@bolttech/template-editor 0.1.1 → 0.1.2

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.
@@ -1,93 +1,81 @@
1
- "use strict";var _2=Object.defineProperty;var I2=(t,e,r)=>e in t?_2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Et=(t,e,r)=>I2(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,"__esModule",{value:!0});const h=require("react/jsx-runtime"),R2=require("react-shadow"),S=require("react"),Q=require("@craftjs/core"),Rt=require("react-icons/ri"),_=require("react-icons/fi"),P2=require("htmlparser2"),z2=require("@monaco-editor/react"),Ei=require("react-dom"),lt=require("react-icons/bi"),jr=require("react-icons/tb"),ns=require("react-icons/lu"),$2=require("@craftjs/utils"),H2=require("re-resizable"),Pr=require("@bolttech/templating-sdk");function Si(t){return t&&t.__esModule?t:{default:t}}function V2(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in t)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:function(){return n[s]}})}}}return Object.freeze(t)}const q2=Si(R2),Be=Si(S),W2=Si(z2),U2=Si(Ei),jh=({text:t="Text",style:e,href:r,...n})=>{const{connectors:{connect:s,drag:o},selected:i}=Q.useNode(c=>({selected:c.events.selected})),{isEnabled:a}=Q.useEditor(c=>({isEnabled:c.options.enabled})),l=()=>({...{fontFamily:"inherit",fontWeight:"500",cursor:i?"pointer":"default",transition:"all 0.2s",padding:"8px 16px",fontSize:"16px",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap",display:"inline-flex",textDecoration:"none",lineHeight:"1.5",alignItems:"center",justifyContent:"center"},...e});return h.jsx("a",{ref:c=>{c&&s(o(c))},style:l(),href:a?void 0:r,target:"_blank",...n,children:t})},J2={props:{text:"Text",target:"_blank",style:{fontFamily:"inherit",fontWeight:"500",cursor:"pointer",transition:"all 0.2s",padding:"8px 16px",fontSize:"16px",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap",display:"inline-flex",textDecoration:"none",lineHeight:"1.5",alignItems:"center",justifyContent:"center"}},displayName:"Anchor",custom:{displayName:"Anchor",settings:["anchor","typography","background","border","spacing"]}};function Jl(){const{actions:{setProp:t},text:e,href:r}=Q.useNode(n=>({text:n.data.props.text,href:n.data.props.href}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Text"}),h.jsx("input",{type:"text",value:e,onChange:n=>t(s=>s.text=n.target.value),className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Link"}),h.jsx("input",{type:"text",value:r||"",onChange:n=>{t(s=>s.href=n.target.value)},className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]})}jh.craft={...J2,related:{settings:Jl}};const Oh=({children:t,style:e,...r})=>{const{connectors:{connect:n,drag:s}}=Q.useNode(i=>({selected:i.events.selected})),o={...e,overflow:"visible",boxSizing:"border-box",...e?.height==="auto"&&{height:"auto",minHeight:e?.minHeight||"50px"}};return h.jsx("div",{ref:i=>{i&&n(s(i))},style:o,...r,children:t})},K2={displayName:"Box",isCanvas:!0,custom:{resizable:!0,settings:["box","default"]},props:{style:{border:"none",borderRadius:"0px",width:"100%",height:"auto",minHeight:"50px"}}};Oh.craft={...K2};const Mt=({options:t,value:e,onChange:r,placeholder:n="Select an option",disabled:s=!1,className:o=""})=>h.jsxs("div",{className:`relative ${o}`,children:[h.jsxs("select",{value:e||"",onChange:i=>r?.(i.target.value),disabled:s,className:`w-full appearance-none rounded-none border border-[#E8E7EE] bg-white px-3 py-2 pr-10 text-sm text-gray-700 transition-all duration-200 hover:border-[#170F4F]/30 hover:bg-gray-50 focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]/20 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-400 ${e?"text-gray-700":"text-gray-500"} `,children:[n&&h.jsx("option",{value:"",disabled:!0,hidden:!0,children:n}),t.map(i=>h.jsx("option",{value:i.value,disabled:i.disabled,children:i.label},i.value))]}),h.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:h.jsx(_.FiChevronDown,{size:16,className:`transition-colors duration-200 ${s?"text-gray-400":"text-gray-500"}`})})]});function Lh(){const{actions:{setProp:t},style:e}=Q.useNode(n=>({style:n.data.props.style})),r=e.display==="block"?"block":e.flexDirection;return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Layout direction"}),h.jsx(Mt,{options:[{value:"row",label:"Row"},{value:"column",label:"Column"},{value:"block",label:"Block"}],value:r,onChange:n=>{t(n==="block"?s=>{s.style.display="block",delete s.style.flexDirection}:s=>{s.style.display="flex",s.style.flexDirection=n})},placeholder:"Choose alignment"})]}),e.display!=="block"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Alignment"}),h.jsx(Mt,{options:[{value:"flex-start",label:"Flex Start"},{value:"flex-end",label:"Flex End"},{value:"center",label:"Center"},{value:"space-between",label:"Space Between"},{value:"space-around",label:"Space Around"},{value:"space-evenly",label:"Space Evenly"}],value:e.justifyContent,onChange:n=>t(s=>s.style.justifyContent=n),placeholder:"Choose alignment"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Gap"}),h.jsx(Mt,{options:[{value:"0px",label:"0"},{value:"4px",label:"4"},{value:"8px",label:"8"},{value:"12px",label:"12"},{value:"16px",label:"16"},{value:"24px",label:"24"},{value:"32px",label:"32"},{value:"48px",label:"48"},{value:"64px",label:"64"}],value:e.gap,onChange:n=>t(s=>s.style.gap=n),placeholder:"Choose gap"})]})]})]})}const _h=({text:t="Button",onClick:e,style:r,...n})=>{const{connectors:{connect:s,drag:o},selected:i}=Q.useNode(l=>({selected:l.events.selected})),a=()=>({...{fontFamily:"inherit",fontWeight:"500",cursor:i?"pointer":"default",transition:"all 0.2s",padding:"8px 16px",fontSize:"16px",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap"},...r});return h.jsx("button",{ref:l=>{l&&s(o(l))},style:a(),className:`${i?"ring-primary-500 ring-2 ring-opacity-50":"hover:ring-2 hover:ring-gray-300 hover:ring-opacity-50"} transition-all duration-200`,onClick:e,...n,children:t})},G2={props:{text:"Button",style:{fontFamily:"inherit",fontWeight:"500",cursor:"pointer",transition:"all 0.2s",padding:"8px 16px",fontSize:"16",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap"}},displayName:"Button",custom:{displayName:"Button",settings:["button","typography","background","border","spacing"]}};function Kl(){const{actions:{setProp:t},text:e,href:r}=Q.useNode(n=>({text:n.data.props.text,href:n.data.props.href}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Button text"}),h.jsx("input",{type:"text",value:e,onChange:n=>t(s=>s.text=n.target.value),className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Link"}),h.jsx("input",{type:"text",value:r||"",onChange:n=>{t(s=>s.onClick=()=>{window.open(n.target.value,"_blank")}),t(s=>s.href=n.target.value)},className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]})}_h.craft={...G2,related:{settings:Kl}};const Ih=({children:t,style:e,renderedChild:r=0,...n})=>{const{connectors:{connect:s,drag:o}}=Q.useNode(d=>({selected:d.events.selected})),i={...e,overflow:"visible",boxSizing:"border-box",...e?.height==="auto"&&{height:"auto",minHeight:e?.minHeight||"50px"}};function a(d){if(!S.isValidElement(d))return null;const f=d.props;return!f||f.children===void 0?null:Be.default.Children.toArray(f.children)}const l=a(t),c=l?l[r-1]:null;return h.jsx("div",{ref:d=>{d&&s(o(d))},style:i,...n,children:c})},Y2={displayName:"Conditional",isCanvas:!0,custom:{resizable:!0,settings:["conditional","default"]},props:{conditions:[{variable:"",operator:"===",value:"",option:"1",isElse:!1}],style:{border:"none",borderRadius:"0px",width:"100%",height:"auto",minHeight:"50px"}}};Ih.craft={...Y2};const _n=({title:t,icon:e,children:r,defaultOpen:n=!1,className:s="",noPadding:o=!1})=>{const i=S.useRef(null),[a,l]=S.useState(n),[c,d]=S.useState(n?void 0:0),f=S.useRef(null);S.useEffect(()=>{i.current&&i.current.parentElement&&i.current.parentElement.firstElementChild===i.current&&!n&&(l(!0),d(void 0))},[n]),S.useEffect(()=>{if(f.current)if(a){const g=f.current.scrollHeight;d(g)}else d(0)},[a]);const m=()=>{l(!a)};return h.jsxs("div",{ref:i,className:`overflow-hidden border border-[#E8E7EE] ${s}`,children:[h.jsxs("button",{onClick:m,className:"flex w-full items-center justify-between border-b border-[#E8E7EE] bg-white px-4 py-3 transition-colors hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-[#170F4F]",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[e,h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:t})]}),h.jsx(_.FiChevronDown,{size:16,className:`text-[#A29FB9] transition-transform duration-200 ${a?"rotate-0":"-rotate-90"}`})]}),h.jsx("div",{ref:f,style:{height:c,overflow:"hidden",transition:"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},"data-testid":`collapse-content-${t.replace(/\s+/g,"-").toLowerCase()}`,children:a&&h.jsx("div",{className:o?"":"bg-white p-4",children:r})})]})};function Rh(){const{renderedChild:t,conditionsProps:e,actions:{setProp:r}}=Q.useNode(y=>({renderedChild:y.data.props.renderedChild,conditionsProps:y.data.props.conditions})),n=[{value:"===",label:"is equal to"},{value:"!==",label:"is not equal to"},{value:">",label:"is greater than"},{value:"<",label:"< is less than"},{value:">=",label:"is greater or equal to",disabled:!0},{value:"<=",label:"is less or equal to",disabled:!0}],[s,o]=S.useState(e||[{variable:"",operator:"===",value:"",option:"1",isElse:!1}]);S.useEffect(()=>{r(y=>y.conditions=s)},[s]);const i=()=>{o(y=>[...y,{variable:"",operator:"===",value:"",option:`${y.length+1}`,isElse:!1}])},a=(y,v,w)=>{o(D=>D.map((E,N)=>N===y?{...E,[v]:w}:E))},l=y=>{o(v=>v.map((w,D)=>D===y?{...w,isElse:!w.isElse}:w))},[c,d]=S.useState(t),f=y=>(y.isElse||!!y.variable&&!!y.operator&&!!y.value)&&!!y.option,m=s[s.length-1],g=m?f(m):!0;return h.jsxs("div",{className:"space-y-2 p-4",children:[h.jsxs("div",{className:"mt-4 whitespace-pre-wrap border bg-gray-50 p-3 text-xs text-gray-600",children:[h.jsx("div",{className:"mb-1 font-semibold",children:"Generated Conditions: (test purposes)"}),s.map((y,v)=>y.option&&h.jsxs("label",{className:"flex items-center space-x-2",children:[h.jsx("input",{type:"radio",name:"condition-option",value:y.option,checked:c===y.option,onChange:()=>{r(w=>w.renderedChild=parseInt(y.option)),d(y.option)},className:"form-radio text-blue-600"}),h.jsx("span",{children:y.isElse?`ELSE → ${y.option}`:`IF ${y.variable} ${y.operator} ${JSON.stringify(y.value)} → ${y.option}`})]},v))]}),s.map((y,v)=>h.jsx(_n,{title:y.isElse?"ELSE":`Condition ${v+1}`,icon:h.jsx(_.FiEdit3,{size:14,className:"text-[#170F4F]"}),defaultOpen:!0,noPadding:!0,children:h.jsxs("div",{className:"relative flex flex-col gap-2 border border-gray-200 bg-gray-50 p-3",children:[v!==0&&h.jsx("button",{type:"button",className:"absolute right-2 top-2 text-gray-400 hover:text-red-500",onClick:()=>{o(w=>w.filter((D,E)=>E!==v))},children:h.jsx(_.FiTrash2,{size:14})}),!y.isElse&&v===s.length-1&&v!==0&&h.jsxs("label",{className:"mt-1 inline-flex items-center space-x-2 text-sm",children:[h.jsx("input",{type:"checkbox",checked:y.isElse,onChange:()=>l(v),disabled:v===0||!s[v-1]?.variable||s.length-1!==v}),h.jsx("span",{children:"Transform to ELSE condition"})]}),!y.isElse&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",placeholder:"Variable (placeholder/tag)",className:"w-full border border-gray-300 px-2 py-1 text-sm",value:y.variable,onChange:w=>a(v,"variable",w.target.value)}),h.jsx(Mt,{value:y.operator,onChange:w=>a(v,"operator",w),options:n}),h.jsx("input",{type:"text",placeholder:"Value",className:"w-full border border-gray-300 px-2 py-1 text-sm",value:y.value,onChange:w=>a(v,"value",w.target.value)})]}),h.jsx("input",{type:"number",placeholder:"Children component (what is rendered if this condition is true)",className:"w-full border border-gray-300 px-2 py-1 text-sm",value:y.option,onChange:w=>a(v,"option",w.target.value),min:1})]},v)})),!s[s.length-1]?.isElse&&h.jsxs("div",{className:"group relative mt-2 inline-block",children:[h.jsx("button",{type:"button",className:`mt-2 px-3 py-1 text-sm text-white ${g?"bg-[#170F4F] hover:bg-blue-700":"cursor-not-allowed bg-gray-400"}`,onClick:i,disabled:!g,children:"Add Condition"}),!g&&h.jsx("div",{className:"absolute left-[75%] top-full z-10 ml-2 mt-1 hidden w-48 rounded bg-black px-2 py-1 text-left text-xs text-white group-hover:block",children:"Before adding a new condition, complete the previous one."})]})]})}function Gl(){const{actions:{setProp:t},style:e}=Q.useNode(r=>({style:r.data.props.style}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Height"}),h.jsx("input",{type:"text",value:e.height,onChange:r=>t(n=>n.style.height=r.target.value),placeholder:"1px",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Width"}),h.jsx("input",{type:"text",value:e.width,onChange:r=>t(n=>n.style.width=r.target.value),placeholder:"100%",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]})}const Yl=({style:t,...e})=>{const{connectors:{connect:r,drag:n},selected:s}=Q.useNode(i=>({selected:i.events.selected})),o={...t,cursor:s?"pointer":"default"};return h.jsx("hr",{ref:i=>{i&&r(n(i))},style:o,className:`${s?"ring-primary-500 ring-2 ring-opacity-50":"hover:ring-2 hover:ring-gray-300 hover:ring-opacity-50"} transition-all duration-200`,...e})};Yl.craft={props:{style:{height:"1px",width:"100%",margin:"16px 0",backgroundColor:"#e5e7eb"}},related:{settings:Gl}};const X2={props:{style:{marginTop:"0px",marginRight:"0px",marginBottom:"0px",marginLeft:"0px",backgroundColor:"#e5e7eb",height:"1px",width:"100%"}},related:{settings:"DividerSettings"},custom:{displayName:"Divider",settings:["divider","background","spacing"]}};Yl.craft={...X2};const Ph=({src:t="https://picsum.photos/id/1/1200/1200",alt:e="Image",style:r,...n})=>{const{connectors:{connect:s,drag:o},selected:i}=Q.useNode(l=>({selected:l.events.selected})),a={...r,cursor:i?"pointer":"default"};return h.jsx("img",{ref:l=>{l&&s(o(l))},src:t,alt:e,style:a,className:`${i?"ring-primary-500 ring-2 ring-opacity-50":"hover:ring-2 hover:ring-gray-300 hover:ring-opacity-50"}`,...n})},Q2={props:{src:"https://picsum.photos/id/1/1200/1200",alt:"Image",style:{width:"200px",height:"200px",objectFit:"cover",borderRadius:"0px"}},custom:{resizable:!0,settings:["image","border"]},related:{settings:"ImageSettings"}};function Xl(){const{actions:{setProp:t},src:e,alt:r,style:n}=Q.useNode(s=>({src:s.data.props.src,alt:s.data.props.alt,style:s.data.props.style}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Image URL"}),h.jsx("input",{type:"text",value:e,onChange:s=>t(o=>o.src=s.target.value),placeholder:"https://example.com/image.jpg",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Alt Text"}),h.jsx("input",{type:"text",value:r,onChange:s=>t(o=>o.alt=s.target.value),placeholder:"Image description",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Width"}),h.jsx("input",{type:"text",value:n.width,onChange:s=>t(o=>o.style.width=s.target.value),placeholder:"100%",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Height"}),h.jsx("input",{type:"text",value:n.height,onChange:s=>t(o=>o.style.height=s.target.value),placeholder:"auto",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Object Fit"}),h.jsx(Mt,{options:[{value:"cover",label:"Cover"},{value:"contain",label:"Contain"},{value:"fill",label:"Fill"},{value:"none",label:"None"},{value:"scale-down",label:"Scale Down"}],value:n.objectFit,onChange:s=>t(o=>o.style.objectFit=s),placeholder:"Choose object fit"})]})]})}Ph.craft={...Q2,related:{settings:Xl}};const zh=({rows:t,columns:e,style:r,children:n,cellStyle:s,rowStyle:o,...i})=>{const{connectors:{connect:a,drag:l}}=Q.useNode(m=>({selected:m.events.selected})),c=()=>({...{borderCollapse:"collapse",border:"1px solid #9CA3AF"},...r}),d=()=>({...o}),f=Array.from({length:t},(m,g)=>Array.from({length:e},(y,v)=>g*e+v));return h.jsx("table",{ref:m=>{m&&a(l(m))},style:c(),...i,children:h.jsx("tbody",{children:f.map((m,g)=>h.jsx("tr",{style:g%2===0?d():{},children:m.map((y,v)=>h.jsx("td",{style:s,children:n?.props?.children?.[g*e+v]||y},v))},g))})})},Z2={displayName:"Table",isCanvas:!0,props:{rows:4,columns:4,style:{borderSpacing:"0px",borderWidth:"1px",borderStyle:"solid",borderColor:"#9CA3AF",width:"100%"},cellStyle:{borderWidth:"1px",borderStyle:"solid",borderColor:"#9CA3AF",padding:"0.5rem 0.75rem",textAlign:"center"},rowStyle:{}},custom:{displayName:"Table",settings:["table","border","layout","background"]}};function In(t,e=300){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function Ql(){const{actions:{setProp:t},rows:e,columns:r,rowStyle:n,cellStyle:s}=Q.useNode(i=>({rows:i.data.props.rows,columns:i.data.props.columns,rowStyle:i.data.props.rowStyle,cellStyle:i.data.props.cellStyle})),o=S.useMemo(()=>In((i,a,l)=>{t(c=>{c[a][l]=i})},300),[t]);return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{className:"flex flex-row space-x-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Rows"}),h.jsx("input",{type:"number",value:e,onChange:i=>t(a=>a.rows=parseInt(i.target.value)),className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Columns"}),h.jsx("input",{type:"number",value:r,onChange:i=>{t(a=>a.columns=parseInt(i.target.value))},className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Rows"}),h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Background Color (odd)"}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:n.backgroundColor,onChange:i=>o(i.target.value,"rowStyle","backgroundColor"),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:n.backgroundColor,onChange:i=>t(a=>a.rowStyle.backgroundColor=i.target.value),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Cells"}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Width"}),h.jsx("div",{className:"mb-2 grid grid-cols-4 gap-1",children:[{value:"0px",label:"0"},{value:"1px",label:"1px"},{value:"2px",label:"2px"},{value:"4px",label:"4px"}].map(i=>h.jsx("button",{onClick:()=>t(a=>a.cellStyle.borderWidth=i.value),className:`border border-[#E8E7EE] px-2 py-2 text-xs transition-all ${s.borderWidth===i.value?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:i.label},i.value))})]}),h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Color"}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:s.borderColor,onChange:i=>o(i.target.value,"cellStyle","borderColor"),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:s.borderColor,onChange:i=>t(a=>a.cellStyle.borderColor=i.target.value),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})]})]})}zh.craft={...Z2,related:{settings:Ql}};const e1=new Set(["Delete","Backspace","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function t1({tagName:t="div",html:e,innerRef:r,onChange:n,disabled:s=!1,editable:o=!0,onBlur:i,onKeyUp:a,onKeyDown:l,...c}){const d=S.useRef(null),f=S.useRef(e),m=S.useRef(!1),g=S.useRef(e),y=S.useCallback(()=>(r&&typeof r!="function"?r:d).current,[r]),v=S.useCallback((B,$)=>Object.assign({},B,{target:{value:$}}),[]),w=S.useCallback(B=>{const $=y();if(!$||!n)return;const O=$.innerHTML;O!==f.current&&(g.current=O,m.current=!0,f.current=O,n(v(B,O)))},[y,n,v]),D=S.useCallback((B,$)=>{if(document.activeElement!==B){$();return}const O=window.getSelection();if(!O||O.rangeCount===0){$();return}const I=O.getRangeAt(0).startOffset;$();try{const q=document.createRange(),J=B.firstChild||B,K=Math.min(I,J.textContent?.length||0);q.setStart(J,K),q.collapse(!0),O.removeAllRanges(),O.addRange(q)}catch{}},[]);S.useEffect(()=>{const B=y();B&&e!==f.current&&!m.current&&D(B,()=>{B.innerHTML=e,g.current=e,f.current=e})},[e,y,D]),S.useEffect(()=>{const B=y();B&&e!==B.innerHTML&&(B.innerHTML=e),g.current=e,f.current=e},[y,e]),S.useEffect(()=>{o||(m.current=!1)},[o]);const E=S.useCallback(B=>{o&&e1.has(B.key)&&B.stopPropagation(),l?.(B),o&&w(B)},[o,l,w]),N=S.useCallback(B=>{o&&B.stopPropagation(),a?.(B),o&&w(B)},[o,a,w]),A=S.useCallback(B=>{o&&(B.stopPropagation(),w(B))},[o,w]),T=S.useCallback(B=>{m.current=!1,i?.(B),o&&w(B)},[o,i,w]),j=S.useCallback(B=>{typeof r=="function"&&r(B),d.current=B},[r]);return Be.default.createElement(t,{...c,ref:typeof r=="function"?j:r||d,contentEditable:!s&&o,suppressContentEditableWarning:!0,onInput:A,onBlur:T,onKeyUp:N,onKeyDown:E,dangerouslySetInnerHTML:{__html:e}})}const $h=Be.default.memo(t1,(t,e)=>!(e.editable===!1||t.editable!==e.editable||t.disabled!==e.disabled||t.tagName!==e.tagName||JSON.stringify(t.style)!==JSON.stringify(e.style)));$h.displayName="ContentEditable";const r1=[{name:"userName",label:"User Name",value:"John Doe"},{name:"userEmail",label:"User Email",value:"john@example.com"},{name:"companyName",label:"Company Name",value:"Acme Corp"},{name:"currentDate",label:"Current Date",value:new Date().toLocaleDateString()},{name:"currentTime",label:"Current Time",value:new Date().toLocaleTimeString()}],n1=({ref:t,editableRef:e,position:r,onVariableInsert:n})=>{const{actions:s,style:o={}}=Q.useNode(w=>({style:w.data.props.style||{}})),[i,a]=S.useState(!1),[l,c]=S.useState(!1),d=w=>{s.setProp(D=>{D.style={...D.style,...w}})},f=()=>{const D=(o.fontWeight||"normal")==="bold"?"normal":"bold";d({fontWeight:D})},m=()=>{const D=(o.fontStyle||"normal")==="italic"?"normal":"italic";d({fontStyle:D})},g=()=>{const w=o.textDecoration||"none",D=String(w).includes("underline")?"none":"underline";d({textDecoration:D})},y=w=>{d({color:w})},v=w=>{if(e.current){e.current.focus();const D=window.getSelection();if(D&&D.rangeCount>0){const E=D.getRangeAt(0);E.deleteContents();const N=document.createElement("span");N.className="variable-tag",N.style.cssText="background: #e3f2fd; border: 1px solid #90caf9; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #1976d2; font-size: 0.9em; cursor: pointer;",N.setAttribute("data-variable",w.name),N.textContent=`{{${w.label}}}`,E.insertNode(N),E.setStartAfter(N),E.collapse(!0),D.removeAllRanges(),D.addRange(E)}}a(!1),n(w.name)};return h.jsx("div",{ref:t,className:"flex flex-wrap gap-2 rounded-lg border border-[#E8E7EE] bg-white p-3 shadow-lg",onMouseDown:w=>w.stopPropagation(),style:{position:"absolute",left:"50%",transform:"translateX(-50%)",zIndex:9999,top:r==="top"?"-70px":void 0,bottom:r==="bottom"?"-70px":void 0},children:h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{className:`flex items-center justify-center border p-2 transition-all duration-200 ${o.fontWeight==="bold"?"border-[#00BAC7] bg-[#CCF1F4] text-[#170F4F]":"border-[#E8E7EE] bg-white text-[#170F4F] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,title:"Bold",onClick:w=>{w.preventDefault(),w.stopPropagation(),f()},children:h.jsx(_.FiBold,{size:14})}),h.jsx("button",{className:`flex items-center justify-center border p-2 transition-all duration-200 ${o.fontStyle==="italic"?"border-[#00BAC7] bg-[#CCF1F4] text-[#170F4F]":"border-[#E8E7EE] bg-white text-[#170F4F] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,title:"Italic",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),m()},children:h.jsx(_.FiItalic,{size:14})}),h.jsx("button",{className:`flex items-center justify-center border p-2 transition-all duration-200 ${String(o.textDecoration).includes("underline")?"border-[#00BAC7] bg-[#CCF1F4] text-[#170F4F]":"border-[#E8E7EE] bg-white text-[#170F4F] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,title:"Underline",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),g()},children:h.jsx(_.FiUnderline,{size:14})}),h.jsx("button",{className:"ml-2 flex items-center justify-center border border-[#E8E7EE] bg-white p-2 text-[#170F4F] transition-all duration-200 hover:border-[#00BAC7] hover:bg-[#CCF1F4]",title:"Text Color",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),c(!l)},children:h.jsx(_.FiEdit3,{size:14})}),l&&h.jsx("input",{type:"color",className:"h-8 w-8 cursor-pointer border border-[#E8E7EE] bg-white hover:border-[#00BAC7]",value:o.color?.toString()||"#000000",onChange:w=>{y(w.target.value),c(!1)}}),h.jsx("button",{className:"flex items-center justify-center border border-[#E8E7EE] bg-white p-2 text-[#170F4F] transition-all duration-200 hover:border-[#00BAC7] hover:bg-[#CCF1F4]",title:"Insert Variable",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),a(!i)},children:h.jsx(_.FiCode,{size:14})}),i&&h.jsx("div",{className:"absolute left-0 top-full z-10 mt-1 border border-[#E8E7EE] bg-white shadow-lg",children:r1.map(w=>h.jsx("button",{className:"block w-full border-none px-3 py-2 text-left text-[#170F4F] transition-colors hover:bg-[#CCF1F4]",onMouseDown:D=>{D.preventDefault(),D.stopPropagation(),v(w)},children:w.label},w.name))})]})})},s1=({isEditing:t=!1,children:e="Double-click to edit text...",style:r={}})=>{const{setProp:n}=Q.useNode(),[s,o]=S.useState("top"),i=S.useRef(null),a=S.useRef(null),l=S.useRef(null),c=S.useCallback(v=>{n(w=>{w.children=v})},[n]),d=S.useCallback(v=>{n(w=>(w.isEditing=v,w))},[n]),f=S.useCallback(v=>{v.preventDefault(),v.stopPropagation(),d(!0),a.current&&(a.current.getBoundingClientRect().top<window.innerHeight*.1?o("bottom"):o("top"))},[a]),m=S.useCallback(v=>{const w=v.target.value;w!==e&&c(w)},[e,c]),g=v=>{if(i.current){const w=window.getSelection();if(w&&w.rangeCount>0){const D=w.getRangeAt(0),E=document.createElement("span");E.setAttribute("data-variable",v),E.style.cssText="background: #e8f5e8; border: 1px solid #4caf50; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #2e7d32; font-size: 0.9em;",E.textContent=`{{${v}}}`,D.deleteContents(),D.insertNode(E),D.setStartAfter(E),D.collapse(!0),w.removeAllRanges(),w.addRange(D);const N=i.current.innerHTML;c(N)}}};S.useEffect(()=>{const v=w=>{if(!t||!a.current)return;const D=w.target;a.current.contains(D)||l.current&&l.current.contains(D)||d(!1)};return t&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[t,d]);const y={cursor:t?"text":"pointer",userSelect:t?"text":"none",...r};return h.jsxs("div",{ref:a,onDoubleClick:f,style:{position:"relative",width:"100%",height:"100%"},children:[t&&h.jsx(n1,{ref:l,editableRef:i,position:s,onVariableInsert:g}),h.jsx($h,{innerRef:v=>{i.current=v},tagName:"p",html:e,editable:t,onChange:m,style:y})]})},Hh=Be.default.memo(s1,(t,e)=>!(t.isEditing!==e.isEditing||t.children!==e.children||JSON.stringify(t.style)!==JSON.stringify(e.style))),o1={displayName:"Text",custom:{resizable:!0,tagHtml:"p",settings:["text","typography","default"]},props:{children:"Double click to edit text 2",isEditing:!1,style:{width:300,height:200,fontSize:16,fontWeight:"normal",color:"#000000",textAlign:"left",minHeight:"50px",padding:"8px",border:"none",outline:"none",overflow:"auto",position:"relative",wordWrap:"break-word",whiteSpace:"normal"}}};Hh.craft={...o1};function Vh(){const{actions:{setProp:t},variableId:e,fallback:r}=Q.useNode(n=>({variableId:n.data.props.variableId,fallback:n.data.props.fallback}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Variable ID"}),h.jsx("input",{type:"text",value:e,onChange:n=>t(s=>s.variableId=n.target.value),placeholder:"ex: nome_usuario",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Default value"}),h.jsx("input",{type:"text",value:r,onChange:n=>t(s=>s.fallback=n.target.value),placeholder:"ex: Usuário",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]})}const i1=({data:t,onSelect:e,selectedPath:r})=>!t||typeof t!="object"?null:h.jsx("div",{className:"space-y-2",children:Object.entries(t).map(([n,s])=>h.jsxs("button",{onClick:()=>e(n,s),className:`block w-full rounded px-3 py-2 text-left transition-colors ${r===n?"bg-blue-100 text-blue-800":"bg-gray-50 text-gray-700 hover:bg-gray-100"}`,children:[h.jsxs("span",{className:"font-medium",children:[n,":"]})," ",h.jsx("span",{className:"text-sm",children:JSON.stringify(s)})]},n))}),a1=({isOpen:t,onClose:e,value:r,onSelect:n})=>{const[s,o]=S.useState(r||""),[i,a]=S.useState(null);return Be.default.useEffect(()=>{const l=localStorage.getItem("bolttech_datasource");if(l)try{const c=JSON.parse(l);c&&typeof c=="object"&&c.data&&a({root:c.data})}catch{}},[t]),t?h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-40",children:h.jsxs("div",{className:"flex w-full max-w-[40vw] flex-col rounded bg-white shadow-xl",children:[h.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4",children:[h.jsx("h2",{className:"text-lg font-bold text-[#170f4f]",children:"Selecionar variável do DataSource"}),h.jsx("button",{onClick:e,className:"p-2 text-gray-400 hover:text-gray-600",children:h.jsx(_.FiX,{size:18})})]}),h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-sm font-medium text-gray-700",children:"Path da variável"}),h.jsx("input",{type:"text",value:s,onChange:l=>o(l.target.value),className:"focus:ring-primary-500 w-full rounded border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2",placeholder:"Ex: root.user.name"})]}),i&&h.jsx("div",{children:h.jsx(i1,{data:i,onSelect:l=>o(l),selectedPath:s})}),h.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[h.jsx("button",{onClick:e,className:"rounded bg-gray-100 px-4 py-2 text-gray-700 transition-colors duration-200 hover:bg-gray-200",children:"Cancelar"}),h.jsx("button",{onClick:()=>{n(s),e()},className:"rounded bg-[#170f4f] px-4 py-2 text-white transition-colors duration-200 hover:bg-[#30aab3]",children:"Salvar"})]})]})]})}):null},qh=({variableId:t="variable",fallback:e="Default value",...r})=>{const{connectors:{connect:n,drag:s},selected:o,actions:{setProp:i}}=Q.useNode(m=>({selected:m.events.selected})),[a,l]=S.useState(!1),c=`{{${t}}}`;let d;try{const m=localStorage.getItem("bolttech_datasource");if(m){const g=JSON.parse(m),y=g&&g.data;y&&t&&(d=t.split(".").reduce((w,D)=>w&&w[D]!==void 0?w[D]:void 0,{root:y}))}}catch{}const f={display:"inline-block",padding:"4px 8px",backgroundColor:"#fef3c7",border:"1px solid #f59e0b",borderRadius:"4px",color:"#92400e",fontFamily:"monospace",fontSize:"14px",cursor:o?"pointer":"default",transition:"all 0.2s"};return h.jsxs(h.Fragment,{children:[h.jsx("span",{ref:m=>{m&&n(s(m))},style:f,className:`${o?"ring-2 ring-yellow-400":"hover:ring-2 hover:ring-yellow-300 hover:ring-opacity-50"} transition-all duration-200`,title:`Variable: ${t}`,onClick:()=>l(!0),...r,children:d!=null?String(d):e||c}),h.jsx(a1,{isOpen:a,onClose:()=>l(!1),value:t,onSelect:m=>i(g=>g.variableId=m)})]})};qh.craft={props:{variableId:"variavel",fallback:"Valor padrão"},related:{settings:Vh}};const Rs=[{id:"box",label:"Box",icon:h.jsx(Rt.RiBox3Line,{size:16}),category:"layout",component:Oh,htmlTags:["div"],settings:Lh},{id:"text",label:"Text",icon:h.jsx(Rt.RiText,{size:16}),category:"content",component:Hh,htmlTags:["p","span","h1","h2","h3","h4","h5","h6"]},{id:"button",label:"Button",icon:h.jsx(Rt.RiSquareLine,{size:16}),category:"interactive",component:_h,settings:Kl,htmlTags:["button"]},{id:"a",label:"Anchor",icon:h.jsx(Rt.RiSquareLine,{size:16}),category:"interactive",component:jh,settings:Jl,htmlTags:["a"]},{id:"image",label:"Image",icon:h.jsx(Rt.RiImageLine,{size:16}),category:"media",component:Ph,settings:Xl,htmlTags:["img"]},{id:"divider",label:"Divider",icon:h.jsx(Rt.RiSeparator,{size:16}),category:"layout",component:Yl,settings:Gl,htmlTags:["hr"]},{id:"table",label:"Table",icon:h.jsx(Rt.RiTableFill,{size:16}),category:"layout",component:zh,settings:Ql,htmlTags:["table"]},{id:"variable",label:"Variable",icon:h.jsx(Rt.RiCodeSSlashLine,{size:16}),category:"dynamic",component:qh,settings:Vh,htmlTags:["span"]},{id:"conditional",label:"Conditional",icon:h.jsx(Rt.RiCodeSSlashLine,{size:16}),category:"dynamic",component:Ih,settings:Rh,htmlTags:["div"]}];function Wh(){const[t,e]=S.useState(!1),[r,n]=S.useState(!1),[s,o]=S.useState(!0);return{showPreview:t,togglePreview:()=>{e(v=>!v),n(!1)},openPreview:()=>{e(!0)},closePreview:()=>{e(!1)},showCodePanel:r,toggleCodePanel:()=>{n(v=>!v)},openCodePanel:()=>{n(!0)},closeCodePanel:()=>{n(!1)},showSidebar:s,toggleSidebar:()=>{o(v=>!v)},isEditorEnabled:!(t||r),setIsEditorEnabled:v=>{e(!v),n(!v)}}}const Uh={mobile:{width:375,height:667},tablet:{width:768,height:1024},desktop:{width:1200,height:800}};function Fi(){const{setIsEditorEnabled:t}=Wh(),{query:e,actions:r}=Q.useEditor(),{nodes:n}=Q.useEditor(c=>({nodes:c.nodes})),s=S.useMemo(()=>Object.keys(n).length>1,[n]),[o,i]=S.useState("desktop");return S.useEffect(()=>{const c=e.node("ROOT").get();c&&r.setProp(c.id,d=>{d.style={...d.style||{},maxWidth:Uh[o].width||"100%"}})},[o]),{device:o,isEmpty:s,setDevice:i,getState:()=>{t(!1);try{return e.serialize()}catch(c){return console.warn("Error serializing canvas:",c),""}finally{t(!0)}},loadState:c=>{try{if(!c.includes("ROOT")){const d=JSON.parse(c),f={type:"div",isCanvas:!0,props:{id:"canvas",className:"relative flex-1 border border-gray-300 shadow-lg",style:{zIndex:1,minHeight:"100%",overflow:"visible",position:"relative",maxWidth:1200,background:`repeating-linear-gradient(
2
- to bottom,
3
- white 0px,
4
- white 1555px,
5
- red 1555px,
6
- red 1556px
7
- )`}},displayName:"div",custom:{},hidden:!1,nodes:Object.keys(d),linkedNodes:{}};c=JSON.stringify(f)}return r.deserialize(c)}catch(d){console.error("Error loading snapshot into canvas:",d)}}}}const l1=new Set(["div","span","p","h1","h2","h3","h4","h5","h6","a","img","button","input","textarea","select","option","ul","ol","li","table","tr","td","th","thead","tbody","section","article","header","footer","nav","main","aside"]),u1=new Set(["img","input","br","hr","meta","link","area","base","col","embed","source","track","wbr"]),c1=new Set(["id","className","title","alt","src","href","target","rel"]),d1=new Set(["width","height","min-width","min-height","max-width","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","border-width","border-top-width","border-right-width","border-bottom-width","border-left-width","top","right","bottom","left","font-size","line-height","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius","letter-spacing","word-spacing","text-indent","text-decoration-thickness"]);class p1{constructor(e={}){Et(this,"options");this.options={inlineStyles:!0,prettify:!1,includeComments:!1,customComponentMap:{},styleTransformers:[],...e}}convert(e){try{const r=e.ROOT;if(!r||!r.nodes)return"";const n=this.buildHTMLFromNodes(r.nodes,e);return this.options.prettify?this.prettifyHTML(n):n}catch(r){return console.error("craftJSToHTML - Error during conversion:",r),""}}buildHTMLFromNodes(e,r){return e.map(n=>this.buildHTMLFromNode(n,r)).filter(n=>n.trim()!=="").join("")}buildHTMLFromNode(e,r){const n=r[e];if(!n||n.hidden)return"";const{type:s,props:o={},nodes:i=[]}=n,a=typeof s=="object"&&s&&"resolvedName"in s?s.resolvedName:s,l=this.getTagName(a,n),c=this.buildAttributes(o);let d="";if(a==="conditional"){const g=i.map(y=>this.buildHTMLFromNodes([y],r));return this.generateConditionalHtml(n,g)}else if(l!=="table")d=this.buildHTMLFromNodes(i,r),o.children&&typeof o.children=="string"&&(d+=o.children),["button","a"].includes(l)&&o.text&&(d+=o.text);else{const g=i.map(y=>this.buildHTMLFromNodes([y],r));d+=this.generateTableHTML(n,g)}return this.isSelfClosingTag(l)?`<${l}${c} />`:`${this.options.includeComments?`<!-- ${a} -->`:""}<${l==="p"?"div":l}${c}>${d}</${l==="p"?"div":l}>`}getTagName(e,r){if(r.custom?.tagName&&typeof r.custom.tagName=="string")return r.custom.tagName.toLowerCase();if(r.custom?.tagHtml&&typeof r.custom.tagHtml=="string")return r.custom.tagHtml.toLowerCase();if(this.options.customComponentMap?.[e])return this.options.customComponentMap[e];const n={image:"img",button:"button",text:"p",divider:"hr",variable:"span",box:"div"};if(n[e])return n[e];const s=e.toLowerCase();return l1.has(s)?s:"div"}buildAttributes(e){const r=[];for(const n of c1)if(e[n]){const s=n==="className"?"class":n;r.push(`${s}="${this.escapeHTML(e[n])}"`)}if(e.style&&this.options.inlineStyles){const n=this.convertStyleObjectToCSS(e.style);n&&r.push(`style="${n}"`)}for(const[n,s]of Object.entries(e))n.startsWith("data-")&&typeof s=="string"&&r.push(`${n}="${this.escapeHTML(s)}"`);return r.length>0?` ${r.join(" ")}`:""}convertStyleObjectToCSS(e){if(!e||typeof e!="object")return"";const r=[];for(const[n,s]of Object.entries(e)){if(s==null)continue;const o=this.camelToKebabCase(n);let i=this.applStyleTransformers(n,s);i=this.addUnitIfNeeded(o,i),r.push(`${o}: ${i}`)}return r.join("; ")}camelToKebabCase(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}applStyleTransformers(e,r){const n=this.options.styleTransformers?.find(s=>s.property===e);return n?n.transform(r):String(r)}addUnitIfNeeded(e,r){const n=parseFloat(r);return!isNaN(n)&&d1.has(e)&&!r.includes("px")&&!r.includes("%")&&!r.includes("em")&&!r.includes("rem")&&!r.includes("vh")&&!r.includes("vw")?`${n}px`:r}isSelfClosingTag(e){return u1.has(e.toLowerCase())}escapeHTML(e){const r=document.createElement("div");return r.textContent=e,r.innerHTML}prettifyHTML(e){let r="",n=0;const s=" ";return e.split(/>\s*</).forEach((o,i)=>{i!==0&&(o=`<${o}`),i!==e.split(/>\s*</).length-1&&(o=`${o}>`),o.match(/^<\/\w/)&&n--,r+=`${s.repeat(Math.max(0,n))+o}
8
- `,o.match(/^<\w[^>]*[^/]$/)&&n++}),r.trim()}generateTableHTML(e,r){let n="";for(let s=0;s<e.props?.rows;s++){n+=`<tr style="${s%2===0?this.convertStyleObjectToCSS(e.props?.rowStyle):""}">`;for(let o=0;o<e.props?.columns;o++)n+=`<td style="${this.convertStyleObjectToCSS(e.props?.cellStyle)}">${r[s*e.props?.columns+o]||""}</td>`;n+="</tr>"}return n}generateConditionalHtml(e,r){return h1(e.props?.conditions,r)}}function h1(t,e){const r={"===":"eq","!==":"ne",">":"gt","<":"lt",">=":"gte","<=":"lte"};let n="",s=!1;return t.forEach(o=>{if(o.isElse){n+=`{{else}}
1
+ "use strict";var z2=Object.defineProperty;var $2=(t,e,r)=>e in t?z2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var It=(t,e,r)=>$2(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,"__esModule",{value:!0});const h=require("react/jsx-runtime"),H2=require("react-shadow"),F=require("react"),Q=require("@craftjs/core"),nr=require("react-icons/ri"),I=require("react-icons/fi"),V2=require("htmlparser2"),q2=require("@monaco-editor/react"),Ni=require("react-dom"),ut=require("react-icons/bi"),Or=require("react-icons/tb"),is=require("react-icons/lu"),W2=require("@craftjs/utils"),U2=require("re-resizable"),zr=require("@bolttech/templating-sdk");function Ti(t){return t&&t.__esModule?t:{default:t}}function K2(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in t)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:function(){return n[s]}})}}}return Object.freeze(t)}const J2=Ti(H2),ze=Ti(F),G2=Ti(q2),Y2=Ti(Ni),Ih=({text:t="Text",style:e,href:r,...n})=>{const{connectors:{connect:s,drag:o},selected:i}=Q.useNode(c=>({selected:c.events.selected})),{isEnabled:a}=Q.useEditor(c=>({isEnabled:c.options.enabled})),l=()=>({...{fontFamily:"inherit",fontWeight:"500",cursor:i?"pointer":"default",transition:"all 0.2s",padding:"8px 16px",fontSize:"16px",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap",display:"inline-flex",textDecoration:"none",lineHeight:"1.5",alignItems:"center",justifyContent:"center"},...e});return h.jsx("a",{ref:c=>{c&&s(o(c))},style:l(),href:a?void 0:r,target:"_blank",...n,children:t})},Z2={props:{text:"Text",target:"_blank",style:{fontFamily:"inherit",fontWeight:"500",cursor:"pointer",transition:"all 0.2s",padding:"8px 16px",fontSize:"16px",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap",display:"inline-flex",textDecoration:"none",lineHeight:"1.5",alignItems:"center",justifyContent:"center"}},displayName:"Anchor",custom:{displayName:"Anchor",settings:["anchor","typography","background","border","spacing"]}};function Gl(){const{actions:{setProp:t},text:e,href:r}=Q.useNode(n=>({text:n.data.props.text,href:n.data.props.href}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Text"}),h.jsx("input",{type:"text",value:e,onChange:n=>t(s=>s.text=n.target.value),className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Link"}),h.jsx("input",{type:"text",value:r||"",onChange:n=>{t(s=>s.href=n.target.value)},className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]})}Ih.craft={...Z2,related:{settings:Gl}};const Rh=({children:t,style:e,...r})=>{const{connectors:{connect:n,drag:s}}=Q.useNode(i=>({selected:i.events.selected})),o={...e,overflow:"visible",boxSizing:"border-box",...e?.height==="auto"&&{height:"auto",minHeight:e?.minHeight||"50px"}};return h.jsx("div",{ref:i=>{i&&n(s(i))},style:o,...r,children:t})},X2={displayName:"Box",isCanvas:!0,custom:{displayName:"Box",resizable:!0,settings:["box","default"]},props:{style:{border:"none",borderRadius:"0px",width:"100%",height:"auto",minHeight:"50px"}}};Rh.craft={...X2};const Tt=({options:t,value:e,onChange:r,placeholder:n="Select an option",disabled:s=!1,className:o=""})=>h.jsxs("div",{className:`relative ${o}`,children:[h.jsxs("select",{value:e||"",onChange:i=>r?.(i.target.value),disabled:s,className:`w-full appearance-none rounded-none border border-[#E8E7EE] bg-white px-3 py-2 pr-10 text-sm text-gray-700 transition-all duration-200 hover:border-[#170F4F]/30 hover:bg-gray-50 focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]/20 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-400 ${e?"text-gray-700":"text-gray-500"} `,children:[n&&h.jsx("option",{value:"",disabled:!0,hidden:!0,children:n}),t.map(i=>h.jsx("option",{value:i.value,disabled:i.disabled,children:i.label},i.value))]}),h.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:h.jsx(I.FiChevronDown,{size:16,className:`transition-colors duration-200 ${s?"text-gray-400":"text-gray-500"}`})})]});function Ph(){const{actions:{setProp:t},style:e}=Q.useNode(n=>({style:n.data.props.style})),r=e.display==="block"?"block":e.flexDirection;return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Layout direction"}),h.jsx(Tt,{options:[{value:"row",label:"Row"},{value:"column",label:"Column"},{value:"block",label:"Block"}],value:r,onChange:n=>{t(n==="block"?s=>{s.style.display="block",delete s.style.flexDirection}:s=>{s.style.display="flex",s.style.flexDirection=n})},placeholder:"Choose alignment"})]}),e.display!=="block"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Alignment"}),h.jsx(Tt,{options:[{value:"flex-start",label:"Flex Start"},{value:"flex-end",label:"Flex End"},{value:"center",label:"Center"},{value:"space-between",label:"Space Between"},{value:"space-around",label:"Space Around"},{value:"space-evenly",label:"Space Evenly"}],value:e.justifyContent,onChange:n=>t(s=>s.style.justifyContent=n),placeholder:"Choose alignment"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Gap"}),h.jsx(Tt,{options:[{value:"0px",label:"0"},{value:"4px",label:"4"},{value:"8px",label:"8"},{value:"12px",label:"12"},{value:"16px",label:"16"},{value:"24px",label:"24"},{value:"32px",label:"32"},{value:"48px",label:"48"},{value:"64px",label:"64"}],value:e.gap,onChange:n=>t(s=>s.style.gap=n),placeholder:"Choose gap"})]})]})]})}const zh=({text:t="Button",onClick:e,style:r,...n})=>{const{connectors:{connect:s,drag:o},selected:i}=Q.useNode(l=>({selected:l.events.selected})),a=()=>({...{fontFamily:"inherit",fontWeight:"500",cursor:i?"pointer":"default",transition:"all 0.2s",padding:"8px 16px",fontSize:"16px",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap"},...r});return h.jsx("button",{ref:l=>{l&&s(o(l))},style:a(),className:`${i?"ring-primary-500 ring-2 ring-opacity-50":"hover:ring-2 hover:ring-gray-300 hover:ring-opacity-50"} transition-all duration-200`,onClick:e,...n,children:t})},Q2={props:{text:"Button",style:{fontFamily:"inherit",fontWeight:"500",cursor:"pointer",transition:"all 0.2s",padding:"8px 16px",fontSize:"16",backgroundColor:"#3b82f6",color:"#ffffff",borderRadius:"8px",borderStyle:"none",whiteSpace:"nowrap"}},displayName:"Button",custom:{displayName:"Button",settings:["button","typography","background","border","spacing"]}};function Yl(){const{actions:{setProp:t},text:e,href:r}=Q.useNode(n=>({text:n.data.props.text,href:n.data.props.href}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Button text"}),h.jsx("input",{type:"text",value:e,onChange:n=>t(s=>s.text=n.target.value),className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Link"}),h.jsx("input",{type:"text",value:r||"",onChange:n=>{t(s=>s.onClick=()=>{window.open(n.target.value,"_blank")}),t(s=>s.href=n.target.value)},className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]})}zh.craft={...Q2,related:{settings:Yl}};const $h=({children:t,style:e,renderedChild:r=0,...n})=>{const{connectors:{connect:s,drag:o}}=Q.useNode(d=>({selected:d.events.selected})),i={...e,overflow:"visible",boxSizing:"border-box",...e?.height==="auto"&&{height:"auto",minHeight:e?.minHeight||"50px"}};function a(d){if(!F.isValidElement(d))return null;const f=d.props;return!f||f.children===void 0?null:ze.default.Children.toArray(f.children)}const l=a(t),c=l?l[r-1]:null;return h.jsx("div",{ref:d=>{d&&s(o(d))},style:i,...n,children:c})},e1={displayName:"Conditional",isCanvas:!0,custom:{displayName:"Conditional",resizable:!0,settings:["conditional","default"]},props:{conditions:[{variable:"",operator:"===",value:"",option:"1",isElse:!1}],style:{border:"none",borderRadius:"0px",width:"100%",height:"auto",minHeight:"50px"}}};$h.craft={...e1};const In=({title:t,icon:e,children:r,defaultOpen:n=!1,className:s="",noPadding:o=!1})=>{const i=F.useRef(null),[a,l]=F.useState(n),[c,d]=F.useState(n?void 0:0),f=F.useRef(null);F.useEffect(()=>{i.current&&i.current.parentElement&&i.current.parentElement.firstElementChild===i.current&&!n&&(l(!0),d(void 0))},[n]),F.useEffect(()=>{if(f.current)if(a){const g=f.current.scrollHeight;d(g)}else d(0)},[a]);const m=()=>{l(!a)};return h.jsxs("div",{ref:i,className:`overflow-hidden border border-[#E8E7EE] ${s}`,children:[h.jsxs("button",{onClick:m,className:"flex w-full items-center justify-between border-b border-[#E8E7EE] bg-white px-4 py-3 transition-colors hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-[#170F4F]",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[e,h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:t})]}),h.jsx(I.FiChevronDown,{size:16,className:`text-[#A29FB9] transition-transform duration-200 ${a?"rotate-0":"-rotate-90"}`})]}),h.jsx("div",{ref:f,style:{height:c,overflow:"hidden",transition:"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},"data-testid":`collapse-content-${t.replace(/\s+/g,"-").toLowerCase()}`,children:a&&h.jsx("div",{className:o?"":"bg-white p-4",children:r})})]})};function Hh(){const{renderedChild:t,conditionsProps:e,actions:{setProp:r}}=Q.useNode(y=>({renderedChild:y.data.props.renderedChild,conditionsProps:y.data.props.conditions})),n=[{value:"===",label:"is equal to"},{value:"!==",label:"is not equal to"},{value:">",label:"is greater than"},{value:"<",label:"< is less than"},{value:">=",label:"is greater or equal to",disabled:!0},{value:"<=",label:"is less or equal to",disabled:!0}],[s,o]=F.useState(e||[{variable:"",operator:"===",value:"",option:"1",isElse:!1}]);F.useEffect(()=>{r(y=>y.conditions=s)},[s]);const i=()=>{o(y=>[...y,{variable:"",operator:"===",value:"",option:`${y.length+1}`,isElse:!1}])},a=(y,x,w)=>{o(D=>D.map((E,S)=>S===y?{...E,[x]:w}:E))},l=y=>{o(x=>x.map((w,D)=>D===y?{...w,isElse:!w.isElse}:w))},[c,d]=F.useState(t),f=y=>(y.isElse||!!y.variable&&!!y.operator&&!!y.value)&&!!y.option,m=s[s.length-1],g=m?f(m):!0;return h.jsxs("div",{className:"space-y-2 p-4",children:[h.jsxs("div",{className:"mt-4 whitespace-pre-wrap border bg-gray-50 p-3 text-xs text-gray-600",children:[h.jsx("div",{className:"mb-1 font-semibold",children:"Generated Conditions: (test purposes)"}),s.map((y,x)=>y.option&&h.jsxs("label",{className:"flex items-center space-x-2",children:[h.jsx("input",{type:"radio",name:"condition-option",value:y.option,checked:c===y.option,onChange:()=>{r(w=>w.renderedChild=parseInt(y.option)),d(y.option)},className:"form-radio text-blue-600"}),h.jsx("span",{children:y.isElse?`ELSE → ${y.option}`:`IF ${y.variable} ${y.operator} ${JSON.stringify(y.value)} → ${y.option}`})]},x))]}),s.map((y,x)=>h.jsx(In,{title:y.isElse?"ELSE":`Condition ${x+1}`,icon:h.jsx(I.FiEdit3,{size:14,className:"text-[#170F4F]"}),defaultOpen:!0,noPadding:!0,children:h.jsxs("div",{className:"relative flex flex-col gap-2 border border-gray-200 bg-gray-50 p-3",children:[x!==0&&h.jsx("button",{type:"button",className:"absolute right-2 top-2 text-gray-400 hover:text-red-500",onClick:()=>{o(w=>w.filter((D,E)=>E!==x))},children:h.jsx(I.FiTrash2,{size:14})}),!y.isElse&&x===s.length-1&&x!==0&&h.jsxs("label",{className:"mt-1 inline-flex items-center space-x-2 text-sm",children:[h.jsx("input",{type:"checkbox",checked:y.isElse,onChange:()=>l(x),disabled:x===0||!s[x-1]?.variable||s.length-1!==x}),h.jsx("span",{children:"Transform to ELSE condition"})]}),!y.isElse&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",placeholder:"Variable (placeholder/tag)",className:"w-full border border-gray-300 px-2 py-1 text-sm",value:y.variable,onChange:w=>a(x,"variable",w.target.value)}),h.jsx(Tt,{value:y.operator,onChange:w=>a(x,"operator",w),options:n}),h.jsx("input",{type:"text",placeholder:"Value",className:"w-full border border-gray-300 px-2 py-1 text-sm",value:y.value,onChange:w=>a(x,"value",w.target.value)})]}),h.jsx("input",{type:"number",placeholder:"Children component (what is rendered if this condition is true)",className:"w-full border border-gray-300 px-2 py-1 text-sm",value:y.option,onChange:w=>a(x,"option",w.target.value),min:1})]},x)})),!s[s.length-1]?.isElse&&h.jsxs("div",{className:"group relative mt-2 inline-block",children:[h.jsx("button",{type:"button",className:`mt-2 px-3 py-1 text-sm text-white ${g?"bg-[#170F4F] hover:bg-blue-700":"cursor-not-allowed bg-gray-400"}`,onClick:i,disabled:!g,children:"Add Condition"}),!g&&h.jsx("div",{className:"absolute left-[75%] top-full z-10 ml-2 mt-1 hidden w-48 rounded bg-black px-2 py-1 text-left text-xs text-white group-hover:block",children:"Before adding a new condition, complete the previous one."})]})]})}function Zl(){const{actions:{setProp:t},style:e}=Q.useNode(r=>({style:r.data.props.style}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Height"}),h.jsx("input",{type:"text",value:e.height,onChange:r=>t(n=>n.style.height=r.target.value),placeholder:"1px",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Width"}),h.jsx("input",{type:"text",value:e.width,onChange:r=>t(n=>n.style.width=r.target.value),placeholder:"100%",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]})}const Xl=({style:t,...e})=>{const{connectors:{connect:r,drag:n},selected:s}=Q.useNode(i=>({selected:i.events.selected})),o={...t,cursor:s?"pointer":"default"};return h.jsx("hr",{ref:i=>{i&&r(n(i))},style:o,className:`${s?"ring-primary-500 ring-2 ring-opacity-50":"hover:ring-2 hover:ring-gray-300 hover:ring-opacity-50"} transition-all duration-200`,...e})};Xl.craft={props:{style:{height:"1px",width:"100%",margin:"16px 0",backgroundColor:"#e5e7eb"}},related:{settings:Zl}};const t1={props:{style:{marginTop:"0px",marginRight:"0px",marginBottom:"0px",marginLeft:"0px",backgroundColor:"#e5e7eb",height:"1px",width:"100%"}},related:{settings:"DividerSettings"},custom:{displayName:"Divider",settings:["divider","background","spacing"]}};Xl.craft={...t1};const Vh=({src:t="https://picsum.photos/id/1/1200/1200",alt:e="Image",style:r,...n})=>{const{connectors:{connect:s,drag:o},selected:i}=Q.useNode(l=>({selected:l.events.selected})),a={...r,cursor:i?"pointer":"default"};return h.jsx("img",{ref:l=>{l&&s(o(l))},src:t,alt:e,style:a,className:`${i?"ring-primary-500 ring-2 ring-opacity-50":"hover:ring-2 hover:ring-gray-300 hover:ring-opacity-50"}`,...n})},r1={props:{src:"https://picsum.photos/id/1/1200/1200",alt:"Image",style:{width:"200px",height:"200px",objectFit:"cover",borderRadius:"0px"}},custom:{displayName:"Image",resizable:!0,settings:["image","border"]},related:{settings:"ImageSettings"}};function Ql(){const{actions:{setProp:t},src:e,alt:r,style:n}=Q.useNode(s=>({src:s.data.props.src,alt:s.data.props.alt,style:s.data.props.style}));return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Image URL"}),h.jsx("input",{type:"text",value:e,onChange:s=>t(o=>o.src=s.target.value),placeholder:"https://example.com/image.jpg",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Alt Text"}),h.jsx("input",{type:"text",value:r,onChange:s=>t(o=>o.alt=s.target.value),placeholder:"Image description",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Width"}),h.jsx("input",{type:"text",value:n.width,onChange:s=>t(o=>o.style.width=s.target.value),placeholder:"100%",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Height"}),h.jsx("input",{type:"text",value:n.height,onChange:s=>t(o=>o.style.height=s.target.value),placeholder:"auto",className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Object Fit"}),h.jsx(Tt,{options:[{value:"cover",label:"Cover"},{value:"contain",label:"Contain"},{value:"fill",label:"Fill"},{value:"none",label:"None"},{value:"scale-down",label:"Scale Down"}],value:n.objectFit,onChange:s=>t(o=>o.style.objectFit=s),placeholder:"Choose object fit"})]})]})}Vh.craft={...r1,related:{settings:Ql}};const qh=({rows:t,columns:e,style:r,children:n,cellStyle:s,rowStyle:o,...i})=>{const{connectors:{connect:a,drag:l}}=Q.useNode(m=>({selected:m.events.selected})),c=()=>({...{borderCollapse:"collapse",border:"1px solid #9CA3AF"},...r}),d=()=>({...o}),f=Array.from({length:t},(m,g)=>Array.from({length:e},(y,x)=>g*e+x));return h.jsx("table",{ref:m=>{m&&a(l(m))},style:c(),...i,children:h.jsx("tbody",{children:f.map((m,g)=>h.jsx("tr",{style:g%2===0?d():{},children:m.map((y,x)=>h.jsx("td",{style:s,children:n?.props?.children?.[g*e+x]||y},x))},g))})})},n1={displayName:"Table",isCanvas:!0,props:{rows:4,columns:4,style:{borderSpacing:"0px",borderWidth:"1px",borderStyle:"solid",borderColor:"#9CA3AF",width:"100%"},cellStyle:{borderWidth:"1px",borderStyle:"solid",borderColor:"#9CA3AF",padding:"0.5rem 0.75rem",textAlign:"center"},rowStyle:{}},custom:{displayName:"Table",settings:["table","border","layout","background"]}};function Rn(t,e=300){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function eu(){const{actions:{setProp:t},rows:e,columns:r,rowStyle:n,cellStyle:s}=Q.useNode(i=>({rows:i.data.props.rows,columns:i.data.props.columns,rowStyle:i.data.props.rowStyle,cellStyle:i.data.props.cellStyle})),o=F.useMemo(()=>Rn((i,a,l)=>{t(c=>{c[a][l]=i})},300),[t]);return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{className:"flex flex-row space-x-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Rows"}),h.jsx("input",{type:"number",value:e,onChange:i=>t(a=>a.rows=parseInt(i.target.value)),className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Columns"}),h.jsx("input",{type:"number",value:r,onChange:i=>{t(a=>a.columns=parseInt(i.target.value))},className:"focus:ring-primary-500 w-full rounded-md border border-gray-300 px-3 py-2 focus:outline-none focus:ring-2"})]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Rows"}),h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Background Color (odd)"}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:n.backgroundColor,onChange:i=>o(i.target.value,"rowStyle","backgroundColor"),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:n.backgroundColor,onChange:i=>t(a=>a.rowStyle.backgroundColor=i.target.value),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Cells"}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Width"}),h.jsx("div",{className:"mb-2 grid grid-cols-4 gap-1",children:[{value:"0px",label:"0"},{value:"1px",label:"1px"},{value:"2px",label:"2px"},{value:"4px",label:"4px"}].map(i=>h.jsx("button",{onClick:()=>t(a=>a.cellStyle.borderWidth=i.value),className:`border border-[#E8E7EE] px-2 py-2 text-xs transition-all ${s.borderWidth===i.value?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:i.label},i.value))})]}),h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Color"}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:s.borderColor,onChange:i=>o(i.target.value,"cellStyle","borderColor"),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:s.borderColor,onChange:i=>t(a=>a.cellStyle.borderColor=i.target.value),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})]})]})}qh.craft={...n1,related:{settings:eu}};const s1=new Set(["Delete","Backspace","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function o1({tagName:t="div",html:e,innerRef:r,onChange:n,disabled:s=!1,editable:o=!0,onBlur:i,onKeyUp:a,onKeyDown:l,...c}){const d=F.useRef(null),f=F.useRef(e),m=F.useRef(!1),g=F.useRef(e),y=F.useCallback(()=>(r&&typeof r!="function"?r:d).current,[r]),x=F.useCallback((B,$)=>Object.assign({},B,{target:{value:$}}),[]),w=F.useCallback(B=>{const $=y();if(!$||!n)return;const O=$.innerHTML;O!==f.current&&(g.current=O,m.current=!0,f.current=O,n(x(B,O)))},[y,n,x]),D=F.useCallback((B,$)=>{if(document.activeElement!==B){$();return}const O=window.getSelection();if(!O||O.rangeCount===0){$();return}const L=O.getRangeAt(0).startOffset;$();try{const H=document.createRange(),Y=B.firstChild||B,q=Math.min(L,Y.textContent?.length||0);H.setStart(Y,q),H.collapse(!0),O.removeAllRanges(),O.addRange(H)}catch{}},[]);F.useEffect(()=>{const B=y();B&&e!==f.current&&!m.current&&D(B,()=>{B.innerHTML=e,g.current=e,f.current=e})},[e,y,D]),F.useEffect(()=>{const B=y();B&&e!==B.innerHTML&&(B.innerHTML=e),g.current=e,f.current=e},[y,e]),F.useEffect(()=>{o||(m.current=!1)},[o]);const E=F.useCallback(B=>{o&&s1.has(B.key)&&B.stopPropagation(),l?.(B),o&&w(B)},[o,l,w]),S=F.useCallback(B=>{o&&B.stopPropagation(),a?.(B),o&&w(B)},[o,a,w]),A=F.useCallback(B=>{o&&(B.stopPropagation(),w(B))},[o,w]),T=F.useCallback(B=>{m.current=!1,i?.(B),o&&w(B)},[o,i,w]),j=F.useCallback(B=>{typeof r=="function"&&r(B),d.current=B},[r]);return ze.default.createElement(t,{...c,ref:typeof r=="function"?j:r||d,contentEditable:!s&&o,suppressContentEditableWarning:!0,onInput:A,onBlur:T,onKeyUp:S,onKeyDown:E,dangerouslySetInnerHTML:{__html:e}})}const Wh=ze.default.memo(o1,(t,e)=>!(e.editable===!1||t.editable!==e.editable||t.disabled!==e.disabled||t.tagName!==e.tagName||JSON.stringify(t.style)!==JSON.stringify(e.style)));Wh.displayName="ContentEditable";const i1=[{name:"userName",label:"User Name",value:"John Doe"},{name:"userEmail",label:"User Email",value:"john@example.com"},{name:"companyName",label:"Company Name",value:"Acme Corp"},{name:"currentDate",label:"Current Date",value:new Date().toLocaleDateString()},{name:"currentTime",label:"Current Time",value:new Date().toLocaleTimeString()}],a1=({ref:t,editableRef:e,position:r,onVariableInsert:n})=>{const{actions:s,style:o={}}=Q.useNode(w=>({style:w.data.props.style||{}})),[i,a]=F.useState(!1),[l,c]=F.useState(!1),d=w=>{s.setProp(D=>{D.style={...D.style,...w}})},f=()=>{const D=(o.fontWeight||"normal")==="bold"?"normal":"bold";d({fontWeight:D})},m=()=>{const D=(o.fontStyle||"normal")==="italic"?"normal":"italic";d({fontStyle:D})},g=()=>{const w=o.textDecoration||"none",D=String(w).includes("underline")?"none":"underline";d({textDecoration:D})},y=w=>{d({color:w})},x=w=>{if(e.current){e.current.focus();const D=window.getSelection();if(D&&D.rangeCount>0){const E=D.getRangeAt(0);E.deleteContents();const S=document.createElement("span");S.className="variable-tag",S.style.cssText="background: #e3f2fd; border: 1px solid #90caf9; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #1976d2; font-size: 0.9em; cursor: pointer;",S.setAttribute("data-variable",w.name),S.textContent=`{{${w.label}}}`,E.insertNode(S),E.setStartAfter(S),E.collapse(!0),D.removeAllRanges(),D.addRange(E)}}a(!1),n(w.name)};return h.jsx("div",{ref:t,className:"flex flex-wrap gap-2 rounded-lg border border-[#E8E7EE] bg-white p-3 shadow-lg",onMouseDown:w=>w.stopPropagation(),style:{position:"absolute",left:"50%",transform:"translateX(-50%)",zIndex:9999,top:r==="top"?"-70px":void 0,bottom:r==="bottom"?"-70px":void 0},children:h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{className:`flex items-center justify-center border p-2 transition-all duration-200 ${o.fontWeight==="bold"?"border-[#00BAC7] bg-[#CCF1F4] text-[#170F4F]":"border-[#E8E7EE] bg-white text-[#170F4F] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,title:"Bold",onClick:w=>{w.preventDefault(),w.stopPropagation(),f()},children:h.jsx(I.FiBold,{size:14})}),h.jsx("button",{className:`flex items-center justify-center border p-2 transition-all duration-200 ${o.fontStyle==="italic"?"border-[#00BAC7] bg-[#CCF1F4] text-[#170F4F]":"border-[#E8E7EE] bg-white text-[#170F4F] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,title:"Italic",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),m()},children:h.jsx(I.FiItalic,{size:14})}),h.jsx("button",{className:`flex items-center justify-center border p-2 transition-all duration-200 ${String(o.textDecoration).includes("underline")?"border-[#00BAC7] bg-[#CCF1F4] text-[#170F4F]":"border-[#E8E7EE] bg-white text-[#170F4F] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,title:"Underline",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),g()},children:h.jsx(I.FiUnderline,{size:14})}),h.jsx("button",{className:"ml-2 flex items-center justify-center border border-[#E8E7EE] bg-white p-2 text-[#170F4F] transition-all duration-200 hover:border-[#00BAC7] hover:bg-[#CCF1F4]",title:"Text Color",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),c(!l)},children:h.jsx(I.FiEdit3,{size:14})}),l&&h.jsx("input",{type:"color",className:"h-8 w-8 cursor-pointer border border-[#E8E7EE] bg-white hover:border-[#00BAC7]",value:o.color?.toString()||"#000000",onChange:w=>{y(w.target.value),c(!1)}}),h.jsx("button",{className:"flex items-center justify-center border border-[#E8E7EE] bg-white p-2 text-[#170F4F] transition-all duration-200 hover:border-[#00BAC7] hover:bg-[#CCF1F4]",title:"Insert Variable",onMouseDown:w=>{w.preventDefault(),w.stopPropagation(),a(!i)},children:h.jsx(I.FiCode,{size:14})}),i&&h.jsx("div",{className:"absolute left-0 top-full z-10 mt-1 border border-[#E8E7EE] bg-white shadow-lg",children:i1.map(w=>h.jsx("button",{className:"block w-full border-none px-3 py-2 text-left text-[#170F4F] transition-colors hover:bg-[#CCF1F4]",onMouseDown:D=>{D.preventDefault(),D.stopPropagation(),x(w)},children:w.label},w.name))})]})})},l1=({isEditing:t=!1,children:e="Double-click to edit text...",style:r={}})=>{const{setProp:n}=Q.useNode(),[s,o]=F.useState("top"),i=F.useRef(null),a=F.useRef(null),l=F.useRef(null),c=F.useCallback(x=>{n(w=>{w.children=x})},[n]),d=F.useCallback(x=>{n(w=>(w.isEditing=x,w))},[n]),f=F.useCallback(x=>{x.preventDefault(),x.stopPropagation(),d(!0),a.current&&(a.current.getBoundingClientRect().top<window.innerHeight*.1?o("bottom"):o("top"))},[a]),m=F.useCallback(x=>{const w=x.target.value;w!==e&&c(w)},[e,c]),g=x=>{if(i.current){const w=window.getSelection();if(w&&w.rangeCount>0){const D=w.getRangeAt(0),E=document.createElement("span");E.setAttribute("data-variable",x),E.style.cssText="background: #e8f5e8; border: 1px solid #4caf50; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #2e7d32; font-size: 0.9em;",E.textContent=`{{${x}}}`,D.deleteContents(),D.insertNode(E),D.setStartAfter(E),D.collapse(!0),w.removeAllRanges(),w.addRange(D);const S=i.current.innerHTML;c(S)}}};F.useEffect(()=>{const x=w=>{if(!t||!a.current)return;const D=w.target;a.current.contains(D)||l.current&&l.current.contains(D)||d(!1)};return t&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[t,d]);const y={cursor:t?"text":"pointer",userSelect:t?"text":"none",...r};return h.jsxs("div",{ref:a,onDoubleClick:f,style:{position:"relative",width:"100%",height:"100%"},children:[t&&h.jsx(a1,{ref:l,editableRef:i,position:s,onVariableInsert:g}),h.jsx(Wh,{innerRef:x=>{i.current=x},tagName:"p",html:e,editable:t,onChange:m,style:y})]})},Uh=ze.default.memo(l1,(t,e)=>!(t.isEditing!==e.isEditing||t.children!==e.children||JSON.stringify(t.style)!==JSON.stringify(e.style))),u1={displayName:"Text",custom:{displayName:"Text",resizable:!0,tagHtml:"p",settings:["text","typography","default"]},props:{children:"Double click to edit text 2",isEditing:!1,style:{width:300,height:200,fontSize:16,fontWeight:"normal",color:"#000000",textAlign:"left",minHeight:"50px",padding:"8px",border:"none",outline:"none",overflow:"auto",position:"relative",wordWrap:"break-word",whiteSpace:"normal"}}};Uh.craft={...u1};const Pn=[{id:"box",label:"Box",icon:h.jsx(nr.RiBox3Line,{size:16}),category:"layout",component:Rh,htmlTags:["div"],settings:Ph},{id:"text",label:"Text",icon:h.jsx(nr.RiText,{size:16}),category:"content",component:Uh,htmlTags:["p","span","h1","h2","h3","h4","h5","h6"]},{id:"button",label:"Button",icon:h.jsx(nr.RiSquareLine,{size:16}),category:"interactive",component:zh,settings:Yl,htmlTags:["button"]},{id:"a",label:"Anchor",icon:h.jsx(nr.RiSquareLine,{size:16}),category:"interactive",component:Ih,settings:Gl,htmlTags:["a"]},{id:"image",label:"Image",icon:h.jsx(nr.RiImageLine,{size:16}),category:"media",component:Vh,settings:Ql,htmlTags:["img"]},{id:"divider",label:"Divider",icon:h.jsx(nr.RiSeparator,{size:16}),category:"layout",component:Xl,settings:Zl,htmlTags:["hr"]},{id:"table",label:"Table",icon:h.jsx(nr.RiTableFill,{size:16}),category:"layout",component:qh,settings:eu,htmlTags:["table"]},{id:"conditional",label:"Conditional",icon:h.jsx(nr.RiCodeSSlashLine,{size:16}),category:"dynamic",component:$h,settings:Hh,htmlTags:["div"]}];function Kh(){const[t,e]=F.useState(!1),[r,n]=F.useState(!1),[s,o]=F.useState(!0);return{showPreview:t,togglePreview:()=>{e(x=>!x),n(!1)},openPreview:()=>{e(!0)},closePreview:()=>{e(!1)},showCodePanel:r,toggleCodePanel:()=>{n(x=>!x)},openCodePanel:()=>{n(!0)},closeCodePanel:()=>{n(!1)},showSidebar:s,toggleSidebar:()=>{o(x=>!x)},isEditorEnabled:!(t||r),setIsEditorEnabled:x=>{e(!x),n(!x)}}}const No={displayName:"Template",isCanvas:!0,custom:{settings:["background","layout","spacing"]}},c1={device:"desktop"},Ro={type:{resolvedName:"CanvasTemplate"},isCanvas:No.isCanvas,props:c1,displayName:No.displayName,custom:No.custom,hidden:!1,linkedNodes:{}};function tu(){const{setIsEditorEnabled:t}=Kh(),{query:e,actions:r}=Q.useEditor(),{nodes:n}=Q.useEditor(x=>({nodes:x.nodes})),s=F.useMemo(()=>Object.keys(n).length>1,[n]),o=F.useMemo(()=>e.node("ROOT").get()?.data?.props?.device||"desktop",[n,e]),[i,a]=F.useState(o);F.useEffect(()=>{a(o)},[o]);const l=x=>{a(x),e.node("ROOT").get()&&r.setProp("ROOT",D=>{D&&(D.device=x)})},c=()=>{t(!1);try{return e.serialize()}catch(x){return console.warn("Error serializing canvas:",x),""}finally{t(!0)}},d=x=>{try{const w=m(x);return r.deserialize(w)}catch(w){return console.error("Error loading snapshot into canvas:",w),r.deserialize(f())}},f=()=>JSON.stringify({ROOT:{...Ro,nodes:[]}}),m=x=>{if(!x||x.trim()==="")return f();const w=JSON.parse(x);if(!w||typeof w!="object")throw new Error("Invalid snapshot: must be an object");const D=w.ROOT,E=D?.displayName==="Template"&&D?.isCanvas===!0,S=D?.type?.resolvedName==="CanvasTemplate";return E&&!S?g(w):E?JSON.stringify(w):y(w)},g=x=>(x.ROOT.type={resolvedName:"CanvasTemplate"},JSON.stringify(x)),y=x=>{const w={};Object.keys(x).forEach(E=>{E!=="ROOT"&&(w[E]=x[E])});const D={ROOT:{...Ro,nodes:Object.keys(w)}};return Object.keys(w).forEach(E=>{D[E]=w[E],D[E].parent||(D[E].parent="ROOT")}),JSON.stringify(D)};return{device:i,isEmpty:s,setDevice:l,getState:c,loadState:d}}const d1=new Set(["div","span","p","h1","h2","h3","h4","h5","h6","a","img","button","input","textarea","select","option","ul","ol","li","table","tr","td","th","thead","tbody","section","article","header","footer","nav","main","aside"]),p1=new Set(["img","input","br","hr","meta","link","area","base","col","embed","source","track","wbr"]),h1=new Set(["id","className","title","alt","src","href","target","rel"]),f1=new Set(["width","height","min-width","min-height","max-width","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","border-width","border-top-width","border-right-width","border-bottom-width","border-left-width","top","right","bottom","left","font-size","line-height","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius","letter-spacing","word-spacing","text-indent","text-decoration-thickness"]);class m1{constructor(e={}){It(this,"options");this.options={inlineStyles:!0,prettify:!1,includeComments:!1,customComponentMap:{},styleTransformers:[],...e}}convert(e){try{const r=e.ROOT;if(!r||!r.nodes)return"";const n=this.buildHTMLFromNodes(r.nodes,e);return this.options.prettify?this.prettifyHTML(n):n}catch(r){return console.error("craftJSToHTML - Error during conversion:",r),""}}buildHTMLFromNodes(e,r){return e.map(n=>this.buildHTMLFromNode(n,r)).filter(n=>n.trim()!=="").join("")}buildHTMLFromNode(e,r){const n=r[e];if(!n||n.hidden)return"";const{type:s,props:o={},nodes:i=[]}=n,a=typeof s=="object"&&s&&"resolvedName"in s?s.resolvedName:s,l=this.getTagName(a,n),c=this.buildAttributes(o);let d="";if(a==="conditional"){const g=i.map(y=>this.buildHTMLFromNodes([y],r));return this.generateConditionalHtml(n,g)}else if(l!=="table")d=this.buildHTMLFromNodes(i,r),o.children&&typeof o.children=="string"&&(d+=o.children),["button","a"].includes(l)&&o.text&&(d+=o.text);else{const g=i.map(y=>this.buildHTMLFromNodes([y],r));d+=this.generateTableHTML(n,g)}return this.isSelfClosingTag(l)?`<${l}${c} />`:`${this.options.includeComments?`<!-- ${a} -->`:""}<${l==="p"?"div":l}${c}>${d}</${l==="p"?"div":l}>`}getTagName(e,r){if(r.custom?.tagName&&typeof r.custom.tagName=="string")return r.custom.tagName.toLowerCase();if(r.custom?.tagHtml&&typeof r.custom.tagHtml=="string")return r.custom.tagHtml.toLowerCase();if(this.options.customComponentMap?.[e])return this.options.customComponentMap[e];const n={image:"img",button:"button",text:"p",divider:"hr",variable:"span",box:"div"};if(n[e])return n[e];const s=e.toLowerCase();return d1.has(s)?s:"div"}buildAttributes(e){const r=[];for(const n of h1)if(e[n]){const s=n==="className"?"class":n;r.push(`${s}="${this.escapeHTML(e[n])}"`)}if(e.style&&this.options.inlineStyles){const n=this.convertStyleObjectToCSS(e.style);n&&r.push(`style="${n}"`)}for(const[n,s]of Object.entries(e))n.startsWith("data-")&&typeof s=="string"&&r.push(`${n}="${this.escapeHTML(s)}"`);return r.length>0?` ${r.join(" ")}`:""}convertStyleObjectToCSS(e){if(!e||typeof e!="object")return"";const r=[];for(const[n,s]of Object.entries(e)){if(s==null)continue;const o=this.camelToKebabCase(n);let i=this.applStyleTransformers(n,s);i=this.addUnitIfNeeded(o,i),r.push(`${o}: ${i}`)}return r.join("; ")}camelToKebabCase(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}applStyleTransformers(e,r){const n=this.options.styleTransformers?.find(s=>s.property===e);return n?n.transform(r):String(r)}addUnitIfNeeded(e,r){const n=parseFloat(r);return!isNaN(n)&&f1.has(e)&&!r.includes("px")&&!r.includes("%")&&!r.includes("em")&&!r.includes("rem")&&!r.includes("vh")&&!r.includes("vw")?`${n}px`:r}isSelfClosingTag(e){return p1.has(e.toLowerCase())}escapeHTML(e){const r=document.createElement("div");return r.textContent=e,r.innerHTML}prettifyHTML(e){let r="",n=0;const s=" ";return e.split(/>\s*</).forEach((o,i)=>{i!==0&&(o=`<${o}`),i!==e.split(/>\s*</).length-1&&(o=`${o}>`),o.match(/^<\/\w/)&&n--,r+=`${s.repeat(Math.max(0,n))+o}
2
+ `,o.match(/^<\w[^>]*[^/]$/)&&n++}),r.trim()}generateTableHTML(e,r){let n="";for(let s=0;s<e.props?.rows;s++){n+=`<tr style="${s%2===0?this.convertStyleObjectToCSS(e.props?.rowStyle):""}">`;for(let o=0;o<e.props?.columns;o++)n+=`<td style="${this.convertStyleObjectToCSS(e.props?.cellStyle)}">${r[s*e.props?.columns+o]||""}</td>`;n+="</tr>"}return n}generateConditionalHtml(e,r){return g1(e.props?.conditions,r)}}function g1(t,e){const r={"===":"eq","!==":"ne",">":"gt","<":"lt",">=":"gte","<=":"lte"};let n="",s=!1;return t.forEach(o=>{if(o.isElse){n+=`{{else}}
9
3
  ${e[parseInt(o.option)-1]}
10
4
  `;return}if(!o.variable||!o.operator||o.value===void 0)throw new Error(`Rule missing required fields: ${JSON.stringify(o)}`);const i=r[o.operator];if(!i)throw new Error(`Unsupported operator: ${o.operator}`);const a=`(${i} ${o.variable} "${o.value}")`;s?n+=`{{else if ${a}}}
11
5
  ${e[parseInt(o.option)-1]}
12
6
  `:(n+=`{{#if ${a}}}
13
7
  ${e[parseInt(o.option)-1]}
14
- `,s=!0)}),s&&(n+="{{/if}}"),n}function Nd(t,e){return new p1(e).convert(t)}const il={id:"canvas",className:"relative flex-1 border border-gray-300 shadow-lg",style:{zIndex:1,minHeight:"100%",overflow:"visible",position:"relative",maxWidth:1200,background:`repeating-linear-gradient(
15
- to bottom,
16
- white 0px,
17
- white 1555px,
18
- red 1555px,
19
- red 1556px
20
- )`}},Ca=new Set(["p","span","h1","h2","h3","h4","h5","h6","strong","em","small","mark","del","ins","sub","sup"]);class f1{constructor(e,r={}){Et(this,"options");Et(this,"tagLookupMap");Et(this,"idCounter");this.options={rootCanvasProps:il,...r},this.tagLookupMap=this.createTagLookupMap(e),this.idCounter=1}convert(e){if(!e?.trim())return this.createEmptyRoot();try{const r=P2.parseDocument(e),n={},s=r.children.filter(a=>a.type==="tag"||a.type==="text"),o="ROOT",i=[];for(const a of s){const l=this.traverseNode(a,o,n);l&&i.push(l)}return n[o]=this.createRootNode(i),this.convertToCraftJSFormat(n)}catch(r){return console.error("Error converting HTML to CraftJS:",r),this.createEmptyRoot()}}createTagLookupMap(e){const r=new Map;for(const n of e)for(const s of n.htmlTags)r.set(s.toLowerCase(),n);return r}getNextId(){return`node-${this.idCounter++}`}traverseNode(e,r,n){return e.type==="text"?this.processTextNode(e,r,n):e.type==="tag"?this.processTagNode(e,r,n):null}processTextNode(e,r,n){const s=e.data?.trim();if(!s)return null;if(r&&n[r]&&Ca.has(n[r].tagName?.toLowerCase()))return n[r].props.children=(n[r].props.children||"")+s,null;const o=Array.from(this.tagLookupMap.values()).find(a=>a.htmlTags.some(l=>Ca.has(l)));if(!o)return null;const i=this.getNextId();return n[i]={id:i,type:o.id,props:{children:s},parent:r,isCanvas:!1,displayName:o.id,custom:{},hidden:!1,nodes:[],linkedNodes:{},tagName:"text"},i}processTagNode(e,r,n){const s=e.name?.toLowerCase();if(!s)return null;const o=this.tagLookupMap.get(s)||null;if(!o)return null;const i=this.getNextId(),a=[];let l="";const c=Ca.has(s);e.children?.length>0&&(s==="table"?e.children.filter(m=>m.type==="tag").flatMap(m=>m.children.filter(g=>g.type==="tag")).flatMap(m=>m.children.filter(g=>g.type==="tag")).forEach(m=>{const g=this.traverseNode(m,i,n);g&&a.push(g)}):e.children.forEach((f,m)=>{if(f.type==="text"&&c||["button","a"].includes(s)){const g=f.data?.trim();g&&(l+=`${m!==0?" ":""}${g}`)}else if(c){const g=Jh(f);l+=`${m!==0?" ":""}${g}`}else{const g=this.traverseNode(f,i,n);g&&a.push(g)}}));const d=this.processAttributes(e.attribs||{});return c&&l&&(d.children=l),["button","a"].includes(s)&&l&&(d.text=l),s==="table"&&this.proccessHtmlTable(e,d),n[i]={id:i,type:o.id,props:d,nodes:a,parent:r,displayName:o.id,isCanvas:o.isCanvas!==!1,custom:{},hidden:!1,linkedNodes:{},tagName:s},i}processAttributes(e){const r={...e};if(r.style&&typeof r.style=="string"){const n=this.parseStyleString(r.style);r.style=n}return r}proccessHtmlTable(e,r){const n=e.children.filter(o=>o.type==="tag");r.rows=n.length;const s=n?.[0].children.filter(o=>o.type==="tag");r.columns=s.length,r.rowStyle=this.processAttributes(n[0].attribs).style,r.cellStyle=this.processAttributes(s[0].attribs).style}parseStyleString(e){const r={};return e.split(";").filter(Boolean).forEach(n=>{const[s,o]=n.split(":").map(a=>a?.trim());if(!s||!o)return;const i=s.replace(/-([a-z])/g,a=>a[1].toUpperCase());r[i]=o}),r}createEmptyRoot(){return{ROOT:{type:"div",isCanvas:!0,props:this.options.rootCanvasProps,displayName:"div",custom:{},hidden:!1,nodes:[],linkedNodes:{}}}}createRootNode(e){return{id:"ROOT",type:"div",props:this.options.rootCanvasProps,nodes:e,isCanvas:!0,displayName:"div",custom:{},hidden:!1,linkedNodes:{}}}convertToCraftJSFormat(e){const r={};return Object.entries(e).forEach(([n,s])=>{n==="ROOT"?r[n]={type:s.type,isCanvas:s.isCanvas,props:s.props||{},displayName:s.displayName||s.type,custom:s.custom||{},hidden:s.hidden||!1,nodes:s.nodes||[],linkedNodes:s.linkedNodes||{}}:r[n]={type:{resolvedName:s.type},isCanvas:s.isCanvas,props:s.props||{},displayName:s.displayName||s.type,custom:s.custom||{},hidden:s.hidden||!1,nodes:s.nodes||[],linkedNodes:s.linkedNodes||{},parent:s.parent||"ROOT"}}),r}}function m1(t,e,r){return new f1(e,r).convert(t)}function Jh(t){if(!t.type||t.type==="text")return t.data||"";const e=t.attribs&&Object.keys(t.attribs).length>0?` ${Object.entries(t.attribs).map(([n,s])=>`${n}="${s}"`).join(" ")}`:"",r=t.children?t.children.map(Jh).map(n=>n.trim()).join(""):"";return`<${t.name}${e}>${r}</${t.name}>`}function Zl(){const{query:t}=Q.useEditor();return{convertFromHtml:(n,s={})=>{const{replace:o=!0,...i}=s,a=m1(n,Rs,i);let l="";if(o)l=JSON.stringify(a);else{const c=t.serialize();if(typeof c=="string")return JSON.stringify(a);const d=c,f=d.ROOT;if(!f)return JSON.stringify(a);const{ROOT:m,...g}=a,y=Object.keys(g);Object.assign(d,g),f.nodes=[...f.nodes||[],...y],y.forEach(v=>{d[v]&&(d[v].parent="ROOT")}),l=JSON.stringify(d)}return l},convertToHtml:(n,s={})=>{if(typeof n=="string")try{const i=JSON.parse(n);return Nd(i,s)}catch(i){return console.error("Error parsing JSON:",i),""}return Nd(n,s)}}}function Kh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gh={exports:{}};(function(t,e){(function(r){function n(){var s=r();return s.default||s}t.exports=n()})(function(){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=u=>{throw TypeError(u)},a=(u,p,b)=>p in u?r(u,p,{enumerable:!0,configurable:!0,writable:!0,value:b}):u[p]=b,l=(u,p)=>{for(var b in p)r(u,b,{get:p[b],enumerable:!0})},c=(u,p,b,x)=>{if(p&&typeof p=="object"||typeof p=="function")for(let C of s(p))!o.call(u,C)&&C!==b&&r(u,C,{get:()=>p[C],enumerable:!(x=n(p,C))||x.enumerable});return u},d=u=>c(r({},"__esModule",{value:!0}),u),f=(u,p,b)=>a(u,typeof p!="symbol"?p+"":p,b),m=(u,p,b)=>p.has(u)||i("Cannot "+b),g=(u,p,b)=>(m(u,p,"read from private field"),b?b.call(u):p.get(u)),y=(u,p,b)=>p.has(u)?i("Cannot add the same private member more than once"):p instanceof WeakSet?p.add(u):p.set(u,b),v=(u,p,b,x)=>(m(u,p,"write to private field"),p.set(u,b),b),w={};l(w,{languages:()=>Cx,options:()=>Ex,parsers:()=>Qc,printers:()=>O2});var D=(u,p,b,x)=>{if(!(u&&p==null))return p.replaceAll?p.replaceAll(b,x):b.global?p.replace(b,x):p.split(b).join(x)},E=D,N="string",A="array",T="cursor",j="indent",B="align",$="trim",O="group",z="fill",I="if-break",q="indent-if-break",J="line-suffix",K="line-suffix-boundary",ae="line",tt="label",mt="break-parent",oc=new Set([T,j,B,$,O,z,I,q,J,K,ae,tt,mt]),B0=(u,p,b)=>{if(!(u&&p==null))return Array.isArray(p)||typeof p=="string"?p[b<0?p.length+b:b]:p.at(b)},$n=B0;function j0(u){if(typeof u=="string")return N;if(Array.isArray(u))return A;if(!u)return;let{type:p}=u;if(oc.has(p))return p}var ic=j0,O0=u=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(u);function L0(u){let p=u===null?"null":typeof u;if(p!=="string"&&p!=="object")return`Unexpected doc '${p}',
21
- Expected it to be 'string' or 'object'.`;if(ic(u))throw new Error("doc is valid.");let b=Object.prototype.toString.call(u);if(b!=="[object Object]")return`Unexpected doc '${b}'.`;let x=O0([...oc].map(C=>`'${C}'`));return`Unexpected doc.type '${u.type}'.
22
- Expected it to be ${x}.`}var _0=class extends Error{constructor(p){super(L0(p));Et(this,"name","InvalidDocError");this.doc=p}},I0=_0;function ac(u,p){if(typeof u=="string")return p(u);let b=new Map;return x(u);function x(k){if(b.has(k))return b.get(k);let F=C(k);return b.set(k,F),F}function C(k){switch(ic(k)){case A:return p(k.map(x));case z:return p({...k,parts:k.parts.map(x)});case I:return p({...k,breakContents:x(k.breakContents),flatContents:x(k.flatContents)});case O:{let{expandedStates:F,contents:M}=k;return F?(F=F.map(x),M=F[0]):M=x(M),p({...k,contents:M,expandedStates:F})}case B:case j:case q:case tt:case J:return p({...k,contents:x(k.contents)});case N:case T:case $:case K:case ae:case mt:return p(k);default:throw new I0(k)}}}function gt(u,p=W0){return ac(u,b=>typeof b=="string"?an(p,b.split(`
23
- `)):b)}var R0=()=>{},P0=R0;function kt(u){return{type:j,contents:u}}function lc(u,p){return{type:B,contents:p,n:u}}function ke(u,p={}){return P0(p.expandedStates),{type:O,id:p.id,contents:u,break:!!p.shouldBreak,expandedStates:p.expandedStates}}function z0(u){return lc(Number.NEGATIVE_INFINITY,u)}function $0(u){return lc({type:"root"},u)}function uc(u){return{type:z,parts:u}}function Ws(u,p="",b={}){return{type:I,breakContents:u,flatContents:p,groupId:b.groupId}}function H0(u,p){return{type:q,contents:u,groupId:p.groupId,negate:p.negate}}var Hn={type:mt},V0={type:ae,hard:!0},q0={type:ae,hard:!0,literal:!0},xe={type:ae},ze={type:ae,soft:!0},he=[V0,Hn],W0=[q0,Hn];function an(u,p){let b=[];for(let x=0;x<p.length;x++)x!==0&&b.push(u),b.push(p[x]);return b}var Us="'",cc='"';function U0(u,p){let b=p===!0||p===Us?Us:cc,x=b===Us?cc:Us,C=0,k=0;for(let F of u)F===b?C++:F===x&&k++;return C>k?x:b}var J0=U0;function K0(u){if(typeof u!="string")throw new TypeError("Expected a string");return u.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var bt,G0=class{constructor(u){y(this,bt),v(this,bt,new Set(u))}getLeadingWhitespaceCount(u){let p=g(this,bt),b=0;for(let x=0;x<u.length&&p.has(u.charAt(x));x++)b++;return b}getTrailingWhitespaceCount(u){let p=g(this,bt),b=0;for(let x=u.length-1;x>=0&&p.has(u.charAt(x));x--)b++;return b}getLeadingWhitespace(u){let p=this.getLeadingWhitespaceCount(u);return u.slice(0,p)}getTrailingWhitespace(u){let p=this.getTrailingWhitespaceCount(u);return u.slice(u.length-p)}hasLeadingWhitespace(u){return g(this,bt).has(u.charAt(0))}hasTrailingWhitespace(u){return g(this,bt).has($n(!1,u,-1))}trimStart(u){let p=this.getLeadingWhitespaceCount(u);return u.slice(p)}trimEnd(u){let p=this.getTrailingWhitespaceCount(u);return u.slice(0,u.length-p)}trim(u){return this.trimEnd(this.trimStart(u))}split(u,p=!1){let b=`[${K0([...g(this,bt)].join(""))}]+`,x=new RegExp(p?`(${b})`:b,"u");return u.split(x)}hasWhitespaceCharacter(u){let p=g(this,bt);return Array.prototype.some.call(u,b=>p.has(b))}hasNonWhitespaceCharacter(u){let p=g(this,bt);return Array.prototype.some.call(u,b=>!p.has(b))}isWhitespaceOnly(u){let p=g(this,bt);return Array.prototype.every.call(u,b=>p.has(b))}};bt=new WeakMap;var Y0=G0,X0=[" ",`
24
- `,"\f","\r"," "],Q0=new Y0(X0),_t=Q0,Z0=class extends Error{constructor(p,b,x="type"){super(`Unexpected ${b} node ${x}: ${JSON.stringify(p[x])}.`);Et(this,"name","UnexpectedNodeError");this.node=p}},eb=Z0;function tb(u){return u?.type==="front-matter"}var Js=tb,rb=new Set(["sourceSpan","startSourceSpan","endSourceSpan","nameSpan","valueSpan","keySpan","tagDefinition","tokens","valueTokens","switchValueSourceSpan","expSourceSpan","valueSourceSpan"]),nb=new Set(["if","else if","for","switch","case"]);function dc(u,p){var b;if(u.type==="text"||u.type==="comment"||Js(u)||u.type==="yaml"||u.type==="toml")return null;if(u.type==="attribute"&&delete p.value,u.type==="docType"&&delete p.value,u.type==="angularControlFlowBlock"&&(b=u.parameters)!=null&&b.children)for(let x of p.parameters.children)nb.has(u.name)?delete x.expression:x.expression=x.expression.trim();u.type==="angularIcuExpression"&&(p.switchValue=u.switchValue.trim()),u.type==="angularLetDeclarationInitializer"&&delete p.value}dc.ignoredProperties=rb;var sb=dc;async function ob(u,p){if(u.language==="yaml"){let b=u.value.trim(),x=b?await p(b,{parser:"yaml"}):"";return $0([u.startDelimiter,u.explicitLanguage,he,x,x?he:"",u.endDelimiter])}}var ib=ob;function Ks(u,p=!0){return[kt([ze,u]),p?ze:""]}function ln(u,p){let b=u.type==="NGRoot"?u.node.type==="NGMicrosyntax"&&u.node.body.length===1&&u.node.body[0].type==="NGMicrosyntaxExpression"?u.node.body[0].expression:u.node:u.type==="JsExpressionRoot"?u.node:u;return b&&(b.type==="ObjectExpression"||b.type==="ArrayExpression"||(p.parser==="__vue_expression"||p.parser==="__vue_ts_expression")&&(b.type==="TemplateLiteral"||b.type==="StringLiteral"))}async function yt(u,p,b,x){b={__isInHtmlAttribute:!0,__embeddedInHtml:!0,...b};let C=!0;x&&(b.__onHtmlBindingRoot=(F,M)=>{C=x(F,M)});let k=await p(u,b,p);return C?ke(k):Ks(k)}function ab(u,p,b,x){let{node:C}=b,k=x.originalText.slice(C.sourceSpan.start.offset,C.sourceSpan.end.offset);return/^\s*$/u.test(k)?"":yt(k,u,{parser:"__ng_directive",__isInHtmlAttribute:!1},ln)}var lb=ab,ub=(u,p)=>{if(!(u&&p==null))return p.toReversed||!Array.isArray(p)?p.toReversed():[...p].reverse()},cb=ub;function db(u){return Array.isArray(u)&&u.length>0}var Xi=db,pc,hc,fc,mc,gc,pb=((pc=globalThis.Deno)==null?void 0:pc.build.os)==="windows"||((fc=(hc=globalThis.navigator)==null?void 0:hc.platform)==null?void 0:fc.startsWith("Win"))||((gc=(mc=globalThis.process)==null?void 0:mc.platform)==null?void 0:gc.startsWith("win"))||!1;function bc(u){if(u=u instanceof URL?u:new URL(u),u.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${u.protocol}"`);return u}function hb(u){return u=bc(u),decodeURIComponent(u.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function fb(u){u=bc(u);let p=decodeURIComponent(u.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return u.hostname!==""&&(p=`\\\\${u.hostname}${p}`),p}function mb(u){return pb?fb(u):hb(u)}var gb=mb,bb=u=>String(u).split(/[/\\]/u).pop();function yc(u,p){if(!p)return;let b=bb(p).toLowerCase();return u.find(({filenames:x})=>x?.some(C=>C.toLowerCase()===b))??u.find(({extensions:x})=>x?.some(C=>b.endsWith(C)))}function yb(u,p){if(p)return u.find(({name:b})=>b.toLowerCase()===p)??u.find(({aliases:b})=>b?.includes(p))??u.find(({extensions:b})=>b?.includes(`.${p}`))}function xc(u,p){if(p){if(String(p).startsWith("file:"))try{p=gb(p)}catch{return}if(typeof p=="string")return u.find(({isSupported:b})=>b?.({filepath:p}))}}function xb(u,p){let b=cb(!1,u.plugins).flatMap(C=>C.languages??[]),x=yb(b,p.language)??yc(b,p.physicalFile)??yc(b,p.file)??xc(b,p.physicalFile)??xc(b,p.file)??(p.physicalFile,void 0);return x?.parsers[0]}var Gs=xb,vb="inline",vc={area:"none",base:"none",basefont:"none",datalist:"none",head:"none",link:"none",meta:"none",noembed:"none",noframes:"none",param:"block",rp:"none",script:"block",style:"none",template:"inline",title:"none",html:"block",body:"block",address:"block",blockquote:"block",center:"block",dialog:"block",div:"block",figure:"block",figcaption:"block",footer:"block",form:"block",header:"block",hr:"block",legend:"block",listing:"block",main:"block",p:"block",plaintext:"block",pre:"block",search:"block",xmp:"block",slot:"contents",ruby:"ruby",rt:"ruby-text",article:"block",aside:"block",h1:"block",h2:"block",h3:"block",h4:"block",h5:"block",h6:"block",hgroup:"block",nav:"block",section:"block",dir:"block",dd:"block",dl:"block",dt:"block",menu:"block",ol:"block",ul:"block",li:"list-item",table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell",input:"inline-block",button:"inline-block",fieldset:"block",details:"block",summary:"block",marquee:"inline-block",source:"block",track:"block",meter:"inline-block",progress:"inline-block",object:"inline-block",video:"inline-block",audio:"inline-block",select:"inline-block",option:"block",optgroup:"block"},wb="normal",wc={listing:"pre",plaintext:"pre",pre:"pre",xmp:"pre",nobr:"nowrap",table:"initial",textarea:"pre-wrap"};function Db(u){return u.type==="element"&&!u.hasExplicitNamespace&&!["html","svg"].includes(u.namespace)}var Vn=Db,Cb=u=>E(!1,u,/^[\t\f\r ]*\n/gu,""),Dc=u=>Cb(_t.trimEnd(u)),kb=u=>{let p=u,b=_t.getLeadingWhitespace(p);b&&(p=p.slice(b.length));let x=_t.getTrailingWhitespace(p);return x&&(p=p.slice(0,-x.length)),{leadingWhitespace:b,trailingWhitespace:x,text:p}};function Cc(u,p){return!!(u.type==="ieConditionalComment"&&u.lastChild&&!u.lastChild.isSelfClosing&&!u.lastChild.endSourceSpan||u.type==="ieConditionalComment"&&!u.complete||un(u)&&u.children.some(b=>b.type!=="text"&&b.type!=="interpolation")||ea(u,p)&&!It(u,p)&&u.type!=="interpolation")}function Ys(u){return u.type==="attribute"||!u.parent||!u.prev?!1:Eb(u.prev)}function Eb(u){return u.type==="comment"&&u.value.trim()==="prettier-ignore"}function it(u){return u.type==="text"||u.type==="comment"}function It(u,p){return u.type==="element"&&(u.fullName==="script"||u.fullName==="style"||u.fullName==="svg:style"||u.fullName==="svg:script"||u.fullName==="mj-style"&&p.parser==="mjml"||Vn(u)&&(u.name==="script"||u.name==="style"))}function Sb(u,p){return u.children&&!It(u,p)}function Fb(u,p){return It(u,p)||u.type==="interpolation"||kc(u)}function kc(u){return Bc(u).startsWith("pre")}function Ab(u,p){var b,x;let C=k();if(C&&!u.prev&&(x=(b=u.parent)==null?void 0:b.tagDefinition)!=null&&x.ignoreFirstLf)return u.type==="interpolation";return C;function k(){return Js(u)||u.type==="angularControlFlowBlock"?!1:(u.type==="text"||u.type==="interpolation")&&u.prev&&(u.prev.type==="text"||u.prev.type==="interpolation")?!0:!u.parent||u.parent.cssDisplay==="none"?!1:un(u.parent)?!0:!(!u.prev&&(u.parent.type==="root"||un(u)&&u.parent||It(u.parent,p)||Qs(u.parent,p)||!Ib(u.parent.cssDisplay))||u.prev&&!zb(u.prev.cssDisplay))}}function Nb(u,p){return Js(u)||u.type==="angularControlFlowBlock"?!1:(u.type==="text"||u.type==="interpolation")&&u.next&&(u.next.type==="text"||u.next.type==="interpolation")?!0:!u.parent||u.parent.cssDisplay==="none"?!1:un(u.parent)?!0:!(!u.next&&(u.parent.type==="root"||un(u)&&u.parent||It(u.parent,p)||Qs(u.parent,p)||!Rb(u.parent.cssDisplay))||u.next&&!Pb(u.next.cssDisplay))}function Tb(u,p){return $b(u.cssDisplay)&&!It(u,p)}function Xs(u){return Js(u)||u.next&&u.sourceSpan.end&&u.sourceSpan.end.line+1<u.next.sourceSpan.start.line}function Mb(u){return Ec(u)||u.type==="element"&&u.children.length>0&&(["body","script","style"].includes(u.name)||u.children.some(p=>jb(p)))||u.firstChild&&u.firstChild===u.lastChild&&u.firstChild.type!=="text"&&Fc(u.firstChild)&&(!u.lastChild.isTrailingSpaceSensitive||Ac(u.lastChild))}function Ec(u){return u.type==="element"&&u.children.length>0&&(["html","head","ul","ol","select"].includes(u.name)||u.cssDisplay.startsWith("table")&&u.cssDisplay!=="table-cell")}function Qi(u){return Nc(u)||u.prev&&Bb(u.prev)||Sc(u)}function Bb(u){return Nc(u)||u.type==="element"&&u.fullName==="br"||Sc(u)}function Sc(u){return Fc(u)&&Ac(u)}function Fc(u){return u.hasLeadingSpaces&&(u.prev?u.prev.sourceSpan.end.line<u.sourceSpan.start.line:u.parent.type==="root"||u.parent.startSourceSpan.end.line<u.sourceSpan.start.line)}function Ac(u){return u.hasTrailingSpaces&&(u.next?u.next.sourceSpan.start.line>u.sourceSpan.end.line:u.parent.type==="root"||u.parent.endSourceSpan&&u.parent.endSourceSpan.start.line>u.sourceSpan.end.line)}function Nc(u){switch(u.type){case"ieConditionalComment":case"comment":case"directive":return!0;case"element":return["script","select"].includes(u.name)}return!1}function Zi(u){return u.lastChild?Zi(u.lastChild):u}function jb(u){var p;return(p=u.children)==null?void 0:p.some(b=>b.type!=="text")}function Tc(u){if(u)switch(u){case"module":case"text/javascript":case"text/babel":case"text/jsx":case"application/javascript":return"babel";case"application/x-typescript":return"typescript";case"text/markdown":return"markdown";case"text/html":return"html";case"text/x-handlebars-template":return"glimmer";default:if(u.endsWith("json")||u.endsWith("importmap")||u==="speculationrules")return"json"}}function Ob(u,p){let{name:b,attrMap:x}=u;if(b!=="script"||Object.prototype.hasOwnProperty.call(x,"src"))return;let{type:C,lang:k}=u.attrMap;return!k&&!C?"babel":Gs(p,{language:k})??Tc(C)}function Lb(u,p){if(!ea(u,p))return;let{attrMap:b}=u;if(Object.prototype.hasOwnProperty.call(b,"src"))return;let{type:x,lang:C}=b;return Gs(p,{language:C})??Tc(x)}function _b(u,p){if(u.name==="style"){let{lang:b}=u.attrMap;return b?Gs(p,{language:b}):"css"}if(u.name==="mj-style"&&p.parser==="mjml")return"css"}function Mc(u,p){return Ob(u,p)??_b(u,p)??Lb(u,p)}function qn(u){return u==="block"||u==="list-item"||u.startsWith("table")}function Ib(u){return!qn(u)&&u!=="inline-block"}function Rb(u){return!qn(u)&&u!=="inline-block"}function Pb(u){return!qn(u)}function zb(u){return!qn(u)}function $b(u){return!qn(u)&&u!=="inline-block"}function un(u){return Bc(u).startsWith("pre")}function Hb(u,p){let b=u;for(;b;){if(p(b))return!0;b=b.parent}return!1}function Vb(u,p){var b;if(cn(u,p))return"block";if(((b=u.prev)==null?void 0:b.type)==="comment"){let C=u.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/u);if(C)return C[1]}let x=!1;if(u.type==="element"&&u.namespace==="svg")if(Hb(u,C=>C.fullName==="svg:foreignObject"))x=!0;else return u.name==="svg"?"inline-block":"block";switch(p.htmlWhitespaceSensitivity){case"strict":return"inline";case"ignore":return"block";default:if(u.type==="element"&&(!u.namespace||x||Vn(u))&&Object.prototype.hasOwnProperty.call(vc,u.name))return vc[u.name]}return vb}function Bc(u){return u.type==="element"&&(!u.namespace||Vn(u))&&Object.prototype.hasOwnProperty.call(wc,u.name)?wc[u.name]:wb}function qb(u){let p=Number.POSITIVE_INFINITY;for(let b of u.split(`
25
- `)){if(b.length===0)continue;let x=_t.getLeadingWhitespaceCount(b);if(x===0)return 0;b.length!==x&&x<p&&(p=x)}return p===Number.POSITIVE_INFINITY?0:p}function jc(u,p=qb(u)){return p===0?u:u.split(`
8
+ `,s=!0)}),s&&(n+="{{/if}}"),n}function jd(t,e){return new m1(e).convert(t)}const Sa=new Set(["p","span","h1","h2","h3","h4","h5","h6","strong","em","small","mark","del","ins","sub","sup"]);class b1{constructor(e,r={}){It(this,"tagLookupMap");It(this,"idCounter");this.tagLookupMap=this.createTagLookupMap(e),this.idCounter=1}convert(e){if(!e?.trim())return this.createEmptyRoot();try{const r=V2.parseDocument(e),n={},s=r.children.filter(a=>a.type==="tag"||a.type==="text"),o="ROOT",i=[];for(const a of s){const l=this.traverseNode(a,o,n);l&&i.push(l)}return n[o]=this.createRootNode(i),this.convertToCraftJSFormat(n)}catch(r){return console.error("Error converting HTML to CraftJS:",r),this.createEmptyRoot()}}createTagLookupMap(e){const r=new Map;for(const n of e)for(const s of n.htmlTags)r.set(s.toLowerCase(),n);return r}getNextId(){return`node-${this.idCounter++}`}traverseNode(e,r,n){return e.type==="text"?this.processTextNode(e,r,n):e.type==="tag"?this.processTagNode(e,r,n):null}processTextNode(e,r,n){const s=e.data?.trim();if(!s)return null;if(r&&n[r]&&Sa.has(n[r].tagName?.toLowerCase()))return n[r].props.children=(n[r].props.children||"")+s,null;const o=Array.from(this.tagLookupMap.values()).find(a=>a.htmlTags.some(l=>Sa.has(l)));if(!o)return null;const i=this.getNextId();return n[i]={id:i,type:o.id,props:{children:s},parent:r,isCanvas:!1,displayName:o.id,custom:{},hidden:!1,nodes:[],linkedNodes:{},tagName:"text"},i}processTagNode(e,r,n){const s=e.name?.toLowerCase();if(!s)return null;const o=this.tagLookupMap.get(s)||null;if(!o)return null;const i=this.getNextId(),a=[];let l="";const c=Sa.has(s);e.children?.length>0&&(s==="table"?e.children.filter(m=>m.type==="tag").flatMap(m=>m.children.filter(g=>g.type==="tag")).flatMap(m=>m.children.filter(g=>g.type==="tag")).forEach(m=>{const g=this.traverseNode(m,i,n);g&&a.push(g)}):e.children.forEach((f,m)=>{if(f.type==="text"&&c||["button","a"].includes(s)){const g=f.data?.trim();g&&(l+=`${m!==0?" ":""}${g}`)}else if(c){const g=Jh(f);l+=`${m!==0?" ":""}${g}`}else{const g=this.traverseNode(f,i,n);g&&a.push(g)}}));const d=this.processAttributes(e.attribs||{});return c&&l&&(d.children=l),["button","a"].includes(s)&&l&&(d.text=l),s==="table"&&this.proccessHtmlTable(e,d),n[i]={id:i,type:o.id,props:d,nodes:a,parent:r,displayName:o.id,isCanvas:o.isCanvas!==!1,custom:{},hidden:!1,linkedNodes:{},tagName:s},i}processAttributes(e){const r={...e};if(r.style&&typeof r.style=="string"){const n=this.parseStyleString(r.style);r.style=n}return r}proccessHtmlTable(e,r){const n=e.children.filter(o=>o.type==="tag");r.rows=n.length;const s=n?.[0].children.filter(o=>o.type==="tag");r.columns=s.length,r.rowStyle=this.processAttributes(n[0].attribs).style,r.cellStyle=this.processAttributes(s[0].attribs).style}parseStyleString(e){const r={};return e.split(";").filter(Boolean).forEach(n=>{const[s,o]=n.split(":").map(a=>a?.trim());if(!s||!o)return;const i=s.replace(/-([a-z])/g,a=>a[1].toUpperCase());r[i]=o}),r}createEmptyRoot(){return{ROOT:{...Ro,nodes:[]}}}createRootNode(e){return{id:"ROOT",...Ro,nodes:e}}convertToCraftJSFormat(e){const r={};return Object.entries(e).forEach(([n,s])=>{n==="ROOT"?r[n]={type:s.type||{resolvedName:"CanvasTemplate"},isCanvas:s.isCanvas,props:s.props||{},displayName:s.displayName,custom:s.custom||{},hidden:s.hidden||!1,nodes:s.nodes||[],linkedNodes:s.linkedNodes||{}}:r[n]={type:{resolvedName:s.type},isCanvas:s.isCanvas,props:s.props||{},displayName:s.displayName||s.type,custom:s.custom||{},hidden:s.hidden||!1,nodes:s.nodes||[],linkedNodes:s.linkedNodes||{},parent:s.parent||"ROOT"}}),r}}function y1(t,e,r){return new b1(e,r).convert(t)}function Jh(t){if(!t.type||t.type==="text")return t.data||"";const e=t.attribs&&Object.keys(t.attribs).length>0?` ${Object.entries(t.attribs).map(([n,s])=>`${n}="${s}"`).join(" ")}`:"",r=t.children?t.children.map(Jh).map(n=>n.trim()).join(""):"";return`<${t.name}${e}>${r}</${t.name}>`}function ru(){const{query:t}=Q.useEditor();return{convertFromHtml:(n,s={})=>{const{replace:o=!0,...i}=s,a=y1(n,Pn,i);let l="";if(o)l=JSON.stringify(a);else{const c=t.serialize();if(typeof c=="string")return JSON.stringify(a);const d=c,f=d.ROOT;if(!f)return JSON.stringify(a);const{ROOT:m,...g}=a,y=Object.keys(g);Object.assign(d,g),f.nodes=[...f.nodes||[],...y],y.forEach(x=>{d[x]&&(d[x].parent="ROOT")}),l=JSON.stringify(d)}return l},convertToHtml:(n,s={})=>{if(typeof n=="string")try{const i=JSON.parse(n);return jd(i,s)}catch(i){return console.error("Error parsing JSON:",i),""}return jd(n,s)}}}function Gh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yh={exports:{}};(function(t,e){(function(r){function n(){var s=r();return s.default||s}t.exports=n()})(function(){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=u=>{throw TypeError(u)},a=(u,p,b)=>p in u?r(u,p,{enumerable:!0,configurable:!0,writable:!0,value:b}):u[p]=b,l=(u,p)=>{for(var b in p)r(u,b,{get:p[b],enumerable:!0})},c=(u,p,b,v)=>{if(p&&typeof p=="object"||typeof p=="function")for(let C of s(p))!o.call(u,C)&&C!==b&&r(u,C,{get:()=>p[C],enumerable:!(v=n(p,C))||v.enumerable});return u},d=u=>c(r({},"__esModule",{value:!0}),u),f=(u,p,b)=>a(u,typeof p!="symbol"?p+"":p,b),m=(u,p,b)=>p.has(u)||i("Cannot "+b),g=(u,p,b)=>(m(u,p,"read from private field"),b?b.call(u):p.get(u)),y=(u,p,b)=>p.has(u)?i("Cannot add the same private member more than once"):p instanceof WeakSet?p.add(u):p.set(u,b),x=(u,p,b,v)=>(m(u,p,"write to private field"),p.set(u,b),b),w={};l(w,{languages:()=>Fx,options:()=>Nx,parsers:()=>rd,printers:()=>R2});var D=(u,p,b,v)=>{if(!(u&&p==null))return p.replaceAll?p.replaceAll(b,v):b.global?p.replace(b,v):p.split(b).join(v)},E=D,S="string",A="array",T="cursor",j="indent",B="align",$="trim",O="group",P="fill",L="if-break",H="indent-if-break",Y="line-suffix",q="line-suffix-boundary",Z="line",he="label",Ae="break-parent",uc=new Set([T,j,B,$,O,P,L,H,Y,q,Z,he,Ae]),_0=(u,p,b)=>{if(!(u&&p==null))return Array.isArray(p)||typeof p=="string"?p[b<0?p.length+b:b]:p.at(b)},Vn=_0;function I0(u){if(typeof u=="string")return S;if(Array.isArray(u))return A;if(!u)return;let{type:p}=u;if(uc.has(p))return p}var cc=I0,R0=u=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(u);function P0(u){let p=u===null?"null":typeof u;if(p!=="string"&&p!=="object")return`Unexpected doc '${p}',
9
+ Expected it to be 'string' or 'object'.`;if(cc(u))throw new Error("doc is valid.");let b=Object.prototype.toString.call(u);if(b!=="[object Object]")return`Unexpected doc '${b}'.`;let v=R0([...uc].map(C=>`'${C}'`));return`Unexpected doc.type '${u.type}'.
10
+ Expected it to be ${v}.`}var z0=class extends Error{constructor(p){super(P0(p));It(this,"name","InvalidDocError");this.doc=p}},$0=z0;function dc(u,p){if(typeof u=="string")return p(u);let b=new Map;return v(u);function v(k){if(b.has(k))return b.get(k);let N=C(k);return b.set(k,N),N}function C(k){switch(cc(k)){case A:return p(k.map(v));case P:return p({...k,parts:k.parts.map(v)});case L:return p({...k,breakContents:v(k.breakContents),flatContents:v(k.flatContents)});case O:{let{expandedStates:N,contents:M}=k;return N?(N=N.map(v),M=N[0]):M=v(M),p({...k,contents:M,expandedStates:N})}case B:case j:case H:case he:case Y:return p({...k,contents:v(k.contents)});case S:case T:case $:case q:case Z:case Ae:return p(k);default:throw new $0(k)}}}function gt(u,p=G0){return dc(u,b=>typeof b=="string"?ln(p,b.split(`
11
+ `)):b)}var H0=()=>{},V0=H0;function kt(u){return{type:j,contents:u}}function pc(u,p){return{type:B,contents:p,n:u}}function Ee(u,p={}){return V0(p.expandedStates),{type:O,id:p.id,contents:u,break:!!p.shouldBreak,expandedStates:p.expandedStates}}function q0(u){return pc(Number.NEGATIVE_INFINITY,u)}function W0(u){return pc({type:"root"},u)}function hc(u){return{type:P,parts:u}}function Us(u,p="",b={}){return{type:L,breakContents:u,flatContents:p,groupId:b.groupId}}function U0(u,p){return{type:H,contents:u,groupId:p.groupId,negate:p.negate}}var qn={type:Ae},K0={type:Z,hard:!0},J0={type:Z,hard:!0,literal:!0},ve={type:Z},He={type:Z,soft:!0},fe=[K0,qn],G0=[J0,qn];function ln(u,p){let b=[];for(let v=0;v<p.length;v++)v!==0&&b.push(u),b.push(p[v]);return b}var Ks="'",fc='"';function Y0(u,p){let b=p===!0||p===Ks?Ks:fc,v=b===Ks?fc:Ks,C=0,k=0;for(let N of u)N===b?C++:N===v&&k++;return C>k?v:b}var Z0=Y0;function X0(u){if(typeof u!="string")throw new TypeError("Expected a string");return u.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var bt,Q0=class{constructor(u){y(this,bt),x(this,bt,new Set(u))}getLeadingWhitespaceCount(u){let p=g(this,bt),b=0;for(let v=0;v<u.length&&p.has(u.charAt(v));v++)b++;return b}getTrailingWhitespaceCount(u){let p=g(this,bt),b=0;for(let v=u.length-1;v>=0&&p.has(u.charAt(v));v--)b++;return b}getLeadingWhitespace(u){let p=this.getLeadingWhitespaceCount(u);return u.slice(0,p)}getTrailingWhitespace(u){let p=this.getTrailingWhitespaceCount(u);return u.slice(u.length-p)}hasLeadingWhitespace(u){return g(this,bt).has(u.charAt(0))}hasTrailingWhitespace(u){return g(this,bt).has(Vn(!1,u,-1))}trimStart(u){let p=this.getLeadingWhitespaceCount(u);return u.slice(p)}trimEnd(u){let p=this.getTrailingWhitespaceCount(u);return u.slice(0,u.length-p)}trim(u){return this.trimEnd(this.trimStart(u))}split(u,p=!1){let b=`[${X0([...g(this,bt)].join(""))}]+`,v=new RegExp(p?`(${b})`:b,"u");return u.split(v)}hasWhitespaceCharacter(u){let p=g(this,bt);return Array.prototype.some.call(u,b=>p.has(b))}hasNonWhitespaceCharacter(u){let p=g(this,bt);return Array.prototype.some.call(u,b=>!p.has(b))}isWhitespaceOnly(u){let p=g(this,bt);return Array.prototype.every.call(u,b=>p.has(b))}};bt=new WeakMap;var eb=Q0,tb=[" ",`
12
+ `,"\f","\r"," "],rb=new eb(tb),Lt=rb,nb=class extends Error{constructor(p,b,v="type"){super(`Unexpected ${b} node ${v}: ${JSON.stringify(p[v])}.`);It(this,"name","UnexpectedNodeError");this.node=p}},sb=nb;function ob(u){return u?.type==="front-matter"}var Js=ob,ib=new Set(["sourceSpan","startSourceSpan","endSourceSpan","nameSpan","valueSpan","keySpan","tagDefinition","tokens","valueTokens","switchValueSourceSpan","expSourceSpan","valueSourceSpan"]),ab=new Set(["if","else if","for","switch","case"]);function mc(u,p){var b;if(u.type==="text"||u.type==="comment"||Js(u)||u.type==="yaml"||u.type==="toml")return null;if(u.type==="attribute"&&delete p.value,u.type==="docType"&&delete p.value,u.type==="angularControlFlowBlock"&&(b=u.parameters)!=null&&b.children)for(let v of p.parameters.children)ab.has(u.name)?delete v.expression:v.expression=v.expression.trim();u.type==="angularIcuExpression"&&(p.switchValue=u.switchValue.trim()),u.type==="angularLetDeclarationInitializer"&&delete p.value}mc.ignoredProperties=ib;var lb=mc;async function ub(u,p){if(u.language==="yaml"){let b=u.value.trim(),v=b?await p(b,{parser:"yaml"}):"";return W0([u.startDelimiter,u.explicitLanguage,fe,v,v?fe:"",u.endDelimiter])}}var cb=ub;function Gs(u,p=!0){return[kt([He,u]),p?He:""]}function un(u,p){let b=u.type==="NGRoot"?u.node.type==="NGMicrosyntax"&&u.node.body.length===1&&u.node.body[0].type==="NGMicrosyntaxExpression"?u.node.body[0].expression:u.node:u.type==="JsExpressionRoot"?u.node:u;return b&&(b.type==="ObjectExpression"||b.type==="ArrayExpression"||(p.parser==="__vue_expression"||p.parser==="__vue_ts_expression")&&(b.type==="TemplateLiteral"||b.type==="StringLiteral"))}async function yt(u,p,b,v){b={__isInHtmlAttribute:!0,__embeddedInHtml:!0,...b};let C=!0;v&&(b.__onHtmlBindingRoot=(N,M)=>{C=v(N,M)});let k=await p(u,b,p);return C?Ee(k):Gs(k)}function db(u,p,b,v){let{node:C}=b,k=v.originalText.slice(C.sourceSpan.start.offset,C.sourceSpan.end.offset);return/^\s*$/u.test(k)?"":yt(k,u,{parser:"__ng_directive",__isInHtmlAttribute:!1},un)}var pb=db,hb=(u,p)=>{if(!(u&&p==null))return p.toReversed||!Array.isArray(p)?p.toReversed():[...p].reverse()},fb=hb;function mb(u){return Array.isArray(u)&&u.length>0}var ea=mb,gc,bc,yc,xc,vc,gb=((gc=globalThis.Deno)==null?void 0:gc.build.os)==="windows"||((yc=(bc=globalThis.navigator)==null?void 0:bc.platform)==null?void 0:yc.startsWith("Win"))||((vc=(xc=globalThis.process)==null?void 0:xc.platform)==null?void 0:vc.startsWith("win"))||!1;function wc(u){if(u=u instanceof URL?u:new URL(u),u.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${u.protocol}"`);return u}function bb(u){return u=wc(u),decodeURIComponent(u.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function yb(u){u=wc(u);let p=decodeURIComponent(u.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return u.hostname!==""&&(p=`\\\\${u.hostname}${p}`),p}function xb(u){return gb?yb(u):bb(u)}var vb=xb,wb=u=>String(u).split(/[/\\]/u).pop();function Dc(u,p){if(!p)return;let b=wb(p).toLowerCase();return u.find(({filenames:v})=>v?.some(C=>C.toLowerCase()===b))??u.find(({extensions:v})=>v?.some(C=>b.endsWith(C)))}function Db(u,p){if(p)return u.find(({name:b})=>b.toLowerCase()===p)??u.find(({aliases:b})=>b?.includes(p))??u.find(({extensions:b})=>b?.includes(`.${p}`))}function Cc(u,p){if(p){if(String(p).startsWith("file:"))try{p=vb(p)}catch{return}if(typeof p=="string")return u.find(({isSupported:b})=>b?.({filepath:p}))}}function Cb(u,p){let b=fb(!1,u.plugins).flatMap(C=>C.languages??[]),v=Db(b,p.language)??Dc(b,p.physicalFile)??Dc(b,p.file)??Cc(b,p.physicalFile)??Cc(b,p.file)??(p.physicalFile,void 0);return v?.parsers[0]}var Ys=Cb,kb="inline",kc={area:"none",base:"none",basefont:"none",datalist:"none",head:"none",link:"none",meta:"none",noembed:"none",noframes:"none",param:"block",rp:"none",script:"block",style:"none",template:"inline",title:"none",html:"block",body:"block",address:"block",blockquote:"block",center:"block",dialog:"block",div:"block",figure:"block",figcaption:"block",footer:"block",form:"block",header:"block",hr:"block",legend:"block",listing:"block",main:"block",p:"block",plaintext:"block",pre:"block",search:"block",xmp:"block",slot:"contents",ruby:"ruby",rt:"ruby-text",article:"block",aside:"block",h1:"block",h2:"block",h3:"block",h4:"block",h5:"block",h6:"block",hgroup:"block",nav:"block",section:"block",dir:"block",dd:"block",dl:"block",dt:"block",menu:"block",ol:"block",ul:"block",li:"list-item",table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell",input:"inline-block",button:"inline-block",fieldset:"block",details:"block",summary:"block",marquee:"inline-block",source:"block",track:"block",meter:"inline-block",progress:"inline-block",object:"inline-block",video:"inline-block",audio:"inline-block",select:"inline-block",option:"block",optgroup:"block"},Eb="normal",Ec={listing:"pre",plaintext:"pre",pre:"pre",xmp:"pre",nobr:"nowrap",table:"initial",textarea:"pre-wrap"};function Sb(u){return u.type==="element"&&!u.hasExplicitNamespace&&!["html","svg"].includes(u.namespace)}var Wn=Sb,Fb=u=>E(!1,u,/^[\t\f\r ]*\n/gu,""),Sc=u=>Fb(Lt.trimEnd(u)),Ab=u=>{let p=u,b=Lt.getLeadingWhitespace(p);b&&(p=p.slice(b.length));let v=Lt.getTrailingWhitespace(p);return v&&(p=p.slice(0,-v.length)),{leadingWhitespace:b,trailingWhitespace:v,text:p}};function Fc(u,p){return!!(u.type==="ieConditionalComment"&&u.lastChild&&!u.lastChild.isSelfClosing&&!u.lastChild.endSourceSpan||u.type==="ieConditionalComment"&&!u.complete||cn(u)&&u.children.some(b=>b.type!=="text"&&b.type!=="interpolation")||na(u,p)&&!_t(u,p)&&u.type!=="interpolation")}function Zs(u){return u.type==="attribute"||!u.parent||!u.prev?!1:Nb(u.prev)}function Nb(u){return u.type==="comment"&&u.value.trim()==="prettier-ignore"}function at(u){return u.type==="text"||u.type==="comment"}function _t(u,p){return u.type==="element"&&(u.fullName==="script"||u.fullName==="style"||u.fullName==="svg:style"||u.fullName==="svg:script"||u.fullName==="mj-style"&&p.parser==="mjml"||Wn(u)&&(u.name==="script"||u.name==="style"))}function Tb(u,p){return u.children&&!_t(u,p)}function Mb(u,p){return _t(u,p)||u.type==="interpolation"||Ac(u)}function Ac(u){return _c(u).startsWith("pre")}function Bb(u,p){var b,v;let C=k();if(C&&!u.prev&&(v=(b=u.parent)==null?void 0:b.tagDefinition)!=null&&v.ignoreFirstLf)return u.type==="interpolation";return C;function k(){return Js(u)||u.type==="angularControlFlowBlock"?!1:(u.type==="text"||u.type==="interpolation")&&u.prev&&(u.prev.type==="text"||u.prev.type==="interpolation")?!0:!u.parent||u.parent.cssDisplay==="none"?!1:cn(u.parent)?!0:!(!u.prev&&(u.parent.type==="root"||cn(u)&&u.parent||_t(u.parent,p)||Qs(u.parent,p)||!$b(u.parent.cssDisplay))||u.prev&&!qb(u.prev.cssDisplay))}}function jb(u,p){return Js(u)||u.type==="angularControlFlowBlock"?!1:(u.type==="text"||u.type==="interpolation")&&u.next&&(u.next.type==="text"||u.next.type==="interpolation")?!0:!u.parent||u.parent.cssDisplay==="none"?!1:cn(u.parent)?!0:!(!u.next&&(u.parent.type==="root"||cn(u)&&u.parent||_t(u.parent,p)||Qs(u.parent,p)||!Hb(u.parent.cssDisplay))||u.next&&!Vb(u.next.cssDisplay))}function Ob(u,p){return Wb(u.cssDisplay)&&!_t(u,p)}function Xs(u){return Js(u)||u.next&&u.sourceSpan.end&&u.sourceSpan.end.line+1<u.next.sourceSpan.start.line}function Lb(u){return Nc(u)||u.type==="element"&&u.children.length>0&&(["body","script","style"].includes(u.name)||u.children.some(p=>Ib(p)))||u.firstChild&&u.firstChild===u.lastChild&&u.firstChild.type!=="text"&&Mc(u.firstChild)&&(!u.lastChild.isTrailingSpaceSensitive||Bc(u.lastChild))}function Nc(u){return u.type==="element"&&u.children.length>0&&(["html","head","ul","ol","select"].includes(u.name)||u.cssDisplay.startsWith("table")&&u.cssDisplay!=="table-cell")}function ta(u){return jc(u)||u.prev&&_b(u.prev)||Tc(u)}function _b(u){return jc(u)||u.type==="element"&&u.fullName==="br"||Tc(u)}function Tc(u){return Mc(u)&&Bc(u)}function Mc(u){return u.hasLeadingSpaces&&(u.prev?u.prev.sourceSpan.end.line<u.sourceSpan.start.line:u.parent.type==="root"||u.parent.startSourceSpan.end.line<u.sourceSpan.start.line)}function Bc(u){return u.hasTrailingSpaces&&(u.next?u.next.sourceSpan.start.line>u.sourceSpan.end.line:u.parent.type==="root"||u.parent.endSourceSpan&&u.parent.endSourceSpan.start.line>u.sourceSpan.end.line)}function jc(u){switch(u.type){case"ieConditionalComment":case"comment":case"directive":return!0;case"element":return["script","select"].includes(u.name)}return!1}function ra(u){return u.lastChild?ra(u.lastChild):u}function Ib(u){var p;return(p=u.children)==null?void 0:p.some(b=>b.type!=="text")}function Oc(u){if(u)switch(u){case"module":case"text/javascript":case"text/babel":case"text/jsx":case"application/javascript":return"babel";case"application/x-typescript":return"typescript";case"text/markdown":return"markdown";case"text/html":return"html";case"text/x-handlebars-template":return"glimmer";default:if(u.endsWith("json")||u.endsWith("importmap")||u==="speculationrules")return"json"}}function Rb(u,p){let{name:b,attrMap:v}=u;if(b!=="script"||Object.prototype.hasOwnProperty.call(v,"src"))return;let{type:C,lang:k}=u.attrMap;return!k&&!C?"babel":Ys(p,{language:k})??Oc(C)}function Pb(u,p){if(!na(u,p))return;let{attrMap:b}=u;if(Object.prototype.hasOwnProperty.call(b,"src"))return;let{type:v,lang:C}=b;return Ys(p,{language:C})??Oc(v)}function zb(u,p){if(u.name==="style"){let{lang:b}=u.attrMap;return b?Ys(p,{language:b}):"css"}if(u.name==="mj-style"&&p.parser==="mjml")return"css"}function Lc(u,p){return Rb(u,p)??zb(u,p)??Pb(u,p)}function Un(u){return u==="block"||u==="list-item"||u.startsWith("table")}function $b(u){return!Un(u)&&u!=="inline-block"}function Hb(u){return!Un(u)&&u!=="inline-block"}function Vb(u){return!Un(u)}function qb(u){return!Un(u)}function Wb(u){return!Un(u)&&u!=="inline-block"}function cn(u){return _c(u).startsWith("pre")}function Ub(u,p){let b=u;for(;b;){if(p(b))return!0;b=b.parent}return!1}function Kb(u,p){var b;if(dn(u,p))return"block";if(((b=u.prev)==null?void 0:b.type)==="comment"){let C=u.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/u);if(C)return C[1]}let v=!1;if(u.type==="element"&&u.namespace==="svg")if(Ub(u,C=>C.fullName==="svg:foreignObject"))v=!0;else return u.name==="svg"?"inline-block":"block";switch(p.htmlWhitespaceSensitivity){case"strict":return"inline";case"ignore":return"block";default:if(u.type==="element"&&(!u.namespace||v||Wn(u))&&Object.prototype.hasOwnProperty.call(kc,u.name))return kc[u.name]}return kb}function _c(u){return u.type==="element"&&(!u.namespace||Wn(u))&&Object.prototype.hasOwnProperty.call(Ec,u.name)?Ec[u.name]:Eb}function Jb(u){let p=Number.POSITIVE_INFINITY;for(let b of u.split(`
13
+ `)){if(b.length===0)continue;let v=Lt.getLeadingWhitespaceCount(b);if(v===0)return 0;b.length!==v&&v<p&&(p=v)}return p===Number.POSITIVE_INFINITY?0:p}function Ic(u,p=Jb(u)){return p===0?u:u.split(`
26
14
  `).map(b=>b.slice(p)).join(`
27
- `)}function Oc(u){return E(!1,E(!1,u,"&apos;","'"),"&quot;",'"')}function rr(u){return Oc(u.value)}var Wb=new Set(["template","style","script"]);function Qs(u,p){return cn(u,p)&&!Wb.has(u.fullName)}function cn(u,p){return p.parser==="vue"&&u.type==="element"&&u.parent.type==="root"&&u.fullName.toLowerCase()!=="html"}function ea(u,p){return cn(u,p)&&(Qs(u,p)||u.attrMap.lang&&u.attrMap.lang!=="html")}function Ub(u){let p=u.fullName;return p.charAt(0)==="#"||p==="slot-scope"||p==="v-slot"||p.startsWith("v-slot:")}function Jb(u,p){let b=u.parent;if(!cn(b,p))return!1;let x=b.fullName,C=u.fullName;return x==="script"&&C==="setup"||x==="style"&&C==="vars"}function Lc(u,p=u.value){return u.parent.isWhitespaceSensitive?u.parent.isIndentationSensitive?gt(p):gt(jc(Dc(p)),he):an(xe,_t.split(p))}function _c(u,p){return cn(u,p)&&u.name==="script"}var Ic=/\{\{(.+?)\}\}/su;async function Kb(u,p){let b=[];for(let[x,C]of u.split(Ic).entries())if(x%2===0)b.push(gt(C));else try{b.push(ke(["{{",kt([xe,await yt(C,p,{parser:"__ng_interpolation",__isInHtmlInterpolation:!0})]),xe,"}}"]))}catch{b.push("{{",gt(C),"}}")}return b}function ta({parser:u}){return(p,b,x)=>yt(rr(x.node),p,{parser:u},ln)}var Gb=ta({parser:"__ng_action"}),Yb=ta({parser:"__ng_binding"}),Xb=ta({parser:"__ng_directive"});function Qb(u,p){if(p.parser!=="angular")return;let{node:b}=u,x=b.fullName;if(x.startsWith("(")&&x.endsWith(")")||x.startsWith("on-"))return Gb;if(x.startsWith("[")&&x.endsWith("]")||/^bind(?:on)?-/u.test(x)||/^ng-(?:if|show|hide|class|style)$/u.test(x))return Yb;if(x.startsWith("*"))return Xb;let C=rr(b);if(/^i18n(?:-.+)?$/u.test(x))return()=>Ks(uc(Lc(b,C.trim())),!C.includes("@@"));if(Ic.test(C))return k=>Kb(C,k)}var Zb=Qb;function ey(u,p){let{node:b}=u,x=rr(b);if(b.fullName==="class"&&!p.parentParser&&!x.includes("{{"))return()=>x.trim().split(/\s+/u).join(" ")}var ty=ey;function Rc(u){return u===" "||u===`
28
- `||u==="\f"||u==="\r"||u===" "}var ry=/^[ \t\n\r\u000c]+/,ny=/^[, \t\n\r\u000c]+/,sy=/^[^ \t\n\r\u000c]+/,oy=/[,]+$/,Pc=/^\d+$/,iy=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;function ay(u){let p=u.length,b,x,C,k,F,M=0,P;function U(se){let ce,Ee=se.exec(u.substring(M));if(Ee)return[ce]=Ee,M+=ce.length,ce}let V=[];for(;;){if(U(ny),M>=p){if(V.length===0)throw new Error("Must contain one or more image candidate strings.");return V}P=M,b=U(sy),x=[],b.slice(-1)===","?(b=b.replace(oy,""),ee()):ie()}function ie(){for(U(ry),C="",k="in descriptor";;){if(F=u.charAt(M),k==="in descriptor")if(Rc(F))C&&(x.push(C),C="",k="after descriptor");else if(F===","){M+=1,C&&x.push(C),ee();return}else if(F==="(")C+=F,k="in parens";else if(F===""){C&&x.push(C),ee();return}else C+=F;else if(k==="in parens")if(F===")")C+=F,k="in descriptor";else if(F===""){x.push(C),ee();return}else C+=F;else if(k==="after descriptor"&&!Rc(F))if(F===""){ee();return}else k="in descriptor",M-=1;M+=1}}function ee(){let se=!1,ce,Ee,Oe,$e,W={},oe,Se,we,Ue,mn;for($e=0;$e<x.length;$e++)oe=x[$e],Se=oe[oe.length-1],we=oe.substring(0,oe.length-1),Ue=parseInt(we,10),mn=parseFloat(we),Pc.test(we)&&Se==="w"?((ce||Ee)&&(se=!0),Ue===0?se=!0:ce=Ue):iy.test(we)&&Se==="x"?((ce||Ee||Oe)&&(se=!0),mn<0?se=!0:Ee=mn):Pc.test(we)&&Se==="h"?((Oe||Ee)&&(se=!0),Ue===0?se=!0:Oe=Ue):se=!0;if(!se)W.source={value:b,startOffset:P},ce&&(W.width={value:ce}),Ee&&(W.density={value:Ee}),Oe&&(W.height={value:Oe}),V.push(W);else throw new Error(`Invalid srcset descriptor found in "${u}" at "${oe}".`)}}var ly=ay;function uy(u){if(u.node.fullName==="srcset"&&(u.parent.fullName==="img"||u.parent.fullName==="source"))return()=>dy(rr(u.node))}var zc={width:"w",height:"h",density:"x"},cy=Object.keys(zc);function dy(u){let p=ly(u),b=cy.filter(V=>p.some(ie=>Object.prototype.hasOwnProperty.call(ie,V)));if(b.length>1)throw new Error("Mixed descriptor in srcset is not supported");let[x]=b,C=zc[x],k=p.map(V=>V.source.value),F=Math.max(...k.map(V=>V.length)),M=p.map(V=>V[x]?String(V[x].value):""),P=M.map(V=>{let ie=V.indexOf(".");return ie===-1?V.length:ie}),U=Math.max(...P);return Ks(an([",",xe],k.map((V,ie)=>{let ee=[V],se=M[ie];if(se){let ce=F-V.length+1,Ee=U-P[ie],Oe=" ".repeat(ce+Ee);ee.push(Ws(Oe," "),se+C)}return ee})))}var py=uy;function hy(u,p){let{node:b}=u,x=rr(u.node).trim();if(b.fullName==="style"&&!p.parentParser&&!x.includes("{{"))return async C=>Ks(await C(x,{parser:"css",__isHTMLStyleAttribute:!0}))}var ra=new WeakMap;function fy(u,p){let{root:b}=u;return ra.has(b)||ra.set(b,b.children.some(x=>_c(x,p)&&["ts","typescript"].includes(x.attrMap.lang))),ra.get(b)}var na=fy;function my(u,p,b){let{node:x}=b,C=rr(x);return yt(`type T<${C}> = any`,u,{parser:"babel-ts",__isEmbeddedTypescriptGenericParameters:!0},ln)}function gy(u,p,{parseWithTs:b}){return yt(`function _(${u}) {}`,p,{parser:b?"babel-ts":"babel",__isVueBindings:!0})}async function by(u,p,b,x){let C=rr(b.node),{left:k,operator:F,right:M}=yy(C),P=na(b,x);return[ke(await yt(`function _(${k}) {}`,u,{parser:P?"babel-ts":"babel",__isVueForBindingLeft:!0}))," ",F," ",await yt(M,u,{parser:P?"__ts_expression":"__js_expression"})]}function yy(u){let p=/(.*?)\s+(in|of)\s+(.*)/su,b=/,([^,\]}]*)(?:,([^,\]}]*))?$/u,x=/^\(|\)$/gu,C=u.match(p);if(!C)return;let k={};if(k.for=C[3].trim(),!k.for)return;let F=E(!1,C[1].trim(),x,""),M=F.match(b);M?(k.alias=F.replace(b,""),k.iterator1=M[1].trim(),M[2]&&(k.iterator2=M[2].trim())):k.alias=F;let P=[k.alias,k.iterator1,k.iterator2];if(!P.some((U,V)=>!U&&(V===0||P.slice(V+1).some(Boolean))))return{left:P.filter(Boolean).join(","),operator:C[2],right:k.for}}function xy(u,p){if(p.parser!=="vue")return;let{node:b}=u,x=b.fullName;if(x==="v-for")return by;if(x==="generic"&&_c(b.parent,p))return my;let C=rr(b),k=na(u,p);if(Ub(b)||Jb(b,p))return F=>gy(C,F,{parseWithTs:k});if(x.startsWith("@")||x.startsWith("v-on:"))return F=>vy(C,F,{parseWithTs:k});if(x.startsWith(":")||x.startsWith(".")||x.startsWith("v-bind:"))return F=>wy(C,F,{parseWithTs:k});if(x.startsWith("v-"))return F=>$c(C,F,{parseWithTs:k})}async function vy(u,p,{parseWithTs:b}){var x;try{return await $c(u,p,{parseWithTs:b})}catch(C){if(((x=C.cause)==null?void 0:x.code)!=="BABEL_PARSER_SYNTAX_ERROR")throw C}return yt(u,p,{parser:b?"__vue_ts_event_binding":"__vue_event_binding"},ln)}function wy(u,p,{parseWithTs:b}){return yt(u,p,{parser:b?"__vue_ts_expression":"__vue_expression"},ln)}function $c(u,p,{parseWithTs:b}){return yt(u,p,{parser:b?"__ts_expression":"__js_expression"},ln)}var Dy=xy;function Cy(u,p){let{node:b}=u;if(b.value){if(/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(p.originalText.slice(b.valueSpan.start.offset,b.valueSpan.end.offset))||p.parser==="lwc"&&b.value.startsWith("{")&&b.value.endsWith("}"))return[b.rawName,"=",b.value];for(let x of[py,hy,ty,Dy,Zb]){let C=x(u,p);if(C)return ky(C)}}}function ky(u){return async(p,b,x,C)=>{let k=await u(p,b,x,C);if(k)return k=ac(k,F=>typeof F=="string"?E(!1,F,'"',"&quot;"):F),[x.node.rawName,'="',ke(k),'"']}}var Ey=Cy,Sy=new Proxy(()=>{},{get:()=>Sy});function Wn(u){return u.sourceSpan.start.offset}function Zs(u){return u.sourceSpan.end.offset}function sa(u,p){return[u.isSelfClosing?"":Fy(u,p),Un(u,p)]}function Fy(u,p){return u.lastChild&&Gn(u.lastChild)?"":[Ay(u,p),oa(u,p)]}function Un(u,p){return(u.next?Tr(u.next):Kn(u.parent))?"":[Jn(u,p),Nr(u,p)]}function Ay(u,p){return Kn(u)?Jn(u.lastChild,p):""}function Nr(u,p){return Gn(u)?oa(u.parent,p):eo(u)?aa(u.next,p):""}function oa(u,p){if(Hc(u,p))return"";switch(u.type){case"ieConditionalComment":return"<!";case"element":if(u.hasHtmComponentClosingTag)return"<//";default:return`</${u.rawName}`}}function Jn(u,p){if(Hc(u,p))return"";switch(u.type){case"ieConditionalComment":case"ieConditionalEndComment":return"[endif]-->";case"ieConditionalStartComment":return"]><!-->";case"interpolation":return"}}";case"angularIcuExpression":return"}";case"element":if(u.isSelfClosing)return"/>";default:return">"}}function Hc(u,p){return!u.isSelfClosing&&!u.endSourceSpan&&(Ys(u)||Cc(u.parent,p))}function Tr(u){return u.prev&&u.prev.type!=="docType"&&u.type!=="angularControlFlowBlock"&&!it(u.prev)&&u.isLeadingSpaceSensitive&&!u.hasLeadingSpaces}function Kn(u){var p;return((p=u.lastChild)==null?void 0:p.isTrailingSpaceSensitive)&&!u.lastChild.hasTrailingSpaces&&!it(Zi(u.lastChild))&&!un(u)}function Gn(u){return!u.next&&!u.hasTrailingSpaces&&u.isTrailingSpaceSensitive&&it(Zi(u))}function eo(u){return u.next&&!it(u.next)&&it(u)&&u.isTrailingSpaceSensitive&&!u.hasTrailingSpaces}function Ny(u){let p=u.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/su);return p?p[1]?p[1].split(/\s+/u):!0:!1}function to(u){return!u.prev&&u.isLeadingSpaceSensitive&&!u.hasLeadingSpaces}function Ty(u,p,b){var x;let{node:C}=u;if(!Xi(C.attrs))return C.isSelfClosing?" ":"";let k=((x=C.prev)==null?void 0:x.type)==="comment"&&Ny(C.prev.value),F=typeof k=="boolean"?()=>k:Array.isArray(k)?ie=>k.includes(ie.rawName):()=>!1,M=u.map(({node:ie})=>F(ie)?gt(p.originalText.slice(Wn(ie),Zs(ie))):b(),"attrs"),P=C.type==="element"&&C.fullName==="script"&&C.attrs.length===1&&C.attrs[0].fullName==="src"&&C.children.length===0,U=p.singleAttributePerLine&&C.attrs.length>1&&!cn(C,p)?he:xe,V=[kt([P?" ":xe,an(U,M)])];return C.firstChild&&to(C.firstChild)||C.isSelfClosing&&Kn(C.parent)||P?V.push(C.isSelfClosing?" ":""):V.push(p.bracketSameLine?C.isSelfClosing?" ":"":C.isSelfClosing?xe:ze),V}function My(u){return u.firstChild&&to(u.firstChild)?"":la(u)}function ia(u,p,b){let{node:x}=u;return[Yn(x,p),Ty(u,p,b),x.isSelfClosing?"":My(x)]}function Yn(u,p){return u.prev&&eo(u.prev)?"":[Mr(u,p),aa(u,p)]}function Mr(u,p){return to(u)?la(u.parent):Tr(u)?Jn(u.prev,p):""}var Vc="<!doctype";function aa(u,p){switch(u.type){case"ieConditionalComment":case"ieConditionalStartComment":return`<!--[if ${u.condition}`;case"ieConditionalEndComment":return"<!--<!";case"interpolation":return"{{";case"docType":{if(u.value==="html"){let{filepath:x}=p;if(x&&/\.html?$/u.test(x))return Vc}let b=Wn(u);return p.originalText.slice(b,b+Vc.length)}case"angularIcuExpression":return"{";case"element":if(u.condition)return`<!--[if ${u.condition}]><!--><${u.rawName}`;default:return`<${u.rawName}`}}function la(u){switch(u.type){case"ieConditionalComment":return"]>";case"element":if(u.condition)return"><!--<![endif]-->";default:return">"}}function By(u,p){if(!u.endSourceSpan)return"";let b=u.startSourceSpan.end.offset;u.firstChild&&to(u.firstChild)&&(b-=la(u).length);let x=u.endSourceSpan.start.offset;return u.lastChild&&Gn(u.lastChild)?x+=oa(u,p).length:Kn(u)&&(x-=Jn(u.lastChild,p).length),p.originalText.slice(b,x)}var qc=By,jy=new Set(["if","else if","for","switch","case"]);function Oy(u,p){let{node:b}=u;switch(b.type){case"element":if(It(b,p)||b.type==="interpolation")return;if(!b.isSelfClosing&&ea(b,p)){let x=Mc(b,p);return x?async(C,k)=>{let F=qc(b,p),M=/^\s*$/u.test(F),P="";return M||(P=await C(Dc(F),{parser:x,__embeddedInHtml:!0}),M=P===""),[Mr(b,p),ke(ia(u,p,k)),M?"":he,P,M?"":he,sa(b,p),Nr(b,p)]}:void 0}break;case"text":if(It(b.parent,p)){let x=Mc(b.parent,p);if(x)return async C=>{let k=x==="markdown"?jc(b.value.replace(/^[^\S\n]*\n/u,"")):b.value,F={parser:x,__embeddedInHtml:!0};if(p.parser==="html"&&x==="babel"){let M="script",{attrMap:P}=b.parent;P&&(P.type==="module"||(P.type==="text/babel"||P.type==="text/jsx")&&P["data-type"]==="module")&&(M="module"),F.__babelSourceType=M}return[Hn,Mr(b,p),await C(k,F),Nr(b,p)]}}else if(b.parent.type==="interpolation")return async x=>{let C={__isInHtmlInterpolation:!0,__embeddedInHtml:!0};return p.parser==="angular"?C.parser="__ng_interpolation":p.parser==="vue"?C.parser=na(u,p)?"__vue_ts_expression":"__vue_expression":C.parser="__js_expression",[kt([xe,await x(b.value,C)]),b.parent.next&&Tr(b.parent.next)?" ":xe]};break;case"attribute":return Ey(u,p);case"front-matter":return x=>ib(b,x);case"angularControlFlowBlockParameters":return jy.has(u.parent.name)?lb:void 0;case"angularLetDeclarationInitializer":return x=>yt(b.value,x,{parser:"__ng_binding",__isInHtmlAttribute:!1})}}var Ly=Oy,Xn=null;function Qn(u){if(Xn!==null&&typeof Xn.property){let p=Xn;return Xn=Qn.prototype=null,p}return Xn=Qn.prototype=u??Object.create(null),new Qn}var _y=10;for(let u=0;u<=_y;u++)Qn();function Iy(u){return Qn(u)}function Ry(u,p="type"){Iy(u);function b(x){let C=x[p],k=u[C];if(!Array.isArray(k))throw Object.assign(new Error(`Missing visitor keys for '${C}'.`),{node:x});return k}return b}var Py=Ry,zy={"front-matter":[],root:["children"],element:["attrs","children"],ieConditionalComment:["children"],ieConditionalStartComment:[],ieConditionalEndComment:[],interpolation:["children"],text:["children"],docType:[],comment:[],attribute:[],cdata:[],angularControlFlowBlock:["children","parameters"],angularControlFlowBlockParameters:["children"],angularControlFlowBlockParameter:[],angularLetDeclaration:["init"],angularLetDeclarationInitializer:[],angularIcuExpression:["cases"],angularIcuCase:["expression"]},$y=zy,Hy=Py($y),Vy=Hy,qy="format",Wy=/^\s*<!--\s*@(?:noformat|noprettier)\s*-->/u,Uy=/^\s*<!--\s*@(?:format|prettier)\s*-->/u;function Jy(u){return Uy.test(u)}function Ky(u){return Wy.test(u)}function Gy(u){return`<!-- @${qy} -->
29
-
30
- ${u}`}var Yy=new Map([["if",new Set(["else if","else"])],["else if",new Set(["else if","else"])],["for",new Set(["empty"])],["defer",new Set(["placeholder","error","loading"])],["placeholder",new Set(["placeholder","error","loading"])],["error",new Set(["placeholder","error","loading"])],["loading",new Set(["placeholder","error","loading"])]]);function Wc(u){let p=Zs(u);return u.type==="element"&&!u.endSourceSpan&&Xi(u.children)?Math.max(p,Wc($n(!1,u.children,-1))):p}function Zn(u,p,b){let x=u.node;if(Ys(x)){let C=Wc(x);return[Mr(x,p),gt(_t.trimEnd(p.originalText.slice(Wn(x)+(x.prev&&eo(x.prev)?aa(x).length:0),C-(x.next&&Tr(x.next)?Jn(x,p).length:0)))),Nr(x,p)]}return b()}function ro(u,p){return it(u)&&it(p)?u.isTrailingSpaceSensitive?u.hasTrailingSpaces?Qi(p)?he:xe:"":Qi(p)?he:ze:eo(u)&&(Ys(p)||p.firstChild||p.isSelfClosing||p.type==="element"&&p.attrs.length>0)||u.type==="element"&&u.isSelfClosing&&Tr(p)?"":!p.isLeadingSpaceSensitive||Qi(p)||Tr(p)&&u.lastChild&&Gn(u.lastChild)&&u.lastChild.lastChild&&Gn(u.lastChild.lastChild)?he:p.hasLeadingSpaces?xe:ze}function ua(u,p,b){let{node:x}=u;if(Ec(x))return[Hn,...u.map(k=>{let F=k.node,M=F.prev?ro(F.prev,F):"";return[M?[M,Xs(F.prev)?he:""]:"",Zn(k,p,b)]},"children")];let C=x.children.map(()=>Symbol(""));return u.map((k,F)=>{let M=k.node;if(it(M)){if(M.prev&&it(M.prev)){let ce=ro(M.prev,M);if(ce)return Xs(M.prev)?[he,he,Zn(k,p,b)]:[ce,Zn(k,p,b)]}return Zn(k,p,b)}let P=[],U=[],V=[],ie=[],ee=M.prev?ro(M.prev,M):"",se=M.next?ro(M,M.next):"";return ee&&(Xs(M.prev)?P.push(he,he):ee===he?P.push(he):it(M.prev)?U.push(ee):U.push(Ws("",ze,{groupId:C[F-1]}))),se&&(Xs(M)?it(M.next)&&ie.push(he,he):se===he?it(M.next)&&ie.push(he):V.push(se)),[...P,ke([...U,ke([Zn(k,p,b),...V],{id:C[F]})]),...ie]},"children")}function Xy(u,p,b){let{node:x}=u,C=[];Qy(u)&&C.push("} "),C.push("@",x.name),x.parameters&&C.push(" (",ke(b("parameters")),")"),C.push(" {");let k=Uc(x);return x.children.length>0?(x.firstChild.hasLeadingSpaces=!0,x.lastChild.hasTrailingSpaces=!0,C.push(kt([he,ua(u,p,b)])),k&&C.push(he,"}")):k&&C.push("}"),ke(C,{shouldBreak:!0})}function Uc(u){var p,b;return!(((p=u.next)==null?void 0:p.type)==="angularControlFlowBlock"&&(b=Yy.get(u.name))!=null&&b.has(u.next.name))}function Qy(u){let{previous:p}=u;return p?.type==="angularControlFlowBlock"&&!Ys(p)&&!Uc(p)}function Zy(u,p,b){return[kt([ze,an([";",xe],u.map(b,"children"))]),ze]}function ex(u,p,b){let{node:x}=u;return[Yn(x,p),ke([x.switchValue.trim(),", ",x.clause,x.cases.length>0?[",",kt([xe,an(xe,u.map(b,"cases"))])]:"",ze]),Un(x,p)]}function tx(u,p,b){let{node:x}=u;return[x.value," {",ke([kt([ze,u.map(({node:C,isLast:k})=>{let F=[b()];return C.type==="text"&&(C.hasLeadingSpaces&&F.unshift(xe),C.hasTrailingSpaces&&!k&&F.push(xe)),F},"expression")]),ze]),"}"]}function rx(u,p,b){let{node:x}=u;if(Cc(x,p))return[Mr(x,p),ke(ia(u,p,b)),gt(qc(x,p)),...sa(x,p),Nr(x,p)];let C=x.children.length===1&&(x.firstChild.type==="interpolation"||x.firstChild.type==="angularIcuExpression")&&x.firstChild.isLeadingSpaceSensitive&&!x.firstChild.hasLeadingSpaces&&x.lastChild.isTrailingSpaceSensitive&&!x.lastChild.hasTrailingSpaces,k=Symbol("element-attr-group-id"),F=V=>ke([ke(ia(u,p,b),{id:k}),V,sa(x,p)]),M=V=>C?H0(V,{groupId:k}):(It(x,p)||Qs(x,p))&&x.parent.type==="root"&&p.parser==="vue"&&!p.vueIndentScriptAndStyle?V:kt(V),P=()=>C?Ws(ze,"",{groupId:k}):x.firstChild.hasLeadingSpaces&&x.firstChild.isLeadingSpaceSensitive?xe:x.firstChild.type==="text"&&x.isWhitespaceSensitive&&x.isIndentationSensitive?z0(ze):ze,U=()=>(x.next?Tr(x.next):Kn(x.parent))?x.lastChild.hasTrailingSpaces&&x.lastChild.isTrailingSpaceSensitive?" ":"":C?Ws(ze,"",{groupId:k}):x.lastChild.hasTrailingSpaces&&x.lastChild.isTrailingSpaceSensitive?xe:(x.lastChild.type==="comment"||x.lastChild.type==="text"&&x.isWhitespaceSensitive&&x.isIndentationSensitive)&&new RegExp(`\\n[\\t ]{${p.tabWidth*(u.ancestors.length-1)}}$`,"u").test(x.lastChild.value)?"":ze;return x.children.length===0?F(x.hasDanglingSpaces&&x.isDanglingSpaceSensitive?xe:""):F([Mb(x)?Hn:"",M([P(),ua(u,p,b)]),U()])}function no(u){return u>=9&&u<=32||u==160}function ca(u){return 48<=u&&u<=57}function so(u){return u>=97&&u<=122||u>=65&&u<=90}function nx(u){return u>=97&&u<=102||u>=65&&u<=70||ca(u)}function da(u){return u===10||u===13}function Jc(u){return 48<=u&&u<=55}function pa(u){return u===39||u===34||u===96}var sx=/-+([a-z0-9])/g;function ox(u){return u.replace(sx,(...p)=>p[1].toUpperCase())}var ha=class Yh{constructor(p,b,x,C){this.file=p,this.offset=b,this.line=x,this.col=C}toString(){return this.offset!=null?`${this.file.url}@${this.line}:${this.col}`:this.file.url}moveBy(p){let b=this.file.content,x=b.length,C=this.offset,k=this.line,F=this.col;for(;C>0&&p<0;)if(C--,p++,b.charCodeAt(C)==10){k--;let M=b.substring(0,C-1).lastIndexOf(`
31
- `);F=M>0?C-M:C}else F--;for(;C<x&&p>0;){let M=b.charCodeAt(C);C++,p--,M==10?(k++,F=0):F++}return new Yh(this.file,C,k,F)}getContext(p,b){let x=this.file.content,C=this.offset;if(C!=null){C>x.length-1&&(C=x.length-1);let k=C,F=0,M=0;for(;F<p&&C>0&&(C--,F++,!(x[C]==`
32
- `&&++M==b)););for(F=0,M=0;F<p&&k<x.length-1&&(k++,F++,!(x[k]==`
33
- `&&++M==b)););return{before:x.substring(C,this.offset),after:x.substring(this.offset,k+1)}}return null}},Kc=class{constructor(u,p){this.content=u,this.url=p}},ne=class{constructor(u,p,b=u,x=null){this.start=u,this.end=p,this.fullStart=b,this.details=x}toString(){return this.start.file.content.substring(this.start.offset,this.end.offset)}},oo;(function(u){u[u.WARNING=0]="WARNING",u[u.ERROR=1]="ERROR"})(oo||(oo={}));var Gc=class{constructor(u,p,b=oo.ERROR,x){this.span=u,this.msg=p,this.level=b,this.relatedError=x}contextualMessage(){let u=this.span.start.getContext(100,3);return u?`${this.msg} ("${u.before}[${oo[this.level]} ->]${u.after}")`:this.msg}toString(){let u=this.span.details?`, ${this.span.details}`:"";return`${this.contextualMessage()}: ${this.span.start}${u}`}},ix=[lx,ux,dx,hx,fx,bx,mx,gx,yx,px];function ax(u,p){for(let b of ix)b(u,p);return u}function lx(u){u.walk(p=>{if(p.type==="element"&&p.tagDefinition.ignoreFirstLf&&p.children.length>0&&p.children[0].type==="text"&&p.children[0].value[0]===`
34
- `){let b=p.children[0];b.value.length===1?p.removeChild(b):b.value=b.value.slice(1)}})}function ux(u){let p=b=>{var x,C;return b.type==="element"&&((x=b.prev)==null?void 0:x.type)==="ieConditionalStartComment"&&b.prev.sourceSpan.end.offset===b.startSourceSpan.start.offset&&((C=b.firstChild)==null?void 0:C.type)==="ieConditionalEndComment"&&b.firstChild.sourceSpan.start.offset===b.startSourceSpan.end.offset};u.walk(b=>{if(b.children)for(let x=0;x<b.children.length;x++){let C=b.children[x];if(!p(C))continue;let k=C.prev,F=C.firstChild;b.removeChild(k),x--;let M=new ne(k.sourceSpan.start,F.sourceSpan.end),P=new ne(M.start,C.sourceSpan.end);C.condition=k.condition,C.sourceSpan=P,C.startSourceSpan=M,C.removeChild(F)}})}function cx(u,p,b){u.walk(x=>{if(x.children)for(let C=0;C<x.children.length;C++){let k=x.children[C];if(k.type!=="text"&&!p(k))continue;k.type!=="text"&&(k.type="text",k.value=b(k));let F=k.prev;!F||F.type!=="text"||(F.value+=k.value,F.sourceSpan=new ne(F.sourceSpan.start,k.sourceSpan.end),x.removeChild(k),C--)}})}function dx(u){return cx(u,p=>p.type==="cdata",p=>`<![CDATA[${p.value}]]>`)}function px(u){let p=b=>{var x,C;return b.type==="element"&&b.attrs.length===0&&b.children.length===1&&b.firstChild.type==="text"&&!_t.hasWhitespaceCharacter(b.children[0].value)&&!b.firstChild.hasLeadingSpaces&&!b.firstChild.hasTrailingSpaces&&b.isLeadingSpaceSensitive&&!b.hasLeadingSpaces&&b.isTrailingSpaceSensitive&&!b.hasTrailingSpaces&&((x=b.prev)==null?void 0:x.type)==="text"&&((C=b.next)==null?void 0:C.type)==="text"};u.walk(b=>{if(b.children)for(let x=0;x<b.children.length;x++){let C=b.children[x];if(!p(C))continue;let k=C.prev,F=C.next;k.value+=`<${C.rawName}>`+C.firstChild.value+`</${C.rawName}>`+F.value,k.sourceSpan=new ne(k.sourceSpan.start,F.sourceSpan.end),k.isTrailingSpaceSensitive=F.isTrailingSpaceSensitive,k.hasTrailingSpaces=F.hasTrailingSpaces,b.removeChild(C),x--,b.removeChild(F)}})}function hx(u,p){if(p.parser==="html")return;let b=/\{\{(.+?)\}\}/su;u.walk(x=>{if(Sb(x,p))for(let C of x.children){if(C.type!=="text")continue;let k=C.sourceSpan.start,F=null,M=C.value.split(b);for(let P=0;P<M.length;P++,k=F){let U=M[P];if(P%2===0){F=k.moveBy(U.length),U.length>0&&x.insertChildBefore(C,{type:"text",value:U,sourceSpan:new ne(k,F)});continue}F=k.moveBy(U.length+4),x.insertChildBefore(C,{type:"interpolation",sourceSpan:new ne(k,F),children:U.length===0?[]:[{type:"text",value:U,sourceSpan:new ne(k.moveBy(2),F.moveBy(-2))}]})}x.removeChild(C)}})}function fx(u,p){u.walk(b=>{let x=b.$children;if(!x)return;if(x.length===0||x.length===1&&x[0].type==="text"&&_t.trim(x[0].value).length===0){b.hasDanglingSpaces=x.length>0,b.$children=[];return}let C=Fb(b,p),k=kc(b);if(!C)for(let F=0;F<x.length;F++){let M=x[F];if(M.type!=="text")continue;let{leadingWhitespace:P,text:U,trailingWhitespace:V}=kb(M.value),ie=M.prev,ee=M.next;U?(M.value=U,M.sourceSpan=new ne(M.sourceSpan.start.moveBy(P.length),M.sourceSpan.end.moveBy(-V.length)),P&&(ie&&(ie.hasTrailingSpaces=!0),M.hasLeadingSpaces=!0),V&&(M.hasTrailingSpaces=!0,ee&&(ee.hasLeadingSpaces=!0))):(b.removeChild(M),F--,(P||V)&&(ie&&(ie.hasTrailingSpaces=!0),ee&&(ee.hasLeadingSpaces=!0)))}b.isWhitespaceSensitive=C,b.isIndentationSensitive=k})}function mx(u){u.walk(p=>{p.isSelfClosing=!p.children||p.type==="element"&&(p.tagDefinition.isVoid||p.endSourceSpan&&p.startSourceSpan.start===p.endSourceSpan.start&&p.startSourceSpan.end===p.endSourceSpan.end)})}function gx(u,p){u.walk(b=>{b.type==="element"&&(b.hasHtmComponentClosingTag=b.endSourceSpan&&/^<\s*\/\s*\/\s*>$/u.test(p.originalText.slice(b.endSourceSpan.start.offset,b.endSourceSpan.end.offset)))})}function bx(u,p){u.walk(b=>{b.cssDisplay=Vb(b,p)})}function yx(u,p){u.walk(b=>{let{children:x}=b;if(x){if(x.length===0){b.isDanglingSpaceSensitive=Tb(b,p);return}for(let C of x)C.isLeadingSpaceSensitive=Ab(C,p),C.isTrailingSpaceSensitive=Nb(C,p);for(let C=0;C<x.length;C++){let k=x[C];k.isLeadingSpaceSensitive=(C===0||k.prev.isTrailingSpaceSensitive)&&k.isLeadingSpaceSensitive,k.isTrailingSpaceSensitive=(C===x.length-1||k.next.isLeadingSpaceSensitive)&&k.isTrailingSpaceSensitive}}})}var xx=ax;function vx(u,p,b){let{node:x}=u;switch(x.type){case"front-matter":return gt(x.raw);case"root":return p.__onHtmlRoot&&p.__onHtmlRoot(x),[ke(ua(u,p,b)),he];case"element":case"ieConditionalComment":return rx(u,p,b);case"angularControlFlowBlock":return Xy(u,p,b);case"angularControlFlowBlockParameters":return Zy(u,p,b);case"angularControlFlowBlockParameter":return _t.trim(x.expression);case"angularLetDeclaration":return ke(["@let ",ke([x.id," =",ke(kt([xe,b("init")]))]),";"]);case"angularLetDeclarationInitializer":return x.value;case"angularIcuExpression":return ex(u,p,b);case"angularIcuCase":return tx(u,p,b);case"ieConditionalStartComment":case"ieConditionalEndComment":return[Yn(x),Un(x)];case"interpolation":return[Yn(x,p),...u.map(b,"children"),Un(x,p)];case"text":{if(x.parent.type==="interpolation"){let M=/\n[^\S\n]*$/u,P=M.test(x.value),U=P?x.value.replace(M,""):x.value;return[gt(U),P?he:""]}let C=Mr(x,p),k=Lc(x),F=Nr(x,p);return k[0]=[C,k[0]],k.push([k.pop(),F]),uc(k)}case"docType":return[ke([Yn(x,p)," ",E(!1,x.value.replace(/^html\b/iu,"html"),/\s+/gu," ")]),Un(x,p)];case"comment":return[Mr(x,p),gt(p.originalText.slice(Wn(x),Zs(x))),Nr(x,p)];case"attribute":{if(x.value===null)return x.rawName;let C=Oc(x.value),k=J0(C,'"');return[x.rawName,"=",k,gt(k==='"'?E(!1,C,'"',"&quot;"):E(!1,C,"'","&apos;")),k]}case"cdata":default:throw new eb(x,"HTML")}}var wx={preprocess:xx,print:vx,insertPragma:Gy,massageAstNode:sb,embed:Ly,getVisitorKeys:Vy},Dx=wx,Cx=[{name:"Angular",type:"markup",extensions:[".component.html"],tmScope:"text.html.basic",aceMode:"html",aliases:["xhtml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["angular"],vscodeLanguageIds:["html"],filenames:[],linguistLanguageId:146},{name:"HTML",type:"markup",extensions:[".html",".hta",".htm",".html.hl",".inc",".xht",".xhtml"],tmScope:"text.html.basic",aceMode:"html",aliases:["xhtml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["html"],vscodeLanguageIds:["html"],linguistLanguageId:146},{name:"Lightning Web Components",type:"markup",extensions:[],tmScope:"text.html.basic",aceMode:"html",aliases:["xhtml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["lwc"],vscodeLanguageIds:["html"],filenames:[],linguistLanguageId:146},{name:"MJML",type:"markup",extensions:[".mjml"],tmScope:"text.mjml.basic",aceMode:"html",aliases:["MJML","mjml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["mjml"],filenames:[],vscodeLanguageIds:["mjml"],linguistLanguageId:146},{name:"Vue",type:"markup",extensions:[".vue"],tmScope:"source.vue",aceMode:"html",parsers:["vue"],vscodeLanguageIds:["vue"],linguistLanguageId:391}],Yc={bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}},Xc="HTML",kx={bracketSameLine:Yc.bracketSameLine,htmlWhitespaceSensitivity:{category:Xc,type:"choice",default:"css",description:"How to handle whitespaces in HTML.",choices:[{value:"css",description:"Respect the default value of CSS display property."},{value:"strict",description:"Whitespaces are considered sensitive."},{value:"ignore",description:"Whitespaces are considered insensitive."}]},singleAttributePerLine:Yc.singleAttributePerLine,vueIndentScriptAndStyle:{category:Xc,type:"boolean",default:!1,description:"Indent script and style tags in Vue files."}},Ex=kx,Qc={};l(Qc,{angular:()=>M2,html:()=>A2,lwc:()=>j2,mjml:()=>T2,vue:()=>B2});var Zc;(function(u){u[u.Emulated=0]="Emulated",u[u.None=2]="None",u[u.ShadowDom=3]="ShadowDom"})(Zc||(Zc={}));var ed;(function(u){u[u.OnPush=0]="OnPush",u[u.Default=1]="Default"})(ed||(ed={}));var td;(function(u){u[u.None=0]="None",u[u.SignalBased=1]="SignalBased",u[u.HasDecoratorInputTransform=2]="HasDecoratorInputTransform"})(td||(td={}));var rd={name:"custom-elements"},nd={name:"no-errors-schema"},Br;(function(u){u[u.NONE=0]="NONE",u[u.HTML=1]="HTML",u[u.STYLE=2]="STYLE",u[u.SCRIPT=3]="SCRIPT",u[u.URL=4]="URL",u[u.RESOURCE_URL=5]="RESOURCE_URL"})(Br||(Br={}));var sd;(function(u){u[u.Error=0]="Error",u[u.Warning=1]="Warning",u[u.Ignore=2]="Ignore"})(sd||(sd={}));var xt;(function(u){u[u.RAW_TEXT=0]="RAW_TEXT",u[u.ESCAPABLE_RAW_TEXT=1]="ESCAPABLE_RAW_TEXT",u[u.PARSABLE_DATA=2]="PARSABLE_DATA"})(xt||(xt={}));function io(u,p=!0){if(u[0]!=":")return[null,u];let b=u.indexOf(":",1);if(b===-1){if(p)throw new Error(`Unsupported format "${u}" expecting ":namespace:name"`);return[null,u]}return[u.slice(1,b),u.slice(b+1)]}function od(u){return io(u)[1]==="ng-container"}function id(u){return io(u)[1]==="ng-content"}function ao(u){return u===null?null:io(u)[0]}function lo(u,p){return u?`:${u}:${p}`:p}var uo;function ad(){return uo||(uo={},co(Br.HTML,["iframe|srcdoc","*|innerHTML","*|outerHTML"]),co(Br.STYLE,["*|style"]),co(Br.URL,["*|formAction","area|href","area|ping","audio|src","a|href","a|ping","blockquote|cite","body|background","del|cite","form|action","img|src","input|src","ins|cite","q|cite","source|src","track|src","video|poster","video|src"]),co(Br.RESOURCE_URL,["applet|code","applet|codebase","base|href","embed|src","frame|src","head|profile","html|manifest","iframe|src","link|href","media|src","object|codebase","object|data","script|src"])),uo}function co(u,p){for(let b of p)uo[b.toLowerCase()]=u}var Sx=class{},Fx="boolean",Ax="number",Nx="string",Tx="object",Mx=["[Element]|textContent,%ariaAtomic,%ariaAutoComplete,%ariaBusy,%ariaChecked,%ariaColCount,%ariaColIndex,%ariaColSpan,%ariaCurrent,%ariaDescription,%ariaDisabled,%ariaExpanded,%ariaHasPopup,%ariaHidden,%ariaKeyShortcuts,%ariaLabel,%ariaLevel,%ariaLive,%ariaModal,%ariaMultiLine,%ariaMultiSelectable,%ariaOrientation,%ariaPlaceholder,%ariaPosInSet,%ariaPressed,%ariaReadOnly,%ariaRelevant,%ariaRequired,%ariaRoleDescription,%ariaRowCount,%ariaRowIndex,%ariaRowSpan,%ariaSelected,%ariaSetSize,%ariaSort,%ariaValueMax,%ariaValueMin,%ariaValueNow,%ariaValueText,%classList,className,elementTiming,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*fullscreenchange,*fullscreenerror,*search,*webkitfullscreenchange,*webkitfullscreenerror,outerHTML,%part,#scrollLeft,#scrollTop,slot,*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored","[HTMLElement]^[Element]|accessKey,autocapitalize,!autofocus,contentEditable,dir,!draggable,enterKeyHint,!hidden,!inert,innerText,inputMode,lang,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate,virtualKeyboardPolicy","abbr,address,article,aside,b,bdi,bdo,cite,content,code,dd,dfn,dt,em,figcaption,figure,footer,header,hgroup,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,autocapitalize,!autofocus,contentEditable,dir,!draggable,enterKeyHint,!hidden,innerText,inputMode,lang,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate,virtualKeyboardPolicy","media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,!preservesPitch,src,%srcObject,#volume",":svg:^[HTMLElement]|!autofocus,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,%style,#tabIndex",":svg:graphics^:svg:|",":svg:animation^:svg:|*begin,*end,*repeat",":svg:geometry^:svg:|",":svg:componentTransferFunction^:svg:|",":svg:gradient^:svg:|",":svg:textContent^:svg:graphics|",":svg:textPositioning^:svg:textContent|","a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,%relList,rev,search,shape,target,text,type,username","area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,%relList,search,shape,target,username","audio^media|","br^[HTMLElement]|clear","base^[HTMLElement]|href,target","body^[HTMLElement]|aLink,background,bgColor,link,*afterprint,*beforeprint,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*messageerror,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink","button^[HTMLElement]|!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value","canvas^[HTMLElement]|#height,#width","content^[HTMLElement]|select","dl^[HTMLElement]|!compact","data^[HTMLElement]|value","datalist^[HTMLElement]|","details^[HTMLElement]|!open","dialog^[HTMLElement]|!open,returnValue","dir^[HTMLElement]|!compact","div^[HTMLElement]|align","embed^[HTMLElement]|align,height,name,src,type,width","fieldset^[HTMLElement]|!disabled,name","font^[HTMLElement]|color,face,size","form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target","frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src","frameset^[HTMLElement]|cols,*afterprint,*beforeprint,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*messageerror,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows","hr^[HTMLElement]|align,color,!noShade,size,width","head^[HTMLElement]|","h1,h2,h3,h4,h5,h6^[HTMLElement]|align","html^[HTMLElement]|version","iframe^[HTMLElement]|align,allow,!allowFullscreen,!allowPaymentRequest,csp,frameBorder,height,loading,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width","img^[HTMLElement]|align,alt,border,%crossOrigin,decoding,#height,#hspace,!isMap,loading,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width","input^[HTMLElement]|accept,align,alt,autocomplete,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width","li^[HTMLElement]|type,#value","label^[HTMLElement]|htmlFor","legend^[HTMLElement]|align","link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,imageSizes,imageSrcset,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type","map^[HTMLElement]|name","marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width","menu^[HTMLElement]|!compact","meta^[HTMLElement]|content,httpEquiv,media,name,scheme","meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value","ins,del^[HTMLElement]|cite,dateTime","ol^[HTMLElement]|!compact,!reversed,#start,type","object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width","optgroup^[HTMLElement]|!disabled,label","option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value","output^[HTMLElement]|defaultValue,%htmlFor,name,value","p^[HTMLElement]|align","param^[HTMLElement]|name,type,value,valueType","picture^[HTMLElement]|","pre^[HTMLElement]|#width","progress^[HTMLElement]|#max,#value","q,blockquote,cite^[HTMLElement]|","script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,!noModule,%referrerPolicy,src,text,type","select^[HTMLElement]|autocomplete,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value","slot^[HTMLElement]|name","source^[HTMLElement]|#height,media,sizes,src,srcset,type,#width","span^[HTMLElement]|","style^[HTMLElement]|!disabled,media,type","caption^[HTMLElement]|align","th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width","col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width","table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width","tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign","tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign","template^[HTMLElement]|","textarea^[HTMLElement]|autocomplete,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap","time^[HTMLElement]|dateTime","title^[HTMLElement]|text","track^[HTMLElement]|!default,kind,label,src,srclang","ul^[HTMLElement]|!compact,type","unknown^[HTMLElement]|","video^media|!disablePictureInPicture,#height,*enterpictureinpicture,*leavepictureinpicture,!playsInline,poster,#width",":svg:a^:svg:graphics|",":svg:animate^:svg:animation|",":svg:animateMotion^:svg:animation|",":svg:animateTransform^:svg:animation|",":svg:circle^:svg:geometry|",":svg:clipPath^:svg:graphics|",":svg:defs^:svg:graphics|",":svg:desc^:svg:|",":svg:discard^:svg:|",":svg:ellipse^:svg:geometry|",":svg:feBlend^:svg:|",":svg:feColorMatrix^:svg:|",":svg:feComponentTransfer^:svg:|",":svg:feComposite^:svg:|",":svg:feConvolveMatrix^:svg:|",":svg:feDiffuseLighting^:svg:|",":svg:feDisplacementMap^:svg:|",":svg:feDistantLight^:svg:|",":svg:feDropShadow^:svg:|",":svg:feFlood^:svg:|",":svg:feFuncA^:svg:componentTransferFunction|",":svg:feFuncB^:svg:componentTransferFunction|",":svg:feFuncG^:svg:componentTransferFunction|",":svg:feFuncR^:svg:componentTransferFunction|",":svg:feGaussianBlur^:svg:|",":svg:feImage^:svg:|",":svg:feMerge^:svg:|",":svg:feMergeNode^:svg:|",":svg:feMorphology^:svg:|",":svg:feOffset^:svg:|",":svg:fePointLight^:svg:|",":svg:feSpecularLighting^:svg:|",":svg:feSpotLight^:svg:|",":svg:feTile^:svg:|",":svg:feTurbulence^:svg:|",":svg:filter^:svg:|",":svg:foreignObject^:svg:graphics|",":svg:g^:svg:graphics|",":svg:image^:svg:graphics|decoding",":svg:line^:svg:geometry|",":svg:linearGradient^:svg:gradient|",":svg:mpath^:svg:|",":svg:marker^:svg:|",":svg:mask^:svg:|",":svg:metadata^:svg:|",":svg:path^:svg:geometry|",":svg:pattern^:svg:|",":svg:polygon^:svg:geometry|",":svg:polyline^:svg:geometry|",":svg:radialGradient^:svg:gradient|",":svg:rect^:svg:geometry|",":svg:svg^:svg:graphics|#currentScale,#zoomAndPan",":svg:script^:svg:|type",":svg:set^:svg:animation|",":svg:stop^:svg:|",":svg:style^:svg:|!disabled,media,title,type",":svg:switch^:svg:graphics|",":svg:symbol^:svg:|",":svg:tspan^:svg:textPositioning|",":svg:text^:svg:textPositioning|",":svg:textPath^:svg:textContent|",":svg:title^:svg:|",":svg:use^:svg:graphics|",":svg:view^:svg:|#zoomAndPan","data^[HTMLElement]|value","keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name","menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default","summary^[HTMLElement]|","time^[HTMLElement]|dateTime",":svg:cursor^:svg:|",":math:^[HTMLElement]|!autofocus,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforeinput,*beforematch,*beforetoggle,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contentvisibilityautostatechange,*contextlost,*contextmenu,*contextrestored,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*scrollend,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,%style,#tabIndex",":math:math^:math:|",":math:maction^:math:|",":math:menclose^:math:|",":math:merror^:math:|",":math:mfenced^:math:|",":math:mfrac^:math:|",":math:mi^:math:|",":math:mmultiscripts^:math:|",":math:mn^:math:|",":math:mo^:math:|",":math:mover^:math:|",":math:mpadded^:math:|",":math:mphantom^:math:|",":math:mroot^:math:|",":math:mrow^:math:|",":math:ms^:math:|",":math:mspace^:math:|",":math:msqrt^:math:|",":math:mstyle^:math:|",":math:msub^:math:|",":math:msubsup^:math:|",":math:msup^:math:|",":math:mtable^:math:|",":math:mtd^:math:|",":math:mtext^:math:|",":math:mtr^:math:|",":math:munder^:math:|",":math:munderover^:math:|",":math:semantics^:math:|"],ld=new Map(Object.entries({class:"className",for:"htmlFor",formaction:"formAction",innerHtml:"innerHTML",readonly:"readOnly",tabindex:"tabIndex"})),Bx=Array.from(ld).reduce((u,[p,b])=>(u.set(p,b),u),new Map),jx=class extends Sx{constructor(){super(),this._schema=new Map,this._eventSchema=new Map,Mx.forEach(u=>{let p=new Map,b=new Set,[x,C]=u.split("|"),k=C.split(","),[F,M]=x.split("^");F.split(",").forEach(U=>{this._schema.set(U.toLowerCase(),p),this._eventSchema.set(U.toLowerCase(),b)});let P=M&&this._schema.get(M.toLowerCase());if(P){for(let[U,V]of P)p.set(U,V);for(let U of this._eventSchema.get(M.toLowerCase()))b.add(U)}k.forEach(U=>{if(U.length>0)switch(U[0]){case"*":b.add(U.substring(1));break;case"!":p.set(U.substring(1),Fx);break;case"#":p.set(U.substring(1),Ax);break;case"%":p.set(U.substring(1),Tx);break;default:p.set(U,Nx)}})})}hasProperty(u,p,b){if(b.some(x=>x.name===nd.name))return!0;if(u.indexOf("-")>-1){if(od(u)||id(u))return!1;if(b.some(x=>x.name===rd.name))return!0}return(this._schema.get(u.toLowerCase())||this._schema.get("unknown")).has(p)}hasElement(u,p){return p.some(b=>b.name===nd.name)||u.indexOf("-")>-1&&(od(u)||id(u)||p.some(b=>b.name===rd.name))?!0:this._schema.has(u.toLowerCase())}securityContext(u,p,b){b&&(p=this.getMappedPropName(p)),u=u.toLowerCase(),p=p.toLowerCase();let x=ad()[u+"|"+p];return x||(x=ad()["*|"+p],x||Br.NONE)}getMappedPropName(u){return ld.get(u)??u}getDefaultComponentElementName(){return"ng-component"}validateProperty(u){return u.toLowerCase().startsWith("on")?{error:!0,msg:`Binding to event property '${u}' is disallowed for security reasons, please use (${u.slice(2)})=...
35
- If '${u}' is a directive input, make sure the directive is imported by the current module.`}:{error:!1}}validateAttribute(u){return u.toLowerCase().startsWith("on")?{error:!0,msg:`Binding to event attribute '${u}' is disallowed for security reasons, please use (${u.slice(2)})=...`}:{error:!1}}allKnownElementNames(){return Array.from(this._schema.keys())}allKnownAttributesOfElement(u){let p=this._schema.get(u.toLowerCase())||this._schema.get("unknown");return Array.from(p.keys()).map(b=>Bx.get(b)??b)}allKnownEventsOfElement(u){return Array.from(this._eventSchema.get(u.toLowerCase())??[])}normalizeAnimationStyleProperty(u){return ox(u)}normalizeAnimationStyleValue(u,p,b){let x="",C=b.toString().trim(),k=null;if(Ox(u)&&b!==0&&b!=="0")if(typeof b=="number")x="px";else{let F=b.match(/^[+-]?[\d\.]+([a-z]*)$/);F&&F[1].length==0&&(k=`Please provide a CSS unit value for ${p}:${b}`)}return{error:k,value:C+x}}};function Ox(u){switch(u){case"width":case"height":case"minWidth":case"minHeight":case"maxWidth":case"maxHeight":case"left":case"top":case"bottom":case"right":case"fontSize":case"outlineWidth":case"outlineOffset":case"paddingTop":case"paddingLeft":case"paddingBottom":case"paddingRight":case"marginTop":case"marginLeft":case"marginBottom":case"marginRight":case"borderRadius":case"borderWidth":case"borderTopWidth":case"borderLeftWidth":case"borderRightWidth":case"borderBottomWidth":case"textIndent":return!0;default:return!1}}var Z=class{constructor({closedByChildren:u,implicitNamespacePrefix:p,contentType:b=xt.PARSABLE_DATA,closedByParent:x=!1,isVoid:C=!1,ignoreFirstLf:k=!1,preventNamespaceInheritance:F=!1,canSelfClose:M=!1}={}){this.closedByChildren={},this.closedByParent=!1,u&&u.length>0&&u.forEach(P=>this.closedByChildren[P]=!0),this.isVoid=C,this.closedByParent=x||C,this.implicitNamespacePrefix=p||null,this.contentType=b,this.ignoreFirstLf=k,this.preventNamespaceInheritance=F,this.canSelfClose=M??C}isClosedByChild(u){return this.isVoid||u.toLowerCase()in this.closedByChildren}getContentType(u){return typeof this.contentType=="object"?(u===void 0?void 0:this.contentType[u])??this.contentType.default:this.contentType}},ud,es;function fa(u){return es||(ud=new Z({canSelfClose:!0}),es=Object.assign(Object.create(null),{base:new Z({isVoid:!0}),meta:new Z({isVoid:!0}),area:new Z({isVoid:!0}),embed:new Z({isVoid:!0}),link:new Z({isVoid:!0}),img:new Z({isVoid:!0}),input:new Z({isVoid:!0}),param:new Z({isVoid:!0}),hr:new Z({isVoid:!0}),br:new Z({isVoid:!0}),source:new Z({isVoid:!0}),track:new Z({isVoid:!0}),wbr:new Z({isVoid:!0}),p:new Z({closedByChildren:["address","article","aside","blockquote","div","dl","fieldset","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","nav","ol","p","pre","section","table","ul"],closedByParent:!0}),thead:new Z({closedByChildren:["tbody","tfoot"]}),tbody:new Z({closedByChildren:["tbody","tfoot"],closedByParent:!0}),tfoot:new Z({closedByChildren:["tbody"],closedByParent:!0}),tr:new Z({closedByChildren:["tr"],closedByParent:!0}),td:new Z({closedByChildren:["td","th"],closedByParent:!0}),th:new Z({closedByChildren:["td","th"],closedByParent:!0}),col:new Z({isVoid:!0}),svg:new Z({implicitNamespacePrefix:"svg"}),foreignObject:new Z({implicitNamespacePrefix:"svg",preventNamespaceInheritance:!0}),math:new Z({implicitNamespacePrefix:"math"}),li:new Z({closedByChildren:["li"],closedByParent:!0}),dt:new Z({closedByChildren:["dt","dd"]}),dd:new Z({closedByChildren:["dt","dd"],closedByParent:!0}),rb:new Z({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rt:new Z({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rtc:new Z({closedByChildren:["rb","rtc","rp"],closedByParent:!0}),rp:new Z({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),optgroup:new Z({closedByChildren:["optgroup"],closedByParent:!0}),option:new Z({closedByChildren:["option","optgroup"],closedByParent:!0}),pre:new Z({ignoreFirstLf:!0}),listing:new Z({ignoreFirstLf:!0}),style:new Z({contentType:xt.RAW_TEXT}),script:new Z({contentType:xt.RAW_TEXT}),title:new Z({contentType:{default:xt.ESCAPABLE_RAW_TEXT,svg:xt.PARSABLE_DATA}}),textarea:new Z({contentType:xt.ESCAPABLE_RAW_TEXT,ignoreFirstLf:!0})}),new jx().allKnownElementNames().forEach(p=>{!es[p]&&ao(p)===null&&(es[p]=new Z({canSelfClose:!1}))})),es[u]??ud}var dn=class{constructor(u,p){this.sourceSpan=u,this.i18n=p}},Lx=class extends dn{constructor(u,p,b,x){super(p,x),this.value=u,this.tokens=b,this.type="text"}visit(u,p){return u.visitText(this,p)}},_x=class extends dn{constructor(u,p,b,x){super(p,x),this.value=u,this.tokens=b,this.type="cdata"}visit(u,p){return u.visitCdata(this,p)}},Ix=class extends dn{constructor(u,p,b,x,C,k){super(x,k),this.switchValue=u,this.type=p,this.cases=b,this.switchValueSourceSpan=C}visit(u,p){return u.visitExpansion(this,p)}},Rx=class{constructor(u,p,b,x,C){this.value=u,this.expression=p,this.sourceSpan=b,this.valueSourceSpan=x,this.expSourceSpan=C,this.type="expansionCase"}visit(u,p){return u.visitExpansionCase(this,p)}},Px=class extends dn{constructor(u,p,b,x,C,k,F){super(b,F),this.name=u,this.value=p,this.keySpan=x,this.valueSpan=C,this.valueTokens=k,this.type="attribute"}visit(u,p){return u.visitAttribute(this,p)}get nameSpan(){return this.keySpan}},nr=class extends dn{constructor(u,p,b,x,C,k=null,F=null,M){super(x,M),this.name=u,this.attrs=p,this.children=b,this.startSourceSpan=C,this.endSourceSpan=k,this.nameSpan=F,this.type="element"}visit(u,p){return u.visitElement(this,p)}},zx=class{constructor(u,p){this.value=u,this.sourceSpan=p,this.type="comment"}visit(u,p){return u.visitComment(this,p)}},$x=class{constructor(u,p){this.value=u,this.sourceSpan=p,this.type="docType"}visit(u,p){return u.visitDocType(this,p)}},pn=class extends dn{constructor(u,p,b,x,C,k,F=null,M){super(x,M),this.name=u,this.parameters=p,this.children=b,this.nameSpan=C,this.startSourceSpan=k,this.endSourceSpan=F,this.type="block"}visit(u,p){return u.visitBlock(this,p)}},cd=class{constructor(u,p){this.expression=u,this.sourceSpan=p,this.type="blockParameter",this.startSourceSpan=null,this.endSourceSpan=null}visit(u,p){return u.visitBlockParameter(this,p)}},dd=class{constructor(u,p,b,x,C){this.name=u,this.value=p,this.sourceSpan=b,this.nameSpan=x,this.valueSpan=C,this.type="letDeclaration",this.startSourceSpan=null,this.endSourceSpan=null}visit(u,p){return u.visitLetDeclaration(this,p)}};function pd(u,p,b=null){let x=[],C=u.visit?k=>u.visit(k,b)||k.visit(u,b):k=>k.visit(u,b);return p.forEach(k=>{let F=C(k);F&&x.push(F)}),x}var Hx=class{constructor(){}visitElement(u,p){this.visitChildren(p,b=>{b(u.attrs),b(u.children)})}visitAttribute(u,p){}visitText(u,p){}visitCdata(u,p){}visitComment(u,p){}visitDocType(u,p){}visitExpansion(u,p){return this.visitChildren(p,b=>{b(u.cases)})}visitExpansionCase(u,p){}visitBlock(u,p){this.visitChildren(p,b=>{b(u.parameters),b(u.children)})}visitBlockParameter(u,p){}visitLetDeclaration(u,p){}visitChildren(u,p){let b=[],x=this;function C(k){k&&b.push(pd(x,k,u))}return p(C),Array.prototype.concat.apply([],b)}},po={AElig:"Æ",AMP:"&",amp:"&",Aacute:"Á",Abreve:"Ă",Acirc:"Â",Acy:"А",Afr:"𝔄",Agrave:"À",Alpha:"Α",Amacr:"Ā",And:"⩓",Aogon:"Ą",Aopf:"𝔸",ApplyFunction:"⁡",af:"⁡",Aring:"Å",angst:"Å",Ascr:"𝒜",Assign:"≔",colone:"≔",coloneq:"≔",Atilde:"Ã",Auml:"Ä",Backslash:"∖",setminus:"∖",setmn:"∖",smallsetminus:"∖",ssetmn:"∖",Barv:"⫧",Barwed:"⌆",doublebarwedge:"⌆",Bcy:"Б",Because:"∵",becaus:"∵",because:"∵",Bernoullis:"ℬ",Bscr:"ℬ",bernou:"ℬ",Beta:"Β",Bfr:"𝔅",Bopf:"𝔹",Breve:"˘",breve:"˘",Bumpeq:"≎",HumpDownHump:"≎",bump:"≎",CHcy:"Ч",COPY:"©",copy:"©",Cacute:"Ć",Cap:"⋒",CapitalDifferentialD:"ⅅ",DD:"ⅅ",Cayleys:"ℭ",Cfr:"ℭ",Ccaron:"Č",Ccedil:"Ç",Ccirc:"Ĉ",Cconint:"∰",Cdot:"Ċ",Cedilla:"¸",cedil:"¸",CenterDot:"·",centerdot:"·",middot:"·",Chi:"Χ",CircleDot:"⊙",odot:"⊙",CircleMinus:"⊖",ominus:"⊖",CirclePlus:"⊕",oplus:"⊕",CircleTimes:"⊗",otimes:"⊗",ClockwiseContourIntegral:"∲",cwconint:"∲",CloseCurlyDoubleQuote:"”",rdquo:"”",rdquor:"”",CloseCurlyQuote:"’",rsquo:"’",rsquor:"’",Colon:"∷",Proportion:"∷",Colone:"⩴",Congruent:"≡",equiv:"≡",Conint:"∯",DoubleContourIntegral:"∯",ContourIntegral:"∮",conint:"∮",oint:"∮",Copf:"ℂ",complexes:"ℂ",Coproduct:"∐",coprod:"∐",CounterClockwiseContourIntegral:"∳",awconint:"∳",Cross:"⨯",Cscr:"𝒞",Cup:"⋓",CupCap:"≍",asympeq:"≍",DDotrahd:"⤑",DJcy:"Ђ",DScy:"Ѕ",DZcy:"Џ",Dagger:"‡",ddagger:"‡",Darr:"↡",Dashv:"⫤",DoubleLeftTee:"⫤",Dcaron:"Ď",Dcy:"Д",Del:"∇",nabla:"∇",Delta:"Δ",Dfr:"𝔇",DiacriticalAcute:"´",acute:"´",DiacriticalDot:"˙",dot:"˙",DiacriticalDoubleAcute:"˝",dblac:"˝",DiacriticalGrave:"`",grave:"`",DiacriticalTilde:"˜",tilde:"˜",Diamond:"⋄",diam:"⋄",diamond:"⋄",DifferentialD:"ⅆ",dd:"ⅆ",Dopf:"𝔻",Dot:"¨",DoubleDot:"¨",die:"¨",uml:"¨",DotDot:"⃜",DotEqual:"≐",doteq:"≐",esdot:"≐",DoubleDownArrow:"⇓",Downarrow:"⇓",dArr:"⇓",DoubleLeftArrow:"⇐",Leftarrow:"⇐",lArr:"⇐",DoubleLeftRightArrow:"⇔",Leftrightarrow:"⇔",hArr:"⇔",iff:"⇔",DoubleLongLeftArrow:"⟸",Longleftarrow:"⟸",xlArr:"⟸",DoubleLongLeftRightArrow:"⟺",Longleftrightarrow:"⟺",xhArr:"⟺",DoubleLongRightArrow:"⟹",Longrightarrow:"⟹",xrArr:"⟹",DoubleRightArrow:"⇒",Implies:"⇒",Rightarrow:"⇒",rArr:"⇒",DoubleRightTee:"⊨",vDash:"⊨",DoubleUpArrow:"⇑",Uparrow:"⇑",uArr:"⇑",DoubleUpDownArrow:"⇕",Updownarrow:"⇕",vArr:"⇕",DoubleVerticalBar:"∥",par:"∥",parallel:"∥",shortparallel:"∥",spar:"∥",DownArrow:"↓",ShortDownArrow:"↓",darr:"↓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",duarr:"⇵",DownBreve:"̑",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",leftharpoondown:"↽",lhard:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",rhard:"⇁",rightharpoondown:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",top:"⊤",DownTeeArrow:"↧",mapstodown:"↧",Dscr:"𝒟",Dstrok:"Đ",ENG:"Ŋ",ETH:"Ð",Eacute:"É",Ecaron:"Ě",Ecirc:"Ê",Ecy:"Э",Edot:"Ė",Efr:"𝔈",Egrave:"È",Element:"∈",in:"∈",isin:"∈",isinv:"∈",Emacr:"Ē",EmptySmallSquare:"◻",EmptyVerySmallSquare:"▫",Eogon:"Ę",Eopf:"𝔼",Epsilon:"Ε",Equal:"⩵",EqualTilde:"≂",eqsim:"≂",esim:"≂",Equilibrium:"⇌",rightleftharpoons:"⇌",rlhar:"⇌",Escr:"ℰ",expectation:"ℰ",Esim:"⩳",Eta:"Η",Euml:"Ë",Exists:"∃",exist:"∃",ExponentialE:"ⅇ",ee:"ⅇ",exponentiale:"ⅇ",Fcy:"Ф",Ffr:"𝔉",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",blacksquare:"▪",squarf:"▪",squf:"▪",Fopf:"𝔽",ForAll:"∀",forall:"∀",Fouriertrf:"ℱ",Fscr:"ℱ",GJcy:"Ѓ",GT:">",gt:">",Gamma:"Γ",Gammad:"Ϝ",Gbreve:"Ğ",Gcedil:"Ģ",Gcirc:"Ĝ",Gcy:"Г",Gdot:"Ġ",Gfr:"𝔊",Gg:"⋙",ggg:"⋙",Gopf:"𝔾",GreaterEqual:"≥",ge:"≥",geq:"≥",GreaterEqualLess:"⋛",gel:"⋛",gtreqless:"⋛",GreaterFullEqual:"≧",gE:"≧",geqq:"≧",GreaterGreater:"⪢",GreaterLess:"≷",gl:"≷",gtrless:"≷",GreaterSlantEqual:"⩾",geqslant:"⩾",ges:"⩾",GreaterTilde:"≳",gsim:"≳",gtrsim:"≳",Gscr:"𝒢",Gt:"≫",NestedGreaterGreater:"≫",gg:"≫",HARDcy:"Ъ",Hacek:"ˇ",caron:"ˇ",Hat:"^",Hcirc:"Ĥ",Hfr:"ℌ",Poincareplane:"ℌ",HilbertSpace:"ℋ",Hscr:"ℋ",hamilt:"ℋ",Hopf:"ℍ",quaternions:"ℍ",HorizontalLine:"─",boxh:"─",Hstrok:"Ħ",HumpEqual:"≏",bumpe:"≏",bumpeq:"≏",IEcy:"Е",IJlig:"IJ",IOcy:"Ё",Iacute:"Í",Icirc:"Î",Icy:"И",Idot:"İ",Ifr:"ℑ",Im:"ℑ",image:"ℑ",imagpart:"ℑ",Igrave:"Ì",Imacr:"Ī",ImaginaryI:"ⅈ",ii:"ⅈ",Int:"∬",Integral:"∫",int:"∫",Intersection:"⋂",bigcap:"⋂",xcap:"⋂",InvisibleComma:"⁣",ic:"⁣",InvisibleTimes:"⁢",it:"⁢",Iogon:"Į",Iopf:"𝕀",Iota:"Ι",Iscr:"ℐ",imagline:"ℐ",Itilde:"Ĩ",Iukcy:"І",Iuml:"Ï",Jcirc:"Ĵ",Jcy:"Й",Jfr:"𝔍",Jopf:"𝕁",Jscr:"𝒥",Jsercy:"Ј",Jukcy:"Є",KHcy:"Х",KJcy:"Ќ",Kappa:"Κ",Kcedil:"Ķ",Kcy:"К",Kfr:"𝔎",Kopf:"𝕂",Kscr:"𝒦",LJcy:"Љ",LT:"<",lt:"<",Lacute:"Ĺ",Lambda:"Λ",Lang:"⟪",Laplacetrf:"ℒ",Lscr:"ℒ",lagran:"ℒ",Larr:"↞",twoheadleftarrow:"↞",Lcaron:"Ľ",Lcedil:"Ļ",Lcy:"Л",LeftAngleBracket:"⟨",lang:"⟨",langle:"⟨",LeftArrow:"←",ShortLeftArrow:"←",larr:"←",leftarrow:"←",slarr:"←",LeftArrowBar:"⇤",larrb:"⇤",LeftArrowRightArrow:"⇆",leftrightarrows:"⇆",lrarr:"⇆",LeftCeiling:"⌈",lceil:"⌈",LeftDoubleBracket:"⟦",lobrk:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",dharl:"⇃",downharpoonleft:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",lfloor:"⌊",LeftRightArrow:"↔",harr:"↔",leftrightarrow:"↔",LeftRightVector:"⥎",LeftTee:"⊣",dashv:"⊣",LeftTeeArrow:"↤",mapstoleft:"↤",LeftTeeVector:"⥚",LeftTriangle:"⊲",vartriangleleft:"⊲",vltri:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",ltrie:"⊴",trianglelefteq:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",uharl:"↿",upharpoonleft:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",leftharpoonup:"↼",lharu:"↼",LeftVectorBar:"⥒",LessEqualGreater:"⋚",leg:"⋚",lesseqgtr:"⋚",LessFullEqual:"≦",lE:"≦",leqq:"≦",LessGreater:"≶",lessgtr:"≶",lg:"≶",LessLess:"⪡",LessSlantEqual:"⩽",leqslant:"⩽",les:"⩽",LessTilde:"≲",lesssim:"≲",lsim:"≲",Lfr:"𝔏",Ll:"⋘",Lleftarrow:"⇚",lAarr:"⇚",Lmidot:"Ŀ",LongLeftArrow:"⟵",longleftarrow:"⟵",xlarr:"⟵",LongLeftRightArrow:"⟷",longleftrightarrow:"⟷",xharr:"⟷",LongRightArrow:"⟶",longrightarrow:"⟶",xrarr:"⟶",Lopf:"𝕃",LowerLeftArrow:"↙",swarr:"↙",swarrow:"↙",LowerRightArrow:"↘",searr:"↘",searrow:"↘",Lsh:"↰",lsh:"↰",Lstrok:"Ł",Lt:"≪",NestedLessLess:"≪",ll:"≪",Map:"⤅",Mcy:"М",MediumSpace:" ",Mellintrf:"ℳ",Mscr:"ℳ",phmmat:"ℳ",Mfr:"𝔐",MinusPlus:"∓",mnplus:"∓",mp:"∓",Mopf:"𝕄",Mu:"Μ",NJcy:"Њ",Nacute:"Ń",Ncaron:"Ň",Ncedil:"Ņ",Ncy:"Н",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",ZeroWidthSpace:"​",NewLine:`
36
- `,Nfr:"𝔑",NoBreak:"⁠",NonBreakingSpace:" ",nbsp:" ",Nopf:"ℕ",naturals:"ℕ",Not:"⫬",NotCongruent:"≢",nequiv:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",npar:"∦",nparallel:"∦",nshortparallel:"∦",nspar:"∦",NotElement:"∉",notin:"∉",notinva:"∉",NotEqual:"≠",ne:"≠",NotEqualTilde:"≂̸",nesim:"≂̸",NotExists:"∄",nexist:"∄",nexists:"∄",NotGreater:"≯",ngt:"≯",ngtr:"≯",NotGreaterEqual:"≱",nge:"≱",ngeq:"≱",NotGreaterFullEqual:"≧̸",ngE:"≧̸",ngeqq:"≧̸",NotGreaterGreater:"≫̸",nGtv:"≫̸",NotGreaterLess:"≹",ntgl:"≹",NotGreaterSlantEqual:"⩾̸",ngeqslant:"⩾̸",nges:"⩾̸",NotGreaterTilde:"≵",ngsim:"≵",NotHumpDownHump:"≎̸",nbump:"≎̸",NotHumpEqual:"≏̸",nbumpe:"≏̸",NotLeftTriangle:"⋪",nltri:"⋪",ntriangleleft:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",nltrie:"⋬",ntrianglelefteq:"⋬",NotLess:"≮",nless:"≮",nlt:"≮",NotLessEqual:"≰",nle:"≰",nleq:"≰",NotLessGreater:"≸",ntlg:"≸",NotLessLess:"≪̸",nLtv:"≪̸",NotLessSlantEqual:"⩽̸",nleqslant:"⩽̸",nles:"⩽̸",NotLessTilde:"≴",nlsim:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",NotPrecedes:"⊀",npr:"⊀",nprec:"⊀",NotPrecedesEqual:"⪯̸",npre:"⪯̸",npreceq:"⪯̸",NotPrecedesSlantEqual:"⋠",nprcue:"⋠",NotReverseElement:"∌",notni:"∌",notniva:"∌",NotRightTriangle:"⋫",nrtri:"⋫",ntriangleright:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",nrtrie:"⋭",ntrianglerighteq:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",nsqsube:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",nsqsupe:"⋣",NotSubset:"⊂⃒",nsubset:"⊂⃒",vnsub:"⊂⃒",NotSubsetEqual:"⊈",nsube:"⊈",nsubseteq:"⊈",NotSucceeds:"⊁",nsc:"⊁",nsucc:"⊁",NotSucceedsEqual:"⪰̸",nsce:"⪰̸",nsucceq:"⪰̸",NotSucceedsSlantEqual:"⋡",nsccue:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",nsupset:"⊃⃒",vnsup:"⊃⃒",NotSupersetEqual:"⊉",nsupe:"⊉",nsupseteq:"⊉",NotTilde:"≁",nsim:"≁",NotTildeEqual:"≄",nsime:"≄",nsimeq:"≄",NotTildeFullEqual:"≇",ncong:"≇",NotTildeTilde:"≉",nap:"≉",napprox:"≉",NotVerticalBar:"∤",nmid:"∤",nshortmid:"∤",nsmid:"∤",Nscr:"𝒩",Ntilde:"Ñ",Nu:"Ν",OElig:"Œ",Oacute:"Ó",Ocirc:"Ô",Ocy:"О",Odblac:"Ő",Ofr:"𝔒",Ograve:"Ò",Omacr:"Ō",Omega:"Ω",ohm:"Ω",Omicron:"Ο",Oopf:"𝕆",OpenCurlyDoubleQuote:"“",ldquo:"“",OpenCurlyQuote:"‘",lsquo:"‘",Or:"⩔",Oscr:"𝒪",Oslash:"Ø",Otilde:"Õ",Otimes:"⨷",Ouml:"Ö",OverBar:"‾",oline:"‾",OverBrace:"⏞",OverBracket:"⎴",tbrk:"⎴",OverParenthesis:"⏜",PartialD:"∂",part:"∂",Pcy:"П",Pfr:"𝔓",Phi:"Φ",Pi:"Π",PlusMinus:"±",plusmn:"±",pm:"±",Popf:"ℙ",primes:"ℙ",Pr:"⪻",Precedes:"≺",pr:"≺",prec:"≺",PrecedesEqual:"⪯",pre:"⪯",preceq:"⪯",PrecedesSlantEqual:"≼",prcue:"≼",preccurlyeq:"≼",PrecedesTilde:"≾",precsim:"≾",prsim:"≾",Prime:"″",Product:"∏",prod:"∏",Proportional:"∝",prop:"∝",propto:"∝",varpropto:"∝",vprop:"∝",Pscr:"𝒫",Psi:"Ψ",QUOT:'"',quot:'"',Qfr:"𝔔",Qopf:"ℚ",rationals:"ℚ",Qscr:"𝒬",RBarr:"⤐",drbkarow:"⤐",REG:"®",circledR:"®",reg:"®",Racute:"Ŕ",Rang:"⟫",Rarr:"↠",twoheadrightarrow:"↠",Rarrtl:"⤖",Rcaron:"Ř",Rcedil:"Ŗ",Rcy:"Р",Re:"ℜ",Rfr:"ℜ",real:"ℜ",realpart:"ℜ",ReverseElement:"∋",SuchThat:"∋",ni:"∋",niv:"∋",ReverseEquilibrium:"⇋",leftrightharpoons:"⇋",lrhar:"⇋",ReverseUpEquilibrium:"⥯",duhar:"⥯",Rho:"Ρ",RightAngleBracket:"⟩",rang:"⟩",rangle:"⟩",RightArrow:"→",ShortRightArrow:"→",rarr:"→",rightarrow:"→",srarr:"→",RightArrowBar:"⇥",rarrb:"⇥",RightArrowLeftArrow:"⇄",rightleftarrows:"⇄",rlarr:"⇄",RightCeiling:"⌉",rceil:"⌉",RightDoubleBracket:"⟧",robrk:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",dharr:"⇂",downharpoonright:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rfloor:"⌋",RightTee:"⊢",vdash:"⊢",RightTeeArrow:"↦",map:"↦",mapsto:"↦",RightTeeVector:"⥛",RightTriangle:"⊳",vartriangleright:"⊳",vrtri:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",rtrie:"⊵",trianglerighteq:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",uharr:"↾",upharpoonright:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",rharu:"⇀",rightharpoonup:"⇀",RightVectorBar:"⥓",Ropf:"ℝ",reals:"ℝ",RoundImplies:"⥰",Rrightarrow:"⇛",rAarr:"⇛",Rscr:"ℛ",realine:"ℛ",Rsh:"↱",rsh:"↱",RuleDelayed:"⧴",SHCHcy:"Щ",SHcy:"Ш",SOFTcy:"Ь",Sacute:"Ś",Sc:"⪼",Scaron:"Š",Scedil:"Ş",Scirc:"Ŝ",Scy:"С",Sfr:"𝔖",ShortUpArrow:"↑",UpArrow:"↑",uarr:"↑",uparrow:"↑",Sigma:"Σ",SmallCircle:"∘",compfn:"∘",Sopf:"𝕊",Sqrt:"√",radic:"√",Square:"□",squ:"□",square:"□",SquareIntersection:"⊓",sqcap:"⊓",SquareSubset:"⊏",sqsub:"⊏",sqsubset:"⊏",SquareSubsetEqual:"⊑",sqsube:"⊑",sqsubseteq:"⊑",SquareSuperset:"⊐",sqsup:"⊐",sqsupset:"⊐",SquareSupersetEqual:"⊒",sqsupe:"⊒",sqsupseteq:"⊒",SquareUnion:"⊔",sqcup:"⊔",Sscr:"𝒮",Star:"⋆",sstarf:"⋆",Sub:"⋐",Subset:"⋐",SubsetEqual:"⊆",sube:"⊆",subseteq:"⊆",Succeeds:"≻",sc:"≻",succ:"≻",SucceedsEqual:"⪰",sce:"⪰",succeq:"⪰",SucceedsSlantEqual:"≽",sccue:"≽",succcurlyeq:"≽",SucceedsTilde:"≿",scsim:"≿",succsim:"≿",Sum:"∑",sum:"∑",Sup:"⋑",Supset:"⋑",Superset:"⊃",sup:"⊃",supset:"⊃",SupersetEqual:"⊇",supe:"⊇",supseteq:"⊇",THORN:"Þ",TRADE:"™",trade:"™",TSHcy:"Ћ",TScy:"Ц",Tab:" ",Tau:"Τ",Tcaron:"Ť",Tcedil:"Ţ",Tcy:"Т",Tfr:"𝔗",Therefore:"∴",there4:"∴",therefore:"∴",Theta:"Θ",ThickSpace:"  ",ThinSpace:" ",thinsp:" ",Tilde:"∼",sim:"∼",thicksim:"∼",thksim:"∼",TildeEqual:"≃",sime:"≃",simeq:"≃",TildeFullEqual:"≅",cong:"≅",TildeTilde:"≈",ap:"≈",approx:"≈",asymp:"≈",thickapprox:"≈",thkap:"≈",Topf:"𝕋",TripleDot:"⃛",tdot:"⃛",Tscr:"𝒯",Tstrok:"Ŧ",Uacute:"Ú",Uarr:"↟",Uarrocir:"⥉",Ubrcy:"Ў",Ubreve:"Ŭ",Ucirc:"Û",Ucy:"У",Udblac:"Ű",Ufr:"𝔘",Ugrave:"Ù",Umacr:"Ū",UnderBar:"_",lowbar:"_",UnderBrace:"⏟",UnderBracket:"⎵",bbrk:"⎵",UnderParenthesis:"⏝",Union:"⋃",bigcup:"⋃",xcup:"⋃",UnionPlus:"⊎",uplus:"⊎",Uogon:"Ų",Uopf:"𝕌",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",udarr:"⇅",UpDownArrow:"↕",updownarrow:"↕",varr:"↕",UpEquilibrium:"⥮",udhar:"⥮",UpTee:"⊥",bot:"⊥",bottom:"⊥",perp:"⊥",UpTeeArrow:"↥",mapstoup:"↥",UpperLeftArrow:"↖",nwarr:"↖",nwarrow:"↖",UpperRightArrow:"↗",nearr:"↗",nearrow:"↗",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",Uring:"Ů",Uscr:"𝒰",Utilde:"Ũ",Uuml:"Ü",VDash:"⊫",Vbar:"⫫",Vcy:"В",Vdash:"⊩",Vdashl:"⫦",Vee:"⋁",bigvee:"⋁",xvee:"⋁",Verbar:"‖",Vert:"‖",VerticalBar:"∣",mid:"∣",shortmid:"∣",smid:"∣",VerticalLine:"|",verbar:"|",vert:"|",VerticalSeparator:"❘",VerticalTilde:"≀",wr:"≀",wreath:"≀",VeryThinSpace:" ",hairsp:" ",Vfr:"𝔙",Vopf:"𝕍",Vscr:"𝒱",Vvdash:"⊪",Wcirc:"Ŵ",Wedge:"⋀",bigwedge:"⋀",xwedge:"⋀",Wfr:"𝔚",Wopf:"𝕎",Wscr:"𝒲",Xfr:"𝔛",Xi:"Ξ",Xopf:"𝕏",Xscr:"𝒳",YAcy:"Я",YIcy:"Ї",YUcy:"Ю",Yacute:"Ý",Ycirc:"Ŷ",Ycy:"Ы",Yfr:"𝔜",Yopf:"𝕐",Yscr:"𝒴",Yuml:"Ÿ",ZHcy:"Ж",Zacute:"Ź",Zcaron:"Ž",Zcy:"З",Zdot:"Ż",Zeta:"Ζ",Zfr:"ℨ",zeetrf:"ℨ",Zopf:"ℤ",integers:"ℤ",Zscr:"𝒵",aacute:"á",abreve:"ă",ac:"∾",mstpos:"∾",acE:"∾̳",acd:"∿",acirc:"â",acy:"а",aelig:"æ",afr:"𝔞",agrave:"à",alefsym:"ℵ",aleph:"ℵ",alpha:"α",amacr:"ā",amalg:"⨿",and:"∧",wedge:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",angle:"∠",ange:"⦤",angmsd:"∡",measuredangle:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angzarr:"⍼",aogon:"ą",aopf:"𝕒",apE:"⩰",apacir:"⩯",ape:"≊",approxeq:"≊",apid:"≋",apos:"'",aring:"å",ascr:"𝒶",ast:"*",midast:"*",atilde:"ã",auml:"ä",awint:"⨑",bNot:"⫭",backcong:"≌",bcong:"≌",backepsilon:"϶",bepsi:"϶",backprime:"‵",bprime:"‵",backsim:"∽",bsim:"∽",backsimeq:"⋍",bsime:"⋍",barvee:"⊽",barwed:"⌅",barwedge:"⌅",bbrktbrk:"⎶",bcy:"б",bdquo:"„",ldquor:"„",bemptyv:"⦰",beta:"β",beth:"ℶ",between:"≬",twixt:"≬",bfr:"𝔟",bigcirc:"◯",xcirc:"◯",bigodot:"⨀",xodot:"⨀",bigoplus:"⨁",xoplus:"⨁",bigotimes:"⨂",xotime:"⨂",bigsqcup:"⨆",xsqcup:"⨆",bigstar:"★",starf:"★",bigtriangledown:"▽",xdtri:"▽",bigtriangleup:"△",xutri:"△",biguplus:"⨄",xuplus:"⨄",bkarow:"⤍",rbarr:"⤍",blacklozenge:"⧫",lozf:"⧫",blacktriangle:"▴",utrif:"▴",blacktriangledown:"▾",dtrif:"▾",blacktriangleleft:"◂",ltrif:"◂",blacktriangleright:"▸",rtrif:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bnot:"⌐",bopf:"𝕓",bowtie:"⋈",boxDL:"╗",boxDR:"╔",boxDl:"╖",boxDr:"╓",boxH:"═",boxHD:"╦",boxHU:"╩",boxHd:"╤",boxHu:"╧",boxUL:"╝",boxUR:"╚",boxUl:"╜",boxUr:"╙",boxV:"║",boxVH:"╬",boxVL:"╣",boxVR:"╠",boxVh:"╫",boxVl:"╢",boxVr:"╟",boxbox:"⧉",boxdL:"╕",boxdR:"╒",boxdl:"┐",boxdr:"┌",boxhD:"╥",boxhU:"╨",boxhd:"┬",boxhu:"┴",boxminus:"⊟",minusb:"⊟",boxplus:"⊞",plusb:"⊞",boxtimes:"⊠",timesb:"⊠",boxuL:"╛",boxuR:"╘",boxul:"┘",boxur:"└",boxv:"│",boxvH:"╪",boxvL:"╡",boxvR:"╞",boxvh:"┼",boxvl:"┤",boxvr:"├",brvbar:"¦",bscr:"𝒷",bsemi:"⁏",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bumpE:"⪮",cacute:"ć",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",caps:"∩︀",caret:"⁁",ccaps:"⩍",ccaron:"č",ccedil:"ç",ccirc:"ĉ",ccups:"⩌",ccupssm:"⩐",cdot:"ċ",cemptyv:"⦲",cent:"¢",cfr:"𝔠",chcy:"ч",check:"✓",checkmark:"✓",chi:"χ",cir:"○",cirE:"⧃",circ:"ˆ",circeq:"≗",cire:"≗",circlearrowleft:"↺",olarr:"↺",circlearrowright:"↻",orarr:"↻",circledS:"Ⓢ",oS:"Ⓢ",circledast:"⊛",oast:"⊛",circledcirc:"⊚",ocir:"⊚",circleddash:"⊝",odash:"⊝",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",clubs:"♣",clubsuit:"♣",colon:":",comma:",",commat:"@",comp:"∁",complement:"∁",congdot:"⩭",copf:"𝕔",copysr:"℗",crarr:"↵",cross:"✗",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",curlyeqprec:"⋞",cuesc:"⋟",curlyeqsucc:"⋟",cularr:"↶",curvearrowleft:"↶",cularrp:"⤽",cup:"∪",cupbrcap:"⩈",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curvearrowright:"↷",curarrm:"⤼",curlyvee:"⋎",cuvee:"⋎",curlywedge:"⋏",cuwed:"⋏",curren:"¤",cwint:"∱",cylcty:"⌭",dHar:"⥥",dagger:"†",daleth:"ℸ",dash:"‐",hyphen:"‐",dbkarow:"⤏",rBarr:"⤏",dcaron:"ď",dcy:"д",ddarr:"⇊",downdownarrows:"⇊",ddotseq:"⩷",eDDot:"⩷",deg:"°",delta:"δ",demptyv:"⦱",dfisht:"⥿",dfr:"𝔡",diamondsuit:"♦",diams:"♦",digamma:"ϝ",gammad:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",djcy:"ђ",dlcorn:"⌞",llcorner:"⌞",dlcrop:"⌍",dollar:"$",dopf:"𝕕",doteqdot:"≑",eDot:"≑",dotminus:"∸",minusd:"∸",dotplus:"∔",plusdo:"∔",dotsquare:"⊡",sdotb:"⊡",drcorn:"⌟",lrcorner:"⌟",drcrop:"⌌",dscr:"𝒹",dscy:"ѕ",dsol:"⧶",dstrok:"đ",dtdot:"⋱",dtri:"▿",triangledown:"▿",dwangle:"⦦",dzcy:"џ",dzigrarr:"⟿",eacute:"é",easter:"⩮",ecaron:"ě",ecir:"≖",eqcirc:"≖",ecirc:"ê",ecolon:"≕",eqcolon:"≕",ecy:"э",edot:"ė",efDot:"≒",fallingdotseq:"≒",efr:"𝔢",eg:"⪚",egrave:"è",egs:"⪖",eqslantgtr:"⪖",egsdot:"⪘",el:"⪙",elinters:"⏧",ell:"ℓ",els:"⪕",eqslantless:"⪕",elsdot:"⪗",emacr:"ē",empty:"∅",emptyset:"∅",emptyv:"∅",varnothing:"∅",emsp13:" ",emsp14:" ",emsp:" ",eng:"ŋ",ensp:" ",eogon:"ę",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",epsilon:"ε",epsiv:"ϵ",straightepsilon:"ϵ",varepsilon:"ϵ",equals:"=",equest:"≟",questeq:"≟",equivDD:"⩸",eqvparsl:"⧥",erDot:"≓",risingdotseq:"≓",erarr:"⥱",escr:"ℯ",eta:"η",eth:"ð",euml:"ë",euro:"€",excl:"!",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",ffr:"𝔣",filig:"fi",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",fopf:"𝕗",fork:"⋔",pitchfork:"⋔",forkv:"⫙",fpartint:"⨍",frac12:"½",half:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",sfrown:"⌢",fscr:"𝒻",gEl:"⪌",gtreqqless:"⪌",gacute:"ǵ",gamma:"γ",gap:"⪆",gtrapprox:"⪆",gbreve:"ğ",gcirc:"ĝ",gcy:"г",gdot:"ġ",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",gfr:"𝔤",gimel:"ℷ",gjcy:"ѓ",glE:"⪒",gla:"⪥",glj:"⪤",gnE:"≩",gneqq:"≩",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gneq:"⪈",gnsim:"⋧",gopf:"𝕘",gscr:"ℊ",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtrdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrarr:"⥸",gvertneqq:"≩︀",gvnE:"≩︀",hardcy:"ъ",harrcir:"⥈",harrw:"↭",leftrightsquigarrow:"↭",hbar:"ℏ",hslash:"ℏ",planck:"ℏ",plankv:"ℏ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",mldr:"…",hercon:"⊹",hfr:"𝔥",hksearow:"⤥",searhk:"⤥",hkswarow:"⤦",swarhk:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",larrhk:"↩",hookrightarrow:"↪",rarrhk:"↪",hopf:"𝕙",horbar:"―",hscr:"𝒽",hstrok:"ħ",hybull:"⁃",iacute:"í",icirc:"î",icy:"и",iecy:"е",iexcl:"¡",ifr:"𝔦",igrave:"ì",iiiint:"⨌",qint:"⨌",iiint:"∭",tint:"∭",iinfin:"⧜",iiota:"℩",ijlig:"ij",imacr:"ī",imath:"ı",inodot:"ı",imof:"⊷",imped:"Ƶ",incare:"℅",infin:"∞",infintie:"⧝",intcal:"⊺",intercal:"⊺",intlarhk:"⨗",intprod:"⨼",iprod:"⨼",iocy:"ё",iogon:"į",iopf:"𝕚",iota:"ι",iquest:"¿",iscr:"𝒾",isinE:"⋹",isindot:"⋵",isins:"⋴",isinsv:"⋳",itilde:"ĩ",iukcy:"і",iuml:"ï",jcirc:"ĵ",jcy:"й",jfr:"𝔧",jmath:"ȷ",jopf:"𝕛",jscr:"𝒿",jsercy:"ј",jukcy:"є",kappa:"κ",kappav:"ϰ",varkappa:"ϰ",kcedil:"ķ",kcy:"к",kfr:"𝔨",kgreen:"ĸ",khcy:"х",kjcy:"ќ",kopf:"𝕜",kscr:"𝓀",lAtail:"⤛",lBarr:"⤎",lEg:"⪋",lesseqqgtr:"⪋",lHar:"⥢",lacute:"ĺ",laemptyv:"⦴",lambda:"λ",langd:"⦑",lap:"⪅",lessapprox:"⪅",laquo:"«",larrbfs:"⤟",larrfs:"⤝",larrlp:"↫",looparrowleft:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",leftarrowtail:"↢",lat:"⪫",latail:"⤙",late:"⪭",lates:"⪭︀",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lcub:"{",lbrack:"[",lsqb:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",lcaron:"ľ",lcedil:"ļ",lcy:"л",ldca:"⤶",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",leq:"≤",leftleftarrows:"⇇",llarr:"⇇",leftthreetimes:"⋋",lthree:"⋋",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessdot:"⋖",ltdot:"⋖",lfisht:"⥼",lfr:"𝔩",lgE:"⪑",lharul:"⥪",lhblk:"▄",ljcy:"љ",llhard:"⥫",lltri:"◺",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnE:"≨",lneqq:"≨",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lneq:"⪇",lnsim:"⋦",loang:"⟬",loarr:"⇽",longmapsto:"⟼",xmap:"⟼",looparrowright:"↬",rarrlp:"↬",lopar:"⦅",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",loz:"◊",lozenge:"◊",lpar:"(",lparlt:"⦓",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",lsime:"⪍",lsimg:"⪏",lsquor:"‚",sbquo:"‚",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltrPar:"⦖",ltri:"◃",triangleleft:"◃",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",mDDot:"∺",macr:"¯",strns:"¯",male:"♂",malt:"✠",maltese:"✠",marker:"▮",mcomma:"⨩",mcy:"м",mdash:"—",mfr:"𝔪",mho:"℧",micro:"µ",midcir:"⫰",minus:"−",minusdu:"⨪",mlcp:"⫛",models:"⊧",mopf:"𝕞",mscr:"𝓂",mu:"μ",multimap:"⊸",mumap:"⊸",nGg:"⋙̸",nGt:"≫⃒",nLeftarrow:"⇍",nlArr:"⇍",nLeftrightarrow:"⇎",nhArr:"⇎",nLl:"⋘̸",nLt:"≪⃒",nRightarrow:"⇏",nrArr:"⇏",nVDash:"⊯",nVdash:"⊮",nacute:"ń",nang:"∠⃒",napE:"⩰̸",napid:"≋̸",napos:"ʼn",natur:"♮",natural:"♮",ncap:"⩃",ncaron:"ň",ncedil:"ņ",ncongdot:"⩭̸",ncup:"⩂",ncy:"н",ndash:"–",neArr:"⇗",nearhk:"⤤",nedot:"≐̸",nesear:"⤨",toea:"⤨",nfr:"𝔫",nharr:"↮",nleftrightarrow:"↮",nhpar:"⫲",nis:"⋼",nisd:"⋺",njcy:"њ",nlE:"≦̸",nleqq:"≦̸",nlarr:"↚",nleftarrow:"↚",nldr:"‥",nopf:"𝕟",not:"¬",notinE:"⋹̸",notindot:"⋵̸",notinvb:"⋷",notinvc:"⋶",notnivb:"⋾",notnivc:"⋽",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",nrarr:"↛",nrightarrow:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nscr:"𝓃",nsub:"⊄",nsubE:"⫅̸",nsubseteqq:"⫅̸",nsup:"⊅",nsupE:"⫆̸",nsupseteqq:"⫆̸",ntilde:"ñ",nu:"ν",num:"#",numero:"№",numsp:" ",nvDash:"⊭",nvHarr:"⤄",nvap:"≍⃒",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwArr:"⇖",nwarhk:"⤣",nwnear:"⤧",oacute:"ó",ocirc:"ô",ocy:"о",odblac:"ő",odiv:"⨸",odsold:"⦼",oelig:"œ",ofcir:"⦿",ofr:"𝔬",ogon:"˛",ograve:"ò",ogt:"⧁",ohbar:"⦵",olcir:"⦾",olcross:"⦻",olt:"⧀",omacr:"ō",omega:"ω",omicron:"ο",omid:"⦶",oopf:"𝕠",opar:"⦷",operp:"⦹",or:"∨",vee:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",oscr:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oslash:"ø",osol:"⊘",otilde:"õ",otimesas:"⨶",ouml:"ö",ovbar:"⌽",para:"¶",parsim:"⫳",parsl:"⫽",pcy:"п",percnt:"%",period:".",permil:"‰",pertenk:"‱",pfr:"𝔭",phi:"φ",phiv:"ϕ",straightphi:"ϕ",varphi:"ϕ",phone:"☎",pi:"π",piv:"ϖ",varpi:"ϖ",planckh:"ℎ",plus:"+",plusacir:"⨣",pluscir:"⨢",plusdu:"⨥",pluse:"⩲",plussim:"⨦",plustwo:"⨧",pointint:"⨕",popf:"𝕡",pound:"£",prE:"⪳",prap:"⪷",precapprox:"⪷",precnapprox:"⪹",prnap:"⪹",precneqq:"⪵",prnE:"⪵",precnsim:"⋨",prnsim:"⋨",prime:"′",profalar:"⌮",profline:"⌒",profsurf:"⌓",prurel:"⊰",pscr:"𝓅",psi:"ψ",puncsp:" ",qfr:"𝔮",qopf:"𝕢",qprime:"⁗",qscr:"𝓆",quatint:"⨖",quest:"?",rAtail:"⤜",rHar:"⥤",race:"∽̱",racute:"ŕ",raemptyv:"⦳",rangd:"⦒",range:"⦥",raquo:"»",rarrap:"⥵",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrpl:"⥅",rarrsim:"⥴",rarrtl:"↣",rightarrowtail:"↣",rarrw:"↝",rightsquigarrow:"↝",ratail:"⤚",ratio:"∶",rbbrk:"❳",rbrace:"}",rcub:"}",rbrack:"]",rsqb:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",rcaron:"ř",rcedil:"ŗ",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdsh:"↳",rect:"▭",rfisht:"⥽",rfr:"𝔯",rharul:"⥬",rho:"ρ",rhov:"ϱ",varrho:"ϱ",rightrightarrows:"⇉",rrarr:"⇉",rightthreetimes:"⋌",rthree:"⋌",ring:"˚",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",ropar:"⦆",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",rpar:")",rpargt:"⦔",rppolint:"⨒",rsaquo:"›",rscr:"𝓇",rtimes:"⋊",rtri:"▹",triangleright:"▹",rtriltri:"⧎",ruluhar:"⥨",rx:"℞",sacute:"ś",scE:"⪴",scap:"⪸",succapprox:"⪸",scaron:"š",scedil:"ş",scirc:"ŝ",scnE:"⪶",succneqq:"⪶",scnap:"⪺",succnapprox:"⪺",scnsim:"⋩",succnsim:"⋩",scpolint:"⨓",scy:"с",sdot:"⋅",sdote:"⩦",seArr:"⇘",sect:"§",semi:";",seswar:"⤩",tosa:"⤩",sext:"✶",sfr:"𝔰",sharp:"♯",shchcy:"щ",shcy:"ш",shy:"­",sigma:"σ",sigmaf:"ς",sigmav:"ς",varsigma:"ς",simdot:"⩪",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",smashp:"⨳",smeparsl:"⧤",smile:"⌣",ssmile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",sopf:"𝕤",spades:"♠",spadesuit:"♠",sqcaps:"⊓︀",sqcups:"⊔︀",sscr:"𝓈",star:"☆",sub:"⊂",subset:"⊂",subE:"⫅",subseteqq:"⫅",subdot:"⪽",subedot:"⫃",submult:"⫁",subnE:"⫋",subsetneqq:"⫋",subne:"⊊",subsetneq:"⊊",subplus:"⪿",subrarr:"⥹",subsim:"⫇",subsub:"⫕",subsup:"⫓",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",supE:"⫆",supseteqq:"⫆",supdot:"⪾",supdsub:"⫘",supedot:"⫄",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supsetneqq:"⫌",supne:"⊋",supsetneq:"⊋",supplus:"⫀",supsim:"⫈",supsub:"⫔",supsup:"⫖",swArr:"⇙",swnwar:"⤪",szlig:"ß",target:"⌖",tau:"τ",tcaron:"ť",tcedil:"ţ",tcy:"т",telrec:"⌕",tfr:"𝔱",theta:"θ",thetasym:"ϑ",thetav:"ϑ",vartheta:"ϑ",thorn:"þ",times:"×",timesbar:"⨱",timesd:"⨰",topbot:"⌶",topcir:"⫱",topf:"𝕥",topfork:"⫚",tprime:"‴",triangle:"▵",utri:"▵",triangleq:"≜",trie:"≜",tridot:"◬",triminus:"⨺",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",tscr:"𝓉",tscy:"ц",tshcy:"ћ",tstrok:"ŧ",uHar:"⥣",uacute:"ú",ubrcy:"ў",ubreve:"ŭ",ucirc:"û",ucy:"у",udblac:"ű",ufisht:"⥾",ufr:"𝔲",ugrave:"ù",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",umacr:"ū",uogon:"ų",uopf:"𝕦",upsi:"υ",upsilon:"υ",upuparrows:"⇈",uuarr:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",uring:"ů",urtri:"◹",uscr:"𝓊",utdot:"⋰",utilde:"ũ",uuml:"ü",uwangle:"⦧",vBar:"⫨",vBarv:"⫩",vangrt:"⦜",varsubsetneq:"⊊︀",vsubne:"⊊︀",varsubsetneqq:"⫋︀",vsubnE:"⫋︀",varsupsetneq:"⊋︀",vsupne:"⊋︀",varsupsetneqq:"⫌︀",vsupnE:"⫌︀",vcy:"в",veebar:"⊻",veeeq:"≚",vellip:"⋮",vfr:"𝔳",vopf:"𝕧",vscr:"𝓋",vzigzag:"⦚",wcirc:"ŵ",wedbar:"⩟",wedgeq:"≙",weierp:"℘",wp:"℘",wfr:"𝔴",wopf:"𝕨",wscr:"𝓌",xfr:"𝔵",xi:"ξ",xnis:"⋻",xopf:"𝕩",xscr:"𝓍",yacute:"ý",yacy:"я",ycirc:"ŷ",ycy:"ы",yen:"¥",yfr:"𝔶",yicy:"ї",yopf:"𝕪",yscr:"𝓎",yucy:"ю",yuml:"ÿ",zacute:"ź",zcaron:"ž",zcy:"з",zdot:"ż",zeta:"ζ",zfr:"𝔷",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",zscr:"𝓏",zwj:"‍",zwnj:"‌"},Vx="";po.ngsp=Vx;var qx=[/@/,/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function Wx(u,p){if(p!=null&&!(Array.isArray(p)&&p.length==2))throw new Error(`Expected '${u}' to be an array, [start, end].`);if(p!=null){let b=p[0],x=p[1];qx.forEach(C=>{if(C.test(b)||C.test(x))throw new Error(`['${b}', '${x}'] contains unusable interpolation symbol.`)})}}var Ux=class Xh{static fromArray(p){return p?(Wx("interpolation",p),new Xh(p[0],p[1])):hd}constructor(p,b){this.start=p,this.end=b}},hd=new Ux("{{","}}"),ma=class extends Gc{constructor(u,p,b){super(b,u),this.tokenType=p}},Jx=class{constructor(u,p,b){this.tokens=u,this.errors=p,this.nonNormalizedIcuExpressions=b}};function Kx(u,p,b,x={}){let C=new Xx(new Kc(u,p),b,x);return C.tokenize(),new Jx(n2(C.tokens),C.errors,C.nonNormalizedIcuExpressions)}var Gx=/\r\n?/g;function hn(u){return`Unexpected character "${u===0?"EOF":String.fromCharCode(u)}"`}function fd(u){return`Unknown entity "${u}" - use the "&#<decimal>;" or "&#x<hex>;" syntax`}function Yx(u,p){return`Unable to parse entity "${p}" - ${u} character reference entities must end with ";"`}var ho;(function(u){u.HEX="hexadecimal",u.DEC="decimal"})(ho||(ho={}));var ga=class{constructor(u){this.error=u}},Xx=class{constructor(u,p,b){this._getTagContentType=p,this._currentTokenStart=null,this._currentTokenType=null,this._expansionCaseStack=[],this._inInterpolation=!1,this._fullNameStack=[],this.tokens=[],this.errors=[],this.nonNormalizedIcuExpressions=[],this._tokenizeIcu=b.tokenizeExpansionForms||!1,this._interpolationConfig=b.interpolationConfig||hd,this._leadingTriviaCodePoints=b.leadingTriviaChars&&b.leadingTriviaChars.map(C=>C.codePointAt(0)||0),this._canSelfClose=b.canSelfClose||!1,this._allowHtmComponentClosingTags=b.allowHtmComponentClosingTags||!1;let x=b.range||{endPos:u.content.length,startPos:0,startLine:0,startCol:0};this._cursor=b.escapedString?new s2(u,x):new xd(u,x),this._preserveLineEndings=b.preserveLineEndings||!1,this._i18nNormalizeLineEndingsInICUs=b.i18nNormalizeLineEndingsInICUs||!1,this._tokenizeBlocks=b.tokenizeBlocks??!0,this._tokenizeLet=b.tokenizeLet??!0;try{this._cursor.init()}catch(C){this.handleError(C)}}_processCarriageReturns(u){return this._preserveLineEndings?u:u.replace(Gx,`
37
- `)}tokenize(){for(;this._cursor.peek()!==0;){let u=this._cursor.clone();try{if(this._attemptCharCode(60))if(this._attemptCharCode(33))this._attemptStr("[CDATA[")?this._consumeCdata(u):this._attemptStr("--")?this._consumeComment(u):this._attemptStrCaseInsensitive("doctype")?this._consumeDocType(u):this._consumeBogusComment(u);else if(this._attemptCharCode(47))this._consumeTagClose(u);else{let p=this._cursor.clone();this._attemptCharCode(63)?(this._cursor=p,this._consumeBogusComment(u)):this._consumeTagOpen(u)}else this._tokenizeLet&&this._cursor.peek()===64&&!this._inInterpolation&&this._attemptStr("@let")?this._consumeLetDeclaration(u):this._tokenizeBlocks&&this._attemptCharCode(64)?this._consumeBlockStart(u):this._tokenizeBlocks&&!this._inInterpolation&&!this._isInExpansionCase()&&!this._isInExpansionForm()&&this._attemptCharCode(125)?this._consumeBlockEnd(u):this._tokenizeIcu&&this._tokenizeExpansionForm()||this._consumeWithInterpolation(5,8,()=>this._isTextEnd(),()=>this._isTagStart())}catch(p){this.handleError(p)}}this._beginToken(34),this._endToken([])}_getBlockName(){let u=!1,p=this._cursor.clone();return this._attemptCharCodeUntilFn(b=>no(b)?!u:bd(b)?(u=!0,!1):!0),this._cursor.getChars(p).trim()}_consumeBlockStart(u){this._beginToken(25,u);let p=this._endToken([this._getBlockName()]);if(this._cursor.peek()===40)if(this._cursor.advance(),this._consumeBlockParameters(),this._attemptCharCodeUntilFn(ve),this._attemptCharCode(41))this._attemptCharCodeUntilFn(ve);else{p.type=29;return}this._attemptCharCode(123)?(this._beginToken(26),this._endToken([])):p.type=29}_consumeBlockEnd(u){this._beginToken(27,u),this._endToken([])}_consumeBlockParameters(){for(this._attemptCharCodeUntilFn(yd);this._cursor.peek()!==41&&this._cursor.peek()!==0;){this._beginToken(28);let u=this._cursor.clone(),p=null,b=0;for(;this._cursor.peek()!==59&&this._cursor.peek()!==0||p!==null;){let x=this._cursor.peek();if(x===92)this._cursor.advance();else if(x===p)p=null;else if(p===null&&pa(x))p=x;else if(x===40&&p===null)b++;else if(x===41&&p===null){if(b===0)break;b>0&&b--}this._cursor.advance()}this._endToken([this._cursor.getChars(u)]),this._attemptCharCodeUntilFn(yd)}}_consumeLetDeclaration(u){if(this._beginToken(30,u),no(this._cursor.peek()))this._attemptCharCodeUntilFn(ve);else{let b=this._endToken([this._cursor.getChars(u)]);b.type=33;return}let p=this._endToken([this._getLetDeclarationName()]);if(this._attemptCharCodeUntilFn(ve),!this._attemptCharCode(61)){p.type=33;return}this._attemptCharCodeUntilFn(b=>ve(b)&&!da(b)),this._consumeLetDeclarationValue(),this._cursor.peek()===59?(this._beginToken(32),this._endToken([]),this._cursor.advance()):(p.type=33,p.sourceSpan=this._cursor.getSpan(u))}_getLetDeclarationName(){let u=this._cursor.clone(),p=!1;return this._attemptCharCodeUntilFn(b=>so(b)||b===36||b===95||p&&ca(b)?(p=!0,!1):!0),this._cursor.getChars(u).trim()}_consumeLetDeclarationValue(){let u=this._cursor.clone();for(this._beginToken(31,u);this._cursor.peek()!==0;){let p=this._cursor.peek();if(p===59)break;pa(p)&&(this._cursor.advance(),this._attemptCharCodeUntilFn(b=>b===92?(this._cursor.advance(),!1):b===p)),this._cursor.advance()}this._endToken([this._cursor.getChars(u)])}_tokenizeExpansionForm(){if(this.isExpansionFormStart())return this._consumeExpansionFormStart(),!0;if(t2(this._cursor.peek())&&this._isInExpansionForm())return this._consumeExpansionCaseStart(),!0;if(this._cursor.peek()===125){if(this._isInExpansionCase())return this._consumeExpansionCaseEnd(),!0;if(this._isInExpansionForm())return this._consumeExpansionFormEnd(),!0}return!1}_beginToken(u,p=this._cursor.clone()){this._currentTokenStart=p,this._currentTokenType=u}_endToken(u,p){if(this._currentTokenStart===null)throw new ma("Programming error - attempted to end a token when there was no start to the token",this._currentTokenType,this._cursor.getSpan(p));if(this._currentTokenType===null)throw new ma("Programming error - attempted to end a token which has no token type",null,this._cursor.getSpan(this._currentTokenStart));let b={type:this._currentTokenType,parts:u,sourceSpan:(p??this._cursor).getSpan(this._currentTokenStart,this._leadingTriviaCodePoints)};return this.tokens.push(b),this._currentTokenStart=null,this._currentTokenType=null,b}_createError(u,p){this._isInExpansionForm()&&(u+=` (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)`);let b=new ma(u,this._currentTokenType,p);return this._currentTokenStart=null,this._currentTokenType=null,new ga(b)}handleError(u){if(u instanceof ba&&(u=this._createError(u.msg,this._cursor.getSpan(u.cursor))),u instanceof ga)this.errors.push(u.error);else throw u}_attemptCharCode(u){return this._cursor.peek()===u?(this._cursor.advance(),!0):!1}_attemptCharCodeCaseInsensitive(u){return r2(this._cursor.peek(),u)?(this._cursor.advance(),!0):!1}_requireCharCode(u){let p=this._cursor.clone();if(!this._attemptCharCode(u))throw this._createError(hn(this._cursor.peek()),this._cursor.getSpan(p))}_attemptStr(u){let p=u.length;if(this._cursor.charsLeft()<p)return!1;let b=this._cursor.clone();for(let x=0;x<p;x++)if(!this._attemptCharCode(u.charCodeAt(x)))return this._cursor=b,!1;return!0}_attemptStrCaseInsensitive(u){for(let p=0;p<u.length;p++)if(!this._attemptCharCodeCaseInsensitive(u.charCodeAt(p)))return!1;return!0}_requireStr(u){let p=this._cursor.clone();if(!this._attemptStr(u))throw this._createError(hn(this._cursor.peek()),this._cursor.getSpan(p))}_requireStrCaseInsensitive(u){let p=this._cursor.clone();if(!this._attemptStrCaseInsensitive(u))throw this._createError(hn(this._cursor.peek()),this._cursor.getSpan(p))}_attemptCharCodeUntilFn(u){for(;!u(this._cursor.peek());)this._cursor.advance()}_requireCharCodeUntilFn(u,p){let b=this._cursor.clone();if(this._attemptCharCodeUntilFn(u),this._cursor.diff(b)<p)throw this._createError(hn(this._cursor.peek()),this._cursor.getSpan(b))}_attemptUntilChar(u){for(;this._cursor.peek()!==u;)this._cursor.advance()}_readChar(){let u=String.fromCodePoint(this._cursor.peek());return this._cursor.advance(),u}_consumeEntity(u){this._beginToken(9);let p=this._cursor.clone();if(this._cursor.advance(),this._attemptCharCode(35)){let b=this._attemptCharCode(120)||this._attemptCharCode(88),x=this._cursor.clone();if(this._attemptCharCodeUntilFn(Zx),this._cursor.peek()!=59){this._cursor.advance();let k=b?ho.HEX:ho.DEC;throw this._createError(Yx(k,this._cursor.getChars(p)),this._cursor.getSpan())}let C=this._cursor.getChars(x);this._cursor.advance();try{let k=parseInt(C,b?16:10);this._endToken([String.fromCharCode(k),this._cursor.getChars(p)])}catch{throw this._createError(fd(this._cursor.getChars(p)),this._cursor.getSpan())}}else{let b=this._cursor.clone();if(this._attemptCharCodeUntilFn(e2),this._cursor.peek()!=59)this._beginToken(u,p),this._cursor=b,this._endToken(["&"]);else{let x=this._cursor.getChars(b);this._cursor.advance();let C=po[x];if(!C)throw this._createError(fd(x),this._cursor.getSpan(p));this._endToken([C,`&${x};`])}}}_consumeRawText(u,p){this._beginToken(u?6:7);let b=[];for(;;){let x=this._cursor.clone(),C=p();if(this._cursor=x,C)break;u&&this._cursor.peek()===38?(this._endToken([this._processCarriageReturns(b.join(""))]),b.length=0,this._consumeEntity(6),this._beginToken(6)):b.push(this._readChar())}this._endToken([this._processCarriageReturns(b.join(""))])}_consumeComment(u){this._beginToken(10,u),this._endToken([]),this._consumeRawText(!1,()=>this._attemptStr("-->")),this._beginToken(11),this._requireStr("-->"),this._endToken([])}_consumeBogusComment(u){this._beginToken(10,u),this._endToken([]),this._consumeRawText(!1,()=>this._cursor.peek()===62),this._beginToken(11),this._cursor.advance(),this._endToken([])}_consumeCdata(u){this._beginToken(12,u),this._endToken([]),this._consumeRawText(!1,()=>this._attemptStr("]]>")),this._beginToken(13),this._requireStr("]]>"),this._endToken([])}_consumeDocType(u){this._beginToken(18,u),this._endToken([]),this._consumeRawText(!1,()=>this._cursor.peek()===62),this._beginToken(19),this._cursor.advance(),this._endToken([])}_consumePrefixAndName(){let u=this._cursor.clone(),p="";for(;this._cursor.peek()!==58&&!Qx(this._cursor.peek());)this._cursor.advance();let b;this._cursor.peek()===58?(p=this._cursor.getChars(u),this._cursor.advance(),b=this._cursor.clone()):b=u,this._requireCharCodeUntilFn(md,p===""?0:1);let x=this._cursor.getChars(b);return[p,x]}_consumeTagOpen(u){let p,b,x,C=[];try{if(!so(this._cursor.peek()))throw this._createError(hn(this._cursor.peek()),this._cursor.getSpan(u));for(x=this._consumeTagOpenStart(u),b=x.parts[0],p=x.parts[1],this._attemptCharCodeUntilFn(ve);this._cursor.peek()!==47&&this._cursor.peek()!==62&&this._cursor.peek()!==60&&this._cursor.peek()!==0;){let[F,M]=this._consumeAttributeName();if(this._attemptCharCodeUntilFn(ve),this._attemptCharCode(61)){this._attemptCharCodeUntilFn(ve);let P=this._consumeAttributeValue();C.push({prefix:F,name:M,value:P})}else C.push({prefix:F,name:M});this._attemptCharCodeUntilFn(ve)}this._consumeTagOpenEnd()}catch(F){if(F instanceof ga){x?x.type=4:(this._beginToken(5,u),this._endToken(["<"]));return}throw F}if(this._canSelfClose&&this.tokens[this.tokens.length-1].type===2)return;let k=this._getTagContentType(p,b,this._fullNameStack.length>0,C);this._handleFullNameStackForTagOpen(b,p),k===xt.RAW_TEXT?this._consumeRawTextWithTagClose(b,p,!1):k===xt.ESCAPABLE_RAW_TEXT&&this._consumeRawTextWithTagClose(b,p,!0)}_consumeRawTextWithTagClose(u,p,b){this._consumeRawText(b,()=>!this._attemptCharCode(60)||!this._attemptCharCode(47)||(this._attemptCharCodeUntilFn(ve),!this._attemptStrCaseInsensitive(u?`${u}:${p}`:p))?!1:(this._attemptCharCodeUntilFn(ve),this._attemptCharCode(62))),this._beginToken(3),this._requireCharCodeUntilFn(x=>x===62,3),this._cursor.advance(),this._endToken([u,p]),this._handleFullNameStackForTagClose(u,p)}_consumeTagOpenStart(u){this._beginToken(0,u);let p=this._consumePrefixAndName();return this._endToken(p)}_consumeAttributeName(){let u=this._cursor.peek();if(u===39||u===34)throw this._createError(hn(u),this._cursor.getSpan());this._beginToken(14);let p=this._consumePrefixAndName();return this._endToken(p),p}_consumeAttributeValue(){let u;if(this._cursor.peek()===39||this._cursor.peek()===34){let p=this._cursor.peek();this._consumeQuote(p);let b=()=>this._cursor.peek()===p;u=this._consumeWithInterpolation(16,17,b,b),this._consumeQuote(p)}else{let p=()=>md(this._cursor.peek());u=this._consumeWithInterpolation(16,17,p,p)}return u}_consumeQuote(u){this._beginToken(15),this._requireCharCode(u),this._endToken([String.fromCodePoint(u)])}_consumeTagOpenEnd(){let u=this._attemptCharCode(47)?2:1;this._beginToken(u),this._requireCharCode(62),this._endToken([])}_consumeTagClose(u){if(this._beginToken(3,u),this._attemptCharCodeUntilFn(ve),this._allowHtmComponentClosingTags&&this._attemptCharCode(47))this._attemptCharCodeUntilFn(ve),this._requireCharCode(62),this._endToken([]);else{let[p,b]=this._consumePrefixAndName();this._attemptCharCodeUntilFn(ve),this._requireCharCode(62),this._endToken([p,b]),this._handleFullNameStackForTagClose(p,b)}}_consumeExpansionFormStart(){this._beginToken(20),this._requireCharCode(123),this._endToken([]),this._expansionCaseStack.push(20),this._beginToken(7);let u=this._readUntil(44),p=this._processCarriageReturns(u);if(this._i18nNormalizeLineEndingsInICUs)this._endToken([p]);else{let x=this._endToken([u]);p!==u&&this.nonNormalizedIcuExpressions.push(x)}this._requireCharCode(44),this._attemptCharCodeUntilFn(ve),this._beginToken(7);let b=this._readUntil(44);this._endToken([b]),this._requireCharCode(44),this._attemptCharCodeUntilFn(ve)}_consumeExpansionCaseStart(){this._beginToken(21);let u=this._readUntil(123).trim();this._endToken([u]),this._attemptCharCodeUntilFn(ve),this._beginToken(22),this._requireCharCode(123),this._endToken([]),this._attemptCharCodeUntilFn(ve),this._expansionCaseStack.push(22)}_consumeExpansionCaseEnd(){this._beginToken(23),this._requireCharCode(125),this._endToken([]),this._attemptCharCodeUntilFn(ve),this._expansionCaseStack.pop()}_consumeExpansionFormEnd(){this._beginToken(24),this._requireCharCode(125),this._endToken([]),this._expansionCaseStack.pop()}_consumeWithInterpolation(u,p,b,x){this._beginToken(u);let C=[];for(;!b();){let F=this._cursor.clone();this._interpolationConfig&&this._attemptStr(this._interpolationConfig.start)?(this._endToken([this._processCarriageReturns(C.join(""))],F),C.length=0,this._consumeInterpolation(p,F,x),this._beginToken(u)):this._cursor.peek()===38?(this._endToken([this._processCarriageReturns(C.join(""))]),C.length=0,this._consumeEntity(u),this._beginToken(u)):C.push(this._readChar())}this._inInterpolation=!1;let k=this._processCarriageReturns(C.join(""));return this._endToken([k]),k}_consumeInterpolation(u,p,b){let x=[];this._beginToken(u,p),x.push(this._interpolationConfig.start);let C=this._cursor.clone(),k=null,F=!1;for(;this._cursor.peek()!==0&&(b===null||!b());){let M=this._cursor.clone();if(this._isTagStart()){this._cursor=M,x.push(this._getProcessedChars(C,M)),this._endToken(x);return}if(k===null)if(this._attemptStr(this._interpolationConfig.end)){x.push(this._getProcessedChars(C,M)),x.push(this._interpolationConfig.end),this._endToken(x);return}else this._attemptStr("//")&&(F=!0);let P=this._cursor.peek();this._cursor.advance(),P===92?this._cursor.advance():P===k?k=null:!F&&k===null&&pa(P)&&(k=P)}x.push(this._getProcessedChars(C,this._cursor)),this._endToken(x)}_getProcessedChars(u,p){return this._processCarriageReturns(p.getChars(u))}_isTextEnd(){return!!(this._isTagStart()||this._cursor.peek()===0||this._tokenizeIcu&&!this._inInterpolation&&(this.isExpansionFormStart()||this._cursor.peek()===125&&this._isInExpansionCase())||this._tokenizeBlocks&&!this._inInterpolation&&!this._isInExpansion()&&(this._isBlockStart()||this._cursor.peek()===64||this._cursor.peek()===125))}_isTagStart(){if(this._cursor.peek()===60){let u=this._cursor.clone();u.advance();let p=u.peek();if(97<=p&&p<=122||65<=p&&p<=90||p===47||p===33)return!0}return!1}_isBlockStart(){if(this._tokenizeBlocks&&this._cursor.peek()===64){let u=this._cursor.clone();if(u.advance(),bd(u.peek()))return!0}return!1}_readUntil(u){let p=this._cursor.clone();return this._attemptUntilChar(u),this._cursor.getChars(p)}_isInExpansion(){return this._isInExpansionCase()||this._isInExpansionForm()}_isInExpansionCase(){return this._expansionCaseStack.length>0&&this._expansionCaseStack[this._expansionCaseStack.length-1]===22}_isInExpansionForm(){return this._expansionCaseStack.length>0&&this._expansionCaseStack[this._expansionCaseStack.length-1]===20}isExpansionFormStart(){if(this._cursor.peek()!==123)return!1;if(this._interpolationConfig){let u=this._cursor.clone(),p=this._attemptStr(this._interpolationConfig.start);return this._cursor=u,!p}return!0}_handleFullNameStackForTagOpen(u,p){let b=lo(u,p);(this._fullNameStack.length===0||this._fullNameStack[this._fullNameStack.length-1]===b)&&this._fullNameStack.push(b)}_handleFullNameStackForTagClose(u,p){let b=lo(u,p);this._fullNameStack.length!==0&&this._fullNameStack[this._fullNameStack.length-1]===b&&this._fullNameStack.pop()}};function ve(u){return!no(u)||u===0}function md(u){return no(u)||u===62||u===60||u===47||u===39||u===34||u===61||u===0}function Qx(u){return(u<97||122<u)&&(u<65||90<u)&&(u<48||u>57)}function Zx(u){return u===59||u===0||!nx(u)}function e2(u){return u===59||u===0||!so(u)}function t2(u){return u!==125}function r2(u,p){return gd(u)===gd(p)}function gd(u){return u>=97&&u<=122?u-97+65:u}function bd(u){return so(u)||ca(u)||u===95}function yd(u){return u!==59&&ve(u)}function n2(u){let p=[],b;for(let x=0;x<u.length;x++){let C=u[x];b&&b.type===5&&C.type===5||b&&b.type===16&&C.type===16?(b.parts[0]+=C.parts[0],b.sourceSpan.end=C.sourceSpan.end):(b=C,p.push(b))}return p}var xd=class al{constructor(p,b){if(p instanceof al){this.file=p.file,this.input=p.input,this.end=p.end;let x=p.state;this.state={peek:x.peek,offset:x.offset,line:x.line,column:x.column}}else{if(!b)throw new Error("Programming error: the range argument must be provided with a file argument.");this.file=p,this.input=p.content,this.end=b.endPos,this.state={peek:-1,offset:b.startPos,line:b.startLine,column:b.startCol}}}clone(){return new al(this)}peek(){return this.state.peek}charsLeft(){return this.end-this.state.offset}diff(p){return this.state.offset-p.state.offset}advance(){this.advanceState(this.state)}init(){this.updatePeek(this.state)}getSpan(p,b){p=p||this;let x=p;if(b)for(;this.diff(p)>0&&b.indexOf(p.peek())!==-1;)x===p&&(p=p.clone()),p.advance();let C=this.locationFromCursor(p),k=this.locationFromCursor(this),F=x!==p?this.locationFromCursor(x):C;return new ne(C,k,F)}getChars(p){return this.input.substring(p.state.offset,this.state.offset)}charAt(p){return this.input.charCodeAt(p)}advanceState(p){if(p.offset>=this.end)throw this.state=p,new ba('Unexpected character "EOF"',this);let b=this.charAt(p.offset);b===10?(p.line++,p.column=0):da(b)||p.column++,p.offset++,this.updatePeek(p)}updatePeek(p){p.peek=p.offset>=this.end?0:this.charAt(p.offset)}locationFromCursor(p){return new ha(p.file,p.state.offset,p.state.line,p.state.column)}},s2=class ll extends xd{constructor(p,b){p instanceof ll?(super(p),this.internalState={...p.internalState}):(super(p,b),this.internalState=this.state)}advance(){this.state=this.internalState,super.advance(),this.processEscapeSequence()}init(){super.init(),this.processEscapeSequence()}clone(){return new ll(this)}getChars(p){let b=p.clone(),x="";for(;b.internalState.offset<this.internalState.offset;)x+=String.fromCodePoint(b.peek()),b.advance();return x}processEscapeSequence(){let p=()=>this.internalState.peek;if(p()===92)if(this.internalState={...this.state},this.advanceState(this.internalState),p()===110)this.state.peek=10;else if(p()===114)this.state.peek=13;else if(p()===118)this.state.peek=11;else if(p()===116)this.state.peek=9;else if(p()===98)this.state.peek=8;else if(p()===102)this.state.peek=12;else if(p()===117)if(this.advanceState(this.internalState),p()===123){this.advanceState(this.internalState);let b=this.clone(),x=0;for(;p()!==125;)this.advanceState(this.internalState),x++;this.state.peek=this.decodeHexDigits(b,x)}else{let b=this.clone();this.advanceState(this.internalState),this.advanceState(this.internalState),this.advanceState(this.internalState),this.state.peek=this.decodeHexDigits(b,4)}else if(p()===120){this.advanceState(this.internalState);let b=this.clone();this.advanceState(this.internalState),this.state.peek=this.decodeHexDigits(b,2)}else if(Jc(p())){let b="",x=0,C=this.clone();for(;Jc(p())&&x<3;)C=this.clone(),b+=String.fromCodePoint(p()),this.advanceState(this.internalState),x++;this.state.peek=parseInt(b,8),this.internalState=C.internalState}else da(this.internalState.peek)?(this.advanceState(this.internalState),this.state=this.internalState):this.state.peek=this.internalState.peek}decodeHexDigits(p,b){let x=this.input.slice(p.internalState.offset,p.internalState.offset+b),C=parseInt(x,16);if(isNaN(C))throw p.state=p.internalState,new ba("Invalid hexadecimal escape sequence",p);return C}},ba=class{constructor(u,p){this.msg=u,this.cursor=p}},We=class Qh extends Gc{static create(p,b,x){return new Qh(p,b,x)}constructor(p,b,x){super(b,x),this.elementName=p}},o2=class{constructor(u,p){this.rootNodes=u,this.errors=p}},i2=class{constructor(u){this.getTagDefinition=u}parse(u,p,b,x=!1,C){let k=se=>(ce,...Ee)=>se(ce.toLowerCase(),...Ee),F=x?this.getTagDefinition:k(this.getTagDefinition),M=se=>F(se).getContentType(),P=x?C:k(C),U=Kx(u,p,C?(se,ce,Ee,Oe)=>{let $e=P(se,ce,Ee,Oe);return $e!==void 0?$e:M(se)}:M,b),V=b&&b.canSelfClose||!1,ie=b&&b.allowHtmComponentClosingTags||!1,ee=new a2(U.tokens,F,V,ie,x);return ee.build(),new o2(ee.rootNodes,U.errors.concat(ee.errors))}},a2=class Zh{constructor(p,b,x,C,k){this.tokens=p,this.getTagDefinition=b,this.canSelfClose=x,this.allowHtmComponentClosingTags=C,this.isTagNameCaseSensitive=k,this._index=-1,this._containerStack=[],this.rootNodes=[],this.errors=[],this._advance()}build(){for(;this._peek.type!==34;)this._peek.type===0||this._peek.type===4?this._consumeStartTag(this._advance()):this._peek.type===3?(this._closeVoidElement(),this._consumeEndTag(this._advance())):this._peek.type===12?(this._closeVoidElement(),this._consumeCdata(this._advance())):this._peek.type===10?(this._closeVoidElement(),this._consumeComment(this._advance())):this._peek.type===5||this._peek.type===7||this._peek.type===6?(this._closeVoidElement(),this._consumeText(this._advance())):this._peek.type===20?this._consumeExpansion(this._advance()):this._peek.type===25?(this._closeVoidElement(),this._consumeBlockOpen(this._advance())):this._peek.type===27?(this._closeVoidElement(),this._consumeBlockClose(this._advance())):this._peek.type===29?(this._closeVoidElement(),this._consumeIncompleteBlock(this._advance())):this._peek.type===30?(this._closeVoidElement(),this._consumeLet(this._advance())):this._peek.type===18?this._consumeDocType(this._advance()):this._peek.type===33?(this._closeVoidElement(),this._consumeIncompleteLet(this._advance())):this._advance();for(let p of this._containerStack)p instanceof pn&&this.errors.push(We.create(p.name,p.sourceSpan,`Unclosed block "${p.name}"`))}_advance(){let p=this._peek;return this._index<this.tokens.length-1&&this._index++,this._peek=this.tokens[this._index],p}_advanceIf(p){return this._peek.type===p?this._advance():null}_consumeCdata(p){let b=this._advance(),x=this._getText(b),C=this._advanceIf(13);this._addToParent(new _x(x,new ne(p.sourceSpan.start,(C||b).sourceSpan.end),[b]))}_consumeComment(p){let b=this._advanceIf(7),x=this._advanceIf(11),C=b!=null?b.parts[0].trim():null,k=x==null?p.sourceSpan:new ne(p.sourceSpan.start,x.sourceSpan.end,p.sourceSpan.fullStart);this._addToParent(new zx(C,k))}_consumeDocType(p){let b=this._advanceIf(7),x=this._advanceIf(19),C=b!=null?b.parts[0].trim():null,k=new ne(p.sourceSpan.start,(x||b||p).sourceSpan.end);this._addToParent(new $x(C,k))}_consumeExpansion(p){let b=this._advance(),x=this._advance(),C=[];for(;this._peek.type===21;){let F=this._parseExpansionCase();if(!F)return;C.push(F)}if(this._peek.type!==24){this.errors.push(We.create(null,this._peek.sourceSpan,"Invalid ICU message. Missing '}'."));return}let k=new ne(p.sourceSpan.start,this._peek.sourceSpan.end,p.sourceSpan.fullStart);this._addToParent(new Ix(b.parts[0],x.parts[0],C,k,b.sourceSpan)),this._advance()}_parseExpansionCase(){let p=this._advance();if(this._peek.type!==22)return this.errors.push(We.create(null,this._peek.sourceSpan,"Invalid ICU message. Missing '{'.")),null;let b=this._advance(),x=this._collectExpansionExpTokens(b);if(!x)return null;let C=this._advance();x.push({type:34,parts:[],sourceSpan:C.sourceSpan});let k=new Zh(x,this.getTagDefinition,this.canSelfClose,this.allowHtmComponentClosingTags,this.isTagNameCaseSensitive);if(k.build(),k.errors.length>0)return this.errors=this.errors.concat(k.errors),null;let F=new ne(p.sourceSpan.start,C.sourceSpan.end,p.sourceSpan.fullStart),M=new ne(b.sourceSpan.start,C.sourceSpan.end,b.sourceSpan.fullStart);return new Rx(p.parts[0],k.rootNodes,F,p.sourceSpan,M)}_collectExpansionExpTokens(p){let b=[],x=[22];for(;;){if((this._peek.type===20||this._peek.type===22)&&x.push(this._peek.type),this._peek.type===23)if(vd(x,22)){if(x.pop(),x.length===0)return b}else return this.errors.push(We.create(null,p.sourceSpan,"Invalid ICU message. Missing '}'.")),null;if(this._peek.type===24)if(vd(x,20))x.pop();else return this.errors.push(We.create(null,p.sourceSpan,"Invalid ICU message. Missing '}'.")),null;if(this._peek.type===34)return this.errors.push(We.create(null,p.sourceSpan,"Invalid ICU message. Missing '}'.")),null;b.push(this._advance())}}_getText(p){let b=p.parts[0];if(b.length>0&&b[0]==`
38
- `){let x=this._getClosestParentElement();x!=null&&x.children.length==0&&this.getTagDefinition(x.name).ignoreFirstLf&&(b=b.substring(1))}return b}_consumeText(p){let b=[p],x=p.sourceSpan,C=p.parts[0];if(C.length>0&&C[0]===`
39
- `){let k=this._getContainer();k!=null&&k.children.length===0&&this.getTagDefinition(k.name).ignoreFirstLf&&(C=C.substring(1),b[0]={type:p.type,sourceSpan:p.sourceSpan,parts:[C]})}for(;this._peek.type===8||this._peek.type===5||this._peek.type===9;)p=this._advance(),b.push(p),p.type===8?C+=p.parts.join("").replace(/&([^;]+);/g,wd):p.type===9?C+=p.parts[0]:C+=p.parts.join("");if(C.length>0){let k=p.sourceSpan;this._addToParent(new Lx(C,new ne(x.start,k.end,x.fullStart,x.details),b))}}_closeVoidElement(){let p=this._getContainer();p instanceof nr&&this.getTagDefinition(p.name).isVoid&&this._containerStack.pop()}_consumeStartTag(p){let[b,x]=p.parts,C=[];for(;this._peek.type===14;)C.push(this._consumeAttr(this._advance()));let k=this._getElementFullName(b,x,this._getClosestParentElement()),F=!1;if(this._peek.type===2){this._advance(),F=!0;let se=this.getTagDefinition(k);this.canSelfClose||se.canSelfClose||ao(k)!==null||se.isVoid||this.errors.push(We.create(k,p.sourceSpan,`Only void, custom and foreign elements can be self closed "${p.parts[1]}"`))}else this._peek.type===1&&(this._advance(),F=!1);let M=this._peek.sourceSpan.fullStart,P=new ne(p.sourceSpan.start,M,p.sourceSpan.fullStart),U=new ne(p.sourceSpan.start,M,p.sourceSpan.fullStart),V=new ne(p.sourceSpan.start.moveBy(1),p.sourceSpan.end),ie=new nr(k,C,[],P,U,void 0,V),ee=this._getContainer();this._pushContainer(ie,ee instanceof nr&&this.getTagDefinition(ee.name).isClosedByChild(ie.name)),F?this._popContainer(k,nr,P):p.type===4&&(this._popContainer(k,nr,null),this.errors.push(We.create(k,P,`Opening tag "${k}" not terminated.`)))}_pushContainer(p,b){b&&this._containerStack.pop(),this._addToParent(p),this._containerStack.push(p)}_consumeEndTag(p){let b=this.allowHtmComponentClosingTags&&p.parts.length===0?null:this._getElementFullName(p.parts[0],p.parts[1],this._getClosestParentElement());if(b&&this.getTagDefinition(b).isVoid)this.errors.push(We.create(b,p.sourceSpan,`Void elements do not have end tags "${p.parts[1]}"`));else if(!this._popContainer(b,nr,p.sourceSpan)){let x=`Unexpected closing tag "${b}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;this.errors.push(We.create(b,p.sourceSpan,x))}}_popContainer(p,b,x){let C=!1;for(let k=this._containerStack.length-1;k>=0;k--){let F=this._containerStack[k];if(ao(F.name)?F.name===p:(p==null||F.name.toLowerCase()===p.toLowerCase())&&F instanceof b)return F.endSourceSpan=x,F.sourceSpan.end=x!==null?x.end:F.sourceSpan.end,this._containerStack.splice(k,this._containerStack.length-k),!C;(F instanceof pn||F instanceof nr&&!this.getTagDefinition(F.name).closedByParent)&&(C=!0)}return!1}_consumeAttr(p){let b=lo(p.parts[0],p.parts[1]),x=p.sourceSpan.end,C;this._peek.type===15&&(C=this._advance());let k="",F=[],M,P;if(this._peek.type===16)for(M=this._peek.sourceSpan,P=this._peek.sourceSpan.end;this._peek.type===16||this._peek.type===17||this._peek.type===9;){let V=this._advance();F.push(V),V.type===17?k+=V.parts.join("").replace(/&([^;]+);/g,wd):V.type===9?k+=V.parts[0]:k+=V.parts.join(""),P=x=V.sourceSpan.end}this._peek.type===15&&(P=x=this._advance().sourceSpan.end);let U=M&&P&&new ne(C?.sourceSpan.start??M.start,P,C?.sourceSpan.fullStart??M.fullStart);return new Px(b,k,new ne(p.sourceSpan.start,x,p.sourceSpan.fullStart),p.sourceSpan,U,F.length>0?F:void 0,void 0)}_consumeBlockOpen(p){let b=[];for(;this._peek.type===28;){let M=this._advance();b.push(new cd(M.parts[0],M.sourceSpan))}this._peek.type===26&&this._advance();let x=this._peek.sourceSpan.fullStart,C=new ne(p.sourceSpan.start,x,p.sourceSpan.fullStart),k=new ne(p.sourceSpan.start,x,p.sourceSpan.fullStart),F=new pn(p.parts[0],b,[],C,p.sourceSpan,k);this._pushContainer(F,!1)}_consumeBlockClose(p){this._popContainer(null,pn,p.sourceSpan)||this.errors.push(We.create(null,p.sourceSpan,'Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the "&#125;" HTML entity instead.'))}_consumeIncompleteBlock(p){let b=[];for(;this._peek.type===28;){let M=this._advance();b.push(new cd(M.parts[0],M.sourceSpan))}let x=this._peek.sourceSpan.fullStart,C=new ne(p.sourceSpan.start,x,p.sourceSpan.fullStart),k=new ne(p.sourceSpan.start,x,p.sourceSpan.fullStart),F=new pn(p.parts[0],b,[],C,p.sourceSpan,k);this._pushContainer(F,!1),this._popContainer(null,pn,null),this.errors.push(We.create(p.parts[0],C,`Incomplete block "${p.parts[0]}". If you meant to write the @ character, you should use the "&#64;" HTML entity instead.`))}_consumeLet(p){let b=p.parts[0],x,C;if(this._peek.type!==31){this.errors.push(We.create(p.parts[0],p.sourceSpan,`Invalid @let declaration "${b}". Declaration must have a value.`));return}else x=this._advance();if(this._peek.type!==32){this.errors.push(We.create(p.parts[0],p.sourceSpan,`Unterminated @let declaration "${b}". Declaration must be terminated with a semicolon.`));return}else C=this._advance();let k=C.sourceSpan.fullStart,F=new ne(p.sourceSpan.start,k,p.sourceSpan.fullStart),M=p.sourceSpan.toString().lastIndexOf(b),P=p.sourceSpan.start.moveBy(M),U=new ne(P,p.sourceSpan.end),V=new dd(b,x.parts[0],F,U,x.sourceSpan);this._addToParent(V)}_consumeIncompleteLet(p){let b=p.parts[0]??"",x=b?` "${b}"`:"";if(b.length>0){let C=p.sourceSpan.toString().lastIndexOf(b),k=p.sourceSpan.start.moveBy(C),F=new ne(k,p.sourceSpan.end),M=new ne(p.sourceSpan.start,p.sourceSpan.start.moveBy(0)),P=new dd(b,"",p.sourceSpan,F,M);this._addToParent(P)}this.errors.push(We.create(p.parts[0],p.sourceSpan,`Incomplete @let declaration${x}. @let declarations must be written as \`@let <name> = <value>;\``))}_getContainer(){return this._containerStack.length>0?this._containerStack[this._containerStack.length-1]:null}_getClosestParentElement(){for(let p=this._containerStack.length-1;p>-1;p--)if(this._containerStack[p]instanceof nr)return this._containerStack[p];return null}_addToParent(p){let b=this._getContainer();b===null?this.rootNodes.push(p):b.children.push(p)}_getElementFullName(p,b,x){if(p===""&&(p=this.getTagDefinition(b).implicitNamespacePrefix||"",p===""&&x!=null)){let C=io(x.name)[1];this.getTagDefinition(C).preventNamespaceInheritance||(p=ao(x.name))}return lo(p,b)}};function vd(u,p){return u.length>0&&u[u.length-1]===p}function wd(u,p){return po[p]!==void 0?po[p]||u:/^#x[a-f0-9]+$/i.test(p)?String.fromCodePoint(parseInt(p.slice(2),16)):/^#\d+$/.test(p)?String.fromCodePoint(parseInt(p.slice(1),10)):u}var l2=class extends i2{constructor(){super(fa)}parse(u,p,b,x=!1,C){return super.parse(u,p,b,x,C)}},ya=null,u2=()=>(ya||(ya=new l2),ya);function Dd(u,p={}){let{canSelfClose:b=!1,allowHtmComponentClosingTags:x=!1,isTagNameCaseSensitive:C=!1,getTagContentType:k,tokenizeAngularBlocks:F=!1,tokenizeAngularLetDeclaration:M=!1}=p;return u2().parse(u,"angular-html-parser",{tokenizeExpansionForms:F,interpolationConfig:void 0,canSelfClose:b,allowHtmComponentClosingTags:x,tokenizeBlocks:F,tokenizeLet:M},C,k)}function c2(u,p){let b=new SyntaxError(u+" ("+p.loc.start.line+":"+p.loc.start.column+")");return Object.assign(b,p)}var d2=c2,ts=3;function p2(u){let p=u.slice(0,ts);if(p!=="---"&&p!=="+++")return;let b=u.indexOf(`
40
- `,ts);if(b===-1)return;let x=u.slice(ts,b).trim(),C=u.indexOf(`
41
- ${p}`,b),k=x;if(k||(k=p==="+++"?"toml":"yaml"),C===-1&&p==="---"&&k==="yaml"&&(C=u.indexOf(`
42
- ...`,b)),C===-1)return;let F=C+1+ts,M=u.charAt(F+1);if(!/\s?/u.test(M))return;let P=u.slice(0,F);return{type:"front-matter",language:k,explicitLanguage:x,value:u.slice(b+1,C),startDelimiter:p,endDelimiter:P.slice(-ts),raw:P}}function h2(u){let p=p2(u);if(!p)return{content:u};let{raw:b}=p;return{frontMatter:p,content:E(!1,b,/[^\n]/gu," ")+u.slice(b.length)}}var f2=h2,fo={attrs:!0,children:!0,cases:!0,expression:!0},Cd=new Set(["parent"]),fn,xa,va,m2=class us{constructor(p={}){y(this,fn),f(this,"type"),f(this,"parent");for(let b of new Set([...Cd,...Object.keys(p)]))this.setProperty(b,p[b])}setProperty(p,b){if(this[p]!==b){if(p in fo&&(b=b.map(x=>this.createChild(x))),!Cd.has(p)){this[p]=b;return}Object.defineProperty(this,p,{value:b,enumerable:!1,configurable:!0})}}map(p){let b;for(let x in fo){let C=this[x];if(C){let k=b2(C,F=>F.map(p));b!==C&&(b||(b=new us({parent:this.parent})),b.setProperty(x,k))}}if(b)for(let x in this)x in fo||(b[x]=this[x]);return p(b||this)}walk(p){for(let b in fo){let x=this[b];if(x)for(let C=0;C<x.length;C++)x[C].walk(p)}p(this)}createChild(p){let b=p instanceof us?p.clone():new us(p);return b.setProperty("parent",this),b}insertChildBefore(p,b){let x=this.$children;x.splice(x.indexOf(p),0,this.createChild(b))}removeChild(p){let b=this.$children;b.splice(b.indexOf(p),1)}replaceChild(p,b){let x=this.$children;x[x.indexOf(p)]=this.createChild(b)}clone(){return new us(this)}get $children(){return this[g(this,fn,xa)]}set $children(p){this[g(this,fn,xa)]=p}get firstChild(){var p;return(p=this.$children)==null?void 0:p[0]}get lastChild(){return $n(!0,this.$children,-1)}get prev(){let p=g(this,fn,va);return p[p.indexOf(this)-1]}get next(){let p=g(this,fn,va);return p[p.indexOf(this)+1]}get rawName(){return this.hasExplicitNamespace?this.fullName:this.name}get fullName(){return this.namespace?this.namespace+":"+this.name:this.name}get attrMap(){return Object.fromEntries(this.attrs.map(p=>[p.fullName,p.value]))}};fn=new WeakSet,xa=function(){return this.type==="angularIcuCase"?"expression":this.type==="angularIcuExpression"?"cases":"children"},va=function(){var u;return((u=this.parent)==null?void 0:u.$children)??[]};var g2=m2;function b2(u,p){let b=u.map(p);return b.some((x,C)=>x!==u[C])?b:u}var y2=[{regex:/^(\[if([^\]]*)\]>)(.*?)<!\s*\[endif\]$/su,parse:v2},{regex:/^\[if([^\]]*)\]><!$/u,parse:w2},{regex:/^<!\s*\[endif\]$/u,parse:D2}];function x2(u,p){if(u.value)for(let{regex:b,parse:x}of y2){let C=u.value.match(b);if(C)return x(u,p,C)}return null}function v2(u,p,b){let[,x,C,k]=b,F=4+x.length,M=u.sourceSpan.start.moveBy(F),P=M.moveBy(k.length),[U,V]=(()=>{try{return[!0,p(k,M).children]}catch{return[!1,[{type:"text",value:k,sourceSpan:new ne(M,P)}]]}})();return{type:"ieConditionalComment",complete:U,children:V,condition:E(!1,C.trim(),/\s+/gu," "),sourceSpan:u.sourceSpan,startSourceSpan:new ne(u.sourceSpan.start,M),endSourceSpan:new ne(P,u.sourceSpan.end)}}function w2(u,p,b){let[,x]=b;return{type:"ieConditionalStartComment",condition:E(!1,x.trim(),/\s+/gu," "),sourceSpan:u.sourceSpan}}function D2(u){return{type:"ieConditionalEndComment",sourceSpan:u.sourceSpan}}var wa=new Map([["*",new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","popover","slot","spellcheck","style","tabindex","title","translate","writingsuggestions"])],["a",new Set(["charset","coords","download","href","hreflang","name","ping","referrerpolicy","rel","rev","shape","target","type"])],["applet",new Set(["align","alt","archive","code","codebase","height","hspace","name","object","vspace","width"])],["area",new Set(["alt","coords","download","href","hreflang","nohref","ping","referrerpolicy","rel","shape","target","type"])],["audio",new Set(["autoplay","controls","crossorigin","loop","muted","preload","src"])],["base",new Set(["href","target"])],["basefont",new Set(["color","face","size"])],["blockquote",new Set(["cite"])],["body",new Set(["alink","background","bgcolor","link","text","vlink"])],["br",new Set(["clear"])],["button",new Set(["disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","popovertarget","popovertargetaction","type","value"])],["canvas",new Set(["height","width"])],["caption",new Set(["align"])],["col",new Set(["align","char","charoff","span","valign","width"])],["colgroup",new Set(["align","char","charoff","span","valign","width"])],["data",new Set(["value"])],["del",new Set(["cite","datetime"])],["details",new Set(["name","open"])],["dialog",new Set(["open"])],["dir",new Set(["compact"])],["div",new Set(["align"])],["dl",new Set(["compact"])],["embed",new Set(["height","src","type","width"])],["fieldset",new Set(["disabled","form","name"])],["font",new Set(["color","face","size"])],["form",new Set(["accept","accept-charset","action","autocomplete","enctype","method","name","novalidate","target"])],["frame",new Set(["frameborder","longdesc","marginheight","marginwidth","name","noresize","scrolling","src"])],["frameset",new Set(["cols","rows"])],["h1",new Set(["align"])],["h2",new Set(["align"])],["h3",new Set(["align"])],["h4",new Set(["align"])],["h5",new Set(["align"])],["h6",new Set(["align"])],["head",new Set(["profile"])],["hr",new Set(["align","noshade","size","width"])],["html",new Set(["manifest","version"])],["iframe",new Set(["align","allow","allowfullscreen","allowpaymentrequest","allowusermedia","frameborder","height","loading","longdesc","marginheight","marginwidth","name","referrerpolicy","sandbox","scrolling","src","srcdoc","width"])],["img",new Set(["align","alt","border","crossorigin","decoding","fetchpriority","height","hspace","ismap","loading","longdesc","name","referrerpolicy","sizes","src","srcset","usemap","vspace","width"])],["input",new Set(["accept","align","alt","autocomplete","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","ismap","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","popovertarget","popovertargetaction","readonly","required","size","src","step","type","usemap","value","width"])],["ins",new Set(["cite","datetime"])],["isindex",new Set(["prompt"])],["label",new Set(["for","form"])],["legend",new Set(["align"])],["li",new Set(["type","value"])],["link",new Set(["as","blocking","charset","color","crossorigin","disabled","fetchpriority","href","hreflang","imagesizes","imagesrcset","integrity","media","referrerpolicy","rel","rev","sizes","target","type"])],["map",new Set(["name"])],["menu",new Set(["compact"])],["meta",new Set(["charset","content","http-equiv","media","name","scheme"])],["meter",new Set(["high","low","max","min","optimum","value"])],["object",new Set(["align","archive","border","classid","codebase","codetype","data","declare","form","height","hspace","name","standby","type","typemustmatch","usemap","vspace","width"])],["ol",new Set(["compact","reversed","start","type"])],["optgroup",new Set(["disabled","label"])],["option",new Set(["disabled","label","selected","value"])],["output",new Set(["for","form","name"])],["p",new Set(["align"])],["param",new Set(["name","type","value","valuetype"])],["pre",new Set(["width"])],["progress",new Set(["max","value"])],["q",new Set(["cite"])],["script",new Set(["async","blocking","charset","crossorigin","defer","fetchpriority","integrity","language","nomodule","referrerpolicy","src","type"])],["select",new Set(["autocomplete","disabled","form","multiple","name","required","size"])],["slot",new Set(["name"])],["source",new Set(["height","media","sizes","src","srcset","type","width"])],["style",new Set(["blocking","media","type"])],["table",new Set(["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"])],["tbody",new Set(["align","char","charoff","valign"])],["td",new Set(["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"])],["template",new Set(["shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode"])],["textarea",new Set(["autocomplete","cols","dirname","disabled","form","maxlength","minlength","name","placeholder","readonly","required","rows","wrap"])],["tfoot",new Set(["align","char","charoff","valign"])],["th",new Set(["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"])],["thead",new Set(["align","char","charoff","valign"])],["time",new Set(["datetime"])],["tr",new Set(["align","bgcolor","char","charoff","valign"])],["track",new Set(["default","kind","label","src","srclang"])],["ul",new Set(["compact","type"])],["video",new Set(["autoplay","controls","crossorigin","height","loop","muted","playsinline","poster","preload","src","width"])]]),C2=new Set(["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","math","menu","menuitem","meta","meter","multicol","nav","nextid","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rbc","rp","rt","rtc","ruby","s","samp","script","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"]);function k2(u){if(u.type==="block"){if(u.name=E(!1,u.name.toLowerCase(),/\s+/gu," ").trim(),u.type="angularControlFlowBlock",!Xi(u.parameters)){delete u.parameters;return}for(let p of u.parameters)p.type="angularControlFlowBlockParameter";u.parameters={type:"angularControlFlowBlockParameters",children:u.parameters,sourceSpan:new ne(u.parameters[0].sourceSpan.start,$n(!1,u.parameters,-1).sourceSpan.end)}}}function E2(u){u.type==="letDeclaration"&&(u.type="angularLetDeclaration",u.id=u.name,u.init={type:"angularLetDeclarationInitializer",sourceSpan:new ne(u.valueSpan.start,u.valueSpan.end),value:u.value},delete u.name,delete u.value)}function S2(u){(u.type==="plural"||u.type==="select")&&(u.clause=u.type,u.type="angularIcuExpression"),u.type==="expansionCase"&&(u.type="angularIcuCase")}function kd(u,p,b){let{name:x,canSelfClose:C=!0,normalizeTagName:k=!1,normalizeAttributeName:F=!1,allowHtmComponentClosingTags:M=!1,isTagNameCaseSensitive:P=!1,shouldParseAsRawText:U}=p,{rootNodes:V,errors:ie}=Dd(u,{canSelfClose:C,allowHtmComponentClosingTags:M,isTagNameCaseSensitive:P,getTagContentType:U?(...W)=>U(...W)?xt.RAW_TEXT:void 0:void 0,tokenizeAngularBlocks:x==="angular"?!0:void 0,tokenizeAngularLetDeclaration:x==="angular"?!0:void 0});if(x==="vue"){if(V.some(we=>we.type==="docType"&&we.value==="html"||we.type==="element"&&we.name.toLowerCase()==="html"))return kd(u,Da,b);let W,oe=()=>W??(W=Dd(u,{canSelfClose:C,allowHtmComponentClosingTags:M,isTagNameCaseSensitive:P})),Se=we=>oe().rootNodes.find(({startSourceSpan:Ue})=>Ue&&Ue.start.offset===we.startSourceSpan.start.offset)??we;for(let[we,Ue]of V.entries()){let{endSourceSpan:mn,startSourceSpan:L2}=Ue;if(mn===null)ie=oe().errors,V[we]=Se(Ue);else if(F2(Ue,b)){let Fd=oe().errors.find(Ad=>Ad.span.start.offset>L2.start.offset&&Ad.span.start.offset<mn.end.offset);Fd&&Ed(Fd),V[we]=Se(Ue)}}}ie.length>0&&Ed(ie[0]);let ee=W=>{let oe=W.name.startsWith(":")?W.name.slice(1).split(":")[0]:null,Se=W.nameSpan.toString(),we=oe!==null&&Se.startsWith(`${oe}:`),Ue=we?Se.slice(oe.length+1):Se;W.name=Ue,W.namespace=oe,W.hasExplicitNamespace=we},se=W=>{switch(W.type){case"element":ee(W);for(let oe of W.attrs)ee(oe),oe.valueSpan?(oe.value=oe.valueSpan.toString(),/["']/u.test(oe.value[0])&&(oe.value=oe.value.slice(1,-1))):oe.value=null;break;case"comment":W.value=W.sourceSpan.toString().slice(4,-3);break;case"text":W.value=W.sourceSpan.toString();break}},ce=(W,oe)=>{let Se=W.toLowerCase();return oe(Se)?Se:W},Ee=W=>{if(W.type==="element"&&(k&&(!W.namespace||W.namespace===W.tagDefinition.implicitNamespacePrefix||Vn(W))&&(W.name=ce(W.name,oe=>C2.has(oe))),F))for(let oe of W.attrs)oe.namespace||(oe.name=ce(oe.name,Se=>wa.has(W.name)&&(wa.get("*").has(Se)||wa.get(W.name).has(Se))))},Oe=W=>{W.sourceSpan&&W.endSourceSpan&&(W.sourceSpan=new ne(W.sourceSpan.start,W.endSourceSpan.end))},$e=W=>{if(W.type==="element"){let oe=fa(P?W.name:W.name.toLowerCase());!W.namespace||W.namespace===oe.implicitNamespacePrefix||Vn(W)?W.tagDefinition=oe:W.tagDefinition=fa("")}};return pd(new class extends Hx{visitExpansionCase(W,oe){x==="angular"&&this.visitChildren(oe,Se=>{Se(W.expression)})}visit(W){se(W),$e(W),Ee(W),Oe(W)}},V),V}function F2(u,p){var b;if(u.type!=="element"||u.name!=="template")return!1;let x=(b=u.attrs.find(C=>C.name==="lang"))==null?void 0:b.value;return!x||Gs(p,{language:x})==="html"}function Ed(u){let{msg:p,span:{start:b,end:x}}=u;throw d2(p,{loc:{start:{line:b.line+1,column:b.col+1},end:{line:x.line+1,column:x.col+1}},cause:u})}function Sd(u,p,b={},x=!0){let{frontMatter:C,content:k}=x?f2(u):{frontMatter:null,content:u},F=new Kc(u,b.filepath),M=new ha(F,0,0,0),P=M.moveBy(u.length),U={type:"root",sourceSpan:new ne(M,P),children:kd(k,p,b)};if(C){let ee=new ha(F,0,0,0),se=ee.moveBy(C.raw.length);C.sourceSpan=new ne(ee,se),U.children.unshift(C)}let V=new g2(U),ie=(ee,se)=>{let{offset:ce}=se,Ee=E(!1,u.slice(0,ce),/[^\n\r]/gu," "),Oe=Sd(Ee+ee,p,b,!1);Oe.sourceSpan=new ne(se,$n(!1,Oe.children,-1).sourceSpan.end);let $e=Oe.children[0];return $e.length===ce?Oe.children.shift():($e.sourceSpan=new ne($e.sourceSpan.start.moveBy(ce),$e.sourceSpan.end),$e.value=$e.value.slice(ce)),Oe};return V.walk(ee=>{if(ee.type==="comment"){let se=x2(ee,ie);se&&ee.parent.replaceChild(ee,se)}k2(ee),E2(ee),S2(ee)}),V}function rs(u){return{parse:(p,b)=>Sd(p,u,b),hasPragma:Jy,hasIgnorePragma:Ky,astFormat:"html",locStart:Wn,locEnd:Zs}}var Da={name:"html",normalizeTagName:!0,normalizeAttributeName:!0,allowHtmComponentClosingTags:!0},A2=rs(Da),N2=new Set(["mj-style","mj-raw"]),T2=rs({...Da,name:"mjml",shouldParseAsRawText:u=>N2.has(u)}),M2=rs({name:"angular"}),B2=rs({name:"vue",isTagNameCaseSensitive:!0,shouldParseAsRawText(u,p,b,x){return u.toLowerCase()!=="html"&&!b&&(u!=="template"||x.some(({name:C,value:k})=>C==="lang"&&k!=="html"&&k!==""&&k!==void 0))}}),j2=rs({name:"lwc",canSelfClose:!1}),O2={html:Dx};return d(w)})})(Gh);var ef=Gh.exports;const g1=Kh(ef),b1=V2({__proto__:null,default:g1},[ef]);var y1=Object.create,eu=Object.defineProperty,x1=Object.getOwnPropertyDescriptor,v1=Object.getOwnPropertyNames,w1=Object.getPrototypeOf,D1=Object.prototype.hasOwnProperty,tf=t=>{throw TypeError(t)},C1=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),tu=(t,e)=>{for(var r in e)eu(t,r,{get:e[r],enumerable:!0})},k1=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of v1(e))!D1.call(t,s)&&s!==r&&eu(t,s,{get:()=>e[s],enumerable:!(n=x1(e,s))||n.enumerable});return t},E1=(t,e,r)=>(r=t!=null?y1(w1(t)):{},k1(eu(r,"default",{value:t,enumerable:!0}),t)),S1=(t,e,r)=>e.has(t)||tf("Cannot "+r),F1=(t,e,r)=>e.has(t)?tf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ss=(t,e,r)=>(S1(t,e,"access private method"),r),A1=C1(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(){return new Proxy({},{get:()=>o=>o})}var r=/\r\n|[\n\r\u2028\u2029]/;function n(o,i,a){let l=Object.assign({column:0,line:-1},o.start),c=Object.assign({},l,o.end),{linesAbove:d=2,linesBelow:f=3}=a||{},m=l.line,g=l.column,y=c.line,v=c.column,w=Math.max(m-(d+1),0),D=Math.min(i.length,y+f);m===-1&&(w=0),y===-1&&(D=i.length);let E=y-m,N={};if(E)for(let A=0;A<=E;A++){let T=A+m;if(!g)N[T]=!0;else if(A===0){let j=i[T-1].length;N[T]=[g,j-g+1]}else if(A===E)N[T]=[0,v];else{let j=i[T-A].length;N[T]=[0,j]}}else g===v?g?N[m]=[g,0]:N[m]=!0:N[m]=[g,v-g];return{start:w,end:D,markerLines:N}}function s(o,i,a={}){let l=e(),c=o.split(r),{start:d,end:f,markerLines:m}=n(i,c,a),g=i.start&&typeof i.start.column=="number",y=String(f).length,v=o.split(r,f).slice(d,f).map((w,D)=>{let E=d+1+D,N=` ${` ${E}`.slice(-y)} |`,A=m[E],T=!m[E+1];if(A){let j="";if(Array.isArray(A)){let B=w.slice(0,Math.max(A[0]-1,0)).replace(/[^\t]/g," "),$=A[1]||1;j=[`
43
- `,l.gutter(N.replace(/\d/g," "))," ",B,l.marker("^").repeat($)].join(""),T&&a.message&&(j+=" "+l.message(a.message))}return[l.marker(">"),l.gutter(N),w.length>0?` ${w}`:"",j].join("")}else return` ${l.gutter(N)}${w.length>0?` ${w}`:""}`}).join(`
44
- `);return a.message&&!g&&(v=`${" ".repeat(y+1)}${a.message}
45
- ${v}`),v}t.codeFrameColumns=s}),N1={};tu(N1,{__debug:()=>HD,check:()=>zD,doc:()=>Pf,format:()=>gu,formatWithCursor:()=>$f,getSupportInfo:()=>$D,util:()=>zf,version:()=>fD});var T1=(t,e,r,n)=>{if(!(t&&e==null))return e.replaceAll?e.replaceAll(r,n):r.global?e.replace(r,n):e.split(r).join(n)},Ai=T1,M1=class{diff(t,e,r={}){let n;typeof r=="function"?(n=r,r={}):"callback"in r&&(n=r.callback);let s=this.castInput(t,r),o=this.castInput(e,r),i=this.removeEmpty(this.tokenize(s,r)),a=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(i,a,r,n)}diffWithOptionsObj(t,e,r,n){var s;let o=D=>{if(D=this.postProcess(D,r),n){setTimeout(function(){n(D)},0);return}else return D},i=e.length,a=t.length,l=1,c=i+a;r.maxEditLength!=null&&(c=Math.min(c,r.maxEditLength));let d=(s=r.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+d,m=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(m[0],e,t,0,r);if(m[0].oldPos+1>=a&&g+1>=i)return o(this.buildValues(m[0].lastComponent,e,t));let y=-1/0,v=1/0,w=()=>{for(let D=Math.max(y,-l);D<=Math.min(v,l);D+=2){let E,N=m[D-1],A=m[D+1];N&&(m[D-1]=void 0);let T=!1;if(A){let B=A.oldPos-D;T=A&&0<=B&&B<i}let j=N&&N.oldPos+1<a;if(!T&&!j){m[D]=void 0;continue}if(!j||T&&N.oldPos<A.oldPos?E=this.addToPath(A,!0,!1,0,r):E=this.addToPath(N,!1,!0,1,r),g=this.extractCommon(E,e,t,D,r),E.oldPos+1>=a&&g+1>=i)return o(this.buildValues(E.lastComponent,e,t))||!0;m[D]=E,E.oldPos+1>=a&&(v=Math.min(v,D-1)),g+1>=i&&(y=Math.max(y,D+1))}l++};if(n)(function D(){setTimeout(function(){if(l>c||Date.now()>f)return n(void 0);w()||D()},0)})();else for(;l<=c&&Date.now()<=f;){let D=w();if(D)return D}}addToPath(t,e,r,n,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===e&&o.removed===r?{oldPos:t.oldPos+n,lastComponent:{count:o.count+1,added:e,removed:r,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+n,lastComponent:{count:1,added:e,removed:r,previousComponent:o}}}extractCommon(t,e,r,n,s){let o=e.length,i=r.length,a=t.oldPos,l=a-n,c=0;for(;l+1<o&&a+1<i&&this.equals(r[a+1],e[l+1],s);)l++,a++,c++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return c&&!s.oneChangePerToken&&(t.lastComponent={count:c,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,l}equals(t,e,r){return r.comparator?r.comparator(t,e):t===e||!!r.ignoreCase&&t.toLowerCase()===e.toLowerCase()}removeEmpty(t){let e=[];for(let r=0;r<t.length;r++)t[r]&&e.push(t[r]);return e}castInput(t,e){return t}tokenize(t,e){return Array.from(t)}join(t){return t.join("")}postProcess(t,e){return t}get useLongestToken(){return!1}buildValues(t,e,r){let n=[],s;for(;t;)n.push(t),s=t.previousComponent,delete t.previousComponent,t=s;n.reverse();let o=n.length,i=0,a=0,l=0;for(;i<o;i++){let c=n[i];if(c.removed)c.value=this.join(r.slice(l,l+c.count)),l+=c.count;else{if(!c.added&&this.useLongestToken){let d=e.slice(a,a+c.count);d=d.map(function(f,m){let g=r[l+m];return g.length>f.length?g:f}),c.value=this.join(d)}else c.value=this.join(e.slice(a,a+c.count));a+=c.count,c.added||(l+=c.count)}}return n}},B1=class extends M1{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},j1=new B1;function O1(t,e,r){return j1.diff(t,e,r)}function L1(t){let e=t.indexOf("\r");return e!==-1?t.charAt(e+1)===`
46
- `?"crlf":"cr":"lf"}function ru(t){switch(t){case"cr":return"\r";case"crlf":return`\r
15
+ `)}function Rc(u){return E(!1,E(!1,u,"&apos;","'"),"&quot;",'"')}function tr(u){return Rc(u.value)}var Gb=new Set(["template","style","script"]);function Qs(u,p){return dn(u,p)&&!Gb.has(u.fullName)}function dn(u,p){return p.parser==="vue"&&u.type==="element"&&u.parent.type==="root"&&u.fullName.toLowerCase()!=="html"}function na(u,p){return dn(u,p)&&(Qs(u,p)||u.attrMap.lang&&u.attrMap.lang!=="html")}function Yb(u){let p=u.fullName;return p.charAt(0)==="#"||p==="slot-scope"||p==="v-slot"||p.startsWith("v-slot:")}function Zb(u,p){let b=u.parent;if(!dn(b,p))return!1;let v=b.fullName,C=u.fullName;return v==="script"&&C==="setup"||v==="style"&&C==="vars"}function Pc(u,p=u.value){return u.parent.isWhitespaceSensitive?u.parent.isIndentationSensitive?gt(p):gt(Ic(Sc(p)),fe):ln(ve,Lt.split(p))}function zc(u,p){return dn(u,p)&&u.name==="script"}var $c=/\{\{(.+?)\}\}/su;async function Xb(u,p){let b=[];for(let[v,C]of u.split($c).entries())if(v%2===0)b.push(gt(C));else try{b.push(Ee(["{{",kt([ve,await yt(C,p,{parser:"__ng_interpolation",__isInHtmlInterpolation:!0})]),ve,"}}"]))}catch{b.push("{{",gt(C),"}}")}return b}function sa({parser:u}){return(p,b,v)=>yt(tr(v.node),p,{parser:u},un)}var Qb=sa({parser:"__ng_action"}),ey=sa({parser:"__ng_binding"}),ty=sa({parser:"__ng_directive"});function ry(u,p){if(p.parser!=="angular")return;let{node:b}=u,v=b.fullName;if(v.startsWith("(")&&v.endsWith(")")||v.startsWith("on-"))return Qb;if(v.startsWith("[")&&v.endsWith("]")||/^bind(?:on)?-/u.test(v)||/^ng-(?:if|show|hide|class|style)$/u.test(v))return ey;if(v.startsWith("*"))return ty;let C=tr(b);if(/^i18n(?:-.+)?$/u.test(v))return()=>Gs(hc(Pc(b,C.trim())),!C.includes("@@"));if($c.test(C))return k=>Xb(C,k)}var ny=ry;function sy(u,p){let{node:b}=u,v=tr(b);if(b.fullName==="class"&&!p.parentParser&&!v.includes("{{"))return()=>v.trim().split(/\s+/u).join(" ")}var oy=sy;function Hc(u){return u===" "||u===`
16
+ `||u==="\f"||u==="\r"||u===" "}var iy=/^[ \t\n\r\u000c]+/,ay=/^[, \t\n\r\u000c]+/,ly=/^[^ \t\n\r\u000c]+/,uy=/[,]+$/,Vc=/^\d+$/,cy=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;function dy(u){let p=u.length,b,v,C,k,N,M=0,z;function K(oe){let ce,Se=oe.exec(u.substring(M));if(Se)return[ce]=Se,M+=ce.length,ce}let W=[];for(;;){if(K(ay),M>=p){if(W.length===0)throw new Error("Must contain one or more image candidate strings.");return W}z=M,b=K(ly),v=[],b.slice(-1)===","?(b=b.replace(uy,""),te()):ae()}function ae(){for(K(iy),C="",k="in descriptor";;){if(N=u.charAt(M),k==="in descriptor")if(Hc(N))C&&(v.push(C),C="",k="after descriptor");else if(N===","){M+=1,C&&v.push(C),te();return}else if(N==="(")C+=N,k="in parens";else if(N===""){C&&v.push(C),te();return}else C+=N;else if(k==="in parens")if(N===")")C+=N,k="in descriptor";else if(N===""){v.push(C),te();return}else C+=N;else if(k==="after descriptor"&&!Hc(N))if(N===""){te();return}else k="in descriptor",M-=1;M+=1}}function te(){let oe=!1,ce,Se,Le,Ve,U={},ie,Fe,De,Je,gn;for(Ve=0;Ve<v.length;Ve++)ie=v[Ve],Fe=ie[ie.length-1],De=ie.substring(0,ie.length-1),Je=parseInt(De,10),gn=parseFloat(De),Vc.test(De)&&Fe==="w"?((ce||Se)&&(oe=!0),Je===0?oe=!0:ce=Je):cy.test(De)&&Fe==="x"?((ce||Se||Le)&&(oe=!0),gn<0?oe=!0:Se=gn):Vc.test(De)&&Fe==="h"?((Le||Se)&&(oe=!0),Je===0?oe=!0:Le=Je):oe=!0;if(!oe)U.source={value:b,startOffset:z},ce&&(U.width={value:ce}),Se&&(U.density={value:Se}),Le&&(U.height={value:Le}),W.push(U);else throw new Error(`Invalid srcset descriptor found in "${u}" at "${ie}".`)}}var py=dy;function hy(u){if(u.node.fullName==="srcset"&&(u.parent.fullName==="img"||u.parent.fullName==="source"))return()=>my(tr(u.node))}var qc={width:"w",height:"h",density:"x"},fy=Object.keys(qc);function my(u){let p=py(u),b=fy.filter(W=>p.some(ae=>Object.prototype.hasOwnProperty.call(ae,W)));if(b.length>1)throw new Error("Mixed descriptor in srcset is not supported");let[v]=b,C=qc[v],k=p.map(W=>W.source.value),N=Math.max(...k.map(W=>W.length)),M=p.map(W=>W[v]?String(W[v].value):""),z=M.map(W=>{let ae=W.indexOf(".");return ae===-1?W.length:ae}),K=Math.max(...z);return Gs(ln([",",ve],k.map((W,ae)=>{let te=[W],oe=M[ae];if(oe){let ce=N-W.length+1,Se=K-z[ae],Le=" ".repeat(ce+Se);te.push(Us(Le," "),oe+C)}return te})))}var gy=hy;function by(u,p){let{node:b}=u,v=tr(u.node).trim();if(b.fullName==="style"&&!p.parentParser&&!v.includes("{{"))return async C=>Gs(await C(v,{parser:"css",__isHTMLStyleAttribute:!0}))}var oa=new WeakMap;function yy(u,p){let{root:b}=u;return oa.has(b)||oa.set(b,b.children.some(v=>zc(v,p)&&["ts","typescript"].includes(v.attrMap.lang))),oa.get(b)}var ia=yy;function xy(u,p,b){let{node:v}=b,C=tr(v);return yt(`type T<${C}> = any`,u,{parser:"babel-ts",__isEmbeddedTypescriptGenericParameters:!0},un)}function vy(u,p,{parseWithTs:b}){return yt(`function _(${u}) {}`,p,{parser:b?"babel-ts":"babel",__isVueBindings:!0})}async function wy(u,p,b,v){let C=tr(b.node),{left:k,operator:N,right:M}=Dy(C),z=ia(b,v);return[Ee(await yt(`function _(${k}) {}`,u,{parser:z?"babel-ts":"babel",__isVueForBindingLeft:!0}))," ",N," ",await yt(M,u,{parser:z?"__ts_expression":"__js_expression"})]}function Dy(u){let p=/(.*?)\s+(in|of)\s+(.*)/su,b=/,([^,\]}]*)(?:,([^,\]}]*))?$/u,v=/^\(|\)$/gu,C=u.match(p);if(!C)return;let k={};if(k.for=C[3].trim(),!k.for)return;let N=E(!1,C[1].trim(),v,""),M=N.match(b);M?(k.alias=N.replace(b,""),k.iterator1=M[1].trim(),M[2]&&(k.iterator2=M[2].trim())):k.alias=N;let z=[k.alias,k.iterator1,k.iterator2];if(!z.some((K,W)=>!K&&(W===0||z.slice(W+1).some(Boolean))))return{left:z.filter(Boolean).join(","),operator:C[2],right:k.for}}function Cy(u,p){if(p.parser!=="vue")return;let{node:b}=u,v=b.fullName;if(v==="v-for")return wy;if(v==="generic"&&zc(b.parent,p))return xy;let C=tr(b),k=ia(u,p);if(Yb(b)||Zb(b,p))return N=>vy(C,N,{parseWithTs:k});if(v.startsWith("@")||v.startsWith("v-on:"))return N=>ky(C,N,{parseWithTs:k});if(v.startsWith(":")||v.startsWith(".")||v.startsWith("v-bind:"))return N=>Ey(C,N,{parseWithTs:k});if(v.startsWith("v-"))return N=>Wc(C,N,{parseWithTs:k})}async function ky(u,p,{parseWithTs:b}){var v;try{return await Wc(u,p,{parseWithTs:b})}catch(C){if(((v=C.cause)==null?void 0:v.code)!=="BABEL_PARSER_SYNTAX_ERROR")throw C}return yt(u,p,{parser:b?"__vue_ts_event_binding":"__vue_event_binding"},un)}function Ey(u,p,{parseWithTs:b}){return yt(u,p,{parser:b?"__vue_ts_expression":"__vue_expression"},un)}function Wc(u,p,{parseWithTs:b}){return yt(u,p,{parser:b?"__ts_expression":"__js_expression"},un)}var Sy=Cy;function Fy(u,p){let{node:b}=u;if(b.value){if(/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(p.originalText.slice(b.valueSpan.start.offset,b.valueSpan.end.offset))||p.parser==="lwc"&&b.value.startsWith("{")&&b.value.endsWith("}"))return[b.rawName,"=",b.value];for(let v of[gy,by,oy,Sy,ny]){let C=v(u,p);if(C)return Ay(C)}}}function Ay(u){return async(p,b,v,C)=>{let k=await u(p,b,v,C);if(k)return k=dc(k,N=>typeof N=="string"?E(!1,N,'"',"&quot;"):N),[v.node.rawName,'="',Ee(k),'"']}}var Ny=Fy,Ty=new Proxy(()=>{},{get:()=>Ty});function Kn(u){return u.sourceSpan.start.offset}function eo(u){return u.sourceSpan.end.offset}function aa(u,p){return[u.isSelfClosing?"":My(u,p),Jn(u,p)]}function My(u,p){return u.lastChild&&Zn(u.lastChild)?"":[By(u,p),la(u,p)]}function Jn(u,p){return(u.next?Mr(u.next):Yn(u.parent))?"":[Gn(u,p),Tr(u,p)]}function By(u,p){return Yn(u)?Gn(u.lastChild,p):""}function Tr(u,p){return Zn(u)?la(u.parent,p):to(u)?ca(u.next,p):""}function la(u,p){if(Uc(u,p))return"";switch(u.type){case"ieConditionalComment":return"<!";case"element":if(u.hasHtmComponentClosingTag)return"<//";default:return`</${u.rawName}`}}function Gn(u,p){if(Uc(u,p))return"";switch(u.type){case"ieConditionalComment":case"ieConditionalEndComment":return"[endif]-->";case"ieConditionalStartComment":return"]><!-->";case"interpolation":return"}}";case"angularIcuExpression":return"}";case"element":if(u.isSelfClosing)return"/>";default:return">"}}function Uc(u,p){return!u.isSelfClosing&&!u.endSourceSpan&&(Zs(u)||Fc(u.parent,p))}function Mr(u){return u.prev&&u.prev.type!=="docType"&&u.type!=="angularControlFlowBlock"&&!at(u.prev)&&u.isLeadingSpaceSensitive&&!u.hasLeadingSpaces}function Yn(u){var p;return((p=u.lastChild)==null?void 0:p.isTrailingSpaceSensitive)&&!u.lastChild.hasTrailingSpaces&&!at(ra(u.lastChild))&&!cn(u)}function Zn(u){return!u.next&&!u.hasTrailingSpaces&&u.isTrailingSpaceSensitive&&at(ra(u))}function to(u){return u.next&&!at(u.next)&&at(u)&&u.isTrailingSpaceSensitive&&!u.hasTrailingSpaces}function jy(u){let p=u.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/su);return p?p[1]?p[1].split(/\s+/u):!0:!1}function ro(u){return!u.prev&&u.isLeadingSpaceSensitive&&!u.hasLeadingSpaces}function Oy(u,p,b){var v;let{node:C}=u;if(!ea(C.attrs))return C.isSelfClosing?" ":"";let k=((v=C.prev)==null?void 0:v.type)==="comment"&&jy(C.prev.value),N=typeof k=="boolean"?()=>k:Array.isArray(k)?ae=>k.includes(ae.rawName):()=>!1,M=u.map(({node:ae})=>N(ae)?gt(p.originalText.slice(Kn(ae),eo(ae))):b(),"attrs"),z=C.type==="element"&&C.fullName==="script"&&C.attrs.length===1&&C.attrs[0].fullName==="src"&&C.children.length===0,K=p.singleAttributePerLine&&C.attrs.length>1&&!dn(C,p)?fe:ve,W=[kt([z?" ":ve,ln(K,M)])];return C.firstChild&&ro(C.firstChild)||C.isSelfClosing&&Yn(C.parent)||z?W.push(C.isSelfClosing?" ":""):W.push(p.bracketSameLine?C.isSelfClosing?" ":"":C.isSelfClosing?ve:He),W}function Ly(u){return u.firstChild&&ro(u.firstChild)?"":da(u)}function ua(u,p,b){let{node:v}=u;return[Xn(v,p),Oy(u,p,b),v.isSelfClosing?"":Ly(v)]}function Xn(u,p){return u.prev&&to(u.prev)?"":[Br(u,p),ca(u,p)]}function Br(u,p){return ro(u)?da(u.parent):Mr(u)?Gn(u.prev,p):""}var Kc="<!doctype";function ca(u,p){switch(u.type){case"ieConditionalComment":case"ieConditionalStartComment":return`<!--[if ${u.condition}`;case"ieConditionalEndComment":return"<!--<!";case"interpolation":return"{{";case"docType":{if(u.value==="html"){let{filepath:v}=p;if(v&&/\.html?$/u.test(v))return Kc}let b=Kn(u);return p.originalText.slice(b,b+Kc.length)}case"angularIcuExpression":return"{";case"element":if(u.condition)return`<!--[if ${u.condition}]><!--><${u.rawName}`;default:return`<${u.rawName}`}}function da(u){switch(u.type){case"ieConditionalComment":return"]>";case"element":if(u.condition)return"><!--<![endif]-->";default:return">"}}function _y(u,p){if(!u.endSourceSpan)return"";let b=u.startSourceSpan.end.offset;u.firstChild&&ro(u.firstChild)&&(b-=da(u).length);let v=u.endSourceSpan.start.offset;return u.lastChild&&Zn(u.lastChild)?v+=la(u,p).length:Yn(u)&&(v-=Gn(u.lastChild,p).length),p.originalText.slice(b,v)}var Jc=_y,Iy=new Set(["if","else if","for","switch","case"]);function Ry(u,p){let{node:b}=u;switch(b.type){case"element":if(_t(b,p)||b.type==="interpolation")return;if(!b.isSelfClosing&&na(b,p)){let v=Lc(b,p);return v?async(C,k)=>{let N=Jc(b,p),M=/^\s*$/u.test(N),z="";return M||(z=await C(Sc(N),{parser:v,__embeddedInHtml:!0}),M=z===""),[Br(b,p),Ee(ua(u,p,k)),M?"":fe,z,M?"":fe,aa(b,p),Tr(b,p)]}:void 0}break;case"text":if(_t(b.parent,p)){let v=Lc(b.parent,p);if(v)return async C=>{let k=v==="markdown"?Ic(b.value.replace(/^[^\S\n]*\n/u,"")):b.value,N={parser:v,__embeddedInHtml:!0};if(p.parser==="html"&&v==="babel"){let M="script",{attrMap:z}=b.parent;z&&(z.type==="module"||(z.type==="text/babel"||z.type==="text/jsx")&&z["data-type"]==="module")&&(M="module"),N.__babelSourceType=M}return[qn,Br(b,p),await C(k,N),Tr(b,p)]}}else if(b.parent.type==="interpolation")return async v=>{let C={__isInHtmlInterpolation:!0,__embeddedInHtml:!0};return p.parser==="angular"?C.parser="__ng_interpolation":p.parser==="vue"?C.parser=ia(u,p)?"__vue_ts_expression":"__vue_expression":C.parser="__js_expression",[kt([ve,await v(b.value,C)]),b.parent.next&&Mr(b.parent.next)?" ":ve]};break;case"attribute":return Ny(u,p);case"front-matter":return v=>cb(b,v);case"angularControlFlowBlockParameters":return Iy.has(u.parent.name)?pb:void 0;case"angularLetDeclarationInitializer":return v=>yt(b.value,v,{parser:"__ng_binding",__isInHtmlAttribute:!1})}}var Py=Ry,Qn=null;function es(u){if(Qn!==null&&typeof Qn.property){let p=Qn;return Qn=es.prototype=null,p}return Qn=es.prototype=u??Object.create(null),new es}var zy=10;for(let u=0;u<=zy;u++)es();function $y(u){return es(u)}function Hy(u,p="type"){$y(u);function b(v){let C=v[p],k=u[C];if(!Array.isArray(k))throw Object.assign(new Error(`Missing visitor keys for '${C}'.`),{node:v});return k}return b}var Vy=Hy,qy={"front-matter":[],root:["children"],element:["attrs","children"],ieConditionalComment:["children"],ieConditionalStartComment:[],ieConditionalEndComment:[],interpolation:["children"],text:["children"],docType:[],comment:[],attribute:[],cdata:[],angularControlFlowBlock:["children","parameters"],angularControlFlowBlockParameters:["children"],angularControlFlowBlockParameter:[],angularLetDeclaration:["init"],angularLetDeclarationInitializer:[],angularIcuExpression:["cases"],angularIcuCase:["expression"]},Wy=qy,Uy=Vy(Wy),Ky=Uy,Jy="format",Gy=/^\s*<!--\s*@(?:noformat|noprettier)\s*-->/u,Yy=/^\s*<!--\s*@(?:format|prettier)\s*-->/u;function Zy(u){return Yy.test(u)}function Xy(u){return Gy.test(u)}function Qy(u){return`<!-- @${Jy} -->
17
+
18
+ ${u}`}var ex=new Map([["if",new Set(["else if","else"])],["else if",new Set(["else if","else"])],["for",new Set(["empty"])],["defer",new Set(["placeholder","error","loading"])],["placeholder",new Set(["placeholder","error","loading"])],["error",new Set(["placeholder","error","loading"])],["loading",new Set(["placeholder","error","loading"])]]);function Gc(u){let p=eo(u);return u.type==="element"&&!u.endSourceSpan&&ea(u.children)?Math.max(p,Gc(Vn(!1,u.children,-1))):p}function ts(u,p,b){let v=u.node;if(Zs(v)){let C=Gc(v);return[Br(v,p),gt(Lt.trimEnd(p.originalText.slice(Kn(v)+(v.prev&&to(v.prev)?ca(v).length:0),C-(v.next&&Mr(v.next)?Gn(v,p).length:0)))),Tr(v,p)]}return b()}function no(u,p){return at(u)&&at(p)?u.isTrailingSpaceSensitive?u.hasTrailingSpaces?ta(p)?fe:ve:"":ta(p)?fe:He:to(u)&&(Zs(p)||p.firstChild||p.isSelfClosing||p.type==="element"&&p.attrs.length>0)||u.type==="element"&&u.isSelfClosing&&Mr(p)?"":!p.isLeadingSpaceSensitive||ta(p)||Mr(p)&&u.lastChild&&Zn(u.lastChild)&&u.lastChild.lastChild&&Zn(u.lastChild.lastChild)?fe:p.hasLeadingSpaces?ve:He}function pa(u,p,b){let{node:v}=u;if(Nc(v))return[qn,...u.map(k=>{let N=k.node,M=N.prev?no(N.prev,N):"";return[M?[M,Xs(N.prev)?fe:""]:"",ts(k,p,b)]},"children")];let C=v.children.map(()=>Symbol(""));return u.map((k,N)=>{let M=k.node;if(at(M)){if(M.prev&&at(M.prev)){let ce=no(M.prev,M);if(ce)return Xs(M.prev)?[fe,fe,ts(k,p,b)]:[ce,ts(k,p,b)]}return ts(k,p,b)}let z=[],K=[],W=[],ae=[],te=M.prev?no(M.prev,M):"",oe=M.next?no(M,M.next):"";return te&&(Xs(M.prev)?z.push(fe,fe):te===fe?z.push(fe):at(M.prev)?K.push(te):K.push(Us("",He,{groupId:C[N-1]}))),oe&&(Xs(M)?at(M.next)&&ae.push(fe,fe):oe===fe?at(M.next)&&ae.push(fe):W.push(oe)),[...z,Ee([...K,Ee([ts(k,p,b),...W],{id:C[N]})]),...ae]},"children")}function tx(u,p,b){let{node:v}=u,C=[];rx(u)&&C.push("} "),C.push("@",v.name),v.parameters&&C.push(" (",Ee(b("parameters")),")"),C.push(" {");let k=Yc(v);return v.children.length>0?(v.firstChild.hasLeadingSpaces=!0,v.lastChild.hasTrailingSpaces=!0,C.push(kt([fe,pa(u,p,b)])),k&&C.push(fe,"}")):k&&C.push("}"),Ee(C,{shouldBreak:!0})}function Yc(u){var p,b;return!(((p=u.next)==null?void 0:p.type)==="angularControlFlowBlock"&&(b=ex.get(u.name))!=null&&b.has(u.next.name))}function rx(u){let{previous:p}=u;return p?.type==="angularControlFlowBlock"&&!Zs(p)&&!Yc(p)}function nx(u,p,b){return[kt([He,ln([";",ve],u.map(b,"children"))]),He]}function sx(u,p,b){let{node:v}=u;return[Xn(v,p),Ee([v.switchValue.trim(),", ",v.clause,v.cases.length>0?[",",kt([ve,ln(ve,u.map(b,"cases"))])]:"",He]),Jn(v,p)]}function ox(u,p,b){let{node:v}=u;return[v.value," {",Ee([kt([He,u.map(({node:C,isLast:k})=>{let N=[b()];return C.type==="text"&&(C.hasLeadingSpaces&&N.unshift(ve),C.hasTrailingSpaces&&!k&&N.push(ve)),N},"expression")]),He]),"}"]}function ix(u,p,b){let{node:v}=u;if(Fc(v,p))return[Br(v,p),Ee(ua(u,p,b)),gt(Jc(v,p)),...aa(v,p),Tr(v,p)];let C=v.children.length===1&&(v.firstChild.type==="interpolation"||v.firstChild.type==="angularIcuExpression")&&v.firstChild.isLeadingSpaceSensitive&&!v.firstChild.hasLeadingSpaces&&v.lastChild.isTrailingSpaceSensitive&&!v.lastChild.hasTrailingSpaces,k=Symbol("element-attr-group-id"),N=W=>Ee([Ee(ua(u,p,b),{id:k}),W,aa(v,p)]),M=W=>C?U0(W,{groupId:k}):(_t(v,p)||Qs(v,p))&&v.parent.type==="root"&&p.parser==="vue"&&!p.vueIndentScriptAndStyle?W:kt(W),z=()=>C?Us(He,"",{groupId:k}):v.firstChild.hasLeadingSpaces&&v.firstChild.isLeadingSpaceSensitive?ve:v.firstChild.type==="text"&&v.isWhitespaceSensitive&&v.isIndentationSensitive?q0(He):He,K=()=>(v.next?Mr(v.next):Yn(v.parent))?v.lastChild.hasTrailingSpaces&&v.lastChild.isTrailingSpaceSensitive?" ":"":C?Us(He,"",{groupId:k}):v.lastChild.hasTrailingSpaces&&v.lastChild.isTrailingSpaceSensitive?ve:(v.lastChild.type==="comment"||v.lastChild.type==="text"&&v.isWhitespaceSensitive&&v.isIndentationSensitive)&&new RegExp(`\\n[\\t ]{${p.tabWidth*(u.ancestors.length-1)}}$`,"u").test(v.lastChild.value)?"":He;return v.children.length===0?N(v.hasDanglingSpaces&&v.isDanglingSpaceSensitive?ve:""):N([Lb(v)?qn:"",M([z(),pa(u,p,b)]),K()])}function so(u){return u>=9&&u<=32||u==160}function ha(u){return 48<=u&&u<=57}function oo(u){return u>=97&&u<=122||u>=65&&u<=90}function ax(u){return u>=97&&u<=102||u>=65&&u<=70||ha(u)}function fa(u){return u===10||u===13}function Zc(u){return 48<=u&&u<=55}function ma(u){return u===39||u===34||u===96}var lx=/-+([a-z0-9])/g;function ux(u){return u.replace(lx,(...p)=>p[1].toUpperCase())}var ga=class Zh{constructor(p,b,v,C){this.file=p,this.offset=b,this.line=v,this.col=C}toString(){return this.offset!=null?`${this.file.url}@${this.line}:${this.col}`:this.file.url}moveBy(p){let b=this.file.content,v=b.length,C=this.offset,k=this.line,N=this.col;for(;C>0&&p<0;)if(C--,p++,b.charCodeAt(C)==10){k--;let M=b.substring(0,C-1).lastIndexOf(`
19
+ `);N=M>0?C-M:C}else N--;for(;C<v&&p>0;){let M=b.charCodeAt(C);C++,p--,M==10?(k++,N=0):N++}return new Zh(this.file,C,k,N)}getContext(p,b){let v=this.file.content,C=this.offset;if(C!=null){C>v.length-1&&(C=v.length-1);let k=C,N=0,M=0;for(;N<p&&C>0&&(C--,N++,!(v[C]==`
20
+ `&&++M==b)););for(N=0,M=0;N<p&&k<v.length-1&&(k++,N++,!(v[k]==`
21
+ `&&++M==b)););return{before:v.substring(C,this.offset),after:v.substring(this.offset,k+1)}}return null}},Xc=class{constructor(u,p){this.content=u,this.url=p}},se=class{constructor(u,p,b=u,v=null){this.start=u,this.end=p,this.fullStart=b,this.details=v}toString(){return this.start.file.content.substring(this.start.offset,this.end.offset)}},io;(function(u){u[u.WARNING=0]="WARNING",u[u.ERROR=1]="ERROR"})(io||(io={}));var Qc=class{constructor(u,p,b=io.ERROR,v){this.span=u,this.msg=p,this.level=b,this.relatedError=v}contextualMessage(){let u=this.span.start.getContext(100,3);return u?`${this.msg} ("${u.before}[${io[this.level]} ->]${u.after}")`:this.msg}toString(){let u=this.span.details?`, ${this.span.details}`:"";return`${this.contextualMessage()}: ${this.span.start}${u}`}},cx=[px,hx,mx,bx,yx,wx,xx,vx,Dx,gx];function dx(u,p){for(let b of cx)b(u,p);return u}function px(u){u.walk(p=>{if(p.type==="element"&&p.tagDefinition.ignoreFirstLf&&p.children.length>0&&p.children[0].type==="text"&&p.children[0].value[0]===`
22
+ `){let b=p.children[0];b.value.length===1?p.removeChild(b):b.value=b.value.slice(1)}})}function hx(u){let p=b=>{var v,C;return b.type==="element"&&((v=b.prev)==null?void 0:v.type)==="ieConditionalStartComment"&&b.prev.sourceSpan.end.offset===b.startSourceSpan.start.offset&&((C=b.firstChild)==null?void 0:C.type)==="ieConditionalEndComment"&&b.firstChild.sourceSpan.start.offset===b.startSourceSpan.end.offset};u.walk(b=>{if(b.children)for(let v=0;v<b.children.length;v++){let C=b.children[v];if(!p(C))continue;let k=C.prev,N=C.firstChild;b.removeChild(k),v--;let M=new se(k.sourceSpan.start,N.sourceSpan.end),z=new se(M.start,C.sourceSpan.end);C.condition=k.condition,C.sourceSpan=z,C.startSourceSpan=M,C.removeChild(N)}})}function fx(u,p,b){u.walk(v=>{if(v.children)for(let C=0;C<v.children.length;C++){let k=v.children[C];if(k.type!=="text"&&!p(k))continue;k.type!=="text"&&(k.type="text",k.value=b(k));let N=k.prev;!N||N.type!=="text"||(N.value+=k.value,N.sourceSpan=new se(N.sourceSpan.start,k.sourceSpan.end),v.removeChild(k),C--)}})}function mx(u){return fx(u,p=>p.type==="cdata",p=>`<![CDATA[${p.value}]]>`)}function gx(u){let p=b=>{var v,C;return b.type==="element"&&b.attrs.length===0&&b.children.length===1&&b.firstChild.type==="text"&&!Lt.hasWhitespaceCharacter(b.children[0].value)&&!b.firstChild.hasLeadingSpaces&&!b.firstChild.hasTrailingSpaces&&b.isLeadingSpaceSensitive&&!b.hasLeadingSpaces&&b.isTrailingSpaceSensitive&&!b.hasTrailingSpaces&&((v=b.prev)==null?void 0:v.type)==="text"&&((C=b.next)==null?void 0:C.type)==="text"};u.walk(b=>{if(b.children)for(let v=0;v<b.children.length;v++){let C=b.children[v];if(!p(C))continue;let k=C.prev,N=C.next;k.value+=`<${C.rawName}>`+C.firstChild.value+`</${C.rawName}>`+N.value,k.sourceSpan=new se(k.sourceSpan.start,N.sourceSpan.end),k.isTrailingSpaceSensitive=N.isTrailingSpaceSensitive,k.hasTrailingSpaces=N.hasTrailingSpaces,b.removeChild(C),v--,b.removeChild(N)}})}function bx(u,p){if(p.parser==="html")return;let b=/\{\{(.+?)\}\}/su;u.walk(v=>{if(Tb(v,p))for(let C of v.children){if(C.type!=="text")continue;let k=C.sourceSpan.start,N=null,M=C.value.split(b);for(let z=0;z<M.length;z++,k=N){let K=M[z];if(z%2===0){N=k.moveBy(K.length),K.length>0&&v.insertChildBefore(C,{type:"text",value:K,sourceSpan:new se(k,N)});continue}N=k.moveBy(K.length+4),v.insertChildBefore(C,{type:"interpolation",sourceSpan:new se(k,N),children:K.length===0?[]:[{type:"text",value:K,sourceSpan:new se(k.moveBy(2),N.moveBy(-2))}]})}v.removeChild(C)}})}function yx(u,p){u.walk(b=>{let v=b.$children;if(!v)return;if(v.length===0||v.length===1&&v[0].type==="text"&&Lt.trim(v[0].value).length===0){b.hasDanglingSpaces=v.length>0,b.$children=[];return}let C=Mb(b,p),k=Ac(b);if(!C)for(let N=0;N<v.length;N++){let M=v[N];if(M.type!=="text")continue;let{leadingWhitespace:z,text:K,trailingWhitespace:W}=Ab(M.value),ae=M.prev,te=M.next;K?(M.value=K,M.sourceSpan=new se(M.sourceSpan.start.moveBy(z.length),M.sourceSpan.end.moveBy(-W.length)),z&&(ae&&(ae.hasTrailingSpaces=!0),M.hasLeadingSpaces=!0),W&&(M.hasTrailingSpaces=!0,te&&(te.hasLeadingSpaces=!0))):(b.removeChild(M),N--,(z||W)&&(ae&&(ae.hasTrailingSpaces=!0),te&&(te.hasLeadingSpaces=!0)))}b.isWhitespaceSensitive=C,b.isIndentationSensitive=k})}function xx(u){u.walk(p=>{p.isSelfClosing=!p.children||p.type==="element"&&(p.tagDefinition.isVoid||p.endSourceSpan&&p.startSourceSpan.start===p.endSourceSpan.start&&p.startSourceSpan.end===p.endSourceSpan.end)})}function vx(u,p){u.walk(b=>{b.type==="element"&&(b.hasHtmComponentClosingTag=b.endSourceSpan&&/^<\s*\/\s*\/\s*>$/u.test(p.originalText.slice(b.endSourceSpan.start.offset,b.endSourceSpan.end.offset)))})}function wx(u,p){u.walk(b=>{b.cssDisplay=Kb(b,p)})}function Dx(u,p){u.walk(b=>{let{children:v}=b;if(v){if(v.length===0){b.isDanglingSpaceSensitive=Ob(b,p);return}for(let C of v)C.isLeadingSpaceSensitive=Bb(C,p),C.isTrailingSpaceSensitive=jb(C,p);for(let C=0;C<v.length;C++){let k=v[C];k.isLeadingSpaceSensitive=(C===0||k.prev.isTrailingSpaceSensitive)&&k.isLeadingSpaceSensitive,k.isTrailingSpaceSensitive=(C===v.length-1||k.next.isLeadingSpaceSensitive)&&k.isTrailingSpaceSensitive}}})}var Cx=dx;function kx(u,p,b){let{node:v}=u;switch(v.type){case"front-matter":return gt(v.raw);case"root":return p.__onHtmlRoot&&p.__onHtmlRoot(v),[Ee(pa(u,p,b)),fe];case"element":case"ieConditionalComment":return ix(u,p,b);case"angularControlFlowBlock":return tx(u,p,b);case"angularControlFlowBlockParameters":return nx(u,p,b);case"angularControlFlowBlockParameter":return Lt.trim(v.expression);case"angularLetDeclaration":return Ee(["@let ",Ee([v.id," =",Ee(kt([ve,b("init")]))]),";"]);case"angularLetDeclarationInitializer":return v.value;case"angularIcuExpression":return sx(u,p,b);case"angularIcuCase":return ox(u,p,b);case"ieConditionalStartComment":case"ieConditionalEndComment":return[Xn(v),Jn(v)];case"interpolation":return[Xn(v,p),...u.map(b,"children"),Jn(v,p)];case"text":{if(v.parent.type==="interpolation"){let M=/\n[^\S\n]*$/u,z=M.test(v.value),K=z?v.value.replace(M,""):v.value;return[gt(K),z?fe:""]}let C=Br(v,p),k=Pc(v),N=Tr(v,p);return k[0]=[C,k[0]],k.push([k.pop(),N]),hc(k)}case"docType":return[Ee([Xn(v,p)," ",E(!1,v.value.replace(/^html\b/iu,"html"),/\s+/gu," ")]),Jn(v,p)];case"comment":return[Br(v,p),gt(p.originalText.slice(Kn(v),eo(v))),Tr(v,p)];case"attribute":{if(v.value===null)return v.rawName;let C=Rc(v.value),k=Z0(C,'"');return[v.rawName,"=",k,gt(k==='"'?E(!1,C,'"',"&quot;"):E(!1,C,"'","&apos;")),k]}case"cdata":default:throw new sb(v,"HTML")}}var Ex={preprocess:Cx,print:kx,insertPragma:Qy,massageAstNode:lb,embed:Py,getVisitorKeys:Ky},Sx=Ex,Fx=[{name:"Angular",type:"markup",extensions:[".component.html"],tmScope:"text.html.basic",aceMode:"html",aliases:["xhtml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["angular"],vscodeLanguageIds:["html"],filenames:[],linguistLanguageId:146},{name:"HTML",type:"markup",extensions:[".html",".hta",".htm",".html.hl",".inc",".xht",".xhtml"],tmScope:"text.html.basic",aceMode:"html",aliases:["xhtml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["html"],vscodeLanguageIds:["html"],linguistLanguageId:146},{name:"Lightning Web Components",type:"markup",extensions:[],tmScope:"text.html.basic",aceMode:"html",aliases:["xhtml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["lwc"],vscodeLanguageIds:["html"],filenames:[],linguistLanguageId:146},{name:"MJML",type:"markup",extensions:[".mjml"],tmScope:"text.mjml.basic",aceMode:"html",aliases:["MJML","mjml"],codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",parsers:["mjml"],filenames:[],vscodeLanguageIds:["mjml"],linguistLanguageId:146},{name:"Vue",type:"markup",extensions:[".vue"],tmScope:"source.vue",aceMode:"html",parsers:["vue"],vscodeLanguageIds:["vue"],linguistLanguageId:391}],ed={bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}},td="HTML",Ax={bracketSameLine:ed.bracketSameLine,htmlWhitespaceSensitivity:{category:td,type:"choice",default:"css",description:"How to handle whitespaces in HTML.",choices:[{value:"css",description:"Respect the default value of CSS display property."},{value:"strict",description:"Whitespaces are considered sensitive."},{value:"ignore",description:"Whitespaces are considered insensitive."}]},singleAttributePerLine:ed.singleAttributePerLine,vueIndentScriptAndStyle:{category:td,type:"boolean",default:!1,description:"Indent script and style tags in Vue files."}},Nx=Ax,rd={};l(rd,{angular:()=>L2,html:()=>B2,lwc:()=>I2,mjml:()=>O2,vue:()=>_2});var nd;(function(u){u[u.Emulated=0]="Emulated",u[u.None=2]="None",u[u.ShadowDom=3]="ShadowDom"})(nd||(nd={}));var sd;(function(u){u[u.OnPush=0]="OnPush",u[u.Default=1]="Default"})(sd||(sd={}));var od;(function(u){u[u.None=0]="None",u[u.SignalBased=1]="SignalBased",u[u.HasDecoratorInputTransform=2]="HasDecoratorInputTransform"})(od||(od={}));var id={name:"custom-elements"},ad={name:"no-errors-schema"},jr;(function(u){u[u.NONE=0]="NONE",u[u.HTML=1]="HTML",u[u.STYLE=2]="STYLE",u[u.SCRIPT=3]="SCRIPT",u[u.URL=4]="URL",u[u.RESOURCE_URL=5]="RESOURCE_URL"})(jr||(jr={}));var ld;(function(u){u[u.Error=0]="Error",u[u.Warning=1]="Warning",u[u.Ignore=2]="Ignore"})(ld||(ld={}));var xt;(function(u){u[u.RAW_TEXT=0]="RAW_TEXT",u[u.ESCAPABLE_RAW_TEXT=1]="ESCAPABLE_RAW_TEXT",u[u.PARSABLE_DATA=2]="PARSABLE_DATA"})(xt||(xt={}));function ao(u,p=!0){if(u[0]!=":")return[null,u];let b=u.indexOf(":",1);if(b===-1){if(p)throw new Error(`Unsupported format "${u}" expecting ":namespace:name"`);return[null,u]}return[u.slice(1,b),u.slice(b+1)]}function ud(u){return ao(u)[1]==="ng-container"}function cd(u){return ao(u)[1]==="ng-content"}function lo(u){return u===null?null:ao(u)[0]}function uo(u,p){return u?`:${u}:${p}`:p}var co;function dd(){return co||(co={},po(jr.HTML,["iframe|srcdoc","*|innerHTML","*|outerHTML"]),po(jr.STYLE,["*|style"]),po(jr.URL,["*|formAction","area|href","area|ping","audio|src","a|href","a|ping","blockquote|cite","body|background","del|cite","form|action","img|src","input|src","ins|cite","q|cite","source|src","track|src","video|poster","video|src"]),po(jr.RESOURCE_URL,["applet|code","applet|codebase","base|href","embed|src","frame|src","head|profile","html|manifest","iframe|src","link|href","media|src","object|codebase","object|data","script|src"])),co}function po(u,p){for(let b of p)co[b.toLowerCase()]=u}var Tx=class{},Mx="boolean",Bx="number",jx="string",Ox="object",Lx=["[Element]|textContent,%ariaAtomic,%ariaAutoComplete,%ariaBusy,%ariaChecked,%ariaColCount,%ariaColIndex,%ariaColSpan,%ariaCurrent,%ariaDescription,%ariaDisabled,%ariaExpanded,%ariaHasPopup,%ariaHidden,%ariaKeyShortcuts,%ariaLabel,%ariaLevel,%ariaLive,%ariaModal,%ariaMultiLine,%ariaMultiSelectable,%ariaOrientation,%ariaPlaceholder,%ariaPosInSet,%ariaPressed,%ariaReadOnly,%ariaRelevant,%ariaRequired,%ariaRoleDescription,%ariaRowCount,%ariaRowIndex,%ariaRowSpan,%ariaSelected,%ariaSetSize,%ariaSort,%ariaValueMax,%ariaValueMin,%ariaValueNow,%ariaValueText,%classList,className,elementTiming,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*fullscreenchange,*fullscreenerror,*search,*webkitfullscreenchange,*webkitfullscreenerror,outerHTML,%part,#scrollLeft,#scrollTop,slot,*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored","[HTMLElement]^[Element]|accessKey,autocapitalize,!autofocus,contentEditable,dir,!draggable,enterKeyHint,!hidden,!inert,innerText,inputMode,lang,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate,virtualKeyboardPolicy","abbr,address,article,aside,b,bdi,bdo,cite,content,code,dd,dfn,dt,em,figcaption,figure,footer,header,hgroup,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,autocapitalize,!autofocus,contentEditable,dir,!draggable,enterKeyHint,!hidden,innerText,inputMode,lang,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate,virtualKeyboardPolicy","media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,!preservesPitch,src,%srcObject,#volume",":svg:^[HTMLElement]|!autofocus,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,%style,#tabIndex",":svg:graphics^:svg:|",":svg:animation^:svg:|*begin,*end,*repeat",":svg:geometry^:svg:|",":svg:componentTransferFunction^:svg:|",":svg:gradient^:svg:|",":svg:textContent^:svg:graphics|",":svg:textPositioning^:svg:textContent|","a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,%relList,rev,search,shape,target,text,type,username","area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,%relList,search,shape,target,username","audio^media|","br^[HTMLElement]|clear","base^[HTMLElement]|href,target","body^[HTMLElement]|aLink,background,bgColor,link,*afterprint,*beforeprint,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*messageerror,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink","button^[HTMLElement]|!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value","canvas^[HTMLElement]|#height,#width","content^[HTMLElement]|select","dl^[HTMLElement]|!compact","data^[HTMLElement]|value","datalist^[HTMLElement]|","details^[HTMLElement]|!open","dialog^[HTMLElement]|!open,returnValue","dir^[HTMLElement]|!compact","div^[HTMLElement]|align","embed^[HTMLElement]|align,height,name,src,type,width","fieldset^[HTMLElement]|!disabled,name","font^[HTMLElement]|color,face,size","form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target","frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src","frameset^[HTMLElement]|cols,*afterprint,*beforeprint,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*messageerror,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows","hr^[HTMLElement]|align,color,!noShade,size,width","head^[HTMLElement]|","h1,h2,h3,h4,h5,h6^[HTMLElement]|align","html^[HTMLElement]|version","iframe^[HTMLElement]|align,allow,!allowFullscreen,!allowPaymentRequest,csp,frameBorder,height,loading,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width","img^[HTMLElement]|align,alt,border,%crossOrigin,decoding,#height,#hspace,!isMap,loading,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width","input^[HTMLElement]|accept,align,alt,autocomplete,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width","li^[HTMLElement]|type,#value","label^[HTMLElement]|htmlFor","legend^[HTMLElement]|align","link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,imageSizes,imageSrcset,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type","map^[HTMLElement]|name","marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width","menu^[HTMLElement]|!compact","meta^[HTMLElement]|content,httpEquiv,media,name,scheme","meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value","ins,del^[HTMLElement]|cite,dateTime","ol^[HTMLElement]|!compact,!reversed,#start,type","object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width","optgroup^[HTMLElement]|!disabled,label","option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value","output^[HTMLElement]|defaultValue,%htmlFor,name,value","p^[HTMLElement]|align","param^[HTMLElement]|name,type,value,valueType","picture^[HTMLElement]|","pre^[HTMLElement]|#width","progress^[HTMLElement]|#max,#value","q,blockquote,cite^[HTMLElement]|","script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,!noModule,%referrerPolicy,src,text,type","select^[HTMLElement]|autocomplete,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value","slot^[HTMLElement]|name","source^[HTMLElement]|#height,media,sizes,src,srcset,type,#width","span^[HTMLElement]|","style^[HTMLElement]|!disabled,media,type","caption^[HTMLElement]|align","th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width","col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width","table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width","tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign","tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign","template^[HTMLElement]|","textarea^[HTMLElement]|autocomplete,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap","time^[HTMLElement]|dateTime","title^[HTMLElement]|text","track^[HTMLElement]|!default,kind,label,src,srclang","ul^[HTMLElement]|!compact,type","unknown^[HTMLElement]|","video^media|!disablePictureInPicture,#height,*enterpictureinpicture,*leavepictureinpicture,!playsInline,poster,#width",":svg:a^:svg:graphics|",":svg:animate^:svg:animation|",":svg:animateMotion^:svg:animation|",":svg:animateTransform^:svg:animation|",":svg:circle^:svg:geometry|",":svg:clipPath^:svg:graphics|",":svg:defs^:svg:graphics|",":svg:desc^:svg:|",":svg:discard^:svg:|",":svg:ellipse^:svg:geometry|",":svg:feBlend^:svg:|",":svg:feColorMatrix^:svg:|",":svg:feComponentTransfer^:svg:|",":svg:feComposite^:svg:|",":svg:feConvolveMatrix^:svg:|",":svg:feDiffuseLighting^:svg:|",":svg:feDisplacementMap^:svg:|",":svg:feDistantLight^:svg:|",":svg:feDropShadow^:svg:|",":svg:feFlood^:svg:|",":svg:feFuncA^:svg:componentTransferFunction|",":svg:feFuncB^:svg:componentTransferFunction|",":svg:feFuncG^:svg:componentTransferFunction|",":svg:feFuncR^:svg:componentTransferFunction|",":svg:feGaussianBlur^:svg:|",":svg:feImage^:svg:|",":svg:feMerge^:svg:|",":svg:feMergeNode^:svg:|",":svg:feMorphology^:svg:|",":svg:feOffset^:svg:|",":svg:fePointLight^:svg:|",":svg:feSpecularLighting^:svg:|",":svg:feSpotLight^:svg:|",":svg:feTile^:svg:|",":svg:feTurbulence^:svg:|",":svg:filter^:svg:|",":svg:foreignObject^:svg:graphics|",":svg:g^:svg:graphics|",":svg:image^:svg:graphics|decoding",":svg:line^:svg:geometry|",":svg:linearGradient^:svg:gradient|",":svg:mpath^:svg:|",":svg:marker^:svg:|",":svg:mask^:svg:|",":svg:metadata^:svg:|",":svg:path^:svg:geometry|",":svg:pattern^:svg:|",":svg:polygon^:svg:geometry|",":svg:polyline^:svg:geometry|",":svg:radialGradient^:svg:gradient|",":svg:rect^:svg:geometry|",":svg:svg^:svg:graphics|#currentScale,#zoomAndPan",":svg:script^:svg:|type",":svg:set^:svg:animation|",":svg:stop^:svg:|",":svg:style^:svg:|!disabled,media,title,type",":svg:switch^:svg:graphics|",":svg:symbol^:svg:|",":svg:tspan^:svg:textPositioning|",":svg:text^:svg:textPositioning|",":svg:textPath^:svg:textContent|",":svg:title^:svg:|",":svg:use^:svg:graphics|",":svg:view^:svg:|#zoomAndPan","data^[HTMLElement]|value","keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name","menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default","summary^[HTMLElement]|","time^[HTMLElement]|dateTime",":svg:cursor^:svg:|",":math:^[HTMLElement]|!autofocus,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforeinput,*beforematch,*beforetoggle,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contentvisibilityautostatechange,*contextlost,*contextmenu,*contextrestored,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*scrollend,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,%style,#tabIndex",":math:math^:math:|",":math:maction^:math:|",":math:menclose^:math:|",":math:merror^:math:|",":math:mfenced^:math:|",":math:mfrac^:math:|",":math:mi^:math:|",":math:mmultiscripts^:math:|",":math:mn^:math:|",":math:mo^:math:|",":math:mover^:math:|",":math:mpadded^:math:|",":math:mphantom^:math:|",":math:mroot^:math:|",":math:mrow^:math:|",":math:ms^:math:|",":math:mspace^:math:|",":math:msqrt^:math:|",":math:mstyle^:math:|",":math:msub^:math:|",":math:msubsup^:math:|",":math:msup^:math:|",":math:mtable^:math:|",":math:mtd^:math:|",":math:mtext^:math:|",":math:mtr^:math:|",":math:munder^:math:|",":math:munderover^:math:|",":math:semantics^:math:|"],pd=new Map(Object.entries({class:"className",for:"htmlFor",formaction:"formAction",innerHtml:"innerHTML",readonly:"readOnly",tabindex:"tabIndex"})),_x=Array.from(pd).reduce((u,[p,b])=>(u.set(p,b),u),new Map),Ix=class extends Tx{constructor(){super(),this._schema=new Map,this._eventSchema=new Map,Lx.forEach(u=>{let p=new Map,b=new Set,[v,C]=u.split("|"),k=C.split(","),[N,M]=v.split("^");N.split(",").forEach(K=>{this._schema.set(K.toLowerCase(),p),this._eventSchema.set(K.toLowerCase(),b)});let z=M&&this._schema.get(M.toLowerCase());if(z){for(let[K,W]of z)p.set(K,W);for(let K of this._eventSchema.get(M.toLowerCase()))b.add(K)}k.forEach(K=>{if(K.length>0)switch(K[0]){case"*":b.add(K.substring(1));break;case"!":p.set(K.substring(1),Mx);break;case"#":p.set(K.substring(1),Bx);break;case"%":p.set(K.substring(1),Ox);break;default:p.set(K,jx)}})})}hasProperty(u,p,b){if(b.some(v=>v.name===ad.name))return!0;if(u.indexOf("-")>-1){if(ud(u)||cd(u))return!1;if(b.some(v=>v.name===id.name))return!0}return(this._schema.get(u.toLowerCase())||this._schema.get("unknown")).has(p)}hasElement(u,p){return p.some(b=>b.name===ad.name)||u.indexOf("-")>-1&&(ud(u)||cd(u)||p.some(b=>b.name===id.name))?!0:this._schema.has(u.toLowerCase())}securityContext(u,p,b){b&&(p=this.getMappedPropName(p)),u=u.toLowerCase(),p=p.toLowerCase();let v=dd()[u+"|"+p];return v||(v=dd()["*|"+p],v||jr.NONE)}getMappedPropName(u){return pd.get(u)??u}getDefaultComponentElementName(){return"ng-component"}validateProperty(u){return u.toLowerCase().startsWith("on")?{error:!0,msg:`Binding to event property '${u}' is disallowed for security reasons, please use (${u.slice(2)})=...
23
+ If '${u}' is a directive input, make sure the directive is imported by the current module.`}:{error:!1}}validateAttribute(u){return u.toLowerCase().startsWith("on")?{error:!0,msg:`Binding to event attribute '${u}' is disallowed for security reasons, please use (${u.slice(2)})=...`}:{error:!1}}allKnownElementNames(){return Array.from(this._schema.keys())}allKnownAttributesOfElement(u){let p=this._schema.get(u.toLowerCase())||this._schema.get("unknown");return Array.from(p.keys()).map(b=>_x.get(b)??b)}allKnownEventsOfElement(u){return Array.from(this._eventSchema.get(u.toLowerCase())??[])}normalizeAnimationStyleProperty(u){return ux(u)}normalizeAnimationStyleValue(u,p,b){let v="",C=b.toString().trim(),k=null;if(Rx(u)&&b!==0&&b!=="0")if(typeof b=="number")v="px";else{let N=b.match(/^[+-]?[\d\.]+([a-z]*)$/);N&&N[1].length==0&&(k=`Please provide a CSS unit value for ${p}:${b}`)}return{error:k,value:C+v}}};function Rx(u){switch(u){case"width":case"height":case"minWidth":case"minHeight":case"maxWidth":case"maxHeight":case"left":case"top":case"bottom":case"right":case"fontSize":case"outlineWidth":case"outlineOffset":case"paddingTop":case"paddingLeft":case"paddingBottom":case"paddingRight":case"marginTop":case"marginLeft":case"marginBottom":case"marginRight":case"borderRadius":case"borderWidth":case"borderTopWidth":case"borderLeftWidth":case"borderRightWidth":case"borderBottomWidth":case"textIndent":return!0;default:return!1}}var ee=class{constructor({closedByChildren:u,implicitNamespacePrefix:p,contentType:b=xt.PARSABLE_DATA,closedByParent:v=!1,isVoid:C=!1,ignoreFirstLf:k=!1,preventNamespaceInheritance:N=!1,canSelfClose:M=!1}={}){this.closedByChildren={},this.closedByParent=!1,u&&u.length>0&&u.forEach(z=>this.closedByChildren[z]=!0),this.isVoid=C,this.closedByParent=v||C,this.implicitNamespacePrefix=p||null,this.contentType=b,this.ignoreFirstLf=k,this.preventNamespaceInheritance=N,this.canSelfClose=M??C}isClosedByChild(u){return this.isVoid||u.toLowerCase()in this.closedByChildren}getContentType(u){return typeof this.contentType=="object"?(u===void 0?void 0:this.contentType[u])??this.contentType.default:this.contentType}},hd,rs;function ba(u){return rs||(hd=new ee({canSelfClose:!0}),rs=Object.assign(Object.create(null),{base:new ee({isVoid:!0}),meta:new ee({isVoid:!0}),area:new ee({isVoid:!0}),embed:new ee({isVoid:!0}),link:new ee({isVoid:!0}),img:new ee({isVoid:!0}),input:new ee({isVoid:!0}),param:new ee({isVoid:!0}),hr:new ee({isVoid:!0}),br:new ee({isVoid:!0}),source:new ee({isVoid:!0}),track:new ee({isVoid:!0}),wbr:new ee({isVoid:!0}),p:new ee({closedByChildren:["address","article","aside","blockquote","div","dl","fieldset","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","nav","ol","p","pre","section","table","ul"],closedByParent:!0}),thead:new ee({closedByChildren:["tbody","tfoot"]}),tbody:new ee({closedByChildren:["tbody","tfoot"],closedByParent:!0}),tfoot:new ee({closedByChildren:["tbody"],closedByParent:!0}),tr:new ee({closedByChildren:["tr"],closedByParent:!0}),td:new ee({closedByChildren:["td","th"],closedByParent:!0}),th:new ee({closedByChildren:["td","th"],closedByParent:!0}),col:new ee({isVoid:!0}),svg:new ee({implicitNamespacePrefix:"svg"}),foreignObject:new ee({implicitNamespacePrefix:"svg",preventNamespaceInheritance:!0}),math:new ee({implicitNamespacePrefix:"math"}),li:new ee({closedByChildren:["li"],closedByParent:!0}),dt:new ee({closedByChildren:["dt","dd"]}),dd:new ee({closedByChildren:["dt","dd"],closedByParent:!0}),rb:new ee({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rt:new ee({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rtc:new ee({closedByChildren:["rb","rtc","rp"],closedByParent:!0}),rp:new ee({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),optgroup:new ee({closedByChildren:["optgroup"],closedByParent:!0}),option:new ee({closedByChildren:["option","optgroup"],closedByParent:!0}),pre:new ee({ignoreFirstLf:!0}),listing:new ee({ignoreFirstLf:!0}),style:new ee({contentType:xt.RAW_TEXT}),script:new ee({contentType:xt.RAW_TEXT}),title:new ee({contentType:{default:xt.ESCAPABLE_RAW_TEXT,svg:xt.PARSABLE_DATA}}),textarea:new ee({contentType:xt.ESCAPABLE_RAW_TEXT,ignoreFirstLf:!0})}),new Ix().allKnownElementNames().forEach(p=>{!rs[p]&&lo(p)===null&&(rs[p]=new ee({canSelfClose:!1}))})),rs[u]??hd}var pn=class{constructor(u,p){this.sourceSpan=u,this.i18n=p}},Px=class extends pn{constructor(u,p,b,v){super(p,v),this.value=u,this.tokens=b,this.type="text"}visit(u,p){return u.visitText(this,p)}},zx=class extends pn{constructor(u,p,b,v){super(p,v),this.value=u,this.tokens=b,this.type="cdata"}visit(u,p){return u.visitCdata(this,p)}},$x=class extends pn{constructor(u,p,b,v,C,k){super(v,k),this.switchValue=u,this.type=p,this.cases=b,this.switchValueSourceSpan=C}visit(u,p){return u.visitExpansion(this,p)}},Hx=class{constructor(u,p,b,v,C){this.value=u,this.expression=p,this.sourceSpan=b,this.valueSourceSpan=v,this.expSourceSpan=C,this.type="expansionCase"}visit(u,p){return u.visitExpansionCase(this,p)}},Vx=class extends pn{constructor(u,p,b,v,C,k,N){super(b,N),this.name=u,this.value=p,this.keySpan=v,this.valueSpan=C,this.valueTokens=k,this.type="attribute"}visit(u,p){return u.visitAttribute(this,p)}get nameSpan(){return this.keySpan}},rr=class extends pn{constructor(u,p,b,v,C,k=null,N=null,M){super(v,M),this.name=u,this.attrs=p,this.children=b,this.startSourceSpan=C,this.endSourceSpan=k,this.nameSpan=N,this.type="element"}visit(u,p){return u.visitElement(this,p)}},qx=class{constructor(u,p){this.value=u,this.sourceSpan=p,this.type="comment"}visit(u,p){return u.visitComment(this,p)}},Wx=class{constructor(u,p){this.value=u,this.sourceSpan=p,this.type="docType"}visit(u,p){return u.visitDocType(this,p)}},hn=class extends pn{constructor(u,p,b,v,C,k,N=null,M){super(v,M),this.name=u,this.parameters=p,this.children=b,this.nameSpan=C,this.startSourceSpan=k,this.endSourceSpan=N,this.type="block"}visit(u,p){return u.visitBlock(this,p)}},fd=class{constructor(u,p){this.expression=u,this.sourceSpan=p,this.type="blockParameter",this.startSourceSpan=null,this.endSourceSpan=null}visit(u,p){return u.visitBlockParameter(this,p)}},md=class{constructor(u,p,b,v,C){this.name=u,this.value=p,this.sourceSpan=b,this.nameSpan=v,this.valueSpan=C,this.type="letDeclaration",this.startSourceSpan=null,this.endSourceSpan=null}visit(u,p){return u.visitLetDeclaration(this,p)}};function gd(u,p,b=null){let v=[],C=u.visit?k=>u.visit(k,b)||k.visit(u,b):k=>k.visit(u,b);return p.forEach(k=>{let N=C(k);N&&v.push(N)}),v}var Ux=class{constructor(){}visitElement(u,p){this.visitChildren(p,b=>{b(u.attrs),b(u.children)})}visitAttribute(u,p){}visitText(u,p){}visitCdata(u,p){}visitComment(u,p){}visitDocType(u,p){}visitExpansion(u,p){return this.visitChildren(p,b=>{b(u.cases)})}visitExpansionCase(u,p){}visitBlock(u,p){this.visitChildren(p,b=>{b(u.parameters),b(u.children)})}visitBlockParameter(u,p){}visitLetDeclaration(u,p){}visitChildren(u,p){let b=[],v=this;function C(k){k&&b.push(gd(v,k,u))}return p(C),Array.prototype.concat.apply([],b)}},ho={AElig:"Æ",AMP:"&",amp:"&",Aacute:"Á",Abreve:"Ă",Acirc:"Â",Acy:"А",Afr:"𝔄",Agrave:"À",Alpha:"Α",Amacr:"Ā",And:"⩓",Aogon:"Ą",Aopf:"𝔸",ApplyFunction:"⁡",af:"⁡",Aring:"Å",angst:"Å",Ascr:"𝒜",Assign:"≔",colone:"≔",coloneq:"≔",Atilde:"Ã",Auml:"Ä",Backslash:"∖",setminus:"∖",setmn:"∖",smallsetminus:"∖",ssetmn:"∖",Barv:"⫧",Barwed:"⌆",doublebarwedge:"⌆",Bcy:"Б",Because:"∵",becaus:"∵",because:"∵",Bernoullis:"ℬ",Bscr:"ℬ",bernou:"ℬ",Beta:"Β",Bfr:"𝔅",Bopf:"𝔹",Breve:"˘",breve:"˘",Bumpeq:"≎",HumpDownHump:"≎",bump:"≎",CHcy:"Ч",COPY:"©",copy:"©",Cacute:"Ć",Cap:"⋒",CapitalDifferentialD:"ⅅ",DD:"ⅅ",Cayleys:"ℭ",Cfr:"ℭ",Ccaron:"Č",Ccedil:"Ç",Ccirc:"Ĉ",Cconint:"∰",Cdot:"Ċ",Cedilla:"¸",cedil:"¸",CenterDot:"·",centerdot:"·",middot:"·",Chi:"Χ",CircleDot:"⊙",odot:"⊙",CircleMinus:"⊖",ominus:"⊖",CirclePlus:"⊕",oplus:"⊕",CircleTimes:"⊗",otimes:"⊗",ClockwiseContourIntegral:"∲",cwconint:"∲",CloseCurlyDoubleQuote:"”",rdquo:"”",rdquor:"”",CloseCurlyQuote:"’",rsquo:"’",rsquor:"’",Colon:"∷",Proportion:"∷",Colone:"⩴",Congruent:"≡",equiv:"≡",Conint:"∯",DoubleContourIntegral:"∯",ContourIntegral:"∮",conint:"∮",oint:"∮",Copf:"ℂ",complexes:"ℂ",Coproduct:"∐",coprod:"∐",CounterClockwiseContourIntegral:"∳",awconint:"∳",Cross:"⨯",Cscr:"𝒞",Cup:"⋓",CupCap:"≍",asympeq:"≍",DDotrahd:"⤑",DJcy:"Ђ",DScy:"Ѕ",DZcy:"Џ",Dagger:"‡",ddagger:"‡",Darr:"↡",Dashv:"⫤",DoubleLeftTee:"⫤",Dcaron:"Ď",Dcy:"Д",Del:"∇",nabla:"∇",Delta:"Δ",Dfr:"𝔇",DiacriticalAcute:"´",acute:"´",DiacriticalDot:"˙",dot:"˙",DiacriticalDoubleAcute:"˝",dblac:"˝",DiacriticalGrave:"`",grave:"`",DiacriticalTilde:"˜",tilde:"˜",Diamond:"⋄",diam:"⋄",diamond:"⋄",DifferentialD:"ⅆ",dd:"ⅆ",Dopf:"𝔻",Dot:"¨",DoubleDot:"¨",die:"¨",uml:"¨",DotDot:"⃜",DotEqual:"≐",doteq:"≐",esdot:"≐",DoubleDownArrow:"⇓",Downarrow:"⇓",dArr:"⇓",DoubleLeftArrow:"⇐",Leftarrow:"⇐",lArr:"⇐",DoubleLeftRightArrow:"⇔",Leftrightarrow:"⇔",hArr:"⇔",iff:"⇔",DoubleLongLeftArrow:"⟸",Longleftarrow:"⟸",xlArr:"⟸",DoubleLongLeftRightArrow:"⟺",Longleftrightarrow:"⟺",xhArr:"⟺",DoubleLongRightArrow:"⟹",Longrightarrow:"⟹",xrArr:"⟹",DoubleRightArrow:"⇒",Implies:"⇒",Rightarrow:"⇒",rArr:"⇒",DoubleRightTee:"⊨",vDash:"⊨",DoubleUpArrow:"⇑",Uparrow:"⇑",uArr:"⇑",DoubleUpDownArrow:"⇕",Updownarrow:"⇕",vArr:"⇕",DoubleVerticalBar:"∥",par:"∥",parallel:"∥",shortparallel:"∥",spar:"∥",DownArrow:"↓",ShortDownArrow:"↓",darr:"↓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",duarr:"⇵",DownBreve:"̑",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",leftharpoondown:"↽",lhard:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",rhard:"⇁",rightharpoondown:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",top:"⊤",DownTeeArrow:"↧",mapstodown:"↧",Dscr:"𝒟",Dstrok:"Đ",ENG:"Ŋ",ETH:"Ð",Eacute:"É",Ecaron:"Ě",Ecirc:"Ê",Ecy:"Э",Edot:"Ė",Efr:"𝔈",Egrave:"È",Element:"∈",in:"∈",isin:"∈",isinv:"∈",Emacr:"Ē",EmptySmallSquare:"◻",EmptyVerySmallSquare:"▫",Eogon:"Ę",Eopf:"𝔼",Epsilon:"Ε",Equal:"⩵",EqualTilde:"≂",eqsim:"≂",esim:"≂",Equilibrium:"⇌",rightleftharpoons:"⇌",rlhar:"⇌",Escr:"ℰ",expectation:"ℰ",Esim:"⩳",Eta:"Η",Euml:"Ë",Exists:"∃",exist:"∃",ExponentialE:"ⅇ",ee:"ⅇ",exponentiale:"ⅇ",Fcy:"Ф",Ffr:"𝔉",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",blacksquare:"▪",squarf:"▪",squf:"▪",Fopf:"𝔽",ForAll:"∀",forall:"∀",Fouriertrf:"ℱ",Fscr:"ℱ",GJcy:"Ѓ",GT:">",gt:">",Gamma:"Γ",Gammad:"Ϝ",Gbreve:"Ğ",Gcedil:"Ģ",Gcirc:"Ĝ",Gcy:"Г",Gdot:"Ġ",Gfr:"𝔊",Gg:"⋙",ggg:"⋙",Gopf:"𝔾",GreaterEqual:"≥",ge:"≥",geq:"≥",GreaterEqualLess:"⋛",gel:"⋛",gtreqless:"⋛",GreaterFullEqual:"≧",gE:"≧",geqq:"≧",GreaterGreater:"⪢",GreaterLess:"≷",gl:"≷",gtrless:"≷",GreaterSlantEqual:"⩾",geqslant:"⩾",ges:"⩾",GreaterTilde:"≳",gsim:"≳",gtrsim:"≳",Gscr:"𝒢",Gt:"≫",NestedGreaterGreater:"≫",gg:"≫",HARDcy:"Ъ",Hacek:"ˇ",caron:"ˇ",Hat:"^",Hcirc:"Ĥ",Hfr:"ℌ",Poincareplane:"ℌ",HilbertSpace:"ℋ",Hscr:"ℋ",hamilt:"ℋ",Hopf:"ℍ",quaternions:"ℍ",HorizontalLine:"─",boxh:"─",Hstrok:"Ħ",HumpEqual:"≏",bumpe:"≏",bumpeq:"≏",IEcy:"Е",IJlig:"IJ",IOcy:"Ё",Iacute:"Í",Icirc:"Î",Icy:"И",Idot:"İ",Ifr:"ℑ",Im:"ℑ",image:"ℑ",imagpart:"ℑ",Igrave:"Ì",Imacr:"Ī",ImaginaryI:"ⅈ",ii:"ⅈ",Int:"∬",Integral:"∫",int:"∫",Intersection:"⋂",bigcap:"⋂",xcap:"⋂",InvisibleComma:"⁣",ic:"⁣",InvisibleTimes:"⁢",it:"⁢",Iogon:"Į",Iopf:"𝕀",Iota:"Ι",Iscr:"ℐ",imagline:"ℐ",Itilde:"Ĩ",Iukcy:"І",Iuml:"Ï",Jcirc:"Ĵ",Jcy:"Й",Jfr:"𝔍",Jopf:"𝕁",Jscr:"𝒥",Jsercy:"Ј",Jukcy:"Є",KHcy:"Х",KJcy:"Ќ",Kappa:"Κ",Kcedil:"Ķ",Kcy:"К",Kfr:"𝔎",Kopf:"𝕂",Kscr:"𝒦",LJcy:"Љ",LT:"<",lt:"<",Lacute:"Ĺ",Lambda:"Λ",Lang:"⟪",Laplacetrf:"ℒ",Lscr:"ℒ",lagran:"ℒ",Larr:"↞",twoheadleftarrow:"↞",Lcaron:"Ľ",Lcedil:"Ļ",Lcy:"Л",LeftAngleBracket:"⟨",lang:"⟨",langle:"⟨",LeftArrow:"←",ShortLeftArrow:"←",larr:"←",leftarrow:"←",slarr:"←",LeftArrowBar:"⇤",larrb:"⇤",LeftArrowRightArrow:"⇆",leftrightarrows:"⇆",lrarr:"⇆",LeftCeiling:"⌈",lceil:"⌈",LeftDoubleBracket:"⟦",lobrk:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",dharl:"⇃",downharpoonleft:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",lfloor:"⌊",LeftRightArrow:"↔",harr:"↔",leftrightarrow:"↔",LeftRightVector:"⥎",LeftTee:"⊣",dashv:"⊣",LeftTeeArrow:"↤",mapstoleft:"↤",LeftTeeVector:"⥚",LeftTriangle:"⊲",vartriangleleft:"⊲",vltri:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",ltrie:"⊴",trianglelefteq:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",uharl:"↿",upharpoonleft:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",leftharpoonup:"↼",lharu:"↼",LeftVectorBar:"⥒",LessEqualGreater:"⋚",leg:"⋚",lesseqgtr:"⋚",LessFullEqual:"≦",lE:"≦",leqq:"≦",LessGreater:"≶",lessgtr:"≶",lg:"≶",LessLess:"⪡",LessSlantEqual:"⩽",leqslant:"⩽",les:"⩽",LessTilde:"≲",lesssim:"≲",lsim:"≲",Lfr:"𝔏",Ll:"⋘",Lleftarrow:"⇚",lAarr:"⇚",Lmidot:"Ŀ",LongLeftArrow:"⟵",longleftarrow:"⟵",xlarr:"⟵",LongLeftRightArrow:"⟷",longleftrightarrow:"⟷",xharr:"⟷",LongRightArrow:"⟶",longrightarrow:"⟶",xrarr:"⟶",Lopf:"𝕃",LowerLeftArrow:"↙",swarr:"↙",swarrow:"↙",LowerRightArrow:"↘",searr:"↘",searrow:"↘",Lsh:"↰",lsh:"↰",Lstrok:"Ł",Lt:"≪",NestedLessLess:"≪",ll:"≪",Map:"⤅",Mcy:"М",MediumSpace:" ",Mellintrf:"ℳ",Mscr:"ℳ",phmmat:"ℳ",Mfr:"𝔐",MinusPlus:"∓",mnplus:"∓",mp:"∓",Mopf:"𝕄",Mu:"Μ",NJcy:"Њ",Nacute:"Ń",Ncaron:"Ň",Ncedil:"Ņ",Ncy:"Н",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",ZeroWidthSpace:"​",NewLine:`
24
+ `,Nfr:"𝔑",NoBreak:"⁠",NonBreakingSpace:" ",nbsp:" ",Nopf:"ℕ",naturals:"ℕ",Not:"⫬",NotCongruent:"≢",nequiv:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",npar:"∦",nparallel:"∦",nshortparallel:"∦",nspar:"∦",NotElement:"∉",notin:"∉",notinva:"∉",NotEqual:"≠",ne:"≠",NotEqualTilde:"≂̸",nesim:"≂̸",NotExists:"∄",nexist:"∄",nexists:"∄",NotGreater:"≯",ngt:"≯",ngtr:"≯",NotGreaterEqual:"≱",nge:"≱",ngeq:"≱",NotGreaterFullEqual:"≧̸",ngE:"≧̸",ngeqq:"≧̸",NotGreaterGreater:"≫̸",nGtv:"≫̸",NotGreaterLess:"≹",ntgl:"≹",NotGreaterSlantEqual:"⩾̸",ngeqslant:"⩾̸",nges:"⩾̸",NotGreaterTilde:"≵",ngsim:"≵",NotHumpDownHump:"≎̸",nbump:"≎̸",NotHumpEqual:"≏̸",nbumpe:"≏̸",NotLeftTriangle:"⋪",nltri:"⋪",ntriangleleft:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",nltrie:"⋬",ntrianglelefteq:"⋬",NotLess:"≮",nless:"≮",nlt:"≮",NotLessEqual:"≰",nle:"≰",nleq:"≰",NotLessGreater:"≸",ntlg:"≸",NotLessLess:"≪̸",nLtv:"≪̸",NotLessSlantEqual:"⩽̸",nleqslant:"⩽̸",nles:"⩽̸",NotLessTilde:"≴",nlsim:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",NotPrecedes:"⊀",npr:"⊀",nprec:"⊀",NotPrecedesEqual:"⪯̸",npre:"⪯̸",npreceq:"⪯̸",NotPrecedesSlantEqual:"⋠",nprcue:"⋠",NotReverseElement:"∌",notni:"∌",notniva:"∌",NotRightTriangle:"⋫",nrtri:"⋫",ntriangleright:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",nrtrie:"⋭",ntrianglerighteq:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",nsqsube:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",nsqsupe:"⋣",NotSubset:"⊂⃒",nsubset:"⊂⃒",vnsub:"⊂⃒",NotSubsetEqual:"⊈",nsube:"⊈",nsubseteq:"⊈",NotSucceeds:"⊁",nsc:"⊁",nsucc:"⊁",NotSucceedsEqual:"⪰̸",nsce:"⪰̸",nsucceq:"⪰̸",NotSucceedsSlantEqual:"⋡",nsccue:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",nsupset:"⊃⃒",vnsup:"⊃⃒",NotSupersetEqual:"⊉",nsupe:"⊉",nsupseteq:"⊉",NotTilde:"≁",nsim:"≁",NotTildeEqual:"≄",nsime:"≄",nsimeq:"≄",NotTildeFullEqual:"≇",ncong:"≇",NotTildeTilde:"≉",nap:"≉",napprox:"≉",NotVerticalBar:"∤",nmid:"∤",nshortmid:"∤",nsmid:"∤",Nscr:"𝒩",Ntilde:"Ñ",Nu:"Ν",OElig:"Œ",Oacute:"Ó",Ocirc:"Ô",Ocy:"О",Odblac:"Ő",Ofr:"𝔒",Ograve:"Ò",Omacr:"Ō",Omega:"Ω",ohm:"Ω",Omicron:"Ο",Oopf:"𝕆",OpenCurlyDoubleQuote:"“",ldquo:"“",OpenCurlyQuote:"‘",lsquo:"‘",Or:"⩔",Oscr:"𝒪",Oslash:"Ø",Otilde:"Õ",Otimes:"⨷",Ouml:"Ö",OverBar:"‾",oline:"‾",OverBrace:"⏞",OverBracket:"⎴",tbrk:"⎴",OverParenthesis:"⏜",PartialD:"∂",part:"∂",Pcy:"П",Pfr:"𝔓",Phi:"Φ",Pi:"Π",PlusMinus:"±",plusmn:"±",pm:"±",Popf:"ℙ",primes:"ℙ",Pr:"⪻",Precedes:"≺",pr:"≺",prec:"≺",PrecedesEqual:"⪯",pre:"⪯",preceq:"⪯",PrecedesSlantEqual:"≼",prcue:"≼",preccurlyeq:"≼",PrecedesTilde:"≾",precsim:"≾",prsim:"≾",Prime:"″",Product:"∏",prod:"∏",Proportional:"∝",prop:"∝",propto:"∝",varpropto:"∝",vprop:"∝",Pscr:"𝒫",Psi:"Ψ",QUOT:'"',quot:'"',Qfr:"𝔔",Qopf:"ℚ",rationals:"ℚ",Qscr:"𝒬",RBarr:"⤐",drbkarow:"⤐",REG:"®",circledR:"®",reg:"®",Racute:"Ŕ",Rang:"⟫",Rarr:"↠",twoheadrightarrow:"↠",Rarrtl:"⤖",Rcaron:"Ř",Rcedil:"Ŗ",Rcy:"Р",Re:"ℜ",Rfr:"ℜ",real:"ℜ",realpart:"ℜ",ReverseElement:"∋",SuchThat:"∋",ni:"∋",niv:"∋",ReverseEquilibrium:"⇋",leftrightharpoons:"⇋",lrhar:"⇋",ReverseUpEquilibrium:"⥯",duhar:"⥯",Rho:"Ρ",RightAngleBracket:"⟩",rang:"⟩",rangle:"⟩",RightArrow:"→",ShortRightArrow:"→",rarr:"→",rightarrow:"→",srarr:"→",RightArrowBar:"⇥",rarrb:"⇥",RightArrowLeftArrow:"⇄",rightleftarrows:"⇄",rlarr:"⇄",RightCeiling:"⌉",rceil:"⌉",RightDoubleBracket:"⟧",robrk:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",dharr:"⇂",downharpoonright:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rfloor:"⌋",RightTee:"⊢",vdash:"⊢",RightTeeArrow:"↦",map:"↦",mapsto:"↦",RightTeeVector:"⥛",RightTriangle:"⊳",vartriangleright:"⊳",vrtri:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",rtrie:"⊵",trianglerighteq:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",uharr:"↾",upharpoonright:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",rharu:"⇀",rightharpoonup:"⇀",RightVectorBar:"⥓",Ropf:"ℝ",reals:"ℝ",RoundImplies:"⥰",Rrightarrow:"⇛",rAarr:"⇛",Rscr:"ℛ",realine:"ℛ",Rsh:"↱",rsh:"↱",RuleDelayed:"⧴",SHCHcy:"Щ",SHcy:"Ш",SOFTcy:"Ь",Sacute:"Ś",Sc:"⪼",Scaron:"Š",Scedil:"Ş",Scirc:"Ŝ",Scy:"С",Sfr:"𝔖",ShortUpArrow:"↑",UpArrow:"↑",uarr:"↑",uparrow:"↑",Sigma:"Σ",SmallCircle:"∘",compfn:"∘",Sopf:"𝕊",Sqrt:"√",radic:"√",Square:"□",squ:"□",square:"□",SquareIntersection:"⊓",sqcap:"⊓",SquareSubset:"⊏",sqsub:"⊏",sqsubset:"⊏",SquareSubsetEqual:"⊑",sqsube:"⊑",sqsubseteq:"⊑",SquareSuperset:"⊐",sqsup:"⊐",sqsupset:"⊐",SquareSupersetEqual:"⊒",sqsupe:"⊒",sqsupseteq:"⊒",SquareUnion:"⊔",sqcup:"⊔",Sscr:"𝒮",Star:"⋆",sstarf:"⋆",Sub:"⋐",Subset:"⋐",SubsetEqual:"⊆",sube:"⊆",subseteq:"⊆",Succeeds:"≻",sc:"≻",succ:"≻",SucceedsEqual:"⪰",sce:"⪰",succeq:"⪰",SucceedsSlantEqual:"≽",sccue:"≽",succcurlyeq:"≽",SucceedsTilde:"≿",scsim:"≿",succsim:"≿",Sum:"∑",sum:"∑",Sup:"⋑",Supset:"⋑",Superset:"⊃",sup:"⊃",supset:"⊃",SupersetEqual:"⊇",supe:"⊇",supseteq:"⊇",THORN:"Þ",TRADE:"™",trade:"™",TSHcy:"Ћ",TScy:"Ц",Tab:" ",Tau:"Τ",Tcaron:"Ť",Tcedil:"Ţ",Tcy:"Т",Tfr:"𝔗",Therefore:"∴",there4:"∴",therefore:"∴",Theta:"Θ",ThickSpace:"  ",ThinSpace:" ",thinsp:" ",Tilde:"∼",sim:"∼",thicksim:"∼",thksim:"∼",TildeEqual:"≃",sime:"≃",simeq:"≃",TildeFullEqual:"≅",cong:"≅",TildeTilde:"≈",ap:"≈",approx:"≈",asymp:"≈",thickapprox:"≈",thkap:"≈",Topf:"𝕋",TripleDot:"⃛",tdot:"⃛",Tscr:"𝒯",Tstrok:"Ŧ",Uacute:"Ú",Uarr:"↟",Uarrocir:"⥉",Ubrcy:"Ў",Ubreve:"Ŭ",Ucirc:"Û",Ucy:"У",Udblac:"Ű",Ufr:"𝔘",Ugrave:"Ù",Umacr:"Ū",UnderBar:"_",lowbar:"_",UnderBrace:"⏟",UnderBracket:"⎵",bbrk:"⎵",UnderParenthesis:"⏝",Union:"⋃",bigcup:"⋃",xcup:"⋃",UnionPlus:"⊎",uplus:"⊎",Uogon:"Ų",Uopf:"𝕌",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",udarr:"⇅",UpDownArrow:"↕",updownarrow:"↕",varr:"↕",UpEquilibrium:"⥮",udhar:"⥮",UpTee:"⊥",bot:"⊥",bottom:"⊥",perp:"⊥",UpTeeArrow:"↥",mapstoup:"↥",UpperLeftArrow:"↖",nwarr:"↖",nwarrow:"↖",UpperRightArrow:"↗",nearr:"↗",nearrow:"↗",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",Uring:"Ů",Uscr:"𝒰",Utilde:"Ũ",Uuml:"Ü",VDash:"⊫",Vbar:"⫫",Vcy:"В",Vdash:"⊩",Vdashl:"⫦",Vee:"⋁",bigvee:"⋁",xvee:"⋁",Verbar:"‖",Vert:"‖",VerticalBar:"∣",mid:"∣",shortmid:"∣",smid:"∣",VerticalLine:"|",verbar:"|",vert:"|",VerticalSeparator:"❘",VerticalTilde:"≀",wr:"≀",wreath:"≀",VeryThinSpace:" ",hairsp:" ",Vfr:"𝔙",Vopf:"𝕍",Vscr:"𝒱",Vvdash:"⊪",Wcirc:"Ŵ",Wedge:"⋀",bigwedge:"⋀",xwedge:"⋀",Wfr:"𝔚",Wopf:"𝕎",Wscr:"𝒲",Xfr:"𝔛",Xi:"Ξ",Xopf:"𝕏",Xscr:"𝒳",YAcy:"Я",YIcy:"Ї",YUcy:"Ю",Yacute:"Ý",Ycirc:"Ŷ",Ycy:"Ы",Yfr:"𝔜",Yopf:"𝕐",Yscr:"𝒴",Yuml:"Ÿ",ZHcy:"Ж",Zacute:"Ź",Zcaron:"Ž",Zcy:"З",Zdot:"Ż",Zeta:"Ζ",Zfr:"ℨ",zeetrf:"ℨ",Zopf:"ℤ",integers:"ℤ",Zscr:"𝒵",aacute:"á",abreve:"ă",ac:"∾",mstpos:"∾",acE:"∾̳",acd:"∿",acirc:"â",acy:"а",aelig:"æ",afr:"𝔞",agrave:"à",alefsym:"ℵ",aleph:"ℵ",alpha:"α",amacr:"ā",amalg:"⨿",and:"∧",wedge:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",angle:"∠",ange:"⦤",angmsd:"∡",measuredangle:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angzarr:"⍼",aogon:"ą",aopf:"𝕒",apE:"⩰",apacir:"⩯",ape:"≊",approxeq:"≊",apid:"≋",apos:"'",aring:"å",ascr:"𝒶",ast:"*",midast:"*",atilde:"ã",auml:"ä",awint:"⨑",bNot:"⫭",backcong:"≌",bcong:"≌",backepsilon:"϶",bepsi:"϶",backprime:"‵",bprime:"‵",backsim:"∽",bsim:"∽",backsimeq:"⋍",bsime:"⋍",barvee:"⊽",barwed:"⌅",barwedge:"⌅",bbrktbrk:"⎶",bcy:"б",bdquo:"„",ldquor:"„",bemptyv:"⦰",beta:"β",beth:"ℶ",between:"≬",twixt:"≬",bfr:"𝔟",bigcirc:"◯",xcirc:"◯",bigodot:"⨀",xodot:"⨀",bigoplus:"⨁",xoplus:"⨁",bigotimes:"⨂",xotime:"⨂",bigsqcup:"⨆",xsqcup:"⨆",bigstar:"★",starf:"★",bigtriangledown:"▽",xdtri:"▽",bigtriangleup:"△",xutri:"△",biguplus:"⨄",xuplus:"⨄",bkarow:"⤍",rbarr:"⤍",blacklozenge:"⧫",lozf:"⧫",blacktriangle:"▴",utrif:"▴",blacktriangledown:"▾",dtrif:"▾",blacktriangleleft:"◂",ltrif:"◂",blacktriangleright:"▸",rtrif:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bnot:"⌐",bopf:"𝕓",bowtie:"⋈",boxDL:"╗",boxDR:"╔",boxDl:"╖",boxDr:"╓",boxH:"═",boxHD:"╦",boxHU:"╩",boxHd:"╤",boxHu:"╧",boxUL:"╝",boxUR:"╚",boxUl:"╜",boxUr:"╙",boxV:"║",boxVH:"╬",boxVL:"╣",boxVR:"╠",boxVh:"╫",boxVl:"╢",boxVr:"╟",boxbox:"⧉",boxdL:"╕",boxdR:"╒",boxdl:"┐",boxdr:"┌",boxhD:"╥",boxhU:"╨",boxhd:"┬",boxhu:"┴",boxminus:"⊟",minusb:"⊟",boxplus:"⊞",plusb:"⊞",boxtimes:"⊠",timesb:"⊠",boxuL:"╛",boxuR:"╘",boxul:"┘",boxur:"└",boxv:"│",boxvH:"╪",boxvL:"╡",boxvR:"╞",boxvh:"┼",boxvl:"┤",boxvr:"├",brvbar:"¦",bscr:"𝒷",bsemi:"⁏",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bumpE:"⪮",cacute:"ć",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",caps:"∩︀",caret:"⁁",ccaps:"⩍",ccaron:"č",ccedil:"ç",ccirc:"ĉ",ccups:"⩌",ccupssm:"⩐",cdot:"ċ",cemptyv:"⦲",cent:"¢",cfr:"𝔠",chcy:"ч",check:"✓",checkmark:"✓",chi:"χ",cir:"○",cirE:"⧃",circ:"ˆ",circeq:"≗",cire:"≗",circlearrowleft:"↺",olarr:"↺",circlearrowright:"↻",orarr:"↻",circledS:"Ⓢ",oS:"Ⓢ",circledast:"⊛",oast:"⊛",circledcirc:"⊚",ocir:"⊚",circleddash:"⊝",odash:"⊝",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",clubs:"♣",clubsuit:"♣",colon:":",comma:",",commat:"@",comp:"∁",complement:"∁",congdot:"⩭",copf:"𝕔",copysr:"℗",crarr:"↵",cross:"✗",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",curlyeqprec:"⋞",cuesc:"⋟",curlyeqsucc:"⋟",cularr:"↶",curvearrowleft:"↶",cularrp:"⤽",cup:"∪",cupbrcap:"⩈",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curvearrowright:"↷",curarrm:"⤼",curlyvee:"⋎",cuvee:"⋎",curlywedge:"⋏",cuwed:"⋏",curren:"¤",cwint:"∱",cylcty:"⌭",dHar:"⥥",dagger:"†",daleth:"ℸ",dash:"‐",hyphen:"‐",dbkarow:"⤏",rBarr:"⤏",dcaron:"ď",dcy:"д",ddarr:"⇊",downdownarrows:"⇊",ddotseq:"⩷",eDDot:"⩷",deg:"°",delta:"δ",demptyv:"⦱",dfisht:"⥿",dfr:"𝔡",diamondsuit:"♦",diams:"♦",digamma:"ϝ",gammad:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",djcy:"ђ",dlcorn:"⌞",llcorner:"⌞",dlcrop:"⌍",dollar:"$",dopf:"𝕕",doteqdot:"≑",eDot:"≑",dotminus:"∸",minusd:"∸",dotplus:"∔",plusdo:"∔",dotsquare:"⊡",sdotb:"⊡",drcorn:"⌟",lrcorner:"⌟",drcrop:"⌌",dscr:"𝒹",dscy:"ѕ",dsol:"⧶",dstrok:"đ",dtdot:"⋱",dtri:"▿",triangledown:"▿",dwangle:"⦦",dzcy:"џ",dzigrarr:"⟿",eacute:"é",easter:"⩮",ecaron:"ě",ecir:"≖",eqcirc:"≖",ecirc:"ê",ecolon:"≕",eqcolon:"≕",ecy:"э",edot:"ė",efDot:"≒",fallingdotseq:"≒",efr:"𝔢",eg:"⪚",egrave:"è",egs:"⪖",eqslantgtr:"⪖",egsdot:"⪘",el:"⪙",elinters:"⏧",ell:"ℓ",els:"⪕",eqslantless:"⪕",elsdot:"⪗",emacr:"ē",empty:"∅",emptyset:"∅",emptyv:"∅",varnothing:"∅",emsp13:" ",emsp14:" ",emsp:" ",eng:"ŋ",ensp:" ",eogon:"ę",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",epsilon:"ε",epsiv:"ϵ",straightepsilon:"ϵ",varepsilon:"ϵ",equals:"=",equest:"≟",questeq:"≟",equivDD:"⩸",eqvparsl:"⧥",erDot:"≓",risingdotseq:"≓",erarr:"⥱",escr:"ℯ",eta:"η",eth:"ð",euml:"ë",euro:"€",excl:"!",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",ffr:"𝔣",filig:"fi",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",fopf:"𝕗",fork:"⋔",pitchfork:"⋔",forkv:"⫙",fpartint:"⨍",frac12:"½",half:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",sfrown:"⌢",fscr:"𝒻",gEl:"⪌",gtreqqless:"⪌",gacute:"ǵ",gamma:"γ",gap:"⪆",gtrapprox:"⪆",gbreve:"ğ",gcirc:"ĝ",gcy:"г",gdot:"ġ",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",gfr:"𝔤",gimel:"ℷ",gjcy:"ѓ",glE:"⪒",gla:"⪥",glj:"⪤",gnE:"≩",gneqq:"≩",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gneq:"⪈",gnsim:"⋧",gopf:"𝕘",gscr:"ℊ",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtrdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrarr:"⥸",gvertneqq:"≩︀",gvnE:"≩︀",hardcy:"ъ",harrcir:"⥈",harrw:"↭",leftrightsquigarrow:"↭",hbar:"ℏ",hslash:"ℏ",planck:"ℏ",plankv:"ℏ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",mldr:"…",hercon:"⊹",hfr:"𝔥",hksearow:"⤥",searhk:"⤥",hkswarow:"⤦",swarhk:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",larrhk:"↩",hookrightarrow:"↪",rarrhk:"↪",hopf:"𝕙",horbar:"―",hscr:"𝒽",hstrok:"ħ",hybull:"⁃",iacute:"í",icirc:"î",icy:"и",iecy:"е",iexcl:"¡",ifr:"𝔦",igrave:"ì",iiiint:"⨌",qint:"⨌",iiint:"∭",tint:"∭",iinfin:"⧜",iiota:"℩",ijlig:"ij",imacr:"ī",imath:"ı",inodot:"ı",imof:"⊷",imped:"Ƶ",incare:"℅",infin:"∞",infintie:"⧝",intcal:"⊺",intercal:"⊺",intlarhk:"⨗",intprod:"⨼",iprod:"⨼",iocy:"ё",iogon:"į",iopf:"𝕚",iota:"ι",iquest:"¿",iscr:"𝒾",isinE:"⋹",isindot:"⋵",isins:"⋴",isinsv:"⋳",itilde:"ĩ",iukcy:"і",iuml:"ï",jcirc:"ĵ",jcy:"й",jfr:"𝔧",jmath:"ȷ",jopf:"𝕛",jscr:"𝒿",jsercy:"ј",jukcy:"є",kappa:"κ",kappav:"ϰ",varkappa:"ϰ",kcedil:"ķ",kcy:"к",kfr:"𝔨",kgreen:"ĸ",khcy:"х",kjcy:"ќ",kopf:"𝕜",kscr:"𝓀",lAtail:"⤛",lBarr:"⤎",lEg:"⪋",lesseqqgtr:"⪋",lHar:"⥢",lacute:"ĺ",laemptyv:"⦴",lambda:"λ",langd:"⦑",lap:"⪅",lessapprox:"⪅",laquo:"«",larrbfs:"⤟",larrfs:"⤝",larrlp:"↫",looparrowleft:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",leftarrowtail:"↢",lat:"⪫",latail:"⤙",late:"⪭",lates:"⪭︀",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lcub:"{",lbrack:"[",lsqb:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",lcaron:"ľ",lcedil:"ļ",lcy:"л",ldca:"⤶",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",leq:"≤",leftleftarrows:"⇇",llarr:"⇇",leftthreetimes:"⋋",lthree:"⋋",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessdot:"⋖",ltdot:"⋖",lfisht:"⥼",lfr:"𝔩",lgE:"⪑",lharul:"⥪",lhblk:"▄",ljcy:"љ",llhard:"⥫",lltri:"◺",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnE:"≨",lneqq:"≨",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lneq:"⪇",lnsim:"⋦",loang:"⟬",loarr:"⇽",longmapsto:"⟼",xmap:"⟼",looparrowright:"↬",rarrlp:"↬",lopar:"⦅",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",loz:"◊",lozenge:"◊",lpar:"(",lparlt:"⦓",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",lsime:"⪍",lsimg:"⪏",lsquor:"‚",sbquo:"‚",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltrPar:"⦖",ltri:"◃",triangleleft:"◃",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",mDDot:"∺",macr:"¯",strns:"¯",male:"♂",malt:"✠",maltese:"✠",marker:"▮",mcomma:"⨩",mcy:"м",mdash:"—",mfr:"𝔪",mho:"℧",micro:"µ",midcir:"⫰",minus:"−",minusdu:"⨪",mlcp:"⫛",models:"⊧",mopf:"𝕞",mscr:"𝓂",mu:"μ",multimap:"⊸",mumap:"⊸",nGg:"⋙̸",nGt:"≫⃒",nLeftarrow:"⇍",nlArr:"⇍",nLeftrightarrow:"⇎",nhArr:"⇎",nLl:"⋘̸",nLt:"≪⃒",nRightarrow:"⇏",nrArr:"⇏",nVDash:"⊯",nVdash:"⊮",nacute:"ń",nang:"∠⃒",napE:"⩰̸",napid:"≋̸",napos:"ʼn",natur:"♮",natural:"♮",ncap:"⩃",ncaron:"ň",ncedil:"ņ",ncongdot:"⩭̸",ncup:"⩂",ncy:"н",ndash:"–",neArr:"⇗",nearhk:"⤤",nedot:"≐̸",nesear:"⤨",toea:"⤨",nfr:"𝔫",nharr:"↮",nleftrightarrow:"↮",nhpar:"⫲",nis:"⋼",nisd:"⋺",njcy:"њ",nlE:"≦̸",nleqq:"≦̸",nlarr:"↚",nleftarrow:"↚",nldr:"‥",nopf:"𝕟",not:"¬",notinE:"⋹̸",notindot:"⋵̸",notinvb:"⋷",notinvc:"⋶",notnivb:"⋾",notnivc:"⋽",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",nrarr:"↛",nrightarrow:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nscr:"𝓃",nsub:"⊄",nsubE:"⫅̸",nsubseteqq:"⫅̸",nsup:"⊅",nsupE:"⫆̸",nsupseteqq:"⫆̸",ntilde:"ñ",nu:"ν",num:"#",numero:"№",numsp:" ",nvDash:"⊭",nvHarr:"⤄",nvap:"≍⃒",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwArr:"⇖",nwarhk:"⤣",nwnear:"⤧",oacute:"ó",ocirc:"ô",ocy:"о",odblac:"ő",odiv:"⨸",odsold:"⦼",oelig:"œ",ofcir:"⦿",ofr:"𝔬",ogon:"˛",ograve:"ò",ogt:"⧁",ohbar:"⦵",olcir:"⦾",olcross:"⦻",olt:"⧀",omacr:"ō",omega:"ω",omicron:"ο",omid:"⦶",oopf:"𝕠",opar:"⦷",operp:"⦹",or:"∨",vee:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",oscr:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oslash:"ø",osol:"⊘",otilde:"õ",otimesas:"⨶",ouml:"ö",ovbar:"⌽",para:"¶",parsim:"⫳",parsl:"⫽",pcy:"п",percnt:"%",period:".",permil:"‰",pertenk:"‱",pfr:"𝔭",phi:"φ",phiv:"ϕ",straightphi:"ϕ",varphi:"ϕ",phone:"☎",pi:"π",piv:"ϖ",varpi:"ϖ",planckh:"ℎ",plus:"+",plusacir:"⨣",pluscir:"⨢",plusdu:"⨥",pluse:"⩲",plussim:"⨦",plustwo:"⨧",pointint:"⨕",popf:"𝕡",pound:"£",prE:"⪳",prap:"⪷",precapprox:"⪷",precnapprox:"⪹",prnap:"⪹",precneqq:"⪵",prnE:"⪵",precnsim:"⋨",prnsim:"⋨",prime:"′",profalar:"⌮",profline:"⌒",profsurf:"⌓",prurel:"⊰",pscr:"𝓅",psi:"ψ",puncsp:" ",qfr:"𝔮",qopf:"𝕢",qprime:"⁗",qscr:"𝓆",quatint:"⨖",quest:"?",rAtail:"⤜",rHar:"⥤",race:"∽̱",racute:"ŕ",raemptyv:"⦳",rangd:"⦒",range:"⦥",raquo:"»",rarrap:"⥵",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrpl:"⥅",rarrsim:"⥴",rarrtl:"↣",rightarrowtail:"↣",rarrw:"↝",rightsquigarrow:"↝",ratail:"⤚",ratio:"∶",rbbrk:"❳",rbrace:"}",rcub:"}",rbrack:"]",rsqb:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",rcaron:"ř",rcedil:"ŗ",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdsh:"↳",rect:"▭",rfisht:"⥽",rfr:"𝔯",rharul:"⥬",rho:"ρ",rhov:"ϱ",varrho:"ϱ",rightrightarrows:"⇉",rrarr:"⇉",rightthreetimes:"⋌",rthree:"⋌",ring:"˚",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",ropar:"⦆",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",rpar:")",rpargt:"⦔",rppolint:"⨒",rsaquo:"›",rscr:"𝓇",rtimes:"⋊",rtri:"▹",triangleright:"▹",rtriltri:"⧎",ruluhar:"⥨",rx:"℞",sacute:"ś",scE:"⪴",scap:"⪸",succapprox:"⪸",scaron:"š",scedil:"ş",scirc:"ŝ",scnE:"⪶",succneqq:"⪶",scnap:"⪺",succnapprox:"⪺",scnsim:"⋩",succnsim:"⋩",scpolint:"⨓",scy:"с",sdot:"⋅",sdote:"⩦",seArr:"⇘",sect:"§",semi:";",seswar:"⤩",tosa:"⤩",sext:"✶",sfr:"𝔰",sharp:"♯",shchcy:"щ",shcy:"ш",shy:"­",sigma:"σ",sigmaf:"ς",sigmav:"ς",varsigma:"ς",simdot:"⩪",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",smashp:"⨳",smeparsl:"⧤",smile:"⌣",ssmile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",sopf:"𝕤",spades:"♠",spadesuit:"♠",sqcaps:"⊓︀",sqcups:"⊔︀",sscr:"𝓈",star:"☆",sub:"⊂",subset:"⊂",subE:"⫅",subseteqq:"⫅",subdot:"⪽",subedot:"⫃",submult:"⫁",subnE:"⫋",subsetneqq:"⫋",subne:"⊊",subsetneq:"⊊",subplus:"⪿",subrarr:"⥹",subsim:"⫇",subsub:"⫕",subsup:"⫓",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",supE:"⫆",supseteqq:"⫆",supdot:"⪾",supdsub:"⫘",supedot:"⫄",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supsetneqq:"⫌",supne:"⊋",supsetneq:"⊋",supplus:"⫀",supsim:"⫈",supsub:"⫔",supsup:"⫖",swArr:"⇙",swnwar:"⤪",szlig:"ß",target:"⌖",tau:"τ",tcaron:"ť",tcedil:"ţ",tcy:"т",telrec:"⌕",tfr:"𝔱",theta:"θ",thetasym:"ϑ",thetav:"ϑ",vartheta:"ϑ",thorn:"þ",times:"×",timesbar:"⨱",timesd:"⨰",topbot:"⌶",topcir:"⫱",topf:"𝕥",topfork:"⫚",tprime:"‴",triangle:"▵",utri:"▵",triangleq:"≜",trie:"≜",tridot:"◬",triminus:"⨺",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",tscr:"𝓉",tscy:"ц",tshcy:"ћ",tstrok:"ŧ",uHar:"⥣",uacute:"ú",ubrcy:"ў",ubreve:"ŭ",ucirc:"û",ucy:"у",udblac:"ű",ufisht:"⥾",ufr:"𝔲",ugrave:"ù",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",umacr:"ū",uogon:"ų",uopf:"𝕦",upsi:"υ",upsilon:"υ",upuparrows:"⇈",uuarr:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",uring:"ů",urtri:"◹",uscr:"𝓊",utdot:"⋰",utilde:"ũ",uuml:"ü",uwangle:"⦧",vBar:"⫨",vBarv:"⫩",vangrt:"⦜",varsubsetneq:"⊊︀",vsubne:"⊊︀",varsubsetneqq:"⫋︀",vsubnE:"⫋︀",varsupsetneq:"⊋︀",vsupne:"⊋︀",varsupsetneqq:"⫌︀",vsupnE:"⫌︀",vcy:"в",veebar:"⊻",veeeq:"≚",vellip:"⋮",vfr:"𝔳",vopf:"𝕧",vscr:"𝓋",vzigzag:"⦚",wcirc:"ŵ",wedbar:"⩟",wedgeq:"≙",weierp:"℘",wp:"℘",wfr:"𝔴",wopf:"𝕨",wscr:"𝓌",xfr:"𝔵",xi:"ξ",xnis:"⋻",xopf:"𝕩",xscr:"𝓍",yacute:"ý",yacy:"я",ycirc:"ŷ",ycy:"ы",yen:"¥",yfr:"𝔶",yicy:"ї",yopf:"𝕪",yscr:"𝓎",yucy:"ю",yuml:"ÿ",zacute:"ź",zcaron:"ž",zcy:"з",zdot:"ż",zeta:"ζ",zfr:"𝔷",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",zscr:"𝓏",zwj:"‍",zwnj:"‌"},Kx="";ho.ngsp=Kx;var Jx=[/@/,/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function Gx(u,p){if(p!=null&&!(Array.isArray(p)&&p.length==2))throw new Error(`Expected '${u}' to be an array, [start, end].`);if(p!=null){let b=p[0],v=p[1];Jx.forEach(C=>{if(C.test(b)||C.test(v))throw new Error(`['${b}', '${v}'] contains unusable interpolation symbol.`)})}}var Yx=class Xh{static fromArray(p){return p?(Gx("interpolation",p),new Xh(p[0],p[1])):bd}constructor(p,b){this.start=p,this.end=b}},bd=new Yx("{{","}}"),ya=class extends Qc{constructor(u,p,b){super(b,u),this.tokenType=p}},Zx=class{constructor(u,p,b){this.tokens=u,this.errors=p,this.nonNormalizedIcuExpressions=b}};function Xx(u,p,b,v={}){let C=new t2(new Xc(u,p),b,v);return C.tokenize(),new Zx(a2(C.tokens),C.errors,C.nonNormalizedIcuExpressions)}var Qx=/\r\n?/g;function fn(u){return`Unexpected character "${u===0?"EOF":String.fromCharCode(u)}"`}function yd(u){return`Unknown entity "${u}" - use the "&#<decimal>;" or "&#x<hex>;" syntax`}function e2(u,p){return`Unable to parse entity "${p}" - ${u} character reference entities must end with ";"`}var fo;(function(u){u.HEX="hexadecimal",u.DEC="decimal"})(fo||(fo={}));var xa=class{constructor(u){this.error=u}},t2=class{constructor(u,p,b){this._getTagContentType=p,this._currentTokenStart=null,this._currentTokenType=null,this._expansionCaseStack=[],this._inInterpolation=!1,this._fullNameStack=[],this.tokens=[],this.errors=[],this.nonNormalizedIcuExpressions=[],this._tokenizeIcu=b.tokenizeExpansionForms||!1,this._interpolationConfig=b.interpolationConfig||bd,this._leadingTriviaCodePoints=b.leadingTriviaChars&&b.leadingTriviaChars.map(C=>C.codePointAt(0)||0),this._canSelfClose=b.canSelfClose||!1,this._allowHtmComponentClosingTags=b.allowHtmComponentClosingTags||!1;let v=b.range||{endPos:u.content.length,startPos:0,startLine:0,startCol:0};this._cursor=b.escapedString?new l2(u,v):new Cd(u,v),this._preserveLineEndings=b.preserveLineEndings||!1,this._i18nNormalizeLineEndingsInICUs=b.i18nNormalizeLineEndingsInICUs||!1,this._tokenizeBlocks=b.tokenizeBlocks??!0,this._tokenizeLet=b.tokenizeLet??!0;try{this._cursor.init()}catch(C){this.handleError(C)}}_processCarriageReturns(u){return this._preserveLineEndings?u:u.replace(Qx,`
25
+ `)}tokenize(){for(;this._cursor.peek()!==0;){let u=this._cursor.clone();try{if(this._attemptCharCode(60))if(this._attemptCharCode(33))this._attemptStr("[CDATA[")?this._consumeCdata(u):this._attemptStr("--")?this._consumeComment(u):this._attemptStrCaseInsensitive("doctype")?this._consumeDocType(u):this._consumeBogusComment(u);else if(this._attemptCharCode(47))this._consumeTagClose(u);else{let p=this._cursor.clone();this._attemptCharCode(63)?(this._cursor=p,this._consumeBogusComment(u)):this._consumeTagOpen(u)}else this._tokenizeLet&&this._cursor.peek()===64&&!this._inInterpolation&&this._attemptStr("@let")?this._consumeLetDeclaration(u):this._tokenizeBlocks&&this._attemptCharCode(64)?this._consumeBlockStart(u):this._tokenizeBlocks&&!this._inInterpolation&&!this._isInExpansionCase()&&!this._isInExpansionForm()&&this._attemptCharCode(125)?this._consumeBlockEnd(u):this._tokenizeIcu&&this._tokenizeExpansionForm()||this._consumeWithInterpolation(5,8,()=>this._isTextEnd(),()=>this._isTagStart())}catch(p){this.handleError(p)}}this._beginToken(34),this._endToken([])}_getBlockName(){let u=!1,p=this._cursor.clone();return this._attemptCharCodeUntilFn(b=>so(b)?!u:wd(b)?(u=!0,!1):!0),this._cursor.getChars(p).trim()}_consumeBlockStart(u){this._beginToken(25,u);let p=this._endToken([this._getBlockName()]);if(this._cursor.peek()===40)if(this._cursor.advance(),this._consumeBlockParameters(),this._attemptCharCodeUntilFn(we),this._attemptCharCode(41))this._attemptCharCodeUntilFn(we);else{p.type=29;return}this._attemptCharCode(123)?(this._beginToken(26),this._endToken([])):p.type=29}_consumeBlockEnd(u){this._beginToken(27,u),this._endToken([])}_consumeBlockParameters(){for(this._attemptCharCodeUntilFn(Dd);this._cursor.peek()!==41&&this._cursor.peek()!==0;){this._beginToken(28);let u=this._cursor.clone(),p=null,b=0;for(;this._cursor.peek()!==59&&this._cursor.peek()!==0||p!==null;){let v=this._cursor.peek();if(v===92)this._cursor.advance();else if(v===p)p=null;else if(p===null&&ma(v))p=v;else if(v===40&&p===null)b++;else if(v===41&&p===null){if(b===0)break;b>0&&b--}this._cursor.advance()}this._endToken([this._cursor.getChars(u)]),this._attemptCharCodeUntilFn(Dd)}}_consumeLetDeclaration(u){if(this._beginToken(30,u),so(this._cursor.peek()))this._attemptCharCodeUntilFn(we);else{let b=this._endToken([this._cursor.getChars(u)]);b.type=33;return}let p=this._endToken([this._getLetDeclarationName()]);if(this._attemptCharCodeUntilFn(we),!this._attemptCharCode(61)){p.type=33;return}this._attemptCharCodeUntilFn(b=>we(b)&&!fa(b)),this._consumeLetDeclarationValue(),this._cursor.peek()===59?(this._beginToken(32),this._endToken([]),this._cursor.advance()):(p.type=33,p.sourceSpan=this._cursor.getSpan(u))}_getLetDeclarationName(){let u=this._cursor.clone(),p=!1;return this._attemptCharCodeUntilFn(b=>oo(b)||b===36||b===95||p&&ha(b)?(p=!0,!1):!0),this._cursor.getChars(u).trim()}_consumeLetDeclarationValue(){let u=this._cursor.clone();for(this._beginToken(31,u);this._cursor.peek()!==0;){let p=this._cursor.peek();if(p===59)break;ma(p)&&(this._cursor.advance(),this._attemptCharCodeUntilFn(b=>b===92?(this._cursor.advance(),!1):b===p)),this._cursor.advance()}this._endToken([this._cursor.getChars(u)])}_tokenizeExpansionForm(){if(this.isExpansionFormStart())return this._consumeExpansionFormStart(),!0;if(o2(this._cursor.peek())&&this._isInExpansionForm())return this._consumeExpansionCaseStart(),!0;if(this._cursor.peek()===125){if(this._isInExpansionCase())return this._consumeExpansionCaseEnd(),!0;if(this._isInExpansionForm())return this._consumeExpansionFormEnd(),!0}return!1}_beginToken(u,p=this._cursor.clone()){this._currentTokenStart=p,this._currentTokenType=u}_endToken(u,p){if(this._currentTokenStart===null)throw new ya("Programming error - attempted to end a token when there was no start to the token",this._currentTokenType,this._cursor.getSpan(p));if(this._currentTokenType===null)throw new ya("Programming error - attempted to end a token which has no token type",null,this._cursor.getSpan(this._currentTokenStart));let b={type:this._currentTokenType,parts:u,sourceSpan:(p??this._cursor).getSpan(this._currentTokenStart,this._leadingTriviaCodePoints)};return this.tokens.push(b),this._currentTokenStart=null,this._currentTokenType=null,b}_createError(u,p){this._isInExpansionForm()&&(u+=` (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)`);let b=new ya(u,this._currentTokenType,p);return this._currentTokenStart=null,this._currentTokenType=null,new xa(b)}handleError(u){if(u instanceof va&&(u=this._createError(u.msg,this._cursor.getSpan(u.cursor))),u instanceof xa)this.errors.push(u.error);else throw u}_attemptCharCode(u){return this._cursor.peek()===u?(this._cursor.advance(),!0):!1}_attemptCharCodeCaseInsensitive(u){return i2(this._cursor.peek(),u)?(this._cursor.advance(),!0):!1}_requireCharCode(u){let p=this._cursor.clone();if(!this._attemptCharCode(u))throw this._createError(fn(this._cursor.peek()),this._cursor.getSpan(p))}_attemptStr(u){let p=u.length;if(this._cursor.charsLeft()<p)return!1;let b=this._cursor.clone();for(let v=0;v<p;v++)if(!this._attemptCharCode(u.charCodeAt(v)))return this._cursor=b,!1;return!0}_attemptStrCaseInsensitive(u){for(let p=0;p<u.length;p++)if(!this._attemptCharCodeCaseInsensitive(u.charCodeAt(p)))return!1;return!0}_requireStr(u){let p=this._cursor.clone();if(!this._attemptStr(u))throw this._createError(fn(this._cursor.peek()),this._cursor.getSpan(p))}_requireStrCaseInsensitive(u){let p=this._cursor.clone();if(!this._attemptStrCaseInsensitive(u))throw this._createError(fn(this._cursor.peek()),this._cursor.getSpan(p))}_attemptCharCodeUntilFn(u){for(;!u(this._cursor.peek());)this._cursor.advance()}_requireCharCodeUntilFn(u,p){let b=this._cursor.clone();if(this._attemptCharCodeUntilFn(u),this._cursor.diff(b)<p)throw this._createError(fn(this._cursor.peek()),this._cursor.getSpan(b))}_attemptUntilChar(u){for(;this._cursor.peek()!==u;)this._cursor.advance()}_readChar(){let u=String.fromCodePoint(this._cursor.peek());return this._cursor.advance(),u}_consumeEntity(u){this._beginToken(9);let p=this._cursor.clone();if(this._cursor.advance(),this._attemptCharCode(35)){let b=this._attemptCharCode(120)||this._attemptCharCode(88),v=this._cursor.clone();if(this._attemptCharCodeUntilFn(n2),this._cursor.peek()!=59){this._cursor.advance();let k=b?fo.HEX:fo.DEC;throw this._createError(e2(k,this._cursor.getChars(p)),this._cursor.getSpan())}let C=this._cursor.getChars(v);this._cursor.advance();try{let k=parseInt(C,b?16:10);this._endToken([String.fromCharCode(k),this._cursor.getChars(p)])}catch{throw this._createError(yd(this._cursor.getChars(p)),this._cursor.getSpan())}}else{let b=this._cursor.clone();if(this._attemptCharCodeUntilFn(s2),this._cursor.peek()!=59)this._beginToken(u,p),this._cursor=b,this._endToken(["&"]);else{let v=this._cursor.getChars(b);this._cursor.advance();let C=ho[v];if(!C)throw this._createError(yd(v),this._cursor.getSpan(p));this._endToken([C,`&${v};`])}}}_consumeRawText(u,p){this._beginToken(u?6:7);let b=[];for(;;){let v=this._cursor.clone(),C=p();if(this._cursor=v,C)break;u&&this._cursor.peek()===38?(this._endToken([this._processCarriageReturns(b.join(""))]),b.length=0,this._consumeEntity(6),this._beginToken(6)):b.push(this._readChar())}this._endToken([this._processCarriageReturns(b.join(""))])}_consumeComment(u){this._beginToken(10,u),this._endToken([]),this._consumeRawText(!1,()=>this._attemptStr("-->")),this._beginToken(11),this._requireStr("-->"),this._endToken([])}_consumeBogusComment(u){this._beginToken(10,u),this._endToken([]),this._consumeRawText(!1,()=>this._cursor.peek()===62),this._beginToken(11),this._cursor.advance(),this._endToken([])}_consumeCdata(u){this._beginToken(12,u),this._endToken([]),this._consumeRawText(!1,()=>this._attemptStr("]]>")),this._beginToken(13),this._requireStr("]]>"),this._endToken([])}_consumeDocType(u){this._beginToken(18,u),this._endToken([]),this._consumeRawText(!1,()=>this._cursor.peek()===62),this._beginToken(19),this._cursor.advance(),this._endToken([])}_consumePrefixAndName(){let u=this._cursor.clone(),p="";for(;this._cursor.peek()!==58&&!r2(this._cursor.peek());)this._cursor.advance();let b;this._cursor.peek()===58?(p=this._cursor.getChars(u),this._cursor.advance(),b=this._cursor.clone()):b=u,this._requireCharCodeUntilFn(xd,p===""?0:1);let v=this._cursor.getChars(b);return[p,v]}_consumeTagOpen(u){let p,b,v,C=[];try{if(!oo(this._cursor.peek()))throw this._createError(fn(this._cursor.peek()),this._cursor.getSpan(u));for(v=this._consumeTagOpenStart(u),b=v.parts[0],p=v.parts[1],this._attemptCharCodeUntilFn(we);this._cursor.peek()!==47&&this._cursor.peek()!==62&&this._cursor.peek()!==60&&this._cursor.peek()!==0;){let[N,M]=this._consumeAttributeName();if(this._attemptCharCodeUntilFn(we),this._attemptCharCode(61)){this._attemptCharCodeUntilFn(we);let z=this._consumeAttributeValue();C.push({prefix:N,name:M,value:z})}else C.push({prefix:N,name:M});this._attemptCharCodeUntilFn(we)}this._consumeTagOpenEnd()}catch(N){if(N instanceof xa){v?v.type=4:(this._beginToken(5,u),this._endToken(["<"]));return}throw N}if(this._canSelfClose&&this.tokens[this.tokens.length-1].type===2)return;let k=this._getTagContentType(p,b,this._fullNameStack.length>0,C);this._handleFullNameStackForTagOpen(b,p),k===xt.RAW_TEXT?this._consumeRawTextWithTagClose(b,p,!1):k===xt.ESCAPABLE_RAW_TEXT&&this._consumeRawTextWithTagClose(b,p,!0)}_consumeRawTextWithTagClose(u,p,b){this._consumeRawText(b,()=>!this._attemptCharCode(60)||!this._attemptCharCode(47)||(this._attemptCharCodeUntilFn(we),!this._attemptStrCaseInsensitive(u?`${u}:${p}`:p))?!1:(this._attemptCharCodeUntilFn(we),this._attemptCharCode(62))),this._beginToken(3),this._requireCharCodeUntilFn(v=>v===62,3),this._cursor.advance(),this._endToken([u,p]),this._handleFullNameStackForTagClose(u,p)}_consumeTagOpenStart(u){this._beginToken(0,u);let p=this._consumePrefixAndName();return this._endToken(p)}_consumeAttributeName(){let u=this._cursor.peek();if(u===39||u===34)throw this._createError(fn(u),this._cursor.getSpan());this._beginToken(14);let p=this._consumePrefixAndName();return this._endToken(p),p}_consumeAttributeValue(){let u;if(this._cursor.peek()===39||this._cursor.peek()===34){let p=this._cursor.peek();this._consumeQuote(p);let b=()=>this._cursor.peek()===p;u=this._consumeWithInterpolation(16,17,b,b),this._consumeQuote(p)}else{let p=()=>xd(this._cursor.peek());u=this._consumeWithInterpolation(16,17,p,p)}return u}_consumeQuote(u){this._beginToken(15),this._requireCharCode(u),this._endToken([String.fromCodePoint(u)])}_consumeTagOpenEnd(){let u=this._attemptCharCode(47)?2:1;this._beginToken(u),this._requireCharCode(62),this._endToken([])}_consumeTagClose(u){if(this._beginToken(3,u),this._attemptCharCodeUntilFn(we),this._allowHtmComponentClosingTags&&this._attemptCharCode(47))this._attemptCharCodeUntilFn(we),this._requireCharCode(62),this._endToken([]);else{let[p,b]=this._consumePrefixAndName();this._attemptCharCodeUntilFn(we),this._requireCharCode(62),this._endToken([p,b]),this._handleFullNameStackForTagClose(p,b)}}_consumeExpansionFormStart(){this._beginToken(20),this._requireCharCode(123),this._endToken([]),this._expansionCaseStack.push(20),this._beginToken(7);let u=this._readUntil(44),p=this._processCarriageReturns(u);if(this._i18nNormalizeLineEndingsInICUs)this._endToken([p]);else{let v=this._endToken([u]);p!==u&&this.nonNormalizedIcuExpressions.push(v)}this._requireCharCode(44),this._attemptCharCodeUntilFn(we),this._beginToken(7);let b=this._readUntil(44);this._endToken([b]),this._requireCharCode(44),this._attemptCharCodeUntilFn(we)}_consumeExpansionCaseStart(){this._beginToken(21);let u=this._readUntil(123).trim();this._endToken([u]),this._attemptCharCodeUntilFn(we),this._beginToken(22),this._requireCharCode(123),this._endToken([]),this._attemptCharCodeUntilFn(we),this._expansionCaseStack.push(22)}_consumeExpansionCaseEnd(){this._beginToken(23),this._requireCharCode(125),this._endToken([]),this._attemptCharCodeUntilFn(we),this._expansionCaseStack.pop()}_consumeExpansionFormEnd(){this._beginToken(24),this._requireCharCode(125),this._endToken([]),this._expansionCaseStack.pop()}_consumeWithInterpolation(u,p,b,v){this._beginToken(u);let C=[];for(;!b();){let N=this._cursor.clone();this._interpolationConfig&&this._attemptStr(this._interpolationConfig.start)?(this._endToken([this._processCarriageReturns(C.join(""))],N),C.length=0,this._consumeInterpolation(p,N,v),this._beginToken(u)):this._cursor.peek()===38?(this._endToken([this._processCarriageReturns(C.join(""))]),C.length=0,this._consumeEntity(u),this._beginToken(u)):C.push(this._readChar())}this._inInterpolation=!1;let k=this._processCarriageReturns(C.join(""));return this._endToken([k]),k}_consumeInterpolation(u,p,b){let v=[];this._beginToken(u,p),v.push(this._interpolationConfig.start);let C=this._cursor.clone(),k=null,N=!1;for(;this._cursor.peek()!==0&&(b===null||!b());){let M=this._cursor.clone();if(this._isTagStart()){this._cursor=M,v.push(this._getProcessedChars(C,M)),this._endToken(v);return}if(k===null)if(this._attemptStr(this._interpolationConfig.end)){v.push(this._getProcessedChars(C,M)),v.push(this._interpolationConfig.end),this._endToken(v);return}else this._attemptStr("//")&&(N=!0);let z=this._cursor.peek();this._cursor.advance(),z===92?this._cursor.advance():z===k?k=null:!N&&k===null&&ma(z)&&(k=z)}v.push(this._getProcessedChars(C,this._cursor)),this._endToken(v)}_getProcessedChars(u,p){return this._processCarriageReturns(p.getChars(u))}_isTextEnd(){return!!(this._isTagStart()||this._cursor.peek()===0||this._tokenizeIcu&&!this._inInterpolation&&(this.isExpansionFormStart()||this._cursor.peek()===125&&this._isInExpansionCase())||this._tokenizeBlocks&&!this._inInterpolation&&!this._isInExpansion()&&(this._isBlockStart()||this._cursor.peek()===64||this._cursor.peek()===125))}_isTagStart(){if(this._cursor.peek()===60){let u=this._cursor.clone();u.advance();let p=u.peek();if(97<=p&&p<=122||65<=p&&p<=90||p===47||p===33)return!0}return!1}_isBlockStart(){if(this._tokenizeBlocks&&this._cursor.peek()===64){let u=this._cursor.clone();if(u.advance(),wd(u.peek()))return!0}return!1}_readUntil(u){let p=this._cursor.clone();return this._attemptUntilChar(u),this._cursor.getChars(p)}_isInExpansion(){return this._isInExpansionCase()||this._isInExpansionForm()}_isInExpansionCase(){return this._expansionCaseStack.length>0&&this._expansionCaseStack[this._expansionCaseStack.length-1]===22}_isInExpansionForm(){return this._expansionCaseStack.length>0&&this._expansionCaseStack[this._expansionCaseStack.length-1]===20}isExpansionFormStart(){if(this._cursor.peek()!==123)return!1;if(this._interpolationConfig){let u=this._cursor.clone(),p=this._attemptStr(this._interpolationConfig.start);return this._cursor=u,!p}return!0}_handleFullNameStackForTagOpen(u,p){let b=uo(u,p);(this._fullNameStack.length===0||this._fullNameStack[this._fullNameStack.length-1]===b)&&this._fullNameStack.push(b)}_handleFullNameStackForTagClose(u,p){let b=uo(u,p);this._fullNameStack.length!==0&&this._fullNameStack[this._fullNameStack.length-1]===b&&this._fullNameStack.pop()}};function we(u){return!so(u)||u===0}function xd(u){return so(u)||u===62||u===60||u===47||u===39||u===34||u===61||u===0}function r2(u){return(u<97||122<u)&&(u<65||90<u)&&(u<48||u>57)}function n2(u){return u===59||u===0||!ax(u)}function s2(u){return u===59||u===0||!oo(u)}function o2(u){return u!==125}function i2(u,p){return vd(u)===vd(p)}function vd(u){return u>=97&&u<=122?u-97+65:u}function wd(u){return oo(u)||ha(u)||u===95}function Dd(u){return u!==59&&we(u)}function a2(u){let p=[],b;for(let v=0;v<u.length;v++){let C=u[v];b&&b.type===5&&C.type===5||b&&b.type===16&&C.type===16?(b.parts[0]+=C.parts[0],b.sourceSpan.end=C.sourceSpan.end):(b=C,p.push(b))}return p}var Cd=class ul{constructor(p,b){if(p instanceof ul){this.file=p.file,this.input=p.input,this.end=p.end;let v=p.state;this.state={peek:v.peek,offset:v.offset,line:v.line,column:v.column}}else{if(!b)throw new Error("Programming error: the range argument must be provided with a file argument.");this.file=p,this.input=p.content,this.end=b.endPos,this.state={peek:-1,offset:b.startPos,line:b.startLine,column:b.startCol}}}clone(){return new ul(this)}peek(){return this.state.peek}charsLeft(){return this.end-this.state.offset}diff(p){return this.state.offset-p.state.offset}advance(){this.advanceState(this.state)}init(){this.updatePeek(this.state)}getSpan(p,b){p=p||this;let v=p;if(b)for(;this.diff(p)>0&&b.indexOf(p.peek())!==-1;)v===p&&(p=p.clone()),p.advance();let C=this.locationFromCursor(p),k=this.locationFromCursor(this),N=v!==p?this.locationFromCursor(v):C;return new se(C,k,N)}getChars(p){return this.input.substring(p.state.offset,this.state.offset)}charAt(p){return this.input.charCodeAt(p)}advanceState(p){if(p.offset>=this.end)throw this.state=p,new va('Unexpected character "EOF"',this);let b=this.charAt(p.offset);b===10?(p.line++,p.column=0):fa(b)||p.column++,p.offset++,this.updatePeek(p)}updatePeek(p){p.peek=p.offset>=this.end?0:this.charAt(p.offset)}locationFromCursor(p){return new ga(p.file,p.state.offset,p.state.line,p.state.column)}},l2=class cl extends Cd{constructor(p,b){p instanceof cl?(super(p),this.internalState={...p.internalState}):(super(p,b),this.internalState=this.state)}advance(){this.state=this.internalState,super.advance(),this.processEscapeSequence()}init(){super.init(),this.processEscapeSequence()}clone(){return new cl(this)}getChars(p){let b=p.clone(),v="";for(;b.internalState.offset<this.internalState.offset;)v+=String.fromCodePoint(b.peek()),b.advance();return v}processEscapeSequence(){let p=()=>this.internalState.peek;if(p()===92)if(this.internalState={...this.state},this.advanceState(this.internalState),p()===110)this.state.peek=10;else if(p()===114)this.state.peek=13;else if(p()===118)this.state.peek=11;else if(p()===116)this.state.peek=9;else if(p()===98)this.state.peek=8;else if(p()===102)this.state.peek=12;else if(p()===117)if(this.advanceState(this.internalState),p()===123){this.advanceState(this.internalState);let b=this.clone(),v=0;for(;p()!==125;)this.advanceState(this.internalState),v++;this.state.peek=this.decodeHexDigits(b,v)}else{let b=this.clone();this.advanceState(this.internalState),this.advanceState(this.internalState),this.advanceState(this.internalState),this.state.peek=this.decodeHexDigits(b,4)}else if(p()===120){this.advanceState(this.internalState);let b=this.clone();this.advanceState(this.internalState),this.state.peek=this.decodeHexDigits(b,2)}else if(Zc(p())){let b="",v=0,C=this.clone();for(;Zc(p())&&v<3;)C=this.clone(),b+=String.fromCodePoint(p()),this.advanceState(this.internalState),v++;this.state.peek=parseInt(b,8),this.internalState=C.internalState}else fa(this.internalState.peek)?(this.advanceState(this.internalState),this.state=this.internalState):this.state.peek=this.internalState.peek}decodeHexDigits(p,b){let v=this.input.slice(p.internalState.offset,p.internalState.offset+b),C=parseInt(v,16);if(isNaN(C))throw p.state=p.internalState,new va("Invalid hexadecimal escape sequence",p);return C}},va=class{constructor(u,p){this.msg=u,this.cursor=p}},Ke=class Qh extends Qc{static create(p,b,v){return new Qh(p,b,v)}constructor(p,b,v){super(b,v),this.elementName=p}},u2=class{constructor(u,p){this.rootNodes=u,this.errors=p}},c2=class{constructor(u){this.getTagDefinition=u}parse(u,p,b,v=!1,C){let k=oe=>(ce,...Se)=>oe(ce.toLowerCase(),...Se),N=v?this.getTagDefinition:k(this.getTagDefinition),M=oe=>N(oe).getContentType(),z=v?C:k(C),K=Xx(u,p,C?(oe,ce,Se,Le)=>{let Ve=z(oe,ce,Se,Le);return Ve!==void 0?Ve:M(oe)}:M,b),W=b&&b.canSelfClose||!1,ae=b&&b.allowHtmComponentClosingTags||!1,te=new d2(K.tokens,N,W,ae,v);return te.build(),new u2(te.rootNodes,K.errors.concat(te.errors))}},d2=class ef{constructor(p,b,v,C,k){this.tokens=p,this.getTagDefinition=b,this.canSelfClose=v,this.allowHtmComponentClosingTags=C,this.isTagNameCaseSensitive=k,this._index=-1,this._containerStack=[],this.rootNodes=[],this.errors=[],this._advance()}build(){for(;this._peek.type!==34;)this._peek.type===0||this._peek.type===4?this._consumeStartTag(this._advance()):this._peek.type===3?(this._closeVoidElement(),this._consumeEndTag(this._advance())):this._peek.type===12?(this._closeVoidElement(),this._consumeCdata(this._advance())):this._peek.type===10?(this._closeVoidElement(),this._consumeComment(this._advance())):this._peek.type===5||this._peek.type===7||this._peek.type===6?(this._closeVoidElement(),this._consumeText(this._advance())):this._peek.type===20?this._consumeExpansion(this._advance()):this._peek.type===25?(this._closeVoidElement(),this._consumeBlockOpen(this._advance())):this._peek.type===27?(this._closeVoidElement(),this._consumeBlockClose(this._advance())):this._peek.type===29?(this._closeVoidElement(),this._consumeIncompleteBlock(this._advance())):this._peek.type===30?(this._closeVoidElement(),this._consumeLet(this._advance())):this._peek.type===18?this._consumeDocType(this._advance()):this._peek.type===33?(this._closeVoidElement(),this._consumeIncompleteLet(this._advance())):this._advance();for(let p of this._containerStack)p instanceof hn&&this.errors.push(Ke.create(p.name,p.sourceSpan,`Unclosed block "${p.name}"`))}_advance(){let p=this._peek;return this._index<this.tokens.length-1&&this._index++,this._peek=this.tokens[this._index],p}_advanceIf(p){return this._peek.type===p?this._advance():null}_consumeCdata(p){let b=this._advance(),v=this._getText(b),C=this._advanceIf(13);this._addToParent(new zx(v,new se(p.sourceSpan.start,(C||b).sourceSpan.end),[b]))}_consumeComment(p){let b=this._advanceIf(7),v=this._advanceIf(11),C=b!=null?b.parts[0].trim():null,k=v==null?p.sourceSpan:new se(p.sourceSpan.start,v.sourceSpan.end,p.sourceSpan.fullStart);this._addToParent(new qx(C,k))}_consumeDocType(p){let b=this._advanceIf(7),v=this._advanceIf(19),C=b!=null?b.parts[0].trim():null,k=new se(p.sourceSpan.start,(v||b||p).sourceSpan.end);this._addToParent(new Wx(C,k))}_consumeExpansion(p){let b=this._advance(),v=this._advance(),C=[];for(;this._peek.type===21;){let N=this._parseExpansionCase();if(!N)return;C.push(N)}if(this._peek.type!==24){this.errors.push(Ke.create(null,this._peek.sourceSpan,"Invalid ICU message. Missing '}'."));return}let k=new se(p.sourceSpan.start,this._peek.sourceSpan.end,p.sourceSpan.fullStart);this._addToParent(new $x(b.parts[0],v.parts[0],C,k,b.sourceSpan)),this._advance()}_parseExpansionCase(){let p=this._advance();if(this._peek.type!==22)return this.errors.push(Ke.create(null,this._peek.sourceSpan,"Invalid ICU message. Missing '{'.")),null;let b=this._advance(),v=this._collectExpansionExpTokens(b);if(!v)return null;let C=this._advance();v.push({type:34,parts:[],sourceSpan:C.sourceSpan});let k=new ef(v,this.getTagDefinition,this.canSelfClose,this.allowHtmComponentClosingTags,this.isTagNameCaseSensitive);if(k.build(),k.errors.length>0)return this.errors=this.errors.concat(k.errors),null;let N=new se(p.sourceSpan.start,C.sourceSpan.end,p.sourceSpan.fullStart),M=new se(b.sourceSpan.start,C.sourceSpan.end,b.sourceSpan.fullStart);return new Hx(p.parts[0],k.rootNodes,N,p.sourceSpan,M)}_collectExpansionExpTokens(p){let b=[],v=[22];for(;;){if((this._peek.type===20||this._peek.type===22)&&v.push(this._peek.type),this._peek.type===23)if(kd(v,22)){if(v.pop(),v.length===0)return b}else return this.errors.push(Ke.create(null,p.sourceSpan,"Invalid ICU message. Missing '}'.")),null;if(this._peek.type===24)if(kd(v,20))v.pop();else return this.errors.push(Ke.create(null,p.sourceSpan,"Invalid ICU message. Missing '}'.")),null;if(this._peek.type===34)return this.errors.push(Ke.create(null,p.sourceSpan,"Invalid ICU message. Missing '}'.")),null;b.push(this._advance())}}_getText(p){let b=p.parts[0];if(b.length>0&&b[0]==`
26
+ `){let v=this._getClosestParentElement();v!=null&&v.children.length==0&&this.getTagDefinition(v.name).ignoreFirstLf&&(b=b.substring(1))}return b}_consumeText(p){let b=[p],v=p.sourceSpan,C=p.parts[0];if(C.length>0&&C[0]===`
27
+ `){let k=this._getContainer();k!=null&&k.children.length===0&&this.getTagDefinition(k.name).ignoreFirstLf&&(C=C.substring(1),b[0]={type:p.type,sourceSpan:p.sourceSpan,parts:[C]})}for(;this._peek.type===8||this._peek.type===5||this._peek.type===9;)p=this._advance(),b.push(p),p.type===8?C+=p.parts.join("").replace(/&([^;]+);/g,Ed):p.type===9?C+=p.parts[0]:C+=p.parts.join("");if(C.length>0){let k=p.sourceSpan;this._addToParent(new Px(C,new se(v.start,k.end,v.fullStart,v.details),b))}}_closeVoidElement(){let p=this._getContainer();p instanceof rr&&this.getTagDefinition(p.name).isVoid&&this._containerStack.pop()}_consumeStartTag(p){let[b,v]=p.parts,C=[];for(;this._peek.type===14;)C.push(this._consumeAttr(this._advance()));let k=this._getElementFullName(b,v,this._getClosestParentElement()),N=!1;if(this._peek.type===2){this._advance(),N=!0;let oe=this.getTagDefinition(k);this.canSelfClose||oe.canSelfClose||lo(k)!==null||oe.isVoid||this.errors.push(Ke.create(k,p.sourceSpan,`Only void, custom and foreign elements can be self closed "${p.parts[1]}"`))}else this._peek.type===1&&(this._advance(),N=!1);let M=this._peek.sourceSpan.fullStart,z=new se(p.sourceSpan.start,M,p.sourceSpan.fullStart),K=new se(p.sourceSpan.start,M,p.sourceSpan.fullStart),W=new se(p.sourceSpan.start.moveBy(1),p.sourceSpan.end),ae=new rr(k,C,[],z,K,void 0,W),te=this._getContainer();this._pushContainer(ae,te instanceof rr&&this.getTagDefinition(te.name).isClosedByChild(ae.name)),N?this._popContainer(k,rr,z):p.type===4&&(this._popContainer(k,rr,null),this.errors.push(Ke.create(k,z,`Opening tag "${k}" not terminated.`)))}_pushContainer(p,b){b&&this._containerStack.pop(),this._addToParent(p),this._containerStack.push(p)}_consumeEndTag(p){let b=this.allowHtmComponentClosingTags&&p.parts.length===0?null:this._getElementFullName(p.parts[0],p.parts[1],this._getClosestParentElement());if(b&&this.getTagDefinition(b).isVoid)this.errors.push(Ke.create(b,p.sourceSpan,`Void elements do not have end tags "${p.parts[1]}"`));else if(!this._popContainer(b,rr,p.sourceSpan)){let v=`Unexpected closing tag "${b}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;this.errors.push(Ke.create(b,p.sourceSpan,v))}}_popContainer(p,b,v){let C=!1;for(let k=this._containerStack.length-1;k>=0;k--){let N=this._containerStack[k];if(lo(N.name)?N.name===p:(p==null||N.name.toLowerCase()===p.toLowerCase())&&N instanceof b)return N.endSourceSpan=v,N.sourceSpan.end=v!==null?v.end:N.sourceSpan.end,this._containerStack.splice(k,this._containerStack.length-k),!C;(N instanceof hn||N instanceof rr&&!this.getTagDefinition(N.name).closedByParent)&&(C=!0)}return!1}_consumeAttr(p){let b=uo(p.parts[0],p.parts[1]),v=p.sourceSpan.end,C;this._peek.type===15&&(C=this._advance());let k="",N=[],M,z;if(this._peek.type===16)for(M=this._peek.sourceSpan,z=this._peek.sourceSpan.end;this._peek.type===16||this._peek.type===17||this._peek.type===9;){let W=this._advance();N.push(W),W.type===17?k+=W.parts.join("").replace(/&([^;]+);/g,Ed):W.type===9?k+=W.parts[0]:k+=W.parts.join(""),z=v=W.sourceSpan.end}this._peek.type===15&&(z=v=this._advance().sourceSpan.end);let K=M&&z&&new se(C?.sourceSpan.start??M.start,z,C?.sourceSpan.fullStart??M.fullStart);return new Vx(b,k,new se(p.sourceSpan.start,v,p.sourceSpan.fullStart),p.sourceSpan,K,N.length>0?N:void 0,void 0)}_consumeBlockOpen(p){let b=[];for(;this._peek.type===28;){let M=this._advance();b.push(new fd(M.parts[0],M.sourceSpan))}this._peek.type===26&&this._advance();let v=this._peek.sourceSpan.fullStart,C=new se(p.sourceSpan.start,v,p.sourceSpan.fullStart),k=new se(p.sourceSpan.start,v,p.sourceSpan.fullStart),N=new hn(p.parts[0],b,[],C,p.sourceSpan,k);this._pushContainer(N,!1)}_consumeBlockClose(p){this._popContainer(null,hn,p.sourceSpan)||this.errors.push(Ke.create(null,p.sourceSpan,'Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the "&#125;" HTML entity instead.'))}_consumeIncompleteBlock(p){let b=[];for(;this._peek.type===28;){let M=this._advance();b.push(new fd(M.parts[0],M.sourceSpan))}let v=this._peek.sourceSpan.fullStart,C=new se(p.sourceSpan.start,v,p.sourceSpan.fullStart),k=new se(p.sourceSpan.start,v,p.sourceSpan.fullStart),N=new hn(p.parts[0],b,[],C,p.sourceSpan,k);this._pushContainer(N,!1),this._popContainer(null,hn,null),this.errors.push(Ke.create(p.parts[0],C,`Incomplete block "${p.parts[0]}". If you meant to write the @ character, you should use the "&#64;" HTML entity instead.`))}_consumeLet(p){let b=p.parts[0],v,C;if(this._peek.type!==31){this.errors.push(Ke.create(p.parts[0],p.sourceSpan,`Invalid @let declaration "${b}". Declaration must have a value.`));return}else v=this._advance();if(this._peek.type!==32){this.errors.push(Ke.create(p.parts[0],p.sourceSpan,`Unterminated @let declaration "${b}". Declaration must be terminated with a semicolon.`));return}else C=this._advance();let k=C.sourceSpan.fullStart,N=new se(p.sourceSpan.start,k,p.sourceSpan.fullStart),M=p.sourceSpan.toString().lastIndexOf(b),z=p.sourceSpan.start.moveBy(M),K=new se(z,p.sourceSpan.end),W=new md(b,v.parts[0],N,K,v.sourceSpan);this._addToParent(W)}_consumeIncompleteLet(p){let b=p.parts[0]??"",v=b?` "${b}"`:"";if(b.length>0){let C=p.sourceSpan.toString().lastIndexOf(b),k=p.sourceSpan.start.moveBy(C),N=new se(k,p.sourceSpan.end),M=new se(p.sourceSpan.start,p.sourceSpan.start.moveBy(0)),z=new md(b,"",p.sourceSpan,N,M);this._addToParent(z)}this.errors.push(Ke.create(p.parts[0],p.sourceSpan,`Incomplete @let declaration${v}. @let declarations must be written as \`@let <name> = <value>;\``))}_getContainer(){return this._containerStack.length>0?this._containerStack[this._containerStack.length-1]:null}_getClosestParentElement(){for(let p=this._containerStack.length-1;p>-1;p--)if(this._containerStack[p]instanceof rr)return this._containerStack[p];return null}_addToParent(p){let b=this._getContainer();b===null?this.rootNodes.push(p):b.children.push(p)}_getElementFullName(p,b,v){if(p===""&&(p=this.getTagDefinition(b).implicitNamespacePrefix||"",p===""&&v!=null)){let C=ao(v.name)[1];this.getTagDefinition(C).preventNamespaceInheritance||(p=lo(v.name))}return uo(p,b)}};function kd(u,p){return u.length>0&&u[u.length-1]===p}function Ed(u,p){return ho[p]!==void 0?ho[p]||u:/^#x[a-f0-9]+$/i.test(p)?String.fromCodePoint(parseInt(p.slice(2),16)):/^#\d+$/.test(p)?String.fromCodePoint(parseInt(p.slice(1),10)):u}var p2=class extends c2{constructor(){super(ba)}parse(u,p,b,v=!1,C){return super.parse(u,p,b,v,C)}},wa=null,h2=()=>(wa||(wa=new p2),wa);function Sd(u,p={}){let{canSelfClose:b=!1,allowHtmComponentClosingTags:v=!1,isTagNameCaseSensitive:C=!1,getTagContentType:k,tokenizeAngularBlocks:N=!1,tokenizeAngularLetDeclaration:M=!1}=p;return h2().parse(u,"angular-html-parser",{tokenizeExpansionForms:N,interpolationConfig:void 0,canSelfClose:b,allowHtmComponentClosingTags:v,tokenizeBlocks:N,tokenizeLet:M},C,k)}function f2(u,p){let b=new SyntaxError(u+" ("+p.loc.start.line+":"+p.loc.start.column+")");return Object.assign(b,p)}var m2=f2,ns=3;function g2(u){let p=u.slice(0,ns);if(p!=="---"&&p!=="+++")return;let b=u.indexOf(`
28
+ `,ns);if(b===-1)return;let v=u.slice(ns,b).trim(),C=u.indexOf(`
29
+ ${p}`,b),k=v;if(k||(k=p==="+++"?"toml":"yaml"),C===-1&&p==="---"&&k==="yaml"&&(C=u.indexOf(`
30
+ ...`,b)),C===-1)return;let N=C+1+ns,M=u.charAt(N+1);if(!/\s?/u.test(M))return;let z=u.slice(0,N);return{type:"front-matter",language:k,explicitLanguage:v,value:u.slice(b+1,C),startDelimiter:p,endDelimiter:z.slice(-ns),raw:z}}function b2(u){let p=g2(u);if(!p)return{content:u};let{raw:b}=p;return{frontMatter:p,content:E(!1,b,/[^\n]/gu," ")+u.slice(b.length)}}var y2=b2,mo={attrs:!0,children:!0,cases:!0,expression:!0},Fd=new Set(["parent"]),mn,Da,Ca,x2=class ds{constructor(p={}){y(this,mn),f(this,"type"),f(this,"parent");for(let b of new Set([...Fd,...Object.keys(p)]))this.setProperty(b,p[b])}setProperty(p,b){if(this[p]!==b){if(p in mo&&(b=b.map(v=>this.createChild(v))),!Fd.has(p)){this[p]=b;return}Object.defineProperty(this,p,{value:b,enumerable:!1,configurable:!0})}}map(p){let b;for(let v in mo){let C=this[v];if(C){let k=w2(C,N=>N.map(p));b!==C&&(b||(b=new ds({parent:this.parent})),b.setProperty(v,k))}}if(b)for(let v in this)v in mo||(b[v]=this[v]);return p(b||this)}walk(p){for(let b in mo){let v=this[b];if(v)for(let C=0;C<v.length;C++)v[C].walk(p)}p(this)}createChild(p){let b=p instanceof ds?p.clone():new ds(p);return b.setProperty("parent",this),b}insertChildBefore(p,b){let v=this.$children;v.splice(v.indexOf(p),0,this.createChild(b))}removeChild(p){let b=this.$children;b.splice(b.indexOf(p),1)}replaceChild(p,b){let v=this.$children;v[v.indexOf(p)]=this.createChild(b)}clone(){return new ds(this)}get $children(){return this[g(this,mn,Da)]}set $children(p){this[g(this,mn,Da)]=p}get firstChild(){var p;return(p=this.$children)==null?void 0:p[0]}get lastChild(){return Vn(!0,this.$children,-1)}get prev(){let p=g(this,mn,Ca);return p[p.indexOf(this)-1]}get next(){let p=g(this,mn,Ca);return p[p.indexOf(this)+1]}get rawName(){return this.hasExplicitNamespace?this.fullName:this.name}get fullName(){return this.namespace?this.namespace+":"+this.name:this.name}get attrMap(){return Object.fromEntries(this.attrs.map(p=>[p.fullName,p.value]))}};mn=new WeakSet,Da=function(){return this.type==="angularIcuCase"?"expression":this.type==="angularIcuExpression"?"cases":"children"},Ca=function(){var u;return((u=this.parent)==null?void 0:u.$children)??[]};var v2=x2;function w2(u,p){let b=u.map(p);return b.some((v,C)=>v!==u[C])?b:u}var D2=[{regex:/^(\[if([^\]]*)\]>)(.*?)<!\s*\[endif\]$/su,parse:k2},{regex:/^\[if([^\]]*)\]><!$/u,parse:E2},{regex:/^<!\s*\[endif\]$/u,parse:S2}];function C2(u,p){if(u.value)for(let{regex:b,parse:v}of D2){let C=u.value.match(b);if(C)return v(u,p,C)}return null}function k2(u,p,b){let[,v,C,k]=b,N=4+v.length,M=u.sourceSpan.start.moveBy(N),z=M.moveBy(k.length),[K,W]=(()=>{try{return[!0,p(k,M).children]}catch{return[!1,[{type:"text",value:k,sourceSpan:new se(M,z)}]]}})();return{type:"ieConditionalComment",complete:K,children:W,condition:E(!1,C.trim(),/\s+/gu," "),sourceSpan:u.sourceSpan,startSourceSpan:new se(u.sourceSpan.start,M),endSourceSpan:new se(z,u.sourceSpan.end)}}function E2(u,p,b){let[,v]=b;return{type:"ieConditionalStartComment",condition:E(!1,v.trim(),/\s+/gu," "),sourceSpan:u.sourceSpan}}function S2(u){return{type:"ieConditionalEndComment",sourceSpan:u.sourceSpan}}var ka=new Map([["*",new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","popover","slot","spellcheck","style","tabindex","title","translate","writingsuggestions"])],["a",new Set(["charset","coords","download","href","hreflang","name","ping","referrerpolicy","rel","rev","shape","target","type"])],["applet",new Set(["align","alt","archive","code","codebase","height","hspace","name","object","vspace","width"])],["area",new Set(["alt","coords","download","href","hreflang","nohref","ping","referrerpolicy","rel","shape","target","type"])],["audio",new Set(["autoplay","controls","crossorigin","loop","muted","preload","src"])],["base",new Set(["href","target"])],["basefont",new Set(["color","face","size"])],["blockquote",new Set(["cite"])],["body",new Set(["alink","background","bgcolor","link","text","vlink"])],["br",new Set(["clear"])],["button",new Set(["disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","popovertarget","popovertargetaction","type","value"])],["canvas",new Set(["height","width"])],["caption",new Set(["align"])],["col",new Set(["align","char","charoff","span","valign","width"])],["colgroup",new Set(["align","char","charoff","span","valign","width"])],["data",new Set(["value"])],["del",new Set(["cite","datetime"])],["details",new Set(["name","open"])],["dialog",new Set(["open"])],["dir",new Set(["compact"])],["div",new Set(["align"])],["dl",new Set(["compact"])],["embed",new Set(["height","src","type","width"])],["fieldset",new Set(["disabled","form","name"])],["font",new Set(["color","face","size"])],["form",new Set(["accept","accept-charset","action","autocomplete","enctype","method","name","novalidate","target"])],["frame",new Set(["frameborder","longdesc","marginheight","marginwidth","name","noresize","scrolling","src"])],["frameset",new Set(["cols","rows"])],["h1",new Set(["align"])],["h2",new Set(["align"])],["h3",new Set(["align"])],["h4",new Set(["align"])],["h5",new Set(["align"])],["h6",new Set(["align"])],["head",new Set(["profile"])],["hr",new Set(["align","noshade","size","width"])],["html",new Set(["manifest","version"])],["iframe",new Set(["align","allow","allowfullscreen","allowpaymentrequest","allowusermedia","frameborder","height","loading","longdesc","marginheight","marginwidth","name","referrerpolicy","sandbox","scrolling","src","srcdoc","width"])],["img",new Set(["align","alt","border","crossorigin","decoding","fetchpriority","height","hspace","ismap","loading","longdesc","name","referrerpolicy","sizes","src","srcset","usemap","vspace","width"])],["input",new Set(["accept","align","alt","autocomplete","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","ismap","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","popovertarget","popovertargetaction","readonly","required","size","src","step","type","usemap","value","width"])],["ins",new Set(["cite","datetime"])],["isindex",new Set(["prompt"])],["label",new Set(["for","form"])],["legend",new Set(["align"])],["li",new Set(["type","value"])],["link",new Set(["as","blocking","charset","color","crossorigin","disabled","fetchpriority","href","hreflang","imagesizes","imagesrcset","integrity","media","referrerpolicy","rel","rev","sizes","target","type"])],["map",new Set(["name"])],["menu",new Set(["compact"])],["meta",new Set(["charset","content","http-equiv","media","name","scheme"])],["meter",new Set(["high","low","max","min","optimum","value"])],["object",new Set(["align","archive","border","classid","codebase","codetype","data","declare","form","height","hspace","name","standby","type","typemustmatch","usemap","vspace","width"])],["ol",new Set(["compact","reversed","start","type"])],["optgroup",new Set(["disabled","label"])],["option",new Set(["disabled","label","selected","value"])],["output",new Set(["for","form","name"])],["p",new Set(["align"])],["param",new Set(["name","type","value","valuetype"])],["pre",new Set(["width"])],["progress",new Set(["max","value"])],["q",new Set(["cite"])],["script",new Set(["async","blocking","charset","crossorigin","defer","fetchpriority","integrity","language","nomodule","referrerpolicy","src","type"])],["select",new Set(["autocomplete","disabled","form","multiple","name","required","size"])],["slot",new Set(["name"])],["source",new Set(["height","media","sizes","src","srcset","type","width"])],["style",new Set(["blocking","media","type"])],["table",new Set(["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"])],["tbody",new Set(["align","char","charoff","valign"])],["td",new Set(["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"])],["template",new Set(["shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode"])],["textarea",new Set(["autocomplete","cols","dirname","disabled","form","maxlength","minlength","name","placeholder","readonly","required","rows","wrap"])],["tfoot",new Set(["align","char","charoff","valign"])],["th",new Set(["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"])],["thead",new Set(["align","char","charoff","valign"])],["time",new Set(["datetime"])],["tr",new Set(["align","bgcolor","char","charoff","valign"])],["track",new Set(["default","kind","label","src","srclang"])],["ul",new Set(["compact","type"])],["video",new Set(["autoplay","controls","crossorigin","height","loop","muted","playsinline","poster","preload","src","width"])]]),F2=new Set(["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","math","menu","menuitem","meta","meter","multicol","nav","nextid","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rbc","rp","rt","rtc","ruby","s","samp","script","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"]);function A2(u){if(u.type==="block"){if(u.name=E(!1,u.name.toLowerCase(),/\s+/gu," ").trim(),u.type="angularControlFlowBlock",!ea(u.parameters)){delete u.parameters;return}for(let p of u.parameters)p.type="angularControlFlowBlockParameter";u.parameters={type:"angularControlFlowBlockParameters",children:u.parameters,sourceSpan:new se(u.parameters[0].sourceSpan.start,Vn(!1,u.parameters,-1).sourceSpan.end)}}}function N2(u){u.type==="letDeclaration"&&(u.type="angularLetDeclaration",u.id=u.name,u.init={type:"angularLetDeclarationInitializer",sourceSpan:new se(u.valueSpan.start,u.valueSpan.end),value:u.value},delete u.name,delete u.value)}function T2(u){(u.type==="plural"||u.type==="select")&&(u.clause=u.type,u.type="angularIcuExpression"),u.type==="expansionCase"&&(u.type="angularIcuCase")}function Ad(u,p,b){let{name:v,canSelfClose:C=!0,normalizeTagName:k=!1,normalizeAttributeName:N=!1,allowHtmComponentClosingTags:M=!1,isTagNameCaseSensitive:z=!1,shouldParseAsRawText:K}=p,{rootNodes:W,errors:ae}=Sd(u,{canSelfClose:C,allowHtmComponentClosingTags:M,isTagNameCaseSensitive:z,getTagContentType:K?(...U)=>K(...U)?xt.RAW_TEXT:void 0:void 0,tokenizeAngularBlocks:v==="angular"?!0:void 0,tokenizeAngularLetDeclaration:v==="angular"?!0:void 0});if(v==="vue"){if(W.some(De=>De.type==="docType"&&De.value==="html"||De.type==="element"&&De.name.toLowerCase()==="html"))return Ad(u,Ea,b);let U,ie=()=>U??(U=Sd(u,{canSelfClose:C,allowHtmComponentClosingTags:M,isTagNameCaseSensitive:z})),Fe=De=>ie().rootNodes.find(({startSourceSpan:Je})=>Je&&Je.start.offset===De.startSourceSpan.start.offset)??De;for(let[De,Je]of W.entries()){let{endSourceSpan:gn,startSourceSpan:P2}=Je;if(gn===null)ae=ie().errors,W[De]=Fe(Je);else if(M2(Je,b)){let Md=ie().errors.find(Bd=>Bd.span.start.offset>P2.start.offset&&Bd.span.start.offset<gn.end.offset);Md&&Nd(Md),W[De]=Fe(Je)}}}ae.length>0&&Nd(ae[0]);let te=U=>{let ie=U.name.startsWith(":")?U.name.slice(1).split(":")[0]:null,Fe=U.nameSpan.toString(),De=ie!==null&&Fe.startsWith(`${ie}:`),Je=De?Fe.slice(ie.length+1):Fe;U.name=Je,U.namespace=ie,U.hasExplicitNamespace=De},oe=U=>{switch(U.type){case"element":te(U);for(let ie of U.attrs)te(ie),ie.valueSpan?(ie.value=ie.valueSpan.toString(),/["']/u.test(ie.value[0])&&(ie.value=ie.value.slice(1,-1))):ie.value=null;break;case"comment":U.value=U.sourceSpan.toString().slice(4,-3);break;case"text":U.value=U.sourceSpan.toString();break}},ce=(U,ie)=>{let Fe=U.toLowerCase();return ie(Fe)?Fe:U},Se=U=>{if(U.type==="element"&&(k&&(!U.namespace||U.namespace===U.tagDefinition.implicitNamespacePrefix||Wn(U))&&(U.name=ce(U.name,ie=>F2.has(ie))),N))for(let ie of U.attrs)ie.namespace||(ie.name=ce(ie.name,Fe=>ka.has(U.name)&&(ka.get("*").has(Fe)||ka.get(U.name).has(Fe))))},Le=U=>{U.sourceSpan&&U.endSourceSpan&&(U.sourceSpan=new se(U.sourceSpan.start,U.endSourceSpan.end))},Ve=U=>{if(U.type==="element"){let ie=ba(z?U.name:U.name.toLowerCase());!U.namespace||U.namespace===ie.implicitNamespacePrefix||Wn(U)?U.tagDefinition=ie:U.tagDefinition=ba("")}};return gd(new class extends Ux{visitExpansionCase(U,ie){v==="angular"&&this.visitChildren(ie,Fe=>{Fe(U.expression)})}visit(U){oe(U),Ve(U),Se(U),Le(U)}},W),W}function M2(u,p){var b;if(u.type!=="element"||u.name!=="template")return!1;let v=(b=u.attrs.find(C=>C.name==="lang"))==null?void 0:b.value;return!v||Ys(p,{language:v})==="html"}function Nd(u){let{msg:p,span:{start:b,end:v}}=u;throw m2(p,{loc:{start:{line:b.line+1,column:b.col+1},end:{line:v.line+1,column:v.col+1}},cause:u})}function Td(u,p,b={},v=!0){let{frontMatter:C,content:k}=v?y2(u):{frontMatter:null,content:u},N=new Xc(u,b.filepath),M=new ga(N,0,0,0),z=M.moveBy(u.length),K={type:"root",sourceSpan:new se(M,z),children:Ad(k,p,b)};if(C){let te=new ga(N,0,0,0),oe=te.moveBy(C.raw.length);C.sourceSpan=new se(te,oe),K.children.unshift(C)}let W=new v2(K),ae=(te,oe)=>{let{offset:ce}=oe,Se=E(!1,u.slice(0,ce),/[^\n\r]/gu," "),Le=Td(Se+te,p,b,!1);Le.sourceSpan=new se(oe,Vn(!1,Le.children,-1).sourceSpan.end);let Ve=Le.children[0];return Ve.length===ce?Le.children.shift():(Ve.sourceSpan=new se(Ve.sourceSpan.start.moveBy(ce),Ve.sourceSpan.end),Ve.value=Ve.value.slice(ce)),Le};return W.walk(te=>{if(te.type==="comment"){let oe=C2(te,ae);oe&&te.parent.replaceChild(te,oe)}A2(te),N2(te),T2(te)}),W}function ss(u){return{parse:(p,b)=>Td(p,u,b),hasPragma:Zy,hasIgnorePragma:Xy,astFormat:"html",locStart:Kn,locEnd:eo}}var Ea={name:"html",normalizeTagName:!0,normalizeAttributeName:!0,allowHtmComponentClosingTags:!0},B2=ss(Ea),j2=new Set(["mj-style","mj-raw"]),O2=ss({...Ea,name:"mjml",shouldParseAsRawText:u=>j2.has(u)}),L2=ss({name:"angular"}),_2=ss({name:"vue",isTagNameCaseSensitive:!0,shouldParseAsRawText(u,p,b,v){return u.toLowerCase()!=="html"&&!b&&(u!=="template"||v.some(({name:C,value:k})=>C==="lang"&&k!=="html"&&k!==""&&k!==void 0))}}),I2=ss({name:"lwc",canSelfClose:!1}),R2={html:Sx};return d(w)})})(Yh);var tf=Yh.exports;const x1=Gh(tf),v1=K2({__proto__:null,default:x1},[tf]);var w1=Object.create,nu=Object.defineProperty,D1=Object.getOwnPropertyDescriptor,C1=Object.getOwnPropertyNames,k1=Object.getPrototypeOf,E1=Object.prototype.hasOwnProperty,rf=t=>{throw TypeError(t)},S1=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),su=(t,e)=>{for(var r in e)nu(t,r,{get:e[r],enumerable:!0})},F1=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of C1(e))!E1.call(t,s)&&s!==r&&nu(t,s,{get:()=>e[s],enumerable:!(n=D1(e,s))||n.enumerable});return t},A1=(t,e,r)=>(r=t!=null?w1(k1(t)):{},F1(nu(r,"default",{value:t,enumerable:!0}),t)),N1=(t,e,r)=>e.has(t)||rf("Cannot "+r),T1=(t,e,r)=>e.has(t)?rf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),as=(t,e,r)=>(N1(t,e,"access private method"),r),M1=S1(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(){return new Proxy({},{get:()=>o=>o})}var r=/\r\n|[\n\r\u2028\u2029]/;function n(o,i,a){let l=Object.assign({column:0,line:-1},o.start),c=Object.assign({},l,o.end),{linesAbove:d=2,linesBelow:f=3}=a||{},m=l.line,g=l.column,y=c.line,x=c.column,w=Math.max(m-(d+1),0),D=Math.min(i.length,y+f);m===-1&&(w=0),y===-1&&(D=i.length);let E=y-m,S={};if(E)for(let A=0;A<=E;A++){let T=A+m;if(!g)S[T]=!0;else if(A===0){let j=i[T-1].length;S[T]=[g,j-g+1]}else if(A===E)S[T]=[0,x];else{let j=i[T-A].length;S[T]=[0,j]}}else g===x?g?S[m]=[g,0]:S[m]=!0:S[m]=[g,x-g];return{start:w,end:D,markerLines:S}}function s(o,i,a={}){let l=e(),c=o.split(r),{start:d,end:f,markerLines:m}=n(i,c,a),g=i.start&&typeof i.start.column=="number",y=String(f).length,x=o.split(r,f).slice(d,f).map((w,D)=>{let E=d+1+D,S=` ${` ${E}`.slice(-y)} |`,A=m[E],T=!m[E+1];if(A){let j="";if(Array.isArray(A)){let B=w.slice(0,Math.max(A[0]-1,0)).replace(/[^\t]/g," "),$=A[1]||1;j=[`
31
+ `,l.gutter(S.replace(/\d/g," "))," ",B,l.marker("^").repeat($)].join(""),T&&a.message&&(j+=" "+l.message(a.message))}return[l.marker(">"),l.gutter(S),w.length>0?` ${w}`:"",j].join("")}else return` ${l.gutter(S)}${w.length>0?` ${w}`:""}`}).join(`
32
+ `);return a.message&&!g&&(x=`${" ".repeat(y+1)}${a.message}
33
+ ${x}`),x}t.codeFrameColumns=s}),B1={};su(B1,{__debug:()=>WD,check:()=>VD,doc:()=>zf,format:()=>xu,formatWithCursor:()=>Hf,getSupportInfo:()=>qD,util:()=>$f,version:()=>bD});var j1=(t,e,r,n)=>{if(!(t&&e==null))return e.replaceAll?e.replaceAll(r,n):r.global?e.replace(r,n):e.split(r).join(n)},Mi=j1,O1=class{diff(t,e,r={}){let n;typeof r=="function"?(n=r,r={}):"callback"in r&&(n=r.callback);let s=this.castInput(t,r),o=this.castInput(e,r),i=this.removeEmpty(this.tokenize(s,r)),a=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(i,a,r,n)}diffWithOptionsObj(t,e,r,n){var s;let o=D=>{if(D=this.postProcess(D,r),n){setTimeout(function(){n(D)},0);return}else return D},i=e.length,a=t.length,l=1,c=i+a;r.maxEditLength!=null&&(c=Math.min(c,r.maxEditLength));let d=(s=r.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+d,m=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(m[0],e,t,0,r);if(m[0].oldPos+1>=a&&g+1>=i)return o(this.buildValues(m[0].lastComponent,e,t));let y=-1/0,x=1/0,w=()=>{for(let D=Math.max(y,-l);D<=Math.min(x,l);D+=2){let E,S=m[D-1],A=m[D+1];S&&(m[D-1]=void 0);let T=!1;if(A){let B=A.oldPos-D;T=A&&0<=B&&B<i}let j=S&&S.oldPos+1<a;if(!T&&!j){m[D]=void 0;continue}if(!j||T&&S.oldPos<A.oldPos?E=this.addToPath(A,!0,!1,0,r):E=this.addToPath(S,!1,!0,1,r),g=this.extractCommon(E,e,t,D,r),E.oldPos+1>=a&&g+1>=i)return o(this.buildValues(E.lastComponent,e,t))||!0;m[D]=E,E.oldPos+1>=a&&(x=Math.min(x,D-1)),g+1>=i&&(y=Math.max(y,D+1))}l++};if(n)(function D(){setTimeout(function(){if(l>c||Date.now()>f)return n(void 0);w()||D()},0)})();else for(;l<=c&&Date.now()<=f;){let D=w();if(D)return D}}addToPath(t,e,r,n,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===e&&o.removed===r?{oldPos:t.oldPos+n,lastComponent:{count:o.count+1,added:e,removed:r,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+n,lastComponent:{count:1,added:e,removed:r,previousComponent:o}}}extractCommon(t,e,r,n,s){let o=e.length,i=r.length,a=t.oldPos,l=a-n,c=0;for(;l+1<o&&a+1<i&&this.equals(r[a+1],e[l+1],s);)l++,a++,c++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return c&&!s.oneChangePerToken&&(t.lastComponent={count:c,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,l}equals(t,e,r){return r.comparator?r.comparator(t,e):t===e||!!r.ignoreCase&&t.toLowerCase()===e.toLowerCase()}removeEmpty(t){let e=[];for(let r=0;r<t.length;r++)t[r]&&e.push(t[r]);return e}castInput(t,e){return t}tokenize(t,e){return Array.from(t)}join(t){return t.join("")}postProcess(t,e){return t}get useLongestToken(){return!1}buildValues(t,e,r){let n=[],s;for(;t;)n.push(t),s=t.previousComponent,delete t.previousComponent,t=s;n.reverse();let o=n.length,i=0,a=0,l=0;for(;i<o;i++){let c=n[i];if(c.removed)c.value=this.join(r.slice(l,l+c.count)),l+=c.count;else{if(!c.added&&this.useLongestToken){let d=e.slice(a,a+c.count);d=d.map(function(f,m){let g=r[l+m];return g.length>f.length?g:f}),c.value=this.join(d)}else c.value=this.join(e.slice(a,a+c.count));a+=c.count,c.added||(l+=c.count)}}return n}},L1=class extends O1{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},_1=new L1;function I1(t,e,r){return _1.diff(t,e,r)}function R1(t){let e=t.indexOf("\r");return e!==-1?t.charAt(e+1)===`
34
+ `?"crlf":"cr":"lf"}function ou(t){switch(t){case"cr":return"\r";case"crlf":return`\r
47
35
  `;default:return`
48
- `}}function rf(t,e){let r;switch(e){case`
36
+ `}}function nf(t,e){let r;switch(e){case`
49
37
  `:r=/\n/gu;break;case"\r":r=/\r/gu;break;case`\r
50
- `:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(e)}.`)}let n=t.match(r);return n?n.length:0}function _1(t){return Ai(!1,t,/\r\n?/gu,`
51
- `)}var nn="string",Kt="array",kr="cursor",Gt="indent",Yt="align",Xt="trim",et="group",Ot="fill",nt="if-break",Qt="indent-if-break",Zt="line-suffix",er="line-suffix-boundary",Pe="line",Lt="label",ft="break-parent",nf=new Set([kr,Gt,Yt,Xt,et,Ot,nt,Qt,Zt,er,Pe,Lt,ft]),I1=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},Ae=I1;function R1(t){let e=t.length;for(;e>0&&(t[e-1]==="\r"||t[e-1]===`
52
- `);)e--;return e<t.length?t.slice(0,e):t}function P1(t){if(typeof t=="string")return nn;if(Array.isArray(t))return Kt;if(!t)return;let{type:e}=t;if(nf.has(e))return e}var sn=P1,z1=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function $1(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
53
- Expected it to be 'string' or 'object'.`;if(sn(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=z1([...nf].map(s=>`'${s}'`));return`Unexpected doc.type '${t.type}'.
54
- Expected it to be ${n}.`}var H1=class extends Error{constructor(e){super($1(e));Et(this,"name","InvalidDocError");this.doc=e}},Fn=H1,Td={};function V1(t,e,r,n){let s=[t];for(;s.length>0;){let o=s.pop();if(o===Td){r(s.pop());continue}r&&s.push(o,Td);let i=sn(o);if(!i)throw new Fn(o);if(e?.(o)!==!1)switch(i){case Kt:case Ot:{let a=i===Kt?o:o.parts;for(let l=a.length,c=l-1;c>=0;--c)s.push(a[c]);break}case nt:s.push(o.flatContents,o.breakContents);break;case et:if(n&&o.expandedStates)for(let a=o.expandedStates.length,l=a-1;l>=0;--l)s.push(o.expandedStates[l]);else s.push(o.contents);break;case Yt:case Gt:case Qt:case Lt:case Zt:s.push(o.contents);break;case nn:case kr:case Xt:case er:case Pe:case ft:break;default:throw new Fn(o)}}}var nu=V1;function Ni(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(o){if(r.has(o))return r.get(o);let i=s(o);return r.set(o,i),i}function s(o){switch(sn(o)){case Kt:return e(o.map(n));case Ot:return e({...o,parts:o.parts.map(n)});case nt:return e({...o,breakContents:n(o.breakContents),flatContents:n(o.flatContents)});case et:{let{expandedStates:i,contents:a}=o;return i?(i=i.map(n),a=i[0]):a=n(a),e({...o,contents:a,expandedStates:i})}case Yt:case Gt:case Qt:case Lt:case Zt:return e({...o,contents:n(o.contents)});case nn:case kr:case Xt:case er:case Pe:case ft:return e(o);default:throw new Fn(o)}}}function su(t,e,r){let n=r,s=!1;function o(i){if(s)return!1;let a=e(i);a!==void 0&&(s=!0,n=a)}return nu(t,o),n}function q1(t){if(t.type===et&&t.break||t.type===Pe&&t.hard||t.type===ft)return!0}function W1(t){return su(t,q1,!1)}function Md(t){if(t.length>0){let e=Ae(!1,t,-1);!e.expandedStates&&!e.break&&(e.break="propagated")}return null}function U1(t){let e=new Set,r=[];function n(o){if(o.type===ft&&Md(r),o.type===et){if(r.push(o),e.has(o))return!1;e.add(o)}}function s(o){o.type===et&&r.pop().break&&Md(r)}nu(t,n,s,!0)}function J1(t){return t.type===Pe&&!t.hard?t.soft?"":" ":t.type===nt?t.flatContents:t}function K1(t){return Ni(t,J1)}function Bd(t){for(t=[...t];t.length>=2&&Ae(!1,t,-2).type===Pe&&Ae(!1,t,-1).type===ft;)t.length-=2;if(t.length>0){let e=fs(Ae(!1,t,-1));t[t.length-1]=e}return t}function fs(t){switch(sn(t)){case Gt:case Qt:case et:case Zt:case Lt:{let e=fs(t.contents);return{...t,contents:e}}case nt:return{...t,breakContents:fs(t.breakContents),flatContents:fs(t.flatContents)};case Ot:return{...t,parts:Bd(t.parts)};case Kt:return Bd(t);case nn:return R1(t);case Yt:case kr:case Xt:case er:case Pe:case ft:break;default:throw new Fn(t)}return t}function sf(t){return fs(Y1(t))}function G1(t){switch(sn(t)){case Ot:if(t.parts.every(e=>e===""))return"";break;case et:if(!t.contents&&!t.id&&!t.break&&!t.expandedStates)return"";if(t.contents.type===et&&t.contents.id===t.id&&t.contents.break===t.break&&t.contents.expandedStates===t.expandedStates)return t.contents;break;case Yt:case Gt:case Qt:case Zt:if(!t.contents)return"";break;case nt:if(!t.flatContents&&!t.breakContents)return"";break;case Kt:{let e=[];for(let r of t){if(!r)continue;let[n,...s]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof Ae(!1,e,-1)=="string"?e[e.length-1]+=n:e.push(n),e.push(...s)}return e.length===0?"":e.length===1?e[0]:e}case nn:case kr:case Xt:case er:case Pe:case Lt:case ft:break;default:throw new Fn(t)}return t}function Y1(t){return Ni(t,e=>G1(e))}function X1(t,e=uf){return Ni(t,r=>typeof r=="string"?cf(e,r.split(`
55
- `)):r)}function Q1(t){if(t.type===Pe)return!0}function Z1(t){return su(t,Q1,!1)}function Ao(t,e){return t.type===Lt?{...t,contents:e(t.contents)}:e(t)}var ev=()=>{},tv=ev;function _o(t){return{type:Gt,contents:t}}function An(t,e){return{type:Yt,contents:e,n:t}}function of(t,e={}){return tv(e.expandedStates),{type:et,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function rv(t){return An(Number.NEGATIVE_INFINITY,t)}function nv(t){return An({type:"root"},t)}function sv(t){return An(-1,t)}function ov(t,e){return of(t[0],{...e,expandedStates:t})}function iv(t){return{type:Ot,parts:t}}function av(t,e="",r={}){return{type:nt,breakContents:t,flatContents:e,groupId:r.groupId}}function lv(t,e){return{type:Qt,contents:t,groupId:e.groupId,negate:e.negate}}function ul(t){return{type:Zt,contents:t}}var uv={type:er},Ti={type:ft},cv={type:Xt},ou={type:Pe,hard:!0},af={type:Pe,hard:!0,literal:!0},lf={type:Pe},dv={type:Pe,soft:!0},Wr=[ou,Ti],uf=[af,Ti],zr={type:kr};function cf(t,e){let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}function df(t,e,r){let n=t;if(e>0){for(let s=0;s<Math.floor(e/r);++s)n=_o(n);n=An(e%r,n),n=An(Number.NEGATIVE_INFINITY,n)}return n}function pv(t,e){return t?{type:Lt,label:t,contents:e}:e}function Ht(t){var e;if(!t)return"";if(Array.isArray(t)){let r=[];for(let n of t)if(Array.isArray(n))r.push(...Ht(n));else{let s=Ht(n);s!==""&&r.push(s)}return r}return t.type===nt?{...t,breakContents:Ht(t.breakContents),flatContents:Ht(t.flatContents)}:t.type===et?{...t,contents:Ht(t.contents),expandedStates:(e=t.expandedStates)==null?void 0:e.map(Ht)}:t.type===Ot?{type:"fill",parts:t.parts.map(Ht)}:t.contents?{...t,contents:Ht(t.contents)}:t}function hv(t){let e=Object.create(null),r=new Set;return n(Ht(t));function n(o,i,a){var l,c;if(typeof o=="string")return JSON.stringify(o);if(Array.isArray(o)){let d=o.map(n).filter(Boolean);return d.length===1?d[0]:`[${d.join(", ")}]`}if(o.type===Pe){let d=((l=a?.[i+1])==null?void 0:l.type)===ft;return o.literal?d?"literalline":"literallineWithoutBreakParent":o.hard?d?"hardline":"hardlineWithoutBreakParent":o.soft?"softline":"line"}if(o.type===ft)return((c=a?.[i-1])==null?void 0:c.type)===Pe&&a[i-1].hard?void 0:"breakParent";if(o.type===Xt)return"trim";if(o.type===Gt)return"indent("+n(o.contents)+")";if(o.type===Yt)return o.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(o.contents)+")":o.n<0?"dedent("+n(o.contents)+")":o.n.type==="root"?"markAsRoot("+n(o.contents)+")":"align("+JSON.stringify(o.n)+", "+n(o.contents)+")";if(o.type===nt)return"ifBreak("+n(o.breakContents)+(o.flatContents?", "+n(o.flatContents):"")+(o.groupId?(o.flatContents?"":', ""')+`, { groupId: ${s(o.groupId)} }`:"")+")";if(o.type===Qt){let d=[];o.negate&&d.push("negate: true"),o.groupId&&d.push(`groupId: ${s(o.groupId)}`);let f=d.length>0?`, { ${d.join(", ")} }`:"";return`indentIfBreak(${n(o.contents)}${f})`}if(o.type===et){let d=[];o.break&&o.break!=="propagated"&&d.push("shouldBreak: true"),o.id&&d.push(`id: ${s(o.id)}`);let f=d.length>0?`, { ${d.join(", ")} }`:"";return o.expandedStates?`conditionalGroup([${o.expandedStates.map(m=>n(m)).join(",")}]${f})`:`group(${n(o.contents)}${f})`}if(o.type===Ot)return`fill([${o.parts.map(d=>n(d)).join(", ")}])`;if(o.type===Zt)return"lineSuffix("+n(o.contents)+")";if(o.type===er)return"lineSuffixBoundary";if(o.type===Lt)return`label(${JSON.stringify(o.label)}, ${n(o.contents)})`;if(o.type===kr)return"cursor";throw new Error("Unknown doc type "+o.type)}function s(o){if(typeof o!="symbol")return JSON.stringify(String(o));if(o in e)return e[o];let i=o.description||"symbol";for(let a=0;;a++){let l=i+(a>0?` #${a}`:"");if(!r.has(l))return r.add(l),e[o]=`Symbol.for(${JSON.stringify(l)})`}}}var fv=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function mv(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function gv(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101631&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129673||t>=129679&&t<=129734||t>=129742&&t<=129756||t>=129759&&t<=129769||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}var bv=t=>!(mv(t)||gv(t)),yv=/[^\x20-\x7F]/u;function xv(t){if(!t)return 0;if(!yv.test(t))return t.length;t=t.replace(fv()," ");let e=0;for(let r of t){let n=r.codePointAt(0);n<=31||n>=127&&n<=159||n>=768&&n<=879||(e+=bv(n)?1:2)}return e}var iu=xv,Xe=Symbol("MODE_BREAK"),St=Symbol("MODE_FLAT"),Dn=Symbol("cursor"),cl=Symbol("DOC_FILL_PRINTED_LENGTH");function pf(){return{value:"",length:0,queue:[]}}function vv(t,e){return dl(t,{type:"indent"},e)}function wv(t,e,r){return e===Number.NEGATIVE_INFINITY?t.root||pf():e<0?dl(t,{type:"dedent"},r):e?e.type==="root"?{...t,root:t}:dl(t,{type:typeof e=="string"?"stringAlign":"numberAlign",n:e},r):t}function dl(t,e,r){let n=e.type==="dedent"?t.queue.slice(0,-1):[...t.queue,e],s="",o=0,i=0,a=0;for(let y of n)switch(y.type){case"indent":d(),r.useTabs?l(1):c(r.tabWidth);break;case"stringAlign":d(),s+=y.n,o+=y.n.length;break;case"numberAlign":i+=1,a+=y.n;break;default:throw new Error(`Unexpected type '${y.type}'`)}return m(),{...t,value:s,length:o,queue:n};function l(y){s+=" ".repeat(y),o+=r.tabWidth*y}function c(y){s+=" ".repeat(y),o+=y}function d(){r.useTabs?f():m()}function f(){i>0&&l(i),g()}function m(){a>0&&c(a),g()}function g(){i=0,a=0}}function pl(t){let e=0,r=0,n=t.length;e:for(;n--;){let s=t[n];if(s===Dn){r++;continue}for(let o=s.length-1;o>=0;o--){let i=s[o];if(i===" "||i===" ")e++;else{t[n]=s.slice(0,o+1);break e}}}if(e>0||r>0)for(t.length=n+1;r-- >0;)t.push(Dn);return e}function mo(t,e,r,n,s,o){if(r===Number.POSITIVE_INFINITY)return!0;let i=e.length,a=[t],l=[];for(;r>=0;){if(a.length===0){if(i===0)return!0;a.push(e[--i]);continue}let{mode:c,doc:d}=a.pop(),f=sn(d);switch(f){case nn:l.push(d),r-=iu(d);break;case Kt:case Ot:{let m=f===Kt?d:d.parts,g=d[cl]??0;for(let y=m.length-1;y>=g;y--)a.push({mode:c,doc:m[y]});break}case Gt:case Yt:case Qt:case Lt:a.push({mode:c,doc:d.contents});break;case Xt:r+=pl(l);break;case et:{if(o&&d.break)return!1;let m=d.break?Xe:c,g=d.expandedStates&&m===Xe?Ae(!1,d.expandedStates,-1):d.contents;a.push({mode:m,doc:g});break}case nt:{let m=(d.groupId?s[d.groupId]||St:c)===Xe?d.breakContents:d.flatContents;m&&a.push({mode:c,doc:m});break}case Pe:if(c===Xe||d.hard)return!0;d.soft||(l.push(" "),r--);break;case Zt:n=!0;break;case er:if(n)return!1;break}}return!1}function Mi(t,e){let r={},n=e.printWidth,s=ru(e.endOfLine),o=0,i=[{ind:pf(),mode:Xe,doc:t}],a=[],l=!1,c=[],d=0;for(U1(t);i.length>0;){let{ind:m,mode:g,doc:y}=i.pop();switch(sn(y)){case nn:{let v=s!==`
56
- `?Ai(!1,y,`
57
- `,s):y;a.push(v),i.length>0&&(o+=iu(v));break}case Kt:for(let v=y.length-1;v>=0;v--)i.push({ind:m,mode:g,doc:y[v]});break;case kr:if(d>=2)throw new Error("There are too many 'cursor' in doc.");a.push(Dn),d++;break;case Gt:i.push({ind:vv(m,e),mode:g,doc:y.contents});break;case Yt:i.push({ind:wv(m,y.n,e),mode:g,doc:y.contents});break;case Xt:o-=pl(a);break;case et:switch(g){case St:if(!l){i.push({ind:m,mode:y.break?Xe:St,doc:y.contents});break}case Xe:{l=!1;let v={ind:m,mode:St,doc:y.contents},w=n-o,D=c.length>0;if(!y.break&&mo(v,i,w,D,r))i.push(v);else if(y.expandedStates){let E=Ae(!1,y.expandedStates,-1);if(y.break){i.push({ind:m,mode:Xe,doc:E});break}else for(let N=1;N<y.expandedStates.length+1;N++)if(N>=y.expandedStates.length){i.push({ind:m,mode:Xe,doc:E});break}else{let A=y.expandedStates[N],T={ind:m,mode:St,doc:A};if(mo(T,i,w,D,r)){i.push(T);break}}}else i.push({ind:m,mode:Xe,doc:y.contents});break}}y.id&&(r[y.id]=Ae(!1,i,-1).mode);break;case Ot:{let v=n-o,w=y[cl]??0,{parts:D}=y,E=D.length-w;if(E===0)break;let N=D[w+0],A=D[w+1],T={ind:m,mode:St,doc:N},j={ind:m,mode:Xe,doc:N},B=mo(T,[],v,c.length>0,r,!0);if(E===1){B?i.push(T):i.push(j);break}let $={ind:m,mode:St,doc:A},O={ind:m,mode:Xe,doc:A};if(E===2){B?i.push($,T):i.push(O,j);break}let z=D[w+2],I={ind:m,mode:g,doc:{...y,[cl]:w+2}};mo({ind:m,mode:St,doc:[N,A,z]},[],v,c.length>0,r,!0)?i.push(I,$,T):B?i.push(I,O,T):i.push(I,O,j);break}case nt:case Qt:{let v=y.groupId?r[y.groupId]:g;if(v===Xe){let w=y.type===nt?y.breakContents:y.negate?y.contents:_o(y.contents);w&&i.push({ind:m,mode:g,doc:w})}if(v===St){let w=y.type===nt?y.flatContents:y.negate?_o(y.contents):y.contents;w&&i.push({ind:m,mode:g,doc:w})}break}case Zt:c.push({ind:m,mode:g,doc:y.contents});break;case er:c.length>0&&i.push({ind:m,mode:g,doc:ou});break;case Pe:switch(g){case St:if(y.hard)l=!0;else{y.soft||(a.push(" "),o+=1);break}case Xe:if(c.length>0){i.push({ind:m,mode:g,doc:y},...c.reverse()),c.length=0;break}y.literal?m.root?(a.push(s,m.root.value),o=m.root.length):(a.push(s),o=0):(o-=pl(a),a.push(s+m.value),o=m.length);break}break;case Lt:i.push({ind:m,mode:g,doc:y.contents});break;case ft:break;default:throw new Fn(y)}i.length===0&&c.length>0&&(i.push(...c.reverse()),c.length=0)}let f=a.indexOf(Dn);if(f!==-1){let m=a.indexOf(Dn,f+1);if(m===-1)return{formatted:a.filter(w=>w!==Dn).join("")};let g=a.slice(0,f).join(""),y=a.slice(f+1,m).join(""),v=a.slice(m+1).join("");return{formatted:g+y+v,cursorNodeStart:g.length,cursorNodeText:y}}return{formatted:a.join("")}}function Dv(t,e,r=0){let n=0;for(let s=r;s<t.length;++s)t[s]===" "?n=n+e-n%e:n++;return n}var au=Dv,Lr,hl,No,Cv=class{constructor(t){F1(this,Lr),this.stack=[t]}get key(){let{stack:t,siblings:e}=this;return Ae(!1,t,e===null?-2:-4)??null}get index(){return this.siblings===null?null:Ae(!1,this.stack,-2)}get node(){return Ae(!1,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:t}=this,e=Ae(!1,t,-3);return Array.isArray(e)?e:null}get next(){let{siblings:t}=this;return t===null?null:t[this.index+1]}get previous(){let{siblings:t}=this;return t===null?null:t[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:t,index:e}=this;return t!==null&&e===t.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...ss(this,Lr,No).call(this)]}getName(){let{stack:t}=this,{length:e}=t;return e>1?Ae(!1,t,-2):null}getValue(){return Ae(!1,this.stack,-1)}getNode(t=0){let e=ss(this,Lr,hl).call(this,t);return e===-1?null:this.stack[e]}getParentNode(t=0){return this.getNode(t+1)}call(t,...e){let{stack:r}=this,{length:n}=r,s=Ae(!1,r,-1);for(let o of e)s=s[o],r.push(o,s);try{return t(this)}finally{r.length=n}}callParent(t,e=0){let r=ss(this,Lr,hl).call(this,e+1),n=this.stack.splice(r+1);try{return t(this)}finally{this.stack.push(...n)}}each(t,...e){let{stack:r}=this,{length:n}=r,s=Ae(!1,r,-1);for(let o of e)s=s[o],r.push(o,s);try{for(let o=0;o<s.length;++o)r.push(o,s[o]),t(this,o,s),r.length-=2}finally{r.length=n}}map(t,...e){let r=[];return this.each((n,s,o)=>{r[s]=t(n,s,o)},...e),r}match(...t){let e=this.stack.length-1,r=null,n=this.stack[e--];for(let s of t){if(n===void 0)return!1;let o=null;if(typeof r=="number"&&(o=r,r=this.stack[e--],n=this.stack[e--]),s&&!s(n,r,o))return!1;r=this.stack[e--],n=this.stack[e--]}return!0}findAncestor(t){for(let e of ss(this,Lr,No).call(this))if(t(e))return e}hasAncestor(t){for(let e of ss(this,Lr,No).call(this))if(t(e))return!0;return!1}};Lr=new WeakSet,hl=function(t){let{stack:e}=this;for(let r=e.length-1;r>=0;r-=2)if(!Array.isArray(e[r])&&--t<0)return r;return-1},No=function*(){let{stack:t}=this;for(let e=t.length-3;e>=0;e-=2){let r=t[e];Array.isArray(r)||(yield r)}};var kv=Cv,hf=new Proxy(()=>{},{get:()=>hf}),fl=hf;function Ev(t){return t!==null&&typeof t=="object"}var Sv=Ev;function*Bi(t,e){let{getVisitorKeys:r,filter:n=()=>!0}=e,s=o=>Sv(o)&&n(o);for(let o of r(t)){let i=t[o];if(Array.isArray(i))for(let a of i)s(a)&&(yield a);else s(i)&&(yield i)}}function*Fv(t,e){let r=[t];for(let n=0;n<r.length;n++){let s=r[n];for(let o of Bi(s,e))yield o,r.push(o)}}function Av(t,e){return Bi(t,e).next().done}function Ps(t){return(e,r,n)=>{let s=!!(n!=null&&n.backwards);if(r===!1)return!1;let{length:o}=e,i=r;for(;i>=0&&i<o;){let a=e.charAt(i);if(t instanceof RegExp){if(!t.test(a))return i}else if(!t.includes(a))return i;s?i--:i++}return i===-1||i===o?i:!1}}var Nv=Ps(/\s/u),wr=Ps(" "),ff=Ps(",; "),mf=Ps(/[^\n\r]/u);function Tv(t,e,r){let n=!!(r!=null&&r.backwards);if(e===!1)return!1;let s=t.charAt(e);if(n){if(t.charAt(e-1)==="\r"&&s===`
38
+ `:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(e)}.`)}let n=t.match(r);return n?n.length:0}function P1(t){return Mi(!1,t,/\r\n?/gu,`
39
+ `)}var sn="string",Kt="array",Er="cursor",Jt="indent",Gt="align",Yt="trim",rt="group",jt="fill",st="if-break",Zt="indent-if-break",Xt="line-suffix",Qt="line-suffix-boundary",$e="line",Ot="label",mt="break-parent",sf=new Set([Er,Jt,Gt,Yt,rt,jt,st,Zt,Xt,Qt,$e,Ot,mt]),z1=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},Te=z1;function $1(t){let e=t.length;for(;e>0&&(t[e-1]==="\r"||t[e-1]===`
40
+ `);)e--;return e<t.length?t.slice(0,e):t}function H1(t){if(typeof t=="string")return sn;if(Array.isArray(t))return Kt;if(!t)return;let{type:e}=t;if(sf.has(e))return e}var on=H1,V1=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function q1(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
41
+ Expected it to be 'string' or 'object'.`;if(on(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=V1([...sf].map(s=>`'${s}'`));return`Unexpected doc.type '${t.type}'.
42
+ Expected it to be ${n}.`}var W1=class extends Error{constructor(e){super(q1(e));It(this,"name","InvalidDocError");this.doc=e}},An=W1,Od={};function U1(t,e,r,n){let s=[t];for(;s.length>0;){let o=s.pop();if(o===Od){r(s.pop());continue}r&&s.push(o,Od);let i=on(o);if(!i)throw new An(o);if(e?.(o)!==!1)switch(i){case Kt:case jt:{let a=i===Kt?o:o.parts;for(let l=a.length,c=l-1;c>=0;--c)s.push(a[c]);break}case st:s.push(o.flatContents,o.breakContents);break;case rt:if(n&&o.expandedStates)for(let a=o.expandedStates.length,l=a-1;l>=0;--l)s.push(o.expandedStates[l]);else s.push(o.contents);break;case Gt:case Jt:case Zt:case Ot:case Xt:s.push(o.contents);break;case sn:case Er:case Yt:case Qt:case $e:case mt:break;default:throw new An(o)}}}var iu=U1;function Bi(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(o){if(r.has(o))return r.get(o);let i=s(o);return r.set(o,i),i}function s(o){switch(on(o)){case Kt:return e(o.map(n));case jt:return e({...o,parts:o.parts.map(n)});case st:return e({...o,breakContents:n(o.breakContents),flatContents:n(o.flatContents)});case rt:{let{expandedStates:i,contents:a}=o;return i?(i=i.map(n),a=i[0]):a=n(a),e({...o,contents:a,expandedStates:i})}case Gt:case Jt:case Zt:case Ot:case Xt:return e({...o,contents:n(o.contents)});case sn:case Er:case Yt:case Qt:case $e:case mt:return e(o);default:throw new An(o)}}}function au(t,e,r){let n=r,s=!1;function o(i){if(s)return!1;let a=e(i);a!==void 0&&(s=!0,n=a)}return iu(t,o),n}function K1(t){if(t.type===rt&&t.break||t.type===$e&&t.hard||t.type===mt)return!0}function J1(t){return au(t,K1,!1)}function Ld(t){if(t.length>0){let e=Te(!1,t,-1);!e.expandedStates&&!e.break&&(e.break="propagated")}return null}function G1(t){let e=new Set,r=[];function n(o){if(o.type===mt&&Ld(r),o.type===rt){if(r.push(o),e.has(o))return!1;e.add(o)}}function s(o){o.type===rt&&r.pop().break&&Ld(r)}iu(t,n,s,!0)}function Y1(t){return t.type===$e&&!t.hard?t.soft?"":" ":t.type===st?t.flatContents:t}function Z1(t){return Bi(t,Y1)}function _d(t){for(t=[...t];t.length>=2&&Te(!1,t,-2).type===$e&&Te(!1,t,-1).type===mt;)t.length-=2;if(t.length>0){let e=gs(Te(!1,t,-1));t[t.length-1]=e}return t}function gs(t){switch(on(t)){case Jt:case Zt:case rt:case Xt:case Ot:{let e=gs(t.contents);return{...t,contents:e}}case st:return{...t,breakContents:gs(t.breakContents),flatContents:gs(t.flatContents)};case jt:return{...t,parts:_d(t.parts)};case Kt:return _d(t);case sn:return $1(t);case Gt:case Er:case Yt:case Qt:case $e:case mt:break;default:throw new An(t)}return t}function of(t){return gs(Q1(t))}function X1(t){switch(on(t)){case jt:if(t.parts.every(e=>e===""))return"";break;case rt:if(!t.contents&&!t.id&&!t.break&&!t.expandedStates)return"";if(t.contents.type===rt&&t.contents.id===t.id&&t.contents.break===t.break&&t.contents.expandedStates===t.expandedStates)return t.contents;break;case Gt:case Jt:case Zt:case Xt:if(!t.contents)return"";break;case st:if(!t.flatContents&&!t.breakContents)return"";break;case Kt:{let e=[];for(let r of t){if(!r)continue;let[n,...s]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof Te(!1,e,-1)=="string"?e[e.length-1]+=n:e.push(n),e.push(...s)}return e.length===0?"":e.length===1?e[0]:e}case sn:case Er:case Yt:case Qt:case $e:case Ot:case mt:break;default:throw new An(t)}return t}function Q1(t){return Bi(t,e=>X1(e))}function ev(t,e=cf){return Bi(t,r=>typeof r=="string"?df(e,r.split(`
43
+ `)):r)}function tv(t){if(t.type===$e)return!0}function rv(t){return au(t,tv,!1)}function To(t,e){return t.type===Ot?{...t,contents:e(t.contents)}:e(t)}var nv=()=>{},sv=nv;function Po(t){return{type:Jt,contents:t}}function Nn(t,e){return{type:Gt,contents:e,n:t}}function af(t,e={}){return sv(e.expandedStates),{type:rt,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function ov(t){return Nn(Number.NEGATIVE_INFINITY,t)}function iv(t){return Nn({type:"root"},t)}function av(t){return Nn(-1,t)}function lv(t,e){return af(t[0],{...e,expandedStates:t})}function uv(t){return{type:jt,parts:t}}function cv(t,e="",r={}){return{type:st,breakContents:t,flatContents:e,groupId:r.groupId}}function dv(t,e){return{type:Zt,contents:t,groupId:e.groupId,negate:e.negate}}function dl(t){return{type:Xt,contents:t}}var pv={type:Qt},ji={type:mt},hv={type:Yt},lu={type:$e,hard:!0},lf={type:$e,hard:!0,literal:!0},uf={type:$e},fv={type:$e,soft:!0},Ur=[lu,ji],cf=[lf,ji],$r={type:Er};function df(t,e){let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}function pf(t,e,r){let n=t;if(e>0){for(let s=0;s<Math.floor(e/r);++s)n=Po(n);n=Nn(e%r,n),n=Nn(Number.NEGATIVE_INFINITY,n)}return n}function mv(t,e){return t?{type:Ot,label:t,contents:e}:e}function $t(t){var e;if(!t)return"";if(Array.isArray(t)){let r=[];for(let n of t)if(Array.isArray(n))r.push(...$t(n));else{let s=$t(n);s!==""&&r.push(s)}return r}return t.type===st?{...t,breakContents:$t(t.breakContents),flatContents:$t(t.flatContents)}:t.type===rt?{...t,contents:$t(t.contents),expandedStates:(e=t.expandedStates)==null?void 0:e.map($t)}:t.type===jt?{type:"fill",parts:t.parts.map($t)}:t.contents?{...t,contents:$t(t.contents)}:t}function gv(t){let e=Object.create(null),r=new Set;return n($t(t));function n(o,i,a){var l,c;if(typeof o=="string")return JSON.stringify(o);if(Array.isArray(o)){let d=o.map(n).filter(Boolean);return d.length===1?d[0]:`[${d.join(", ")}]`}if(o.type===$e){let d=((l=a?.[i+1])==null?void 0:l.type)===mt;return o.literal?d?"literalline":"literallineWithoutBreakParent":o.hard?d?"hardline":"hardlineWithoutBreakParent":o.soft?"softline":"line"}if(o.type===mt)return((c=a?.[i-1])==null?void 0:c.type)===$e&&a[i-1].hard?void 0:"breakParent";if(o.type===Yt)return"trim";if(o.type===Jt)return"indent("+n(o.contents)+")";if(o.type===Gt)return o.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(o.contents)+")":o.n<0?"dedent("+n(o.contents)+")":o.n.type==="root"?"markAsRoot("+n(o.contents)+")":"align("+JSON.stringify(o.n)+", "+n(o.contents)+")";if(o.type===st)return"ifBreak("+n(o.breakContents)+(o.flatContents?", "+n(o.flatContents):"")+(o.groupId?(o.flatContents?"":', ""')+`, { groupId: ${s(o.groupId)} }`:"")+")";if(o.type===Zt){let d=[];o.negate&&d.push("negate: true"),o.groupId&&d.push(`groupId: ${s(o.groupId)}`);let f=d.length>0?`, { ${d.join(", ")} }`:"";return`indentIfBreak(${n(o.contents)}${f})`}if(o.type===rt){let d=[];o.break&&o.break!=="propagated"&&d.push("shouldBreak: true"),o.id&&d.push(`id: ${s(o.id)}`);let f=d.length>0?`, { ${d.join(", ")} }`:"";return o.expandedStates?`conditionalGroup([${o.expandedStates.map(m=>n(m)).join(",")}]${f})`:`group(${n(o.contents)}${f})`}if(o.type===jt)return`fill([${o.parts.map(d=>n(d)).join(", ")}])`;if(o.type===Xt)return"lineSuffix("+n(o.contents)+")";if(o.type===Qt)return"lineSuffixBoundary";if(o.type===Ot)return`label(${JSON.stringify(o.label)}, ${n(o.contents)})`;if(o.type===Er)return"cursor";throw new Error("Unknown doc type "+o.type)}function s(o){if(typeof o!="symbol")return JSON.stringify(String(o));if(o in e)return e[o];let i=o.description||"symbol";for(let a=0;;a++){let l=i+(a>0?` #${a}`:"");if(!r.has(l))return r.add(l),e[o]=`Symbol.for(${JSON.stringify(l)})`}}}var bv=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function yv(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function xv(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101631&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129673||t>=129679&&t<=129734||t>=129742&&t<=129756||t>=129759&&t<=129769||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}var vv=t=>!(yv(t)||xv(t)),wv=/[^\x20-\x7F]/u;function Dv(t){if(!t)return 0;if(!wv.test(t))return t.length;t=t.replace(bv()," ");let e=0;for(let r of t){let n=r.codePointAt(0);n<=31||n>=127&&n<=159||n>=768&&n<=879||(e+=vv(n)?1:2)}return e}var uu=Dv,Qe=Symbol("MODE_BREAK"),Et=Symbol("MODE_FLAT"),Cn=Symbol("cursor"),pl=Symbol("DOC_FILL_PRINTED_LENGTH");function hf(){return{value:"",length:0,queue:[]}}function Cv(t,e){return hl(t,{type:"indent"},e)}function kv(t,e,r){return e===Number.NEGATIVE_INFINITY?t.root||hf():e<0?hl(t,{type:"dedent"},r):e?e.type==="root"?{...t,root:t}:hl(t,{type:typeof e=="string"?"stringAlign":"numberAlign",n:e},r):t}function hl(t,e,r){let n=e.type==="dedent"?t.queue.slice(0,-1):[...t.queue,e],s="",o=0,i=0,a=0;for(let y of n)switch(y.type){case"indent":d(),r.useTabs?l(1):c(r.tabWidth);break;case"stringAlign":d(),s+=y.n,o+=y.n.length;break;case"numberAlign":i+=1,a+=y.n;break;default:throw new Error(`Unexpected type '${y.type}'`)}return m(),{...t,value:s,length:o,queue:n};function l(y){s+=" ".repeat(y),o+=r.tabWidth*y}function c(y){s+=" ".repeat(y),o+=y}function d(){r.useTabs?f():m()}function f(){i>0&&l(i),g()}function m(){a>0&&c(a),g()}function g(){i=0,a=0}}function fl(t){let e=0,r=0,n=t.length;e:for(;n--;){let s=t[n];if(s===Cn){r++;continue}for(let o=s.length-1;o>=0;o--){let i=s[o];if(i===" "||i===" ")e++;else{t[n]=s.slice(0,o+1);break e}}}if(e>0||r>0)for(t.length=n+1;r-- >0;)t.push(Cn);return e}function go(t,e,r,n,s,o){if(r===Number.POSITIVE_INFINITY)return!0;let i=e.length,a=[t],l=[];for(;r>=0;){if(a.length===0){if(i===0)return!0;a.push(e[--i]);continue}let{mode:c,doc:d}=a.pop(),f=on(d);switch(f){case sn:l.push(d),r-=uu(d);break;case Kt:case jt:{let m=f===Kt?d:d.parts,g=d[pl]??0;for(let y=m.length-1;y>=g;y--)a.push({mode:c,doc:m[y]});break}case Jt:case Gt:case Zt:case Ot:a.push({mode:c,doc:d.contents});break;case Yt:r+=fl(l);break;case rt:{if(o&&d.break)return!1;let m=d.break?Qe:c,g=d.expandedStates&&m===Qe?Te(!1,d.expandedStates,-1):d.contents;a.push({mode:m,doc:g});break}case st:{let m=(d.groupId?s[d.groupId]||Et:c)===Qe?d.breakContents:d.flatContents;m&&a.push({mode:c,doc:m});break}case $e:if(c===Qe||d.hard)return!0;d.soft||(l.push(" "),r--);break;case Xt:n=!0;break;case Qt:if(n)return!1;break}}return!1}function Oi(t,e){let r={},n=e.printWidth,s=ou(e.endOfLine),o=0,i=[{ind:hf(),mode:Qe,doc:t}],a=[],l=!1,c=[],d=0;for(G1(t);i.length>0;){let{ind:m,mode:g,doc:y}=i.pop();switch(on(y)){case sn:{let x=s!==`
44
+ `?Mi(!1,y,`
45
+ `,s):y;a.push(x),i.length>0&&(o+=uu(x));break}case Kt:for(let x=y.length-1;x>=0;x--)i.push({ind:m,mode:g,doc:y[x]});break;case Er:if(d>=2)throw new Error("There are too many 'cursor' in doc.");a.push(Cn),d++;break;case Jt:i.push({ind:Cv(m,e),mode:g,doc:y.contents});break;case Gt:i.push({ind:kv(m,y.n,e),mode:g,doc:y.contents});break;case Yt:o-=fl(a);break;case rt:switch(g){case Et:if(!l){i.push({ind:m,mode:y.break?Qe:Et,doc:y.contents});break}case Qe:{l=!1;let x={ind:m,mode:Et,doc:y.contents},w=n-o,D=c.length>0;if(!y.break&&go(x,i,w,D,r))i.push(x);else if(y.expandedStates){let E=Te(!1,y.expandedStates,-1);if(y.break){i.push({ind:m,mode:Qe,doc:E});break}else for(let S=1;S<y.expandedStates.length+1;S++)if(S>=y.expandedStates.length){i.push({ind:m,mode:Qe,doc:E});break}else{let A=y.expandedStates[S],T={ind:m,mode:Et,doc:A};if(go(T,i,w,D,r)){i.push(T);break}}}else i.push({ind:m,mode:Qe,doc:y.contents});break}}y.id&&(r[y.id]=Te(!1,i,-1).mode);break;case jt:{let x=n-o,w=y[pl]??0,{parts:D}=y,E=D.length-w;if(E===0)break;let S=D[w+0],A=D[w+1],T={ind:m,mode:Et,doc:S},j={ind:m,mode:Qe,doc:S},B=go(T,[],x,c.length>0,r,!0);if(E===1){B?i.push(T):i.push(j);break}let $={ind:m,mode:Et,doc:A},O={ind:m,mode:Qe,doc:A};if(E===2){B?i.push($,T):i.push(O,j);break}let P=D[w+2],L={ind:m,mode:g,doc:{...y,[pl]:w+2}};go({ind:m,mode:Et,doc:[S,A,P]},[],x,c.length>0,r,!0)?i.push(L,$,T):B?i.push(L,O,T):i.push(L,O,j);break}case st:case Zt:{let x=y.groupId?r[y.groupId]:g;if(x===Qe){let w=y.type===st?y.breakContents:y.negate?y.contents:Po(y.contents);w&&i.push({ind:m,mode:g,doc:w})}if(x===Et){let w=y.type===st?y.flatContents:y.negate?Po(y.contents):y.contents;w&&i.push({ind:m,mode:g,doc:w})}break}case Xt:c.push({ind:m,mode:g,doc:y.contents});break;case Qt:c.length>0&&i.push({ind:m,mode:g,doc:lu});break;case $e:switch(g){case Et:if(y.hard)l=!0;else{y.soft||(a.push(" "),o+=1);break}case Qe:if(c.length>0){i.push({ind:m,mode:g,doc:y},...c.reverse()),c.length=0;break}y.literal?m.root?(a.push(s,m.root.value),o=m.root.length):(a.push(s),o=0):(o-=fl(a),a.push(s+m.value),o=m.length);break}break;case Ot:i.push({ind:m,mode:g,doc:y.contents});break;case mt:break;default:throw new An(y)}i.length===0&&c.length>0&&(i.push(...c.reverse()),c.length=0)}let f=a.indexOf(Cn);if(f!==-1){let m=a.indexOf(Cn,f+1);if(m===-1)return{formatted:a.filter(w=>w!==Cn).join("")};let g=a.slice(0,f).join(""),y=a.slice(f+1,m).join(""),x=a.slice(m+1).join("");return{formatted:g+y+x,cursorNodeStart:g.length,cursorNodeText:y}}return{formatted:a.join("")}}function Ev(t,e,r=0){let n=0;for(let s=r;s<t.length;++s)t[s]===" "?n=n+e-n%e:n++;return n}var cu=Ev,_r,ml,Mo,Sv=class{constructor(t){T1(this,_r),this.stack=[t]}get key(){let{stack:t,siblings:e}=this;return Te(!1,t,e===null?-2:-4)??null}get index(){return this.siblings===null?null:Te(!1,this.stack,-2)}get node(){return Te(!1,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:t}=this,e=Te(!1,t,-3);return Array.isArray(e)?e:null}get next(){let{siblings:t}=this;return t===null?null:t[this.index+1]}get previous(){let{siblings:t}=this;return t===null?null:t[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:t,index:e}=this;return t!==null&&e===t.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...as(this,_r,Mo).call(this)]}getName(){let{stack:t}=this,{length:e}=t;return e>1?Te(!1,t,-2):null}getValue(){return Te(!1,this.stack,-1)}getNode(t=0){let e=as(this,_r,ml).call(this,t);return e===-1?null:this.stack[e]}getParentNode(t=0){return this.getNode(t+1)}call(t,...e){let{stack:r}=this,{length:n}=r,s=Te(!1,r,-1);for(let o of e)s=s[o],r.push(o,s);try{return t(this)}finally{r.length=n}}callParent(t,e=0){let r=as(this,_r,ml).call(this,e+1),n=this.stack.splice(r+1);try{return t(this)}finally{this.stack.push(...n)}}each(t,...e){let{stack:r}=this,{length:n}=r,s=Te(!1,r,-1);for(let o of e)s=s[o],r.push(o,s);try{for(let o=0;o<s.length;++o)r.push(o,s[o]),t(this,o,s),r.length-=2}finally{r.length=n}}map(t,...e){let r=[];return this.each((n,s,o)=>{r[s]=t(n,s,o)},...e),r}match(...t){let e=this.stack.length-1,r=null,n=this.stack[e--];for(let s of t){if(n===void 0)return!1;let o=null;if(typeof r=="number"&&(o=r,r=this.stack[e--],n=this.stack[e--]),s&&!s(n,r,o))return!1;r=this.stack[e--],n=this.stack[e--]}return!0}findAncestor(t){for(let e of as(this,_r,Mo).call(this))if(t(e))return e}hasAncestor(t){for(let e of as(this,_r,Mo).call(this))if(t(e))return!0;return!1}};_r=new WeakSet,ml=function(t){let{stack:e}=this;for(let r=e.length-1;r>=0;r-=2)if(!Array.isArray(e[r])&&--t<0)return r;return-1},Mo=function*(){let{stack:t}=this;for(let e=t.length-3;e>=0;e-=2){let r=t[e];Array.isArray(r)||(yield r)}};var Fv=Sv,ff=new Proxy(()=>{},{get:()=>ff}),gl=ff;function Av(t){return t!==null&&typeof t=="object"}var Nv=Av;function*Li(t,e){let{getVisitorKeys:r,filter:n=()=>!0}=e,s=o=>Nv(o)&&n(o);for(let o of r(t)){let i=t[o];if(Array.isArray(i))for(let a of i)s(a)&&(yield a);else s(i)&&(yield i)}}function*Tv(t,e){let r=[t];for(let n=0;n<r.length;n++){let s=r[n];for(let o of Li(s,e))yield o,r.push(o)}}function Mv(t,e){return Li(t,e).next().done}function zs(t){return(e,r,n)=>{let s=!!(n!=null&&n.backwards);if(r===!1)return!1;let{length:o}=e,i=r;for(;i>=0&&i<o;){let a=e.charAt(i);if(t instanceof RegExp){if(!t.test(a))return i}else if(!t.includes(a))return i;s?i--:i++}return i===-1||i===o?i:!1}}var Bv=zs(/\s/u),Dr=zs(" "),mf=zs(",; "),gf=zs(/[^\n\r]/u);function jv(t,e,r){let n=!!(r!=null&&r.backwards);if(e===!1)return!1;let s=t.charAt(e);if(n){if(t.charAt(e-1)==="\r"&&s===`
58
46
  `)return e-2;if(s===`
59
47
  `||s==="\r"||s==="\u2028"||s==="\u2029")return e-1}else{if(s==="\r"&&t.charAt(e+1)===`
60
48
  `)return e+2;if(s===`
61
- `||s==="\r"||s==="\u2028"||s==="\u2029")return e+1}return e}var Xr=Tv;function Mv(t,e,r={}){let n=wr(t,r.backwards?e-1:e,r),s=Xr(t,n,r);return n!==s}var gr=Mv;function Bv(t){return Array.isArray(t)&&t.length>0}var jv=Bv,gf=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Ov=t=>Object.keys(t).filter(e=>!gf.has(e));function Lv(t){return t?e=>t(e,gf):Ov}var ji=Lv;function _v(t){let e=t.type||t.kind||"(unknown type)",r=String(t.name||t.id&&(typeof t.id=="object"?t.id.name:t.id)||t.key&&(typeof t.key=="object"?t.key.name:t.key)||t.value&&(typeof t.value=="object"?"":String(t.value))||t.operator||"");return r.length>20&&(r=r.slice(0,19)+"…"),e+(r?" "+r:"")}function lu(t,e){(t.comments??(t.comments=[])).push(e),e.printed=!1,e.nodeDescription=_v(t)}function ms(t,e){e.leading=!0,e.trailing=!1,lu(t,e)}function _r(t,e,r){e.leading=!1,e.trailing=!1,r&&(e.marker=r),lu(t,e)}function gs(t,e){e.leading=!1,e.trailing=!0,lu(t,e)}var ka=new WeakMap;function uu(t,e){if(ka.has(t))return ka.get(t);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:s},locStart:o,locEnd:i}=e;if(!n)return[];let a=(r?.(t,e)??[...Bi(t,{getVisitorKeys:ji(s)})]).flatMap(l=>n(l)?[l]:uu(l,e));return a.sort((l,c)=>o(l)-o(c)||i(l)-i(c)),ka.set(t,a),a}function bf(t,e,r,n){let{locStart:s,locEnd:o}=r,i=s(e),a=o(e),l=uu(t,r),c,d,f=0,m=l.length;for(;f<m;){let g=f+m>>1,y=l[g],v=s(y),w=o(y);if(v<=i&&a<=w)return bf(y,e,r,y);if(w<=i){c=y,f=g+1;continue}if(a<=v){d=y,m=g;continue}throw new Error("Comment location overlaps with node location")}if(n?.type==="TemplateLiteral"){let{quasis:g}=n,y=Sa(g,e,r);c&&Sa(g,c,r)!==y&&(c=null),d&&Sa(g,d,r)!==y&&(d=null)}return{enclosingNode:n,precedingNode:c,followingNode:d}}var Ea=()=>!1;function Iv(t,e){let{comments:r}=t;if(delete t.comments,!jv(r)||!e.printer.canAttachComment)return;let n=[],{printer:{experimentalFeatures:{avoidAstMutation:s=!1}={},handleComments:o={}},originalText:i}=e,{ownLine:a=Ea,endOfLine:l=Ea,remaining:c=Ea}=o,d=r.map((f,m)=>({...bf(t,f,e),comment:f,text:i,options:e,ast:t,isLastComment:r.length-1===m}));for(let[f,m]of d.entries()){let{comment:g,precedingNode:y,enclosingNode:v,followingNode:w,text:D,options:E,ast:N,isLastComment:A}=m,T;if(s?T=[m]:(g.enclosingNode=v,g.precedingNode=y,g.followingNode=w,T=[g,D,E,N,A]),Rv(D,E,d,f))g.placement="ownLine",a(...T)||(w?ms(w,g):y?gs(y,g):_r(v||N,g));else if(Pv(D,E,d,f))g.placement="endOfLine",l(...T)||(y?gs(y,g):w?ms(w,g):_r(v||N,g));else if(g.placement="remaining",!c(...T))if(y&&w){let j=n.length;j>0&&n[j-1].followingNode!==w&&jd(n,E),n.push(m)}else y?gs(y,g):w?ms(w,g):_r(v||N,g)}if(jd(n,e),!s)for(let f of r)delete f.precedingNode,delete f.enclosingNode,delete f.followingNode}var yf=t=>!/[\S\n\u2028\u2029]/u.test(t);function Rv(t,e,r,n){let{comment:s,precedingNode:o}=r[n],{locStart:i,locEnd:a}=e,l=i(s);if(o)for(let c=n-1;c>=0;c--){let{comment:d,precedingNode:f}=r[c];if(f!==o||!yf(t.slice(a(d),l)))break;l=i(d)}return gr(t,l,{backwards:!0})}function Pv(t,e,r,n){let{comment:s,followingNode:o}=r[n],{locStart:i,locEnd:a}=e,l=a(s);if(o)for(let c=n+1;c<r.length;c++){let{comment:d,followingNode:f}=r[c];if(f!==o||!yf(t.slice(l,i(d))))break;l=a(d)}return gr(t,l)}function jd(t,e){var r,n;let s=t.length;if(s===0)return;let{precedingNode:o,followingNode:i}=t[0],a=e.locStart(i),l;for(l=s;l>0;--l){let{comment:c,precedingNode:d,followingNode:f}=t[l-1];fl.strictEqual(d,o),fl.strictEqual(f,i);let m=e.originalText.slice(e.locEnd(c),a);if(((n=(r=e.printer).isGap)==null?void 0:n.call(r,m,e))??/^[\s(]*$/u.test(m))a=e.locStart(c);else break}for(let[c,{comment:d}]of t.entries())c<l?gs(o,d):ms(i,d);for(let c of[o,i])c.comments&&c.comments.length>1&&c.comments.sort((d,f)=>e.locStart(d)-e.locStart(f));t.length=0}function Sa(t,e,r){let n=r.locStart(e)-1;for(let s=1;s<t.length;++s)if(n<r.locStart(t[s]))return s-1;return 0}function zv(t,e){let r=e-1;r=wr(t,r,{backwards:!0}),r=Xr(t,r,{backwards:!0}),r=wr(t,r,{backwards:!0});let n=Xr(t,r,{backwards:!0});return r!==n}var cu=zv;function xf(t,e){let r=t.node;return r.printed=!0,e.printer.printComment(t,e)}function $v(t,e){var r;let n=t.node,s=[xf(t,e)],{printer:o,originalText:i,locStart:a,locEnd:l}=e;if((r=o.isBlockComment)!=null&&r.call(o,n)){let d=gr(i,l(n))?gr(i,a(n),{backwards:!0})?Wr:lf:" ";s.push(d)}else s.push(Wr);let c=Xr(i,wr(i,l(n)));return c!==!1&&gr(i,c)&&s.push(Wr),s}function Hv(t,e,r){var n;let s=t.node,o=xf(t,e),{printer:i,originalText:a,locStart:l}=e,c=(n=i.isBlockComment)==null?void 0:n.call(i,s);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||gr(a,l(s),{backwards:!0})){let d=cu(a,l(s));return{doc:ul([Wr,d?Wr:"",o]),isBlock:c,hasLineSuffix:!0}}return!c||r!=null&&r.hasLineSuffix?{doc:[ul([" ",o]),Ti],isBlock:c,hasLineSuffix:!0}:{doc:[" ",o],isBlock:c,hasLineSuffix:!1}}function Vv(t,e){let r=t.node;if(!r)return{};let n=e[Symbol.for("printedComments")];if((r.comments||[]).filter(a=>!n.has(a)).length===0)return{leading:"",trailing:""};let s=[],o=[],i;return t.each(()=>{let a=t.node;if(n!=null&&n.has(a))return;let{leading:l,trailing:c}=a;l?s.push($v(t,e)):c&&(i=Hv(t,e,i),o.push(i.doc))},"comments"),{leading:s,trailing:o}}function qv(t,e,r){let{leading:n,trailing:s}=Vv(t,r);return!n&&!s?e:Ao(e,o=>[n,o,s])}function Wv(t){let{[Symbol.for("comments")]:e,[Symbol.for("printedComments")]:r}=t;for(let n of e){if(!n.printed&&!r.has(n))throw new Error('Comment "'+n.value.trim()+'" was not printed. Please report this error!');delete n.printed}}var vf=class extends Error{constructor(){super(...arguments);Et(this,"name","ConfigError")}},Od=class extends Error{constructor(){super(...arguments);Et(this,"name","UndefinedParserError")}},Uv={checkIgnorePragma:{category:"Special",type:"boolean",default:!1,description:"Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",cliCategory:"Other"},cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:"Print (to stderr) where a cursor at the given position would move to after formatting.",cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
49
+ `||s==="\r"||s==="\u2028"||s==="\u2029")return e+1}return e}var Xr=jv;function Ov(t,e,r={}){let n=Dr(t,r.backwards?e-1:e,r),s=Xr(t,n,r);return n!==s}var gr=Ov;function Lv(t){return Array.isArray(t)&&t.length>0}var _v=Lv,bf=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Iv=t=>Object.keys(t).filter(e=>!bf.has(e));function Rv(t){return t?e=>t(e,bf):Iv}var _i=Rv;function Pv(t){let e=t.type||t.kind||"(unknown type)",r=String(t.name||t.id&&(typeof t.id=="object"?t.id.name:t.id)||t.key&&(typeof t.key=="object"?t.key.name:t.key)||t.value&&(typeof t.value=="object"?"":String(t.value))||t.operator||"");return r.length>20&&(r=r.slice(0,19)+"…"),e+(r?" "+r:"")}function du(t,e){(t.comments??(t.comments=[])).push(e),e.printed=!1,e.nodeDescription=Pv(t)}function bs(t,e){e.leading=!0,e.trailing=!1,du(t,e)}function Ir(t,e,r){e.leading=!1,e.trailing=!1,r&&(e.marker=r),du(t,e)}function ys(t,e){e.leading=!1,e.trailing=!0,du(t,e)}var Fa=new WeakMap;function pu(t,e){if(Fa.has(t))return Fa.get(t);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:s},locStart:o,locEnd:i}=e;if(!n)return[];let a=(r?.(t,e)??[...Li(t,{getVisitorKeys:_i(s)})]).flatMap(l=>n(l)?[l]:pu(l,e));return a.sort((l,c)=>o(l)-o(c)||i(l)-i(c)),Fa.set(t,a),a}function yf(t,e,r,n){let{locStart:s,locEnd:o}=r,i=s(e),a=o(e),l=pu(t,r),c,d,f=0,m=l.length;for(;f<m;){let g=f+m>>1,y=l[g],x=s(y),w=o(y);if(x<=i&&a<=w)return yf(y,e,r,y);if(w<=i){c=y,f=g+1;continue}if(a<=x){d=y,m=g;continue}throw new Error("Comment location overlaps with node location")}if(n?.type==="TemplateLiteral"){let{quasis:g}=n,y=Na(g,e,r);c&&Na(g,c,r)!==y&&(c=null),d&&Na(g,d,r)!==y&&(d=null)}return{enclosingNode:n,precedingNode:c,followingNode:d}}var Aa=()=>!1;function zv(t,e){let{comments:r}=t;if(delete t.comments,!_v(r)||!e.printer.canAttachComment)return;let n=[],{printer:{experimentalFeatures:{avoidAstMutation:s=!1}={},handleComments:o={}},originalText:i}=e,{ownLine:a=Aa,endOfLine:l=Aa,remaining:c=Aa}=o,d=r.map((f,m)=>({...yf(t,f,e),comment:f,text:i,options:e,ast:t,isLastComment:r.length-1===m}));for(let[f,m]of d.entries()){let{comment:g,precedingNode:y,enclosingNode:x,followingNode:w,text:D,options:E,ast:S,isLastComment:A}=m,T;if(s?T=[m]:(g.enclosingNode=x,g.precedingNode=y,g.followingNode=w,T=[g,D,E,S,A]),$v(D,E,d,f))g.placement="ownLine",a(...T)||(w?bs(w,g):y?ys(y,g):Ir(x||S,g));else if(Hv(D,E,d,f))g.placement="endOfLine",l(...T)||(y?ys(y,g):w?bs(w,g):Ir(x||S,g));else if(g.placement="remaining",!c(...T))if(y&&w){let j=n.length;j>0&&n[j-1].followingNode!==w&&Id(n,E),n.push(m)}else y?ys(y,g):w?bs(w,g):Ir(x||S,g)}if(Id(n,e),!s)for(let f of r)delete f.precedingNode,delete f.enclosingNode,delete f.followingNode}var xf=t=>!/[\S\n\u2028\u2029]/u.test(t);function $v(t,e,r,n){let{comment:s,precedingNode:o}=r[n],{locStart:i,locEnd:a}=e,l=i(s);if(o)for(let c=n-1;c>=0;c--){let{comment:d,precedingNode:f}=r[c];if(f!==o||!xf(t.slice(a(d),l)))break;l=i(d)}return gr(t,l,{backwards:!0})}function Hv(t,e,r,n){let{comment:s,followingNode:o}=r[n],{locStart:i,locEnd:a}=e,l=a(s);if(o)for(let c=n+1;c<r.length;c++){let{comment:d,followingNode:f}=r[c];if(f!==o||!xf(t.slice(l,i(d))))break;l=a(d)}return gr(t,l)}function Id(t,e){var r,n;let s=t.length;if(s===0)return;let{precedingNode:o,followingNode:i}=t[0],a=e.locStart(i),l;for(l=s;l>0;--l){let{comment:c,precedingNode:d,followingNode:f}=t[l-1];gl.strictEqual(d,o),gl.strictEqual(f,i);let m=e.originalText.slice(e.locEnd(c),a);if(((n=(r=e.printer).isGap)==null?void 0:n.call(r,m,e))??/^[\s(]*$/u.test(m))a=e.locStart(c);else break}for(let[c,{comment:d}]of t.entries())c<l?ys(o,d):bs(i,d);for(let c of[o,i])c.comments&&c.comments.length>1&&c.comments.sort((d,f)=>e.locStart(d)-e.locStart(f));t.length=0}function Na(t,e,r){let n=r.locStart(e)-1;for(let s=1;s<t.length;++s)if(n<r.locStart(t[s]))return s-1;return 0}function Vv(t,e){let r=e-1;r=Dr(t,r,{backwards:!0}),r=Xr(t,r,{backwards:!0}),r=Dr(t,r,{backwards:!0});let n=Xr(t,r,{backwards:!0});return r!==n}var hu=Vv;function vf(t,e){let r=t.node;return r.printed=!0,e.printer.printComment(t,e)}function qv(t,e){var r;let n=t.node,s=[vf(t,e)],{printer:o,originalText:i,locStart:a,locEnd:l}=e;if((r=o.isBlockComment)!=null&&r.call(o,n)){let d=gr(i,l(n))?gr(i,a(n),{backwards:!0})?Ur:uf:" ";s.push(d)}else s.push(Ur);let c=Xr(i,Dr(i,l(n)));return c!==!1&&gr(i,c)&&s.push(Ur),s}function Wv(t,e,r){var n;let s=t.node,o=vf(t,e),{printer:i,originalText:a,locStart:l}=e,c=(n=i.isBlockComment)==null?void 0:n.call(i,s);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||gr(a,l(s),{backwards:!0})){let d=hu(a,l(s));return{doc:dl([Ur,d?Ur:"",o]),isBlock:c,hasLineSuffix:!0}}return!c||r!=null&&r.hasLineSuffix?{doc:[dl([" ",o]),ji],isBlock:c,hasLineSuffix:!0}:{doc:[" ",o],isBlock:c,hasLineSuffix:!1}}function Uv(t,e){let r=t.node;if(!r)return{};let n=e[Symbol.for("printedComments")];if((r.comments||[]).filter(a=>!n.has(a)).length===0)return{leading:"",trailing:""};let s=[],o=[],i;return t.each(()=>{let a=t.node;if(n!=null&&n.has(a))return;let{leading:l,trailing:c}=a;l?s.push(qv(t,e)):c&&(i=Wv(t,e,i),o.push(i.doc))},"comments"),{leading:s,trailing:o}}function Kv(t,e,r){let{leading:n,trailing:s}=Uv(t,r);return!n&&!s?e:To(e,o=>[n,o,s])}function Jv(t){let{[Symbol.for("comments")]:e,[Symbol.for("printedComments")]:r}=t;for(let n of e){if(!n.printed&&!r.has(n))throw new Error('Comment "'+n.value.trim()+'" was not printed. Please report this error!');delete n.printed}}var wf=class extends Error{constructor(){super(...arguments);It(this,"name","ConfigError")}},Rd=class extends Error{constructor(){super(...arguments);It(this,"name","UndefinedParserError")}},Gv={checkIgnorePragma:{category:"Special",type:"boolean",default:!1,description:"Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",cliCategory:"Other"},cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:"Print (to stderr) where a cursor at the given position would move to after formatting.",cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
62
50
  (mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:t=>typeof t=="string"||typeof t=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"jsonc",description:"JSON with Comments"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"},{value:"mjml",description:"MJML"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:t=>typeof t=="string"||typeof t=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
63
51
  The range will extend forwards to the end of the selected statement.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
64
- The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function wf({plugins:t=[],showDeprecated:e=!1}={}){let r=t.flatMap(s=>s.languages??[]),n=[];for(let s of Kv(Object.assign({},...t.map(({options:o})=>o),Uv)))!e&&s.deprecated||(Array.isArray(s.choices)&&(e||(s.choices=s.choices.filter(o=>!o.deprecated)),s.name==="parser"&&(s.choices=[...s.choices,...Jv(s.choices,r,t)])),s.pluginDefaults=Object.fromEntries(t.filter(o=>{var i;return((i=o.defaultOptions)==null?void 0:i[s.name])!==void 0}).map(o=>[o.name,o.defaultOptions[s.name]])),n.push(s));return{languages:r,options:n}}function*Jv(t,e,r){let n=new Set(t.map(s=>s.value));for(let s of e)if(s.parsers){for(let o of s.parsers)if(!n.has(o)){n.add(o);let i=r.find(l=>l.parsers&&Object.prototype.hasOwnProperty.call(l.parsers,o)),a=s.name;i!=null&&i.name&&(a+=` (plugin: ${i.name})`),yield{value:o,description:a}}}}function Kv(t){let e=[];for(let[r,n]of Object.entries(t)){let s={name:r,...n};Array.isArray(s.default)&&(s.default=Ae(!1,s.default,-1).value),e.push(s)}return e}var Gv=(t,e)=>{if(!(t&&e==null))return e.toReversed||!Array.isArray(e)?e.toReversed():[...e].reverse()},Yv=Gv,Ld,_d,Id,Rd,Pd,Xv=((Ld=globalThis.Deno)==null?void 0:Ld.build.os)==="windows"||((Id=(_d=globalThis.navigator)==null?void 0:_d.platform)==null?void 0:Id.startsWith("Win"))||((Pd=(Rd=globalThis.process)==null?void 0:Rd.platform)==null?void 0:Pd.startsWith("win"))||!1;function Df(t){if(t=t instanceof URL?t:new URL(t),t.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${t.protocol}"`);return t}function Qv(t){return t=Df(t),decodeURIComponent(t.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function Zv(t){t=Df(t);let e=decodeURIComponent(t.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return t.hostname!==""&&(e=`\\\\${t.hostname}${e}`),e}function ew(t){return Xv?Zv(t):Qv(t)}var tw=ew,rw=t=>String(t).split(/[/\\]/u).pop();function zd(t,e){if(!e)return;let r=rw(e).toLowerCase();return t.find(({filenames:n})=>n?.some(s=>s.toLowerCase()===r))??t.find(({extensions:n})=>n?.some(s=>r.endsWith(s)))}function nw(t,e){if(e)return t.find(({name:r})=>r.toLowerCase()===e)??t.find(({aliases:r})=>r?.includes(e))??t.find(({extensions:r})=>r?.includes(`.${e}`))}function $d(t,e){if(e){if(String(e).startsWith("file:"))try{e=tw(e)}catch{return}if(typeof e=="string")return t.find(({isSupported:r})=>r?.({filepath:e}))}}function sw(t,e){let r=Yv(!1,t.plugins).flatMap(s=>s.languages??[]),n=nw(r,e.language)??zd(r,e.physicalFile)??zd(r,e.file)??$d(r,e.physicalFile)??$d(r,e.file)??(e.physicalFile,void 0);return n?.parsers[0]}var ow=sw,Cn={key:t=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?t:JSON.stringify(t),value(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(r=>Cn.value(r)).join(", ")}]`;let e=Object.keys(t);return e.length===0?"{}":`{ ${e.map(r=>`${Cn.key(r)}: ${Cn.value(t[r])}`).join(", ")} }`},pair:({key:t,value:e})=>Cn.value({[t]:e})},Cf=new Proxy(String,{get:()=>Cf}),Tt=Cf,iw=(t,e,{descriptor:r})=>{let n=[`${Tt.yellow(typeof t=="string"?r.key(t):r.pair(t))} is deprecated`];return e&&n.push(`we now treat it as ${Tt.blue(typeof e=="string"?r.key(e):r.pair(e))}`),n.join("; ")+"."},kf=Symbol.for("vnopts.VALUE_NOT_EXIST"),To=Symbol.for("vnopts.VALUE_UNCHANGED"),Hd=" ".repeat(2),aw=(t,e,r)=>{let{text:n,list:s}=r.normalizeExpectedResult(r.schemas[t].expected(r)),o=[];return n&&o.push(Vd(t,e,n,r.descriptor)),s&&o.push([Vd(t,e,s.title,r.descriptor)].concat(s.values.map(i=>Ef(i,r.loggerPrintWidth))).join(`
65
- `)),Sf(o,r.loggerPrintWidth)};function Vd(t,e,r,n){return[`Invalid ${Tt.red(n.key(t))} value.`,`Expected ${Tt.blue(r)},`,`but received ${e===kf?Tt.gray("nothing"):Tt.red(n.value(e))}.`].join(" ")}function Ef({text:t,list:e},r){let n=[];return t&&n.push(`- ${Tt.blue(t)}`),e&&n.push([`- ${Tt.blue(e.title)}:`].concat(e.values.map(s=>Ef(s,r-Hd.length).replace(/^|\n/g,`$&${Hd}`))).join(`
66
- `)),Sf(n,r)}function Sf(t,e){if(t.length===1)return t[0];let[r,n]=t,[s,o]=t.map(i=>i.split(`
67
- `,1)[0].length);return s>e&&s>o?n:r}var Fa=[],qd=[];function lw(t,e){if(t===e)return 0;let r=t;t.length>e.length&&(t=e,e=r);let n=t.length,s=e.length;for(;n>0&&t.charCodeAt(~-n)===e.charCodeAt(~-s);)n--,s--;let o=0;for(;o<n&&t.charCodeAt(o)===e.charCodeAt(o);)o++;if(n-=o,s-=o,n===0)return s;let i,a,l,c,d=0,f=0;for(;d<n;)qd[d]=t.charCodeAt(o+d),Fa[d]=++d;for(;f<s;)for(i=e.charCodeAt(o+f),l=f++,a=f,d=0;d<n;d++)c=i===qd[d]?l:l+1,l=Fa[d],a=Fa[d]=l>a?c>a?a+1:c:c>l?l+1:c;return a}var Ff=(t,e,{descriptor:r,logger:n,schemas:s})=>{let o=[`Ignored unknown option ${Tt.yellow(r.pair({key:t,value:e}))}.`],i=Object.keys(s).sort().find(a=>lw(t,a)<3);i&&o.push(`Did you mean ${Tt.blue(r.key(i))}?`),n.warn(o.join(" "))},uw=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function cw(t,e){let r=new t(e),n=Object.create(r);for(let s of uw)s in e&&(n[s]=dw(e[s],r,Er.prototype[s].length));return n}var Er=class{static create(t){return cw(this,t)}constructor(t){this.name=t.name}default(t){}expected(t){return"nothing"}validate(t,e){return!1}deprecated(t,e){return!1}forward(t,e){}redirect(t,e){}overlap(t,e,r){return t}preprocess(t,e){return t}postprocess(t,e){return To}};function dw(t,e,r){return typeof t=="function"?(...n)=>t(...n.slice(0,r-1),e,...n.slice(r-1)):()=>t}var pw=class extends Er{constructor(e){super(e),this._sourceName=e.sourceName}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,r){return r.schemas[this._sourceName].validate(e,r)}redirect(e,r){return this._sourceName}},hw=class extends Er{expected(){return"anything"}validate(){return!0}},fw=class extends Er{constructor({valueSchema:t,name:e=t.name,...r}){super({...r,name:e}),this._valueSchema=t}expected(t){let{text:e,list:r}=t.normalizeExpectedResult(this._valueSchema.expected(t));return{text:e&&`an array of ${e}`,list:r&&{title:"an array of the following values",values:[{list:r}]}}}validate(t,e){if(!Array.isArray(t))return!1;let r=[];for(let n of t){let s=e.normalizeValidateResult(this._valueSchema.validate(n,e),n);s!==!0&&r.push(s.value)}return r.length===0?!0:{value:r}}deprecated(t,e){let r=[];for(let n of t){let s=e.normalizeDeprecatedResult(this._valueSchema.deprecated(n,e),n);s!==!1&&r.push(...s.map(({value:o})=>({value:[o]})))}return r}forward(t,e){let r=[];for(let n of t){let s=e.normalizeForwardResult(this._valueSchema.forward(n,e),n);r.push(...s.map(Wd))}return r}redirect(t,e){let r=[],n=[];for(let s of t){let o=e.normalizeRedirectResult(this._valueSchema.redirect(s,e),s);"remain"in o&&r.push(o.remain),n.push(...o.redirect.map(Wd))}return r.length===0?{redirect:n}:{redirect:n,remain:r}}overlap(t,e){return t.concat(e)}};function Wd({from:t,to:e}){return{from:[t],to:e}}var mw=class extends Er{expected(){return"true or false"}validate(t){return typeof t=="boolean"}};function gw(t,e){let r=Object.create(null);for(let n of t){let s=n[e];if(r[s])throw new Error(`Duplicate ${e} ${JSON.stringify(s)}`);r[s]=n}return r}function bw(t,e){let r=new Map;for(let n of t){let s=n[e];if(r.has(s))throw new Error(`Duplicate ${e} ${JSON.stringify(s)}`);r.set(s,n)}return r}function yw(){let t=Object.create(null);return e=>{let r=JSON.stringify(e);return t[r]?!0:(t[r]=!0,!1)}}function xw(t,e){let r=[],n=[];for(let s of t)e(s)?r.push(s):n.push(s);return[r,n]}function vw(t){return t===Math.floor(t)}function ww(t,e){if(t===e)return 0;let r=typeof t,n=typeof e,s=["undefined","object","boolean","number","string"];return r!==n?s.indexOf(r)-s.indexOf(n):r!=="string"?Number(t)-Number(e):t.localeCompare(e)}function Dw(t){return(...e)=>{let r=t(...e);return typeof r=="string"?new Error(r):r}}function Ud(t){return t===void 0?{}:t}function Af(t){if(typeof t=="string")return{text:t};let{text:e,list:r}=t;return Cw((e||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:e,list:{title:r.title,values:r.values.map(Af)}}:{text:e}}function Jd(t,e){return t===!0?!0:t===!1?{value:e}:t}function Kd(t,e,r=!1){return t===!1?!1:t===!0?r?!0:[{value:e}]:"value"in t?[t]:t.length===0?!1:t}function Gd(t,e){return typeof t=="string"||"key"in t?{from:e,to:t}:"from"in t?{from:t.from,to:t.to}:{from:e,to:t.to}}function ml(t,e){return t===void 0?[]:Array.isArray(t)?t.map(r=>Gd(r,e)):[Gd(t,e)]}function Yd(t,e){let r=ml(typeof t=="object"&&"redirect"in t?t.redirect:t,e);return r.length===0?{remain:e,redirect:r}:typeof t=="object"&&"remain"in t?{remain:t.remain,redirect:r}:{redirect:r}}function Cw(t,e){if(!t)throw new Error(e)}var kw=class extends Er{constructor(t){super(t),this._choices=bw(t.choices.map(e=>e&&typeof e=="object"?e:{value:e}),"value")}expected({descriptor:t}){let e=Array.from(this._choices.keys()).map(s=>this._choices.get(s)).filter(({hidden:s})=>!s).map(s=>s.value).sort(ww).map(t.value),r=e.slice(0,-2),n=e.slice(-2);return{text:r.concat(n.join(" or ")).join(", "),list:{title:"one of the following values",values:e}}}validate(t){return this._choices.has(t)}deprecated(t){let e=this._choices.get(t);return e&&e.deprecated?{value:t}:!1}forward(t){let e=this._choices.get(t);return e?e.forward:void 0}redirect(t){let e=this._choices.get(t);return e?e.redirect:void 0}},Ew=class extends Er{expected(){return"a number"}validate(t,e){return typeof t=="number"}},Sw=class extends Ew{expected(){return"an integer"}validate(t,e){return e.normalizeValidateResult(super.validate(t,e),t)===!0&&vw(t)}},Xd=class extends Er{expected(){return"a string"}validate(t){return typeof t=="string"}},Fw=Cn,Aw=Ff,Nw=aw,Tw=iw,Mw=class{constructor(t,e){let{logger:r=console,loggerPrintWidth:n=80,descriptor:s=Fw,unknown:o=Aw,invalid:i=Nw,deprecated:a=Tw,missing:l=()=>!1,required:c=()=>!1,preprocess:d=m=>m,postprocess:f=()=>To}=e||{};this._utils={descriptor:s,logger:r||{warn:()=>{}},loggerPrintWidth:n,schemas:gw(t,"name"),normalizeDefaultResult:Ud,normalizeExpectedResult:Af,normalizeDeprecatedResult:Kd,normalizeForwardResult:ml,normalizeRedirectResult:Yd,normalizeValidateResult:Jd},this._unknownHandler=o,this._invalidHandler=Dw(i),this._deprecatedHandler=a,this._identifyMissing=(m,g)=>!(m in g)||l(m,g),this._identifyRequired=c,this._preprocess=d,this._postprocess=f,this.cleanHistory()}cleanHistory(){this._hasDeprecationWarned=yw()}normalize(t){let e={},r=[this._preprocess(t,this._utils)],n=()=>{for(;r.length!==0;){let s=r.shift(),o=this._applyNormalization(s,e);r.push(...o)}};n();for(let s of Object.keys(this._utils.schemas)){let o=this._utils.schemas[s];if(!(s in e)){let i=Ud(o.default(this._utils));"value"in i&&r.push({[s]:i.value})}}n();for(let s of Object.keys(this._utils.schemas)){if(!(s in e))continue;let o=this._utils.schemas[s],i=e[s],a=o.postprocess(i,this._utils);a!==To&&(this._applyValidation(a,s,o),e[s]=a)}return this._applyPostprocess(e),this._applyRequiredCheck(e),e}_applyNormalization(t,e){let r=[],{knownKeys:n,unknownKeys:s}=this._partitionOptionKeys(t);for(let o of n){let i=this._utils.schemas[o],a=i.preprocess(t[o],this._utils);this._applyValidation(a,o,i);let l=({from:f,to:m})=>{r.push(typeof m=="string"?{[m]:f}:{[m.key]:m.value})},c=({value:f,redirectTo:m})=>{let g=Kd(i.deprecated(f,this._utils),a,!0);if(g!==!1)if(g===!0)this._hasDeprecationWarned(o)||this._utils.logger.warn(this._deprecatedHandler(o,m,this._utils));else for(let{value:y}of g){let v={key:o,value:y};if(!this._hasDeprecationWarned(v)){let w=typeof m=="string"?{key:m,value:y}:m;this._utils.logger.warn(this._deprecatedHandler(v,w,this._utils))}}};ml(i.forward(a,this._utils),a).forEach(l);let d=Yd(i.redirect(a,this._utils),a);if(d.redirect.forEach(l),"remain"in d){let f=d.remain;e[o]=o in e?i.overlap(e[o],f,this._utils):f,c({value:f})}for(let{from:f,to:m}of d.redirect)c({value:f,redirectTo:m})}for(let o of s){let i=t[o];this._applyUnknownHandler(o,i,e,(a,l)=>{r.push({[a]:l})})}return r}_applyRequiredCheck(t){for(let e of Object.keys(this._utils.schemas))if(this._identifyMissing(e,t)&&this._identifyRequired(e))throw this._invalidHandler(e,kf,this._utils)}_partitionOptionKeys(t){let[e,r]=xw(Object.keys(t).filter(n=>!this._identifyMissing(n,t)),n=>n in this._utils.schemas);return{knownKeys:e,unknownKeys:r}}_applyValidation(t,e,r){let n=Jd(r.validate(t,this._utils),t);if(n!==!0)throw this._invalidHandler(e,n.value,this._utils)}_applyUnknownHandler(t,e,r,n){let s=this._unknownHandler(t,e,this._utils);if(s)for(let o of Object.keys(s)){if(this._identifyMissing(o,s))continue;let i=s[o];o in this._utils.schemas?n(o,i):r[o]=i}}_applyPostprocess(t){let e=this._postprocess(t,this._utils);if(e!==To){if(e.delete)for(let r of e.delete)delete t[r];if(e.override){let{knownKeys:r,unknownKeys:n}=this._partitionOptionKeys(e.override);for(let s of r){let o=e.override[s];this._applyValidation(o,s,this._utils.schemas[s]),t[s]=o}for(let s of n){let o=e.override[s];this._applyUnknownHandler(s,o,t,(i,a)=>{let l=this._utils.schemas[i];this._applyValidation(a,i,l),t[i]=a})}}}}},Aa;function Bw(t,e,{logger:r=!1,isCLI:n=!1,passThrough:s=!1,FlagSchema:o,descriptor:i}={}){if(n){if(!o)throw new Error("'FlagSchema' option is required.");if(!i)throw new Error("'descriptor' option is required.")}else i=Cn;let a=s?Array.isArray(s)?(m,g)=>s.includes(m)?{[m]:g}:void 0:(m,g)=>({[m]:g}):(m,g,y)=>{let{_:v,...w}=y.schemas;return Ff(m,g,{...y,schemas:w})},l=jw(e,{isCLI:n,FlagSchema:o}),c=new Mw(l,{logger:r,unknown:a,descriptor:i}),d=r!==!1;d&&Aa&&(c._hasDeprecationWarned=Aa);let f=c.normalize(t);return d&&(Aa=c._hasDeprecationWarned),f}function jw(t,{isCLI:e,FlagSchema:r}){let n=[];e&&n.push(hw.create({name:"_"}));for(let s of t)n.push(Ow(s,{isCLI:e,optionInfos:t,FlagSchema:r})),s.alias&&e&&n.push(pw.create({name:s.alias,sourceName:s.name}));return n}function Ow(t,{isCLI:e,optionInfos:r,FlagSchema:n}){let{name:s}=t,o={name:s},i,a={};switch(t.type){case"int":i=Sw,e&&(o.preprocess=Number);break;case"string":i=Xd;break;case"choice":i=kw,o.choices=t.choices.map(l=>l!=null&&l.redirect?{...l,redirect:{to:{key:t.name,value:l.redirect}}}:l);break;case"boolean":i=mw;break;case"flag":i=n,o.flags=r.flatMap(l=>[l.alias,l.description&&l.name,l.oppositeDescription&&`no-${l.name}`].filter(Boolean));break;case"path":i=Xd;break;default:throw new Error(`Unexpected type ${t.type}`)}if(t.exception?o.validate=(l,c,d)=>t.exception(l)||c.validate(l,d):o.validate=(l,c,d)=>l===void 0||c.validate(l,d),t.redirect&&(a.redirect=l=>l?{to:typeof t.redirect=="string"?t.redirect:{key:t.redirect.option,value:t.redirect.value}}:void 0),t.deprecated&&(a.deprecated=!0),e&&!t.array){let l=o.preprocess||(c=>c);o.preprocess=(c,d,f)=>d.preprocess(l(Array.isArray(c)?Ae(!1,c,-1):c),f)}return t.array?fw.create({...e?{preprocess:l=>Array.isArray(l)?l:[l]}:{},...a,valueSchema:i.create(o)}):i.create({...o,...a})}var Lw=Bw,_w=(t,e,r)=>{if(!(t&&e==null)){if(e.findLast)return e.findLast(r);for(let n=e.length-1;n>=0;n--){let s=e[n];if(r(s,n,e))return s}}},Nf=_w;function Tf(t,e){if(!e)throw new Error("parserName is required.");let r=Nf(!1,t,s=>s.parsers&&Object.prototype.hasOwnProperty.call(s.parsers,e));if(r)return r;let n=`Couldn't resolve parser "${e}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new vf(n)}function Iw(t,e){if(!e)throw new Error("astFormat is required.");let r=Nf(!1,t,s=>s.printers&&Object.prototype.hasOwnProperty.call(s.printers,e));if(r)return r;let n=`Couldn't find plugin for AST format "${e}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new vf(n)}function du({plugins:t,parser:e}){let r=Tf(t,e);return Mf(r,e)}function Mf(t,e){let r=t.parsers[e];return typeof r=="function"?r():r}function Rw(t,e){let r=t.printers[e];return typeof r=="function"?r():r}var Qd={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function Pw(t,e={}){var r;let n={...t};if(!n.parser)if(n.filepath){if(n.parser=ow(n,{physicalFile:n.filepath}),!n.parser)throw new Od(`No parser could be inferred for file "${n.filepath}".`)}else throw new Od("No parser and no file path given, couldn't infer a parser.");let s=wf({plugins:t.plugins,showDeprecated:!0}).options,o={...Qd,...Object.fromEntries(s.filter(m=>m.default!==void 0).map(m=>[m.name,m.default]))},i=Tf(n.plugins,n.parser),a=await Mf(i,n.parser);n.astFormat=a.astFormat,n.locEnd=a.locEnd,n.locStart=a.locStart;let l=(r=i.printers)!=null&&r[a.astFormat]?i:Iw(n.plugins,a.astFormat),c=await Rw(l,a.astFormat);n.printer=c;let d=l.defaultOptions?Object.fromEntries(Object.entries(l.defaultOptions).filter(([,m])=>m!==void 0)):{},f={...o,...d};for(let[m,g]of Object.entries(f))(n[m]===null||n[m]===void 0)&&(n[m]=g);return n.parser==="json"&&(n.trailingComma="none"),Lw(n,s,{passThrough:Object.keys(Qd),...e})}var Rn=Pw,zw=E1(A1());async function $w(t,e){let r=await du(e),n=r.preprocess?r.preprocess(t,e):t;e.originalText=n;let s;try{s=await r.parse(n,e,e)}catch(o){Hw(o,t)}return{text:n,ast:s}}function Hw(t,e){let{loc:r}=t;if(r){let n=(0,zw.codeFrameColumns)(e,r,{highlightCode:!0});throw t.message+=`
68
- `+n,t.codeFrame=n,t}throw t}var zs=$w;async function Vw(t,e,r,n,s){let{embeddedLanguageFormatting:o,printer:{embed:i,hasPrettierIgnore:a=()=>!1,getVisitorKeys:l}}=r;if(!i||o!=="auto")return;if(i.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let c=ji(i.getVisitorKeys??l),d=[];g();let f=t.stack;for(let{print:y,node:v,pathStack:w}of d)try{t.stack=w;let D=await y(m,e,t,r);D&&s.set(v,D)}catch(D){if(globalThis.PRETTIER_DEBUG)throw D}t.stack=f;function m(y,v){return qw(y,v,r,n)}function g(){let{node:y}=t;if(y===null||typeof y!="object"||a(t))return;for(let w of c(y))Array.isArray(y[w])?t.each(g,w):t.call(g,w);let v=i(t,r);if(v){if(typeof v=="function"){d.push({print:v,node:y,pathStack:[...t.stack]});return}s.set(y,v)}}}async function qw(t,e,r,n){let s=await Rn({...r,...e,parentParser:r.parser,originalText:t,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:!0}),{ast:o}=await zs(t,s),i=await n(o,s);return sf(i)}function Ww(t,e){let{originalText:r,[Symbol.for("comments")]:n,locStart:s,locEnd:o,[Symbol.for("printedComments")]:i}=e,{node:a}=t,l=s(a),c=o(a);for(let d of n)s(d)>=l&&o(d)<=c&&i.add(d);return r.slice(l,c)}var Uw=Ww;async function Oi(t,e){({ast:t}=await Bf(t,e));let r=new Map,n=new kv(t),s=new Map;await Vw(n,i,e,Oi,s);let o=await Zd(n,e,i,void 0,s);if(Wv(e),e.cursorOffset>=0){if(e.nodeAfterCursor&&!e.nodeBeforeCursor)return[zr,o];if(e.nodeBeforeCursor&&!e.nodeAfterCursor)return[o,zr]}return o;function i(l,c){return l===void 0||l===n?a(c):Array.isArray(l)?n.call(()=>a(c),...l):n.call(()=>a(c),l)}function a(l){let c=n.node;if(c==null)return"";let d=c&&typeof c=="object"&&l===void 0;if(d&&r.has(c))return r.get(c);let f=Zd(n,e,i,l,s);return d&&r.set(c,f),f}}function Zd(t,e,r,n,s){var o;let{node:i}=t,{printer:a}=e,l;switch((o=a.hasPrettierIgnore)!=null&&o.call(a,t)?l=Uw(t,e):s.has(i)?l=s.get(i):l=a.print(t,e,r,n),i){case e.cursorNode:l=Ao(l,c=>[zr,c,zr]);break;case e.nodeBeforeCursor:l=Ao(l,c=>[c,zr]);break;case e.nodeAfterCursor:l=Ao(l,c=>[zr,c]);break}return a.printComment&&(!a.willPrintOwnComments||!a.willPrintOwnComments(t,e))&&(l=qv(t,l,e)),l}async function Bf(t,e){let r=t.comments??[];e[Symbol.for("comments")]=r,e[Symbol.for("printedComments")]=new Set,Iv(t,e);let{printer:{preprocess:n}}=e;return t=n?await n(t,e):t,{ast:t,comments:r}}function Jw(t,e){let{cursorOffset:r,locStart:n,locEnd:s}=e,o=ji(e.printer.getVisitorKeys),i=g=>n(g)<=r&&s(g)>=r,a=t,l=[t];for(let g of Fv(t,{getVisitorKeys:o,filter:i}))l.push(g),a=g;if(Av(a,{getVisitorKeys:o}))return{cursorNode:a};let c,d,f=-1,m=Number.POSITIVE_INFINITY;for(;l.length>0&&(c===void 0||d===void 0);){a=l.pop();let g=c!==void 0,y=d!==void 0;for(let v of Bi(a,{getVisitorKeys:o})){if(!g){let w=s(v);w<=r&&w>f&&(c=v,f=w)}if(!y){let w=n(v);w>=r&&w<m&&(d=v,m=w)}}}return{nodeBeforeCursor:c,nodeAfterCursor:d}}var jf=Jw;function Kw(t,e){let{printer:{massageAstNode:r,getVisitorKeys:n}}=e;if(!r)return t;let s=ji(n),o=r.ignoredProperties??new Set;return i(t);function i(a,l){if(!(a!==null&&typeof a=="object"))return a;if(Array.isArray(a))return a.map(m=>i(m,l)).filter(Boolean);let c={},d=new Set(s(a));for(let m in a)!Object.prototype.hasOwnProperty.call(a,m)||o.has(m)||(d.has(m)?c[m]=i(a[m],a):c[m]=a[m]);let f=r(a,c,l);if(f!==null)return f??c}}var Gw=Kw,Yw=(t,e,r)=>{if(!(t&&e==null)){if(e.findLastIndex)return e.findLastIndex(r);for(let n=e.length-1;n>=0;n--){let s=e[n];if(r(s,n,e))return n}return-1}},Xw=Yw,Qw=({parser:t})=>t==="json"||t==="json5"||t==="jsonc"||t==="json-stringify";function Zw(t,e){let r=[t.node,...t.parentNodes],n=new Set([e.node,...e.parentNodes]);return r.find(s=>Of.has(s.type)&&n.has(s))}function ep(t){let e=Xw(!1,t,r=>r.type!=="Program"&&r.type!=="File");return e===-1?t:t.slice(0,e+1)}function eD(t,e,{locStart:r,locEnd:n}){let s=t.node,o=e.node;if(s===o)return{startNode:s,endNode:o};let i=r(t.node);for(let l of ep(e.parentNodes))if(r(l)>=i)o=l;else break;let a=n(e.node);for(let l of ep(t.parentNodes)){if(n(l)<=a)s=l;else break;if(s===o)break}return{startNode:s,endNode:o}}function gl(t,e,r,n,s=[],o){let{locStart:i,locEnd:a}=r,l=i(t),c=a(t);if(!(e>c||e<l||o==="rangeEnd"&&e===l||o==="rangeStart"&&e===c)){for(let d of uu(t,r)){let f=gl(d,e,r,n,[t,...s],o);if(f)return f}if(!n||n(t,s[0]))return{node:t,parentNodes:s}}}function tD(t,e){return e!=="DeclareExportDeclaration"&&t!=="TypeParameterDeclaration"&&(t==="Directive"||t==="TypeAlias"||t==="TSExportAssignment"||t.startsWith("Declare")||t.startsWith("TSDeclare")||t.endsWith("Statement")||t.endsWith("Declaration"))}var Of=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),rD=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function tp(t,e,r){if(!e)return!1;switch(t.parser){case"flow":case"hermes":case"babel":case"babel-flow":case"babel-ts":case"typescript":case"acorn":case"espree":case"meriyah":case"oxc":case"oxc-ts":case"__babel_estree":return tD(e.type,r?.type);case"json":case"json5":case"jsonc":case"json-stringify":return Of.has(e.type);case"graphql":return rD.has(e.kind);case"vue":return e.tag!=="root"}return!1}function nD(t,e,r){let{rangeStart:n,rangeEnd:s,locStart:o,locEnd:i}=e;fl.ok(s>n);let a=t.slice(n,s).search(/\S/u),l=a===-1;if(!l)for(n+=a;s>n&&!/\S/u.test(t[s-1]);--s);let c=gl(r,n,e,(g,y)=>tp(e,g,y),[],"rangeStart"),d=l?c:gl(r,s,e,g=>tp(e,g),[],"rangeEnd");if(!c||!d)return{rangeStart:0,rangeEnd:0};let f,m;if(Qw(e)){let g=Zw(c,d);f=g,m=g}else({startNode:f,endNode:m}=eD(c,d,e));return{rangeStart:Math.min(o(f),o(m)),rangeEnd:Math.max(i(f),i(m))}}var Lf="\uFEFF",rp=Symbol("cursor");async function _f(t,e,r=0){if(!t||t.trim().length===0)return{formatted:"",cursorOffset:-1,comments:[]};let{ast:n,text:s}=await zs(t,e);e.cursorOffset>=0&&(e={...e,...jf(n,e)});let o=await Oi(n,e);r>0&&(o=df([Wr,o],r,e.tabWidth));let i=Mi(o,e);if(r>0){let l=i.formatted.trim();i.cursorNodeStart!==void 0&&(i.cursorNodeStart-=i.formatted.indexOf(l),i.cursorNodeStart<0&&(i.cursorNodeStart=0,i.cursorNodeText=i.cursorNodeText.trimStart()),i.cursorNodeStart+i.cursorNodeText.length>l.length&&(i.cursorNodeText=i.cursorNodeText.trimEnd())),i.formatted=l+ru(e.endOfLine)}let a=e[Symbol.for("comments")];if(e.cursorOffset>=0){let l,c,d,f;if((e.cursorNode||e.nodeBeforeCursor||e.nodeAfterCursor)&&i.cursorNodeText)if(d=i.cursorNodeStart,f=i.cursorNodeText,e.cursorNode)l=e.locStart(e.cursorNode),c=s.slice(l,e.locEnd(e.cursorNode));else{if(!e.nodeBeforeCursor&&!e.nodeAfterCursor)throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");l=e.nodeBeforeCursor?e.locEnd(e.nodeBeforeCursor):0;let D=e.nodeAfterCursor?e.locStart(e.nodeAfterCursor):s.length;c=s.slice(l,D)}else l=0,c=s,d=0,f=i.formatted;let m=e.cursorOffset-l;if(c===f)return{formatted:i.formatted,cursorOffset:d+m,comments:a};let g=c.split("");g.splice(m,0,rp);let y=f.split(""),v=O1(g,y),w=d;for(let D of v)if(D.removed){if(D.value.includes(rp))break}else w+=D.count;return{formatted:i.formatted,cursorOffset:w,comments:a}}return{formatted:i.formatted,cursorOffset:-1,comments:a}}async function sD(t,e){let{ast:r,text:n}=await zs(t,e),{rangeStart:s,rangeEnd:o}=nD(n,e,r),i=n.slice(s,o),a=Math.min(s,n.lastIndexOf(`
69
- `,s)+1),l=n.slice(a,s).match(/^\s*/u)[0],c=au(l,e.tabWidth),d=await _f(i,{...e,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:e.cursorOffset>s&&e.cursorOffset<=o?e.cursorOffset-s:-1,endOfLine:"lf"},c),f=d.formatted.trimEnd(),{cursorOffset:m}=e;m>o?m+=f.length-i.length:d.cursorOffset>=0&&(m=d.cursorOffset+s);let g=n.slice(0,s)+f+n.slice(o);if(e.endOfLine!=="lf"){let y=ru(e.endOfLine);m>=0&&y===`\r
70
- `&&(m+=rf(g.slice(0,m),`
71
- `)),g=Ai(!1,g,`
72
- `,y)}return{formatted:g,cursorOffset:m,comments:d.comments}}function Na(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function np(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:s}=e;return r=Na(t,r,-1),n=Na(t,n,0),s=Na(t,s,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:s}}function If(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:o}=np(t,e),i=t.charAt(0)===Lf;if(i&&(t=t.slice(1),r--,n--,s--),o==="auto"&&(o=L1(t)),t.includes("\r")){let a=l=>rf(t.slice(0,Math.max(l,0)),`\r
73
- `);r-=a(r),n-=a(n),s-=a(s),t=_1(t)}return{hasBOM:i,text:t,options:np(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:o})}}async function sp(t,e){let r=await du(e);return!r.hasPragma||r.hasPragma(t)}async function oD(t,e){var r;let n=await du(e);return(r=n.hasIgnorePragma)==null?void 0:r.call(n,t)}async function Rf(t,e){let{hasBOM:r,text:n,options:s}=If(t,await Rn(e));if(s.rangeStart>=s.rangeEnd&&n!==""||s.requirePragma&&!await sp(n,s)||s.checkIgnorePragma&&await oD(n,s))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let o;return s.rangeStart>0||s.rangeEnd<n.length?o=await sD(n,s):(!s.requirePragma&&s.insertPragma&&s.printer.insertPragma&&!await sp(n,s)&&(n=s.printer.insertPragma(n)),o=await _f(n,s)),r&&(o.formatted=Lf+o.formatted,o.cursorOffset>=0&&o.cursorOffset++),o}async function iD(t,e,r){let{text:n,options:s}=If(t,await Rn(e)),o=await zs(n,s);return r&&(r.preprocessForPrint&&(o.ast=await Bf(o.ast,s)),r.massage&&(o.ast=Gw(o.ast,s))),o}async function aD(t,e){e=await Rn(e);let r=await Oi(t,e);return Mi(r,e)}async function lD(t,e){let r=hv(t),{formatted:n}=await Rf(r,{...e,parser:"__js_expression"});return n}async function uD(t,e){e=await Rn(e);let{ast:r}=await zs(t,e);return e.cursorOffset>=0&&(e={...e,...jf(r,e)}),Oi(r,e)}async function cD(t,e){return Mi(t,await Rn(e))}var Pf={};tu(Pf,{builders:()=>dD,printer:()=>pD,utils:()=>hD});var dD={join:cf,line:lf,softline:dv,hardline:Wr,literalline:uf,group:of,conditionalGroup:ov,fill:iv,lineSuffix:ul,lineSuffixBoundary:uv,cursor:zr,breakParent:Ti,ifBreak:av,trim:cv,indent:_o,indentIfBreak:lv,align:An,addAlignmentToDoc:df,markAsRoot:nv,dedentToRoot:rv,dedent:sv,hardlineWithoutBreakParent:ou,literallineWithoutBreakParent:af,label:pv,concat:t=>t},pD={printDocToString:Mi},hD={willBreak:W1,traverseDoc:nu,findInDoc:su,mapDoc:Ni,removeLines:K1,stripTrailingHardline:sf,replaceEndOfLine:X1,canBreak:Z1},fD="3.6.2",zf={};tu(zf,{addDanglingComment:()=>_r,addLeadingComment:()=>ms,addTrailingComment:()=>gs,getAlignmentSize:()=>au,getIndentSize:()=>vD,getMaxContinuousCount:()=>CD,getNextNonSpaceNonCommentCharacter:()=>ED,getNextNonSpaceNonCommentCharacterIndex:()=>LD,getPreferredQuote:()=>FD,getStringWidth:()=>iu,hasNewline:()=>gr,hasNewlineInRange:()=>ND,hasSpaces:()=>MD,isNextLineEmpty:()=>PD,isNextLineEmptyAfterIndex:()=>mu,isPreviousLineEmpty:()=>ID,makeString:()=>jD,skip:()=>Ps,skipEverythingButNewLine:()=>mf,skipInlineComment:()=>pu,skipNewline:()=>Xr,skipSpaces:()=>wr,skipToLineEnd:()=>ff,skipTrailingComment:()=>hu,skipWhitespace:()=>Nv});function mD(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;r<t.length;++r)if(t.charAt(r)==="*"&&t.charAt(r+1)==="/")return r+2}return e}var pu=mD;function gD(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?mf(t,e):e}var hu=gD;function bD(t,e){let r=null,n=e;for(;n!==r;)r=n,n=wr(t,n),n=pu(t,n),n=hu(t,n),n=Xr(t,n);return n}var fu=bD;function yD(t,e){let r=null,n=e;for(;n!==r;)r=n,n=ff(t,n),n=pu(t,n),n=wr(t,n);return n=hu(t,n),n=Xr(t,n),n!==!1&&gr(t,n)}var mu=yD;function xD(t,e){let r=t.lastIndexOf(`
74
- `);return r===-1?0:au(t.slice(r+1).match(/^[\t ]*/u)[0],e)}var vD=xD;function wD(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function DD(t,e){let r=t.match(new RegExp(`(${wD(e)})+`,"gu"));return r===null?0:r.reduce((n,s)=>Math.max(n,s.length/e.length),0)}var CD=DD;function kD(t,e){let r=fu(t,e);return r===!1?"":t.charAt(r)}var ED=kD,go="'",op='"';function SD(t,e){let r=e===!0||e===go?go:op,n=r===go?op:go,s=0,o=0;for(let i of t)i===r?s++:i===n&&o++;return s>o?n:r}var FD=SD;function AD(t,e,r){for(let n=e;n<r;++n)if(t.charAt(n)===`
75
- `)return!0;return!1}var ND=AD;function TD(t,e,r={}){return wr(t,r.backwards?e-1:e,r)!==e}var MD=TD;function BD(t,e,r){let n=e==='"'?"'":'"',s=Ai(!1,t,/\\(.)|(["'])/gsu,(o,i,a)=>i===n?i:a===e?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(i)?i:"\\"+i));return e+s+e}var jD=BD;function OD(t,e,r){return fu(t,r(e))}function LD(t,e){return arguments.length===2||typeof e=="number"?fu(t,e):OD(...arguments)}function _D(t,e,r){return cu(t,r(e))}function ID(t,e){return arguments.length===2||typeof e=="number"?cu(t,e):_D(...arguments)}function RD(t,e,r){return mu(t,r(e))}function PD(t,e){return arguments.length===2||typeof e=="number"?mu(t,e):RD(...arguments)}function Ir(t,e=1){return async(...r)=>{let n=r[e]??{},s=n.plugins??[];return r[e]={...n,plugins:Array.isArray(s)?s:Object.values(s)},t(...r)}}var $f=Ir(Rf);async function gu(t,e){let{formatted:r}=await $f(t,{...e,cursorOffset:-1});return r}async function zD(t,e){return await gu(t,e)===t}var $D=Ir(wf,0),HD={parse:Ir(iD),formatAST:Ir(aD),formatDoc:Ir(lD),printToDoc:Ir(uD),printDocToString:Ir(cD)};function VD(t=""){const{actions:e,query:r}=Q.useEditor(),{getState:n,loadState:s}=Fi(),{convertFromHtml:o,convertToHtml:i}=Zl(),[a,l]=S.useState(t),[c,d]=S.useState(t),[f,m]=S.useState("idle"),[g,y]=S.useState(""),[v,w]=S.useState(!1),D=S.useCallback(async()=>{if(a.trim()){w(!0);try{const z=await gu(a,{parser:"html",plugins:[b1],printWidth:80,tabWidth:2,useTabs:!1,semi:!0,singleQuote:!1,trailingComma:"none",bracketSpacing:!0,htmlWhitespaceSensitivity:"css"});l(z)}catch(z){console.error("Error formatting HTML:",z);const I=a.replace(/>\s*</g,"><").replace(/\n\s*\n/g,`
52
+ The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function Df({plugins:t=[],showDeprecated:e=!1}={}){let r=t.flatMap(s=>s.languages??[]),n=[];for(let s of Zv(Object.assign({},...t.map(({options:o})=>o),Gv)))!e&&s.deprecated||(Array.isArray(s.choices)&&(e||(s.choices=s.choices.filter(o=>!o.deprecated)),s.name==="parser"&&(s.choices=[...s.choices,...Yv(s.choices,r,t)])),s.pluginDefaults=Object.fromEntries(t.filter(o=>{var i;return((i=o.defaultOptions)==null?void 0:i[s.name])!==void 0}).map(o=>[o.name,o.defaultOptions[s.name]])),n.push(s));return{languages:r,options:n}}function*Yv(t,e,r){let n=new Set(t.map(s=>s.value));for(let s of e)if(s.parsers){for(let o of s.parsers)if(!n.has(o)){n.add(o);let i=r.find(l=>l.parsers&&Object.prototype.hasOwnProperty.call(l.parsers,o)),a=s.name;i!=null&&i.name&&(a+=` (plugin: ${i.name})`),yield{value:o,description:a}}}}function Zv(t){let e=[];for(let[r,n]of Object.entries(t)){let s={name:r,...n};Array.isArray(s.default)&&(s.default=Te(!1,s.default,-1).value),e.push(s)}return e}var Xv=(t,e)=>{if(!(t&&e==null))return e.toReversed||!Array.isArray(e)?e.toReversed():[...e].reverse()},Qv=Xv,Pd,zd,$d,Hd,Vd,ew=((Pd=globalThis.Deno)==null?void 0:Pd.build.os)==="windows"||(($d=(zd=globalThis.navigator)==null?void 0:zd.platform)==null?void 0:$d.startsWith("Win"))||((Vd=(Hd=globalThis.process)==null?void 0:Hd.platform)==null?void 0:Vd.startsWith("win"))||!1;function Cf(t){if(t=t instanceof URL?t:new URL(t),t.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${t.protocol}"`);return t}function tw(t){return t=Cf(t),decodeURIComponent(t.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function rw(t){t=Cf(t);let e=decodeURIComponent(t.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return t.hostname!==""&&(e=`\\\\${t.hostname}${e}`),e}function nw(t){return ew?rw(t):tw(t)}var sw=nw,ow=t=>String(t).split(/[/\\]/u).pop();function qd(t,e){if(!e)return;let r=ow(e).toLowerCase();return t.find(({filenames:n})=>n?.some(s=>s.toLowerCase()===r))??t.find(({extensions:n})=>n?.some(s=>r.endsWith(s)))}function iw(t,e){if(e)return t.find(({name:r})=>r.toLowerCase()===e)??t.find(({aliases:r})=>r?.includes(e))??t.find(({extensions:r})=>r?.includes(`.${e}`))}function Wd(t,e){if(e){if(String(e).startsWith("file:"))try{e=sw(e)}catch{return}if(typeof e=="string")return t.find(({isSupported:r})=>r?.({filepath:e}))}}function aw(t,e){let r=Qv(!1,t.plugins).flatMap(s=>s.languages??[]),n=iw(r,e.language)??qd(r,e.physicalFile)??qd(r,e.file)??Wd(r,e.physicalFile)??Wd(r,e.file)??(e.physicalFile,void 0);return n?.parsers[0]}var lw=aw,kn={key:t=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?t:JSON.stringify(t),value(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(r=>kn.value(r)).join(", ")}]`;let e=Object.keys(t);return e.length===0?"{}":`{ ${e.map(r=>`${kn.key(r)}: ${kn.value(t[r])}`).join(", ")} }`},pair:({key:t,value:e})=>kn.value({[t]:e})},kf=new Proxy(String,{get:()=>kf}),Nt=kf,uw=(t,e,{descriptor:r})=>{let n=[`${Nt.yellow(typeof t=="string"?r.key(t):r.pair(t))} is deprecated`];return e&&n.push(`we now treat it as ${Nt.blue(typeof e=="string"?r.key(e):r.pair(e))}`),n.join("; ")+"."},Ef=Symbol.for("vnopts.VALUE_NOT_EXIST"),Bo=Symbol.for("vnopts.VALUE_UNCHANGED"),Ud=" ".repeat(2),cw=(t,e,r)=>{let{text:n,list:s}=r.normalizeExpectedResult(r.schemas[t].expected(r)),o=[];return n&&o.push(Kd(t,e,n,r.descriptor)),s&&o.push([Kd(t,e,s.title,r.descriptor)].concat(s.values.map(i=>Sf(i,r.loggerPrintWidth))).join(`
53
+ `)),Ff(o,r.loggerPrintWidth)};function Kd(t,e,r,n){return[`Invalid ${Nt.red(n.key(t))} value.`,`Expected ${Nt.blue(r)},`,`but received ${e===Ef?Nt.gray("nothing"):Nt.red(n.value(e))}.`].join(" ")}function Sf({text:t,list:e},r){let n=[];return t&&n.push(`- ${Nt.blue(t)}`),e&&n.push([`- ${Nt.blue(e.title)}:`].concat(e.values.map(s=>Sf(s,r-Ud.length).replace(/^|\n/g,`$&${Ud}`))).join(`
54
+ `)),Ff(n,r)}function Ff(t,e){if(t.length===1)return t[0];let[r,n]=t,[s,o]=t.map(i=>i.split(`
55
+ `,1)[0].length);return s>e&&s>o?n:r}var Ta=[],Jd=[];function dw(t,e){if(t===e)return 0;let r=t;t.length>e.length&&(t=e,e=r);let n=t.length,s=e.length;for(;n>0&&t.charCodeAt(~-n)===e.charCodeAt(~-s);)n--,s--;let o=0;for(;o<n&&t.charCodeAt(o)===e.charCodeAt(o);)o++;if(n-=o,s-=o,n===0)return s;let i,a,l,c,d=0,f=0;for(;d<n;)Jd[d]=t.charCodeAt(o+d),Ta[d]=++d;for(;f<s;)for(i=e.charCodeAt(o+f),l=f++,a=f,d=0;d<n;d++)c=i===Jd[d]?l:l+1,l=Ta[d],a=Ta[d]=l>a?c>a?a+1:c:c>l?l+1:c;return a}var Af=(t,e,{descriptor:r,logger:n,schemas:s})=>{let o=[`Ignored unknown option ${Nt.yellow(r.pair({key:t,value:e}))}.`],i=Object.keys(s).sort().find(a=>dw(t,a)<3);i&&o.push(`Did you mean ${Nt.blue(r.key(i))}?`),n.warn(o.join(" "))},pw=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function hw(t,e){let r=new t(e),n=Object.create(r);for(let s of pw)s in e&&(n[s]=fw(e[s],r,Sr.prototype[s].length));return n}var Sr=class{static create(t){return hw(this,t)}constructor(t){this.name=t.name}default(t){}expected(t){return"nothing"}validate(t,e){return!1}deprecated(t,e){return!1}forward(t,e){}redirect(t,e){}overlap(t,e,r){return t}preprocess(t,e){return t}postprocess(t,e){return Bo}};function fw(t,e,r){return typeof t=="function"?(...n)=>t(...n.slice(0,r-1),e,...n.slice(r-1)):()=>t}var mw=class extends Sr{constructor(e){super(e),this._sourceName=e.sourceName}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,r){return r.schemas[this._sourceName].validate(e,r)}redirect(e,r){return this._sourceName}},gw=class extends Sr{expected(){return"anything"}validate(){return!0}},bw=class extends Sr{constructor({valueSchema:t,name:e=t.name,...r}){super({...r,name:e}),this._valueSchema=t}expected(t){let{text:e,list:r}=t.normalizeExpectedResult(this._valueSchema.expected(t));return{text:e&&`an array of ${e}`,list:r&&{title:"an array of the following values",values:[{list:r}]}}}validate(t,e){if(!Array.isArray(t))return!1;let r=[];for(let n of t){let s=e.normalizeValidateResult(this._valueSchema.validate(n,e),n);s!==!0&&r.push(s.value)}return r.length===0?!0:{value:r}}deprecated(t,e){let r=[];for(let n of t){let s=e.normalizeDeprecatedResult(this._valueSchema.deprecated(n,e),n);s!==!1&&r.push(...s.map(({value:o})=>({value:[o]})))}return r}forward(t,e){let r=[];for(let n of t){let s=e.normalizeForwardResult(this._valueSchema.forward(n,e),n);r.push(...s.map(Gd))}return r}redirect(t,e){let r=[],n=[];for(let s of t){let o=e.normalizeRedirectResult(this._valueSchema.redirect(s,e),s);"remain"in o&&r.push(o.remain),n.push(...o.redirect.map(Gd))}return r.length===0?{redirect:n}:{redirect:n,remain:r}}overlap(t,e){return t.concat(e)}};function Gd({from:t,to:e}){return{from:[t],to:e}}var yw=class extends Sr{expected(){return"true or false"}validate(t){return typeof t=="boolean"}};function xw(t,e){let r=Object.create(null);for(let n of t){let s=n[e];if(r[s])throw new Error(`Duplicate ${e} ${JSON.stringify(s)}`);r[s]=n}return r}function vw(t,e){let r=new Map;for(let n of t){let s=n[e];if(r.has(s))throw new Error(`Duplicate ${e} ${JSON.stringify(s)}`);r.set(s,n)}return r}function ww(){let t=Object.create(null);return e=>{let r=JSON.stringify(e);return t[r]?!0:(t[r]=!0,!1)}}function Dw(t,e){let r=[],n=[];for(let s of t)e(s)?r.push(s):n.push(s);return[r,n]}function Cw(t){return t===Math.floor(t)}function kw(t,e){if(t===e)return 0;let r=typeof t,n=typeof e,s=["undefined","object","boolean","number","string"];return r!==n?s.indexOf(r)-s.indexOf(n):r!=="string"?Number(t)-Number(e):t.localeCompare(e)}function Ew(t){return(...e)=>{let r=t(...e);return typeof r=="string"?new Error(r):r}}function Yd(t){return t===void 0?{}:t}function Nf(t){if(typeof t=="string")return{text:t};let{text:e,list:r}=t;return Sw((e||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:e,list:{title:r.title,values:r.values.map(Nf)}}:{text:e}}function Zd(t,e){return t===!0?!0:t===!1?{value:e}:t}function Xd(t,e,r=!1){return t===!1?!1:t===!0?r?!0:[{value:e}]:"value"in t?[t]:t.length===0?!1:t}function Qd(t,e){return typeof t=="string"||"key"in t?{from:e,to:t}:"from"in t?{from:t.from,to:t.to}:{from:e,to:t.to}}function bl(t,e){return t===void 0?[]:Array.isArray(t)?t.map(r=>Qd(r,e)):[Qd(t,e)]}function ep(t,e){let r=bl(typeof t=="object"&&"redirect"in t?t.redirect:t,e);return r.length===0?{remain:e,redirect:r}:typeof t=="object"&&"remain"in t?{remain:t.remain,redirect:r}:{redirect:r}}function Sw(t,e){if(!t)throw new Error(e)}var Fw=class extends Sr{constructor(t){super(t),this._choices=vw(t.choices.map(e=>e&&typeof e=="object"?e:{value:e}),"value")}expected({descriptor:t}){let e=Array.from(this._choices.keys()).map(s=>this._choices.get(s)).filter(({hidden:s})=>!s).map(s=>s.value).sort(kw).map(t.value),r=e.slice(0,-2),n=e.slice(-2);return{text:r.concat(n.join(" or ")).join(", "),list:{title:"one of the following values",values:e}}}validate(t){return this._choices.has(t)}deprecated(t){let e=this._choices.get(t);return e&&e.deprecated?{value:t}:!1}forward(t){let e=this._choices.get(t);return e?e.forward:void 0}redirect(t){let e=this._choices.get(t);return e?e.redirect:void 0}},Aw=class extends Sr{expected(){return"a number"}validate(t,e){return typeof t=="number"}},Nw=class extends Aw{expected(){return"an integer"}validate(t,e){return e.normalizeValidateResult(super.validate(t,e),t)===!0&&Cw(t)}},tp=class extends Sr{expected(){return"a string"}validate(t){return typeof t=="string"}},Tw=kn,Mw=Af,Bw=cw,jw=uw,Ow=class{constructor(t,e){let{logger:r=console,loggerPrintWidth:n=80,descriptor:s=Tw,unknown:o=Mw,invalid:i=Bw,deprecated:a=jw,missing:l=()=>!1,required:c=()=>!1,preprocess:d=m=>m,postprocess:f=()=>Bo}=e||{};this._utils={descriptor:s,logger:r||{warn:()=>{}},loggerPrintWidth:n,schemas:xw(t,"name"),normalizeDefaultResult:Yd,normalizeExpectedResult:Nf,normalizeDeprecatedResult:Xd,normalizeForwardResult:bl,normalizeRedirectResult:ep,normalizeValidateResult:Zd},this._unknownHandler=o,this._invalidHandler=Ew(i),this._deprecatedHandler=a,this._identifyMissing=(m,g)=>!(m in g)||l(m,g),this._identifyRequired=c,this._preprocess=d,this._postprocess=f,this.cleanHistory()}cleanHistory(){this._hasDeprecationWarned=ww()}normalize(t){let e={},r=[this._preprocess(t,this._utils)],n=()=>{for(;r.length!==0;){let s=r.shift(),o=this._applyNormalization(s,e);r.push(...o)}};n();for(let s of Object.keys(this._utils.schemas)){let o=this._utils.schemas[s];if(!(s in e)){let i=Yd(o.default(this._utils));"value"in i&&r.push({[s]:i.value})}}n();for(let s of Object.keys(this._utils.schemas)){if(!(s in e))continue;let o=this._utils.schemas[s],i=e[s],a=o.postprocess(i,this._utils);a!==Bo&&(this._applyValidation(a,s,o),e[s]=a)}return this._applyPostprocess(e),this._applyRequiredCheck(e),e}_applyNormalization(t,e){let r=[],{knownKeys:n,unknownKeys:s}=this._partitionOptionKeys(t);for(let o of n){let i=this._utils.schemas[o],a=i.preprocess(t[o],this._utils);this._applyValidation(a,o,i);let l=({from:f,to:m})=>{r.push(typeof m=="string"?{[m]:f}:{[m.key]:m.value})},c=({value:f,redirectTo:m})=>{let g=Xd(i.deprecated(f,this._utils),a,!0);if(g!==!1)if(g===!0)this._hasDeprecationWarned(o)||this._utils.logger.warn(this._deprecatedHandler(o,m,this._utils));else for(let{value:y}of g){let x={key:o,value:y};if(!this._hasDeprecationWarned(x)){let w=typeof m=="string"?{key:m,value:y}:m;this._utils.logger.warn(this._deprecatedHandler(x,w,this._utils))}}};bl(i.forward(a,this._utils),a).forEach(l);let d=ep(i.redirect(a,this._utils),a);if(d.redirect.forEach(l),"remain"in d){let f=d.remain;e[o]=o in e?i.overlap(e[o],f,this._utils):f,c({value:f})}for(let{from:f,to:m}of d.redirect)c({value:f,redirectTo:m})}for(let o of s){let i=t[o];this._applyUnknownHandler(o,i,e,(a,l)=>{r.push({[a]:l})})}return r}_applyRequiredCheck(t){for(let e of Object.keys(this._utils.schemas))if(this._identifyMissing(e,t)&&this._identifyRequired(e))throw this._invalidHandler(e,Ef,this._utils)}_partitionOptionKeys(t){let[e,r]=Dw(Object.keys(t).filter(n=>!this._identifyMissing(n,t)),n=>n in this._utils.schemas);return{knownKeys:e,unknownKeys:r}}_applyValidation(t,e,r){let n=Zd(r.validate(t,this._utils),t);if(n!==!0)throw this._invalidHandler(e,n.value,this._utils)}_applyUnknownHandler(t,e,r,n){let s=this._unknownHandler(t,e,this._utils);if(s)for(let o of Object.keys(s)){if(this._identifyMissing(o,s))continue;let i=s[o];o in this._utils.schemas?n(o,i):r[o]=i}}_applyPostprocess(t){let e=this._postprocess(t,this._utils);if(e!==Bo){if(e.delete)for(let r of e.delete)delete t[r];if(e.override){let{knownKeys:r,unknownKeys:n}=this._partitionOptionKeys(e.override);for(let s of r){let o=e.override[s];this._applyValidation(o,s,this._utils.schemas[s]),t[s]=o}for(let s of n){let o=e.override[s];this._applyUnknownHandler(s,o,t,(i,a)=>{let l=this._utils.schemas[i];this._applyValidation(a,i,l),t[i]=a})}}}}},Ma;function Lw(t,e,{logger:r=!1,isCLI:n=!1,passThrough:s=!1,FlagSchema:o,descriptor:i}={}){if(n){if(!o)throw new Error("'FlagSchema' option is required.");if(!i)throw new Error("'descriptor' option is required.")}else i=kn;let a=s?Array.isArray(s)?(m,g)=>s.includes(m)?{[m]:g}:void 0:(m,g)=>({[m]:g}):(m,g,y)=>{let{_:x,...w}=y.schemas;return Af(m,g,{...y,schemas:w})},l=_w(e,{isCLI:n,FlagSchema:o}),c=new Ow(l,{logger:r,unknown:a,descriptor:i}),d=r!==!1;d&&Ma&&(c._hasDeprecationWarned=Ma);let f=c.normalize(t);return d&&(Ma=c._hasDeprecationWarned),f}function _w(t,{isCLI:e,FlagSchema:r}){let n=[];e&&n.push(gw.create({name:"_"}));for(let s of t)n.push(Iw(s,{isCLI:e,optionInfos:t,FlagSchema:r})),s.alias&&e&&n.push(mw.create({name:s.alias,sourceName:s.name}));return n}function Iw(t,{isCLI:e,optionInfos:r,FlagSchema:n}){let{name:s}=t,o={name:s},i,a={};switch(t.type){case"int":i=Nw,e&&(o.preprocess=Number);break;case"string":i=tp;break;case"choice":i=Fw,o.choices=t.choices.map(l=>l!=null&&l.redirect?{...l,redirect:{to:{key:t.name,value:l.redirect}}}:l);break;case"boolean":i=yw;break;case"flag":i=n,o.flags=r.flatMap(l=>[l.alias,l.description&&l.name,l.oppositeDescription&&`no-${l.name}`].filter(Boolean));break;case"path":i=tp;break;default:throw new Error(`Unexpected type ${t.type}`)}if(t.exception?o.validate=(l,c,d)=>t.exception(l)||c.validate(l,d):o.validate=(l,c,d)=>l===void 0||c.validate(l,d),t.redirect&&(a.redirect=l=>l?{to:typeof t.redirect=="string"?t.redirect:{key:t.redirect.option,value:t.redirect.value}}:void 0),t.deprecated&&(a.deprecated=!0),e&&!t.array){let l=o.preprocess||(c=>c);o.preprocess=(c,d,f)=>d.preprocess(l(Array.isArray(c)?Te(!1,c,-1):c),f)}return t.array?bw.create({...e?{preprocess:l=>Array.isArray(l)?l:[l]}:{},...a,valueSchema:i.create(o)}):i.create({...o,...a})}var Rw=Lw,Pw=(t,e,r)=>{if(!(t&&e==null)){if(e.findLast)return e.findLast(r);for(let n=e.length-1;n>=0;n--){let s=e[n];if(r(s,n,e))return s}}},Tf=Pw;function Mf(t,e){if(!e)throw new Error("parserName is required.");let r=Tf(!1,t,s=>s.parsers&&Object.prototype.hasOwnProperty.call(s.parsers,e));if(r)return r;let n=`Couldn't resolve parser "${e}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new wf(n)}function zw(t,e){if(!e)throw new Error("astFormat is required.");let r=Tf(!1,t,s=>s.printers&&Object.prototype.hasOwnProperty.call(s.printers,e));if(r)return r;let n=`Couldn't find plugin for AST format "${e}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new wf(n)}function fu({plugins:t,parser:e}){let r=Mf(t,e);return Bf(r,e)}function Bf(t,e){let r=t.parsers[e];return typeof r=="function"?r():r}function $w(t,e){let r=t.printers[e];return typeof r=="function"?r():r}var rp={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function Hw(t,e={}){var r;let n={...t};if(!n.parser)if(n.filepath){if(n.parser=lw(n,{physicalFile:n.filepath}),!n.parser)throw new Rd(`No parser could be inferred for file "${n.filepath}".`)}else throw new Rd("No parser and no file path given, couldn't infer a parser.");let s=Df({plugins:t.plugins,showDeprecated:!0}).options,o={...rp,...Object.fromEntries(s.filter(m=>m.default!==void 0).map(m=>[m.name,m.default]))},i=Mf(n.plugins,n.parser),a=await Bf(i,n.parser);n.astFormat=a.astFormat,n.locEnd=a.locEnd,n.locStart=a.locStart;let l=(r=i.printers)!=null&&r[a.astFormat]?i:zw(n.plugins,a.astFormat),c=await $w(l,a.astFormat);n.printer=c;let d=l.defaultOptions?Object.fromEntries(Object.entries(l.defaultOptions).filter(([,m])=>m!==void 0)):{},f={...o,...d};for(let[m,g]of Object.entries(f))(n[m]===null||n[m]===void 0)&&(n[m]=g);return n.parser==="json"&&(n.trailingComma="none"),Rw(n,s,{passThrough:Object.keys(rp),...e})}var zn=Hw,Vw=A1(M1());async function qw(t,e){let r=await fu(e),n=r.preprocess?r.preprocess(t,e):t;e.originalText=n;let s;try{s=await r.parse(n,e,e)}catch(o){Ww(o,t)}return{text:n,ast:s}}function Ww(t,e){let{loc:r}=t;if(r){let n=(0,Vw.codeFrameColumns)(e,r,{highlightCode:!0});throw t.message+=`
56
+ `+n,t.codeFrame=n,t}throw t}var $s=qw;async function Uw(t,e,r,n,s){let{embeddedLanguageFormatting:o,printer:{embed:i,hasPrettierIgnore:a=()=>!1,getVisitorKeys:l}}=r;if(!i||o!=="auto")return;if(i.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let c=_i(i.getVisitorKeys??l),d=[];g();let f=t.stack;for(let{print:y,node:x,pathStack:w}of d)try{t.stack=w;let D=await y(m,e,t,r);D&&s.set(x,D)}catch(D){if(globalThis.PRETTIER_DEBUG)throw D}t.stack=f;function m(y,x){return Kw(y,x,r,n)}function g(){let{node:y}=t;if(y===null||typeof y!="object"||a(t))return;for(let w of c(y))Array.isArray(y[w])?t.each(g,w):t.call(g,w);let x=i(t,r);if(x){if(typeof x=="function"){d.push({print:x,node:y,pathStack:[...t.stack]});return}s.set(y,x)}}}async function Kw(t,e,r,n){let s=await zn({...r,...e,parentParser:r.parser,originalText:t,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:!0}),{ast:o}=await $s(t,s),i=await n(o,s);return of(i)}function Jw(t,e){let{originalText:r,[Symbol.for("comments")]:n,locStart:s,locEnd:o,[Symbol.for("printedComments")]:i}=e,{node:a}=t,l=s(a),c=o(a);for(let d of n)s(d)>=l&&o(d)<=c&&i.add(d);return r.slice(l,c)}var Gw=Jw;async function Ii(t,e){({ast:t}=await jf(t,e));let r=new Map,n=new Fv(t),s=new Map;await Uw(n,i,e,Ii,s);let o=await np(n,e,i,void 0,s);if(Jv(e),e.cursorOffset>=0){if(e.nodeAfterCursor&&!e.nodeBeforeCursor)return[$r,o];if(e.nodeBeforeCursor&&!e.nodeAfterCursor)return[o,$r]}return o;function i(l,c){return l===void 0||l===n?a(c):Array.isArray(l)?n.call(()=>a(c),...l):n.call(()=>a(c),l)}function a(l){let c=n.node;if(c==null)return"";let d=c&&typeof c=="object"&&l===void 0;if(d&&r.has(c))return r.get(c);let f=np(n,e,i,l,s);return d&&r.set(c,f),f}}function np(t,e,r,n,s){var o;let{node:i}=t,{printer:a}=e,l;switch((o=a.hasPrettierIgnore)!=null&&o.call(a,t)?l=Gw(t,e):s.has(i)?l=s.get(i):l=a.print(t,e,r,n),i){case e.cursorNode:l=To(l,c=>[$r,c,$r]);break;case e.nodeBeforeCursor:l=To(l,c=>[c,$r]);break;case e.nodeAfterCursor:l=To(l,c=>[$r,c]);break}return a.printComment&&(!a.willPrintOwnComments||!a.willPrintOwnComments(t,e))&&(l=Kv(t,l,e)),l}async function jf(t,e){let r=t.comments??[];e[Symbol.for("comments")]=r,e[Symbol.for("printedComments")]=new Set,zv(t,e);let{printer:{preprocess:n}}=e;return t=n?await n(t,e):t,{ast:t,comments:r}}function Yw(t,e){let{cursorOffset:r,locStart:n,locEnd:s}=e,o=_i(e.printer.getVisitorKeys),i=g=>n(g)<=r&&s(g)>=r,a=t,l=[t];for(let g of Tv(t,{getVisitorKeys:o,filter:i}))l.push(g),a=g;if(Mv(a,{getVisitorKeys:o}))return{cursorNode:a};let c,d,f=-1,m=Number.POSITIVE_INFINITY;for(;l.length>0&&(c===void 0||d===void 0);){a=l.pop();let g=c!==void 0,y=d!==void 0;for(let x of Li(a,{getVisitorKeys:o})){if(!g){let w=s(x);w<=r&&w>f&&(c=x,f=w)}if(!y){let w=n(x);w>=r&&w<m&&(d=x,m=w)}}}return{nodeBeforeCursor:c,nodeAfterCursor:d}}var Of=Yw;function Zw(t,e){let{printer:{massageAstNode:r,getVisitorKeys:n}}=e;if(!r)return t;let s=_i(n),o=r.ignoredProperties??new Set;return i(t);function i(a,l){if(!(a!==null&&typeof a=="object"))return a;if(Array.isArray(a))return a.map(m=>i(m,l)).filter(Boolean);let c={},d=new Set(s(a));for(let m in a)!Object.prototype.hasOwnProperty.call(a,m)||o.has(m)||(d.has(m)?c[m]=i(a[m],a):c[m]=a[m]);let f=r(a,c,l);if(f!==null)return f??c}}var Xw=Zw,Qw=(t,e,r)=>{if(!(t&&e==null)){if(e.findLastIndex)return e.findLastIndex(r);for(let n=e.length-1;n>=0;n--){let s=e[n];if(r(s,n,e))return n}return-1}},eD=Qw,tD=({parser:t})=>t==="json"||t==="json5"||t==="jsonc"||t==="json-stringify";function rD(t,e){let r=[t.node,...t.parentNodes],n=new Set([e.node,...e.parentNodes]);return r.find(s=>Lf.has(s.type)&&n.has(s))}function sp(t){let e=eD(!1,t,r=>r.type!=="Program"&&r.type!=="File");return e===-1?t:t.slice(0,e+1)}function nD(t,e,{locStart:r,locEnd:n}){let s=t.node,o=e.node;if(s===o)return{startNode:s,endNode:o};let i=r(t.node);for(let l of sp(e.parentNodes))if(r(l)>=i)o=l;else break;let a=n(e.node);for(let l of sp(t.parentNodes)){if(n(l)<=a)s=l;else break;if(s===o)break}return{startNode:s,endNode:o}}function yl(t,e,r,n,s=[],o){let{locStart:i,locEnd:a}=r,l=i(t),c=a(t);if(!(e>c||e<l||o==="rangeEnd"&&e===l||o==="rangeStart"&&e===c)){for(let d of pu(t,r)){let f=yl(d,e,r,n,[t,...s],o);if(f)return f}if(!n||n(t,s[0]))return{node:t,parentNodes:s}}}function sD(t,e){return e!=="DeclareExportDeclaration"&&t!=="TypeParameterDeclaration"&&(t==="Directive"||t==="TypeAlias"||t==="TSExportAssignment"||t.startsWith("Declare")||t.startsWith("TSDeclare")||t.endsWith("Statement")||t.endsWith("Declaration"))}var Lf=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),oD=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function op(t,e,r){if(!e)return!1;switch(t.parser){case"flow":case"hermes":case"babel":case"babel-flow":case"babel-ts":case"typescript":case"acorn":case"espree":case"meriyah":case"oxc":case"oxc-ts":case"__babel_estree":return sD(e.type,r?.type);case"json":case"json5":case"jsonc":case"json-stringify":return Lf.has(e.type);case"graphql":return oD.has(e.kind);case"vue":return e.tag!=="root"}return!1}function iD(t,e,r){let{rangeStart:n,rangeEnd:s,locStart:o,locEnd:i}=e;gl.ok(s>n);let a=t.slice(n,s).search(/\S/u),l=a===-1;if(!l)for(n+=a;s>n&&!/\S/u.test(t[s-1]);--s);let c=yl(r,n,e,(g,y)=>op(e,g,y),[],"rangeStart"),d=l?c:yl(r,s,e,g=>op(e,g),[],"rangeEnd");if(!c||!d)return{rangeStart:0,rangeEnd:0};let f,m;if(tD(e)){let g=rD(c,d);f=g,m=g}else({startNode:f,endNode:m}=nD(c,d,e));return{rangeStart:Math.min(o(f),o(m)),rangeEnd:Math.max(i(f),i(m))}}var _f="\uFEFF",ip=Symbol("cursor");async function If(t,e,r=0){if(!t||t.trim().length===0)return{formatted:"",cursorOffset:-1,comments:[]};let{ast:n,text:s}=await $s(t,e);e.cursorOffset>=0&&(e={...e,...Of(n,e)});let o=await Ii(n,e);r>0&&(o=pf([Ur,o],r,e.tabWidth));let i=Oi(o,e);if(r>0){let l=i.formatted.trim();i.cursorNodeStart!==void 0&&(i.cursorNodeStart-=i.formatted.indexOf(l),i.cursorNodeStart<0&&(i.cursorNodeStart=0,i.cursorNodeText=i.cursorNodeText.trimStart()),i.cursorNodeStart+i.cursorNodeText.length>l.length&&(i.cursorNodeText=i.cursorNodeText.trimEnd())),i.formatted=l+ou(e.endOfLine)}let a=e[Symbol.for("comments")];if(e.cursorOffset>=0){let l,c,d,f;if((e.cursorNode||e.nodeBeforeCursor||e.nodeAfterCursor)&&i.cursorNodeText)if(d=i.cursorNodeStart,f=i.cursorNodeText,e.cursorNode)l=e.locStart(e.cursorNode),c=s.slice(l,e.locEnd(e.cursorNode));else{if(!e.nodeBeforeCursor&&!e.nodeAfterCursor)throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");l=e.nodeBeforeCursor?e.locEnd(e.nodeBeforeCursor):0;let D=e.nodeAfterCursor?e.locStart(e.nodeAfterCursor):s.length;c=s.slice(l,D)}else l=0,c=s,d=0,f=i.formatted;let m=e.cursorOffset-l;if(c===f)return{formatted:i.formatted,cursorOffset:d+m,comments:a};let g=c.split("");g.splice(m,0,ip);let y=f.split(""),x=I1(g,y),w=d;for(let D of x)if(D.removed){if(D.value.includes(ip))break}else w+=D.count;return{formatted:i.formatted,cursorOffset:w,comments:a}}return{formatted:i.formatted,cursorOffset:-1,comments:a}}async function aD(t,e){let{ast:r,text:n}=await $s(t,e),{rangeStart:s,rangeEnd:o}=iD(n,e,r),i=n.slice(s,o),a=Math.min(s,n.lastIndexOf(`
57
+ `,s)+1),l=n.slice(a,s).match(/^\s*/u)[0],c=cu(l,e.tabWidth),d=await If(i,{...e,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:e.cursorOffset>s&&e.cursorOffset<=o?e.cursorOffset-s:-1,endOfLine:"lf"},c),f=d.formatted.trimEnd(),{cursorOffset:m}=e;m>o?m+=f.length-i.length:d.cursorOffset>=0&&(m=d.cursorOffset+s);let g=n.slice(0,s)+f+n.slice(o);if(e.endOfLine!=="lf"){let y=ou(e.endOfLine);m>=0&&y===`\r
58
+ `&&(m+=nf(g.slice(0,m),`
59
+ `)),g=Mi(!1,g,`
60
+ `,y)}return{formatted:g,cursorOffset:m,comments:d.comments}}function Ba(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function ap(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:s}=e;return r=Ba(t,r,-1),n=Ba(t,n,0),s=Ba(t,s,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:s}}function Rf(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:o}=ap(t,e),i=t.charAt(0)===_f;if(i&&(t=t.slice(1),r--,n--,s--),o==="auto"&&(o=R1(t)),t.includes("\r")){let a=l=>nf(t.slice(0,Math.max(l,0)),`\r
61
+ `);r-=a(r),n-=a(n),s-=a(s),t=P1(t)}return{hasBOM:i,text:t,options:ap(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:o})}}async function lp(t,e){let r=await fu(e);return!r.hasPragma||r.hasPragma(t)}async function lD(t,e){var r;let n=await fu(e);return(r=n.hasIgnorePragma)==null?void 0:r.call(n,t)}async function Pf(t,e){let{hasBOM:r,text:n,options:s}=Rf(t,await zn(e));if(s.rangeStart>=s.rangeEnd&&n!==""||s.requirePragma&&!await lp(n,s)||s.checkIgnorePragma&&await lD(n,s))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let o;return s.rangeStart>0||s.rangeEnd<n.length?o=await aD(n,s):(!s.requirePragma&&s.insertPragma&&s.printer.insertPragma&&!await lp(n,s)&&(n=s.printer.insertPragma(n)),o=await If(n,s)),r&&(o.formatted=_f+o.formatted,o.cursorOffset>=0&&o.cursorOffset++),o}async function uD(t,e,r){let{text:n,options:s}=Rf(t,await zn(e)),o=await $s(n,s);return r&&(r.preprocessForPrint&&(o.ast=await jf(o.ast,s)),r.massage&&(o.ast=Xw(o.ast,s))),o}async function cD(t,e){e=await zn(e);let r=await Ii(t,e);return Oi(r,e)}async function dD(t,e){let r=gv(t),{formatted:n}=await Pf(r,{...e,parser:"__js_expression"});return n}async function pD(t,e){e=await zn(e);let{ast:r}=await $s(t,e);return e.cursorOffset>=0&&(e={...e,...Of(r,e)}),Ii(r,e)}async function hD(t,e){return Oi(t,await zn(e))}var zf={};su(zf,{builders:()=>fD,printer:()=>mD,utils:()=>gD});var fD={join:df,line:uf,softline:fv,hardline:Ur,literalline:cf,group:af,conditionalGroup:lv,fill:uv,lineSuffix:dl,lineSuffixBoundary:pv,cursor:$r,breakParent:ji,ifBreak:cv,trim:hv,indent:Po,indentIfBreak:dv,align:Nn,addAlignmentToDoc:pf,markAsRoot:iv,dedentToRoot:ov,dedent:av,hardlineWithoutBreakParent:lu,literallineWithoutBreakParent:lf,label:mv,concat:t=>t},mD={printDocToString:Oi},gD={willBreak:J1,traverseDoc:iu,findInDoc:au,mapDoc:Bi,removeLines:Z1,stripTrailingHardline:of,replaceEndOfLine:ev,canBreak:rv},bD="3.6.2",$f={};su($f,{addDanglingComment:()=>Ir,addLeadingComment:()=>bs,addTrailingComment:()=>ys,getAlignmentSize:()=>cu,getIndentSize:()=>CD,getMaxContinuousCount:()=>SD,getNextNonSpaceNonCommentCharacter:()=>AD,getNextNonSpaceNonCommentCharacterIndex:()=>RD,getPreferredQuote:()=>TD,getStringWidth:()=>uu,hasNewline:()=>gr,hasNewlineInRange:()=>BD,hasSpaces:()=>OD,isNextLineEmpty:()=>HD,isNextLineEmptyAfterIndex:()=>yu,isPreviousLineEmpty:()=>zD,makeString:()=>_D,skip:()=>zs,skipEverythingButNewLine:()=>gf,skipInlineComment:()=>mu,skipNewline:()=>Xr,skipSpaces:()=>Dr,skipToLineEnd:()=>mf,skipTrailingComment:()=>gu,skipWhitespace:()=>Bv});function yD(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;r<t.length;++r)if(t.charAt(r)==="*"&&t.charAt(r+1)==="/")return r+2}return e}var mu=yD;function xD(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?gf(t,e):e}var gu=xD;function vD(t,e){let r=null,n=e;for(;n!==r;)r=n,n=Dr(t,n),n=mu(t,n),n=gu(t,n),n=Xr(t,n);return n}var bu=vD;function wD(t,e){let r=null,n=e;for(;n!==r;)r=n,n=mf(t,n),n=mu(t,n),n=Dr(t,n);return n=gu(t,n),n=Xr(t,n),n!==!1&&gr(t,n)}var yu=wD;function DD(t,e){let r=t.lastIndexOf(`
62
+ `);return r===-1?0:cu(t.slice(r+1).match(/^[\t ]*/u)[0],e)}var CD=DD;function kD(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ED(t,e){let r=t.match(new RegExp(`(${kD(e)})+`,"gu"));return r===null?0:r.reduce((n,s)=>Math.max(n,s.length/e.length),0)}var SD=ED;function FD(t,e){let r=bu(t,e);return r===!1?"":t.charAt(r)}var AD=FD,bo="'",up='"';function ND(t,e){let r=e===!0||e===bo?bo:up,n=r===bo?up:bo,s=0,o=0;for(let i of t)i===r?s++:i===n&&o++;return s>o?n:r}var TD=ND;function MD(t,e,r){for(let n=e;n<r;++n)if(t.charAt(n)===`
63
+ `)return!0;return!1}var BD=MD;function jD(t,e,r={}){return Dr(t,r.backwards?e-1:e,r)!==e}var OD=jD;function LD(t,e,r){let n=e==='"'?"'":'"',s=Mi(!1,t,/\\(.)|(["'])/gsu,(o,i,a)=>i===n?i:a===e?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(i)?i:"\\"+i));return e+s+e}var _D=LD;function ID(t,e,r){return bu(t,r(e))}function RD(t,e){return arguments.length===2||typeof e=="number"?bu(t,e):ID(...arguments)}function PD(t,e,r){return hu(t,r(e))}function zD(t,e){return arguments.length===2||typeof e=="number"?hu(t,e):PD(...arguments)}function $D(t,e,r){return yu(t,r(e))}function HD(t,e){return arguments.length===2||typeof e=="number"?yu(t,e):$D(...arguments)}function Rr(t,e=1){return async(...r)=>{let n=r[e]??{},s=n.plugins??[];return r[e]={...n,plugins:Array.isArray(s)?s:Object.values(s)},t(...r)}}var Hf=Rr(Pf);async function xu(t,e){let{formatted:r}=await Hf(t,{...e,cursorOffset:-1});return r}async function VD(t,e){return await xu(t,e)===t}var qD=Rr(Df,0),WD={parse:Rr(uD),formatAST:Rr(cD),formatDoc:Rr(dD),printToDoc:Rr(pD),printDocToString:Rr(hD)};function UD(t=""){const{actions:e,query:r}=Q.useEditor(),{getState:n,loadState:s}=tu(),{convertFromHtml:o,convertToHtml:i}=ru(),[a,l]=F.useState(t),[c,d]=F.useState(t),[f,m]=F.useState("idle"),[g,y]=F.useState(""),[x,w]=F.useState(!1),D=F.useCallback(async()=>{if(a.trim()){w(!0);try{const P=await xu(a,{parser:"html",plugins:[v1],printWidth:80,tabWidth:2,useTabs:!1,semi:!0,singleQuote:!1,trailingComma:"none",bracketSpacing:!0,htmlWhitespaceSensitivity:"css"});l(P)}catch(P){console.error("Error formatting HTML:",P);const L=a.replace(/>\s*</g,"><").replace(/\n\s*\n/g,`
76
64
  `).split(`
77
- `).map(q=>q.trim()).filter(q=>q).join(`
78
- `);l(I)}finally{w(!1)}}},[a]),E=S.useRef(null),N=S.useRef(!1),A=a!==c;S.useEffect(()=>{if(!N.current&&e&&r)try{const z=i(n());z&&z.trim()&&(l(z),d(z)),N.current=!0}catch(z){console.warn("Could not initialize code from canvas:",z)}},[e,r]);const T=S.useCallback(async()=>{if(a.trim()){m("processing"),y("");try{const z=o(a,{replace:!0});z&&z.includes("ROOT")&&s(z),m("success")}catch(z){console.error("Error applying code to canvas:",z),m("error"),y(z instanceof Error?z.message:"Unknown error occurred")}}},[a]),j=S.useCallback(z=>{l(z),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{z.trim()?T():m("idle")},1e3)},[T]),B=S.useCallback(()=>{d(a),m("success");try{localStorage.setItem("editor_saved_code",a)}catch(z){console.warn("Could not save to localStorage:",z)}},[a]),$=S.useCallback(()=>{l(c),m("idle"),y(""),E.current&&clearTimeout(E.current)},[c]),O=S.useCallback(()=>{E.current&&clearTimeout(E.current),m("idle"),y("")},[]);return S.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]),{codeValue:a,savedCodeValue:c,conversionStatus:f,hasUnsavedChanges:A,errorMessage:g,isFormattingCode:v,handleCodeChange:j,handleSave:B,handleRevert:$,handleClose:O,applyCodeToCanvas:T,formatCode:D}}const qD={loading:!1,error:null,template:{}},Hf=S.createContext(qD),WD=({variant:t="primary",loading:e=!1,children:r,disabled:n,className:s="",...o})=>{const i=t==="primary",a=n||e;return h.jsx("button",{...o,disabled:a,className:`rounded-none border px-4 py-2 text-sm font-medium transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-60 ${i?"bg-[#170F4F] hover:bg-[#009CA8] text-white border-[#170F4F]":"bg-white hover:bg-[#F5F5F7] text-[#170F4F] border-[#E8E7EE]"} ${s}`,children:e?"Loading...":r})},UD=({isOpen:t,title:e,onClose:r,children:n,footer:s,showCloseButton:o=!0})=>t?h.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50",onClick:r,children:h.jsxs("div",{className:"w-[90%] max-w-md rounded-none bg-white shadow-lg",onClick:i=>i.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between border-b border-[#e8e7ee] px-6 py-4",children:[h.jsx("h2",{className:"text-lg font-semibold text-[#170f4f]",children:e}),o&&r&&h.jsx("button",{onClick:r,className:"flex h-8 w-8 items-center justify-center rounded-none text-2xl text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700",children:"×"})]}),h.jsx("div",{className:"px-6 py-4",children:n}),s&&h.jsx("div",{className:"flex justify-end gap-3 border-t border-[#e8e7ee] px-6 py-4",children:s})]})}):null,JD=({templateId:t,baseUrl:e,workspace:r,children:n})=>{const[s,o]=S.useState(!1),[i,a]=S.useState(null),[l,c]=S.useState({}),[d,f]=S.useState(!1),[m,g]=S.useState(Pr.TemplateFormat.HTML),y=S.useMemo(()=>(e||console.warn("[TemplateProvider] baseUrl was not provided"),r||console.warn("[TemplateProvider] workspace was not provided"),new Pr.TemplatingSdk(e,{workspace:r,mode:"editor"})),[e,r]),v=S.useCallback(async A=>{if(A)try{o(!0),a(null);const T=await y.get(A);T?(T.format||(console.warn("[TemplateProvider] Template format is missing. User must select a format."),f(!0)),c(T)):a(`Template with ID "${A}" not found`)}catch(T){const j=T instanceof Error?T.message:"Failed to load template";a(j),console.error("[TemplateProvider] Error loading template:",T)}finally{o(!1)}},[y]),w=S.useCallback(A=>c(T=>T?.update?.(A)),[c]),D=S.useCallback(async()=>{if(!l?.id){console.warn("No template loaded to save");return}try{o(!0);const A=await l.save();c(A)}catch(A){console.error("Error saving template:",A)}finally{o(!1)}},[l]),E=S.useCallback(async()=>{if(l?.id)try{o(!0);const A=await l.setFormat(m);c(A),f(!1)}catch(A){console.error("Error saving template format:",A),a("Failed to save template format")}finally{o(!1)}},[l,m]);S.useEffect(()=>{t&&v(t)},[t,v]);const N=S.useMemo(()=>({loading:s,error:i,template:l,loadTemplate:v,updateTemplate:w,saveTemplate:D}),[s,i,l,v,w,D]);return h.jsxs(Hf.Provider,{value:N,children:[n,h.jsxs(UD,{isOpen:d,title:"Template Format Required",showCloseButton:!1,footer:h.jsx(WD,{variant:"primary",onClick:E,disabled:s,loading:s,children:"Save Format"}),children:[h.jsx("p",{className:"mb-5 text-sm text-gray-600",children:"This template is missing a format. Please select a format to continue editing."}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"format-select",className:"mb-2 block text-sm font-medium text-[#170f4f]",children:"Select Format"}),h.jsx(Mt,{options:[{value:Pr.TemplateFormat.HTML,label:"HTML"},{value:Pr.TemplateFormat.PDF,label:"PDF"}],value:m,onChange:A=>g(A),placeholder:"Choose a format"})]})]})]})};function Pn(){const t=S.useContext(Hf);if(!t)throw new Error("useTemplate must be used within a TemplateProvider");return t}const KD=({onClose:t,onFormat:e,onSave:r,isFormattingCode:n,codeValue:s,hasUnsavedChanges:o,conversionStatus:i})=>h.jsxs("div",{className:"flex items-center justify-between border-b border-gray-700 bg-[#23272f] px-4 py-2",children:[h.jsxs("div",{className:"flex items-center space-x-3",children:[h.jsx("div",{className:"group relative",children:h.jsx("button",{className:"rounded p-1 text-gray-400 transition-colors duration-200 hover:text-white",onClick:t,"aria-label":"Close Code Panel",children:h.jsx(_.FiX,{size:18})})}),h.jsx("span",{className:"text-base font-semibold text-white",children:"Code Editor"}),h.jsxs("div",{className:"flex items-center space-x-2",children:[h.jsx("div",{className:`h-2 w-2 rounded-full ${o?"bg-yellow-500":"bg-green-500"}`}),h.jsx("span",{className:`text-xs font-medium ${o?"text-yellow-400":"text-green-400"}`,children:o?"Unsaved":"Saved"})]})]}),h.jsxs("div",{className:"flex items-center space-x-2",children:[h.jsxs("div",{className:"group relative",children:[h.jsx("button",{onClick:e,disabled:n||!s.trim(),className:"rounded p-1 text-gray-400 transition-colors duration-200 hover:text-white disabled:cursor-not-allowed disabled:text-gray-600","aria-label":"Format HTML",children:n?h.jsx(_.FiLoader,{size:18,className:"animate-spin"}):h.jsx(_.FiFileText,{size:18})}),h.jsx("span",{className:"absolute bottom-full left-1/2 z-10 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded bg-gray-900 px-2 py-1 text-xs text-white opacity-0 transition-opacity duration-200 group-hover:opacity-100",children:n?"Formatting HTML...":"Format HTML"})]}),h.jsxs("div",{className:"group relative",children:[h.jsx("button",{onClick:r,disabled:i==="processing"||!o,className:"rounded p-1 text-gray-400 transition-colors duration-200 hover:text-white disabled:cursor-not-allowed disabled:text-gray-600","aria-label":"Save HTML",children:h.jsx(_.FiSave,{size:18})}),h.jsx("span",{className:"absolute bottom-full left-1/2 z-10 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded bg-gray-900 px-2 py-1 text-xs text-white opacity-0 transition-opacity duration-200 group-hover:opacity-100",children:"Save"})]})]})]});function GD({height:t="100%",defaultLanguage:e="html",theme:r="vs-dark",value:n,onChange:s,options:o}){const i=S.useRef(null),[a,l]=S.useState(null);return S.useEffect(()=>{const c=document.createElement("div");return c.style.position="fixed",c.style.top="0",c.style.left="0",c.style.width="100%",c.style.height="100%",c.style.pointerEvents="none",c.style.zIndex="9999",document.body.appendChild(c),l(c),()=>{c.parentNode&&c.parentNode.removeChild(c)}},[]),S.useEffect(()=>{if(!i.current||!a)return;const c=()=>{if(!i.current||!a)return;const m=i.current.getBoundingClientRect(),g=a.firstChild;g&&(g.style.position="absolute",g.style.top=`${m.top}px`,g.style.left=`${m.left}px`,g.style.width=`${m.width}px`,g.style.height=`${m.height}px`,g.style.pointerEvents="auto")};c();const d=()=>{requestAnimationFrame(c)};window.addEventListener("resize",d),window.addEventListener("scroll",d,!0);let f;return window.ResizeObserver&&(f=new ResizeObserver(d),f.observe(i.current)),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0),f&&f.disconnect()}},[a]),h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:i,style:{width:"100%",height:t}}),a&&Ei.createPortal(h.jsx("div",{style:{backgroundColor:"#1e1e1e"},children:h.jsx(W2.default,{height:t,defaultLanguage:e,theme:r,value:n,onChange:s,options:o})}),a)]})}function YD({onClose:t}){const{codeValue:e,conversionStatus:r,hasUnsavedChanges:n,handleCodeChange:s,handleSave:o,handleClose:i,formatCode:a,isFormattingCode:l}=VD();return h.jsxs("div",{className:"flex h-full w-1/2 flex-col border-r border-gray-200 bg-[#181c24]",children:[h.jsx(KD,{onClose:()=>{i(),t()},onFormat:a,onSave:o,isFormattingCode:l,codeValue:e,hasUnsavedChanges:n,conversionStatus:r}),h.jsx("div",{className:"flex-1 p-0",style:{width:"100%",height:"100%"},children:h.jsx(GD,{height:"100%",defaultLanguage:"html",theme:"vs-dark",value:e,onChange:c=>s(c||""),options:{fontSize:16,padding:{top:10},minimap:{enabled:!1},wordWrap:"on",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,autoIndent:"full",tabSize:2,insertSpaces:!0,automaticLayout:!0,folding:!0,lineNumbers:"on",renderWhitespace:"selection",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},suggest:{showKeywords:!0,showSnippets:!0}}})})]})}const XD=({templateId:t,errorMessage:e,onContinue:r,onGoBack:n})=>h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",children:h.jsxs("div",{className:"flex w-full max-w-lg flex-col rounded-none bg-white shadow-xl",children:[h.jsx("div",{className:"border-b border-border bg-white px-6 py-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-red-50",children:h.jsx(_.FiAlertTriangle,{className:"text-red-600",size:20})}),h.jsx("h2",{className:"text-lg font-bold text-primary",children:"Template Not Found"})]})}),h.jsxs("div",{className:"px-6 py-5",children:[t&&h.jsx("div",{className:"mb-4 rounded-none border border-border bg-background-light px-4 py-3",children:h.jsxs("p",{className:"text-sm text-muted",children:["Template ID:"," ",h.jsx("span",{className:"font-medium text-text",children:t})]})}),h.jsx("p",{className:"mb-5 text-sm leading-relaxed text-text",children:e}),h.jsx("div",{className:"rounded-none border border-red-200 bg-red-50 px-4 py-3",children:h.jsxs("div",{className:"flex gap-2",children:[h.jsx(_.FiAlertTriangle,{className:"mt-0.5 flex-shrink-0 text-red-600",size:16}),h.jsxs("p",{className:"text-sm leading-relaxed text-red-800",children:[h.jsx("strong",{children:"Warning:"})," Any changes made will not be saved, as the template was not found."]})]})})]}),h.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-border px-6 py-4",children:[h.jsx("button",{onClick:n,className:"rounded-none border border-border bg-background-light px-4 py-2 text-sm font-medium text-text transition-colors duration-200 hover:bg-surface",children:"Go Back"}),h.jsx("button",{onClick:r,className:"rounded-none bg-primary px-4 py-2 text-sm font-medium text-white transition-colors duration-200 hover:bg-secondary",children:"Continue Anyway"})]})]})}),QD={},ZD=(t,e)=>({onDeleteNode:()=>{const r=e.getEvent("selected").last();r&&t.delete(r)},onCopy:()=>{const r=e.getEvent("selected").last();if(!r){console.warn("[Copy] No node selected");return}try{const n=e.node(r).toNodeTree();console.log("[Copy] Node tree:",n);const s={type:"craftjs-copy",nodeTree:n,selectedId:r,timestamp:Date.now()};console.log("[Copy] Copy data:",s);const o=JSON.stringify(s,(i,a)=>{if(!["dom","rules","_hydrationTimestamp","events"].includes(i))return i==="type"&&typeof a=="function"?{resolvedName:a.name||a.displayName||"Unknown"}:a});navigator.clipboard.writeText(o),console.log("[Copy] Successfully copied to clipboard")}catch(n){console.error("[Copy] Failed to copy node:",n)}},onPaste:async()=>{console.log("[Paste] Starting paste operation...");try{const r=await navigator.clipboard.readText();if(console.log("[Paste] Clipboard text:",r),!r){console.warn("[Paste] Clipboard is empty");return}let n;try{n=JSON.parse(r),console.log("[Paste] Parsed clipboard data:",n)}catch(f){console.warn("[Paste] Invalid clipboard data:",f);return}if(!n||n.type!=="craftjs-copy"||!n.nodeTree){console.warn("[Paste] Clipboard does not contain valid node data");return}const s=n.nodeTree;console.log("[Paste] Node tree to paste:",s);const i=(f=>{const m={...f},g={},y=()=>Math.random().toString(36).substring(2,15);if(m.nodes&&(Object.keys(m.nodes).forEach(v=>{g[v]=y()}),m.rootNodeId&&g[m.rootNodeId]&&(m.rootNodeId=g[m.rootNodeId])),m.nodes){const v={};Object.keys(m.nodes).forEach(w=>{const D={...m.nodes[w]},E=g[w];if(D.id=E,D.events=D.events||{selected:!1,dragged:!1,hovered:!1},D.dom=null,D.rules=D.rules||{canDrag:()=>!0,canDrop:()=>!0,canMoveIn:()=>!0,canMoveOut:()=>!0},D.data){if(D.data.props=D.data.props||{},D.data.custom=D.data.custom||{},D.data.hidden=D.data.hidden||!1,D.data.isCanvas=D.data.isCanvas||!1,D.data.nodes=D.data.nodes||[],D.data.linkedNodes=D.data.linkedNodes||{},D.data.displayName=D.data.displayName||D.data.type?.displayName||"Component",D.data.parent&&g[D.data.parent]&&(D.data.parent=g[D.data.parent]),D.data.nodes&&Array.isArray(D.data.nodes)&&(D.data.nodes=D.data.nodes.map(N=>g[N]||N)),D.data.linkedNodes){const N={};Object.keys(D.data.linkedNodes).forEach(A=>{const T=D.data.linkedNodes[A];N[A]=g[T]||T}),D.data.linkedNodes=N}if(D.data.type&&typeof D.data.type=="object"&&D.data.type.resolvedName){const N=Rs.find(A=>{const T=typeof A.component=="function"?A.component.name||A.component.displayName:"";return A.id===D.data.type.resolvedName||T===D.data.type.resolvedName});N?(D.data.type=N.component,console.log("[Paste] Resolved component:",D.data.type.resolvedName,"to",N.component)):console.warn("[Paste] Could not resolve component:",D.data.type.resolvedName)}}v[E]=D}),m.nodes=v}return m})(s);console.log("[Paste] Reconstructed node tree:",i);const a=e.getEvent("selected").last();let l="ROOT",c;if(a){const f=e.node(a).get();if(console.log("[Paste] Selected node data:",f),f.data.isCanvas)l=a,c=(f.data.nodes||[]).length,console.log("[Paste] Inserting as child of canvas node:",a,"at index:",c);else{const m=f.data.parent;m?(l=m,c=e.node(l).get().data.nodes.indexOf(a)+1,console.log("[Paste] Inserting after selected node in parent:",l,"at index:",c)):(l="ROOT",c=e.node("ROOT").get().data.nodes.indexOf(a)+1,console.log("[Paste] Inserting after selected node in ROOT at index:",c))}}else c=e.node("ROOT").get().data.nodes.length,console.log("[Paste] No selection, adding to end of ROOT at index:",c);console.log("[Paste] Will insert at parent:",l,"index:",c),console.log("[Paste] Using addNodeTree with reconstructed nodeTree:",i),t.addNodeTree(i,l,c);const d=i.rootNodeId;d&&(console.log("[Paste] Selecting newly pasted node:",d),t.selectNode(d)),console.log("[Paste] Node pasted successfully")}catch(r){console.error("[Paste] Failed to paste:",r),r instanceof Error&&console.error("[Paste] Error stack:",r.stack)}},onUndo:()=>t.history.undo(),onRedo:()=>t.history.redo(),onSave:()=>{const r=e.serialize();console.log("Saving JSON:",r)}});function eC(){const{actions:t,query:e}=Q.useEditor(),r=s=>s.toLowerCase().charAt(0).toUpperCase()+s.toLowerCase().slice(1),n=s=>s.includes("_")?`on${s.split("_").map(r).join("")}`:`on${r(s)}`;S.useEffect(()=>{const s=ZD(t,e),o=i=>{const a=navigator.platform.includes("Mac"),l=[];(a&&i.metaKey||!a&&i.ctrlKey)&&l.push(a?"Meta":"Ctrl"),i.shiftKey&&l.push("Shift"),l.push(i.key);const c=l.join("+");Object.entries(QD).forEach(([d,f])=>{if(f.keys.includes(c)){i.preventDefault();const m=s[n(d)];console.log("Executing shortcut:",d,n(d)),m?.()}})};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,e])}const tC=({name:t})=>h.jsx("div",{className:"border-b border-[#e8e7ee] bg-gray-50 p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded bg-[#170f4f]",children:h.jsx("span",{className:"text-xs font-medium text-white",children:t.charAt(0).toUpperCase()})}),h.jsx("div",{className:"flex-1",children:h.jsx("h3",{className:"text-sm font-medium text-[#170f4f]",children:t})})]})});function rC(){const{selected:t,nodes:e,actions:r,query:n}=Q.useEditor(D=>({selected:D.events.selected,nodes:D.nodes})),s=Array.from(t)[0],o=()=>{if(t&&t.size>0){const D=Array.from(t)[0];r.delete(D)}},i=()=>{if(!s)return;const D=n.node(s).get(),E=n.node(s).ancestors()[0];if(!E)return;const T=n.node(E).get().data.nodes.indexOf(s);if(T===-1)return;const j={data:{type:D.data.type,props:{...D.data.props}}},B=n.parseFreshNode(j).toNode();r.add(B,E,T+1)},a=()=>{if(!s)return;const D=n.node(s).ancestors()[0];if(!D)return;const A=n.node(D).get().data.nodes.indexOf(s);if(A>0){const T=A-1;r.move(s,D,T)}},l=()=>{if(!s)return;const D=n.node(s).ancestors()[0];if(!D)return;const N=n.node(D).get().data.nodes,A=N.indexOf(s);if(A!==-1&&A<N.length-1){const T=A+2;r.move(s,D,T)}},c=()=>{if(s){const D=Array.from(t)[0];r.setHidden(D,!e[D].data.hidden)}};S.useEffect(()=>{const D=E=>{if(t&&t.size>0){const N=E.target;!(N.tagName==="INPUT"||N.tagName==="TEXTAREA"||N.contentEditable==="true")&&(E.key==="Backspace"||E.key==="Delete")&&(E.preventDefault(),o())}};return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[t]);const f=(()=>{if(!t||t.size===0)return null;const D=Array.from(t)[0],E=n.node(D).get();return E?{id:D,type:E.data.type,displayName:E.data.displayName||String(E.data.type),props:E.data.props,isCanvas:E.data.isCanvas,isDeletable:!0,isDuplicateable:!0,parent:E.data.parent}:null})();if(!f)return null;const m=n.node(s).ancestors()[0]||"ROOT",g=n.node(m).get(),v=g.data.nodes.indexOf(s),w=g.data.nodes.length-1;return h.jsxs("div",{className:"space-y-3 p-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("button",{onClick:i,disabled:!f.isDuplicateable,className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",children:[h.jsx(_.FiCopy,{size:14}),"Duplicate"]}),h.jsxs("button",{onClick:o,disabled:!f.isDeletable,className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:border-red-300 hover:bg-red-50 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-50",children:[h.jsx(_.FiTrash2,{size:14}),"Delete"]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("button",{disabled:v===0,onClick:a,className:`flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50 ${v===0?"cursor-not-allowed opacity-50 hover:bg-white":""}`,children:[h.jsx(_.FiArrowUp,{size:14}),"Move Up"]}),h.jsxs("button",{disabled:v>=w,onClick:l,className:`flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50 ${v>=w?"cursor-not-allowed opacity-50 hover:bg-white":""}`,children:[h.jsx(_.FiArrowDown,{size:14}),"Move Down"]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("button",{className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50",children:[h.jsx(_.FiLock,{size:14}),"Lock"]}),h.jsx("button",{onClick:c,className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50",children:e[s].data.hidden?h.jsxs(h.Fragment,{children:[h.jsx(_.FiEye,{size:14}),"Show"]}):h.jsxs(h.Fragment,{children:[h.jsx(_.FiEyeOff,{size:14}),"Hide"]})})]})]})}function nC(){const{selected:t,query:e}=Q.useEditor(c=>({selected:c.events.selected})),[r,n]=S.useState(""),s=S.useRef(null),o=()=>{if(s.current){const c=s.current.textContent||"";navigator.clipboard.writeText(c).then(()=>{console.log("HTML copied to clipboard")})}},i=c=>{try{const d=e.node(c).get();return d&&d.dom?d.dom.outerHTML.replace(/data-cy="[^"]*"/g,"").replace(/data-craft-id="[^"]*"/g,"").replace(/data-node-id="[^"]*"/g,"").replace(/class="[^"]*craft[^"]*"/g,'class=""').replace(/class="[^"]*ring-[^"]*"/g,'class=""').replace(/class="[^"]*hover:[^"]*"/g,'class=""').replace(/class="[^"]*transition-[^"]*"/g,'class=""').replace(/class="[^"]*duration-[^"]*"/g,'class=""').replace(/class="[^"]*opacity-[^"]*"/g,'class=""').replace(/class="[^"]*cursor-[^"]*"/g,'class=""').replace(/class="[^"]*min-h-screen[^"]*"/g,'class=""').replace(/class="[^"]*bg-white[^"]*"/g,'class=""').replace(/class=""/g,"").replace(/\s+/g," ").trim()||"<!-- No HTML available -->":"<!-- Component not found in DOM -->"}catch(d){return console.error("Error getting component HTML:",d),"<!-- Error getting component HTML -->"}};S.useEffect(()=>{if(t&&t.size>0){const c=Array.from(t)[0];if(e.node(c).get()){const f=i(c);n(f)}}else n("")},[t,e]);const l=(()=>{if(!t||t.size===0)return null;const c=Array.from(t)[0],d=e.node(c).get();return d?{id:c,type:d.data.type,displayName:d.data.displayName||String(d.data.type),props:d.data.props,isCanvas:d.data.isCanvas,isDeletable:!0,isDuplicateable:!0,parent:d.data.parent}:null})();return l?h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-700",children:"Component ID"}),h.jsx("input",{type:"text",value:l.id,readOnly:!0,className:"w-full rounded-none border border-[#e8e7ee] bg-gray-50 px-3 py-2 text-xs focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-700",children:"Component Parent"}),h.jsx("input",{type:"text",value:String(l.parent),readOnly:!0,className:"w-full rounded-none border border-[#e8e7ee] bg-gray-50 px-3 py-2 text-xs focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-700",children:"Properties"}),h.jsx("div",{className:"rounded-none border border-[#e8e7ee] bg-gray-50 p-3",children:h.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-600",children:JSON.stringify(l?.props,null,2)})})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[h.jsx("label",{className:"block text-xs font-medium text-gray-700",children:"Component HTML"}),h.jsx("button",{onClick:o,className:"rounded-none p-1 text-gray-400 transition-colors duration-200 hover:bg-gray-100 hover:text-gray-600",title:"Copy HTML to clipboard",children:h.jsx(_.FiClipboard,{size:14})})]}),h.jsx("div",{className:"rounded-none border border-[#e8e7ee] bg-gray-50 p-3",children:h.jsx("pre",{ref:s,className:"whitespace-pre-wrap font-mono text-xs text-gray-600",children:r||"<!-- No HTML available -->"})})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("span",{className:"inline-flex items-center rounded bg-blue-100 px-2 py-1 text-xs font-medium text-blue-800",children:l.isCanvas?"Canvas":"Component"}),l.isDeletable&&h.jsx("span",{className:"inline-flex items-center rounded bg-green-100 px-2 py-1 text-xs font-medium text-green-800",children:"Deletable"}),l.isDuplicateable&&h.jsx("span",{className:"inline-flex items-center rounded bg-purple-100 px-2 py-1 text-xs font-medium text-purple-800",children:"Duplicatable"})]})]}):null}function _e(t){this.content=t}_e.prototype={constructor:_e,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,r){var n=r&&r!=t?this.remove(r):this,s=n.find(t),o=n.content.slice();return s==-1?o.push(r||t,e):(o[s+1]=e,r&&(o[s]=r)),new _e(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var r=this.content.slice();return r.splice(e,2),new _e(r)},addToStart:function(t,e){return new _e([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var r=this.remove(t).content.slice();return r.push(t,e),new _e(r)},addBefore:function(t,e,r){var n=this.remove(e),s=n.content.slice(),o=n.find(t);return s.splice(o==-1?s.length:o,0,e,r),new _e(s)},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=_e.from(t),t.size?new _e(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=_e.from(t),t.size?new _e(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=_e.from(t);for(var r=0;r<t.content.length;r+=2)e=e.remove(t.content[r]);return e},toObject:function(){var t={};return this.forEach(function(e,r){t[e]=r}),t},get size(){return this.content.length>>1}};_e.from=function(t){if(t instanceof _e)return t;var e=[];if(t)for(var r in t)e.push(r,t[r]);return new _e(e)};function Vf(t,e,r){for(let n=0;;n++){if(n==t.childCount||n==e.childCount)return t.childCount==e.childCount?null:r;let s=t.child(n),o=e.child(n);if(s==o){r+=s.nodeSize;continue}if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)r++;return r}if(s.content.size||o.content.size){let i=Vf(s.content,o.content,r+1);if(i!=null)return i}r+=s.nodeSize}}function qf(t,e,r,n){for(let s=t.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:r,b:n};let i=t.child(--s),a=e.child(--o),l=i.nodeSize;if(i==a){r-=l,n-=l;continue}if(!i.sameMarkup(a))return{a:r,b:n};if(i.isText&&i.text!=a.text){let c=0,d=Math.min(i.text.length,a.text.length);for(;c<d&&i.text[i.text.length-c-1]==a.text[a.text.length-c-1];)c++,r--,n--;return{a:r,b:n}}if(i.content.size||a.content.size){let c=qf(i.content,a.content,r-1,n-1);if(c)return c}r-=l,n-=l}}class L{constructor(e,r){if(this.content=e,this.size=r||0,r==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,r,n,s=0,o){for(let i=0,a=0;a<r;i++){let l=this.content[i],c=a+l.nodeSize;if(c>e&&n(l,s+a,o||null,i)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,r-d),n,s+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,r,n,s){let o="",i=!0;return this.nodesBetween(e,r,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,r-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(i?i=!1:o+=n),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let r=this.lastChild,n=e.firstChild,s=this.content.slice(),o=0;for(r.isText&&r.sameMarkup(n)&&(s[s.length-1]=r.withText(r.text+n.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new L(s,this.size+e.size)}cut(e,r=this.size){if(e==0&&r==this.size)return this;let n=[],s=0;if(r>e)for(let o=0,i=0;i<r;o++){let a=this.content[o],l=i+a.nodeSize;l>e&&((i<e||l>r)&&(a.isText?a=a.cut(Math.max(0,e-i),Math.min(a.text.length,r-i)):a=a.cut(Math.max(0,e-i-1),Math.min(a.content.size,r-i-1))),n.push(a),s+=a.nodeSize),i=l}return new L(n,s)}cutByIndex(e,r){return e==r?L.empty:e==0&&r==this.content.length?this:new L(this.content.slice(e,r))}replaceChild(e,r){let n=this.content[e];if(n==r)return this;let s=this.content.slice(),o=this.size+r.nodeSize-n.nodeSize;return s[e]=r,new L(s,o)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let r=0;r<this.content.length;r++)if(!this.content[r].eq(e.content[r]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let r=this.content[e];if(!r)throw new RangeError("Index "+e+" out of range for "+this);return r}maybeChild(e){return this.content[e]||null}forEach(e){for(let r=0,n=0;r<this.content.length;r++){let s=this.content[r];e(s,n,r),n+=s.nodeSize}}findDiffStart(e,r=0){return Vf(this,e,r)}findDiffEnd(e,r=this.size,n=e.size){return qf(this,e,r,n)}findIndex(e){if(e==0)return bo(0,e);if(e==this.size)return bo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,n=0;;r++){let s=this.child(r),o=n+s.nodeSize;if(o>=e)return o==e?bo(r+1,o):bo(r,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,r){if(!r)return L.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(r.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let r,n=0;for(let s=0;s<e.length;s++){let o=e[s];n+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(r||(r=e.slice(0,s)),r[r.length-1]=o.withText(r[r.length-1].text+o.text)):r&&r.push(o)}return new L(r||e,n)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const Ta={index:0,offset:0};function bo(t,e){return Ta.index=t,Ta.offset=e,Ta}function Io(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let r=Array.isArray(t);if(Array.isArray(e)!=r)return!1;if(r){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!Io(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!Io(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}let ue=class bl{constructor(e,r){this.type=e,this.attrs=r}addToSet(e){let r,n=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))r||(r=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(r||(r=e.slice(0,s)),r.push(this),n=!0),r&&r.push(o)}}return r||(r=e.slice()),n||r.push(this),r}removeFromSet(e){for(let r=0;r<e.length;r++)if(this.eq(e[r]))return e.slice(0,r).concat(e.slice(r+1));return e}isInSet(e){for(let r=0;r<e.length;r++)if(this.eq(e[r]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Io(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let r in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,r){if(!r)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[r.type];if(!n)throw new RangeError(`There is no mark type ${r.type} in this schema`);let s=n.create(r.attrs);return n.checkAttrs(s.attrs),s}static sameSet(e,r){if(e==r)return!0;if(e.length!=r.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(r[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return bl.none;if(e instanceof bl)return[e];let r=e.slice();return r.sort((n,s)=>n.type.rank-s.type.rank),r}};ue.none=[];class Ro extends Error{}class H{constructor(e,r,n){this.content=e,this.openStart=r,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,r){let n=Uf(this.content,e+this.openStart,r);return n&&new H(n,this.openStart,this.openEnd)}removeBetween(e,r){return new H(Wf(this.content,e+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,r){if(!r)return H.empty;let n=r.openStart||0,s=r.openEnd||0;if(typeof n!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(L.fromJSON(e,r.content),n,s)}static maxOpen(e,r=!0){let n=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.lastChild)s++;return new H(e,n,s)}}H.empty=new H(L.empty,0,0);function Wf(t,e,r){let{index:n,offset:s}=t.findIndex(e),o=t.maybeChild(n),{index:i,offset:a}=t.findIndex(r);if(s==e||o.isText){if(a!=r&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(r))}if(n!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(n,o.copy(Wf(o.content,e-s-1,r-s-1)))}function Uf(t,e,r,n){let{index:s,offset:o}=t.findIndex(e),i=t.maybeChild(s);if(o==e||i.isText)return n&&!n.canReplace(s,s,r)?null:t.cut(0,e).append(r).append(t.cut(e));let a=Uf(i.content,e-o-1,r,i);return a&&t.replaceChild(s,i.copy(a))}function sC(t,e,r){if(r.openStart>t.depth)throw new Ro("Inserted content deeper than insertion position");if(t.depth-r.openStart!=e.depth-r.openEnd)throw new Ro("Inconsistent open depths");return Jf(t,e,r,0)}function Jf(t,e,r,n){let s=t.index(n),o=t.node(n);if(s==e.index(n)&&n<t.depth-r.openStart){let i=Jf(t,e,r,n+1);return o.copy(o.content.replaceChild(s,i))}else if(r.content.size)if(!r.openStart&&!r.openEnd&&t.depth==n&&e.depth==n){let i=t.parent,a=i.content;return Jr(i,a.cut(0,t.parentOffset).append(r.content).append(a.cut(e.parentOffset)))}else{let{start:i,end:a}=oC(r,t);return Jr(o,Gf(t,i,a,e,n))}else return Jr(o,Po(t,e,n))}function Kf(t,e){if(!e.type.compatibleContent(t.type))throw new Ro("Cannot join "+e.type.name+" onto "+t.type.name)}function yl(t,e,r){let n=t.node(r);return Kf(n,e.node(r)),n}function Ur(t,e){let r=e.length-1;r>=0&&t.isText&&t.sameMarkup(e[r])?e[r]=t.withText(e[r].text+t.text):e.push(t)}function bs(t,e,r,n){let s=(e||t).node(r),o=0,i=e?e.index(r):s.childCount;t&&(o=t.index(r),t.depth>r?o++:t.textOffset&&(Ur(t.nodeAfter,n),o++));for(let a=o;a<i;a++)Ur(s.child(a),n);e&&e.depth==r&&e.textOffset&&Ur(e.nodeBefore,n)}function Jr(t,e){return t.type.checkContent(e),t.copy(e)}function Gf(t,e,r,n,s){let o=t.depth>s&&yl(t,e,s+1),i=n.depth>s&&yl(r,n,s+1),a=[];return bs(null,t,s,a),o&&i&&e.index(s)==r.index(s)?(Kf(o,i),Ur(Jr(o,Gf(t,e,r,n,s+1)),a)):(o&&Ur(Jr(o,Po(t,e,s+1)),a),bs(e,r,s,a),i&&Ur(Jr(i,Po(r,n,s+1)),a)),bs(n,null,s,a),new L(a)}function Po(t,e,r){let n=[];if(bs(null,t,r,n),t.depth>r){let s=yl(t,e,r+1);Ur(Jr(s,Po(t,e,r+1)),n)}return bs(e,null,r,n),new L(n)}function oC(t,e){let r=e.depth-t.openStart,s=e.node(r).copy(t.content);for(let o=r-1;o>=0;o--)s=e.node(o).copy(L.from(s));return{start:s.resolveNoCache(t.openStart+r),end:s.resolveNoCache(s.content.size-t.openEnd-r)}}class Fs{constructor(e,r,n){this.pos=e,this.path=r,this.parentOffset=n,this.depth=r.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,r=this.index(this.depth);if(r==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],s=e.child(r);return n?e.child(r).cut(n):s}get nodeBefore(){let e=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(e).cut(0,r):e==0?null:this.parent.child(e-1)}posAtIndex(e,r){r=this.resolveDepth(r);let n=this.path[r*3],s=r==0?0:this.path[r*3-1]+1;for(let o=0;o<e;o++)s+=n.child(o).nodeSize;return s}marks(){let e=this.parent,r=this.index();if(e.content.size==0)return ue.none;if(this.textOffset)return e.child(r).marks;let n=e.maybeChild(r-1),s=e.maybeChild(r);if(!n){let a=n;n=s,s=a}let o=n.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let r=this.parent.maybeChild(this.index());if(!r||!r.isInline)return null;let n=r.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)n[o].type.spec.inclusive===!1&&(!s||!n[o].isInSet(s.marks))&&(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let r=this.depth;r>0;r--)if(this.start(r)<=e&&this.end(r)>=e)return r;return 0}blockRange(e=this,r){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!r||r(this.node(n))))return new zo(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let r=1;r<=this.depth;r++)e+=(e?"/":"")+this.node(r).type.name+"_"+this.index(r-1);return e+":"+this.parentOffset}static resolve(e,r){if(!(r>=0&&r<=e.content.size))throw new RangeError("Position "+r+" out of range");let n=[],s=0,o=r;for(let i=e;;){let{index:a,offset:l}=i.content.findIndex(o),c=o-l;if(n.push(i,a,s+l),!c||(i=i.child(a),i.isText))break;o=c-1,s+=l+1}return new Fs(r,n,o)}static resolveCached(e,r){let n=ip.get(e);if(n)for(let o=0;o<n.elts.length;o++){let i=n.elts[o];if(i.pos==r)return i}else ip.set(e,n=new iC);let s=n.elts[n.i]=Fs.resolve(e,r);return n.i=(n.i+1)%aC,s}}class iC{constructor(){this.elts=[],this.i=0}}const aC=12,ip=new WeakMap;class zo{constructor(e,r,n){this.$from=e,this.$to=r,this.depth=n}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 lC=Object.create(null);class Ct{constructor(e,r,n,s=ue.none){this.type=e,this.attrs=r,this.marks=s,this.content=n||L.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,r,n,s=0){this.content.nodesBetween(e,r,n,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,r,n,s){return this.content.textBetween(e,r,n,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,r,n){return this.type==e&&Io(this.attrs,r||e.defaultAttrs||lC)&&ue.sameSet(this.marks,n||ue.none)}copy(e=null){return e==this.content?this:new Ct(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ct(this.type,this.attrs,this.content,e)}cut(e,r=this.content.size){return e==0&&r==this.content.size?this:this.copy(this.content.cut(e,r))}slice(e,r=this.content.size,n=!1){if(e==r)return H.empty;let s=this.resolve(e),o=this.resolve(r),i=n?0:s.sharedDepth(r),a=s.start(i),c=s.node(i).content.cut(s.pos-a,o.pos-a);return new H(c,s.depth-i,o.depth-i)}replace(e,r,n){return sC(this.resolve(e),this.resolve(r),n)}nodeAt(e){for(let r=this;;){let{index:n,offset:s}=r.content.findIndex(e);if(r=r.maybeChild(n),!r)return null;if(s==e||r.isText)return r;e-=s+1}}childAfter(e){let{index:r,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(r),index:r,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:r,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(r),index:r,offset:n};let s=this.content.child(r-1);return{node:s,index:r-1,offset:n-s.nodeSize}}resolve(e){return Fs.resolveCached(this,e)}resolveNoCache(e){return Fs.resolve(this,e)}rangeHasMark(e,r,n){let s=!1;return r>e&&this.nodesBetween(e,r,o=>(n.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Yf(this.marks,e)}contentMatchAt(e){let r=this.type.contentMatch.matchFragment(this.content,0,e);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(e,r,n=L.empty,s=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,s,o),a=i&&i.matchFragment(this.content,r);if(!a||!a.validEnd)return!1;for(let l=s;l<o;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,r,n,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,r);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ue.none;for(let r=0;r<this.marks.length;r++){let n=this.marks[r];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!ue.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(r=>r.type.name)}`);this.content.forEach(r=>r.check())}toJSON(){let e={type:this.type.name};for(let r in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(r=>r.toJSON())),e}static fromJSON(e,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let n;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=r.marks.map(e.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(r.text,n)}let s=L.fromJSON(e,r.content),o=e.nodeType(r.type).create(r.attrs,s,n);return o.type.checkAttrs(o.attrs),o}}Ct.prototype.text=void 0;class $o extends Ct{constructor(e,r,n,s){if(super(e,r,null,s),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yf(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,r){return this.text.slice(e,r)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new $o(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new $o(this.type,this.attrs,e,this.marks)}cut(e=0,r=this.text.length){return e==0&&r==this.text.length?this:this.withText(this.text.slice(e,r))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yf(t,e){for(let r=t.length-1;r>=0;r--)e=t[r].type.name+"("+e+")";return e}class Qr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,r){let n=new uC(e,r);if(n.next==null)return Qr.empty;let s=Xf(n);n.next&&n.err("Unexpected trailing text");let o=gC(mC(s));return bC(o,n),o}matchType(e){for(let r=0;r<this.next.length;r++)if(this.next[r].type==e)return this.next[r].next;return null}matchFragment(e,r=0,n=e.childCount){let s=this;for(let o=r;s&&o<n;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:r}=this.next[e];if(!(r.isText||r.hasRequiredAttrs()))return r}return null}compatible(e){for(let r=0;r<this.next.length;r++)for(let n=0;n<e.next.length;n++)if(this.next[r].type==e.next[n].type)return!0;return!1}fillBefore(e,r=!1,n=0){let s=[this];function o(i,a){let l=i.matchFragment(e,n);if(l&&(!r||l.validEnd))return L.from(a.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:d,next:f}=i.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let m=o(f,a.concat(d));if(m)return m}}return null}return o(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let r=this.computeWrapping(e);return this.wrapCache.push(e,r),r}computeWrapping(e){let r=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let s=n.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let a=s;a.type;a=a.via)i.push(a.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:a,next:l}=o.next[i];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in r)&&(!s.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:s}),r[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function r(n){e.push(n);for(let s=0;s<n.next.length;s++)e.indexOf(n.next[s].next)==-1&&r(n.next[s].next)}return r(this),e.map((n,s)=>{let o=s+(n.validEnd?"*":" ")+" ";for(let i=0;i<n.next.length;i++)o+=(i?", ":"")+n.next[i].type.name+"->"+e.indexOf(n.next[i].next);return o}).join(`
79
- `)}}Qr.empty=new Qr(!0);class uC{constructor(e,r){this.string=e,this.nodeTypes=r,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Xf(t){let e=[];do e.push(cC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function cC(t){let e=[];do e.push(dC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function dC(t){let e=fC(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=pC(t,e);else break;return e}function ap(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function pC(t,e){let r=ap(t),n=r;return t.eat(",")&&(t.next!="}"?n=ap(t):n=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:e}}function hC(t,e){let r=t.nodeTypes,n=r[e];if(n)return[n];let s=[];for(let o in r){let i=r[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function fC(t){if(t.eat("(")){let e=Xf(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=hC(t,t.next).map(r=>(t.inline==null?t.inline=r.isInline:t.inline!=r.isInline&&t.err("Mixing inline and block content"),{type:"name",value:r}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function mC(t){let e=[[]];return s(o(t,0),r()),e;function r(){return e.push([])-1}function n(i,a,l){let c={term:l,to:a};return e[i].push(c),c}function s(i,a){i.forEach(l=>l.to=a)}function o(i,a){if(i.type=="choice")return i.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(i.type=="seq")for(let l=0;;l++){let c=o(i.exprs[l],a);if(l==i.exprs.length-1)return c;s(c,a=r())}else if(i.type=="star"){let l=r();return n(a,l),s(o(i.expr,l),l),[n(l)]}else if(i.type=="plus"){let l=r();return s(o(i.expr,a),l),s(o(i.expr,l),l),[n(l)]}else{if(i.type=="opt")return[n(a)].concat(o(i.expr,a));if(i.type=="range"){let l=a;for(let c=0;c<i.min;c++){let d=r();s(o(i.expr,l),d),l=d}if(i.max==-1)s(o(i.expr,l),l);else for(let c=i.min;c<i.max;c++){let d=r();n(l,d),s(o(i.expr,l),d),l=d}return[n(l)]}else{if(i.type=="name")return[n(a,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Qf(t,e){return e-t}function lp(t,e){let r=[];return n(e),r.sort(Qf);function n(s){let o=t[s];if(o.length==1&&!o[0].term)return n(o[0].to);r.push(s);for(let i=0;i<o.length;i++){let{term:a,to:l}=o[i];!a&&r.indexOf(l)==-1&&n(l)}}}function gC(t){let e=Object.create(null);return r(lp(t,0));function r(n){let s=[];n.forEach(i=>{t[i].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<s.length;d++)s[d][0]==a&&(c=s[d][1]);lp(t,l).forEach(d=>{c||s.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let o=e[n.join(",")]=new Qr(n.indexOf(t.length-1)>-1);for(let i=0;i<s.length;i++){let a=s[i][1].sort(Qf);o.next.push({type:s[i][0],next:e[a.join(",")]||r(a)})}return o}}function bC(t,e){for(let r=0,n=[t];r<n.length;r++){let s=n[r],o=!s.validEnd,i=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];i.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),n.indexOf(c)==-1&&n.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Zf(t){let e=Object.create(null);for(let r in t){let n=t[r];if(!n.hasDefault)return null;e[r]=n.default}return e}function em(t,e){let r=Object.create(null);for(let n in t){let s=e&&e[n];if(s===void 0){let o=t[n];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+n)}r[n]=s}return r}function tm(t,e,r,n){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${r} of type ${s}`);for(let s in t){let o=t[s];o.validate&&o.validate(e[s])}}function rm(t,e){let r=Object.create(null);if(e)for(let n in e)r[n]=new xC(t,n,e[n]);return r}let up=class nm{constructor(e,r,n){this.name=e,this.schema=r,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=rm(e,n.attrs),this.defaultAttrs=Zf(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Qr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:em(this.attrs,e)}create(e=null,r,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ct(this,this.computeAttrs(e),L.from(r),ue.setFrom(n))}createChecked(e=null,r,n){return r=L.from(r),this.checkContent(r),new Ct(this,this.computeAttrs(e),r,ue.setFrom(n))}createAndFill(e=null,r,n){if(e=this.computeAttrs(e),r=L.from(r),r.size){let i=this.contentMatch.fillBefore(r);if(!i)return null;r=i.append(r)}let s=this.contentMatch.matchFragment(r),o=s&&s.fillBefore(L.empty,!0);return o?new Ct(this,e,r.append(o),ue.setFrom(n)):null}validContent(e){let r=this.contentMatch.matchFragment(e);if(!r||!r.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){tm(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let r=0;r<e.length;r++)if(!this.allowsMarkType(e[r].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let r;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?r&&r.push(e[n]):r||(r=e.slice(0,n));return r?r.length?r:ue.none:e}static compile(e,r){let n=Object.create(null);e.forEach((o,i)=>n[o]=new nm(o,r,i));let s=r.spec.topNode||"doc";if(!n[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function yC(t,e,r){let n=r.split("|");return s=>{let o=s===null?"null":typeof s;if(n.indexOf(o)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${t}, got ${o}`)}}class xC{constructor(e,r,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?yC(e,r,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Li{constructor(e,r,n,s){this.name=e,this.rank=r,this.schema=n,this.spec=s,this.attrs=rm(e,s.attrs),this.excluded=null;let o=Zf(this.attrs);this.instance=o?new ue(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ue(this,em(this.attrs,e))}static compile(e,r){let n=Object.create(null),s=0;return e.forEach((o,i)=>n[o]=new Li(o,s++,r,i)),n}removeFromSet(e){for(var r=0;r<e.length;r++)e[r].type==this&&(e=e.slice(0,r).concat(e.slice(r+1)),r--);return e}isInSet(e){for(let r=0;r<e.length;r++)if(e[r].type==this)return e[r]}checkAttrs(e){tm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class sm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let s in e)r[s]=e[s];r.nodes=_e.from(e.nodes),r.marks=_e.from(e.marks||{}),this.nodes=up.compile(this.spec.nodes,this),this.marks=Li.compile(this.spec.marks,this);let n=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=n[i]||(n[i]=Qr.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?cp(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:cp(this,i.split(" "))}this.nodeFromJSON=s=>Ct.fromJSON(this,s),this.markFromJSON=s=>ue.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,r=null,n,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof up){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(r,n,s)}text(e,r){let n=this.nodes.text;return new $o(n,n.defaultAttrs,e,ue.setFrom(r))}mark(e,r){return typeof e=="string"&&(e=this.marks[e]),e.create(r)}nodeType(e){let r=this.nodes[e];if(!r)throw new RangeError("Unknown node type: "+e);return r}}function cp(t,e){let r=[];for(let n=0;n<e.length;n++){let s=e[n],o=t.marks[s],i=o;if(o)r.push(o);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&r.push(i=l)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return r}function vC(t){return t.tag!=null}function wC(t){return t.style!=null}class br{constructor(e,r){this.schema=e,this.rules=r,this.tags=[],this.styles=[];let n=this.matchedStyles=[];r.forEach(s=>{if(vC(s))this.tags.push(s);else if(wC(s)){let o=/[^=]*/.exec(s.style)[0];n.indexOf(o)<0&&n.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,r={}){let n=new pp(this,r,!1);return n.addAll(e,ue.none,r.from,r.to),n.finish()}parseSlice(e,r={}){let n=new pp(this,r,!0);return n.addAll(e,ue.none,r.from,r.to),H.maxOpen(n.finish())}matchTag(e,r,n){for(let s=n?this.tags.indexOf(n)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(kC(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||r.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,r,n,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],a=i.style;if(!(a.indexOf(e)!=0||i.context&&!n.matchesContext(i.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=r))){if(i.getAttrs){let l=i.getAttrs(r);if(l===!1)continue;i.attrs=l||void 0}return i}}}static schemaRules(e){let r=[];function n(s){let o=s.priority==null?50:s.priority,i=0;for(;i<r.length;i++){let a=r[i];if((a.priority==null?50:a.priority)<o)break}r.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{n(i=hp(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{n(i=hp(i)),i.node||i.ignore||i.mark||(i.node=s)})}return r}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new br(e,br.schemaRules(e)))}}const om={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},DC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},im={ol:!0,ul:!0},As=1,xl=2,ys=4;function dp(t,e,r){return e!=null?(e?As:0)|(e==="full"?xl:0):t&&t.whitespace=="pre"?As|xl:r&~ys}class yo{constructor(e,r,n,s,o,i){this.type=e,this.attrs=r,this.marks=n,this.solid=s,this.options=i,this.content=[],this.activeMarks=ue.none,this.match=o||(i&ys?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let r=this.type.contentMatch.fillBefore(L.from(e));if(r)this.match=this.type.contentMatch.matchFragment(r);else{let n=this.type.contentMatch,s;return(s=n.findWrapping(e.type))?(this.match=n,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&As)){let n=this.content[this.content.length-1],s;if(n&&n.isText&&(s=/[ \t\r\n\u000c]+$/.exec(n.text))){let o=n;n.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let r=L.from(this.content);return!e&&this.match&&(r=r.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!om.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class pp{constructor(e,r,n){this.parser=e,this.options=r,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let s=r.topNode,o,i=dp(null,r.preserveWhitespace,0)|(n?ys:0);s?o=new yo(s.type,s.attrs,ue.none,!0,r.topMatch||s.type.contentMatch,i):n?o=new yo(null,null,ue.none,!0,null,i):o=new yo(e.schema.topNodeType,null,ue.none,!0,null,i),this.nodes=[o],this.find=r.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,r){e.nodeType==3?this.addTextNode(e,r):e.nodeType==1&&this.addElement(e,r)}addTextNode(e,r){let n=e.nodeValue,s=this.top,o=s.options&xl?"full":this.localPreserveWS||(s.options&As)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if(o==="full")n=n.replace(/\r\n?/g,`
80
- `);else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(i.linebreakReplacement.create(),r,!0),a[l]&&this.insertNode(i.text(a[l]),r,!/\S/.test(a[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),r,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,r,n){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),a;im.hasOwnProperty(i)&&this.parser.normalizeLists&&CC(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:DC.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,r);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(om.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,r);break e}let f=l&&l.skip?r:this.readStyles(e,r);f&&this.addAll(e,f),c&&this.sync(o),this.needsBlock=d}else{let c=this.readStyles(e,r);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,r){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
81
- `),r)}ignoreFallback(e,r){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),r,!0)}readStyles(e,r){let n=e.style;if(n&&n.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=n.getPropertyValue(o);if(i)for(let a=void 0;;){let l=this.parser.matchStyle(o,i,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?r=r.filter(c=>!l.clearMark(c)):r=r.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return r}addElementByRule(e,r,n,s){let o,i;if(r.node)if(i=this.parser.schema.nodes[r.node],i.isLeaf)this.insertNode(i.create(r.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(i,r.attrs||null,n,r.preserveWhitespace);l&&(o=!0,n=l)}else{let l=this.parser.schema.marks[r.mark];n=n.concat(l.create(r.attrs))}let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,n,s);else if(r.getContent)this.findInside(e),r.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof r.contentElement=="string"?l=e.querySelector(r.contentElement):typeof r.contentElement=="function"?l=r.contentElement(e):r.contentElement&&(l=r.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,r,n,s){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,a=s==null?null:e.childNodes[s];i!=a;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,r);this.findAtPoint(e,o)}findPlace(e,r,n){let s,o;for(let i=this.open,a=0;i>=0;i--){let l=this.nodes[i],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,o=l,!c.length))break;if(l.solid){if(n)break;a+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)r=this.enterInner(s[i],null,r,!1);return r}insertNode(e,r,n){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(r=this.enterInner(o,null,r))}let s=this.findPlace(e,r,n);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=ue.none;for(let a of s.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):fp(a.type,e.type))&&(i=a.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,r,n,s){let o=this.findPlace(e.create(r),n,!1);return o&&(o=this.enterInner(e,r,n,!0,s)),o}enterInner(e,r,n,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let a=dp(e,o,i.options);i.options&ys&&i.content.length==0&&(a|=ys);let l=ue.none;return n=n.filter(c=>(i.type?i.type.allowsMarkType(c.type):fp(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new yo(e,r,l,s,null,a)),this.open++,n}closeExtra(e=!1){let r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let r=this.open;r>=0;r--){if(this.nodes[r]==e)return this.open=r,!0;this.localPreserveWS&&(this.nodes[r].options|=As)}return!1}get currentPos(){this.closeExtra();let e=0;for(let r=this.open;r>=0;r--){let n=this.nodes[r].content;for(let s=n.length-1;s>=0;s--)e+=n[s].nodeSize;r&&e++}return e}findAtPoint(e,r){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==r&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&(this.find[r].pos=this.currentPos)}findAround(e,r,n){if(e!=r&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&r.compareDocumentPosition(this.find[s].node)&(n?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&(this.find[r].pos=this.currentPos-(e.nodeValue.length-this.find[r].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let r=e.split("/"),n=this.options.context,s=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(s?0:1),i=(a,l)=>{for(;a>=0;a--){let c=r[a];if(c==""){if(a==r.length-1||a==0)continue;for(;l>=o;l--)if(i(a-1,l))return!0;return!1}else{let d=l>0||l==0&&s?this.nodes[l].type:n&&l>=o?n.node(l-o).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return i(r.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let r=e.depth;r>=0;r--){let n=e.node(r).contentMatchAt(e.indexAfter(r)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let r in this.parser.schema.nodes){let n=this.parser.schema.nodes[r];if(n.isTextblock&&n.defaultAttrs)return n}}}function CC(t){for(let e=t.firstChild,r=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&im.hasOwnProperty(n)&&r?(r.appendChild(e),e=r):n=="li"?r=e:n&&(r=null)}}function kC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function hp(t){let e={};for(let r in t)e[r]=t[r];return e}function fp(t,e){let r=e.schema.nodes;for(let n in r){let s=r[n];if(!s.allowsMarkType(t))continue;let o=[],i=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||o.indexOf(d)<0&&i(d))return!0}};if(i(s.contentMatch))return!0}}class on{constructor(e,r){this.nodes=e,this.marks=r}serializeFragment(e,r={},n){n||(n=Ma(r).createDocumentFragment());let s=n,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let a=0,l=0;for(;a<o.length&&l<i.marks.length;){let c=i.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)s=o.pop()[1];for(;l<i.marks.length;){let c=i.marks[l++],d=this.serializeMark(c,i.isInline,r);d&&(o.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(i,r))}),n}serializeNodeInner(e,r){let{dom:n,contentDOM:s}=Mo(Ma(r),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,r,s)}return n}serializeNode(e,r={}){let n=this.serializeNodeInner(e,r);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,r);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,r,n={}){let s=this.marks[e.type.name];return s&&Mo(Ma(n),s(e,r),null,e.attrs)}static renderSpec(e,r,n=null,s){return Mo(e,r,n,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new on(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let r=mp(e.nodes);return r.text||(r.text=n=>n.text),r}static marksFromSchema(e){return mp(e.marks)}}function mp(t){let e={};for(let r in t){let n=t[r].spec.toDOM;n&&(e[r]=n)}return e}function Ma(t){return t.document||window.document}const gp=new WeakMap;function EC(t){let e=gp.get(t);return e===void 0&&gp.set(t,e=SC(t)),e}function SC(t){let e=null;function r(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let s=0;s<n.length;s++)r(n[s]);else for(let s in n)r(n[s])}return r(t),e}function Mo(t,e,r,n){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(o=EC(n))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=s.indexOf(" ");i>0&&(r=s.slice(0,i),s=s.slice(i+1));let a,l=r?t.createElementNS(r,s):t.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let f in c)if(c[f]!=null){let m=f.indexOf(" ");m>0?l.setAttributeNS(f.slice(0,m),f.slice(m+1),c[f]):f=="style"&&l.style?l.style.cssText=c[f]:l.setAttribute(f,c[f])}}for(let f=d;f<e.length;f++){let m=e[f];if(m===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:g,contentDOM:y}=Mo(t,m,r,n);if(l.appendChild(g),y){if(a)throw new RangeError("Multiple content holes");a=y}}}return{dom:l,contentDOM:a}}const am=65535,lm=Math.pow(2,16);function FC(t,e){return t+e*lm}function bp(t){return t&am}function AC(t){return(t-(t&am))/lm}const um=1,cm=2,Bo=4,dm=8;class vl{constructor(e,r,n){this.pos=e,this.delInfo=r,this.recover=n}get deleted(){return(this.delInfo&dm)>0}get deletedBefore(){return(this.delInfo&(um|Bo))>0}get deletedAfter(){return(this.delInfo&(cm|Bo))>0}get deletedAcross(){return(this.delInfo&Bo)>0}}class rt{constructor(e,r=!1){if(this.ranges=e,this.inverted=r,!e.length&&rt.empty)return rt.empty}recover(e){let r=0,n=bp(e);if(!this.inverted)for(let s=0;s<n;s++)r+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[n*3]+r+AC(e)}mapResult(e,r=1){return this._map(e,r,!1)}map(e,r=1){return this._map(e,r,!0)}_map(e,r,n){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+o],d=this.ranges[a+i],f=l+c;if(e<=f){let m=c?e==l?-1:e==f?1:r:r,g=l+s+(m<0?0:d);if(n)return g;let y=e==(r<0?l:f)?null:FC(a/3,e-l),v=e==l?cm:e==f?um:Bo;return(r<0?e!=l:e!=f)&&(v|=dm),new vl(g,v,y)}s+=d-c}return n?e+s:new vl(e+s,0,null)}touches(e,r){let n=0,s=bp(r),o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let c=this.ranges[a+o],d=l+c;if(e<=d&&a==s*3)return!0;n+=this.ranges[a+i]-c}return!1}forEach(e){let r=this.inverted?2:1,n=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],a=i-(this.inverted?o:0),l=i+(this.inverted?0:o),c=this.ranges[s+r],d=this.ranges[s+n];e(a,a+c,l,l+d),o+=d-c}}invert(){return new rt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?rt.empty:new rt(e<0?[0,-e,0]:[0,0,e])}}rt.empty=new rt([]);class Ns{constructor(e,r,n=0,s=e?e.length:0){this.mirror=r,this.from=n,this.to=s,this._maps=e||[],this.ownData=!(e||r)}get maps(){return this._maps}slice(e=0,r=this.maps.length){return new Ns(this._maps,this.mirror,e,r)}appendMap(e,r){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),r!=null&&this.setMirror(this._maps.length-1,r)}appendMapping(e){for(let r=0,n=this._maps.length;r<e._maps.length;r++){let s=e.getMirror(r);this.appendMap(e._maps[r],s!=null&&s<r?n+s:void 0)}}getMirror(e){if(this.mirror){for(let r=0;r<this.mirror.length;r++)if(this.mirror[r]==e)return this.mirror[r+(r%2?-1:1)]}}setMirror(e,r){this.mirror||(this.mirror=[]),this.mirror.push(e,r)}appendMappingInverted(e){for(let r=e.maps.length-1,n=this._maps.length+e._maps.length;r>=0;r--){let s=e.getMirror(r);this.appendMap(e._maps[r].invert(),s!=null&&s>r?n-s-1:void 0)}}invert(){let e=new Ns;return e.appendMappingInverted(this),e}map(e,r=1){if(this.mirror)return this._map(e,r,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,r);return e}mapResult(e,r=1){return this._map(e,r,!1)}_map(e,r,n){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],a=i.mapResult(e,r);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return n?e:new vl(e,s,null)}}const Ba=Object.create(null);class qe{getMap(){return rt.empty}merge(e){return null}static fromJSON(e,r){if(!r||!r.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Ba[r.stepType];if(!n)throw new RangeError(`No step type ${r.stepType} defined`);return n.fromJSON(e,r)}static jsonID(e,r){if(e in Ba)throw new RangeError("Duplicate use of step JSON ID "+e);return Ba[e]=r,r.prototype.jsonID=e,r}}class De{constructor(e,r){this.doc=e,this.failed=r}static ok(e){return new De(e,null)}static fail(e){return new De(null,e)}static fromReplace(e,r,n,s){try{return De.ok(e.replace(r,n,s))}catch(o){if(o instanceof Ro)return De.fail(o.message);throw o}}}function bu(t,e,r){let n=[];for(let s=0;s<t.childCount;s++){let o=t.child(s);o.content.size&&(o=o.copy(bu(o.content,e,o))),o.isInline&&(o=e(o,r,s)),n.push(o)}return L.fromArray(n)}class hr extends qe{constructor(e,r,n){super(),this.from=e,this.to=r,this.mark=n}apply(e){let r=e.slice(this.from,this.to),n=e.resolve(this.from),s=n.node(n.sharedDepth(this.to)),o=new H(bu(r.content,(i,a)=>!i.isAtom||!a.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),r.openStart,r.openEnd);return De.fromReplace(e,this.from,this.to,o)}invert(){return new Dt(this.from,this.to,this.mark)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new hr(r.pos,n.pos,this.mark)}merge(e){return e instanceof hr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new hr(r.from,r.to,e.markFromJSON(r.mark))}}qe.jsonID("addMark",hr);class Dt extends qe{constructor(e,r,n){super(),this.from=e,this.to=r,this.mark=n}apply(e){let r=e.slice(this.from,this.to),n=new H(bu(r.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),r.openStart,r.openEnd);return De.fromReplace(e,this.from,this.to,n)}invert(){return new hr(this.from,this.to,this.mark)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new Dt(r.pos,n.pos,this.mark)}merge(e){return e instanceof Dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Dt(r.from,r.to,e.markFromJSON(r.mark))}}qe.jsonID("removeMark",Dt);class fr extends qe{constructor(e,r){super(),this.pos=e,this.mark=r}apply(e){let r=e.nodeAt(this.pos);if(!r)return De.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.addToSet(r.marks));return De.fromReplace(e,this.pos,this.pos+1,new H(L.from(n),0,r.isLeaf?0:1))}invert(e){let r=e.nodeAt(this.pos);if(r){let n=this.mark.addToSet(r.marks);if(n.length==r.marks.length){for(let s=0;s<r.marks.length;s++)if(!r.marks[s].isInSet(n))return new fr(this.pos,r.marks[s]);return new fr(this.pos,this.mark)}}return new Zr(this.pos,this.mark)}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new fr(r.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fr(r.pos,e.markFromJSON(r.mark))}}qe.jsonID("addNodeMark",fr);class Zr extends qe{constructor(e,r){super(),this.pos=e,this.mark=r}apply(e){let r=e.nodeAt(this.pos);if(!r)return De.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.removeFromSet(r.marks));return De.fromReplace(e,this.pos,this.pos+1,new H(L.from(n),0,r.isLeaf?0:1))}invert(e){let r=e.nodeAt(this.pos);return!r||!this.mark.isInSet(r.marks)?this:new fr(this.pos,this.mark)}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new Zr(r.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Zr(r.pos,e.markFromJSON(r.mark))}}qe.jsonID("removeNodeMark",Zr);class Ne extends qe{constructor(e,r,n,s=!1){super(),this.from=e,this.to=r,this.slice=n,this.structure=s}apply(e){return this.structure&&wl(e,this.from,this.to)?De.fail("Structure replace would overwrite content"):De.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ne(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deletedAcross&&n.deletedAcross?null:new Ne(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ne)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let r=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ne(this.from,this.to+(e.to-e.from),r,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let r=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ne(e.from,this.to,r,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ne(r.from,r.to,H.fromJSON(e,r.slice),!!r.structure)}}qe.jsonID("replace",Ne);class Te extends qe{constructor(e,r,n,s,o,i,a=!1){super(),this.from=e,this.to=r,this.gapFrom=n,this.gapTo=s,this.slice=o,this.insert=i,this.structure=a}apply(e){if(this.structure&&(wl(e,this.from,this.gapFrom)||wl(e,this.gapTo,this.to)))return De.fail("Structure gap-replace would overwrite content");let r=e.slice(this.gapFrom,this.gapTo);if(r.openStart||r.openEnd)return De.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,r.content);return n?De.fromReplace(e,this.from,this.to,n):De.fail("Content does not fit in gap")}getMap(){return new rt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let r=this.gapTo-this.gapFrom;return new Te(this.from,this.from+this.slice.size+r,this.from+this.insert,this.from+this.insert+r,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),s=this.from==this.gapFrom?r.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return r.deletedAcross&&n.deletedAcross||s<r.pos||o>n.pos?null:new Te(r.pos,n.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number"||typeof r.gapFrom!="number"||typeof r.gapTo!="number"||typeof r.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Te(r.from,r.to,r.gapFrom,r.gapTo,H.fromJSON(e,r.slice),r.insert,!!r.structure)}}qe.jsonID("replaceAround",Te);function wl(t,e,r){let n=t.resolve(e),s=r-e,o=n.depth;for(;s>0&&o>0&&n.indexAfter(o)==n.node(o).childCount;)o--,s--;if(s>0){let i=n.node(o).maybeChild(n.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function NC(t,e,r,n){let s=[],o=[],i,a;t.doc.nodesBetween(e,r,(l,c,d)=>{if(!l.isInline)return;let f=l.marks;if(!n.isInSet(f)&&d.type.allowsMarkType(n.type)){let m=Math.max(c,e),g=Math.min(c+l.nodeSize,r),y=n.addToSet(f);for(let v=0;v<f.length;v++)f[v].isInSet(y)||(i&&i.to==m&&i.mark.eq(f[v])?i.to=g:s.push(i=new Dt(m,g,f[v])));a&&a.to==m?a.to=g:o.push(a=new hr(m,g,n))}}),s.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function TC(t,e,r,n){let s=[],o=0;t.doc.nodesBetween(e,r,(i,a)=>{if(!i.isInline)return;o++;let l=null;if(n instanceof Li){let c=i.marks,d;for(;d=n.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else n?n.isInSet(i.marks)&&(l=[n]):l=i.marks;if(l&&l.length){let c=Math.min(a+i.nodeSize,r);for(let d=0;d<l.length;d++){let f=l[d],m;for(let g=0;g<s.length;g++){let y=s[g];y.step==o-1&&f.eq(s[g].style)&&(m=y)}m?(m.to=c,m.step=o):s.push({style:f,from:Math.max(a,e),to:c,step:o})}}}),s.forEach(i=>t.step(new Dt(i.from,i.to,i.style)))}function yu(t,e,r,n=r.contentMatch,s=!0){let o=t.doc.nodeAt(e),i=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),d=a+c.nodeSize,f=n.matchType(c.type);if(!f)i.push(new Ne(a,d,H.empty));else{n=f;for(let m=0;m<c.marks.length;m++)r.allowsMarkType(c.marks[m].type)||t.step(new Dt(a,d,c.marks[m]));if(s&&c.isText&&r.whitespace!="pre"){let m,g=/\r?\n|\r/g,y;for(;m=g.exec(c.text);)y||(y=new H(L.from(r.schema.text(" ",r.allowedMarks(c.marks))),0,0)),i.push(new Ne(a+m.index,a+m.index+m[0].length,y))}}a=d}if(!n.validEnd){let l=n.fillBefore(L.empty,!0);t.replace(a,a,new H(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function MC(t,e,r){return(e==0||t.canReplace(e,t.childCount))&&(r==t.childCount||t.canReplace(0,r))}function zn(t){let r=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let s=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&s.canReplace(o,i,r))return n;if(n==0||s.type.spec.isolating||!MC(s,o,i))break}return null}function BC(t,e,r){let{$from:n,$to:s,depth:o}=e,i=n.before(o+1),a=s.after(o+1),l=i,c=a,d=L.empty,f=0;for(let y=o,v=!1;y>r;y--)v||n.index(y)>0?(v=!0,d=L.from(n.node(y).copy(d)),f++):l--;let m=L.empty,g=0;for(let y=o,v=!1;y>r;y--)v||s.after(y+1)<s.end(y)?(v=!0,m=L.from(s.node(y).copy(m)),g++):c++;t.step(new Te(l,c,i,a,new H(d.append(m),f,g),d.size-f,!0))}function xu(t,e,r=null,n=t){let s=jC(t,e),o=s&&OC(n,e);return o?s.map(yp).concat({type:e,attrs:r}).concat(o.map(yp)):null}function yp(t){return{type:t,attrs:null}}function jC(t,e){let{parent:r,startIndex:n,endIndex:s}=t,o=r.contentMatchAt(n).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return r.canReplaceWith(n,s,i)?o:null}function OC(t,e){let{parent:r,startIndex:n,endIndex:s}=t,o=r.child(n),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let l=(i.length?i[i.length-1]:e).contentMatch;for(let c=n;l&&c<s;c++)l=l.matchType(r.child(c).type);return!l||!l.validEnd?null:i}function LC(t,e,r){let n=L.empty;for(let i=r.length-1;i>=0;i--){if(n.size){let a=r[i].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=L.from(r[i].type.create(r[i].attrs,n))}let s=e.start,o=e.end;t.step(new Te(s,o,s,o,new H(n,0,0),r.length,!0))}function _C(t,e,r,n,s){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,r,(i,a)=>{let l=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(n,l)&&IC(t.doc,t.mapping.slice(o).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let g=n.whitespace=="pre",y=!!n.contentMatch.matchType(n.schema.linebreakReplacement);g&&!y?c=!1:!g&&y&&(c=!0)}c===!1&&hm(t,i,a,o),yu(t,t.mapping.slice(o).map(a,1),n,void 0,c===null);let d=t.mapping.slice(o),f=d.map(a,1),m=d.map(a+i.nodeSize,1);return t.step(new Te(f,m,f+1,m-1,new H(L.from(n.create(l,null,i.marks)),0,0),1,!0)),c===!0&&pm(t,i,a,o),!1}})}function pm(t,e,r,n){e.forEach((s,o)=>{if(s.isText){let i,a=/\r?\n|\r/g;for(;i=a.exec(s.text);){let l=t.mapping.slice(n).map(r+1+o+i.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function hm(t,e,r,n){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=t.mapping.slice(n).map(r+1+o);t.replaceWith(i,i+1,e.type.schema.text(`
82
- `))}})}function IC(t,e,r){let n=t.resolve(e),s=n.index();return n.parent.canReplaceWith(s,s+1,r)}function RC(t,e,r,n,s){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");r||(r=o.type);let i=r.create(n,null,s||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,i);if(!r.validContent(o.content))throw new RangeError("Invalid content for node type "+r.name);t.step(new Te(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new H(L.from(i),0,0),1,!0))}function Ut(t,e,r=1,n){let s=t.resolve(e),o=s.depth-r,i=n&&n[n.length-1]||s.parent;if(o<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!i.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,d=r-2;c>o;c--,d--){let f=s.node(c),m=s.index(c);if(f.type.spec.isolating)return!1;let g=f.content.cutByIndex(m,f.childCount),y=n&&n[d+1];y&&(g=g.replaceChild(0,y.type.create(y.attrs)));let v=n&&n[d]||f;if(!f.canReplace(m+1,f.childCount)||!v.type.validContent(g))return!1}let a=s.indexAfter(o),l=n&&n[0];return s.node(o).canReplaceWith(a,a,l?l.type:s.node(o+1).type)}function PC(t,e,r=1,n){let s=t.doc.resolve(e),o=L.empty,i=L.empty;for(let a=s.depth,l=s.depth-r,c=r-1;a>l;a--,c--){o=L.from(s.node(a).copy(o));let d=n&&n[c];i=L.from(d?d.type.create(d.attrs,i):s.node(a).copy(i))}t.step(new Ne(e,e,new H(o.append(i),r,r),!0))}function Sr(t,e){let r=t.resolve(e),n=r.index();return fm(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function zC(t,e){e.content.size||t.type.compatibleContent(e.type);let r=t.contentMatchAt(t.childCount),{linebreakReplacement:n}=t.type.schema;for(let s=0;s<e.childCount;s++){let o=e.child(s),i=o.type==n?t.type.schema.nodes.text:o.type;if(r=r.matchType(i),!r||!t.type.allowsMarks(o.marks))return!1}return r.validEnd}function fm(t,e){return!!(t&&e&&!t.isLeaf&&zC(t,e))}function _i(t,e,r=-1){let n=t.resolve(e);for(let s=n.depth;;s--){let o,i,a=n.index(s);if(s==n.depth?(o=n.nodeBefore,i=n.nodeAfter):r>0?(o=n.node(s+1),a++,i=n.node(s).maybeChild(a)):(o=n.node(s).maybeChild(a-1),i=n.node(s+1)),o&&!o.isTextblock&&fm(o,i)&&n.node(s).canReplace(a,a+1))return e;if(s==0)break;e=r<0?n.before(s):n.after(s)}}function $C(t,e,r){let n=null,{linebreakReplacement:s}=t.doc.type.schema,o=t.doc.resolve(e-r),i=o.node().type;if(s&&i.inlineContent){let d=i.whitespace=="pre",f=!!i.contentMatch.matchType(s);d&&!f?n=!1:!d&&f&&(n=!0)}let a=t.steps.length;if(n===!1){let d=t.doc.resolve(e+r);hm(t,d.node(),d.before(),a)}i.inlineContent&&yu(t,e+r-1,i,o.node().contentMatchAt(o.index()),n==null);let l=t.mapping.slice(a),c=l.map(e-r);if(t.step(new Ne(c,l.map(e+r,-1),H.empty,!0)),n===!0){let d=t.doc.resolve(c);pm(t,d.node(),d.before(),t.steps.length)}return t}function HC(t,e,r){let n=t.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),r))return e;if(n.parentOffset==0)for(let s=n.depth-1;s>=0;s--){let o=n.index(s);if(n.node(s).canReplaceWith(o,o,r))return n.before(s+1);if(o>0)return null}if(n.parentOffset==n.parent.content.size)for(let s=n.depth-1;s>=0;s--){let o=n.indexAfter(s);if(n.node(s).canReplaceWith(o,o,r))return n.after(s+1);if(o<n.node(s).childCount)return null}return null}function mm(t,e,r){let n=t.resolve(e);if(!r.content.size)return e;let s=r.content;for(let o=0;o<r.openStart;o++)s=s.firstChild.content;for(let o=1;o<=(r.openStart==0&&r.size?2:1);o++)for(let i=n.depth;i>=0;i--){let a=i==n.depth?0:n.pos<=(n.start(i+1)+n.end(i+1))/2?-1:1,l=n.index(i)+(a>0?1:0),c=n.node(i),d=!1;if(o==1)d=c.canReplace(l,l,s);else{let f=c.contentMatchAt(l).findWrapping(s.firstChild.type);d=f&&c.canReplaceWith(l,l,f[0])}if(d)return a==0?n.pos:a<0?n.before(i+1):n.after(i+1)}return null}function Ii(t,e,r=e,n=H.empty){if(e==r&&!n.size)return null;let s=t.resolve(e),o=t.resolve(r);return gm(s,o,n)?new Ne(e,r,n):new VC(s,o,n).fit()}function gm(t,e,r){return!r.openStart&&!r.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),r.content)}class VC{constructor(e,r,n){this.$from=e,this.$to=r,this.unplaced=n,this.frontier=[],this.placed=L.empty;for(let s=0;s<=e.depth;s++){let o=e.node(s);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=L.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,n=this.$from,s=this.close(e<0?this.$to:n.doc.resolve(e));if(!s)return null;let o=this.placed,i=n.depth,a=s.depth;for(;i&&a&&o.childCount==1;)o=o.firstChild.content,i--,a--;let l=new H(o,i,a);return e>-1?new Te(n.pos,e,this.$to.pos,this.$to.end(),l,r):l.size||n.pos!=this.$to.pos?new Ne(n.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let r=this.unplaced.content,n=0,s=this.unplaced.openEnd;n<e;n++){let o=r.firstChild;if(r.childCount>1&&(s=0),o.type.spec.isolating&&s<=n){e=n;break}r=o.content}for(let r=1;r<=2;r++)for(let n=r==1?e:this.unplaced.openStart;n>=0;n--){let s,o=null;n?(o=ja(this.unplaced.content,n-1).firstChild,s=o.content):s=this.unplaced.content;let i=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,f=null;if(r==1&&(i?c.matchType(i.type)||(f=c.fillBefore(L.from(i),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:a,parent:o,inject:f};if(r==2&&i&&(d=c.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:a,parent:o,wrap:d};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:r,openEnd:n}=this.unplaced,s=ja(e,r);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new H(e,r+1,Math.max(n,s.size+r>=e.size-n?r+1:0)),!0)}dropNode(){let{content:e,openStart:r,openEnd:n}=this.unplaced,s=ja(e,r);if(s.childCount<=1&&r>0){let o=e.size-r<=r+s.size;this.unplaced=new H(cs(e,r-1,1),r-1,o?r-1:n)}else this.unplaced=new H(cs(e,r,1),r,n)}placeNodes({sliceDepth:e,frontierDepth:r,parent:n,inject:s,wrap:o}){for(;this.depth>r;)this.closeFrontierNode();if(o)for(let v=0;v<o.length;v++)this.openFrontierNode(o[v]);let i=this.unplaced,a=n?n.content:i.content,l=i.openStart-e,c=0,d=[],{match:f,type:m}=this.frontier[r];if(s){for(let v=0;v<s.childCount;v++)d.push(s.child(v));f=f.matchFragment(s)}let g=a.size+e-(i.content.size-i.openEnd);for(;c<a.childCount;){let v=a.child(c),w=f.matchType(v.type);if(!w)break;c++,(c>1||l==0||v.content.size)&&(f=w,d.push(bm(v.mark(m.allowedMarks(v.marks)),c==1?l:0,c==a.childCount?g:-1)))}let y=c==a.childCount;y||(g=-1),this.placed=ds(this.placed,r,L.from(d)),this.frontier[r].match=f,y&&g<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,w=a;v<g;v++){let D=w.lastChild;this.frontier.push({type:D.type,match:D.contentMatchAt(D.childCount)}),w=D.content}this.unplaced=y?e==0?H.empty:new H(cs(i.content,e-1,1),e-1,g<0?i.openEnd:e-1):new H(cs(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],r;if(!e.type.isTextblock||!Oa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(r=this.findCloseLevel(this.$to))&&r.depth==this.depth)return-1;let{depth:n}=this.$to,s=this.$to.after(n);for(;n>1&&s==this.$to.end(--n);)++s;return s}findCloseLevel(e){e:for(let r=Math.min(this.depth,e.depth);r>=0;r--){let{match:n,type:s}=this.frontier[r],o=r<e.depth&&e.end(r+1)==e.pos+(e.depth-(r+1)),i=Oa(e,r,s,n,o);if(i){for(let a=r-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Oa(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:r,fit:i,move:o?e.doc.resolve(e.after(r+1)):e}}}}close(e){let r=this.findCloseLevel(e);if(!r)return null;for(;this.depth>r.depth;)this.closeFrontierNode();r.fit.childCount&&(this.placed=ds(this.placed,r.depth,r.fit)),e=r.move;for(let n=r.depth+1;n<=e.depth;n++){let s=e.node(n),o=s.type.contentMatch.fillBefore(s.content,!0,e.index(n));this.openFrontierNode(s.type,s.attrs,o)}return e}openFrontierNode(e,r=null,n){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=ds(this.placed,this.depth,L.from(e.create(r,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let r=this.frontier.pop().match.fillBefore(L.empty,!0);r.childCount&&(this.placed=ds(this.placed,this.frontier.length,r))}}function cs(t,e,r){return e==0?t.cutByIndex(r,t.childCount):t.replaceChild(0,t.firstChild.copy(cs(t.firstChild.content,e-1,r)))}function ds(t,e,r){return e==0?t.append(r):t.replaceChild(t.childCount-1,t.lastChild.copy(ds(t.lastChild.content,e-1,r)))}function ja(t,e){for(let r=0;r<e;r++)t=t.firstChild.content;return t}function bm(t,e,r){if(e<=0)return t;let n=t.content;return e>1&&(n=n.replaceChild(0,bm(n.firstChild,e-1,n.childCount==1?r-1:0))),e>0&&(n=t.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(t.type.contentMatch.matchFragment(n).fillBefore(L.empty,!0)))),t.copy(n)}function Oa(t,e,r,n,s){let o=t.node(e),i=s?t.indexAfter(e):t.index(e);if(i==o.childCount&&!r.compatibleContent(o.type))return null;let a=n.fillBefore(o.content,!0,i);return a&&!qC(r,o.content,i)?a:null}function qC(t,e,r){for(let n=r;n<e.childCount;n++)if(!t.allowsMarks(e.child(n).marks))return!0;return!1}function WC(t){return t.spec.defining||t.spec.definingForContent}function UC(t,e,r,n){if(!n.size)return t.deleteRange(e,r);let s=t.doc.resolve(e),o=t.doc.resolve(r);if(gm(s,o,n))return t.step(new Ne(e,r,n));let i=xm(s,t.doc.resolve(r));i[i.length-1]==0&&i.pop();let a=-(s.depth+1);i.unshift(a);for(let m=s.depth,g=s.pos-1;m>0;m--,g--){let y=s.node(m).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;i.indexOf(m)>-1?a=m:s.before(m)==g&&i.splice(1,0,-m)}let l=i.indexOf(a),c=[],d=n.openStart;for(let m=n.content,g=0;;g++){let y=m.firstChild;if(c.push(y),g==n.openStart)break;m=y.content}for(let m=d-1;m>=0;m--){let g=c[m],y=WC(g.type);if(y&&!g.sameMarkup(s.node(Math.abs(a)-1)))d=m;else if(y||!g.type.isTextblock)break}for(let m=n.openStart;m>=0;m--){let g=(m+d+1)%(n.openStart+1),y=c[g];if(y)for(let v=0;v<i.length;v++){let w=i[(v+l)%i.length],D=!0;w<0&&(D=!1,w=-w);let E=s.node(w-1),N=s.index(w-1);if(E.canReplaceWith(N,N,y.type,y.marks))return t.replace(s.before(w),D?o.after(w):r,new H(ym(n.content,0,n.openStart,g),g,n.openEnd))}}let f=t.steps.length;for(let m=i.length-1;m>=0&&(t.replace(e,r,n),!(t.steps.length>f));m--){let g=i[m];g<0||(e=s.before(g),r=o.after(g))}}function ym(t,e,r,n,s){if(e<r){let o=t.firstChild;t=t.replaceChild(0,o.copy(ym(o.content,e+1,r,n,o)))}if(e>n){let o=s.contentMatchAt(0),i=o.fillBefore(t).append(t);t=i.append(o.matchFragment(i).fillBefore(L.empty,!0))}return t}function JC(t,e,r,n){if(!n.isInline&&e==r&&t.doc.resolve(e).parent.content.size){let s=HC(t.doc,e,n.type);s!=null&&(e=r=s)}t.replaceRange(e,r,new H(L.from(n),0,0))}function KC(t,e,r){let n=t.doc.resolve(e),s=t.doc.resolve(r),o=xm(n,s);for(let i=0;i<o.length;i++){let a=o[i],l=i==o.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return t.delete(n.start(a),s.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),s.indexAfter(a-1))))return t.delete(n.before(a),s.after(a))}for(let i=1;i<=n.depth&&i<=s.depth;i++)if(e-n.start(i)==n.depth-i&&r>n.end(i)&&s.end(i)-r!=s.depth-i&&n.start(i-1)==s.start(i-1)&&n.node(i-1).canReplace(n.index(i-1),s.index(i-1)))return t.delete(n.before(i),r);t.delete(e,r)}function xm(t,e){let r=[],n=Math.min(t.depth,e.depth);for(let s=n;s>=0;s--){let o=t.start(s);if(o<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(o==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==o-1)&&r.push(s)}return r}class En extends qe{constructor(e,r,n){super(),this.pos=e,this.attr=r,this.value=n}apply(e){let r=e.nodeAt(this.pos);if(!r)return De.fail("No node at attribute step's position");let n=Object.create(null);for(let o in r.attrs)n[o]=r.attrs[o];n[this.attr]=this.value;let s=r.type.create(n,null,r.marks);return De.fromReplace(e,this.pos,this.pos+1,new H(L.from(s),0,r.isLeaf?0:1))}getMap(){return rt.empty}invert(e){return new En(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new En(r.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,r){if(typeof r.pos!="number"||typeof r.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new En(r.pos,r.attr,r.value)}}qe.jsonID("attr",En);class Ts extends qe{constructor(e,r){super(),this.attr=e,this.value=r}apply(e){let r=Object.create(null);for(let s in e.attrs)r[s]=e.attrs[s];r[this.attr]=this.value;let n=e.type.create(r,e.content,e.marks);return De.ok(n)}getMap(){return rt.empty}invert(e){return new Ts(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,r){if(typeof r.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ts(r.attr,r.value)}}qe.jsonID("docAttr",Ts);let Nn=class extends Error{};Nn=function t(e){let r=Error.call(this,e);return r.__proto__=t.prototype,r};Nn.prototype=Object.create(Error.prototype);Nn.prototype.constructor=Nn;Nn.prototype.name="TransformError";class vm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ns}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let r=this.maybeStep(e);if(r.failed)throw new Nn(r.failed);return this}maybeStep(e){let r=e.apply(this.doc);return r.failed||this.addStep(e,r.doc),r}get docChanged(){return this.steps.length>0}addStep(e,r){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=r}replace(e,r=e,n=H.empty){let s=Ii(this.doc,e,r,n);return s&&this.step(s),this}replaceWith(e,r,n){return this.replace(e,r,new H(L.from(n),0,0))}delete(e,r){return this.replace(e,r,H.empty)}insert(e,r){return this.replaceWith(e,e,r)}replaceRange(e,r,n){return UC(this,e,r,n),this}replaceRangeWith(e,r,n){return JC(this,e,r,n),this}deleteRange(e,r){return KC(this,e,r),this}lift(e,r){return BC(this,e,r),this}join(e,r=1){return $C(this,e,r),this}wrap(e,r){return LC(this,e,r),this}setBlockType(e,r=e,n,s=null){return _C(this,e,r,n,s),this}setNodeMarkup(e,r,n=null,s){return RC(this,e,r,n,s),this}setNodeAttribute(e,r,n){return this.step(new En(e,r,n)),this}setDocAttribute(e,r){return this.step(new Ts(e,r)),this}addNodeMark(e,r){return this.step(new fr(e,r)),this}removeNodeMark(e,r){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(r instanceof ue)r.isInSet(n.marks)&&this.step(new Zr(e,r));else{let s=n.marks,o,i=[];for(;o=r.isInSet(s);)i.push(new Zr(e,o)),s=o.removeFromSet(s);for(let a=i.length-1;a>=0;a--)this.step(i[a])}return this}split(e,r=1,n){return PC(this,e,r,n),this}addMark(e,r,n){return NC(this,e,r,n),this}removeMark(e,r,n){return TC(this,e,r,n),this}clearIncompatible(e,r,n){return yu(this,e,r,n),this}}const La=Object.create(null);class re{constructor(e,r,n){this.$anchor=e,this.$head=r,this.ranges=n||[new GC(e.min(r),e.max(r))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let r=0;r<e.length;r++)if(e[r].$from.pos!=e[r].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,r=H.empty){let n=r.content.lastChild,s=null;for(let a=0;a<r.openEnd;a++)s=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:c}=i[a],d=e.mapping.slice(o);e.replaceRange(d.map(l.pos),d.map(c.pos),a?H.empty:r),a==0&&wp(e,o,(n?n.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,r){let n=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:i,$to:a}=s[o],l=e.mapping.slice(n),c=l.map(i.pos),d=l.map(a.pos);o?e.deleteRange(c,d):(e.replaceRangeWith(c,d,r),wp(e,n,r.isInline?-1:1))}}static findFrom(e,r,n=!1){let s=e.parent.inlineContent?new X(e):yn(e.node(0),e.parent,e.pos,e.index(),r,n);if(s)return s;for(let o=e.depth-1;o>=0;o--){let i=r<0?yn(e.node(0),e.node(o),e.before(o+1),e.index(o),r,n):yn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,r,n);if(i)return i}return null}static near(e,r=1){return this.findFrom(e,r)||this.findFrom(e,-r)||new st(e.node(0))}static atStart(e){return yn(e,e,0,0,1)||new st(e)}static atEnd(e){return yn(e,e,e.content.size,e.childCount,-1)||new st(e)}static fromJSON(e,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=La[r.type];if(!n)throw new RangeError(`No selection type ${r.type} defined`);return n.fromJSON(e,r)}static jsonID(e,r){if(e in La)throw new RangeError("Duplicate use of selection JSON ID "+e);return La[e]=r,r.prototype.jsonID=e,r}getBookmark(){return X.between(this.$anchor,this.$head).getBookmark()}}re.prototype.visible=!0;class GC{constructor(e,r){this.$from=e,this.$to=r}}let xp=!1;function vp(t){!xp&&!t.parent.inlineContent&&(xp=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class X extends re{constructor(e,r=e){vp(e),vp(r),super(e,r)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,r){let n=e.resolve(r.map(this.head));if(!n.parent.inlineContent)return re.near(n);let s=e.resolve(r.map(this.anchor));return new X(s.parent.inlineContent?s:n,n)}replace(e,r=H.empty){if(super.replace(e,r),r==H.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof X&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ri(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,r){if(typeof r.anchor!="number"||typeof r.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new X(e.resolve(r.anchor),e.resolve(r.head))}static create(e,r,n=r){let s=e.resolve(r);return new this(s,n==r?s:e.resolve(n))}static between(e,r,n){let s=e.pos-r.pos;if((!n||s)&&(n=s>=0?1:-1),!r.parent.inlineContent){let o=re.findFrom(r,n,!0)||re.findFrom(r,-n,!0);if(o)r=o.$head;else return re.near(r,n)}return e.parent.inlineContent||(s==0?e=r:(e=(re.findFrom(e,-n,!0)||re.findFrom(e,n,!0)).$anchor,e.pos<r.pos!=s<0&&(e=r))),new X(e,r)}}re.jsonID("text",X);class Ri{constructor(e,r){this.anchor=e,this.head=r}map(e){return new Ri(e.map(this.anchor),e.map(this.head))}resolve(e){return X.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends re{constructor(e){let r=e.nodeAfter,n=e.node(0).resolve(e.pos+r.nodeSize);super(e,n),this.node=r}map(e,r){let{deleted:n,pos:s}=r.mapResult(this.anchor),o=e.resolve(s);return n?re.near(o):new Y(o)}content(){return new H(L.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new vu(this.anchor)}static fromJSON(e,r){if(typeof r.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(r.anchor))}static create(e,r){return new Y(e.resolve(r))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1;re.jsonID("node",Y);class vu{constructor(e){this.anchor=e}map(e){let{deleted:r,pos:n}=e.mapResult(this.anchor);return r?new Ri(n,n):new vu(n)}resolve(e){let r=e.resolve(this.anchor),n=r.nodeAfter;return n&&Y.isSelectable(n)?new Y(r):re.near(r)}}class st extends re{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,r=H.empty){if(r==H.empty){e.delete(0,e.doc.content.size);let n=re.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,r)}toJSON(){return{type:"all"}}static fromJSON(e){return new st(e)}map(e){return new st(e)}eq(e){return e instanceof st}getBookmark(){return YC}}re.jsonID("all",st);const YC={map(){return this},resolve(t){return new st(t)}};function yn(t,e,r,n,s,o=!1){if(e.inlineContent)return X.create(t,r);for(let i=n-(s>0?0:1);s>0?i<e.childCount:i>=0;i+=s){let a=e.child(i);if(a.isAtom){if(!o&&Y.isSelectable(a))return Y.create(t,r-(s<0?a.nodeSize:0))}else{let l=yn(t,a,r+s,s<0?a.childCount:0,s,o);if(l)return l}r+=a.nodeSize*s}return null}function wp(t,e,r){let n=t.steps.length-1;if(n<e)return;let s=t.steps[n];if(!(s instanceof Ne||s instanceof Te))return;let o=t.mapping.maps[n],i;o.forEach((a,l,c,d)=>{i==null&&(i=d)}),t.setSelection(re.near(t.doc.resolve(i),r))}const Dp=1,xo=2,Cp=4;class XC extends vm{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Dp)&~xo,this.storedMarks=null,this}get selectionSet(){return(this.updated&Dp)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xo,this}ensureMarks(e){return ue.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&xo)>0}addStep(e,r){super.addStep(e,r),this.updated=this.updated&~xo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,r=!0){let n=this.selection;return r&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||ue.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,r,n){let s=this.doc.type.schema;if(r==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(n==null&&(n=r),!e)return this.deleteRange(r,n);let o=this.storedMarks;if(!o){let i=this.doc.resolve(r);o=n==r?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(r,n,s.text(e,o)),!this.selection.empty&&this.selection.to==r+e.length&&this.setSelection(re.near(this.selection.$to)),this}}setMeta(e,r){return this.meta[typeof e=="string"?e:e.key]=r,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Cp,this}get scrolledIntoView(){return(this.updated&Cp)>0}}function kp(t,e){return!e||!t?t:t.bind(e)}class ps{constructor(e,r,n){this.name=e,this.init=kp(r.init,n),this.apply=kp(r.apply,n)}}const QC=[new ps("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ps("selection",{init(t,e){return t.selection||re.atStart(e.doc)},apply(t){return t.selection}}),new ps("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,r,n){return n.selection.$cursor?t.storedMarks:null}}),new ps("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class _a{constructor(e,r){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=QC.slice(),r&&r.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new ps(n.key,n.spec.state,n))})}}class kn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,r=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=r){let s=this.config.plugins[n];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let r=[e],n=this.applyInner(e),s=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let a=this.config.plugins[i];if(a.spec.appendTransaction){let l=s?s[i].n:0,c=s?s[i].state:this,d=l<r.length&&a.spec.appendTransaction.call(a,l?r.slice(l):r,c,n);if(d&&n.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let f=0;f<this.config.plugins.length;f++)s.push(f<i?{state:n,n:r.length}:{state:this,n:0})}r.push(d),n=n.applyInner(d),o=!0}s&&(s[i]={state:n,n:r.length})}}if(!o)return{state:n,transactions:r}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let r=new kn(this.config),n=this.config.fields;for(let s=0;s<n.length;s++){let o=n[s];r[o.name]=o.apply(e,this[o.name],this,r)}return r}get tr(){return new XC(this)}static create(e){let r=new _a(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new kn(r);for(let s=0;s<r.fields.length;s++)n[r.fields[s].name]=r.fields[s].init(e,n);return n}reconfigure(e){let r=new _a(this.schema,e.plugins),n=r.fields,s=new kn(r);for(let o=0;o<n.length;o++){let i=n[o].name;s[i]=this.hasOwnProperty(i)?this[i]:n[o].init(e,s)}return s}toJSON(e){let r={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(r.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[n],o=s.spec.state;o&&o.toJSON&&(r[n]=o.toJSON.call(s,this[s.key]))}return r}static fromJSON(e,r,n){if(!r)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new _a(e.schema,e.plugins),o=new kn(s);return s.fields.forEach(i=>{if(i.name=="doc")o.doc=Ct.fromJSON(e.schema,r.doc);else if(i.name=="selection")o.selection=re.fromJSON(o.doc,r.selection);else if(i.name=="storedMarks")r.storedMarks&&(o.storedMarks=r.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],c=l.spec.state;if(l.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(r,a)){o[i.name]=c.fromJSON.call(l,e,r[a],o);return}}o[i.name]=i.init(e,o)}}),o}}function wm(t,e,r){for(let n in t){let s=t[n];s instanceof Function?s=s.bind(e):n=="handleDOMEvents"&&(s=wm(s,e,{})),r[n]=s}return r}class be{constructor(e){this.spec=e,this.props={},e.props&&wm(e.props,this,this.props),this.key=e.key?e.key.key:Dm("plugin")}getState(e){return e[this.key]}}const Ia=Object.create(null);function Dm(t){return t in Ia?t+"$"+ ++Ia[t]:(Ia[t]=0,t+"$")}class je{constructor(e="key"){this.key=Dm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const wu=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Cm(t,e){let{$cursor:r}=t.selection;return!r||(e?!e.endOfTextblock("backward",t):r.parentOffset>0)?null:r}const km=(t,e,r)=>{let n=Cm(t,r);if(!n)return!1;let s=Du(n);if(!s){let i=n.blockRange(),a=i&&zn(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}let o=s.nodeBefore;if(jm(t,s,e,-1))return!0;if(n.parent.content.size==0&&(Tn(o,"end")||Y.isSelectable(o)))for(let i=n.depth;;i--){let a=Ii(t.doc,n.before(i),n.after(i),H.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Tn(o,"end")?re.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):Y.create(l.doc,s.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(i==1||n.node(i-1).childCount>1)break}return o.isAtom&&s.depth==n.depth-1?(e&&e(t.tr.delete(s.pos-o.nodeSize,s.pos).scrollIntoView()),!0):!1},ZC=(t,e,r)=>{let n=Cm(t,r);if(!n)return!1;let s=Du(n);return s?Em(t,s,e):!1},ek=(t,e,r)=>{let n=Fm(t,r);if(!n)return!1;let s=Cu(n);return s?Em(t,s,e):!1};function Em(t,e,r){let n=e.nodeBefore,s=n,o=e.pos-1;for(;!s.isTextblock;o--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let i=e.nodeAfter,a=i,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=Ii(t.doc,o,l,H.empty);if(!c||c.from!=o||c instanceof Ne&&c.slice.size>=l-o)return!1;if(r){let d=t.tr.step(c);d.setSelection(X.create(d.doc,o)),r(d.scrollIntoView())}return!0}function Tn(t,e,r=!1){for(let n=t;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&n.childCount!=1)return!1}return!1}const Sm=(t,e,r)=>{let{$head:n,empty:s}=t.selection,o=n;if(!s)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",t):n.parentOffset>0)return!1;o=Du(n)}let i=o&&o.nodeBefore;return!i||!Y.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Y.create(t.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)};function Du(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 Fm(t,e){let{$cursor:r}=t.selection;return!r||(e?!e.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)?null:r}const Am=(t,e,r)=>{let n=Fm(t,r);if(!n)return!1;let s=Cu(n);if(!s)return!1;let o=s.nodeAfter;if(jm(t,s,e,1))return!0;if(n.parent.content.size==0&&(Tn(o,"start")||Y.isSelectable(o))){let i=Ii(t.doc,n.before(),n.after(),H.empty);if(i&&i.slice.size<i.to-i.from){if(e){let a=t.tr.step(i);a.setSelection(Tn(o,"start")?re.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):Y.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&s.depth==n.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+o.nodeSize).scrollIntoView()),!0):!1},Nm=(t,e,r)=>{let{$head:n,empty:s}=t.selection,o=n;if(!s)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)return!1;o=Cu(n)}let i=o&&o.nodeAfter;return!i||!Y.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Y.create(t.doc,o.pos)).scrollIntoView()),!0)};function Cu(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let r=t.node(e);if(t.index(e)+1<r.childCount)return t.doc.resolve(t.after(e+1));if(r.type.spec.isolating)break}return null}const tk=(t,e)=>{let r=t.selection,n=r instanceof Y,s;if(n){if(r.node.isTextblock||!Sr(t.doc,r.from))return!1;s=r.from}else if(s=_i(t.doc,r.from,-1),s==null)return!1;if(e){let o=t.tr.join(s);n&&o.setSelection(Y.create(o.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},rk=(t,e)=>{let r=t.selection,n;if(r instanceof Y){if(r.node.isTextblock||!Sr(t.doc,r.to))return!1;n=r.to}else if(n=_i(t.doc,r.to,1),n==null)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0},nk=(t,e)=>{let{$from:r,$to:n}=t.selection,s=r.blockRange(n),o=s&&zn(s);return o==null?!1:(e&&e(t.tr.lift(s,o).scrollIntoView()),!0)},Tm=(t,e)=>{let{$head:r,$anchor:n}=t.selection;return!r.parent.type.spec.code||!r.sameParent(n)?!1:(e&&e(t.tr.insertText(`
83
- `).scrollIntoView()),!0)};function ku(t){for(let e=0;e<t.edgeCount;e++){let{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}const sk=(t,e)=>{let{$head:r,$anchor:n}=t.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let s=r.node(-1),o=r.indexAfter(-1),i=ku(s.contentMatchAt(o));if(!i||!s.canReplaceWith(o,o,i))return!1;if(e){let a=r.after(),l=t.tr.replaceWith(a,a,i.createAndFill());l.setSelection(re.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Mm=(t,e)=>{let r=t.selection,{$from:n,$to:s}=r;if(r instanceof st||n.parent.inlineContent||s.parent.inlineContent)return!1;let o=ku(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let i=(!n.parentOffset&&s.index()<s.parent.childCount?n:s).pos,a=t.tr.insert(i,o.createAndFill());a.setSelection(X.create(a.doc,i+1)),e(a.scrollIntoView())}return!0},Bm=(t,e)=>{let{$cursor:r}=t.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let o=r.before();if(Ut(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let n=r.blockRange(),s=n&&zn(n);return s==null?!1:(e&&e(t.tr.lift(n,s).scrollIntoView()),!0)};function ok(t){return(e,r)=>{let{$from:n,$to:s}=e.selection;if(e.selection instanceof Y&&e.selection.node.isBlock)return!n.parentOffset||!Ut(e.doc,n.pos)?!1:(r&&r(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let o=[],i,a,l=!1,c=!1;for(let g=n.depth;;g--)if(n.node(g).isBlock){l=n.end(g)==n.pos+(n.depth-g),c=n.start(g)==n.pos-(n.depth-g),a=ku(n.node(g-1).contentMatchAt(n.indexAfter(g-1))),o.unshift(l&&a?{type:a}:null),i=g;break}else{if(g==1)return!1;o.unshift(null)}let d=e.tr;(e.selection instanceof X||e.selection instanceof st)&&d.deleteSelection();let f=d.mapping.map(n.pos),m=Ut(d.doc,f,o.length,o);if(m||(o[0]=a?{type:a}:null,m=Ut(d.doc,f,o.length,o)),!m)return!1;if(d.split(f,o.length,o),!l&&c&&n.node(i).type!=a){let g=d.mapping.map(n.before(i)),y=d.doc.resolve(g);a&&n.node(i-1).canReplaceWith(y.index(),y.index()+1,a)&&d.setNodeMarkup(d.mapping.map(n.before(i)),a)}return r&&r(d.scrollIntoView()),!0}}const ik=ok(),ak=(t,e)=>{let{$from:r,to:n}=t.selection,s,o=r.sharedDepth(n);return o==0?!1:(s=r.before(o),e&&e(t.tr.setSelection(Y.create(t.doc,s))),!0)};function lk(t,e,r){let n=e.nodeBefore,s=e.nodeAfter,o=e.index();return!n||!s||!n.type.compatibleContent(s.type)?!1:!n.content.size&&e.parent.canReplace(o-1,o)?(r&&r(t.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(s.isTextblock||Sr(t.doc,e.pos))?!1:(r&&r(t.tr.join(e.pos).scrollIntoView()),!0)}function jm(t,e,r,n){let s=e.nodeBefore,o=e.nodeAfter,i,a,l=s.type.spec.isolating||o.type.spec.isolating;if(!l&&lk(t,e,r))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(a=s.contentMatchAt(s.childCount)).findWrapping(o.type))&&a.matchType(i[0]||o.type).validEnd){if(r){let g=e.pos+o.nodeSize,y=L.empty;for(let D=i.length-1;D>=0;D--)y=L.from(i[D].create(null,y));y=L.from(s.copy(y));let v=t.tr.step(new Te(e.pos-1,g,e.pos,g,new H(y,1,0),i.length,!0)),w=v.doc.resolve(g+2*i.length);w.nodeAfter&&w.nodeAfter.type==s.type&&Sr(v.doc,w.pos)&&v.join(w.pos),r(v.scrollIntoView())}return!0}let d=o.type.spec.isolating||n>0&&l?null:re.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),m=f&&zn(f);if(m!=null&&m>=e.depth)return r&&r(t.tr.lift(f,m).scrollIntoView()),!0;if(c&&Tn(o,"start",!0)&&Tn(s,"end")){let g=s,y=[];for(;y.push(g),!g.isTextblock;)g=g.lastChild;let v=o,w=1;for(;!v.isTextblock;v=v.firstChild)w++;if(g.canReplace(g.childCount,g.childCount,v.content)){if(r){let D=L.empty;for(let N=y.length-1;N>=0;N--)D=L.from(y[N].copy(D));let E=t.tr.step(new Te(e.pos-y.length,e.pos+o.nodeSize,e.pos+w,e.pos+o.nodeSize-w,new H(D,y.length,0),0,!0));r(E.scrollIntoView())}return!0}}return!1}function Om(t){return function(e,r){let n=e.selection,s=t<0?n.$from:n.$to,o=s.depth;for(;s.node(o).isInline;){if(!o)return!1;o--}return s.node(o).isTextblock?(r&&r(e.tr.setSelection(X.create(e.doc,t<0?s.start(o):s.end(o)))),!0):!1}}const uk=Om(-1),ck=Om(1);function dk(t,e=null){return function(r,n){let{$from:s,$to:o}=r.selection,i=s.blockRange(o),a=i&&xu(i,t,e);return a?(n&&n(r.tr.wrap(i,a).scrollIntoView()),!0):!1}}function Ep(t,e=null){return function(r,n){let s=!1;for(let o=0;o<r.selection.ranges.length&&!s;o++){let{$from:{pos:i},$to:{pos:a}}=r.selection.ranges[o];r.doc.nodesBetween(i,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let d=r.doc.resolve(c),f=d.index();s=d.parent.canReplaceWith(f,f+1,t)}})}if(!s)return!1;if(n){let o=r.tr;for(let i=0;i<r.selection.ranges.length;i++){let{$from:{pos:a},$to:{pos:l}}=r.selection.ranges[i];o.setBlockType(a,l,t,e)}n(o.scrollIntoView())}return!0}}function Eu(...t){return function(e,r,n){for(let s=0;s<t.length;s++)if(t[s](e,r,n))return!0;return!1}}Eu(wu,km,Sm);Eu(wu,Am,Nm);Eu(Tm,Mm,Bm,ik);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function pk(t,e=null){return function(r,n){let{$from:s,$to:o}=r.selection,i=s.blockRange(o);if(!i)return!1;let a=n?r.tr:null;return hk(a,i,t,e)?(n&&n(a.scrollIntoView()),!0):!1}}function hk(t,e,r,n=null){let s=!1,o=e,i=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(r)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=i.resolve(e.start-2);o=new zo(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new zo(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=xu(o,r,n,e);return a?(t&&fk(t,e,a,s,r),!0):!1}function fk(t,e,r,n,s){let o=L.empty;for(let d=r.length-1;d>=0;d--)o=L.from(r[d].type.create(r[d].attrs,o));t.step(new Te(e.start-(n?2:0),e.end,e.start,e.end,new H(o,0,0),r.length,!0));let i=0;for(let d=0;d<r.length;d++)r[d].type==s&&(i=d+1);let a=r.length-i,l=e.start+r.length-(n?2:0),c=e.parent;for(let d=e.startIndex,f=e.endIndex,m=!0;d<f;d++,m=!1)!m&&Ut(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return t}function mk(t){return function(e,r){let{$from:n,$to:s}=e.selection,o=n.blockRange(s,i=>i.childCount>0&&i.firstChild.type==t);return o?r?n.node(o.depth-1).type==t?gk(e,r,t,o):bk(e,r,o):!0:!1}}function gk(t,e,r,n){let s=t.tr,o=n.end,i=n.$to.end(n.depth);o<i&&(s.step(new Te(o-1,i,o,i,new H(L.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new zo(s.doc.resolve(n.$from.pos),s.doc.resolve(i),n.depth));const a=zn(n);if(a==null)return!1;s.lift(n,a);let l=s.doc.resolve(s.mapping.map(o,-1)-1);return Sr(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function bk(t,e,r){let n=t.tr,s=r.parent;for(let g=r.end,y=r.endIndex-1,v=r.startIndex;y>v;y--)g-=s.child(y).nodeSize,n.delete(g-1,g+1);let o=n.doc.resolve(r.start),i=o.nodeAfter;if(n.mapping.map(r.end)!=r.start+o.nodeAfter.nodeSize)return!1;let a=r.startIndex==0,l=r.endIndex==s.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+(a?0:1),d+1,i.content.append(l?L.empty:L.from(s))))return!1;let f=o.pos,m=f+i.nodeSize;return n.step(new Te(f-(a?1:0),m+(l?1:0),f+1,m-1,new H((a?L.empty:L.from(s.copy(L.empty))).append(l?L.empty:L.from(s.copy(L.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function yk(t){return function(e,r){let{$from:n,$to:s}=e.selection,o=n.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let i=o.startIndex;if(i==0)return!1;let a=o.parent,l=a.child(i-1);if(l.type!=t)return!1;if(r){let c=l.lastChild&&l.lastChild.type==a.type,d=L.from(c?t.create():null),f=new H(L.from(t.create(null,L.from(a.type.create(null,d)))),c?3:1,0),m=o.start,g=o.end;r(e.tr.step(new Te(m-(c?3:1),g,m,g,f,1,!0)).scrollIntoView())}return!0}}const Ie=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Mn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Dl=null;const qt=function(t,e,r){let n=Dl||(Dl=document.createRange());return n.setEnd(t,r??t.nodeValue.length),n.setStart(t,e||0),n},xk=function(){Dl=null},en=function(t,e,r,n){return r&&(Sp(t,e,r,n,-1)||Sp(t,e,r,n,1))},vk=/^(img|br|input|textarea|hr)$/i;function Sp(t,e,r,n,s){for(var o;;){if(t==r&&e==n)return!0;if(e==(s<0?0:dt(t))){let i=t.parentNode;if(!i||i.nodeType!=1||$s(t)||vk.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ie(t)+(s<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(s<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((o=i.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=s;else return!1;else t=i,e=s<0?dt(t):0}else return!1}}function dt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wk(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=dt(t)}else if(t.parentNode&&!$s(t))e=Ie(t),t=t.parentNode;else return null}}function Dk(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!$s(t))e=Ie(t)+1,t=t.parentNode;else return null}}function Ck(t,e,r){for(let n=e==0,s=e==dt(t);n||s;){if(t==r)return!0;let o=Ie(t);if(t=t.parentNode,!t)return!1;n=n&&o==0,s=s&&o==dt(t)}}function $s(t){let e;for(let r=t;r&&!(e=r.pmViewDesc);r=r.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Pi=function(t){return t.focusNode&&en(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Rr(t,e){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=t,r.key=r.code=e,r}function kk(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ek(t,e,r){if(t.caretPositionFromPoint)try{let n=t.caretPositionFromPoint(e,r);if(n)return{node:n.offsetNode,offset:Math.min(dt(n.offsetNode),n.offset)}}catch{}if(t.caretRangeFromPoint){let n=t.caretRangeFromPoint(e,r);if(n)return{node:n.startContainer,offset:Math.min(dt(n.startContainer),n.startOffset)}}}const Bt=typeof navigator<"u"?navigator:null,Fp=typeof document<"u"?document:null,Fr=Bt&&Bt.userAgent||"",Cl=/Edge\/(\d+)/.exec(Fr),Lm=/MSIE \d/.exec(Fr),kl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Fr),Ze=!!(Lm||kl||Cl),yr=Lm?document.documentMode:kl?+kl[1]:Cl?+Cl[1]:0,pt=!Ze&&/gecko\/(\d+)/i.test(Fr);pt&&+(/Firefox\/(\d+)/.exec(Fr)||[0,0])[1];const El=!Ze&&/Chrome\/(\d+)/.exec(Fr),Ve=!!El,_m=El?+El[1]:0,Ke=!Ze&&!!Bt&&/Apple Computer/.test(Bt.vendor),Bn=Ke&&(/Mobile\/\w+/.test(Fr)||!!Bt&&Bt.maxTouchPoints>2),ct=Bn||(Bt?/Mac/.test(Bt.platform):!1),Sk=Bt?/Win/.test(Bt.platform):!1,Wt=/Android \d/.test(Fr),Hs=!!Fp&&"webkitFontSmoothing"in Fp.documentElement.style,Fk=Hs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ak(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 Pt(t,e){return typeof t=="number"?t:t[e]}function Nk(t){let e=t.getBoundingClientRect(),r=e.width/t.offsetWidth||1,n=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*r,top:e.top,bottom:e.top+t.clientHeight*n}}function Ap(t,e,r){let n=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let i=r||t.dom;i;){if(i.nodeType!=1){i=Mn(i);continue}let a=i,l=a==o.body,c=l?Ak(o):Nk(a),d=0,f=0;if(e.top<c.top+Pt(n,"top")?f=-(c.top-e.top+Pt(s,"top")):e.bottom>c.bottom-Pt(n,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+Pt(s,"top")-c.top:e.bottom-c.bottom+Pt(s,"bottom")),e.left<c.left+Pt(n,"left")?d=-(c.left-e.left+Pt(s,"left")):e.right>c.right-Pt(n,"right")&&(d=e.right-c.right+Pt(s,"right")),d||f)if(l)o.defaultView.scrollBy(d,f);else{let g=a.scrollLeft,y=a.scrollTop;f&&(a.scrollTop+=f),d&&(a.scrollLeft+=d);let v=a.scrollLeft-g,w=a.scrollTop-y;e={left:e.left-v,top:e.top-w,right:e.right-v,bottom:e.bottom-w}}let m=l?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(m))break;i=m=="absolute"?i.offsetParent:Mn(i)}}function Tk(t){let e=t.dom.getBoundingClientRect(),r=Math.max(0,e.top),n,s;for(let o=(e.left+e.right)/2,i=r+1;i<Math.min(innerHeight,e.bottom);i+=5){let a=t.root.elementFromPoint(o,i);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=r-20){n=a,s=l.top;break}}return{refDOM:n,refTop:s,stack:Im(t.dom)}}function Im(t){let e=[],r=t.ownerDocument;for(let n=t;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),t!=r);n=Mn(n));return e}function Mk({refDOM:t,refTop:e,stack:r}){let n=t?t.getBoundingClientRect().top:0;Rm(r,n==0?0:n-e)}function Rm(t,e){for(let r=0;r<t.length;r++){let{dom:n,top:s,left:o}=t[r];n.scrollTop!=s+e&&(n.scrollTop=s+e),n.scrollLeft!=o&&(n.scrollLeft=o)}}let gn=null;function Bk(t){if(t.setActive)return t.setActive();if(gn)return t.focus(gn);let e=Im(t);t.focus(gn==null?{get preventScroll(){return gn={preventScroll:!0},!0}}:void 0),gn||(gn=!1,Rm(e,0))}function Pm(t,e){let r,n=2e8,s,o=0,i=e.top,a=e.top,l,c;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let m;if(d.nodeType==1)m=d.getClientRects();else if(d.nodeType==3)m=qt(d).getClientRects();else continue;for(let g=0;g<m.length;g++){let y=m[g];if(y.top<=i&&y.bottom>=a){i=Math.max(y.bottom,i),a=Math.min(y.top,a);let v=y.left>e.left?y.left-e.left:y.right<e.left?e.left-y.right:0;if(v<n){r=d,n=v,s=v&&r.nodeType==3?{left:y.right<e.left?y.right:y.left,top:e.top}:e,d.nodeType==1&&v&&(o=f+(e.left>=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!l&&y.left<=e.left&&y.right>=e.left&&(l=d,c={left:Math.max(y.left,Math.min(y.right,e.left)),top:y.top});!r&&(e.left>=y.right&&e.top>=y.top||e.left>=y.left&&e.top>=y.bottom)&&(o=f+1)}}return!r&&l&&(r=l,s=c,n=0),r&&r.nodeType==3?jk(r,s):!r||n&&r.nodeType==1?{node:t,offset:o}:Pm(r,s)}function jk(t,e){let r=t.nodeValue.length,n=document.createRange();for(let s=0;s<r;s++){n.setEnd(t,s+1),n.setStart(t,s);let o=ar(n,1);if(o.top!=o.bottom&&Su(e,o))return{node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function Su(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ok(t,e){let r=t.parentNode;return r&&/^li$/i.test(r.nodeName)&&e.left<t.getBoundingClientRect().left?r:t}function Lk(t,e,r){let{node:n,offset:s}=Pm(e,r),o=-1;if(n.nodeType==1&&!n.firstChild){let i=n.getBoundingClientRect();o=i.left!=i.right&&r.left>(i.left+i.right)/2?1:-1}return t.docView.posFromDOM(n,s,o)}function _k(t,e,r,n){let s=-1;for(let o=e,i=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!i&&l.left>n.left||l.top>n.top?s=a.posBefore:(!i&&l.right<n.left||l.bottom<n.top)&&(s=a.posAfter),i=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,r,-1)}function zm(t,e,r){let n=t.childNodes.length;if(n&&r.top<r.bottom)for(let s=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-r.top)/(r.bottom-r.top))-2)),o=s;;){let i=t.childNodes[o];if(i.nodeType==1){let a=i.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Su(e,c))return zm(i,e,c)}}if((o=(o+1)%n)==s)break}return t}function Ik(t,e){let r=t.dom.ownerDocument,n,s=0,o=Ek(r,e.left,e.top);o&&({node:n,offset:s}=o);let i=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top),a;if(!i||!t.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=t.dom.getBoundingClientRect();if(!Su(e,c)||(i=zm(t.dom,e,c),!i))return null}if(Ke)for(let c=i;n&&c;c=Mn(c))c.draggable&&(n=void 0);if(i=Ok(i,e),n){if(pt&&n.nodeType==1&&(s=Math.min(s,n.childNodes.length),s<n.childNodes.length)){let d=n.childNodes[s],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&s++}let c;Hs&&s&&n.nodeType==1&&(c=n.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,n==t.dom&&s==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||n.nodeType!=1||n.childNodes[s-1].nodeName!="BR")&&(a=_k(t,n,s,e))}a==null&&(a=Lk(t,i,e));let l=t.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Np(t){return t.top<t.bottom||t.left<t.right}function ar(t,e){let r=t.getClientRects();if(r.length){let n=r[e<0?0:r.length-1];if(Np(n))return n}return Array.prototype.find.call(r,Np)||t.getBoundingClientRect()}const Rk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function $m(t,e,r){let{node:n,offset:s,atom:o}=t.docView.domFromPos(e,r<0?-1:1),i=Hs||pt;if(n.nodeType==3)if(i&&(Rk.test(n.nodeValue)||(r<0?!s:s==n.nodeValue.length))){let l=ar(qt(n,s,s),r);if(pt&&s&&/\s/.test(n.nodeValue[s-1])&&s<n.nodeValue.length){let c=ar(qt(n,s-1,s-1),-1);if(c.top==l.top){let d=ar(qt(n,s,s+1),-1);if(d.top!=l.top)return is(d,d.left<c.left)}}return l}else{let l=s,c=s,d=r<0?1:-1;return r<0&&!s?(c++,d=-1):r>=0&&s==n.nodeValue.length?(l--,d=1):r<0?l--:c++,is(ar(qt(n,l,c),d),d<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&s&&(r<0||s==dt(n))){let l=n.childNodes[s-1];if(l.nodeType==1)return Ra(l.getBoundingClientRect(),!1)}if(o==null&&s<dt(n)){let l=n.childNodes[s];if(l.nodeType==1)return Ra(l.getBoundingClientRect(),!0)}return Ra(n.getBoundingClientRect(),r>=0)}if(o==null&&s&&(r<0||s==dt(n))){let l=n.childNodes[s-1],c=l.nodeType==3?qt(l,dt(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return is(ar(c,1),!1)}if(o==null&&s<dt(n)){let l=n.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?qt(l,0,i?0:1):l.nodeType==1?l:null:null;if(c)return is(ar(c,-1),!0)}return is(ar(n.nodeType==3?qt(n):n,-r),r>=0)}function is(t,e){if(t.width==0)return t;let r=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:r,right:r}}function Ra(t,e){if(t.height==0)return t;let r=e?t.top:t.bottom;return{top:r,bottom:r,left:t.left,right:t.right}}function Hm(t,e,r){let n=t.state,s=t.root.activeElement;n!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return r()}finally{n!=e&&t.updateState(n),s!=t.dom&&s&&s.focus()}}function Pk(t,e,r){let n=e.selection,s=r=="up"?n.$from:n.$to;return Hm(t,e,()=>{let{node:o}=t.docView.domFromPos(s.pos,r=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let i=$m(t,s.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=qt(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(r=="up"?i.top-d.top>(d.bottom-i.top)*2:d.bottom-i.bottom>(i.bottom-d.top)*2))return!1}}return!0})}const zk=/[\u0590-\u08ac]/;function $k(t,e,r){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let s=n.parentOffset,o=!s,i=s==n.parent.content.size,a=t.domSelection();return a?!zk.test(n.parent.textContent)||!a.modify?r=="left"||r=="backward"?o:i:Hm(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),m=a.caretBidiLevel;a.modify("move",r,"character");let g=n.depth?t.docView.domAfterPos(n.before()):t.dom,{focusNode:y,focusOffset:v}=t.domSelectionRange(),w=y&&!g.contains(y.nodeType==1?y:y.parentNode)||l==y&&c==v;try{a.collapse(d,f),l&&(l!=d||c!=f)&&a.extend&&a.extend(l,c)}catch{}return m!=null&&(a.caretBidiLevel=m),w}):n.pos==n.start()||n.pos==n.end()}let Tp=null,Mp=null,Bp=!1;function Hk(t,e,r){return Tp==e&&Mp==r?Bp:(Tp=e,Mp=r,Bp=r=="up"||r=="down"?Pk(t,e,r):$k(t,e,r))}const ht=0,jp=1,$r=2,jt=3;class Vs{constructor(e,r,n,s){this.parent=e,this.children=r,this.dom=n,this.contentDOM=s,this.dirty=ht,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,r,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let r=0;r<this.children.length;r++)e+=this.children[r].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let r=0,n=this.posAtStart;;r++){let s=this.children[r];if(s==e)return n;n+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,r,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let o,i;if(e==this.contentDOM)o=e.childNodes[r-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(i)+i.size:this.posAtStart}else{let o,i;if(e==this.contentDOM)o=e.childNodes[r];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(i):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=r>Ie(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(r==0)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!1;break}if(o.previousSibling)break}if(s==null&&r==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!0;break}if(o.nextSibling)break}}return s??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,r=!1){for(let n=!0,s=e;s;s=s.parentNode){let o=this.getDesc(s),i;if(o&&(!r||o.node))if(n&&(i=o.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))n=!1;else return o}}getDesc(e){let r=e.pmViewDesc;for(let n=r;n;n=n.parent)if(n==this)return r}posFromDOM(e,r,n){for(let s=e;s;s=s.parentNode){let o=this.getDesc(s);if(o)return o.localPosFromDOM(e,r,n)}return-1}descAt(e){for(let r=0,n=0;r<this.children.length;r++){let s=this.children[r],o=n+s.size;if(n==e&&o!=n){for(;!s.border&&s.children.length;)for(let i=0;i<s.children.length;i++){let a=s.children[i];if(a.size){s=a;break}}return s}if(e<o)return s.descAt(e-n-s.border);n=o}}domFromPos(e,r){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,s=0;for(let o=0;n<this.children.length;n++){let i=this.children[n],a=o+i.size;if(a>e||i instanceof qm){s=e-o;break}o=a}if(s)return this.children[n].domFromPos(s-this.children[n].border,r);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof Vm&&o.side>=0;n--);if(r<=0){let o,i=!0;for(;o=n?this.children[n-1]:null,!(!o||o.dom.parentNode==this.contentDOM);n--,i=!1);return o&&r&&i&&!o.border&&!o.domAtom?o.domFromPos(o.size,r):{node:this.contentDOM,offset:o?Ie(o.dom)+1:0}}else{let o,i=!0;for(;o=n<this.children.length?this.children[n]:null,!(!o||o.dom.parentNode==this.contentDOM);n++,i=!1);return o&&i&&!o.border&&!o.domAtom?o.domFromPos(0,r):{node:this.contentDOM,offset:o?Ie(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,r,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:r,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,o=-1;for(let i=n,a=0;;a++){let l=this.children[a],c=i+l.size;if(s==-1&&e<=c){let d=i+l.border;if(e>=d&&r<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,r,d);e=i;for(let f=a;f>0;f--){let m=this.children[f-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){s=Ie(m.dom)+1;break}e-=m.size}s==-1&&(s=0)}if(s>-1&&(c>r||a==this.children.length-1)){r=c;for(let d=a+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Ie(f.dom);break}r+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:r,fromOffset:s,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let r=this.children[e<0?0:this.children.length-1];return r.size==0||r.emptyChildAt(e)}domAfterPos(e){let{node:r,offset:n}=this.domFromPos(e,0);if(r.nodeType!=1||n==r.childNodes.length)throw new RangeError("No node after pos "+e);return r.childNodes[n]}setSelection(e,r,n,s=!1){let o=Math.min(e,r),i=Math.max(e,r);for(let g=0,y=0;g<this.children.length;g++){let v=this.children[g],w=y+v.size;if(o>y&&i<w)return v.setSelection(e-y-v.border,r-y-v.border,n,s);y=w}let a=this.domFromPos(e,e?-1:1),l=r==e?a:this.domFromPos(r,r?-1:1),c=n.root.getSelection(),d=n.domSelectionRange(),f=!1;if((pt||Ke)&&e==r){let{node:g,offset:y}=a;if(g.nodeType==3){if(f=!!(y&&g.nodeValue[y-1]==`
84
- `),f&&y==g.nodeValue.length)for(let v=g,w;v;v=v.parentNode){if(w=v.nextSibling){w.nodeName=="BR"&&(a=l={node:w.parentNode,offset:Ie(w)+1});break}let D=v.pmViewDesc;if(D&&D.node&&D.node.isBlock)break}}else{let v=g.childNodes[y-1];f=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(pt&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let g=d.focusNode.childNodes[d.focusOffset];g&&g.contentEditable=="false"&&(s=!0)}if(!(s||f&&Ke)&&en(a.node,a.offset,d.anchorNode,d.anchorOffset)&&en(l.node,l.offset,d.focusNode,d.focusOffset))return;let m=!1;if((c.extend||e==r)&&!(f&&pt)){c.collapse(a.node,a.offset);try{e!=r&&c.extend(l.node,l.offset),m=!0}catch{}}if(!m){if(e>r){let y=a;a=l,l=y}let g=document.createRange();g.setEnd(l.node,l.offset),g.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(g)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,r){for(let n=0,s=0;s<this.children.length;s++){let o=this.children[s],i=n+o.size;if(n==i?e<=i&&r>=n:e<i&&r>n){let a=n+o.border,l=i-o.border;if(e>=a&&r<=l){this.dirty=e==n||r==i?$r:jp,e==a&&r==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=jt:o.markDirty(e-a,r-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?$r:jt}n=i}this.dirty=$r}markParentsDirty(){let e=1;for(let r=this.parent;r;r=r.parent,e++){let n=e==1?$r:jp;r.dirty<n&&(r.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Vm extends Vs{constructor(e,r,n,s){let o,i=r.type.toDOM;if(typeof i=="function"&&(i=i(n,()=>{if(!o)return s;if(o.parent)return o.parent.posBeforeChild(o)})),!r.type.spec.raw){if(i.nodeType!=1){let a=document.createElement("span");a.appendChild(i),i=a}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=r,this.widget=r,o=this}matchesWidget(e){return this.dirty==ht&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let r=this.widget.spec.stopEvent;return r?r(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Vk extends Vs{constructor(e,r,n,s){super(e,[],r,null),this.textDOM=n,this.text=s}get size(){return this.text.length}localPosFromDOM(e,r){return e!=this.textDOM?this.posAtStart+(r?this.size:0):this.posAtStart+r}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class tn extends Vs{constructor(e,r,n,s,o){super(e,[],n,s),this.mark=r,this.spec=o}static create(e,r,n,s){let o=s.nodeViews[r.type.name],i=o&&o(r,s,n);return(!i||!i.dom)&&(i=on.renderSpec(document,r.type.spec.toDOM(r,n),null,r.attrs)),new tn(e,r,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=jt&&this.mark.eq(e)}markDirty(e,r){if(super.markDirty(e,r),this.dirty!=ht){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=ht}}slice(e,r,n){let s=tn.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;r<i&&(o=Fl(o,r,i,n)),e>0&&(o=Fl(o,0,e,n));for(let a=0;a<o.length;a++)o[a].parent=s;return s.children=o,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class xr extends Vs{constructor(e,r,n,s,o,i,a,l,c){super(e,[],o,i),this.node=r,this.outerDeco=n,this.innerDeco=s,this.nodeDOM=a}static create(e,r,n,s,o,i){let a=o.nodeViews[r.type.name],l,c=a&&a(r,o,()=>{if(!l)return i;if(l.parent)return l.parent.posBeforeChild(l)},n,s),d=c&&c.dom,f=c&&c.contentDOM;if(r.isText){if(!d)d=document.createTextNode(r.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=on.renderSpec(document,r.type.spec.toDOM(r),null,r.attrs));!f&&!r.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),r.type.spec.draggable&&(d.draggable=!0));let m=d;return d=Jm(d,n,r),c?l=new qk(e,r,n,s,d,f||null,m,c,o,i+1):r.isText?new zi(e,r,n,s,d,m,o):new xr(e,r,n,s,d,f||null,m,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let n=this.children[r];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>L.empty)}return e}matchesNode(e,r,n){return this.dirty==ht&&e.eq(this.node)&&Ho(r,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,r){let n=this.node.inlineContent,s=r,o=e.composing?this.localCompositionInfo(e,r):null,i=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new Uk(this,i&&i.node,e);Gk(this.node,this.innerDeco,(c,d,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,n,e):c.type.side>=0&&!f&&l.syncToMarks(d==this.node.childCount?ue.none:this.node.child(d).marks,n,e),l.placeWidget(c,e,s)},(c,d,f,m)=>{l.syncToMarks(c.marks,n,e);let g;l.findNodeMatch(c,d,f,m)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(g=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,d,f,g,e)||l.updateNextNode(c,d,f,e,m,s)||l.addNode(c,d,f,e,s),s+=c.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==$r)&&(i&&this.protectLocalComposition(e,i),Wm(this.contentDOM,this.children,e),Bn&&Yk(this.dom))}localCompositionInfo(e,r){let{from:n,to:s}=e.state.selection;if(!(e.state.selection instanceof X)||n<r||s>r+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let i=o.nodeValue,a=Xk(this.node.content,i,n-r,s-r);return a<0?null:{node:o,pos:a,text:i}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:r,pos:n,text:s}){if(this.getDesc(r))return;let o=r;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Vk(this,o,r,s);e.input.compositionNodes.push(i),this.children=Fl(this.children,n,n+s.length,e,i)}update(e,r,n,s){return this.dirty==jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,r,n,s),!0)}updateInner(e,r,n,s){this.updateOuterDeco(r),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=ht}updateOuterDeco(e){if(Ho(e,this.outerDeco))return;let r=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Um(this.dom,this.nodeDOM,Sl(this.outerDeco,this.node,r),Sl(e,this.node,r)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Op(t,e,r,n,s){Jm(n,e,t);let o=new xr(void 0,t,e,r,n,n,n,s,0);return o.contentDOM&&o.updateChildren(s,0),o}class zi extends xr{constructor(e,r,n,s,o,i,a){super(e,r,n,s,o,null,i,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,r,n,s){return this.dirty==jt||this.dirty!=ht&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(r),(this.dirty!=ht||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=ht,!0)}inParent(){let e=this.parent.contentDOM;for(let r=this.nodeDOM;r;r=r.parentNode)if(r==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,r,n){return e==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):super.localPosFromDOM(e,r,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,r,n){let s=this.node.cut(e,r),o=document.createTextNode(s.text);return new zi(this.parent,s,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,r){super.markDirty(e,r),this.dom!=this.nodeDOM&&(e==0||r==this.nodeDOM.nodeValue.length)&&(this.dirty=jt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class qm extends Vs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ht&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qk extends xr{constructor(e,r,n,s,o,i,a,l,c,d){super(e,r,n,s,o,i,a,c,d),this.spec=l}update(e,r,n,s){if(this.dirty==jt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,r,n);return o&&this.updateInner(e,r,n,s),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,r,n,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,r,n,s){this.spec.setSelection?this.spec.setSelection(e,r,n.root):super.setSelection(e,r,n,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Wm(t,e,r){let n=t.firstChild,s=!1;for(let o=0;o<e.length;o++){let i=e[o],a=i.dom;if(a.parentNode==t){for(;a!=n;)n=Lp(n),s=!0;n=n.nextSibling}else s=!0,t.insertBefore(a,n);if(i instanceof tn){let l=n?n.previousSibling:t.lastChild;Wm(i.contentDOM,i.children,r),n=l?l.nextSibling:t.firstChild}}for(;n;)n=Lp(n),s=!0;s&&r.trackWrites==t&&(r.trackWrites=null)}const xs=function(t){t&&(this.nodeName=t)};xs.prototype=Object.create(null);const Hr=[new xs];function Sl(t,e,r){if(t.length==0)return Hr;let n=r?Hr[0]:new xs,s=[n];for(let o=0;o<t.length;o++){let i=t[o].type.attrs;if(i){i.nodeName&&s.push(n=new xs(i.nodeName));for(let a in i){let l=i[a];l!=null&&(r&&s.length==1&&s.push(n=new xs(e.isInline?"span":"div")),a=="class"?n.class=(n.class?n.class+" ":"")+l:a=="style"?n.style=(n.style?n.style+";":"")+l:a!="nodeName"&&(n[a]=l))}}}return s}function Um(t,e,r,n){if(r==Hr&&n==Hr)return e;let s=e;for(let o=0;o<n.length;o++){let i=n[o],a=r[o];if(o){let l;a&&a.nodeName==i.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==i.nodeName||(l=document.createElement(i.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=Hr[0]),s=l}Wk(s,a||Hr[0],i)}return s}function Wk(t,e,r){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in r)&&t.removeAttribute(n);for(let n in r)n!="class"&&n!="style"&&n!="nodeName"&&r[n]!=e[n]&&t.setAttribute(n,r[n]);if(e.class!=r.class){let n=e.class?e.class.split(" ").filter(Boolean):[],s=r.class?r.class.split(" ").filter(Boolean):[];for(let o=0;o<n.length;o++)s.indexOf(n[o])==-1&&t.classList.remove(n[o]);for(let o=0;o<s.length;o++)n.indexOf(s[o])==-1&&t.classList.add(s[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=r.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=n.exec(e.style);)t.style.removeProperty(s[1])}r.style&&(t.style.cssText+=r.style)}}function Jm(t,e,r){return Um(t,t,Hr,Sl(e,r,t.nodeType!=1))}function Ho(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].type.eq(e[r].type))return!1;return!0}function Lp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Uk{constructor(e,r,n){this.lock=r,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Jk(e.node.content,e)}destroyBetween(e,r){if(e!=r){for(let n=e;n<r;n++)this.top.children[n].destroy();this.top.children.splice(e,r-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,r,n){let s=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;s<i&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=ht,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[o])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=tn.create(this.top,e[o],r,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(e,r,n,s){let o=-1,i;if(s>=this.preMatch.index&&(i=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&i.matchesNode(e,r,n))o=this.top.children.indexOf(i,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,r,n)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,r,n,s,o){let i=this.top.children[s];return i.dirty==jt&&i.dom==i.contentDOM&&(i.dirty=$r),i.update(e,r,n,o)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let r=e.parentNode;if(!r)return-1;if(r==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==n)return s}return-1}e=r}}updateNextNode(e,r,n,s,o,i){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof xr){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let d=l.dom,f,m=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=jt&&Ho(r,l.outerDeco));if(!m&&l.update(e,r,n,s))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!m&&(f=this.recreateWrapper(l,e,r,n,s,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=$r,f.updateChildren(s,i+1),f.dirty=ht),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,r,n,s,o,i){if(e.dirty||r.isAtom||!e.children.length||!e.node.content.eq(r.content)||!Ho(n,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=xr.create(this.top,r,n,s,o,i);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,r,n,s,o){let i=xr.create(this.top,e,r,n,s,o);i.contentDOM&&i.updateChildren(s,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,r,n){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let o=new Vm(this.top,e,r,n);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],r=this.top;for(;e instanceof tn;)r=e,e=r.children[r.children.length-1];(!e||!(e instanceof zi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ke||Ve)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",r),this.addHackNode("BR",this.top))}addHackNode(e,r){if(r==this.top&&this.index<r.children.length&&r.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let s=new qm(this.top,[],n,null);r!=this.top?r.children.push(s):r.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Jk(t,e){let r=e,n=r.children.length,s=t.childCount,o=new Map,i=[];e:for(;s>0;){let a;for(;;)if(n){let c=r.children[n-1];if(c instanceof tn)r=c,n=c.children.length;else{a=c,n--;break}}else{if(r==e)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=a.node;if(l){if(l!=t.child(s-1))break;--s,o.set(a,s),i.push(a)}}return{index:s,matched:o,matches:i.reverse()}}function Kk(t,e){return t.type.side-e.type.side}function Gk(t,e,r,n){let s=e.locals(t),o=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);n(d,s,e.forChild(o,d),c),o+=d.nodeSize}return}let i=0,a=[],l=null;for(let c=0;;){let d,f;for(;i<s.length&&s[i].to==o;){let w=s[i++];w.widget&&(d?(f||(f=[d])).push(w):d=w)}if(d)if(f){f.sort(Kk);for(let w=0;w<f.length;w++)r(f[w],c,!!l)}else r(d,c,!!l);let m,g;if(l)g=-1,m=l,l=null;else if(c<t.childCount)g=c,m=t.child(c++);else break;for(let w=0;w<a.length;w++)a[w].to<=o&&a.splice(w--,1);for(;i<s.length&&s[i].from<=o&&s[i].to>o;)a.push(s[i++]);let y=o+m.nodeSize;if(m.isText){let w=y;i<s.length&&s[i].from<w&&(w=s[i].from);for(let D=0;D<a.length;D++)a[D].to<w&&(w=a[D].to);w<y&&(l=m.cut(w-o),m=m.cut(0,w-o),y=w,g=-1)}else for(;i<s.length&&s[i].to<y;)i++;let v=m.isInline&&!m.isLeaf?a.filter(w=>!w.inline):a.slice();n(m,v,e.forChild(o,m),g),o=y}}function Yk(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Xk(t,e,r,n){for(let s=0,o=0;s<t.childCount&&o<=n;){let i=t.child(s++),a=o;if(o+=i.nodeSize,!i.isText)continue;let l=i.text;for(;s<t.childCount;){let c=t.child(s++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=r){if(o>=n&&l.slice(n-e.length-a,n-a)==e)return n-e.length;let c=a<n?l.lastIndexOf(e,n-a-1):-1;if(c>=0&&c+e.length+a>=r)return a+c;if(r==n&&l.length>=n+e.length-a&&l.slice(n-a,n-a+e.length)==e)return n}}return-1}function Fl(t,e,r,n,s){let o=[];for(let i=0,a=0;i<t.length;i++){let l=t[i],c=a,d=a+=l.size;c>=r||d<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,n)),s&&(o.push(s),s=void 0),d>r&&o.push(l.slice(r-c,l.size,n)))}return o}function Fu(t,e=null){let r=t.domSelectionRange(),n=t.state.doc;if(!r.focusNode)return null;let s=t.docView.nearestDesc(r.focusNode),o=s&&s.size==0,i=t.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(i<0)return null;let a=n.resolve(i),l,c;if(Pi(r)){for(l=i;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&Y.isSelectable(f)&&s.parent&&!(f.isInline&&Ck(r.focusNode,r.focusOffset,s.dom))){let m=s.posBefore;c=new Y(i==m?a:n.resolve(m))}}else{if(r instanceof t.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let f=i,m=i;for(let g=0;g<r.rangeCount;g++){let y=r.getRangeAt(g);f=Math.min(f,t.docView.posFromDOM(y.startContainer,y.startOffset,1)),m=Math.max(m,t.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(f<0)return null;[l,i]=m==t.state.selection.anchor?[m,f]:[f,m],a=n.resolve(i)}else l=t.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}let d=n.resolve(l);if(!c){let f=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=Au(t,d,a,f)}return c}function Km(t){return t.editable?t.hasFocus():Ym(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Jt(t,e=!1){let r=t.state.selection;if(Gm(t,r),!!Km(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ve){let n=t.domSelectionRange(),s=t.domObserver.currentSelection;if(n.anchorNode&&s.anchorNode&&en(n.anchorNode,n.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Zk(t);else{let{anchor:n,head:s}=r,o,i;_p&&!(r instanceof X)&&(r.$from.parent.inlineContent||(o=Ip(t,r.from)),!r.empty&&!r.$from.parent.inlineContent&&(i=Ip(t,r.to))),t.docView.setSelection(n,s,t,e),_p&&(o&&Rp(o),i&&Rp(i)),r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Qk(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const _p=Ke||Ve&&_m<63;function Ip(t,e){let{node:r,offset:n}=t.docView.domFromPos(e,0),s=n<r.childNodes.length?r.childNodes[n]:null,o=n?r.childNodes[n-1]:null;if(Ke&&s&&s.contentEditable=="false")return Pa(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return Pa(s);if(o)return Pa(o)}}function Pa(t){return t.contentEditable="true",Ke&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Rp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Qk(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let r=t.domSelectionRange(),n=r.anchorNode,s=r.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(r.anchorNode!=n||r.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Km(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Zk(t){let e=t.domSelection();if(!e)return;let r=t.cursorWrapper.dom,n=r.nodeName=="IMG";n?e.collapse(r.parentNode,Ie(r)+1):e.collapse(r,0),!n&&!t.state.selection.visible&&Ze&&yr<=11&&(r.disabled=!0,r.disabled=!1)}function Gm(t,e){if(e instanceof Y){let r=t.docView.descAt(e.from);r!=t.lastSelectedViewDesc&&(Pp(t),r&&r.selectNode(),t.lastSelectedViewDesc=r)}else Pp(t)}function Pp(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Au(t,e,r,n){return t.someProp("createSelectionBetween",s=>s(t,e,r))||X.between(e,r,n)}function zp(t){return t.editable&&!t.hasFocus()?!1:Ym(t)}function Ym(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function eE(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),r=t.domSelectionRange();return en(e.node,e.offset,r.anchorNode,r.anchorOffset)}function Al(t,e){let{$anchor:r,$head:n}=t.selection,s=e>0?r.max(n):r.min(n),o=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return o&&re.findFrom(o,e)}function lr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $p(t,e,r){let n=t.state.selection;if(n instanceof X)if(r.indexOf("s")>-1){let{$head:s}=n,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=t.state.doc.resolve(s.pos+o.nodeSize*(e<0?-1:1));return lr(t,new X(n.$anchor,i))}else if(n.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Al(t.state,e);return s&&s instanceof Y?lr(t,s):!1}else if(!(ct&&r.indexOf("m")>-1)){let s=n.$head,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,i;if(!o||o.isText)return!1;let a=e<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(i=t.docView.descAt(a))&&!i.contentDOM?Y.isSelectable(o)?lr(t,new Y(e<0?t.state.doc.resolve(s.pos-o.nodeSize):s)):Hs?lr(t,new X(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(n instanceof Y&&n.node.isInline)return lr(t,new X(e>0?n.$to:n.$from));{let s=Al(t.state,e);return s?lr(t,s):!1}}}function Vo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function vs(t,e){let r=t.pmViewDesc;return r&&r.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function bn(t,e){return e<0?tE(t):rE(t)}function tE(t){let e=t.domSelectionRange(),r=e.focusNode,n=e.focusOffset;if(!r)return;let s,o,i=!1;for(pt&&r.nodeType==1&&n<Vo(r)&&vs(r.childNodes[n],-1)&&(i=!0);;)if(n>0){if(r.nodeType!=1)break;{let a=r.childNodes[n-1];if(vs(a,-1))s=r,o=--n;else if(a.nodeType==3)r=a,n=r.nodeValue.length;else break}}else{if(Xm(r))break;{let a=r.previousSibling;for(;a&&vs(a,-1);)s=r.parentNode,o=Ie(a),a=a.previousSibling;if(a)r=a,n=Vo(r);else{if(r=r.parentNode,r==t.dom)break;n=0}}}i?Nl(t,r,n):s&&Nl(t,s,o)}function rE(t){let e=t.domSelectionRange(),r=e.focusNode,n=e.focusOffset;if(!r)return;let s=Vo(r),o,i;for(;;)if(n<s){if(r.nodeType!=1)break;let a=r.childNodes[n];if(vs(a,1))o=r,i=++n;else break}else{if(Xm(r))break;{let a=r.nextSibling;for(;a&&vs(a,1);)o=a.parentNode,i=Ie(a)+1,a=a.nextSibling;if(a)r=a,n=0,s=Vo(r);else{if(r=r.parentNode,r==t.dom)break;n=s=0}}}o&&Nl(t,o,i)}function Xm(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function nE(t,e){for(;t&&e==t.childNodes.length&&!$s(t);)e=Ie(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let r=t.childNodes[e];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r,e=0}}function sE(t,e){for(;t&&!e&&!$s(t);)e=Ie(t),t=t.parentNode;for(;t&&e;){let r=t.childNodes[e-1];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r,e=t.childNodes.length}}function Nl(t,e,r){if(e.nodeType!=3){let o,i;(i=nE(e,r))?(e=i,r=0):(o=sE(e,r))&&(e=o,r=o.nodeValue.length)}let n=t.domSelection();if(!n)return;if(Pi(n)){let o=document.createRange();o.setEnd(e,r),o.setStart(e,r),n.removeAllRanges(),n.addRange(o)}else n.extend&&n.extend(e,r);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Jt(t)},50)}function Hp(t,e){let r=t.state.doc.resolve(e);if(!(Ve||Sk)&&r.parent.inlineContent){let s=t.coordsAtPos(e);if(e>r.start()){let o=t.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(e<r.end()){let o=t.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Vp(t,e,r){let n=t.state.selection;if(n instanceof X&&!n.empty||r.indexOf("s")>-1||ct&&r.indexOf("m")>-1)return!1;let{$from:s,$to:o}=n;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=Al(t.state,e);if(i&&i instanceof Y)return lr(t,i)}if(!s.parent.inlineContent){let i=e<0?s:o,a=n instanceof st?re.near(i,e):re.findFrom(i,e);return a?lr(t,a):!1}return!1}function qp(t,e){if(!(t.state.selection instanceof X))return!0;let{$head:r,$anchor:n,empty:s}=t.state.selection;if(!r.sameParent(n))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(o&&!o.isText){let i=t.state.tr;return e<0?i.delete(r.pos-o.nodeSize,r.pos):i.delete(r.pos,r.pos+o.nodeSize),t.dispatch(i),!0}return!1}function Wp(t,e,r){t.domObserver.stop(),e.contentEditable=r,t.domObserver.start()}function oE(t){if(!Ke||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:r}=t.domSelectionRange();if(e&&e.nodeType==1&&r==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;Wp(t,n,"true"),setTimeout(()=>Wp(t,n,"false"),20)}return!1}function iE(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function aE(t,e){let r=e.keyCode,n=iE(e);if(r==8||ct&&r==72&&n=="c")return qp(t,-1)||bn(t,-1);if(r==46&&!e.shiftKey||ct&&r==68&&n=="c")return qp(t,1)||bn(t,1);if(r==13||r==27)return!0;if(r==37||ct&&r==66&&n=="c"){let s=r==37?Hp(t,t.state.selection.from)=="ltr"?-1:1:-1;return $p(t,s,n)||bn(t,s)}else if(r==39||ct&&r==70&&n=="c"){let s=r==39?Hp(t,t.state.selection.from)=="ltr"?1:-1:1;return $p(t,s,n)||bn(t,s)}else{if(r==38||ct&&r==80&&n=="c")return Vp(t,-1,n)||bn(t,-1);if(r==40||ct&&r==78&&n=="c")return oE(t)||Vp(t,1,n)||bn(t,1);if(n==(ct?"m":"c")&&(r==66||r==73||r==89||r==90))return!0}return!1}function Nu(t,e){t.someProp("transformCopied",g=>{e=g(e,t)});let r=[],{content:n,openStart:s,openEnd:o}=e;for(;s>1&&o>1&&n.childCount==1&&n.firstChild.childCount==1;){s--,o--;let g=n.firstChild;r.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),n=g.content}let i=t.someProp("clipboardSerializer")||on.fromSchema(t.state.schema),a=ng(),l=a.createElement("div");l.appendChild(i.serializeFragment(n,{document:a}));let c=l.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=rg[c.nodeName.toLowerCase()]);){for(let g=d.length-1;g>=0;g--){let y=a.createElement(d[g]);for(;l.firstChild;)y.appendChild(l.firstChild);l.appendChild(y),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${o}${f?` -${f}`:""} ${JSON.stringify(r)}`);let m=t.someProp("clipboardTextSerializer",g=>g(e,t))||e.content.textBetween(0,e.content.size,`
85
-
86
- `);return{dom:l,text:m,slice:e}}function Qm(t,e,r,n,s){let o=s.parent.type.spec.code,i,a;if(!r&&!e)return null;let l=!!e&&(n||o||!r);if(l){if(t.someProp("transformPastedText",m=>{e=m(e,o||n,t)}),o)return a=new H(L.from(t.state.schema.text(e.replace(/\r\n?/g,`
87
- `))),0,0),t.someProp("transformPasted",m=>{a=m(a,t,!0)}),a;let f=t.someProp("clipboardTextParser",m=>m(e,s,n,t));if(f)a=f;else{let m=s.marks(),{schema:g}=t.state,y=on.fromSchema(g);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let w=i.appendChild(document.createElement("p"));v&&w.appendChild(y.serializeNode(g.text(v,m)))})}}else t.someProp("transformPastedHTML",f=>{r=f(r,t)}),i=dE(r),Hs&&pE(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let m=i.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;i=m}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||br.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||d),context:s,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!lE.test(m.parentNode.nodeName)?{ignore:!0}:null}})),d)a=hE(Up(a,+d[1],+d[2]),d[4]);else if(a=H.maxOpen(uE(a.content,s),!0),a.openStart||a.openEnd){let f=0,m=0;for(let g=a.content.firstChild;f<a.openStart&&!g.type.spec.isolating;f++,g=g.firstChild);for(let g=a.content.lastChild;m<a.openEnd&&!g.type.spec.isolating;m++,g=g.lastChild);a=Up(a,f,m)}return t.someProp("transformPasted",f=>{a=f(a,t,l)}),a}const lE=/^(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 uE(t,e){if(t.childCount<2)return t;for(let r=e.depth;r>=0;r--){let s=e.node(r).contentMatchAt(e.index(r)),o,i=[];if(t.forEach(a=>{if(!i)return;let l=s.findWrapping(a.type),c;if(!l)return i=null;if(c=i.length&&o.length&&eg(l,o,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=tg(i[i.length-1],o.length));let d=Zm(a,l);i.push(d),s=s.matchType(d.type),o=l}}),i)return L.from(i)}return t}function Zm(t,e,r=0){for(let n=e.length-1;n>=r;n--)t=e[n].create(null,L.from(t));return t}function eg(t,e,r,n,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let o=eg(t,e,r,n.lastChild,s+1);if(o)return n.copy(n.content.replaceChild(n.childCount-1,o));if(n.contentMatchAt(n.childCount).matchType(s==t.length-1?r.type:t[s+1]))return n.copy(n.content.append(L.from(Zm(r,t,s+1))))}}function tg(t,e){if(e==0)return t;let r=t.content.replaceChild(t.childCount-1,tg(t.lastChild,e-1)),n=t.contentMatchAt(t.childCount).fillBefore(L.empty,!0);return t.copy(r.append(n))}function Tl(t,e,r,n,s,o){let i=e<0?t.firstChild:t.lastChild,a=i.content;return t.childCount>1&&(o=0),s<n-1&&(a=Tl(a,e,r,n,s+1,o)),s>=r&&(a=e<0?i.contentMatchAt(0).fillBefore(a,o<=s).append(a):a.append(i.contentMatchAt(i.childCount).fillBefore(L.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(a))}function Up(t,e,r){return e<t.openStart&&(t=new H(Tl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),r<t.openEnd&&(t=new H(Tl(t.content,1,r,t.openEnd,0,0),t.openStart,r)),t}const rg={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 Jp=null;function ng(){return Jp||(Jp=document.implementation.createHTMLDocument("title"))}let za=null;function cE(t){let e=window.trustedTypes;return e?(za||(za=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:r=>r})),za.createHTML(t)):t}function dE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let r=ng().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(t),s;if((s=n&&rg[n[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=cE(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;return r}function pE(t){let e=t.querySelectorAll(Ve?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<e.length;r++){let n=e[r];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),n)}}function hE(t,e){if(!t.size)return t;let r=t.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return t}let{content:s,openStart:o,openEnd:i}=t;for(let a=n.length-2;a>=0;a-=2){let l=r.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;s=L.from(l.create(n[a+1],s)),o++,i++}return new H(s,o,i)}const Ge={},Ye={},fE={touchstart:!0,touchmove:!0};class mE{constructor(){this.shiftKey=!1,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=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function gE(t){for(let e in Ge){let r=Ge[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=n=>{yE(t,n)&&!Tu(t,n)&&(t.editable||!(n.type in Ye))&&r(t,n)},fE[e]?{passive:!0}:void 0)}Ke&&t.dom.addEventListener("input",()=>null),Ml(t)}function mr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function bE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ml(t){t.someProp("handleDOMEvents",e=>{for(let r in e)t.input.eventHandlers[r]||t.dom.addEventListener(r,t.input.eventHandlers[r]=n=>Tu(t,n))})}function Tu(t,e){return t.someProp("handleDOMEvents",r=>{let n=r[e.type];return n?n(t,e)||e.defaultPrevented:!1})}function yE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let r=e.target;r!=t.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(e))return!1;return!0}function xE(t,e){!Tu(t,e)&&Ge[e.type]&&(t.editable||!(e.type in Ye))&&Ge[e.type](t,e)}Ye.keydown=(t,e)=>{let r=e;if(t.input.shiftKey=r.keyCode==16||r.shiftKey,!og(t,r)&&(t.input.lastKeyCode=r.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Wt&&Ve&&r.keyCode==13)))if(r.keyCode!=229&&t.domObserver.forceFlush(),Bn&&r.keyCode==13&&!r.ctrlKey&&!r.altKey&&!r.metaKey){let n=Date.now();t.input.lastIOSEnter=n,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==n&&(t.someProp("handleKeyDown",s=>s(t,Rr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",n=>n(t,r))||aE(t,r)?r.preventDefault():mr(t,"key")};Ye.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ye.keypress=(t,e)=>{let r=e;if(og(t,r)||!r.charCode||r.ctrlKey&&!r.altKey||ct&&r.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,r))){r.preventDefault();return}let n=t.state.selection;if(!(n instanceof X)||!n.$from.sameParent(n.$to)){let s=String.fromCharCode(r.charCode),o=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",i=>i(t,n.$from.pos,n.$to.pos,s,o))&&t.dispatch(o()),r.preventDefault()}};function $i(t){return{left:t.clientX,top:t.clientY}}function vE(t,e){let r=e.x-t.clientX,n=e.y-t.clientY;return r*r+n*n<100}function Mu(t,e,r,n,s){if(n==-1)return!1;let o=t.state.doc.resolve(n);for(let i=o.depth+1;i>0;i--)if(t.someProp(e,a=>i>o.depth?a(t,r,o.nodeAfter,o.before(i),s,!0):a(t,r,o.node(i),o.before(i),s,!1)))return!0;return!1}function Sn(t,e,r){if(t.focused||t.focus(),t.state.selection.eq(e))return;let n=t.state.tr.setSelection(e);n.setMeta("pointer",!0),t.dispatch(n)}function wE(t,e){if(e==-1)return!1;let r=t.state.doc.resolve(e),n=r.nodeAfter;return n&&n.isAtom&&Y.isSelectable(n)?(Sn(t,new Y(r)),!0):!1}function DE(t,e){if(e==-1)return!1;let r=t.state.selection,n,s;r instanceof Y&&(n=r.node);let o=t.state.doc.resolve(e);for(let i=o.depth+1;i>0;i--){let a=i>o.depth?o.nodeAfter:o.node(i);if(Y.isSelectable(a)){n&&r.$from.depth>0&&i>=r.$from.depth&&o.before(r.$from.depth+1)==r.$from.pos?s=o.before(r.$from.depth):s=o.before(i);break}}return s!=null?(Sn(t,Y.create(t.state.doc,s)),!0):!1}function CE(t,e,r,n,s){return Mu(t,"handleClickOn",e,r,n)||t.someProp("handleClick",o=>o(t,e,n))||(s?DE(t,r):wE(t,r))}function kE(t,e,r,n){return Mu(t,"handleDoubleClickOn",e,r,n)||t.someProp("handleDoubleClick",s=>s(t,e,n))}function EE(t,e,r,n){return Mu(t,"handleTripleClickOn",e,r,n)||t.someProp("handleTripleClick",s=>s(t,e,n))||SE(t,r,n)}function SE(t,e,r){if(r.button!=0)return!1;let n=t.state.doc;if(e==-1)return n.inlineContent?(Sn(t,X.create(n,0,n.content.size)),!0):!1;let s=n.resolve(e);for(let o=s.depth+1;o>0;o--){let i=o>s.depth?s.nodeAfter:s.node(o),a=s.before(o);if(i.inlineContent)Sn(t,X.create(n,a+1,a+1+i.content.size));else if(Y.isSelectable(i))Sn(t,Y.create(n,a));else continue;return!0}}function Bu(t){return qo(t)}const sg=ct?"metaKey":"ctrlKey";Ge.mousedown=(t,e)=>{let r=e;t.input.shiftKey=r.shiftKey;let n=Bu(t),s=Date.now(),o="singleClick";s-t.input.lastClick.time<500&&vE(r,t.input.lastClick)&&!r[sg]&&t.input.lastClick.button==r.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:s,x:r.clientX,y:r.clientY,type:o,button:r.button};let i=t.posAtCoords($i(r));i&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new FE(t,i,r,!!n)):(o=="doubleClick"?kE:EE)(t,i.pos,i.inside,r)?r.preventDefault():mr(t,"pointer"))};class FE{constructor(e,r,n,s){this.view=e,this.pos=r,this.event=n,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[sg],this.allowDefault=n.shiftKey;let o,i;if(r.inside>-1)o=e.state.doc.nodeAt(r.inside),i=r.inside;else{let d=e.state.doc.resolve(r.pos);o=d.parent,i=d.depth?d.before():0}const a=s?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(n.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof Y&&c.from<=i&&c.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&pt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),mr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Jt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let r=this.pos;this.view.state.doc!=this.startDoc&&(r=this.view.posAtCoords($i(e))),this.updateAllowDefault(e),this.allowDefault||!r?mr(this.view,"pointer"):CE(this.view,r.pos,r.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ke&&this.mightDrag&&!this.mightDrag.node.isAtom||Ve&&!this.view.state.selection.visible&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(Sn(this.view,re.near(this.view.state.doc.resolve(r.pos))),e.preventDefault()):mr(this.view,"pointer")}move(e){this.updateAllowDefault(e),mr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ge.touchstart=t=>{t.input.lastTouch=Date.now(),Bu(t),mr(t,"pointer")};Ge.touchmove=t=>{t.input.lastTouch=Date.now(),mr(t,"pointer")};Ge.contextmenu=t=>Bu(t);function og(t,e){return t.composing?!0:Ke&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const AE=Wt?5e3:-1;Ye.compositionstart=Ye.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,r=e.selection.$to;if(e.selection instanceof X&&(e.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||r.marks(),qo(t,!0),t.markCursor=null;else if(qo(t,!e.selection.empty),pt&&e.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let n=t.domSelectionRange();for(let s=n.focusNode,o=n.focusOffset;s&&s.nodeType==1&&o!=0;){let i=o<0?s.lastChild:s.childNodes[o-1];if(!i)break;if(i.nodeType==3){let a=t.domSelection();a&&a.collapse(i,i.nodeValue.length);break}else s=i,o=-1}}t.input.composing=!0}ig(t,AE)};Ye.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,ig(t,20))};function ig(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qo(t),e))}function ag(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=TE());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function NE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let r=wk(e.focusNode,e.focusOffset),n=Dk(e.focusNode,e.focusOffset);if(r&&n&&r!=n){let s=n.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(r==o||n==o)return o;if(!s||!s.isText(n.nodeValue))return n;if(t.input.compositionNode==n){let i=r.pmViewDesc;if(!(!i||!i.isText(r.nodeValue)))return n}}return r||n}function TE(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qo(t,e=!1){if(!(Wt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ag(t),e||t.docView&&t.docView.dirty){let r=Fu(t),n=t.state.selection;return r&&!r.eq(n)?t.dispatch(t.state.tr.setSelection(r)):(t.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function ME(t,e){if(!t.dom.parentNode)return;let r=t.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(e),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),n.removeAllRanges(),n.addRange(s),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),t.focus()},50)}const Ms=Ze&&yr<15||Bn&&Fk<604;Ge.copy=Ye.cut=(t,e)=>{let r=e,n=t.state.selection,s=r.type=="cut";if(n.empty)return;let o=Ms?null:r.clipboardData,i=n.content(),{dom:a,text:l}=Nu(t,i);o?(r.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):ME(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function BE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function jE(t,e){if(!t.dom.parentNode)return;let r=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,n=t.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),n.parentNode&&n.parentNode.removeChild(n),r?Bs(t,n.value,null,s,e):Bs(t,n.textContent,n.innerHTML,s,e)},50)}function Bs(t,e,r,n,s){let o=Qm(t,e,r,n,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,o||H.empty)))return!0;if(!o)return!1;let i=BE(o),a=i?t.state.tr.replaceSelectionWith(i,n):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function lg(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let r=t.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}Ye.paste=(t,e)=>{let r=e;if(t.composing&&!Wt)return;let n=Ms?null:r.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;n&&Bs(t,lg(n),n.getData("text/html"),s,r)?r.preventDefault():jE(t,r)};class ug{constructor(e,r,n){this.slice=e,this.move=r,this.node=n}}const OE=ct?"altKey":"ctrlKey";function cg(t,e){let r=t.someProp("dragCopies",n=>!n(e));return r??!e[OE]}Ge.dragstart=(t,e)=>{let r=e,n=t.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let s=t.state.selection,o=s.empty?null:t.posAtCoords($i(r)),i;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof Y?s.to-1:s.to))){if(n&&n.mightDrag)i=Y.create(t.state.doc,n.mightDrag.pos);else if(r.target&&r.target.nodeType==1){let f=t.docView.nearestDesc(r.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(i=Y.create(t.state.doc,f.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:c,slice:d}=Nu(t,a);(!r.dataTransfer.files.length||!Ve||_m>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Ms?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",Ms||r.dataTransfer.setData("text/plain",c),t.dragging=new ug(d,cg(t,r),i)};Ge.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ye.dragover=Ye.dragenter=(t,e)=>e.preventDefault();Ye.drop=(t,e)=>{let r=e,n=t.dragging;if(t.dragging=null,!r.dataTransfer)return;let s=t.posAtCoords($i(r));if(!s)return;let o=t.state.doc.resolve(s.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=Qm(t,lg(r.dataTransfer),Ms?null:r.dataTransfer.getData("text/html"),!1,o);let a=!!(n&&cg(t,r));if(t.someProp("handleDrop",y=>y(t,r,i||H.empty,a))){r.preventDefault();return}if(!i)return;r.preventDefault();let l=i?mm(t.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let c=t.state.tr;if(a){let{node:y}=n;y?y.replace(c):c.deleteSelection()}let d=c.mapping.map(l),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=c.doc;if(f?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(m))return;let g=c.doc.resolve(d);if(f&&Y.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Y(g));else{let y=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,w,D,E)=>y=E),c.setSelection(Au(t,g,c.doc.resolve(y)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Ge.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Jt(t)},20))};Ge.blur=(t,e)=>{let r=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),r.relatedTarget&&t.dom.contains(r.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ge.beforeinput=(t,e)=>{if(Ve&&Wt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Rr(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Ye)Ge[t]=Ye[t];function js(t,e){if(t==e)return!0;for(let r in t)if(t[r]!==e[r])return!1;for(let r in e)if(!(r in t))return!1;return!0}class Wo{constructor(e,r){this.toDOM=e,this.spec=r||Kr,this.side=this.spec.side||0}map(e,r,n,s){let{pos:o,deleted:i}=e.mapResult(r.from+s,this.side<0?-1:1);return i?null:new Je(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Wo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&js(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class vr{constructor(e,r){this.attrs=e,this.spec=r||Kr}map(e,r,n,s){let o=e.map(r.from+s,this.spec.inclusiveStart?-1:1)-n,i=e.map(r.to+s,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Je(o,i,this)}valid(e,r){return r.from<r.to}eq(e){return this==e||e instanceof vr&&js(this.attrs,e.attrs)&&js(this.spec,e.spec)}static is(e){return e.type instanceof vr}destroy(){}}class ju{constructor(e,r){this.attrs=e,this.spec=r||Kr}map(e,r,n,s){let o=e.mapResult(r.from+s,1);if(o.deleted)return null;let i=e.mapResult(r.to+s,-1);return i.deleted||i.pos<=o.pos?null:new Je(o.pos-n,i.pos-n,this)}valid(e,r){let{index:n,offset:s}=e.content.findIndex(r.from),o;return s==r.from&&!(o=e.child(n)).isText&&s+o.nodeSize==r.to}eq(e){return this==e||e instanceof ju&&js(this.attrs,e.attrs)&&js(this.spec,e.spec)}destroy(){}}class Je{constructor(e,r,n){this.from=e,this.to=r,this.type=n}copy(e,r){return new Je(e,r,this.type)}eq(e,r=0){return this.type.eq(e.type)&&this.from+r==e.from&&this.to+r==e.to}map(e,r,n){return this.type.map(e,this,r,n)}static widget(e,r,n){return new Je(e,e,new Wo(r,n))}static inline(e,r,n,s){return new Je(e,r,new vr(n,s))}static node(e,r,n,s){return new Je(e,r,new ju(n,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof vr}get widget(){return this.type instanceof Wo}}const xn=[],Kr={};class fe{constructor(e,r){this.local=e.length?e:xn,this.children=r.length?r:xn}static create(e,r){return r.length?Uo(r,e,0,Kr):He}find(e,r,n){let s=[];return this.findInner(e??0,r??1e9,s,0,n),s}findInner(e,r,n,s,o){for(let i=0;i<this.local.length;i++){let a=this.local[i];a.from<=r&&a.to>=e&&(!o||o(a.spec))&&n.push(a.copy(a.from+s,a.to+s))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<r&&this.children[i+1]>e){let a=this.children[i]+1;this.children[i+2].findInner(e-a,r-a,n,s+a,o)}}map(e,r,n){return this==He||e.maps.length==0?this:this.mapInner(e,r,0,0,n||Kr)}mapInner(e,r,n,s,o){let i;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,s);l&&l.type.valid(r,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?LE(this.children,i||[],e,r,n,s,o):i?new fe(i.sort(Gr),xn):He}add(e,r){return r.length?this==He?fe.create(e,r):this.addInner(e,r,0):this}addInner(e,r,n){let s,o=0;e.forEach((a,l)=>{let c=l+n,d;if(d=pg(r,a,c)){for(s||(s=this.children.slice());o<s.length&&s[o]<l;)o+=3;s[o]==l?s[o+2]=s[o+2].addInner(a,d,c+1):s.splice(o,0,l,l+a.nodeSize,Uo(d,a,c+1,Kr)),o+=3}});let i=dg(o?hg(r):r,-n);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new fe(i.length?this.local.concat(i).sort(Gr):this.local,s||this.children)}remove(e){return e.length==0||this==He?this:this.removeInner(e,0)}removeInner(e,r){let n=this.children,s=this.local;for(let o=0;o<n.length;o+=3){let i,a=n[o]+r,l=n[o+1]+r;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>a&&f.to<l&&(e[d]=null,(i||(i=[])).push(f));if(!i)continue;n==this.children&&(n=this.children.slice());let c=n[o+2].removeInner(i,a+1);c!=He?n[o+2]=c:(n.splice(o,3),o-=3)}if(s.length){for(let o=0,i;o<e.length;o++)if(i=e[o])for(let a=0;a<s.length;a++)s[a].eq(i,r)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return n==this.children&&s==this.local?this:s.length||n.length?new fe(s,n):He}forChild(e,r){if(this==He)return this;if(r.isLeaf)return fe.empty;let n,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let o=e+1,i=o+r.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<i&&l.to>o&&l.type instanceof vr){let c=Math.max(o,l.from)-o,d=Math.min(i,l.to)-o;c<d&&(s||(s=[])).push(l.copy(c,d))}}if(s){let a=new fe(s.sort(Gr),xn);return n?new dr([a,n]):a}return n||He}eq(e){if(this==e)return!0;if(!(e instanceof fe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let r=0;r<this.local.length;r++)if(!this.local[r].eq(e.local[r]))return!1;for(let r=0;r<this.children.length;r+=3)if(this.children[r]!=e.children[r]||this.children[r+1]!=e.children[r+1]||!this.children[r+2].eq(e.children[r+2]))return!1;return!0}locals(e){return Ou(this.localsInner(e))}localsInner(e){if(this==He)return xn;if(e.inlineContent||!this.local.some(vr.is))return this.local;let r=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof vr||r.push(this.local[n]);return r}forEachSet(e){e(this)}}fe.empty=new fe([],[]);fe.removeOverlap=Ou;const He=fe.empty;class dr{constructor(e){this.members=e}map(e,r){const n=this.members.map(s=>s.map(e,r,Kr));return dr.from(n)}forChild(e,r){if(r.isLeaf)return fe.empty;let n=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(e,r);o!=He&&(o instanceof dr?n=n.concat(o.members):n.push(o))}return dr.from(n)}eq(e){if(!(e instanceof dr)||e.members.length!=this.members.length)return!1;for(let r=0;r<this.members.length;r++)if(!this.members[r].eq(e.members[r]))return!1;return!0}locals(e){let r,n=!0;for(let s=0;s<this.members.length;s++){let o=this.members[s].localsInner(e);if(o.length)if(!r)r=o;else{n&&(r=r.slice(),n=!1);for(let i=0;i<o.length;i++)r.push(o[i])}}return r?Ou(n?r:r.sort(Gr)):xn}static from(e){switch(e.length){case 0:return He;case 1:return e[0];default:return new dr(e.every(r=>r instanceof fe)?e:e.reduce((r,n)=>r.concat(n instanceof fe?n:n.members),[]))}}forEachSet(e){for(let r=0;r<this.members.length;r++)this.members[r].forEachSet(e)}}function LE(t,e,r,n,s,o,i){let a=t.slice();for(let c=0,d=o;c<r.maps.length;c++){let f=0;r.maps[c].forEach((m,g,y,v)=>{let w=v-y-(g-m);for(let D=0;D<a.length;D+=3){let E=a[D+1];if(E<0||m>E+d-f)continue;let N=a[D]+d-f;g>=N?a[D+1]=m<=N?-2:-1:m>=d&&w&&(a[D]+=w,a[D+1]+=w)}f+=w}),d=r.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=r.map(t[c]+o),f=d-s;if(f<0||f>=n.content.size){l=!0;continue}let m=r.map(t[c+1]+o,-1),g=m-s,{index:y,offset:v}=n.content.findIndex(f),w=n.maybeChild(y);if(w&&v==f&&v+w.nodeSize==g){let D=a[c+2].mapInner(r,w,d+1,t[c]+o+1,i);D!=He?(a[c]=f,a[c+1]=g,a[c+2]=D):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=_E(a,t,e,r,s,o,i),d=Uo(c,n,0,i);e=d.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,m=0;f<d.children.length;f+=3){let g=d.children[f];for(;m<a.length&&a[m]<g;)m+=3;a.splice(m,0,d.children[f],d.children[f+1],d.children[f+2])}}return new fe(e.sort(Gr),a)}function dg(t,e){if(!e||!t.length)return t;let r=[];for(let n=0;n<t.length;n++){let s=t[n];r.push(new Je(s.from+e,s.to+e,s.type))}return r}function _E(t,e,r,n,s,o,i){function a(l,c){for(let d=0;d<l.local.length;d++){let f=l.local[d].map(n,s,c);f?r.push(f):i.onRemove&&i.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return r}function pg(t,e,r){if(e.isLeaf)return null;let n=r+e.nodeSize,s=null;for(let o=0,i;o<t.length;o++)(i=t[o])&&i.from>r&&i.to<n&&((s||(s=[])).push(i),t[o]=null);return s}function hg(t){let e=[];for(let r=0;r<t.length;r++)t[r]!=null&&e.push(t[r]);return e}function Uo(t,e,r,n){let s=[],o=!1;e.forEach((a,l)=>{let c=pg(t,a,l+r);if(c){o=!0;let d=Uo(c,a,r+l+1,n);d!=He&&s.push(l,l+a.nodeSize,d)}});let i=dg(o?hg(t):t,-r).sort(Gr);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||(n.onRemove&&n.onRemove(i[a].spec),i.splice(a--,1));return i.length||s.length?new fe(i,s):He}function Gr(t,e){return t.from-e.from||t.to-e.to}function Ou(t){let e=t;for(let r=0;r<e.length-1;r++){let n=e[r];if(n.from!=n.to)for(let s=r+1;s<e.length;s++){let o=e[s];if(o.from==n.from){o.to!=n.to&&(e==t&&(e=t.slice()),e[s]=o.copy(o.from,n.to),Kp(e,s+1,o.copy(n.to,o.to)));continue}else{o.from<n.to&&(e==t&&(e=t.slice()),e[r]=n.copy(n.from,o.from),Kp(e,s,n.copy(o.from,n.to)));break}}}return e}function Kp(t,e,r){for(;e<t.length&&Gr(r,t[e])>0;)e++;t.splice(e,0,r)}function $a(t){let e=[];return t.someProp("decorations",r=>{let n=r(t.state);n&&n!=He&&e.push(n)}),t.cursorWrapper&&e.push(fe.create(t.state.doc,[t.cursorWrapper.deco])),dr.from(e)}const IE={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},RE=Ze&&yr<=11;class PE{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class zE{constructor(e,r){this.view=e,this.handleDOMChange=r,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new PE,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let s=0;s<n.length;s++)this.queue.push(n[s]);Ze&&yr<=11&&n.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),RE&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,IE)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let r=0;r<e.length;r++)this.queue.push(e[r]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(zp(this.view)){if(this.suppressingSelectionUpdates)return Jt(this.view);if(Ze&&yr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&en(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let r=new Set,n;for(let o=e.focusNode;o;o=Mn(o))r.add(o);for(let o=e.anchorNode;o;o=Mn(o))if(r.has(o)){n=o;break}let s=n&&this.view.docView.nearestDesc(n);if(s&&s.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&zp(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,a=!1,l=[];if(e.editable)for(let d=0;d<r.length;d++){let f=this.registerMutation(r[d],l);f&&(o=o<0?f.from:Math.min(f.from,o),i=i<0?f.to:Math.max(f.to,i),f.typeOver&&(a=!0))}if(pt&&l.length){let d=l.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,m]=d;f.parentNode&&f.parentNode.parentNode==m.parentNode?m.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let m of d){let g=m.parentNode;g&&g.nodeName=="LI"&&(!f||VE(e,f)!=g)&&m.remove()}}}let c=null;o<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Pi(n)&&(c=Fu(e))&&c.eq(re.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Jt(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||s)&&(o>-1&&(e.docView.markDirty(o,i),$E(e)),this.handleDOMChange(o,i,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Jt(e),this.currentSelection.set(n))}registerMutation(e,r){if(r.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];r.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let s=e.previousSibling,o=e.nextSibling;if(Ze&&yr<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:m}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f),(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(o=m)}let i=s&&s.parentNode==e.target?Ie(s)+1:0,a=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?Ie(o):e.target.childNodes.length,c=n.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Gp=new WeakMap,Yp=!1;function $E(t){if(!Gp.has(t)&&(Gp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=pt,Yp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Yp=!0}}function Xp(t,e){let r=e.startContainer,n=e.startOffset,s=e.endContainer,o=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return en(i.node,i.offset,s,o)&&([r,n,s,o]=[s,o,r,n]),{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:o}}function HE(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Xp(t,s)}let r;function n(s){s.preventDefault(),s.stopImmediatePropagation(),r=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0),r?Xp(t,r):null}function VE(t,e){for(let r=e.parentNode;r&&r!=t.dom;r=r.parentNode){let n=t.docView.nearestDesc(r,!0);if(n&&n.node.isBlock)return r}return null}function qE(t,e,r){let{node:n,fromOffset:s,toOffset:o,from:i,to:a}=t.docView.parseRange(e,r),l=t.domSelectionRange(),c,d=l.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Pi(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ve&&t.input.lastKeyCode===8)for(let w=o;w>s;w--){let D=n.childNodes[w-1],E=D.pmViewDesc;if(D.nodeName=="BR"&&!E){o=w;break}if(!E||E.size)break}let f=t.state.doc,m=t.someProp("domParser")||br.fromSchema(t.state.schema),g=f.resolve(i),y=null,v=m.parse(n,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:s,to:o,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:WE,context:g});if(c&&c[0].pos!=null){let w=c[0].pos,D=c[1]&&c[1].pos;D==null&&(D=w),y={anchor:w+i,head:D+i}}return{doc:v,sel:y,from:i,to:a}}function WE(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ke&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(t.parentNode.lastChild==t||Ke&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const UE=/^(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 JE(t,e,r,n,s){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let B=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,$=Fu(t,B);if($&&!t.state.selection.eq($)){if(Ve&&Wt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",z=>z(t,Rr(13,"Enter"))))return;let O=t.state.tr.setSelection($);B=="pointer"?O.setMeta("pointer",!0):B=="key"&&O.scrollIntoView(),o&&O.setMeta("composition",o),t.dispatch(O)}return}let i=t.state.doc.resolve(e),a=i.sharedDepth(r);e=i.before(a+1),r=t.state.doc.resolve(r).after(a+1);let l=t.state.selection,c=qE(t,e,r),d=t.state.doc,f=d.slice(c.from,c.to),m,g;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,g="end"):(m=t.state.selection.from,g="start"),t.input.lastKeyCode=null;let y=YE(f.content,c.doc.content,c.from,m,g);if(y&&t.input.domChangeCount++,(Bn&&t.input.lastIOSEnter>Date.now()-225||Wt)&&s.some(B=>B.nodeType==1&&!UE.test(B.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",B=>B(t,Rr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(n&&l instanceof X&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))y={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let B=Qp(t,t.state.doc,c.sel);if(B&&!B.eq(t.state.selection)){let $=t.state.tr.setSelection(B);o&&$.setMeta("composition",o),t.dispatch($)}}return}t.state.selection.from<t.state.selection.to&&y.start==y.endB&&t.state.selection instanceof X&&(y.start>t.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?y.start=t.state.selection.from:y.endA<t.state.selection.to&&y.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),Ze&&yr<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>c.from&&c.doc.textBetween(y.start-c.from-1,y.start-c.from+1)=="  "&&(y.start--,y.endA--,y.endB--);let v=c.doc.resolveNoCache(y.start-c.from),w=c.doc.resolveNoCache(y.endB-c.from),D=d.resolve(y.start),E=v.sameParent(w)&&v.parent.inlineContent&&D.end()>=y.endA;if((Bn&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!E&&v.pos<c.doc.content.size&&(!v.sameParent(w)||!v.parent.inlineContent)&&v.pos<w.pos&&!/\S/.test(c.doc.textBetween(v.pos,w.pos,"","")))&&t.someProp("handleKeyDown",B=>B(t,Rr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&GE(d,y.start,y.endA,v,w)&&t.someProp("handleKeyDown",B=>B(t,Rr(8,"Backspace")))){Wt&&Ve&&t.domObserver.suppressSelectionUpdates();return}Ve&&y.endB==y.start&&(t.input.lastChromeDelete=Date.now()),Wt&&!E&&v.start()!=w.start()&&w.parentOffset==0&&v.depth==w.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==y.endA&&(y.endB-=2,w=c.doc.resolveNoCache(y.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(B){return B(t,Rr(13,"Enter"))})},20));let N=y.start,A=y.endA,T=B=>{let $=B||t.state.tr.replace(N,A,c.doc.slice(y.start-c.from,y.endB-c.from));if(c.sel){let O=Qp(t,$.doc,c.sel);O&&!(Ve&&t.composing&&O.empty&&(y.start!=y.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==N||O.head==$.mapping.map(A)-1)||Ze&&O.empty&&O.head==N)&&$.setSelection(O)}return o&&$.setMeta("composition",o),$.scrollIntoView()},j;if(E)if(v.pos==w.pos){Ze&&yr<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Jt(t),20));let B=T(t.state.tr.delete(N,A)),$=d.resolve(y.start).marksAcross(d.resolve(y.endA));$&&B.ensureMarks($),t.dispatch(B)}else if(y.endA==y.endB&&(j=KE(v.parent.content.cut(v.parentOffset,w.parentOffset),D.parent.content.cut(D.parentOffset,y.endA-D.start())))){let B=T(t.state.tr);j.type=="add"?B.addMark(N,A,j.mark):B.removeMark(N,A,j.mark),t.dispatch(B)}else if(v.parent.child(v.index()).isText&&v.index()==w.index()-(w.textOffset?0:1)){let B=v.parent.textBetween(v.parentOffset,w.parentOffset),$=()=>T(t.state.tr.insertText(B,N,A));t.someProp("handleTextInput",O=>O(t,N,A,B,$))||t.dispatch($())}else t.dispatch(T());else t.dispatch(T())}function Qp(t,e,r){return Math.max(r.anchor,r.head)>e.content.size?null:Au(t,e.resolve(r.anchor),e.resolve(r.head))}function KE(t,e){let r=t.firstChild.marks,n=e.firstChild.marks,s=r,o=n,i,a,l;for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);for(let d=0;d<r.length;d++)o=r[d].removeFromSet(o);if(s.length==1&&o.length==0)a=s[0],i="add",l=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&o.length==1)a=o[0],i="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(L.from(c).eq(t))return{mark:a,type:i}}function GE(t,e,r,n,s){if(r-e<=s.pos-n.pos||Ha(n,!0,!1)<s.pos)return!1;let o=t.resolve(e);if(!n.parent.isTextblock){let a=o.nodeAfter;return a!=null&&r==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let i=t.resolve(Ha(o,!0,!0));return!i.parent.isTextblock||i.pos>r||Ha(i,!0,!1)<r?!1:n.parent.content.cut(n.parentOffset).eq(i.parent.content)}function Ha(t,e,r){let n=t.depth,s=e?t.end():t.pos;for(;n>0&&(e||t.indexAfter(n)==t.node(n).childCount);)n--,s++,e=!1;if(r){let o=t.node(n).maybeChild(t.indexAfter(n));for(;o&&!o.isLeaf;)o=o.firstChild,s++}return s}function YE(t,e,r,n,s){let o=t.findDiffStart(e,r);if(o==null)return null;let{a:i,b:a}=t.findDiffEnd(e,r+t.size,r+e.size);if(s=="end"){let l=Math.max(0,o-Math.min(i,a));n-=i+l-o}if(i<o&&t.size<e.size){let l=n<=o&&n>=i?o-n:0;o-=l,o&&o<e.size&&Zp(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-i),i=o}else if(a<o){let l=n<=o&&n>=a?o-n:0;o-=l,o&&o<t.size&&Zp(t.textBetween(o-1,o+1))&&(o+=l?1:-1),i=o+(i-a),a=o}return{start:o,endA:i,endB:a}}function Zp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),r=t.charCodeAt(1);return e>=56320&&e<=57343&&r>=55296&&r<=56319}class fg{constructor(e,r){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new mE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=r,this.state=r.state,this.directPlugins=r.plugins||[],this.directPlugins.forEach(sh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=rh(this),th(this),this.nodeViews=nh(this),this.docView=Op(this.state.doc,eh(this),$a(this),this.dom,this),this.domObserver=new zE(this,(n,s,o,i)=>JE(this,n,s,o,i)),this.domObserver.start(),gE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let r in e)this._props[r]=e[r];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ml(this);let r=this._props;this._props=e,e.plugins&&(e.plugins.forEach(sh),this.directPlugins=e.plugins),this.updateStateInner(e.state,r)}setProps(e){let r={};for(let n in this._props)r[n]=this._props[n];r.state=this.state;for(let n in e)r[n]=e[n];this.update(r)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,r){var n;let s=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(ag(this),i=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=r.plugins;if(a||this._props.plugins!=r.plugins||this._props.nodeViews!=r.nodeViews){let g=nh(this);QE(g,this.nodeViews)&&(this.nodeViews=g,o=!0)}(a||r.handleDOMEvents!=this._props.handleDOMEvents)&&Ml(this),this.editable=rh(this),th(this);let l=$a(this),c=eh(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(s.selection))&&(i=!0);let m=d=="preserve"&&i&&this.dom.style.overflowAnchor==null&&Tk(this);if(i){this.domObserver.stop();let g=f&&(Ze||Ve)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&XE(s.selection,e.selection);if(f){let y=Ve?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=NE(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Op(e.doc,c,l,this.dom,this)),y&&!this.trackWrites&&(g=!0)}g||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&eE(this))?Jt(this,g):(Gm(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((n=this.dragging)===null||n===void 0)&&n.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():m&&Mk(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",r=>r(this)))if(this.state.selection instanceof Y){let r=this.docView.domAfterPos(this.state.selection.from);r.nodeType==1&&Ap(this,r.getBoundingClientRect(),e)}else Ap(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let r=0;r<this.directPlugins.length;r++){let n=this.directPlugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let r=0;r<this.state.plugins.length;r++){let n=this.state.plugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let r=0;r<this.pluginViews.length;r++){let n=this.pluginViews[r];n.update&&n.update(this,e)}}updateDraggedNode(e,r){let n=e.node,s=-1;if(this.state.doc.nodeAt(n.from)==n.node)s=n.from;else{let o=n.from+(this.state.doc.content.size-r.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==n.node&&(s=o)}this.dragging=new ug(e.slice,e.move,s<0?void 0:Y.create(this.state.doc,s))}someProp(e,r){let n=this._props&&this._props[e],s;if(n!=null&&(s=r?r(n):n))return s;for(let i=0;i<this.directPlugins.length;i++){let a=this.directPlugins[i].props[e];if(a!=null&&(s=r?r(a):a))return s}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let a=o[i].props[e];if(a!=null&&(s=r?r(a):a))return s}}hasFocus(){if(Ze){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Bk(this.dom),Jt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Ik(this,e)}coordsAtPos(e,r=1){return $m(this,e,r)}domAtPos(e,r=0){return this.docView.domFromPos(e,r)}nodeDOM(e){let r=this.docView.descAt(e);return r?r.nodeDOM:null}posAtDOM(e,r,n=-1){let s=this.docView.posFromDOM(e,r,n);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,r){return Hk(this,r||this.state,e)}pasteHTML(e,r){return Bs(this,"",e,!1,r||new ClipboardEvent("paste"))}pasteText(e,r){return Bs(this,e,null,!0,r||new ClipboardEvent("paste"))}serializeForClipboard(e){return Nu(this,e)}destroy(){this.docView&&(bE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$a(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,xk())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xE(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ke&&this.root.nodeType===11&&kk(this.dom.ownerDocument)==this.dom&&HE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}fg.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function eh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",r=>{if(typeof r=="function"&&(r=r(t.state)),r)for(let n in r)n=="class"?e.class+=" "+r[n]:n=="style"?e.style=(e.style?e.style+";":"")+r[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(r[n]))}),e.translate||(e.translate="no"),[Je.node(0,t.state.doc.content.size,e)]}function th(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:Je.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function rh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function XE(t,e){let r=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(r)!=e.$anchor.start(r)}function nh(t){let e=Object.create(null);function r(n){for(let s in n)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=n[s])}return t.someProp("nodeViews",r),t.someProp("markViews",r),e}function QE(t,e){let r=0,n=0;for(let s in t){if(t[s]!=e[s])return!0;r++}for(let s in e)n++;return r!=n}function sh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Dr={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:"'"},Jo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ZE=typeof navigator<"u"&&/Mac/.test(navigator.platform),eS=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Re=0;Re<10;Re++)Dr[48+Re]=Dr[96+Re]=String(Re);for(var Re=1;Re<=24;Re++)Dr[Re+111]="F"+Re;for(var Re=65;Re<=90;Re++)Dr[Re]=String.fromCharCode(Re+32),Jo[Re]=String.fromCharCode(Re);for(var Va in Dr)Jo.hasOwnProperty(Va)||(Jo[Va]=Dr[Va]);function tS(t){var e=ZE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||eS&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",r=!e&&t.key||(t.shiftKey?Jo:Dr)[t.keyCode]||t.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}const rS=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),nS=typeof navigator<"u"&&/Win/.test(navigator.platform);function sS(t){let e=t.split(/-(?!$)/),r=e[e.length-1];r=="Space"&&(r=" ");let n,s,o,i;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))rS?i=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(r="Alt-"+r),s&&(r="Ctrl-"+r),i&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function oS(t){let e=Object.create(null);for(let r in t)e[sS(r)]=t[r];return e}function qa(t,e,r=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),r&&e.shiftKey&&(t="Shift-"+t),t}function iS(t){return new be({props:{handleKeyDown:mg(t)}})}function mg(t){let e=oS(t);return function(r,n){let s=tS(n),o,i=e[qa(s,n)];if(i&&i(r.state,r.dispatch,r))return!0;if(s.length==1&&s!=" "){if(n.shiftKey){let a=e[qa(s,n,!1)];if(a&&a(r.state,r.dispatch,r))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(nS&&n.ctrlKey&&n.altKey)&&(o=Dr[n.keyCode])&&o!=s){let a=e[qa(o,n)];if(a&&a(r.state,r.dispatch,r))return!0}}return!1}}var aS=Object.defineProperty,Lu=(t,e)=>{for(var r in e)aS(t,r,{get:e[r],enumerable:!0})};function Hi(t){const{state:e,transaction:r}=t;let{selection:n}=r,{doc:s}=r,{storedMarks:o}=r;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 o},get selection(){return n},get doc(){return s},get tr(){return n=r.selection,s=r.doc,o=r.storedMarks,r}}}var Vi=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:r}=this,{view:n}=e,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([i,a])=>[i,(...c)=>{const d=a(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:r,editor:n,state:s}=this,{view:o}=n,i=[],a=!!t,l=t||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),i.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,m])=>[f,(...y)=>{const v=this.buildProps(l,e),w=m(...y)(v);return i.push(w),d}])),run:c};return d}createCan(t){const{rawCommands:e,state:r}=this,n=!1,s=t||r.tr,o=this.buildProps(s,n);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,n)}}buildProps(t,e=!0){const{rawCommands:r,editor:n,state:s}=this,{view:o}=n,i={tr:t,editor:n,view:o,state:Hi({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([a,l])=>[a,(...c)=>l(...c)(i)]))}};return i}},gg={};Lu(gg,{blur:()=>lS,clearContent:()=>uS,clearNodes:()=>cS,command:()=>dS,createParagraphNear:()=>pS,cut:()=>hS,deleteCurrentNode:()=>fS,deleteNode:()=>mS,deleteRange:()=>gS,deleteSelection:()=>bS,enter:()=>yS,exitCode:()=>xS,extendMarkRange:()=>vS,first:()=>wS,focus:()=>CS,forEach:()=>kS,insertContent:()=>ES,insertContentAt:()=>AS,joinBackward:()=>MS,joinDown:()=>TS,joinForward:()=>BS,joinItemBackward:()=>jS,joinItemForward:()=>OS,joinTextblockBackward:()=>LS,joinTextblockForward:()=>_S,joinUp:()=>NS,keyboardShortcut:()=>RS,lift:()=>PS,liftEmptyBlock:()=>zS,liftListItem:()=>$S,newlineInCode:()=>HS,resetAttributes:()=>VS,scrollIntoView:()=>qS,selectAll:()=>WS,selectNodeBackward:()=>US,selectNodeForward:()=>JS,selectParentNode:()=>KS,selectTextblockEnd:()=>GS,selectTextblockStart:()=>YS,setContent:()=>XS,setMark:()=>mF,setMeta:()=>gF,setNode:()=>bF,setNodeSelection:()=>yF,setTextSelection:()=>xF,sinkListItem:()=>vF,splitBlock:()=>wF,splitListItem:()=>DF,toggleList:()=>CF,toggleMark:()=>kF,toggleNode:()=>EF,toggleWrap:()=>SF,undoInputRule:()=>FF,unsetAllMarks:()=>AF,unsetMark:()=>NF,updateAttributes:()=>TF,wrapIn:()=>MF,wrapInList:()=>BF});var lS=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var r;t.isDestroyed||(e.dom.blur(),(r=window?.getSelection())==null||r.removeAllRanges())}),!0),uS=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),cS=()=>({state:t,tr:e,dispatch:r})=>{const{selection:n}=e,{ranges:s}=n;return r&&s.forEach(({$from:o,$to:i})=>{t.doc.nodesBetween(o.pos,i.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,f=c.resolve(d.map(l)),m=c.resolve(d.map(l+a.nodeSize)),g=f.blockRange(m);if(!g)return;const y=zn(g);if(a.type.isTextblock){const{defaultType:v}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(g.start,v)}(y||y===0)&&e.lift(g,y)})}),!0},dS=t=>e=>t(e),pS=()=>({state:t,dispatch:e})=>Mm(t,e),hS=(t,e)=>({editor:r,tr:n})=>{const{state:s}=r,o=s.doc.slice(t.from,t.to);n.deleteRange(t.from,t.to);const i=n.mapping.map(e);return n.insert(i,o.content),n.setSelection(new X(n.doc.resolve(Math.max(i-1,0)))),!0},fS=()=>({tr:t,dispatch:e})=>{const{selection:r}=t,n=r.$anchor.node();if(n.content.size>0)return!1;const s=t.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===n.type){if(e){const a=s.before(o),l=s.after(o);t.delete(a,l).scrollIntoView()}return!0}return!1};function Ce(t,e){if(typeof t=="string"){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}var mS=t=>({tr:e,state:r,dispatch:n})=>{const s=Ce(t,r.schema),o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===s){if(n){const l=o.before(i),c=o.after(i);e.delete(l,c).scrollIntoView()}return!0}return!1},gS=t=>({tr:e,dispatch:r})=>{const{from:n,to:s}=t;return r&&e.delete(n,s),!0},bS=()=>({state:t,dispatch:e})=>wu(t,e),yS=()=>({commands:t})=>t.keyboardShortcut("Enter"),xS=()=>({state:t,dispatch:e})=>sk(t,e);function _u(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ko(t,e,r={strict:!0}){const n=Object.keys(e);return n.length?n.every(s=>r.strict?e[s]===t[s]:_u(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function bg(t,e,r={}){return t.find(n=>n.type===e&&Ko(Object.fromEntries(Object.keys(r).map(s=>[s,n.attrs[s]])),r))}function oh(t,e,r={}){return!!bg(t,e,r)}function Iu(t,e,r){var n;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(d=>d.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(d=>d.type===e)||(r=r||((n=s.node.marks[0])==null?void 0:n.attrs),!bg([...s.node.marks],e,r)))return;let i=s.index,a=t.start()+s.offset,l=i+1,c=a+s.node.nodeSize;for(;i>0&&oh([...t.parent.child(i-1).marks],e,r);)i-=1,a-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&oh([...t.parent.child(l).marks],e,r);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function tr(t,e){if(typeof t=="string"){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}var vS=(t,e={})=>({tr:r,state:n,dispatch:s})=>{const o=tr(t,n.schema),{doc:i,selection:a}=r,{$from:l,from:c,to:d}=a;if(s){const f=Iu(l,o,e);if(f&&f.from<=c&&f.to>=d){const m=X.create(i,f.from,f.to);r.setSelection(m)}}return!0},wS=t=>e=>{const r=typeof t=="function"?t(e):t;for(let n=0;n<r.length;n+=1)if(r[n](e))return!0;return!1};function yg(t){return t instanceof X}function Vr(t=0,e=0,r=0){return Math.min(Math.max(t,e),r)}function xg(t,e=null){if(!e)return null;const r=re.atStart(t),n=re.atEnd(t);if(e==="start"||e===!0)return r;if(e==="end")return n;const s=r.from,o=n.to;return e==="all"?X.create(t,Vr(0,s,o),Vr(t.content.size,s,o)):X.create(t,Vr(e,s,o),Vr(e,s,o))}function DS(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ru(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var CS=(t=null,e={})=>({editor:r,view:n,tr:s,dispatch:o})=>{e={scrollIntoView:!0,...e};const i=()=>{(Ru()||DS())&&n.dom.focus(),requestAnimationFrame(()=>{r.isDestroyed||(n.focus(),e?.scrollIntoView&&r.commands.scrollIntoView())})};if(n.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!yg(r.state.selection))return i(),!0;const a=xg(s.doc,t)||r.state.selection,l=r.state.selection.eq(a);return o&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),i()),!0},kS=(t,e)=>r=>t.every((n,s)=>e(n,{...r,index:s})),ES=(t,e)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},t,e),vg=t=>{const e=t.childNodes;for(let r=e.length-1;r>=0;r-=1){const n=e[r];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?t.removeChild(n):n.nodeType===1&&vg(n)}return t};function vo(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,r=new window.DOMParser().parseFromString(e,"text/html").body;return vg(r)}function Os(t,e,r){if(t instanceof Ct||t instanceof L)return t;r={slice:!0,parseOptions:{},...r};const n=typeof t=="object"&&t!==null,s=typeof t=="string";if(n)try{if(Array.isArray(t)&&t.length>0)return L.fromArray(t.map(a=>e.nodeFromJSON(a)));const i=e.nodeFromJSON(t);return r.errorOnInvalidContent&&i.check(),i}catch(o){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),Os("",e,r)}if(s){if(r.errorOnInvalidContent){let i=!1,a="";const l=new sm({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(r.slice?br.fromSchema(l).parseSlice(vo(t),r.parseOptions):br.fromSchema(l).parse(vo(t),r.parseOptions),r.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=br.fromSchema(e);return r.slice?o.parseSlice(vo(t),r.parseOptions).content:o.parse(vo(t),r.parseOptions)}return Os("",e,r)}function SS(t,e,r){const n=t.steps.length-1;if(n<e)return;const s=t.steps[n];if(!(s instanceof Ne||s instanceof Te))return;const o=t.mapping.maps[n];let i=0;o.forEach((a,l,c,d)=>{i===0&&(i=d)}),t.setSelection(re.near(t.doc.resolve(i),r))}var FS=t=>!("type"in t),AS=(t,e,r)=>({tr:n,dispatch:s,editor:o})=>{var i;if(s){r={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};let a;const l=w=>{o.emit("contentError",{editor:o,error:w,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Os(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(w){l(w)}try{a=Os(e,o.schema,{parseOptions:c,errorOnInvalidContent:(i=r.errorOnInvalidContent)!=null?i:o.options.enableContentCheck})}catch(w){return l(w),!1}let{from:d,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},m=!0,g=!0;if((FS(a)?a:[a]).forEach(w=>{w.check(),m=m?w.isText&&w.marks.length===0:!1,g=g?w.isBlock:!1}),d===f&&g){const{parent:w}=n.doc.resolve(d);w.isTextblock&&!w.type.spec.code&&!w.childCount&&(d-=1,f+=1)}let v;if(m){if(Array.isArray(e))v=e.map(w=>w.text||"").join("");else if(e instanceof L){let w="";e.forEach(D=>{D.text&&(w+=D.text)}),v=w}else typeof e=="object"&&e&&e.text?v=e.text:v=e;n.insertText(v,d,f)}else{v=a;const w=n.doc.resolve(d),D=w.node(),E=w.parentOffset===0,N=D.isText||D.isTextblock,A=D.content.size>0;E&&N&&A&&(d=Math.max(0,d-1)),n.replaceWith(d,f,v)}r.updateSelection&&SS(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:d,text:v}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:d,text:v})}return!0},NS=()=>({state:t,dispatch:e})=>tk(t,e),TS=()=>({state:t,dispatch:e})=>rk(t,e),MS=()=>({state:t,dispatch:e})=>km(t,e),BS=()=>({state:t,dispatch:e})=>Am(t,e),jS=()=>({state:t,dispatch:e,tr:r})=>{try{const n=_i(t.doc,t.selection.$from.pos,-1);return n==null?!1:(r.join(n,2),e&&e(r),!0)}catch{return!1}},OS=()=>({state:t,dispatch:e,tr:r})=>{try{const n=_i(t.doc,t.selection.$from.pos,1);return n==null?!1:(r.join(n,2),e&&e(r),!0)}catch{return!1}},LS=()=>({state:t,dispatch:e})=>ZC(t,e),_S=()=>({state:t,dispatch:e})=>ek(t,e);function wg(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function IS(t){const e=t.split(/-(?!$)/);let r=e[e.length-1];r==="Space"&&(r=" ");let n,s,o,i;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Ru()||wg()?i=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(r=`Alt-${r}`),s&&(r=`Ctrl-${r}`),i&&(r=`Meta-${r}`),o&&(r=`Shift-${r}`),r}var RS=t=>({editor:e,view:r,tr:n,dispatch:s})=>{const o=IS(t).split(/-(?!$)/),i=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{r.someProp("handleKeyDown",c=>c(r,a))});return l?.steps.forEach(c=>{const d=c.map(n.mapping);d&&s&&n.maybeStep(d)}),!0};function Cr(t,e,r={}){const{from:n,to:s,empty:o}=t.selection,i=e?Ce(e,t.schema):null,a=[];t.doc.nodesBetween(n,s,(f,m)=>{if(f.isText)return;const g=Math.max(n,m),y=Math.min(s,m+f.nodeSize);a.push({node:f,from:g,to:y})});const l=s-n,c=a.filter(f=>i?i.name===f.node.type.name:!0).filter(f=>Ko(f.node.attrs,r,{strict:!1}));return o?!!c.length:c.reduce((f,m)=>f+m.to-m.from,0)>=l}var PS=(t,e={})=>({state:r,dispatch:n})=>{const s=Ce(t,r.schema);return Cr(r,s,e)?nk(r,n):!1},zS=()=>({state:t,dispatch:e})=>Bm(t,e),$S=t=>({state:e,dispatch:r})=>{const n=Ce(t,e.schema);return mk(n)(e,r)},HS=()=>({state:t,dispatch:e})=>Tm(t,e);function qi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ih(t,e){const r=typeof e=="string"?[e]:e;return Object.keys(t).reduce((n,s)=>(r.includes(s)||(n[s]=t[s]),n),{})}var VS=(t,e)=>({tr:r,state:n,dispatch:s})=>{let o=null,i=null;const a=qi(typeof t=="string"?t:t.name,n.schema);return a?(a==="node"&&(o=Ce(t,n.schema)),a==="mark"&&(i=tr(t,n.schema)),s&&r.selection.ranges.forEach(l=>{n.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{o&&o===c.type&&r.setNodeMarkup(d,void 0,ih(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(f=>{i===f.type&&r.addMark(d,d+c.nodeSize,i.create(ih(f.attrs,e)))})})}),!0):!1},qS=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),WS=()=>({tr:t,dispatch:e})=>{if(e){const r=new st(t.doc);t.setSelection(r)}return!0},US=()=>({state:t,dispatch:e})=>Sm(t,e),JS=()=>({state:t,dispatch:e})=>Nm(t,e),KS=()=>({state:t,dispatch:e})=>ak(t,e),GS=()=>({state:t,dispatch:e})=>ck(t,e),YS=()=>({state:t,dispatch:e})=>uk(t,e);function Bl(t,e,r={},n={}){return Os(t,e,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var XS=(t,{errorOnInvalidContent:e,emitUpdate:r=!0,parseOptions:n={}}={})=>({editor:s,tr:o,dispatch:i,commands:a})=>{const{doc:l}=o;if(n.preserveWhitespace!=="full"){const c=Bl(t,s.schema,n,{errorOnInvalidContent:e??s.options.enableContentCheck});return i&&o.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!r),!0}return i&&o.setMeta("preventUpdate",!r),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:n,errorOnInvalidContent:e??s.options.enableContentCheck})};function Dg(t,e){const r=tr(e,t.schema),{from:n,to:s,empty:o}=t.selection,i=[];o?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(n,s,l=>{i.push(...l.marks)});const a=i.find(l=>l.type.name===r.name);return a?{...a.attrs}:{}}function Cg(t,e){const r=new vm(t);return e.forEach(n=>{n.steps.forEach(s=>{r.step(s)})}),r}function QS(t){for(let e=0;e<t.edgeCount;e+=1){const{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function ZS(t,e,r){const n=[];return t.nodesBetween(e.from,e.to,(s,o)=>{r(s)&&n.push({node:s,pos:o})}),n}function eF(t,e){for(let r=t.depth;r>0;r-=1){const n=t.node(r);if(e(n))return{pos:r>0?t.before(r):0,start:t.start(r),depth:r,node:n}}}function Wi(t){return e=>eF(e.$from,t)}function G(t,e,r){return t.config[e]===void 0&&t.parent?G(t.parent,e,r):typeof t.config[e]=="function"?t.config[e].bind({...r,parent:t.parent?G(t.parent,e,r):null}):t.config[e]}function Pu(t){return t.map(e=>{const r={name:e.name,options:e.options,storage:e.storage},n=G(e,"addExtensions",r);return n?[e,...Pu(n())]:e}).flat(10)}function zu(t,e){const r=on.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(r),s.innerHTML}function kg(t){return typeof t=="function"}function le(t,e=void 0,...r){return kg(t)?e?t.bind(e)(...r):t(...r):t}function tF(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Ls(t){const e=t.filter(s=>s.type==="extension"),r=t.filter(s=>s.type==="node"),n=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:r,markExtensions:n}}function Eg(t){const e=[],{nodeExtensions:r,markExtensions:n}=Ls(t),s=[...r,...n],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage,extensions:s},l=G(i,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([m,g])=>{e.push({type:f,name:m,attribute:{...o,...g}})})})})}),s.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage},l=G(i,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,f])=>{const m={...o,...f};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:i.name,name:d,attribute:m})})}),e}function ye(...t){return t.filter(e=>!!e).reduce((e,r)=>{const n={...e};return Object.entries(r).forEach(([s,o])=>{if(!n[s]){n[s]=o;return}if(s==="class"){const a=o?String(o).split(" "):[],l=n[s]?n[s].split(" "):[],c=a.filter(d=>!l.includes(d));n[s]=[...l,...c].join(" ")}else if(s==="style"){const a=o?o.split(";").map(d=>d.trim()).filter(Boolean):[],l=n[s]?n[s].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[f,m]=d.split(":").map(g=>g.trim());c.set(f,m)}),a.forEach(d=>{const[f,m]=d.split(":").map(g=>g.trim());c.set(f,m)}),n[s]=Array.from(c.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else n[s]=o}),n},{})}function Go(t,e){return e.filter(r=>r.type===t.type.name).filter(r=>r.attribute.rendered).map(r=>r.attribute.renderHTML?r.attribute.renderHTML(t.attrs)||{}:{[r.name]:t.attrs[r.name]}).reduce((r,n)=>ye(r,n),{})}function rF(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function ah(t,e){return"style"in t?t:{...t,getAttrs:r=>{const n=t.getAttrs?t.getAttrs(r):t.attrs;if(n===!1)return!1;const s=e.reduce((o,i)=>{const a=i.attribute.parseHTML?i.attribute.parseHTML(r):rF(r.getAttribute(i.name));return a==null?o:{...o,[i.name]:a}},{});return{...n,...s}}}}function lh(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>e==="attrs"&&tF(r)?!1:r!=null))}function nF(t,e){var r;const n=Eg(t),{nodeExtensions:s,markExtensions:o}=Ls(t),i=(r=s.find(c=>G(c,"topNode")))==null?void 0:r.name,a=Object.fromEntries(s.map(c=>{const d=n.filter(D=>D.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((D,E)=>{const N=G(E,"extendNodeSchema",f);return{...D,...N?N(c):{}}},{}),g=lh({...m,content:le(G(c,"content",f)),marks:le(G(c,"marks",f)),group:le(G(c,"group",f)),inline:le(G(c,"inline",f)),atom:le(G(c,"atom",f)),selectable:le(G(c,"selectable",f)),draggable:le(G(c,"draggable",f)),code:le(G(c,"code",f)),whitespace:le(G(c,"whitespace",f)),linebreakReplacement:le(G(c,"linebreakReplacement",f)),defining:le(G(c,"defining",f)),isolating:le(G(c,"isolating",f)),attrs:Object.fromEntries(d.map(D=>{var E,N;return[D.name,{default:(E=D?.attribute)==null?void 0:E.default,validate:(N=D?.attribute)==null?void 0:N.validate}]}))}),y=le(G(c,"parseHTML",f));y&&(g.parseDOM=y.map(D=>ah(D,d)));const v=G(c,"renderHTML",f);v&&(g.toDOM=D=>v({node:D,HTMLAttributes:Go(D,d)}));const w=G(c,"renderText",f);return w&&(g.toText=w),[c.name,g]})),l=Object.fromEntries(o.map(c=>{const d=n.filter(w=>w.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((w,D)=>{const E=G(D,"extendMarkSchema",f);return{...w,...E?E(c):{}}},{}),g=lh({...m,inclusive:le(G(c,"inclusive",f)),excludes:le(G(c,"excludes",f)),group:le(G(c,"group",f)),spanning:le(G(c,"spanning",f)),code:le(G(c,"code",f)),attrs:Object.fromEntries(d.map(w=>{var D,E;return[w.name,{default:(D=w?.attribute)==null?void 0:D.default,validate:(E=w?.attribute)==null?void 0:E.validate}]}))}),y=le(G(c,"parseHTML",f));y&&(g.parseDOM=y.map(w=>ah(w,d)));const v=G(c,"renderHTML",f);return v&&(g.toDOM=w=>v({mark:w,HTMLAttributes:Go(w,d)})),[c.name,g]}));return new sm({topNode:i,nodes:a,marks:l})}function sF(t){const e=t.filter((r,n)=>t.indexOf(r)!==n);return Array.from(new Set(e))}function $u(t){return t.sort((r,n)=>{const s=G(r,"priority")||100,o=G(n,"priority")||100;return s>o?-1:s<o?1:0})}function Sg(t){const e=$u(Pu(t)),r=sF(e.map(n=>n.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function Fg(t,e,r){const{from:n,to:s}=e,{blockSeparator:o=`
88
-
89
- `,textSerializers:i={}}=r||{};let a="";return t.nodesBetween(n,s,(l,c,d,f)=>{var m;l.isBlock&&c>n&&(a+=o);const g=i?.[l.type.name];if(g)return d&&(a+=g({node:l,pos:c,parent:d,index:f,range:e})),!1;l.isText&&(a+=(m=l?.text)==null?void 0:m.slice(Math.max(n,c)-c,s-c))}),a}function oF(t,e){const r={from:0,to:t.content.size};return Fg(t,r,e)}function Ag(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,r])=>[e,r.spec.toText]))}function iF(t,e){const r=Ce(e,t.schema),{from:n,to:s}=t.selection,o=[];t.doc.nodesBetween(n,s,a=>{o.push(a)});const i=o.reverse().find(a=>a.type.name===r.name);return i?{...i.attrs}:{}}function Ng(t,e){const r=qi(typeof e=="string"?e:e.name,t.schema);return r==="node"?iF(t,e):r==="mark"?Dg(t,e):{}}function aF(t,e=JSON.stringify){const r={};return t.filter(n=>{const s=e(n);return Object.prototype.hasOwnProperty.call(r,s)?!1:r[s]=!0})}function lF(t){const e=aF(t);return e.length===1?e:e.filter((r,n)=>!e.filter((o,i)=>i!==n).some(o=>r.oldRange.from>=o.oldRange.from&&r.oldRange.to<=o.oldRange.to&&r.newRange.from>=o.newRange.from&&r.newRange.to<=o.newRange.to))}function Tg(t){const{mapping:e,steps:r}=t,n=[];return e.maps.forEach((s,o)=>{const i=[];if(s.ranges.length)s.forEach((a,l)=>{i.push({from:a,to:l})});else{const{from:a,to:l}=r[o];if(a===void 0||l===void 0)return;i.push({from:a,to:l})}i.forEach(({from:a,to:l})=>{const c=e.slice(o).map(a,-1),d=e.slice(o).map(l),f=e.invert().map(c,-1),m=e.invert().map(d);n.push({oldRange:{from:f,to:m},newRange:{from:c,to:d}})})}),lF(n)}function Hu(t,e,r){const n=[];return t===e?r.resolve(t).marks().forEach(s=>{const o=r.resolve(t),i=Iu(o,s.type);i&&n.push({mark:s,...i})}):r.nodesBetween(t,e,(s,o)=>{!s||s?.nodeSize===void 0||n.push(...s.marks.map(i=>({from:o,to:o+s.nodeSize,mark:i})))}),n}var uF=(t,e,r,n=20)=>{const s=t.doc.resolve(r);let o=n,i=null;for(;o>0&&i===null;){const a=s.node(o);a?.type.name===e?i=a:o-=1}return[i,o]};function Wa(t,e){return e.nodes[t]||e.marks[t]||null}function jo(t,e,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{const s=t.find(o=>o.type===e&&o.name===n);return s?s.attribute.keepOnSplit:!1}))}var cF=(t,e=500)=>{let r="";const n=t.parentOffset;return t.parent.nodesBetween(Math.max(0,n-e),n,(s,o,i,a)=>{var l,c;const d=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:o,parent:i,index:a}))||s.textContent||"%leaf%";r+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,n-o))}),r};function jl(t,e,r={}){const{empty:n,ranges:s}=t.selection,o=e?tr(e,t.schema):null;if(n)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>Ko(f.attrs,r,{strict:!1}));let i=0;const a=[];if(s.forEach(({$from:f,$to:m})=>{const g=f.pos,y=m.pos;t.doc.nodesBetween(g,y,(v,w)=>{if(!v.isText&&!v.marks.length)return;const D=Math.max(g,w),E=Math.min(y,w+v.nodeSize),N=E-D;i+=N,a.push(...v.marks.map(A=>({mark:A,from:D,to:E})))})}),i===0)return!1;const l=a.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>Ko(f.mark.attrs,r,{strict:!1})).reduce((f,m)=>f+m.to-m.from,0),c=a.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,m)=>f+m.to-m.from,0);return(l>0?l+c:l)>=i}function dF(t,e,r={}){if(!e)return Cr(t,null,r)||jl(t,null,r);const n=qi(e,t.schema);return n==="node"?Cr(t,e,r):n==="mark"?jl(t,e,r):!1}var pF=(t,e)=>{const{$from:r,$to:n,$anchor:s}=t.selection;if(e){const o=Wi(a=>a.type.name===e)(t.selection);if(!o)return!1;const i=t.doc.resolve(o.pos+1);return s.pos+1===i.end()}return!(n.parentOffset<n.parent.nodeSize-2||r.pos!==n.pos)},hF=t=>{const{$from:e,$to:r}=t.selection;return!(e.parentOffset>0||e.pos!==r.pos)};function uh(t,e){return Array.isArray(e)?e.some(r=>(typeof r=="string"?r:r.name)===t.name):e}function ch(t,e){const{nodeExtensions:r}=Ls(e),n=r.find(i=>i.name===t);if(!n)return!1;const s={name:n.name,options:n.options,storage:n.storage},o=le(G(n,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function Ui(t,{checkChildren:e=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((n=t.text)!=null?n:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(o=>{s!==!1&&(Ui(o,{ignoreWhitespace:r,checkChildren:e})||(s=!1))}),s}return!1}function Mg(t){return t instanceof Y}function fF(t,e,r){var n;const{selection:s}=e;let o=null;if(yg(s)&&(o=s.$cursor),o){const a=(n=t.storedMarks)!=null?n:o.marks();return o.parent.type.allowsMarkType(r)&&(!!r.isInSet(a)||!a.some(c=>c.type.excludes(r)))}const{ranges:i}=s;return i.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(r):!1;return t.doc.nodesBetween(a.pos,l.pos,(d,f,m)=>{if(c)return!1;if(d.isInline){const g=!m||m.type.allowsMarkType(r),y=!!r.isInSet(d.marks)||!d.marks.some(v=>v.type.excludes(r));c=g&&y}return!c}),c})}var mF=(t,e={})=>({tr:r,state:n,dispatch:s})=>{const{selection:o}=r,{empty:i,ranges:a}=o,l=tr(t,n.schema);if(s)if(i){const c=Dg(n,l);r.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,f=c.$to.pos;n.doc.nodesBetween(d,f,(m,g)=>{const y=Math.max(g,d),v=Math.min(g+m.nodeSize,f);m.marks.find(D=>D.type===l)?m.marks.forEach(D=>{l===D.type&&r.addMark(y,v,l.create({...D.attrs,...e}))}):r.addMark(y,v,l.create(e))})});return fF(n,r,l)},gF=(t,e)=>({tr:r})=>(r.setMeta(t,e),!0),bF=(t,e={})=>({state:r,dispatch:n,chain:s})=>{const o=Ce(t,r.schema);let i;return r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:a})=>Ep(o,{...i,...e})(r)?!0:a.clearNodes()).command(({state:a})=>Ep(o,{...i,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},yF=t=>({tr:e,dispatch:r})=>{if(r){const{doc:n}=e,s=Vr(t,0,n.content.size),o=Y.create(n,s);e.setSelection(o)}return!0},xF=t=>({tr:e,dispatch:r})=>{if(r){const{doc:n}=e,{from:s,to:o}=typeof t=="number"?{from:t,to:t}:t,i=X.atStart(n).from,a=X.atEnd(n).to,l=Vr(s,i,a),c=Vr(o,i,a),d=X.create(n,l,c);e.setSelection(d)}return!0},vF=t=>({state:e,dispatch:r})=>{const n=Ce(t,e.schema);return yk(n)(e,r)};function dh(t,e){const r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(r){const n=r.filter(s=>e?.includes(s.type.name));t.tr.ensureMarks(n)}}var wF=({keepMarks:t=!0}={})=>({tr:e,state:r,dispatch:n,editor:s})=>{const{selection:o,doc:i}=e,{$from:a,$to:l}=o,c=s.extensionManager.attributes,d=jo(c,a.node().type.name,a.node().attrs);if(o instanceof Y&&o.node.isBlock)return!a.parentOffset||!Ut(i,a.pos)?!1:(n&&(t&&dh(r,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,m=a.depth===0?void 0:QS(a.node(-1).contentMatchAt(a.indexAfter(-1)));let g=f&&m?[{type:m,attrs:d}]:void 0,y=Ut(e.doc,e.mapping.map(a.pos),1,g);if(!g&&!y&&Ut(e.doc,e.mapping.map(a.pos),1,m?[{type:m}]:void 0)&&(y=!0,g=m?[{type:m,attrs:d}]:void 0),n){if(y&&(o instanceof X&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,g),m&&!f&&!a.parentOffset&&a.parent.type!==m)){const v=e.mapping.map(a.before()),w=e.doc.resolve(v);a.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(a.before()),m)}t&&dh(r,s.extensionManager.splittableMarks),e.scrollIntoView()}return y},DF=(t,e={})=>({tr:r,state:n,dispatch:s,editor:o})=>{var i;const a=Ce(t,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const f=l.node(-1);if(f.type!==a)return!1;const m=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let D=L.empty;const E=l.index(-1)?1:l.index(-2)?2:3;for(let $=l.depth-E;$>=l.depth-3;$-=1)D=L.from(l.node($).copy(D));const N=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,A={...jo(m,l.node().type.name,l.node().attrs),...e},T=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill(A))||void 0;D=D.append(L.from(a.createAndFill(null,T)||void 0));const j=l.before(l.depth-(E-1));r.replace(j,l.after(-N),new H(D,4-E,0));let B=-1;r.doc.nodesBetween(j,r.doc.content.size,($,O)=>{if(B>-1)return!1;$.isTextblock&&$.content.size===0&&(B=O+1)}),B>-1&&r.setSelection(X.near(r.doc.resolve(B))),r.scrollIntoView()}return!0}const g=c.pos===l.end()?f.contentMatchAt(0).defaultType:null,y={...jo(m,f.type.name,f.attrs),...e},v={...jo(m,l.node().type.name,l.node().attrs),...e};r.delete(l.pos,c.pos);const w=g?[{type:a,attrs:y},{type:g,attrs:v}]:[{type:a,attrs:y}];if(!Ut(r.doc,l.pos,2))return!1;if(s){const{selection:D,storedMarks:E}=n,{splittableMarks:N}=o.extensionManager,A=E||D.$to.parentOffset&&D.$from.marks();if(r.split(l.pos,2,w).scrollIntoView(),!A||!s)return!0;const T=A.filter(j=>N.includes(j.type.name));r.ensureMarks(T)}return!0},Ua=(t,e)=>{const r=Wi(i=>i.type===e)(t.selection);if(!r)return!0;const n=t.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0)return!0;const s=t.doc.nodeAt(n);return r.node.type===s?.type&&Sr(t.doc,r.pos)&&t.join(r.pos),!0},Ja=(t,e)=>{const r=Wi(i=>i.type===e)(t.selection);if(!r)return!0;const n=t.doc.resolve(r.start).after(r.depth);if(n===void 0)return!0;const s=t.doc.nodeAt(n);return r.node.type===s?.type&&Sr(t.doc,n)&&t.join(n),!0},CF=(t,e,r,n={})=>({editor:s,tr:o,state:i,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:f,splittableMarks:m}=s.extensionManager,g=Ce(t,i.schema),y=Ce(e,i.schema),{selection:v,storedMarks:w}=i,{$from:D,$to:E}=v,N=D.blockRange(E),A=w||v.$to.parentOffset&&v.$from.marks();if(!N)return!1;const T=Wi(j=>ch(j.type.name,f))(v);if(N.depth>=1&&T&&N.depth-T.depth<=1){if(T.node.type===g)return c.liftListItem(y);if(ch(T.node.type.name,f)&&g.validContent(T.node.content)&&a)return l().command(()=>(o.setNodeMarkup(T.pos,g),!0)).command(()=>Ua(o,g)).command(()=>Ja(o,g)).run()}return!r||!A||!a?l().command(()=>d().wrapInList(g,n)?!0:c.clearNodes()).wrapInList(g,n).command(()=>Ua(o,g)).command(()=>Ja(o,g)).run():l().command(()=>{const j=d().wrapInList(g,n),B=A.filter($=>m.includes($.type.name));return o.ensureMarks(B),j?!0:c.clearNodes()}).wrapInList(g,n).command(()=>Ua(o,g)).command(()=>Ja(o,g)).run()},kF=(t,e={},r={})=>({state:n,commands:s})=>{const{extendEmptyMarkRange:o=!1}=r,i=tr(t,n.schema);return jl(n,i,e)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,e)},EF=(t,e,r={})=>({state:n,commands:s})=>{const o=Ce(t,n.schema),i=Ce(e,n.schema),a=Cr(n,o,r);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?s.setNode(i,l):s.setNode(o,{...l,...r})},SF=(t,e={})=>({state:r,commands:n})=>{const s=Ce(t,r.schema);return Cr(r,s,e)?n.lift(s):n.wrapIn(s,e)},FF=()=>({state:t,dispatch:e})=>{const r=t.plugins;for(let n=0;n<r.length;n+=1){const s=r[n];let o;if(s.spec.isInputRules&&(o=s.getState(t))){if(e){const i=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)i.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=i.doc.resolve(o.from).marks();i.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else i.delete(o.from,o.to)}return!0}}return!1},AF=()=>({tr:t,dispatch:e})=>{const{selection:r}=t,{empty:n,ranges:s}=r;return n||e&&s.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},NF=(t,e={})=>({tr:r,state:n,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=r,l=tr(t,n.schema),{$from:c,empty:d,ranges:f}=a;if(!s)return!0;if(d&&i){let{from:m,to:g}=a;const y=(o=c.marks().find(w=>w.type===l))==null?void 0:o.attrs,v=Iu(c,l,y);v&&(m=v.from,g=v.to),r.removeMark(m,g,l)}else f.forEach(m=>{r.removeMark(m.$from.pos,m.$to.pos,l)});return r.removeStoredMark(l),!0},TF=(t,e={})=>({tr:r,state:n,dispatch:s})=>{let o=null,i=null;const a=qi(typeof t=="string"?t:t.name,n.schema);return a?(a==="node"&&(o=Ce(t,n.schema)),a==="mark"&&(i=tr(t,n.schema)),s&&r.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let f,m,g,y;r.selection.empty?n.doc.nodesBetween(c,d,(v,w)=>{o&&o===v.type&&(g=Math.max(w,c),y=Math.min(w+v.nodeSize,d),f=w,m=v)}):n.doc.nodesBetween(c,d,(v,w)=>{w<c&&o&&o===v.type&&(g=Math.max(w,c),y=Math.min(w+v.nodeSize,d),f=w,m=v),w>=c&&w<=d&&(o&&o===v.type&&r.setNodeMarkup(w,void 0,{...v.attrs,...e}),i&&v.marks.length&&v.marks.forEach(D=>{if(i===D.type){const E=Math.max(w,c),N=Math.min(w+v.nodeSize,d);r.addMark(E,N,i.create({...D.attrs,...e}))}}))}),m&&(f!==void 0&&r.setNodeMarkup(f,void 0,{...m.attrs,...e}),i&&m.marks.length&&m.marks.forEach(v=>{i===v.type&&r.addMark(g,y,i.create({...v.attrs,...e}))}))}),!0):!1},MF=(t,e={})=>({state:r,dispatch:n})=>{const s=Ce(t,r.schema);return dk(s,e)(r,n)},BF=(t,e={})=>({state:r,dispatch:n})=>{const s=Ce(t,r.schema);return pk(s,e)(r,n)},jF=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const r=this.callbacks[t];return r&&r.forEach(n=>n.apply(this,e)),this}off(t,e){const r=this.callbacks[t];return r&&(e?this.callbacks[t]=r.filter(n=>n!==e):delete this.callbacks[t]),this}once(t,e){const r=(...n)=>{this.off(t,r),e.apply(this,n)};return this.on(t,r)}removeAllListeners(){this.callbacks={}}},Ji=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},OF=(t,e)=>{if(_u(e))return e.exec(t);const r=e(t);if(!r)return null;const n=[r.text];return n.index=r.index,n.input=t,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n};function wo(t){var e;const{editor:r,from:n,to:s,text:o,rules:i,plugin:a}=t,{view:l}=r;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(m=>m.type.spec.code))return!1;let d=!1;const f=cF(c)+o;return i.forEach(m=>{if(d)return;const g=OF(f,m.find);if(!g)return;const y=l.state.tr,v=Hi({state:l.state,transaction:y}),w={from:n-(g[0].length-o.length),to:s},{commands:D,chain:E,can:N}=new Vi({editor:r,state:v});m.handler({state:v,range:w,match:g,commands:D,chain:E,can:N})===null||!y.steps.length||(m.undoable&&y.setMeta(a,{transform:y,from:n,to:s,text:o}),l.dispatch(y),d=!0)}),d}function LF(t){const{editor:e,rules:r}=t,n=new be({state:{init(){return null},apply(s,o,i){const a=s.getMeta(n);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=zu(L.from(d),i.schema);const{from:f}=l,m=f+d.length;wo({editor:e,from:f,to:m,text:d,rules:r,plugin:n})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,i,a){return wo({editor:e,from:o,to:i,text:a,rules:r,plugin:n})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&wo({editor:e,from:o.pos,to:o.pos,text:"",rules:r,plugin:n})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:i}=s.state.selection;return i?wo({editor:e,from:i.pos,to:i.pos,text:`
90
- `,rules:r,plugin:n}):!1}},isInputRules:!0});return n}function _F(t){return Object.prototype.toString.call(t).slice(8,-1)}function Do(t){return _F(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Bg(t,e){const r={...t};return Do(t)&&Do(e)&&Object.keys(e).forEach(n=>{Do(e[n])&&Do(t[n])?r[n]=Bg(t[n],e[n]):r[n]=e[n]}),r}var Vu=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{...le(G(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...le(G(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Bg(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}},Ar=class jg extends Vu{constructor(){super(...arguments),this.type="mark"}static create(e={}){const r=typeof e=="function"?e():e;return new jg(r)}static handleExit({editor:e,mark:r}){const{tr:n}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!!!i.find(c=>c?.type.name===r.name))return!1;const l=i.find(c=>c?.type.name===r.name);return l&&n.removeStoredMark(l),n.insertText(" ",s.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const r=typeof e=="function"?e():e;return super.extend(r)}};function IF(t){return typeof t=="number"}var RF=class{constructor(t){this.find=t.find,this.handler=t.handler}},PF=(t,e,r)=>{if(_u(e))return[...t.matchAll(e)];const n=e(t,r);return n?n.map(s=>{const o=[s.text];return o.index=s.index,o.input=t,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function zF(t){const{editor:e,state:r,from:n,to:s,rule:o,pasteEvent:i,dropEvent:a}=t,{commands:l,chain:c,can:d}=new Vi({editor:e,state:r}),f=[];return r.doc.nodesBetween(n,s,(g,y)=>{var v,w,D,E,N;if((w=(v=g.type)==null?void 0:v.spec)!=null&&w.code||!(g.isText||g.isTextblock||g.isInline))return;const A=(N=(E=(D=g.content)==null?void 0:D.size)!=null?E:g.nodeSize)!=null?N:0,T=Math.max(n,y),j=Math.min(s,y+A);if(T>=j)return;const B=g.isText?g.text||"":g.textBetween(T-y,j-y,void 0,"");PF(B,o.find,i).forEach(O=>{if(O.index===void 0)return;const z=T+O.index+1,I=z+O[0].length,q={from:r.tr.mapping.map(z),to:r.tr.mapping.map(I)},J=o.handler({state:r,range:q,match:O,commands:l,chain:c,can:d,pasteEvent:i,dropEvent:a});f.push(J)})}),f.every(g=>g!==null)}var Co=null,$F=t=>{var e;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=r.clipboardData)==null||e.setData("text/html",t),r};function HF(t){const{editor:e,rules:r}=t;let n=null,s=!1,o=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:f,to:m,rule:g,pasteEvt:y})=>{const v=d.tr,w=Hi({state:d,transaction:v});if(!(!zF({editor:e,state:w,from:Math.max(f-1,0),to:m.b-1,rule:g,pasteEvent:y,dropEvent:a})||!v.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return r.map(d=>new be({view(f){const m=y=>{var v;n=(v=f.dom.parentElement)!=null&&v.contains(y.target)?f.dom.parentElement:null,n&&(Co=e)},g=()=>{Co&&(Co=null)};return window.addEventListener("dragstart",m),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",m),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(f,m)=>{if(o=n===f.dom.parentElement,a=m,!o){const g=Co;g?.isEditable&&setTimeout(()=>{const y=g.state.selection;y&&g.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(f,m)=>{var g;const y=(g=m.clipboardData)==null?void 0:g.getData("text/html");return i=m,s=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(f,m,g)=>{const y=f[0],v=y.getMeta("uiEvent")==="paste"&&!s,w=y.getMeta("uiEvent")==="drop"&&!o,D=y.getMeta("applyPasteRules"),E=!!D;if(!v&&!w&&!E)return;if(E){let{text:T}=D;typeof T=="string"?T=T:T=zu(L.from(T),g.schema);const{from:j}=D,B=j+T.length,$=$F(T);return l({rule:d,state:g,from:j,to:{b:B},pasteEvt:$})}const N=m.doc.content.findDiffStart(g.doc.content),A=m.doc.content.findDiffEnd(g.doc.content);if(!(!IF(N)||!A||N===A.b))return l({rule:d,state:g,from:N,to:A,pasteEvt:i})}}))}var Ki=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Sg(t),this.schema=nF(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Wa(e.name,this.schema)},n=G(e,"addCommands",r);return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this;return $u([...this.extensions].reverse()).flatMap(n=>{const s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Wa(n.name,this.schema)},o=[],i=G(n,"addKeyboardShortcuts",s);let a={};if(n.type==="mark"&&G(n,"exitable",s)&&(a.ArrowRight=()=>Ar.handleExit({editor:t,mark:n})),i){const m=Object.fromEntries(Object.entries(i()).map(([g,y])=>[g,()=>y({editor:t})]));a={...a,...m}}const l=iS(a);o.push(l);const c=G(n,"addInputRules",s);if(uh(n,t.options.enableInputRules)&&c){const m=c();if(m&&m.length){const g=LF({editor:t,rules:m}),y=Array.isArray(g)?g:[g];o.push(...y)}}const d=G(n,"addPasteRules",s);if(uh(n,t.options.enablePasteRules)&&d){const m=d();if(m&&m.length){const g=HF({editor:t,rules:m});o.push(...g)}}const f=G(n,"addProseMirrorPlugins",s);if(f){const m=f();o.push(...m)}return o})}get attributes(){return Eg(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Ls(this.extensions);return Object.fromEntries(e.filter(r=>!!G(r,"addNodeView")).map(r=>{const n=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ce(r.name,this.schema)},o=G(r,"addNodeView",s);if(!o)return[];const i=(a,l,c,d,f)=>{const m=Go(a,n);return o()({node:a,view:l,getPos:c,decorations:d,innerDecorations:f,editor:t,extension:r,HTMLAttributes:m})};return[r.name,i]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Ls(this.extensions);return Object.fromEntries(e.filter(r=>!!G(r,"addMarkView")).map(r=>{const n=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:tr(r.name,this.schema)},o=G(r,"addMarkView",s);if(!o)return[];const i=(a,l,c)=>{const d=Go(a,n);return o()({mark:a,view:l,inline:c,editor:t,extension:r,HTMLAttributes:d,updateAttributes:f=>{rA(a,t,f)}})};return[r.name,i]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var r;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Wa(e.name,this.schema)};e.type==="mark"&&((r=le(G(e,"keepOnSplit",n)))==null||r)&&this.splittableMarks.push(e.name);const s=G(e,"onBeforeCreate",n),o=G(e,"onCreate",n),i=G(e,"onUpdate",n),a=G(e,"onSelectionUpdate",n),l=G(e,"onTransaction",n),c=G(e,"onFocus",n),d=G(e,"onBlur",n),f=G(e,"onDestroy",n);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),i&&this.editor.on("update",i),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Ki.resolve=Sg;Ki.sort=$u;Ki.flatten=Pu;var VF={};Lu(VF,{ClipboardTextSerializer:()=>Lg,Commands:()=>_g,Delete:()=>Ig,Drop:()=>Rg,Editable:()=>Pg,FocusEvents:()=>$g,Keymap:()=>Hg,Paste:()=>Vg,Tabindex:()=>qg,focusEventsPluginKey:()=>zg});var de=class Og extends Vu{constructor(){super(...arguments),this.type="extension"}static create(e={}){const r=typeof e=="function"?e():e;return new Og(r)}configure(e){return super.configure(e)}extend(e){const r=typeof e=="function"?e():e;return super.extend(r)}},Lg=de.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new be({key:new je("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:r}=t,{doc:n,selection:s}=e,{ranges:o}=s,i=Math.min(...o.map(d=>d.$from.pos)),a=Math.max(...o.map(d=>d.$to.pos)),l=Ag(r);return Fg(n,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),_g=de.create({name:"commands",addCommands(){return{...gg}}}),Ig=de.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var r,n,s;const o=()=>{var i,a,l,c;if((c=(l=(a=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const d=Cg(t.before,[t,...e]);Tg(d).forEach(g=>{d.mapping.mapResult(g.oldRange.from).deletedAfter&&d.mapping.mapResult(g.oldRange.to).deletedBefore&&d.before.nodesBetween(g.oldRange.from,g.oldRange.to,(y,v)=>{const w=v+y.nodeSize-2,D=g.oldRange.from<=v&&w<=g.oldRange.to;this.editor.emit("delete",{type:"node",node:y,from:v,to:w,newFrom:d.mapping.map(v),newTo:d.mapping.map(w),deletedRange:g.oldRange,newRange:g.newRange,partial:!D,editor:this.editor,transaction:t,combinedTransform:d})})});const m=d.mapping;d.steps.forEach((g,y)=>{var v,w;if(g instanceof Dt){const D=m.slice(y).map(g.from,-1),E=m.slice(y).map(g.to),N=m.invert().map(D,-1),A=m.invert().map(E),T=(v=d.doc.nodeAt(D-1))==null?void 0:v.marks.some(B=>B.eq(g.mark)),j=(w=d.doc.nodeAt(E))==null?void 0:w.marks.some(B=>B.eq(g.mark));this.editor.emit("delete",{type:"mark",mark:g.mark,from:g.from,to:g.to,deletedRange:{from:N,to:A},newRange:{from:D,to:E},partial:!!(j||T),editor:this.editor,transaction:t,combinedTransform:d})}})};(s=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.async)==null||s?setTimeout(o,0):o()}}),Rg=de.create({name:"drop",addProseMirrorPlugins(){return[new be({key:new je("tiptapDrop"),props:{handleDrop:(t,e,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:r,moved:n})}}})]}}),Pg=de.create({name:"editable",addProseMirrorPlugins(){return[new be({key:new je("editable"),props:{editable:()=>this.editor.options.editable}})]}}),zg=new je("focusEvents"),$g=de.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new be({key:zg,props:{handleDOMEvents:{focus:(e,r)=>{t.isFocused=!0;const n=t.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,r)=>{t.isFocused=!1;const n=t.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Hg=de.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:f}=l,{pos:m,parent:g}=f,y=f.parent.isTextblock&&m>0?a.doc.resolve(m-1):f,v=y.parent.type.spec.isolating,w=f.pos-f.parentOffset,D=v&&y.parent.childCount===1?w===f.pos:re.atStart(c).from===m;return!d||!g.type.isTextblock||g.textContent.length||!D||D&&f.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.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()},s={...n},o={...n,"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 Ru()||wg()?o:s},addProseMirrorPlugins(){return[new be({key:new je("clearDocument"),appendTransaction:(t,e,r)=>{if(t.some(v=>v.getMeta("composition")))return;const n=t.some(v=>v.docChanged)&&!e.doc.eq(r.doc),s=t.some(v=>v.getMeta("preventClearDocument"));if(!n||s)return;const{empty:o,from:i,to:a}=e.selection,l=re.atStart(e.doc).from,c=re.atEnd(e.doc).to;if(o||!(i===l&&a===c)||!Ui(r.doc))return;const m=r.tr,g=Hi({state:r,transaction:m}),{commands:y}=new Vi({editor:this.editor,state:g});if(y.clearNodes(),!!m.steps.length)return m}})]}}),Vg=de.create({name:"paste",addProseMirrorPlugins(){return[new be({key:new je("tiptapPaste"),props:{handlePaste:(t,e,r)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:r})}}})]}}),qg=de.create({name:"tabindex",addProseMirrorPlugins(){return[new be({key:new je("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),qF=class vn{constructor(e,r,n=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=r,this.currentNode=s}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 e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let r=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}r=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:r,to:n},e)}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(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),r=this.resolvedPos.doc.resolve(e);return new vn(r,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 vn(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 vn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((r,n)=>{const s=r.isBlock&&!r.isTextblock,o=r.isAtom&&!r.isText,i=this.pos+n+(o?0:1);if(i<0||i>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(i);if(!s&&a.depth<=this.depth)return;const l=new vn(a,this.editor,s,s?r:null);s&&(l.actualDepth=this.depth+1),e.push(new vn(a,this.editor,s,s?r:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,r={}){let n=null,s=this.parent;for(;s&&!n;){if(s.node.type.name===e)if(Object.keys(r).length>0){const o=s.node.attrs,i=Object.keys(r);for(let a=0;a<i.length;a+=1){const l=i[a];if(o[l]!==r[l])break}}else n=s;s=s.parent}return n}querySelector(e,r={}){return this.querySelectorAll(e,r,!0)[0]||null}querySelectorAll(e,r={},n=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(r);return this.children.forEach(i=>{n&&s.length>0||(i.node.type.name===e&&o.every(l=>r[l]===i.node.attrs[l])&&s.push(i),!(n&&s.length>0)&&(s=s.concat(i.querySelectorAll(e,r,n))))}),s}setAttribute(e){const{tr:r}=this.editor.state;r.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(r)}},WF=`.ProseMirror {
65
+ `).map(H=>H.trim()).filter(H=>H).join(`
66
+ `);l(L)}finally{w(!1)}}},[a]),E=F.useRef(null),S=F.useRef(!1),A=a!==c;F.useEffect(()=>{if(!S.current&&e&&r)try{const P=i(n());P&&P.trim()&&(l(P),d(P)),S.current=!0}catch(P){console.warn("Could not initialize code from canvas:",P)}},[e,r]);const T=F.useCallback(async()=>{if(a.trim()){m("processing"),y("");try{const P=o(a,{replace:!0});P&&P.includes("ROOT")&&s(P),m("success")}catch(P){console.error("Error applying code to canvas:",P),m("error"),y(P instanceof Error?P.message:"Unknown error occurred")}}},[a]),j=F.useCallback(P=>{l(P),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{P.trim()?T():m("idle")},1e3)},[T]),B=F.useCallback(()=>{d(a),m("success");try{localStorage.setItem("editor_saved_code",a)}catch(P){console.warn("Could not save to localStorage:",P)}},[a]),$=F.useCallback(()=>{l(c),m("idle"),y(""),E.current&&clearTimeout(E.current)},[c]),O=F.useCallback(()=>{E.current&&clearTimeout(E.current),m("idle"),y("")},[]);return F.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]),{codeValue:a,savedCodeValue:c,conversionStatus:f,hasUnsavedChanges:A,errorMessage:g,isFormattingCode:x,handleCodeChange:j,handleSave:B,handleRevert:$,handleClose:O,applyCodeToCanvas:T,formatCode:D}}const KD={loading:!1,error:null,template:{}},Vf=F.createContext(KD),JD=({variant:t="primary",loading:e=!1,children:r,disabled:n,className:s="",...o})=>{const i=t==="primary",a=n||e;return h.jsx("button",{...o,disabled:a,className:`rounded-none border px-4 py-2 text-sm font-medium transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-60 ${i?"bg-[#170F4F] hover:bg-[#009CA8] text-white border-[#170F4F]":"bg-white hover:bg-[#F5F5F7] text-[#170F4F] border-[#E8E7EE]"} ${s}`,children:e?"Loading...":r})},GD=({isOpen:t,title:e,onClose:r,children:n,footer:s,showCloseButton:o=!0})=>t?h.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50",onClick:r,children:h.jsxs("div",{className:"w-[90%] max-w-md rounded-none bg-white shadow-lg",onClick:i=>i.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between border-b border-[#e8e7ee] px-6 py-4",children:[h.jsx("h2",{className:"text-lg font-semibold text-[#170f4f]",children:e}),o&&r&&h.jsx("button",{onClick:r,className:"flex h-8 w-8 items-center justify-center rounded-none text-2xl text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700",children:"×"})]}),h.jsx("div",{className:"px-6 py-4",children:n}),s&&h.jsx("div",{className:"flex justify-end gap-3 border-t border-[#e8e7ee] px-6 py-4",children:s})]})}):null,YD=({templateId:t,baseUrl:e,workspace:r,children:n})=>{const[s,o]=F.useState(!1),[i,a]=F.useState(null),[l,c]=F.useState({}),[d,f]=F.useState(!1),[m,g]=F.useState(zr.TemplateFormat.HTML),y=F.useMemo(()=>(e||console.warn("[TemplateProvider] baseUrl was not provided"),r||console.warn("[TemplateProvider] workspace was not provided"),new zr.TemplatingSdk(e,{workspace:r,mode:"editor"})),[e,r]),x=F.useCallback(async A=>{if(A)try{o(!0),a(null);const T=await y.get(A);T?(T.format||(console.warn("[TemplateProvider] Template format is missing. User must select a format."),f(!0)),c(T)):a(`Template with ID "${A}" not found`)}catch(T){const j=T instanceof Error?T.message:"Failed to load template";a(j),console.error("[TemplateProvider] Error loading template:",T)}finally{o(!1)}},[y]),w=F.useCallback(A=>c(T=>T?.update?.(A)),[c]),D=F.useCallback(async()=>{if(!l?.id){console.warn("No template loaded to save");return}try{const A=await l.save();c(A)}catch(A){console.error("Error saving template:",A)}},[l]),E=F.useCallback(async()=>{if(l?.id)try{o(!0);const A=await l.setFormat(m);c(A),f(!1)}catch(A){console.error("Error saving template format:",A),a("Failed to save template format")}finally{o(!1)}},[l,m]);F.useEffect(()=>{t&&x(t)},[t,x]);const S=F.useMemo(()=>({loading:s,error:i,template:l,loadTemplate:x,updateTemplate:w,saveTemplate:D}),[s,i,l,x,w,D]);return h.jsxs(Vf.Provider,{value:S,children:[n,h.jsxs(GD,{isOpen:d,title:"Template Format Required",showCloseButton:!1,footer:h.jsx(JD,{variant:"primary",onClick:E,disabled:s,loading:s,children:"Save Format"}),children:[h.jsx("p",{className:"mb-5 text-sm text-gray-600",children:"This template is missing a format. Please select a format to continue editing."}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"format-select",className:"mb-2 block text-sm font-medium text-[#170f4f]",children:"Select Format"}),h.jsx(Tt,{options:[{value:zr.TemplateFormat.HTML,label:"HTML"},{value:zr.TemplateFormat.PDF,label:"PDF"}],value:m,onChange:A=>g(A),placeholder:"Choose a format"})]})]})]})};function $n(){const t=F.useContext(Vf);if(!t)throw new Error("useTemplate must be used within a TemplateProvider");return t}function ZD({containerWidth:t=0,containerHeight:e=0,contentWidth:r=0,contentHeight:n=0}={}){const[s,o]=F.useState(100),[i,a]=F.useState({x:0,y:0}),c=F.useCallback(x=>{if(!t||!r||!e)return 1;const w=.01,D=t*(1-w*2),E=e*(1-w*2),S=D/r,A=E/n,T=Math.min(S,A);return x==="fit"||x===100?T:T*(x/100)},[t,e,r,n])(s);F.useEffect(()=>{(s==="fit"||s===100)&&a({x:0,y:0})},[s]),F.useEffect(()=>{a({x:0,y:0})},[r,n]);const d=F.useCallback(()=>{const D=(s==="fit"?100:s)*1.07,E=Math.min(Math.round(D*10)/10,400);o(E)},[s]),f=F.useCallback(()=>{const D=(s==="fit"?100:s)/1.07,E=Math.max(Math.round(D*10)/10,10);o(E)},[s]),m=F.useCallback(x=>{o(x)},[]),g=F.useCallback(x=>{const w=Math.max(10,Math.min(400,x));o(w)},[]),y=F.useCallback(()=>{o(100)},[]);return{zoom:s,scale:c,panOffset:i,setPanOffset:a,zoomIn:d,zoomOut:f,setZoomLevel:m,setZoomToLevel:g,resetZoom:y,canZoomIn:typeof s=="number"&&s<400,canZoomOut:typeof s=="number"&&s>10}}const br={THROTTLE_MS:50,BASE_FACTOR:1.07,MAC_GESTURE_BOOST:1.7,MAC_GESTURE_THRESHOLD:10,SCROLL_AMOUNT:100,MIN_ZOOM:10,MAX_ZOOM:400},XD=t=>Math.abs(t)<br.MAC_GESTURE_THRESHOLD,qf=t=>t?Math.pow(br.BASE_FACTOR,br.MAC_GESTURE_BOOST):br.BASE_FACTOR,Wf=t=>t==="fit"?100:t,Uf=t=>Math.max(br.MIN_ZOOM,Math.min(br.MAX_ZOOM,Math.round(t*10)/10)),QD=(t,e)=>{const r=Wf(t),n=qf(e);return Uf(r*n)},eC=(t,e)=>{const r=Wf(t),n=qf(e);return Uf(r/n)},tC=(t,e,r)=>{const n=(e-t.clientWidth)/2,s=(r-t.clientHeight)/2;t.scrollLeft=Math.max(0,n),t.scrollTop=Math.max(0,s)},rC=(t,e)=>{const{SCROLL_AMOUNT:r}=br;switch(t){case"ArrowUp":return e.scrollTop-=r,!0;case"ArrowDown":return e.scrollTop+=r,!0;case"ArrowLeft":return e.scrollLeft-=r,!0;case"ArrowRight":return e.scrollLeft+=r,!0;default:return!1}};function nC({scale:t,zoom:e,panOffset:r,onPanOffsetChange:n,onZoomToLevel:s,containerRef:o}){const[i,a]=F.useState(!1),[l,c]=F.useState({x:0,y:0}),d=F.useRef(0),f=F.useCallback(x=>{t>1&&x.button===0&&x.target===o.current&&(a(!0),c({x:x.clientX-r.x,y:x.clientY-r.y}),x.preventDefault())},[t,r,o]),m=F.useCallback(x=>{if(i&&n){const w={x:x.clientX-l.x,y:x.clientY-l.y};n(w)}},[i,l,n]),g=F.useCallback(()=>{a(!1)},[]),y=F.useCallback(x=>{if(!x.ctrlKey&&!x.metaKey)return;x.preventDefault();const w=Date.now();if(w-d.current<br.THROTTLE_MS||(d.current=w,!s))return;const D=x.deltaY,E=XD(D);if(D<0){const S=QD(e,E);s(S)}else if(D>0){const S=eC(e,E);s(S)}},[e,s]);return F.useEffect(()=>{const x=o.current;if(!x)return;const w=D=>{if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(D.key)||t===1)return;rC(D.key,x)&&D.preventDefault()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[t,o]),F.useEffect(()=>{const x=o.current;if(x)return x.addEventListener("wheel",y,{passive:!1}),()=>x.removeEventListener("wheel",y)},[y,o]),{isDragging:i,handleMouseDown:f,handleMouseMove:m,handleMouseUp:g}}const sC=({onClose:t,onFormat:e,onSave:r,isFormattingCode:n,codeValue:s,hasUnsavedChanges:o,conversionStatus:i})=>h.jsxs("div",{className:"flex items-center justify-between border-b border-gray-700 bg-[#23272f] px-4 py-2",children:[h.jsxs("div",{className:"flex items-center space-x-3",children:[h.jsx("div",{className:"group relative",children:h.jsx("button",{className:"rounded p-1 text-gray-400 transition-colors duration-200 hover:text-white",onClick:t,"aria-label":"Close Code Panel",children:h.jsx(I.FiX,{size:18})})}),h.jsx("span",{className:"text-base font-semibold text-white",children:"Code Editor"}),h.jsxs("div",{className:"flex items-center space-x-2",children:[h.jsx("div",{className:`h-2 w-2 rounded-full ${o?"bg-yellow-500":"bg-green-500"}`}),h.jsx("span",{className:`text-xs font-medium ${o?"text-yellow-400":"text-green-400"}`,children:o?"Unsaved":"Saved"})]})]}),h.jsxs("div",{className:"flex items-center space-x-2",children:[h.jsxs("div",{className:"group relative",children:[h.jsx("button",{onClick:e,disabled:n||!s.trim(),className:"rounded p-1 text-gray-400 transition-colors duration-200 hover:text-white disabled:cursor-not-allowed disabled:text-gray-600","aria-label":"Format HTML",children:n?h.jsx(I.FiLoader,{size:18,className:"animate-spin"}):h.jsx(I.FiFileText,{size:18})}),h.jsx("span",{className:"absolute bottom-full left-1/2 z-10 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded bg-gray-900 px-2 py-1 text-xs text-white opacity-0 transition-opacity duration-200 group-hover:opacity-100",children:n?"Formatting HTML...":"Format HTML"})]}),h.jsxs("div",{className:"group relative",children:[h.jsx("button",{onClick:r,disabled:i==="processing"||!o,className:"rounded p-1 text-gray-400 transition-colors duration-200 hover:text-white disabled:cursor-not-allowed disabled:text-gray-600","aria-label":"Save HTML",children:h.jsx(I.FiSave,{size:18})}),h.jsx("span",{className:"absolute bottom-full left-1/2 z-10 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded bg-gray-900 px-2 py-1 text-xs text-white opacity-0 transition-opacity duration-200 group-hover:opacity-100",children:"Save"})]})]})]});function oC({height:t="100%",defaultLanguage:e="html",theme:r="vs-dark",value:n,onChange:s,options:o}){const i=F.useRef(null),[a,l]=F.useState(null);return F.useEffect(()=>{const c=document.createElement("div");return c.style.position="fixed",c.style.top="0",c.style.left="0",c.style.width="100%",c.style.height="100%",c.style.pointerEvents="none",c.style.zIndex="9999",document.body.appendChild(c),l(c),()=>{c.parentNode&&c.parentNode.removeChild(c)}},[]),F.useEffect(()=>{if(!i.current||!a)return;const c=()=>{if(!i.current||!a)return;const m=i.current.getBoundingClientRect(),g=a.firstChild;g&&(g.style.position="absolute",g.style.top=`${m.top}px`,g.style.left=`${m.left}px`,g.style.width=`${m.width}px`,g.style.height=`${m.height}px`,g.style.pointerEvents="auto")};c();const d=()=>{requestAnimationFrame(c)};window.addEventListener("resize",d),window.addEventListener("scroll",d,!0);let f;return window.ResizeObserver&&(f=new ResizeObserver(d),f.observe(i.current)),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0),f&&f.disconnect()}},[a]),h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:i,style:{width:"100%",height:t}}),a&&Ni.createPortal(h.jsx("div",{style:{backgroundColor:"#1e1e1e"},children:h.jsx(G2.default,{height:t,defaultLanguage:e,theme:r,value:n,onChange:s,options:o})}),a)]})}function iC({onClose:t}){const{codeValue:e,conversionStatus:r,hasUnsavedChanges:n,handleCodeChange:s,handleSave:o,handleClose:i,formatCode:a,isFormattingCode:l}=UD();return h.jsxs("div",{className:"flex h-full w-1/2 flex-col border-r border-gray-200 bg-[#181c24]",children:[h.jsx(sC,{onClose:()=>{i(),t()},onFormat:a,onSave:o,isFormattingCode:l,codeValue:e,hasUnsavedChanges:n,conversionStatus:r}),h.jsx("div",{className:"flex-1 p-0",style:{width:"100%",height:"100%"},children:h.jsx(oC,{height:"100%",defaultLanguage:"html",theme:"vs-dark",value:e,onChange:c=>s(c||""),options:{fontSize:16,padding:{top:10},minimap:{enabled:!1},wordWrap:"on",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,autoIndent:"full",tabSize:2,insertSpaces:!0,automaticLayout:!0,folding:!0,lineNumbers:"on",renderWhitespace:"selection",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},suggest:{showKeywords:!0,showSnippets:!0}}})})]})}const aC=({templateId:t,errorMessage:e,onContinue:r,onGoBack:n})=>h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",children:h.jsxs("div",{className:"flex w-full max-w-lg flex-col rounded-none bg-white shadow-xl",children:[h.jsx("div",{className:"border-b border-border bg-white px-6 py-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-red-50",children:h.jsx(I.FiAlertTriangle,{className:"text-red-600",size:20})}),h.jsx("h2",{className:"text-lg font-bold text-primary",children:"Template Not Found"})]})}),h.jsxs("div",{className:"px-6 py-5",children:[t&&h.jsx("div",{className:"mb-4 rounded-none border border-border bg-background-light px-4 py-3",children:h.jsxs("p",{className:"text-sm text-muted",children:["Template ID:"," ",h.jsx("span",{className:"font-medium text-text",children:t})]})}),h.jsx("p",{className:"mb-5 text-sm leading-relaxed text-text",children:e}),h.jsx("div",{className:"rounded-none border border-red-200 bg-red-50 px-4 py-3",children:h.jsxs("div",{className:"flex gap-2",children:[h.jsx(I.FiAlertTriangle,{className:"mt-0.5 flex-shrink-0 text-red-600",size:16}),h.jsxs("p",{className:"text-sm leading-relaxed text-red-800",children:[h.jsx("strong",{children:"Warning:"})," Any changes made will not be saved, as the template was not found."]})]})})]}),h.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-border px-6 py-4",children:[h.jsx("button",{onClick:n,className:"rounded-none border border-border bg-background-light px-4 py-2 text-sm font-medium text-text transition-colors duration-200 hover:bg-surface",children:"Go Back"}),h.jsx("button",{onClick:r,className:"rounded-none bg-primary px-4 py-2 text-sm font-medium text-white transition-colors duration-200 hover:bg-secondary",children:"Continue Anyway"})]})]})}),zo={mobile:{width:375,height:667},tablet:{width:768,height:1024},desktop:{width:1200,height:800}};function lC(){return h.jsx("div",{className:"pointer-events-none flex items-center justify-center",children:h.jsxs("div",{className:"mx-auto p-6 text-center",children:[h.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center border border-[#170F4F] bg-[#E8E7EE]",children:h.jsx("span",{className:"text-2xl text-[#170F4F]",children:"📄"})}),h.jsx("h3",{className:"mb-2 text-lg font-medium text-[#170F4F]",children:"Start building your page"}),h.jsx("p",{className:"text-sm text-[#A29FB9]",children:"Drag components from the sidebar to create your page layout."})]})})}function vu({className:t,children:e,device:r="desktop",style:n,...s}){const{connectors:{connect:o},isHover:i,isSelected:a}=Q.useNode(x=>({hasChildren:x.data.nodes.length>0,isHover:x.events.hovered,isSelected:x.events.selected})),l=i&&!a,c=a,d=l||c,f=zo?.[r]||zo.desktop,m={backgroundColor:"white",minHeight:f.height,minWidth:f.width,boxShadow:"0 2px 8px rgba(23,15,79,0.1)",maxWidth:f.width,transition:"max-width 0.3s ease-in-out, min-width 0.3s ease-in-out",outline:c?"1px solid rgba(23,15,79,0.3)":l?"1px dashed rgba(0,186,199,0.3)":"none",outlineOffset:"-1px",...n},g=n&&Object.keys(n).length>0,y=!e&&!g;return h.jsxs("div",{id:"bte-canvas-template",className:[t,"relative",e?"":"flex h-full flex-1 items-center justify-center"].filter(Boolean).join(" "),ref:x=>{x&&o(x)},style:m,...s,children:[d&&h.jsxs("div",{className:`absolute left-0 top-0 flex items-center gap-1.5 px-2 py-1 text-xs font-medium backdrop-blur-sm ${c?"border border-[#170F4F]/60 bg-[#170F4F]/90 text-white shadow-md":"border border-[#00BAC7]/60 bg-[#00BAC7]/90 text-white shadow-sm"}`,style:{borderRadius:"4px",transform:"translateY(-100%)",transformOrigin:"left bottom",marginTop:"-2px",zIndex:100,transition:"all 0.15s ease-out",pointerEvents:"none"},children:[h.jsx("div",{className:"flex h-3 w-3 items-center justify-center",children:c?h.jsx("div",{className:"h-2 w-2 rounded-full bg-white"}):h.jsx("div",{className:"h-2 w-2 rounded-full bg-white opacity-70"})}),h.jsx("span",{className:"select-none whitespace-nowrap leading-none",children:"Template"})]}),e||y&&h.jsx(lC,{})]})}vu.craft=No;const uC={},cC=(t,e)=>({onDeleteNode:()=>{const r=e.getEvent("selected").last();r&&t.delete(r)},onCopy:()=>{const r=e.getEvent("selected").last();if(!r){console.warn("[Copy] No node selected");return}try{const n=e.node(r).toNodeTree();console.log("[Copy] Node tree:",n);const s={type:"craftjs-copy",nodeTree:n,selectedId:r,timestamp:Date.now()};console.log("[Copy] Copy data:",s);const o=JSON.stringify(s,(i,a)=>{if(!["dom","rules","_hydrationTimestamp","events"].includes(i))return i==="type"&&typeof a=="function"?{resolvedName:a.name||a.displayName||"Unknown"}:a});navigator.clipboard.writeText(o),console.log("[Copy] Successfully copied to clipboard")}catch(n){console.error("[Copy] Failed to copy node:",n)}},onPaste:async()=>{console.log("[Paste] Starting paste operation...");try{const r=await navigator.clipboard.readText();if(console.log("[Paste] Clipboard text:",r),!r){console.warn("[Paste] Clipboard is empty");return}let n;try{n=JSON.parse(r),console.log("[Paste] Parsed clipboard data:",n)}catch(f){console.warn("[Paste] Invalid clipboard data:",f);return}if(!n||n.type!=="craftjs-copy"||!n.nodeTree){console.warn("[Paste] Clipboard does not contain valid node data");return}const s=n.nodeTree;console.log("[Paste] Node tree to paste:",s);const i=(f=>{const m={...f},g={},y=()=>Math.random().toString(36).substring(2,15);if(m.nodes&&(Object.keys(m.nodes).forEach(x=>{g[x]=y()}),m.rootNodeId&&g[m.rootNodeId]&&(m.rootNodeId=g[m.rootNodeId])),m.nodes){const x={};Object.keys(m.nodes).forEach(w=>{const D={...m.nodes[w]},E=g[w];if(D.id=E,D.events=D.events||{selected:!1,dragged:!1,hovered:!1},D.dom=null,D.rules=D.rules||{canDrag:()=>!0,canDrop:()=>!0,canMoveIn:()=>!0,canMoveOut:()=>!0},D.data){if(D.data.props=D.data.props||{},D.data.custom=D.data.custom||{},D.data.hidden=D.data.hidden||!1,D.data.isCanvas=D.data.isCanvas||!1,D.data.nodes=D.data.nodes||[],D.data.linkedNodes=D.data.linkedNodes||{},D.data.displayName=D.data.displayName||D.data.type?.displayName||"Component",D.data.parent&&g[D.data.parent]&&(D.data.parent=g[D.data.parent]),D.data.nodes&&Array.isArray(D.data.nodes)&&(D.data.nodes=D.data.nodes.map(S=>g[S]||S)),D.data.linkedNodes){const S={};Object.keys(D.data.linkedNodes).forEach(A=>{const T=D.data.linkedNodes[A];S[A]=g[T]||T}),D.data.linkedNodes=S}if(D.data.type&&typeof D.data.type=="object"&&D.data.type.resolvedName){const S=Pn.find(A=>{const T=typeof A.component=="function"?A.component.name||A.component.displayName:"";return A.id===D.data.type.resolvedName||T===D.data.type.resolvedName});S?(D.data.type=S.component,console.log("[Paste] Resolved component:",D.data.type.resolvedName,"to",S.component)):console.warn("[Paste] Could not resolve component:",D.data.type.resolvedName)}}x[E]=D}),m.nodes=x}return m})(s);console.log("[Paste] Reconstructed node tree:",i);const a=e.getEvent("selected").last();let l="ROOT",c;if(a){const f=e.node(a).get();if(console.log("[Paste] Selected node data:",f),f.data.isCanvas)l=a,c=(f.data.nodes||[]).length,console.log("[Paste] Inserting as child of canvas node:",a,"at index:",c);else{const m=f.data.parent;m?(l=m,c=e.node(l).get().data.nodes.indexOf(a)+1,console.log("[Paste] Inserting after selected node in parent:",l,"at index:",c)):(l="ROOT",c=e.node("ROOT").get().data.nodes.indexOf(a)+1,console.log("[Paste] Inserting after selected node in ROOT at index:",c))}}else c=e.node("ROOT").get().data.nodes.length,console.log("[Paste] No selection, adding to end of ROOT at index:",c);console.log("[Paste] Will insert at parent:",l,"index:",c),console.log("[Paste] Using addNodeTree with reconstructed nodeTree:",i),t.addNodeTree(i,l,c);const d=i.rootNodeId;d&&(console.log("[Paste] Selecting newly pasted node:",d),t.selectNode(d)),console.log("[Paste] Node pasted successfully")}catch(r){console.error("[Paste] Failed to paste:",r),r instanceof Error&&console.error("[Paste] Error stack:",r.stack)}},onUndo:()=>t.history.undo(),onRedo:()=>t.history.redo(),onSave:()=>{const r=e.serialize();console.log("Saving JSON:",r)}});function dC(){const{actions:t,query:e}=Q.useEditor(),r=s=>s.toLowerCase().charAt(0).toUpperCase()+s.toLowerCase().slice(1),n=s=>s.includes("_")?`on${s.split("_").map(r).join("")}`:`on${r(s)}`;F.useEffect(()=>{const s=cC(t,e),o=i=>{const a=navigator.platform.includes("Mac"),l=[];(a&&i.metaKey||!a&&i.ctrlKey)&&l.push(a?"Meta":"Ctrl"),i.shiftKey&&l.push("Shift"),l.push(i.key);const c=l.join("+");Object.entries(uC).forEach(([d,f])=>{if(f.keys.includes(c)){i.preventDefault();const m=s[n(d)];console.log("Executing shortcut:",d,n(d)),m?.()}})};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,e])}const pC=({name:t,displayName:e})=>{const r=n=>Pn.find(o=>{const i=o.label.toLowerCase(),a=n.toLowerCase();return i===a})?.icon||t.charAt(0).toUpperCase();return h.jsx("div",{className:"border-b border-[#e8e7ee] bg-gray-50 p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded bg-[#170f4f]",children:h.jsx("span",{className:"text-xs font-medium text-white",children:r(t)})}),h.jsx("div",{className:"flex-1",children:h.jsx("h3",{className:"text-sm font-medium text-[#170f4f]",children:e})})]})})};function hC(){const{selected:t,nodes:e,actions:r,query:n}=Q.useEditor(S=>({selected:S.events.selected,nodes:S.nodes})),s=Array.from(t)[0],o=()=>{if(t&&t.size>0){const S=Array.from(t)[0];r.delete(S)}},i=S=>({data:{type:S.type,props:{...S.props},custom:{...S.custom}}}),a=()=>{if(!s)return;const S=n.node(s).get(),A=n.node(s).ancestors()[0];if(!A)return;const B=n.node(A).get().data.nodes.indexOf(s);if(B===-1)return;const $=i(S.data),O=n.parseFreshNode($).toNode();r.add(O,A,B+1)},l=()=>{if(!s)return;const S=n.node(s).ancestors()[0],A=n.node(s).toNodeTree();if(!S)return;const B=n.node(S).get().data.nodes.indexOf(s);if(B===-1)return;const $=Object.values(A.nodes).map(({data:P,id:L})=>{const H=i(P),Y=n.node(L).ancestors()[0],q=n.parseFreshNode(H).toNode();return{newNode:q,exId:L,exParentId:Y,newId:q.id}});let O=0;$.forEach(({newNode:P,exParentId:L})=>{const H=$.filter(Y=>Y.exId===L)?.[0];H?(r.add(P,H.newId,O),O++):r.add(P,S,B+1)})},c=()=>{if(!s)return;const S=n.node(s).ancestors()[0];if(!S)return;const j=n.node(S).get().data.nodes.indexOf(s);if(j>0){const B=j-1;r.move(s,S,B)}},d=()=>{if(!s)return;const S=n.node(s).ancestors()[0];if(!S)return;const T=n.node(S).get().data.nodes,j=T.indexOf(s);if(j!==-1&&j<T.length-1){const B=j+2;r.move(s,S,B)}},f=()=>{if(s){const S=Array.from(t)[0];r.setHidden(S,!e[S].data.hidden)}};F.useEffect(()=>{const S=A=>{if(t&&t.size>0){const T=A.target;!(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.contentEditable==="true")&&(A.key==="Backspace"||A.key==="Delete")&&(A.preventDefault(),o())}};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[t]);const g=(()=>{if(!t||t.size===0)return null;const S=Array.from(t)[0],A=n.node(S).get();return A?{id:S,type:A.data.type,displayName:A.data.displayName||String(A.data.type),props:A.data.props,isCanvas:A.data.isCanvas,isDeletable:!0,isDuplicateable:!0,parent:A.data.parent}:null})();if(!g)return null;const y=n.node(s).ancestors()[0]||"ROOT",x=n.node(y).get(),D=x.data.nodes.indexOf(s),E=x.data.nodes.length-1;return h.jsxs("div",{className:"space-y-3 p-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("button",{onClick:a,disabled:!g.isDuplicateable,className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",children:[h.jsx(I.FiCopy,{size:14}),"Duplicate"]}),h.jsxs("button",{onClick:o,disabled:!g.isDeletable,className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:border-red-300 hover:bg-red-50 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-50",children:[h.jsx(I.FiTrash2,{size:14}),"Delete"]})]}),h.jsx("div",{className:"grid",children:h.jsxs("button",{onClick:l,className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50",children:[h.jsx(I.FiCopy,{size:14}),"Duplicate with children"]})}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("button",{disabled:D===0,onClick:c,className:`flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50 ${D===0?"cursor-not-allowed opacity-50 hover:bg-white":""}`,children:[h.jsx(I.FiArrowUp,{size:14}),"Move Up"]}),h.jsxs("button",{disabled:D>=E,onClick:d,className:`flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50 ${D>=E?"cursor-not-allowed opacity-50 hover:bg-white":""}`,children:[h.jsx(I.FiArrowDown,{size:14}),"Move Down"]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("button",{className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50",children:[h.jsx(I.FiLock,{size:14}),"Lock"]}),h.jsx("button",{onClick:f,className:"flex items-center justify-center gap-2 border border-[#e8e7ee] bg-white px-3 py-2 text-xs font-medium transition-colors duration-200 hover:bg-gray-50",children:e[s].data.hidden?h.jsxs(h.Fragment,{children:[h.jsx(I.FiEye,{size:14}),"Show"]}):h.jsxs(h.Fragment,{children:[h.jsx(I.FiEyeOff,{size:14}),"Hide"]})})]})]})}function fC(){const{selected:t,query:e}=Q.useEditor(c=>({selected:c.events.selected})),[r,n]=F.useState(""),s=F.useRef(null),o=()=>{if(s.current){const c=s.current.textContent||"";navigator.clipboard.writeText(c).then(()=>{console.log("HTML copied to clipboard")})}},i=c=>{try{const d=e.node(c).get();return d&&d.dom?d.dom.outerHTML.replace(/data-cy="[^"]*"/g,"").replace(/data-craft-id="[^"]*"/g,"").replace(/data-node-id="[^"]*"/g,"").replace(/class="[^"]*craft[^"]*"/g,'class=""').replace(/class="[^"]*ring-[^"]*"/g,'class=""').replace(/class="[^"]*hover:[^"]*"/g,'class=""').replace(/class="[^"]*transition-[^"]*"/g,'class=""').replace(/class="[^"]*duration-[^"]*"/g,'class=""').replace(/class="[^"]*opacity-[^"]*"/g,'class=""').replace(/class="[^"]*cursor-[^"]*"/g,'class=""').replace(/class="[^"]*min-h-screen[^"]*"/g,'class=""').replace(/class="[^"]*bg-white[^"]*"/g,'class=""').replace(/class=""/g,"").replace(/\s+/g," ").trim()||"<!-- No HTML available -->":"<!-- Component not found in DOM -->"}catch(d){return console.error("Error getting component HTML:",d),"<!-- Error getting component HTML -->"}};F.useEffect(()=>{if(t&&t.size>0){const c=Array.from(t)[0];if(e.node(c).get()){const f=i(c);n(f)}}else n("")},[t,e]);const l=(()=>{if(!t||t.size===0)return null;const c=Array.from(t)[0],d=e.node(c).get();return d?{id:c,type:d.data.type,displayName:d.data.displayName||String(d.data.type),props:d.data.props,isCanvas:d.data.isCanvas,isDeletable:!0,isDuplicateable:!0,parent:d.data.parent}:null})();return l?h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-700",children:"Component ID"}),h.jsx("input",{type:"text",value:l.id,readOnly:!0,className:"w-full rounded-none border border-[#e8e7ee] bg-gray-50 px-3 py-2 text-xs focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-700",children:"Component Parent"}),h.jsx("input",{type:"text",value:String(l.parent),readOnly:!0,className:"w-full rounded-none border border-[#e8e7ee] bg-gray-50 px-3 py-2 text-xs focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-700",children:"Properties"}),h.jsx("div",{className:"rounded-none border border-[#e8e7ee] bg-gray-50 p-3",children:h.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-600",children:JSON.stringify(l?.props,null,2)})})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[h.jsx("label",{className:"block text-xs font-medium text-gray-700",children:"Component HTML"}),h.jsx("button",{onClick:o,className:"rounded-none p-1 text-gray-400 transition-colors duration-200 hover:bg-gray-100 hover:text-gray-600",title:"Copy HTML to clipboard",children:h.jsx(I.FiClipboard,{size:14})})]}),h.jsx("div",{className:"rounded-none border border-[#e8e7ee] bg-gray-50 p-3",children:h.jsx("pre",{ref:s,className:"whitespace-pre-wrap font-mono text-xs text-gray-600",children:r||"<!-- No HTML available -->"})})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("span",{className:"inline-flex items-center rounded bg-blue-100 px-2 py-1 text-xs font-medium text-blue-800",children:l.isCanvas?"Canvas":"Component"}),l.isDeletable&&h.jsx("span",{className:"inline-flex items-center rounded bg-green-100 px-2 py-1 text-xs font-medium text-green-800",children:"Deletable"}),l.isDuplicateable&&h.jsx("span",{className:"inline-flex items-center rounded bg-purple-100 px-2 py-1 text-xs font-medium text-purple-800",children:"Duplicatable"})]})]}):null}function Ie(t){this.content=t}Ie.prototype={constructor:Ie,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,r){var n=r&&r!=t?this.remove(r):this,s=n.find(t),o=n.content.slice();return s==-1?o.push(r||t,e):(o[s+1]=e,r&&(o[s]=r)),new Ie(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var r=this.content.slice();return r.splice(e,2),new Ie(r)},addToStart:function(t,e){return new Ie([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var r=this.remove(t).content.slice();return r.push(t,e),new Ie(r)},addBefore:function(t,e,r){var n=this.remove(e),s=n.content.slice(),o=n.find(t);return s.splice(o==-1?s.length:o,0,e,r),new Ie(s)},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=Ie.from(t),t.size?new Ie(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ie.from(t),t.size?new Ie(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ie.from(t);for(var r=0;r<t.content.length;r+=2)e=e.remove(t.content[r]);return e},toObject:function(){var t={};return this.forEach(function(e,r){t[e]=r}),t},get size(){return this.content.length>>1}};Ie.from=function(t){if(t instanceof Ie)return t;var e=[];if(t)for(var r in t)e.push(r,t[r]);return new Ie(e)};function Kf(t,e,r){for(let n=0;;n++){if(n==t.childCount||n==e.childCount)return t.childCount==e.childCount?null:r;let s=t.child(n),o=e.child(n);if(s==o){r+=s.nodeSize;continue}if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)r++;return r}if(s.content.size||o.content.size){let i=Kf(s.content,o.content,r+1);if(i!=null)return i}r+=s.nodeSize}}function Jf(t,e,r,n){for(let s=t.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:r,b:n};let i=t.child(--s),a=e.child(--o),l=i.nodeSize;if(i==a){r-=l,n-=l;continue}if(!i.sameMarkup(a))return{a:r,b:n};if(i.isText&&i.text!=a.text){let c=0,d=Math.min(i.text.length,a.text.length);for(;c<d&&i.text[i.text.length-c-1]==a.text[a.text.length-c-1];)c++,r--,n--;return{a:r,b:n}}if(i.content.size||a.content.size){let c=Jf(i.content,a.content,r-1,n-1);if(c)return c}r-=l,n-=l}}class _{constructor(e,r){if(this.content=e,this.size=r||0,r==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,r,n,s=0,o){for(let i=0,a=0;a<r;i++){let l=this.content[i],c=a+l.nodeSize;if(c>e&&n(l,s+a,o||null,i)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,r-d),n,s+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,r,n,s){let o="",i=!0;return this.nodesBetween(e,r,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,r-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(i?i=!1:o+=n),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let r=this.lastChild,n=e.firstChild,s=this.content.slice(),o=0;for(r.isText&&r.sameMarkup(n)&&(s[s.length-1]=r.withText(r.text+n.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new _(s,this.size+e.size)}cut(e,r=this.size){if(e==0&&r==this.size)return this;let n=[],s=0;if(r>e)for(let o=0,i=0;i<r;o++){let a=this.content[o],l=i+a.nodeSize;l>e&&((i<e||l>r)&&(a.isText?a=a.cut(Math.max(0,e-i),Math.min(a.text.length,r-i)):a=a.cut(Math.max(0,e-i-1),Math.min(a.content.size,r-i-1))),n.push(a),s+=a.nodeSize),i=l}return new _(n,s)}cutByIndex(e,r){return e==r?_.empty:e==0&&r==this.content.length?this:new _(this.content.slice(e,r))}replaceChild(e,r){let n=this.content[e];if(n==r)return this;let s=this.content.slice(),o=this.size+r.nodeSize-n.nodeSize;return s[e]=r,new _(s,o)}addToStart(e){return new _([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new _(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let r=0;r<this.content.length;r++)if(!this.content[r].eq(e.content[r]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let r=this.content[e];if(!r)throw new RangeError("Index "+e+" out of range for "+this);return r}maybeChild(e){return this.content[e]||null}forEach(e){for(let r=0,n=0;r<this.content.length;r++){let s=this.content[r];e(s,n,r),n+=s.nodeSize}}findDiffStart(e,r=0){return Kf(this,e,r)}findDiffEnd(e,r=this.size,n=e.size){return Jf(this,e,r,n)}findIndex(e){if(e==0)return yo(0,e);if(e==this.size)return yo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,n=0;;r++){let s=this.child(r),o=n+s.nodeSize;if(o>=e)return o==e?yo(r+1,o):yo(r,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,r){if(!r)return _.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return new _(r.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return _.empty;let r,n=0;for(let s=0;s<e.length;s++){let o=e[s];n+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(r||(r=e.slice(0,s)),r[r.length-1]=o.withText(r[r.length-1].text+o.text)):r&&r.push(o)}return new _(r||e,n)}static from(e){if(!e)return _.empty;if(e instanceof _)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new _([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}_.empty=new _([],0);const ja={index:0,offset:0};function yo(t,e){return ja.index=t,ja.offset=e,ja}function $o(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let r=Array.isArray(t);if(Array.isArray(e)!=r)return!1;if(r){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!$o(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!$o(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}let ue=class xl{constructor(e,r){this.type=e,this.attrs=r}addToSet(e){let r,n=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))r||(r=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(r||(r=e.slice(0,s)),r.push(this),n=!0),r&&r.push(o)}}return r||(r=e.slice()),n||r.push(this),r}removeFromSet(e){for(let r=0;r<e.length;r++)if(this.eq(e[r]))return e.slice(0,r).concat(e.slice(r+1));return e}isInSet(e){for(let r=0;r<e.length;r++)if(this.eq(e[r]))return!0;return!1}eq(e){return this==e||this.type==e.type&&$o(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let r in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,r){if(!r)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[r.type];if(!n)throw new RangeError(`There is no mark type ${r.type} in this schema`);let s=n.create(r.attrs);return n.checkAttrs(s.attrs),s}static sameSet(e,r){if(e==r)return!0;if(e.length!=r.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(r[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return xl.none;if(e instanceof xl)return[e];let r=e.slice();return r.sort((n,s)=>n.type.rank-s.type.rank),r}};ue.none=[];class Ho extends Error{}class V{constructor(e,r,n){this.content=e,this.openStart=r,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,r){let n=Yf(this.content,e+this.openStart,r);return n&&new V(n,this.openStart,this.openEnd)}removeBetween(e,r){return new V(Gf(this.content,e+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,r){if(!r)return V.empty;let n=r.openStart||0,s=r.openEnd||0;if(typeof n!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new V(_.fromJSON(e,r.content),n,s)}static maxOpen(e,r=!0){let n=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.lastChild)s++;return new V(e,n,s)}}V.empty=new V(_.empty,0,0);function Gf(t,e,r){let{index:n,offset:s}=t.findIndex(e),o=t.maybeChild(n),{index:i,offset:a}=t.findIndex(r);if(s==e||o.isText){if(a!=r&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(r))}if(n!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(n,o.copy(Gf(o.content,e-s-1,r-s-1)))}function Yf(t,e,r,n){let{index:s,offset:o}=t.findIndex(e),i=t.maybeChild(s);if(o==e||i.isText)return n&&!n.canReplace(s,s,r)?null:t.cut(0,e).append(r).append(t.cut(e));let a=Yf(i.content,e-o-1,r,i);return a&&t.replaceChild(s,i.copy(a))}function mC(t,e,r){if(r.openStart>t.depth)throw new Ho("Inserted content deeper than insertion position");if(t.depth-r.openStart!=e.depth-r.openEnd)throw new Ho("Inconsistent open depths");return Zf(t,e,r,0)}function Zf(t,e,r,n){let s=t.index(n),o=t.node(n);if(s==e.index(n)&&n<t.depth-r.openStart){let i=Zf(t,e,r,n+1);return o.copy(o.content.replaceChild(s,i))}else if(r.content.size)if(!r.openStart&&!r.openEnd&&t.depth==n&&e.depth==n){let i=t.parent,a=i.content;return Jr(i,a.cut(0,t.parentOffset).append(r.content).append(a.cut(e.parentOffset)))}else{let{start:i,end:a}=gC(r,t);return Jr(o,Qf(t,i,a,e,n))}else return Jr(o,Vo(t,e,n))}function Xf(t,e){if(!e.type.compatibleContent(t.type))throw new Ho("Cannot join "+e.type.name+" onto "+t.type.name)}function vl(t,e,r){let n=t.node(r);return Xf(n,e.node(r)),n}function Kr(t,e){let r=e.length-1;r>=0&&t.isText&&t.sameMarkup(e[r])?e[r]=t.withText(e[r].text+t.text):e.push(t)}function xs(t,e,r,n){let s=(e||t).node(r),o=0,i=e?e.index(r):s.childCount;t&&(o=t.index(r),t.depth>r?o++:t.textOffset&&(Kr(t.nodeAfter,n),o++));for(let a=o;a<i;a++)Kr(s.child(a),n);e&&e.depth==r&&e.textOffset&&Kr(e.nodeBefore,n)}function Jr(t,e){return t.type.checkContent(e),t.copy(e)}function Qf(t,e,r,n,s){let o=t.depth>s&&vl(t,e,s+1),i=n.depth>s&&vl(r,n,s+1),a=[];return xs(null,t,s,a),o&&i&&e.index(s)==r.index(s)?(Xf(o,i),Kr(Jr(o,Qf(t,e,r,n,s+1)),a)):(o&&Kr(Jr(o,Vo(t,e,s+1)),a),xs(e,r,s,a),i&&Kr(Jr(i,Vo(r,n,s+1)),a)),xs(n,null,s,a),new _(a)}function Vo(t,e,r){let n=[];if(xs(null,t,r,n),t.depth>r){let s=vl(t,e,r+1);Kr(Jr(s,Vo(t,e,r+1)),n)}return xs(e,null,r,n),new _(n)}function gC(t,e){let r=e.depth-t.openStart,s=e.node(r).copy(t.content);for(let o=r-1;o>=0;o--)s=e.node(o).copy(_.from(s));return{start:s.resolveNoCache(t.openStart+r),end:s.resolveNoCache(s.content.size-t.openEnd-r)}}class Ns{constructor(e,r,n){this.pos=e,this.path=r,this.parentOffset=n,this.depth=r.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,r=this.index(this.depth);if(r==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],s=e.child(r);return n?e.child(r).cut(n):s}get nodeBefore(){let e=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(e).cut(0,r):e==0?null:this.parent.child(e-1)}posAtIndex(e,r){r=this.resolveDepth(r);let n=this.path[r*3],s=r==0?0:this.path[r*3-1]+1;for(let o=0;o<e;o++)s+=n.child(o).nodeSize;return s}marks(){let e=this.parent,r=this.index();if(e.content.size==0)return ue.none;if(this.textOffset)return e.child(r).marks;let n=e.maybeChild(r-1),s=e.maybeChild(r);if(!n){let a=n;n=s,s=a}let o=n.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let r=this.parent.maybeChild(this.index());if(!r||!r.isInline)return null;let n=r.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)n[o].type.spec.inclusive===!1&&(!s||!n[o].isInSet(s.marks))&&(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let r=this.depth;r>0;r--)if(this.start(r)<=e&&this.end(r)>=e)return r;return 0}blockRange(e=this,r){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!r||r(this.node(n))))return new qo(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let r=1;r<=this.depth;r++)e+=(e?"/":"")+this.node(r).type.name+"_"+this.index(r-1);return e+":"+this.parentOffset}static resolve(e,r){if(!(r>=0&&r<=e.content.size))throw new RangeError("Position "+r+" out of range");let n=[],s=0,o=r;for(let i=e;;){let{index:a,offset:l}=i.content.findIndex(o),c=o-l;if(n.push(i,a,s+l),!c||(i=i.child(a),i.isText))break;o=c-1,s+=l+1}return new Ns(r,n,o)}static resolveCached(e,r){let n=cp.get(e);if(n)for(let o=0;o<n.elts.length;o++){let i=n.elts[o];if(i.pos==r)return i}else cp.set(e,n=new bC);let s=n.elts[n.i]=Ns.resolve(e,r);return n.i=(n.i+1)%yC,s}}class bC{constructor(){this.elts=[],this.i=0}}const yC=12,cp=new WeakMap;class qo{constructor(e,r,n){this.$from=e,this.$to=r,this.depth=n}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 xC=Object.create(null);class Ct{constructor(e,r,n,s=ue.none){this.type=e,this.attrs=r,this.marks=s,this.content=n||_.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,r,n,s=0){this.content.nodesBetween(e,r,n,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,r,n,s){return this.content.textBetween(e,r,n,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,r,n){return this.type==e&&$o(this.attrs,r||e.defaultAttrs||xC)&&ue.sameSet(this.marks,n||ue.none)}copy(e=null){return e==this.content?this:new Ct(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ct(this.type,this.attrs,this.content,e)}cut(e,r=this.content.size){return e==0&&r==this.content.size?this:this.copy(this.content.cut(e,r))}slice(e,r=this.content.size,n=!1){if(e==r)return V.empty;let s=this.resolve(e),o=this.resolve(r),i=n?0:s.sharedDepth(r),a=s.start(i),c=s.node(i).content.cut(s.pos-a,o.pos-a);return new V(c,s.depth-i,o.depth-i)}replace(e,r,n){return mC(this.resolve(e),this.resolve(r),n)}nodeAt(e){for(let r=this;;){let{index:n,offset:s}=r.content.findIndex(e);if(r=r.maybeChild(n),!r)return null;if(s==e||r.isText)return r;e-=s+1}}childAfter(e){let{index:r,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(r),index:r,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:r,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(r),index:r,offset:n};let s=this.content.child(r-1);return{node:s,index:r-1,offset:n-s.nodeSize}}resolve(e){return Ns.resolveCached(this,e)}resolveNoCache(e){return Ns.resolve(this,e)}rangeHasMark(e,r,n){let s=!1;return r>e&&this.nodesBetween(e,r,o=>(n.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),em(this.marks,e)}contentMatchAt(e){let r=this.type.contentMatch.matchFragment(this.content,0,e);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(e,r,n=_.empty,s=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,s,o),a=i&&i.matchFragment(this.content,r);if(!a||!a.validEnd)return!1;for(let l=s;l<o;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,r,n,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,r);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ue.none;for(let r=0;r<this.marks.length;r++){let n=this.marks[r];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!ue.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(r=>r.type.name)}`);this.content.forEach(r=>r.check())}toJSON(){let e={type:this.type.name};for(let r in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(r=>r.toJSON())),e}static fromJSON(e,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let n;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=r.marks.map(e.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(r.text,n)}let s=_.fromJSON(e,r.content),o=e.nodeType(r.type).create(r.attrs,s,n);return o.type.checkAttrs(o.attrs),o}}Ct.prototype.text=void 0;class Wo extends Ct{constructor(e,r,n,s){if(super(e,r,null,s),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):em(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,r){return this.text.slice(e,r)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Wo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Wo(this.type,this.attrs,e,this.marks)}cut(e=0,r=this.text.length){return e==0&&r==this.text.length?this:this.withText(this.text.slice(e,r))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function em(t,e){for(let r=t.length-1;r>=0;r--)e=t[r].type.name+"("+e+")";return e}class Qr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,r){let n=new vC(e,r);if(n.next==null)return Qr.empty;let s=tm(n);n.next&&n.err("Unexpected trailing text");let o=FC(SC(s));return AC(o,n),o}matchType(e){for(let r=0;r<this.next.length;r++)if(this.next[r].type==e)return this.next[r].next;return null}matchFragment(e,r=0,n=e.childCount){let s=this;for(let o=r;s&&o<n;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:r}=this.next[e];if(!(r.isText||r.hasRequiredAttrs()))return r}return null}compatible(e){for(let r=0;r<this.next.length;r++)for(let n=0;n<e.next.length;n++)if(this.next[r].type==e.next[n].type)return!0;return!1}fillBefore(e,r=!1,n=0){let s=[this];function o(i,a){let l=i.matchFragment(e,n);if(l&&(!r||l.validEnd))return _.from(a.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:d,next:f}=i.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let m=o(f,a.concat(d));if(m)return m}}return null}return o(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let r=this.computeWrapping(e);return this.wrapCache.push(e,r),r}computeWrapping(e){let r=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let s=n.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let a=s;a.type;a=a.via)i.push(a.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:a,next:l}=o.next[i];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in r)&&(!s.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:s}),r[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function r(n){e.push(n);for(let s=0;s<n.next.length;s++)e.indexOf(n.next[s].next)==-1&&r(n.next[s].next)}return r(this),e.map((n,s)=>{let o=s+(n.validEnd?"*":" ")+" ";for(let i=0;i<n.next.length;i++)o+=(i?", ":"")+n.next[i].type.name+"->"+e.indexOf(n.next[i].next);return o}).join(`
67
+ `)}}Qr.empty=new Qr(!0);class vC{constructor(e,r){this.string=e,this.nodeTypes=r,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tm(t){let e=[];do e.push(wC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function wC(t){let e=[];do e.push(DC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function DC(t){let e=EC(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=CC(t,e);else break;return e}function dp(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function CC(t,e){let r=dp(t),n=r;return t.eat(",")&&(t.next!="}"?n=dp(t):n=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:e}}function kC(t,e){let r=t.nodeTypes,n=r[e];if(n)return[n];let s=[];for(let o in r){let i=r[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function EC(t){if(t.eat("(")){let e=tm(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=kC(t,t.next).map(r=>(t.inline==null?t.inline=r.isInline:t.inline!=r.isInline&&t.err("Mixing inline and block content"),{type:"name",value:r}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function SC(t){let e=[[]];return s(o(t,0),r()),e;function r(){return e.push([])-1}function n(i,a,l){let c={term:l,to:a};return e[i].push(c),c}function s(i,a){i.forEach(l=>l.to=a)}function o(i,a){if(i.type=="choice")return i.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(i.type=="seq")for(let l=0;;l++){let c=o(i.exprs[l],a);if(l==i.exprs.length-1)return c;s(c,a=r())}else if(i.type=="star"){let l=r();return n(a,l),s(o(i.expr,l),l),[n(l)]}else if(i.type=="plus"){let l=r();return s(o(i.expr,a),l),s(o(i.expr,l),l),[n(l)]}else{if(i.type=="opt")return[n(a)].concat(o(i.expr,a));if(i.type=="range"){let l=a;for(let c=0;c<i.min;c++){let d=r();s(o(i.expr,l),d),l=d}if(i.max==-1)s(o(i.expr,l),l);else for(let c=i.min;c<i.max;c++){let d=r();n(l,d),s(o(i.expr,l),d),l=d}return[n(l)]}else{if(i.type=="name")return[n(a,void 0,i.value)];throw new Error("Unknown expr type")}}}}function rm(t,e){return e-t}function pp(t,e){let r=[];return n(e),r.sort(rm);function n(s){let o=t[s];if(o.length==1&&!o[0].term)return n(o[0].to);r.push(s);for(let i=0;i<o.length;i++){let{term:a,to:l}=o[i];!a&&r.indexOf(l)==-1&&n(l)}}}function FC(t){let e=Object.create(null);return r(pp(t,0));function r(n){let s=[];n.forEach(i=>{t[i].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<s.length;d++)s[d][0]==a&&(c=s[d][1]);pp(t,l).forEach(d=>{c||s.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let o=e[n.join(",")]=new Qr(n.indexOf(t.length-1)>-1);for(let i=0;i<s.length;i++){let a=s[i][1].sort(rm);o.next.push({type:s[i][0],next:e[a.join(",")]||r(a)})}return o}}function AC(t,e){for(let r=0,n=[t];r<n.length;r++){let s=n[r],o=!s.validEnd,i=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];i.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),n.indexOf(c)==-1&&n.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function nm(t){let e=Object.create(null);for(let r in t){let n=t[r];if(!n.hasDefault)return null;e[r]=n.default}return e}function sm(t,e){let r=Object.create(null);for(let n in t){let s=e&&e[n];if(s===void 0){let o=t[n];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+n)}r[n]=s}return r}function om(t,e,r,n){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${r} of type ${s}`);for(let s in t){let o=t[s];o.validate&&o.validate(e[s])}}function im(t,e){let r=Object.create(null);if(e)for(let n in e)r[n]=new TC(t,n,e[n]);return r}let hp=class am{constructor(e,r,n){this.name=e,this.schema=r,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=im(e,n.attrs),this.defaultAttrs=nm(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Qr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:sm(this.attrs,e)}create(e=null,r,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ct(this,this.computeAttrs(e),_.from(r),ue.setFrom(n))}createChecked(e=null,r,n){return r=_.from(r),this.checkContent(r),new Ct(this,this.computeAttrs(e),r,ue.setFrom(n))}createAndFill(e=null,r,n){if(e=this.computeAttrs(e),r=_.from(r),r.size){let i=this.contentMatch.fillBefore(r);if(!i)return null;r=i.append(r)}let s=this.contentMatch.matchFragment(r),o=s&&s.fillBefore(_.empty,!0);return o?new Ct(this,e,r.append(o),ue.setFrom(n)):null}validContent(e){let r=this.contentMatch.matchFragment(e);if(!r||!r.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){om(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let r=0;r<e.length;r++)if(!this.allowsMarkType(e[r].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let r;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?r&&r.push(e[n]):r||(r=e.slice(0,n));return r?r.length?r:ue.none:e}static compile(e,r){let n=Object.create(null);e.forEach((o,i)=>n[o]=new am(o,r,i));let s=r.spec.topNode||"doc";if(!n[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function NC(t,e,r){let n=r.split("|");return s=>{let o=s===null?"null":typeof s;if(n.indexOf(o)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${t}, got ${o}`)}}class TC{constructor(e,r,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?NC(e,r,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Ri{constructor(e,r,n,s){this.name=e,this.rank=r,this.schema=n,this.spec=s,this.attrs=im(e,s.attrs),this.excluded=null;let o=nm(this.attrs);this.instance=o?new ue(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ue(this,sm(this.attrs,e))}static compile(e,r){let n=Object.create(null),s=0;return e.forEach((o,i)=>n[o]=new Ri(o,s++,r,i)),n}removeFromSet(e){for(var r=0;r<e.length;r++)e[r].type==this&&(e=e.slice(0,r).concat(e.slice(r+1)),r--);return e}isInSet(e){for(let r=0;r<e.length;r++)if(e[r].type==this)return e[r]}checkAttrs(e){om(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class lm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let s in e)r[s]=e[s];r.nodes=Ie.from(e.nodes),r.marks=Ie.from(e.marks||{}),this.nodes=hp.compile(this.spec.nodes,this),this.marks=Ri.compile(this.spec.marks,this);let n=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=n[i]||(n[i]=Qr.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?fp(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:fp(this,i.split(" "))}this.nodeFromJSON=s=>Ct.fromJSON(this,s),this.markFromJSON=s=>ue.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,r=null,n,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof hp){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(r,n,s)}text(e,r){let n=this.nodes.text;return new Wo(n,n.defaultAttrs,e,ue.setFrom(r))}mark(e,r){return typeof e=="string"&&(e=this.marks[e]),e.create(r)}nodeType(e){let r=this.nodes[e];if(!r)throw new RangeError("Unknown node type: "+e);return r}}function fp(t,e){let r=[];for(let n=0;n<e.length;n++){let s=e[n],o=t.marks[s],i=o;if(o)r.push(o);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&r.push(i=l)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return r}function MC(t){return t.tag!=null}function BC(t){return t.style!=null}class yr{constructor(e,r){this.schema=e,this.rules=r,this.tags=[],this.styles=[];let n=this.matchedStyles=[];r.forEach(s=>{if(MC(s))this.tags.push(s);else if(BC(s)){let o=/[^=]*/.exec(s.style)[0];n.indexOf(o)<0&&n.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,r={}){let n=new gp(this,r,!1);return n.addAll(e,ue.none,r.from,r.to),n.finish()}parseSlice(e,r={}){let n=new gp(this,r,!0);return n.addAll(e,ue.none,r.from,r.to),V.maxOpen(n.finish())}matchTag(e,r,n){for(let s=n?this.tags.indexOf(n)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(LC(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||r.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,r,n,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],a=i.style;if(!(a.indexOf(e)!=0||i.context&&!n.matchesContext(i.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=r))){if(i.getAttrs){let l=i.getAttrs(r);if(l===!1)continue;i.attrs=l||void 0}return i}}}static schemaRules(e){let r=[];function n(s){let o=s.priority==null?50:s.priority,i=0;for(;i<r.length;i++){let a=r[i];if((a.priority==null?50:a.priority)<o)break}r.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{n(i=bp(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{n(i=bp(i)),i.node||i.ignore||i.mark||(i.node=s)})}return r}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new yr(e,yr.schemaRules(e)))}}const um={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},jC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},cm={ol:!0,ul:!0},Ts=1,wl=2,vs=4;function mp(t,e,r){return e!=null?(e?Ts:0)|(e==="full"?wl:0):t&&t.whitespace=="pre"?Ts|wl:r&~vs}class xo{constructor(e,r,n,s,o,i){this.type=e,this.attrs=r,this.marks=n,this.solid=s,this.options=i,this.content=[],this.activeMarks=ue.none,this.match=o||(i&vs?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let r=this.type.contentMatch.fillBefore(_.from(e));if(r)this.match=this.type.contentMatch.matchFragment(r);else{let n=this.type.contentMatch,s;return(s=n.findWrapping(e.type))?(this.match=n,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ts)){let n=this.content[this.content.length-1],s;if(n&&n.isText&&(s=/[ \t\r\n\u000c]+$/.exec(n.text))){let o=n;n.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let r=_.from(this.content);return!e&&this.match&&(r=r.append(this.match.fillBefore(_.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!um.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class gp{constructor(e,r,n){this.parser=e,this.options=r,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let s=r.topNode,o,i=mp(null,r.preserveWhitespace,0)|(n?vs:0);s?o=new xo(s.type,s.attrs,ue.none,!0,r.topMatch||s.type.contentMatch,i):n?o=new xo(null,null,ue.none,!0,null,i):o=new xo(e.schema.topNodeType,null,ue.none,!0,null,i),this.nodes=[o],this.find=r.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,r){e.nodeType==3?this.addTextNode(e,r):e.nodeType==1&&this.addElement(e,r)}addTextNode(e,r){let n=e.nodeValue,s=this.top,o=s.options&wl?"full":this.localPreserveWS||(s.options&Ts)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if(o==="full")n=n.replace(/\r\n?/g,`
68
+ `);else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(i.linebreakReplacement.create(),r,!0),a[l]&&this.insertNode(i.text(a[l]),r,!/\S/.test(a[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),r,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,r,n){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),a;cm.hasOwnProperty(i)&&this.parser.normalizeLists&&OC(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:jC.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,r);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(um.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,r);break e}let f=l&&l.skip?r:this.readStyles(e,r);f&&this.addAll(e,f),c&&this.sync(o),this.needsBlock=d}else{let c=this.readStyles(e,r);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,r){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
69
+ `),r)}ignoreFallback(e,r){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),r,!0)}readStyles(e,r){let n=e.style;if(n&&n.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=n.getPropertyValue(o);if(i)for(let a=void 0;;){let l=this.parser.matchStyle(o,i,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?r=r.filter(c=>!l.clearMark(c)):r=r.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return r}addElementByRule(e,r,n,s){let o,i;if(r.node)if(i=this.parser.schema.nodes[r.node],i.isLeaf)this.insertNode(i.create(r.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(i,r.attrs||null,n,r.preserveWhitespace);l&&(o=!0,n=l)}else{let l=this.parser.schema.marks[r.mark];n=n.concat(l.create(r.attrs))}let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,n,s);else if(r.getContent)this.findInside(e),r.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof r.contentElement=="string"?l=e.querySelector(r.contentElement):typeof r.contentElement=="function"?l=r.contentElement(e):r.contentElement&&(l=r.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,r,n,s){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,a=s==null?null:e.childNodes[s];i!=a;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,r);this.findAtPoint(e,o)}findPlace(e,r,n){let s,o;for(let i=this.open,a=0;i>=0;i--){let l=this.nodes[i],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,o=l,!c.length))break;if(l.solid){if(n)break;a+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)r=this.enterInner(s[i],null,r,!1);return r}insertNode(e,r,n){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(r=this.enterInner(o,null,r))}let s=this.findPlace(e,r,n);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=ue.none;for(let a of s.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):yp(a.type,e.type))&&(i=a.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,r,n,s){let o=this.findPlace(e.create(r),n,!1);return o&&(o=this.enterInner(e,r,n,!0,s)),o}enterInner(e,r,n,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let a=mp(e,o,i.options);i.options&vs&&i.content.length==0&&(a|=vs);let l=ue.none;return n=n.filter(c=>(i.type?i.type.allowsMarkType(c.type):yp(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new xo(e,r,l,s,null,a)),this.open++,n}closeExtra(e=!1){let r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let r=this.open;r>=0;r--){if(this.nodes[r]==e)return this.open=r,!0;this.localPreserveWS&&(this.nodes[r].options|=Ts)}return!1}get currentPos(){this.closeExtra();let e=0;for(let r=this.open;r>=0;r--){let n=this.nodes[r].content;for(let s=n.length-1;s>=0;s--)e+=n[s].nodeSize;r&&e++}return e}findAtPoint(e,r){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==r&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&(this.find[r].pos=this.currentPos)}findAround(e,r,n){if(e!=r&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&r.compareDocumentPosition(this.find[s].node)&(n?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&(this.find[r].pos=this.currentPos-(e.nodeValue.length-this.find[r].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let r=e.split("/"),n=this.options.context,s=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(s?0:1),i=(a,l)=>{for(;a>=0;a--){let c=r[a];if(c==""){if(a==r.length-1||a==0)continue;for(;l>=o;l--)if(i(a-1,l))return!0;return!1}else{let d=l>0||l==0&&s?this.nodes[l].type:n&&l>=o?n.node(l-o).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return i(r.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let r=e.depth;r>=0;r--){let n=e.node(r).contentMatchAt(e.indexAfter(r)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let r in this.parser.schema.nodes){let n=this.parser.schema.nodes[r];if(n.isTextblock&&n.defaultAttrs)return n}}}function OC(t){for(let e=t.firstChild,r=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&cm.hasOwnProperty(n)&&r?(r.appendChild(e),e=r):n=="li"?r=e:n&&(r=null)}}function LC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function bp(t){let e={};for(let r in t)e[r]=t[r];return e}function yp(t,e){let r=e.schema.nodes;for(let n in r){let s=r[n];if(!s.allowsMarkType(t))continue;let o=[],i=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||o.indexOf(d)<0&&i(d))return!0}};if(i(s.contentMatch))return!0}}class an{constructor(e,r){this.nodes=e,this.marks=r}serializeFragment(e,r={},n){n||(n=Oa(r).createDocumentFragment());let s=n,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let a=0,l=0;for(;a<o.length&&l<i.marks.length;){let c=i.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)s=o.pop()[1];for(;l<i.marks.length;){let c=i.marks[l++],d=this.serializeMark(c,i.isInline,r);d&&(o.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(i,r))}),n}serializeNodeInner(e,r){let{dom:n,contentDOM:s}=jo(Oa(r),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,r,s)}return n}serializeNode(e,r={}){let n=this.serializeNodeInner(e,r);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,r);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,r,n={}){let s=this.marks[e.type.name];return s&&jo(Oa(n),s(e,r),null,e.attrs)}static renderSpec(e,r,n=null,s){return jo(e,r,n,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new an(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let r=xp(e.nodes);return r.text||(r.text=n=>n.text),r}static marksFromSchema(e){return xp(e.marks)}}function xp(t){let e={};for(let r in t){let n=t[r].spec.toDOM;n&&(e[r]=n)}return e}function Oa(t){return t.document||window.document}const vp=new WeakMap;function _C(t){let e=vp.get(t);return e===void 0&&vp.set(t,e=IC(t)),e}function IC(t){let e=null;function r(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let s=0;s<n.length;s++)r(n[s]);else for(let s in n)r(n[s])}return r(t),e}function jo(t,e,r,n){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(o=_C(n))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=s.indexOf(" ");i>0&&(r=s.slice(0,i),s=s.slice(i+1));let a,l=r?t.createElementNS(r,s):t.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let f in c)if(c[f]!=null){let m=f.indexOf(" ");m>0?l.setAttributeNS(f.slice(0,m),f.slice(m+1),c[f]):f=="style"&&l.style?l.style.cssText=c[f]:l.setAttribute(f,c[f])}}for(let f=d;f<e.length;f++){let m=e[f];if(m===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:g,contentDOM:y}=jo(t,m,r,n);if(l.appendChild(g),y){if(a)throw new RangeError("Multiple content holes");a=y}}}return{dom:l,contentDOM:a}}const dm=65535,pm=Math.pow(2,16);function RC(t,e){return t+e*pm}function wp(t){return t&dm}function PC(t){return(t-(t&dm))/pm}const hm=1,fm=2,Oo=4,mm=8;class Dl{constructor(e,r,n){this.pos=e,this.delInfo=r,this.recover=n}get deleted(){return(this.delInfo&mm)>0}get deletedBefore(){return(this.delInfo&(hm|Oo))>0}get deletedAfter(){return(this.delInfo&(fm|Oo))>0}get deletedAcross(){return(this.delInfo&Oo)>0}}class nt{constructor(e,r=!1){if(this.ranges=e,this.inverted=r,!e.length&&nt.empty)return nt.empty}recover(e){let r=0,n=wp(e);if(!this.inverted)for(let s=0;s<n;s++)r+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[n*3]+r+PC(e)}mapResult(e,r=1){return this._map(e,r,!1)}map(e,r=1){return this._map(e,r,!0)}_map(e,r,n){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+o],d=this.ranges[a+i],f=l+c;if(e<=f){let m=c?e==l?-1:e==f?1:r:r,g=l+s+(m<0?0:d);if(n)return g;let y=e==(r<0?l:f)?null:RC(a/3,e-l),x=e==l?fm:e==f?hm:Oo;return(r<0?e!=l:e!=f)&&(x|=mm),new Dl(g,x,y)}s+=d-c}return n?e+s:new Dl(e+s,0,null)}touches(e,r){let n=0,s=wp(r),o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let c=this.ranges[a+o],d=l+c;if(e<=d&&a==s*3)return!0;n+=this.ranges[a+i]-c}return!1}forEach(e){let r=this.inverted?2:1,n=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],a=i-(this.inverted?o:0),l=i+(this.inverted?0:o),c=this.ranges[s+r],d=this.ranges[s+n];e(a,a+c,l,l+d),o+=d-c}}invert(){return new nt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?nt.empty:new nt(e<0?[0,-e,0]:[0,0,e])}}nt.empty=new nt([]);class Ms{constructor(e,r,n=0,s=e?e.length:0){this.mirror=r,this.from=n,this.to=s,this._maps=e||[],this.ownData=!(e||r)}get maps(){return this._maps}slice(e=0,r=this.maps.length){return new Ms(this._maps,this.mirror,e,r)}appendMap(e,r){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),r!=null&&this.setMirror(this._maps.length-1,r)}appendMapping(e){for(let r=0,n=this._maps.length;r<e._maps.length;r++){let s=e.getMirror(r);this.appendMap(e._maps[r],s!=null&&s<r?n+s:void 0)}}getMirror(e){if(this.mirror){for(let r=0;r<this.mirror.length;r++)if(this.mirror[r]==e)return this.mirror[r+(r%2?-1:1)]}}setMirror(e,r){this.mirror||(this.mirror=[]),this.mirror.push(e,r)}appendMappingInverted(e){for(let r=e.maps.length-1,n=this._maps.length+e._maps.length;r>=0;r--){let s=e.getMirror(r);this.appendMap(e._maps[r].invert(),s!=null&&s>r?n-s-1:void 0)}}invert(){let e=new Ms;return e.appendMappingInverted(this),e}map(e,r=1){if(this.mirror)return this._map(e,r,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,r);return e}mapResult(e,r=1){return this._map(e,r,!1)}_map(e,r,n){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],a=i.mapResult(e,r);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return n?e:new Dl(e,s,null)}}const La=Object.create(null);class Ue{getMap(){return nt.empty}merge(e){return null}static fromJSON(e,r){if(!r||!r.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=La[r.stepType];if(!n)throw new RangeError(`No step type ${r.stepType} defined`);return n.fromJSON(e,r)}static jsonID(e,r){if(e in La)throw new RangeError("Duplicate use of step JSON ID "+e);return La[e]=r,r.prototype.jsonID=e,r}}class Ce{constructor(e,r){this.doc=e,this.failed=r}static ok(e){return new Ce(e,null)}static fail(e){return new Ce(null,e)}static fromReplace(e,r,n,s){try{return Ce.ok(e.replace(r,n,s))}catch(o){if(o instanceof Ho)return Ce.fail(o.message);throw o}}}function wu(t,e,r){let n=[];for(let s=0;s<t.childCount;s++){let o=t.child(s);o.content.size&&(o=o.copy(wu(o.content,e,o))),o.isInline&&(o=e(o,r,s)),n.push(o)}return _.fromArray(n)}class hr extends Ue{constructor(e,r,n){super(),this.from=e,this.to=r,this.mark=n}apply(e){let r=e.slice(this.from,this.to),n=e.resolve(this.from),s=n.node(n.sharedDepth(this.to)),o=new V(wu(r.content,(i,a)=>!i.isAtom||!a.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),r.openStart,r.openEnd);return Ce.fromReplace(e,this.from,this.to,o)}invert(){return new Dt(this.from,this.to,this.mark)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new hr(r.pos,n.pos,this.mark)}merge(e){return e instanceof hr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new hr(r.from,r.to,e.markFromJSON(r.mark))}}Ue.jsonID("addMark",hr);class Dt extends Ue{constructor(e,r,n){super(),this.from=e,this.to=r,this.mark=n}apply(e){let r=e.slice(this.from,this.to),n=new V(wu(r.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),r.openStart,r.openEnd);return Ce.fromReplace(e,this.from,this.to,n)}invert(){return new hr(this.from,this.to,this.mark)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new Dt(r.pos,n.pos,this.mark)}merge(e){return e instanceof Dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Dt(r.from,r.to,e.markFromJSON(r.mark))}}Ue.jsonID("removeMark",Dt);class fr extends Ue{constructor(e,r){super(),this.pos=e,this.mark=r}apply(e){let r=e.nodeAt(this.pos);if(!r)return Ce.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.addToSet(r.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new V(_.from(n),0,r.isLeaf?0:1))}invert(e){let r=e.nodeAt(this.pos);if(r){let n=this.mark.addToSet(r.marks);if(n.length==r.marks.length){for(let s=0;s<r.marks.length;s++)if(!r.marks[s].isInSet(n))return new fr(this.pos,r.marks[s]);return new fr(this.pos,this.mark)}}return new en(this.pos,this.mark)}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new fr(r.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fr(r.pos,e.markFromJSON(r.mark))}}Ue.jsonID("addNodeMark",fr);class en extends Ue{constructor(e,r){super(),this.pos=e,this.mark=r}apply(e){let r=e.nodeAt(this.pos);if(!r)return Ce.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.removeFromSet(r.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new V(_.from(n),0,r.isLeaf?0:1))}invert(e){let r=e.nodeAt(this.pos);return!r||!this.mark.isInSet(r.marks)?this:new fr(this.pos,this.mark)}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new en(r.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new en(r.pos,e.markFromJSON(r.mark))}}Ue.jsonID("removeNodeMark",en);class Me extends Ue{constructor(e,r,n,s=!1){super(),this.from=e,this.to=r,this.slice=n,this.structure=s}apply(e){return this.structure&&Cl(e,this.from,this.to)?Ce.fail("Structure replace would overwrite content"):Ce.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Me(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return r.deletedAcross&&n.deletedAcross?null:new Me(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Me)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let r=this.slice.size+e.slice.size==0?V.empty:new V(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Me(this.from,this.to+(e.to-e.from),r,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let r=this.slice.size+e.slice.size==0?V.empty:new V(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Me(e.from,this.to,r,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Me(r.from,r.to,V.fromJSON(e,r.slice),!!r.structure)}}Ue.jsonID("replace",Me);class Be extends Ue{constructor(e,r,n,s,o,i,a=!1){super(),this.from=e,this.to=r,this.gapFrom=n,this.gapTo=s,this.slice=o,this.insert=i,this.structure=a}apply(e){if(this.structure&&(Cl(e,this.from,this.gapFrom)||Cl(e,this.gapTo,this.to)))return Ce.fail("Structure gap-replace would overwrite content");let r=e.slice(this.gapFrom,this.gapTo);if(r.openStart||r.openEnd)return Ce.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,r.content);return n?Ce.fromReplace(e,this.from,this.to,n):Ce.fail("Content does not fit in gap")}getMap(){return new nt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let r=this.gapTo-this.gapFrom;return new Be(this.from,this.from+this.slice.size+r,this.from+this.insert,this.from+this.insert+r,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let r=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),s=this.from==this.gapFrom?r.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return r.deletedAcross&&n.deletedAcross||s<r.pos||o>n.pos?null:new Be(r.pos,n.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,r){if(typeof r.from!="number"||typeof r.to!="number"||typeof r.gapFrom!="number"||typeof r.gapTo!="number"||typeof r.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Be(r.from,r.to,r.gapFrom,r.gapTo,V.fromJSON(e,r.slice),r.insert,!!r.structure)}}Ue.jsonID("replaceAround",Be);function Cl(t,e,r){let n=t.resolve(e),s=r-e,o=n.depth;for(;s>0&&o>0&&n.indexAfter(o)==n.node(o).childCount;)o--,s--;if(s>0){let i=n.node(o).maybeChild(n.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function zC(t,e,r,n){let s=[],o=[],i,a;t.doc.nodesBetween(e,r,(l,c,d)=>{if(!l.isInline)return;let f=l.marks;if(!n.isInSet(f)&&d.type.allowsMarkType(n.type)){let m=Math.max(c,e),g=Math.min(c+l.nodeSize,r),y=n.addToSet(f);for(let x=0;x<f.length;x++)f[x].isInSet(y)||(i&&i.to==m&&i.mark.eq(f[x])?i.to=g:s.push(i=new Dt(m,g,f[x])));a&&a.to==m?a.to=g:o.push(a=new hr(m,g,n))}}),s.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function $C(t,e,r,n){let s=[],o=0;t.doc.nodesBetween(e,r,(i,a)=>{if(!i.isInline)return;o++;let l=null;if(n instanceof Ri){let c=i.marks,d;for(;d=n.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else n?n.isInSet(i.marks)&&(l=[n]):l=i.marks;if(l&&l.length){let c=Math.min(a+i.nodeSize,r);for(let d=0;d<l.length;d++){let f=l[d],m;for(let g=0;g<s.length;g++){let y=s[g];y.step==o-1&&f.eq(s[g].style)&&(m=y)}m?(m.to=c,m.step=o):s.push({style:f,from:Math.max(a,e),to:c,step:o})}}}),s.forEach(i=>t.step(new Dt(i.from,i.to,i.style)))}function Du(t,e,r,n=r.contentMatch,s=!0){let o=t.doc.nodeAt(e),i=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),d=a+c.nodeSize,f=n.matchType(c.type);if(!f)i.push(new Me(a,d,V.empty));else{n=f;for(let m=0;m<c.marks.length;m++)r.allowsMarkType(c.marks[m].type)||t.step(new Dt(a,d,c.marks[m]));if(s&&c.isText&&r.whitespace!="pre"){let m,g=/\r?\n|\r/g,y;for(;m=g.exec(c.text);)y||(y=new V(_.from(r.schema.text(" ",r.allowedMarks(c.marks))),0,0)),i.push(new Me(a+m.index,a+m.index+m[0].length,y))}}a=d}if(!n.validEnd){let l=n.fillBefore(_.empty,!0);t.replace(a,a,new V(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function HC(t,e,r){return(e==0||t.canReplace(e,t.childCount))&&(r==t.childCount||t.canReplace(0,r))}function Hn(t){let r=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let s=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&s.canReplace(o,i,r))return n;if(n==0||s.type.spec.isolating||!HC(s,o,i))break}return null}function VC(t,e,r){let{$from:n,$to:s,depth:o}=e,i=n.before(o+1),a=s.after(o+1),l=i,c=a,d=_.empty,f=0;for(let y=o,x=!1;y>r;y--)x||n.index(y)>0?(x=!0,d=_.from(n.node(y).copy(d)),f++):l--;let m=_.empty,g=0;for(let y=o,x=!1;y>r;y--)x||s.after(y+1)<s.end(y)?(x=!0,m=_.from(s.node(y).copy(m)),g++):c++;t.step(new Be(l,c,i,a,new V(d.append(m),f,g),d.size-f,!0))}function Cu(t,e,r=null,n=t){let s=qC(t,e),o=s&&WC(n,e);return o?s.map(Dp).concat({type:e,attrs:r}).concat(o.map(Dp)):null}function Dp(t){return{type:t,attrs:null}}function qC(t,e){let{parent:r,startIndex:n,endIndex:s}=t,o=r.contentMatchAt(n).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return r.canReplaceWith(n,s,i)?o:null}function WC(t,e){let{parent:r,startIndex:n,endIndex:s}=t,o=r.child(n),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let l=(i.length?i[i.length-1]:e).contentMatch;for(let c=n;l&&c<s;c++)l=l.matchType(r.child(c).type);return!l||!l.validEnd?null:i}function UC(t,e,r){let n=_.empty;for(let i=r.length-1;i>=0;i--){if(n.size){let a=r[i].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=_.from(r[i].type.create(r[i].attrs,n))}let s=e.start,o=e.end;t.step(new Be(s,o,s,o,new V(n,0,0),r.length,!0))}function KC(t,e,r,n,s){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,r,(i,a)=>{let l=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(n,l)&&JC(t.doc,t.mapping.slice(o).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let g=n.whitespace=="pre",y=!!n.contentMatch.matchType(n.schema.linebreakReplacement);g&&!y?c=!1:!g&&y&&(c=!0)}c===!1&&bm(t,i,a,o),Du(t,t.mapping.slice(o).map(a,1),n,void 0,c===null);let d=t.mapping.slice(o),f=d.map(a,1),m=d.map(a+i.nodeSize,1);return t.step(new Be(f,m,f+1,m-1,new V(_.from(n.create(l,null,i.marks)),0,0),1,!0)),c===!0&&gm(t,i,a,o),!1}})}function gm(t,e,r,n){e.forEach((s,o)=>{if(s.isText){let i,a=/\r?\n|\r/g;for(;i=a.exec(s.text);){let l=t.mapping.slice(n).map(r+1+o+i.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function bm(t,e,r,n){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=t.mapping.slice(n).map(r+1+o);t.replaceWith(i,i+1,e.type.schema.text(`
70
+ `))}})}function JC(t,e,r){let n=t.resolve(e),s=n.index();return n.parent.canReplaceWith(s,s+1,r)}function GC(t,e,r,n,s){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");r||(r=o.type);let i=r.create(n,null,s||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,i);if(!r.validContent(o.content))throw new RangeError("Invalid content for node type "+r.name);t.step(new Be(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new V(_.from(i),0,0),1,!0))}function Wt(t,e,r=1,n){let s=t.resolve(e),o=s.depth-r,i=n&&n[n.length-1]||s.parent;if(o<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!i.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,d=r-2;c>o;c--,d--){let f=s.node(c),m=s.index(c);if(f.type.spec.isolating)return!1;let g=f.content.cutByIndex(m,f.childCount),y=n&&n[d+1];y&&(g=g.replaceChild(0,y.type.create(y.attrs)));let x=n&&n[d]||f;if(!f.canReplace(m+1,f.childCount)||!x.type.validContent(g))return!1}let a=s.indexAfter(o),l=n&&n[0];return s.node(o).canReplaceWith(a,a,l?l.type:s.node(o+1).type)}function YC(t,e,r=1,n){let s=t.doc.resolve(e),o=_.empty,i=_.empty;for(let a=s.depth,l=s.depth-r,c=r-1;a>l;a--,c--){o=_.from(s.node(a).copy(o));let d=n&&n[c];i=_.from(d?d.type.create(d.attrs,i):s.node(a).copy(i))}t.step(new Me(e,e,new V(o.append(i),r,r),!0))}function Fr(t,e){let r=t.resolve(e),n=r.index();return ym(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function ZC(t,e){e.content.size||t.type.compatibleContent(e.type);let r=t.contentMatchAt(t.childCount),{linebreakReplacement:n}=t.type.schema;for(let s=0;s<e.childCount;s++){let o=e.child(s),i=o.type==n?t.type.schema.nodes.text:o.type;if(r=r.matchType(i),!r||!t.type.allowsMarks(o.marks))return!1}return r.validEnd}function ym(t,e){return!!(t&&e&&!t.isLeaf&&ZC(t,e))}function Pi(t,e,r=-1){let n=t.resolve(e);for(let s=n.depth;;s--){let o,i,a=n.index(s);if(s==n.depth?(o=n.nodeBefore,i=n.nodeAfter):r>0?(o=n.node(s+1),a++,i=n.node(s).maybeChild(a)):(o=n.node(s).maybeChild(a-1),i=n.node(s+1)),o&&!o.isTextblock&&ym(o,i)&&n.node(s).canReplace(a,a+1))return e;if(s==0)break;e=r<0?n.before(s):n.after(s)}}function XC(t,e,r){let n=null,{linebreakReplacement:s}=t.doc.type.schema,o=t.doc.resolve(e-r),i=o.node().type;if(s&&i.inlineContent){let d=i.whitespace=="pre",f=!!i.contentMatch.matchType(s);d&&!f?n=!1:!d&&f&&(n=!0)}let a=t.steps.length;if(n===!1){let d=t.doc.resolve(e+r);bm(t,d.node(),d.before(),a)}i.inlineContent&&Du(t,e+r-1,i,o.node().contentMatchAt(o.index()),n==null);let l=t.mapping.slice(a),c=l.map(e-r);if(t.step(new Me(c,l.map(e+r,-1),V.empty,!0)),n===!0){let d=t.doc.resolve(c);gm(t,d.node(),d.before(),t.steps.length)}return t}function QC(t,e,r){let n=t.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),r))return e;if(n.parentOffset==0)for(let s=n.depth-1;s>=0;s--){let o=n.index(s);if(n.node(s).canReplaceWith(o,o,r))return n.before(s+1);if(o>0)return null}if(n.parentOffset==n.parent.content.size)for(let s=n.depth-1;s>=0;s--){let o=n.indexAfter(s);if(n.node(s).canReplaceWith(o,o,r))return n.after(s+1);if(o<n.node(s).childCount)return null}return null}function xm(t,e,r){let n=t.resolve(e);if(!r.content.size)return e;let s=r.content;for(let o=0;o<r.openStart;o++)s=s.firstChild.content;for(let o=1;o<=(r.openStart==0&&r.size?2:1);o++)for(let i=n.depth;i>=0;i--){let a=i==n.depth?0:n.pos<=(n.start(i+1)+n.end(i+1))/2?-1:1,l=n.index(i)+(a>0?1:0),c=n.node(i),d=!1;if(o==1)d=c.canReplace(l,l,s);else{let f=c.contentMatchAt(l).findWrapping(s.firstChild.type);d=f&&c.canReplaceWith(l,l,f[0])}if(d)return a==0?n.pos:a<0?n.before(i+1):n.after(i+1)}return null}function zi(t,e,r=e,n=V.empty){if(e==r&&!n.size)return null;let s=t.resolve(e),o=t.resolve(r);return vm(s,o,n)?new Me(e,r,n):new ek(s,o,n).fit()}function vm(t,e,r){return!r.openStart&&!r.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),r.content)}class ek{constructor(e,r,n){this.$from=e,this.$to=r,this.unplaced=n,this.frontier=[],this.placed=_.empty;for(let s=0;s<=e.depth;s++){let o=e.node(s);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=_.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,n=this.$from,s=this.close(e<0?this.$to:n.doc.resolve(e));if(!s)return null;let o=this.placed,i=n.depth,a=s.depth;for(;i&&a&&o.childCount==1;)o=o.firstChild.content,i--,a--;let l=new V(o,i,a);return e>-1?new Be(n.pos,e,this.$to.pos,this.$to.end(),l,r):l.size||n.pos!=this.$to.pos?new Me(n.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let r=this.unplaced.content,n=0,s=this.unplaced.openEnd;n<e;n++){let o=r.firstChild;if(r.childCount>1&&(s=0),o.type.spec.isolating&&s<=n){e=n;break}r=o.content}for(let r=1;r<=2;r++)for(let n=r==1?e:this.unplaced.openStart;n>=0;n--){let s,o=null;n?(o=_a(this.unplaced.content,n-1).firstChild,s=o.content):s=this.unplaced.content;let i=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,f=null;if(r==1&&(i?c.matchType(i.type)||(f=c.fillBefore(_.from(i),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:a,parent:o,inject:f};if(r==2&&i&&(d=c.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:a,parent:o,wrap:d};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:r,openEnd:n}=this.unplaced,s=_a(e,r);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new V(e,r+1,Math.max(n,s.size+r>=e.size-n?r+1:0)),!0)}dropNode(){let{content:e,openStart:r,openEnd:n}=this.unplaced,s=_a(e,r);if(s.childCount<=1&&r>0){let o=e.size-r<=r+s.size;this.unplaced=new V(ps(e,r-1,1),r-1,o?r-1:n)}else this.unplaced=new V(ps(e,r,1),r,n)}placeNodes({sliceDepth:e,frontierDepth:r,parent:n,inject:s,wrap:o}){for(;this.depth>r;)this.closeFrontierNode();if(o)for(let x=0;x<o.length;x++)this.openFrontierNode(o[x]);let i=this.unplaced,a=n?n.content:i.content,l=i.openStart-e,c=0,d=[],{match:f,type:m}=this.frontier[r];if(s){for(let x=0;x<s.childCount;x++)d.push(s.child(x));f=f.matchFragment(s)}let g=a.size+e-(i.content.size-i.openEnd);for(;c<a.childCount;){let x=a.child(c),w=f.matchType(x.type);if(!w)break;c++,(c>1||l==0||x.content.size)&&(f=w,d.push(wm(x.mark(m.allowedMarks(x.marks)),c==1?l:0,c==a.childCount?g:-1)))}let y=c==a.childCount;y||(g=-1),this.placed=hs(this.placed,r,_.from(d)),this.frontier[r].match=f,y&&g<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,w=a;x<g;x++){let D=w.lastChild;this.frontier.push({type:D.type,match:D.contentMatchAt(D.childCount)}),w=D.content}this.unplaced=y?e==0?V.empty:new V(ps(i.content,e-1,1),e-1,g<0?i.openEnd:e-1):new V(ps(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],r;if(!e.type.isTextblock||!Ia(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(r=this.findCloseLevel(this.$to))&&r.depth==this.depth)return-1;let{depth:n}=this.$to,s=this.$to.after(n);for(;n>1&&s==this.$to.end(--n);)++s;return s}findCloseLevel(e){e:for(let r=Math.min(this.depth,e.depth);r>=0;r--){let{match:n,type:s}=this.frontier[r],o=r<e.depth&&e.end(r+1)==e.pos+(e.depth-(r+1)),i=Ia(e,r,s,n,o);if(i){for(let a=r-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Ia(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:r,fit:i,move:o?e.doc.resolve(e.after(r+1)):e}}}}close(e){let r=this.findCloseLevel(e);if(!r)return null;for(;this.depth>r.depth;)this.closeFrontierNode();r.fit.childCount&&(this.placed=hs(this.placed,r.depth,r.fit)),e=r.move;for(let n=r.depth+1;n<=e.depth;n++){let s=e.node(n),o=s.type.contentMatch.fillBefore(s.content,!0,e.index(n));this.openFrontierNode(s.type,s.attrs,o)}return e}openFrontierNode(e,r=null,n){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=hs(this.placed,this.depth,_.from(e.create(r,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let r=this.frontier.pop().match.fillBefore(_.empty,!0);r.childCount&&(this.placed=hs(this.placed,this.frontier.length,r))}}function ps(t,e,r){return e==0?t.cutByIndex(r,t.childCount):t.replaceChild(0,t.firstChild.copy(ps(t.firstChild.content,e-1,r)))}function hs(t,e,r){return e==0?t.append(r):t.replaceChild(t.childCount-1,t.lastChild.copy(hs(t.lastChild.content,e-1,r)))}function _a(t,e){for(let r=0;r<e;r++)t=t.firstChild.content;return t}function wm(t,e,r){if(e<=0)return t;let n=t.content;return e>1&&(n=n.replaceChild(0,wm(n.firstChild,e-1,n.childCount==1?r-1:0))),e>0&&(n=t.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(t.type.contentMatch.matchFragment(n).fillBefore(_.empty,!0)))),t.copy(n)}function Ia(t,e,r,n,s){let o=t.node(e),i=s?t.indexAfter(e):t.index(e);if(i==o.childCount&&!r.compatibleContent(o.type))return null;let a=n.fillBefore(o.content,!0,i);return a&&!tk(r,o.content,i)?a:null}function tk(t,e,r){for(let n=r;n<e.childCount;n++)if(!t.allowsMarks(e.child(n).marks))return!0;return!1}function rk(t){return t.spec.defining||t.spec.definingForContent}function nk(t,e,r,n){if(!n.size)return t.deleteRange(e,r);let s=t.doc.resolve(e),o=t.doc.resolve(r);if(vm(s,o,n))return t.step(new Me(e,r,n));let i=Cm(s,t.doc.resolve(r));i[i.length-1]==0&&i.pop();let a=-(s.depth+1);i.unshift(a);for(let m=s.depth,g=s.pos-1;m>0;m--,g--){let y=s.node(m).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;i.indexOf(m)>-1?a=m:s.before(m)==g&&i.splice(1,0,-m)}let l=i.indexOf(a),c=[],d=n.openStart;for(let m=n.content,g=0;;g++){let y=m.firstChild;if(c.push(y),g==n.openStart)break;m=y.content}for(let m=d-1;m>=0;m--){let g=c[m],y=rk(g.type);if(y&&!g.sameMarkup(s.node(Math.abs(a)-1)))d=m;else if(y||!g.type.isTextblock)break}for(let m=n.openStart;m>=0;m--){let g=(m+d+1)%(n.openStart+1),y=c[g];if(y)for(let x=0;x<i.length;x++){let w=i[(x+l)%i.length],D=!0;w<0&&(D=!1,w=-w);let E=s.node(w-1),S=s.index(w-1);if(E.canReplaceWith(S,S,y.type,y.marks))return t.replace(s.before(w),D?o.after(w):r,new V(Dm(n.content,0,n.openStart,g),g,n.openEnd))}}let f=t.steps.length;for(let m=i.length-1;m>=0&&(t.replace(e,r,n),!(t.steps.length>f));m--){let g=i[m];g<0||(e=s.before(g),r=o.after(g))}}function Dm(t,e,r,n,s){if(e<r){let o=t.firstChild;t=t.replaceChild(0,o.copy(Dm(o.content,e+1,r,n,o)))}if(e>n){let o=s.contentMatchAt(0),i=o.fillBefore(t).append(t);t=i.append(o.matchFragment(i).fillBefore(_.empty,!0))}return t}function sk(t,e,r,n){if(!n.isInline&&e==r&&t.doc.resolve(e).parent.content.size){let s=QC(t.doc,e,n.type);s!=null&&(e=r=s)}t.replaceRange(e,r,new V(_.from(n),0,0))}function ok(t,e,r){let n=t.doc.resolve(e),s=t.doc.resolve(r),o=Cm(n,s);for(let i=0;i<o.length;i++){let a=o[i],l=i==o.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return t.delete(n.start(a),s.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),s.indexAfter(a-1))))return t.delete(n.before(a),s.after(a))}for(let i=1;i<=n.depth&&i<=s.depth;i++)if(e-n.start(i)==n.depth-i&&r>n.end(i)&&s.end(i)-r!=s.depth-i&&n.start(i-1)==s.start(i-1)&&n.node(i-1).canReplace(n.index(i-1),s.index(i-1)))return t.delete(n.before(i),r);t.delete(e,r)}function Cm(t,e){let r=[],n=Math.min(t.depth,e.depth);for(let s=n;s>=0;s--){let o=t.start(s);if(o<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(o==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==o-1)&&r.push(s)}return r}class Sn extends Ue{constructor(e,r,n){super(),this.pos=e,this.attr=r,this.value=n}apply(e){let r=e.nodeAt(this.pos);if(!r)return Ce.fail("No node at attribute step's position");let n=Object.create(null);for(let o in r.attrs)n[o]=r.attrs[o];n[this.attr]=this.value;let s=r.type.create(n,null,r.marks);return Ce.fromReplace(e,this.pos,this.pos+1,new V(_.from(s),0,r.isLeaf?0:1))}getMap(){return nt.empty}invert(e){return new Sn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let r=e.mapResult(this.pos,1);return r.deletedAfter?null:new Sn(r.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,r){if(typeof r.pos!="number"||typeof r.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Sn(r.pos,r.attr,r.value)}}Ue.jsonID("attr",Sn);class Bs extends Ue{constructor(e,r){super(),this.attr=e,this.value=r}apply(e){let r=Object.create(null);for(let s in e.attrs)r[s]=e.attrs[s];r[this.attr]=this.value;let n=e.type.create(r,e.content,e.marks);return Ce.ok(n)}getMap(){return nt.empty}invert(e){return new Bs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,r){if(typeof r.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Bs(r.attr,r.value)}}Ue.jsonID("docAttr",Bs);let Tn=class extends Error{};Tn=function t(e){let r=Error.call(this,e);return r.__proto__=t.prototype,r};Tn.prototype=Object.create(Error.prototype);Tn.prototype.constructor=Tn;Tn.prototype.name="TransformError";class km{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ms}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let r=this.maybeStep(e);if(r.failed)throw new Tn(r.failed);return this}maybeStep(e){let r=e.apply(this.doc);return r.failed||this.addStep(e,r.doc),r}get docChanged(){return this.steps.length>0}addStep(e,r){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=r}replace(e,r=e,n=V.empty){let s=zi(this.doc,e,r,n);return s&&this.step(s),this}replaceWith(e,r,n){return this.replace(e,r,new V(_.from(n),0,0))}delete(e,r){return this.replace(e,r,V.empty)}insert(e,r){return this.replaceWith(e,e,r)}replaceRange(e,r,n){return nk(this,e,r,n),this}replaceRangeWith(e,r,n){return sk(this,e,r,n),this}deleteRange(e,r){return ok(this,e,r),this}lift(e,r){return VC(this,e,r),this}join(e,r=1){return XC(this,e,r),this}wrap(e,r){return UC(this,e,r),this}setBlockType(e,r=e,n,s=null){return KC(this,e,r,n,s),this}setNodeMarkup(e,r,n=null,s){return GC(this,e,r,n,s),this}setNodeAttribute(e,r,n){return this.step(new Sn(e,r,n)),this}setDocAttribute(e,r){return this.step(new Bs(e,r)),this}addNodeMark(e,r){return this.step(new fr(e,r)),this}removeNodeMark(e,r){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(r instanceof ue)r.isInSet(n.marks)&&this.step(new en(e,r));else{let s=n.marks,o,i=[];for(;o=r.isInSet(s);)i.push(new en(e,o)),s=o.removeFromSet(s);for(let a=i.length-1;a>=0;a--)this.step(i[a])}return this}split(e,r=1,n){return YC(this,e,r,n),this}addMark(e,r,n){return zC(this,e,r,n),this}removeMark(e,r,n){return $C(this,e,r,n),this}clearIncompatible(e,r,n){return Du(this,e,r,n),this}}const Ra=Object.create(null);class ne{constructor(e,r,n){this.$anchor=e,this.$head=r,this.ranges=n||[new ik(e.min(r),e.max(r))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let r=0;r<e.length;r++)if(e[r].$from.pos!=e[r].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,r=V.empty){let n=r.content.lastChild,s=null;for(let a=0;a<r.openEnd;a++)s=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:c}=i[a],d=e.mapping.slice(o);e.replaceRange(d.map(l.pos),d.map(c.pos),a?V.empty:r),a==0&&Ep(e,o,(n?n.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,r){let n=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:i,$to:a}=s[o],l=e.mapping.slice(n),c=l.map(i.pos),d=l.map(a.pos);o?e.deleteRange(c,d):(e.replaceRangeWith(c,d,r),Ep(e,n,r.isInline?-1:1))}}static findFrom(e,r,n=!1){let s=e.parent.inlineContent?new X(e):xn(e.node(0),e.parent,e.pos,e.index(),r,n);if(s)return s;for(let o=e.depth-1;o>=0;o--){let i=r<0?xn(e.node(0),e.node(o),e.before(o+1),e.index(o),r,n):xn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,r,n);if(i)return i}return null}static near(e,r=1){return this.findFrom(e,r)||this.findFrom(e,-r)||new ot(e.node(0))}static atStart(e){return xn(e,e,0,0,1)||new ot(e)}static atEnd(e){return xn(e,e,e.content.size,e.childCount,-1)||new ot(e)}static fromJSON(e,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ra[r.type];if(!n)throw new RangeError(`No selection type ${r.type} defined`);return n.fromJSON(e,r)}static jsonID(e,r){if(e in Ra)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ra[e]=r,r.prototype.jsonID=e,r}getBookmark(){return X.between(this.$anchor,this.$head).getBookmark()}}ne.prototype.visible=!0;class ik{constructor(e,r){this.$from=e,this.$to=r}}let Cp=!1;function kp(t){!Cp&&!t.parent.inlineContent&&(Cp=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class X extends ne{constructor(e,r=e){kp(e),kp(r),super(e,r)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,r){let n=e.resolve(r.map(this.head));if(!n.parent.inlineContent)return ne.near(n);let s=e.resolve(r.map(this.anchor));return new X(s.parent.inlineContent?s:n,n)}replace(e,r=V.empty){if(super.replace(e,r),r==V.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof X&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new $i(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,r){if(typeof r.anchor!="number"||typeof r.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new X(e.resolve(r.anchor),e.resolve(r.head))}static create(e,r,n=r){let s=e.resolve(r);return new this(s,n==r?s:e.resolve(n))}static between(e,r,n){let s=e.pos-r.pos;if((!n||s)&&(n=s>=0?1:-1),!r.parent.inlineContent){let o=ne.findFrom(r,n,!0)||ne.findFrom(r,-n,!0);if(o)r=o.$head;else return ne.near(r,n)}return e.parent.inlineContent||(s==0?e=r:(e=(ne.findFrom(e,-n,!0)||ne.findFrom(e,n,!0)).$anchor,e.pos<r.pos!=s<0&&(e=r))),new X(e,r)}}ne.jsonID("text",X);class $i{constructor(e,r){this.anchor=e,this.head=r}map(e){return new $i(e.map(this.anchor),e.map(this.head))}resolve(e){return X.between(e.resolve(this.anchor),e.resolve(this.head))}}class G extends ne{constructor(e){let r=e.nodeAfter,n=e.node(0).resolve(e.pos+r.nodeSize);super(e,n),this.node=r}map(e,r){let{deleted:n,pos:s}=r.mapResult(this.anchor),o=e.resolve(s);return n?ne.near(o):new G(o)}content(){return new V(_.from(this.node),0,0)}eq(e){return e instanceof G&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ku(this.anchor)}static fromJSON(e,r){if(typeof r.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new G(e.resolve(r.anchor))}static create(e,r){return new G(e.resolve(r))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}G.prototype.visible=!1;ne.jsonID("node",G);class ku{constructor(e){this.anchor=e}map(e){let{deleted:r,pos:n}=e.mapResult(this.anchor);return r?new $i(n,n):new ku(n)}resolve(e){let r=e.resolve(this.anchor),n=r.nodeAfter;return n&&G.isSelectable(n)?new G(r):ne.near(r)}}class ot extends ne{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,r=V.empty){if(r==V.empty){e.delete(0,e.doc.content.size);let n=ne.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,r)}toJSON(){return{type:"all"}}static fromJSON(e){return new ot(e)}map(e){return new ot(e)}eq(e){return e instanceof ot}getBookmark(){return ak}}ne.jsonID("all",ot);const ak={map(){return this},resolve(t){return new ot(t)}};function xn(t,e,r,n,s,o=!1){if(e.inlineContent)return X.create(t,r);for(let i=n-(s>0?0:1);s>0?i<e.childCount:i>=0;i+=s){let a=e.child(i);if(a.isAtom){if(!o&&G.isSelectable(a))return G.create(t,r-(s<0?a.nodeSize:0))}else{let l=xn(t,a,r+s,s<0?a.childCount:0,s,o);if(l)return l}r+=a.nodeSize*s}return null}function Ep(t,e,r){let n=t.steps.length-1;if(n<e)return;let s=t.steps[n];if(!(s instanceof Me||s instanceof Be))return;let o=t.mapping.maps[n],i;o.forEach((a,l,c,d)=>{i==null&&(i=d)}),t.setSelection(ne.near(t.doc.resolve(i),r))}const Sp=1,vo=2,Fp=4;class lk extends km{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Sp)&~vo,this.storedMarks=null,this}get selectionSet(){return(this.updated&Sp)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=vo,this}ensureMarks(e){return ue.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&vo)>0}addStep(e,r){super.addStep(e,r),this.updated=this.updated&~vo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,r=!0){let n=this.selection;return r&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||ue.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,r,n){let s=this.doc.type.schema;if(r==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(n==null&&(n=r),!e)return this.deleteRange(r,n);let o=this.storedMarks;if(!o){let i=this.doc.resolve(r);o=n==r?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(r,n,s.text(e,o)),!this.selection.empty&&this.selection.to==r+e.length&&this.setSelection(ne.near(this.selection.$to)),this}}setMeta(e,r){return this.meta[typeof e=="string"?e:e.key]=r,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Fp,this}get scrolledIntoView(){return(this.updated&Fp)>0}}function Ap(t,e){return!e||!t?t:t.bind(e)}class fs{constructor(e,r,n){this.name=e,this.init=Ap(r.init,n),this.apply=Ap(r.apply,n)}}const uk=[new fs("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new fs("selection",{init(t,e){return t.selection||ne.atStart(e.doc)},apply(t){return t.selection}}),new fs("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,r,n){return n.selection.$cursor?t.storedMarks:null}}),new fs("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Pa{constructor(e,r){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=uk.slice(),r&&r.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new fs(n.key,n.spec.state,n))})}}class En{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,r=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=r){let s=this.config.plugins[n];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let r=[e],n=this.applyInner(e),s=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let a=this.config.plugins[i];if(a.spec.appendTransaction){let l=s?s[i].n:0,c=s?s[i].state:this,d=l<r.length&&a.spec.appendTransaction.call(a,l?r.slice(l):r,c,n);if(d&&n.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let f=0;f<this.config.plugins.length;f++)s.push(f<i?{state:n,n:r.length}:{state:this,n:0})}r.push(d),n=n.applyInner(d),o=!0}s&&(s[i]={state:n,n:r.length})}}if(!o)return{state:n,transactions:r}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let r=new En(this.config),n=this.config.fields;for(let s=0;s<n.length;s++){let o=n[s];r[o.name]=o.apply(e,this[o.name],this,r)}return r}get tr(){return new lk(this)}static create(e){let r=new Pa(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new En(r);for(let s=0;s<r.fields.length;s++)n[r.fields[s].name]=r.fields[s].init(e,n);return n}reconfigure(e){let r=new Pa(this.schema,e.plugins),n=r.fields,s=new En(r);for(let o=0;o<n.length;o++){let i=n[o].name;s[i]=this.hasOwnProperty(i)?this[i]:n[o].init(e,s)}return s}toJSON(e){let r={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(r.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[n],o=s.spec.state;o&&o.toJSON&&(r[n]=o.toJSON.call(s,this[s.key]))}return r}static fromJSON(e,r,n){if(!r)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Pa(e.schema,e.plugins),o=new En(s);return s.fields.forEach(i=>{if(i.name=="doc")o.doc=Ct.fromJSON(e.schema,r.doc);else if(i.name=="selection")o.selection=ne.fromJSON(o.doc,r.selection);else if(i.name=="storedMarks")r.storedMarks&&(o.storedMarks=r.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],c=l.spec.state;if(l.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(r,a)){o[i.name]=c.fromJSON.call(l,e,r[a],o);return}}o[i.name]=i.init(e,o)}}),o}}function Em(t,e,r){for(let n in t){let s=t[n];s instanceof Function?s=s.bind(e):n=="handleDOMEvents"&&(s=Em(s,e,{})),r[n]=s}return r}class ye{constructor(e){this.spec=e,this.props={},e.props&&Em(e.props,this,this.props),this.key=e.key?e.key.key:Sm("plugin")}getState(e){return e[this.key]}}const za=Object.create(null);function Sm(t){return t in za?t+"$"+ ++za[t]:(za[t]=0,t+"$")}class Oe{constructor(e="key"){this.key=Sm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Eu=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Fm(t,e){let{$cursor:r}=t.selection;return!r||(e?!e.endOfTextblock("backward",t):r.parentOffset>0)?null:r}const Am=(t,e,r)=>{let n=Fm(t,r);if(!n)return!1;let s=Su(n);if(!s){let i=n.blockRange(),a=i&&Hn(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}let o=s.nodeBefore;if(Im(t,s,e,-1))return!0;if(n.parent.content.size==0&&(Mn(o,"end")||G.isSelectable(o)))for(let i=n.depth;;i--){let a=zi(t.doc,n.before(i),n.after(i),V.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Mn(o,"end")?ne.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):G.create(l.doc,s.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(i==1||n.node(i-1).childCount>1)break}return o.isAtom&&s.depth==n.depth-1?(e&&e(t.tr.delete(s.pos-o.nodeSize,s.pos).scrollIntoView()),!0):!1},ck=(t,e,r)=>{let n=Fm(t,r);if(!n)return!1;let s=Su(n);return s?Nm(t,s,e):!1},dk=(t,e,r)=>{let n=Mm(t,r);if(!n)return!1;let s=Fu(n);return s?Nm(t,s,e):!1};function Nm(t,e,r){let n=e.nodeBefore,s=n,o=e.pos-1;for(;!s.isTextblock;o--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let i=e.nodeAfter,a=i,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=zi(t.doc,o,l,V.empty);if(!c||c.from!=o||c instanceof Me&&c.slice.size>=l-o)return!1;if(r){let d=t.tr.step(c);d.setSelection(X.create(d.doc,o)),r(d.scrollIntoView())}return!0}function Mn(t,e,r=!1){for(let n=t;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&n.childCount!=1)return!1}return!1}const Tm=(t,e,r)=>{let{$head:n,empty:s}=t.selection,o=n;if(!s)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",t):n.parentOffset>0)return!1;o=Su(n)}let i=o&&o.nodeBefore;return!i||!G.isSelectable(i)?!1:(e&&e(t.tr.setSelection(G.create(t.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)};function Su(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 Mm(t,e){let{$cursor:r}=t.selection;return!r||(e?!e.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)?null:r}const Bm=(t,e,r)=>{let n=Mm(t,r);if(!n)return!1;let s=Fu(n);if(!s)return!1;let o=s.nodeAfter;if(Im(t,s,e,1))return!0;if(n.parent.content.size==0&&(Mn(o,"start")||G.isSelectable(o))){let i=zi(t.doc,n.before(),n.after(),V.empty);if(i&&i.slice.size<i.to-i.from){if(e){let a=t.tr.step(i);a.setSelection(Mn(o,"start")?ne.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):G.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&s.depth==n.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+o.nodeSize).scrollIntoView()),!0):!1},jm=(t,e,r)=>{let{$head:n,empty:s}=t.selection,o=n;if(!s)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)return!1;o=Fu(n)}let i=o&&o.nodeAfter;return!i||!G.isSelectable(i)?!1:(e&&e(t.tr.setSelection(G.create(t.doc,o.pos)).scrollIntoView()),!0)};function Fu(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let r=t.node(e);if(t.index(e)+1<r.childCount)return t.doc.resolve(t.after(e+1));if(r.type.spec.isolating)break}return null}const pk=(t,e)=>{let r=t.selection,n=r instanceof G,s;if(n){if(r.node.isTextblock||!Fr(t.doc,r.from))return!1;s=r.from}else if(s=Pi(t.doc,r.from,-1),s==null)return!1;if(e){let o=t.tr.join(s);n&&o.setSelection(G.create(o.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},hk=(t,e)=>{let r=t.selection,n;if(r instanceof G){if(r.node.isTextblock||!Fr(t.doc,r.to))return!1;n=r.to}else if(n=Pi(t.doc,r.to,1),n==null)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0},fk=(t,e)=>{let{$from:r,$to:n}=t.selection,s=r.blockRange(n),o=s&&Hn(s);return o==null?!1:(e&&e(t.tr.lift(s,o).scrollIntoView()),!0)},Om=(t,e)=>{let{$head:r,$anchor:n}=t.selection;return!r.parent.type.spec.code||!r.sameParent(n)?!1:(e&&e(t.tr.insertText(`
71
+ `).scrollIntoView()),!0)};function Au(t){for(let e=0;e<t.edgeCount;e++){let{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}const mk=(t,e)=>{let{$head:r,$anchor:n}=t.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let s=r.node(-1),o=r.indexAfter(-1),i=Au(s.contentMatchAt(o));if(!i||!s.canReplaceWith(o,o,i))return!1;if(e){let a=r.after(),l=t.tr.replaceWith(a,a,i.createAndFill());l.setSelection(ne.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Lm=(t,e)=>{let r=t.selection,{$from:n,$to:s}=r;if(r instanceof ot||n.parent.inlineContent||s.parent.inlineContent)return!1;let o=Au(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let i=(!n.parentOffset&&s.index()<s.parent.childCount?n:s).pos,a=t.tr.insert(i,o.createAndFill());a.setSelection(X.create(a.doc,i+1)),e(a.scrollIntoView())}return!0},_m=(t,e)=>{let{$cursor:r}=t.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let o=r.before();if(Wt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let n=r.blockRange(),s=n&&Hn(n);return s==null?!1:(e&&e(t.tr.lift(n,s).scrollIntoView()),!0)};function gk(t){return(e,r)=>{let{$from:n,$to:s}=e.selection;if(e.selection instanceof G&&e.selection.node.isBlock)return!n.parentOffset||!Wt(e.doc,n.pos)?!1:(r&&r(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let o=[],i,a,l=!1,c=!1;for(let g=n.depth;;g--)if(n.node(g).isBlock){l=n.end(g)==n.pos+(n.depth-g),c=n.start(g)==n.pos-(n.depth-g),a=Au(n.node(g-1).contentMatchAt(n.indexAfter(g-1))),o.unshift(l&&a?{type:a}:null),i=g;break}else{if(g==1)return!1;o.unshift(null)}let d=e.tr;(e.selection instanceof X||e.selection instanceof ot)&&d.deleteSelection();let f=d.mapping.map(n.pos),m=Wt(d.doc,f,o.length,o);if(m||(o[0]=a?{type:a}:null,m=Wt(d.doc,f,o.length,o)),!m)return!1;if(d.split(f,o.length,o),!l&&c&&n.node(i).type!=a){let g=d.mapping.map(n.before(i)),y=d.doc.resolve(g);a&&n.node(i-1).canReplaceWith(y.index(),y.index()+1,a)&&d.setNodeMarkup(d.mapping.map(n.before(i)),a)}return r&&r(d.scrollIntoView()),!0}}const bk=gk(),yk=(t,e)=>{let{$from:r,to:n}=t.selection,s,o=r.sharedDepth(n);return o==0?!1:(s=r.before(o),e&&e(t.tr.setSelection(G.create(t.doc,s))),!0)};function xk(t,e,r){let n=e.nodeBefore,s=e.nodeAfter,o=e.index();return!n||!s||!n.type.compatibleContent(s.type)?!1:!n.content.size&&e.parent.canReplace(o-1,o)?(r&&r(t.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(s.isTextblock||Fr(t.doc,e.pos))?!1:(r&&r(t.tr.join(e.pos).scrollIntoView()),!0)}function Im(t,e,r,n){let s=e.nodeBefore,o=e.nodeAfter,i,a,l=s.type.spec.isolating||o.type.spec.isolating;if(!l&&xk(t,e,r))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(a=s.contentMatchAt(s.childCount)).findWrapping(o.type))&&a.matchType(i[0]||o.type).validEnd){if(r){let g=e.pos+o.nodeSize,y=_.empty;for(let D=i.length-1;D>=0;D--)y=_.from(i[D].create(null,y));y=_.from(s.copy(y));let x=t.tr.step(new Be(e.pos-1,g,e.pos,g,new V(y,1,0),i.length,!0)),w=x.doc.resolve(g+2*i.length);w.nodeAfter&&w.nodeAfter.type==s.type&&Fr(x.doc,w.pos)&&x.join(w.pos),r(x.scrollIntoView())}return!0}let d=o.type.spec.isolating||n>0&&l?null:ne.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),m=f&&Hn(f);if(m!=null&&m>=e.depth)return r&&r(t.tr.lift(f,m).scrollIntoView()),!0;if(c&&Mn(o,"start",!0)&&Mn(s,"end")){let g=s,y=[];for(;y.push(g),!g.isTextblock;)g=g.lastChild;let x=o,w=1;for(;!x.isTextblock;x=x.firstChild)w++;if(g.canReplace(g.childCount,g.childCount,x.content)){if(r){let D=_.empty;for(let S=y.length-1;S>=0;S--)D=_.from(y[S].copy(D));let E=t.tr.step(new Be(e.pos-y.length,e.pos+o.nodeSize,e.pos+w,e.pos+o.nodeSize-w,new V(D,y.length,0),0,!0));r(E.scrollIntoView())}return!0}}return!1}function Rm(t){return function(e,r){let n=e.selection,s=t<0?n.$from:n.$to,o=s.depth;for(;s.node(o).isInline;){if(!o)return!1;o--}return s.node(o).isTextblock?(r&&r(e.tr.setSelection(X.create(e.doc,t<0?s.start(o):s.end(o)))),!0):!1}}const vk=Rm(-1),wk=Rm(1);function Dk(t,e=null){return function(r,n){let{$from:s,$to:o}=r.selection,i=s.blockRange(o),a=i&&Cu(i,t,e);return a?(n&&n(r.tr.wrap(i,a).scrollIntoView()),!0):!1}}function Np(t,e=null){return function(r,n){let s=!1;for(let o=0;o<r.selection.ranges.length&&!s;o++){let{$from:{pos:i},$to:{pos:a}}=r.selection.ranges[o];r.doc.nodesBetween(i,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let d=r.doc.resolve(c),f=d.index();s=d.parent.canReplaceWith(f,f+1,t)}})}if(!s)return!1;if(n){let o=r.tr;for(let i=0;i<r.selection.ranges.length;i++){let{$from:{pos:a},$to:{pos:l}}=r.selection.ranges[i];o.setBlockType(a,l,t,e)}n(o.scrollIntoView())}return!0}}function Nu(...t){return function(e,r,n){for(let s=0;s<t.length;s++)if(t[s](e,r,n))return!0;return!1}}Nu(Eu,Am,Tm);Nu(Eu,Bm,jm);Nu(Om,Lm,_m,bk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Ck(t,e=null){return function(r,n){let{$from:s,$to:o}=r.selection,i=s.blockRange(o);if(!i)return!1;let a=n?r.tr:null;return kk(a,i,t,e)?(n&&n(a.scrollIntoView()),!0):!1}}function kk(t,e,r,n=null){let s=!1,o=e,i=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(r)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=i.resolve(e.start-2);o=new qo(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new qo(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=Cu(o,r,n,e);return a?(t&&Ek(t,e,a,s,r),!0):!1}function Ek(t,e,r,n,s){let o=_.empty;for(let d=r.length-1;d>=0;d--)o=_.from(r[d].type.create(r[d].attrs,o));t.step(new Be(e.start-(n?2:0),e.end,e.start,e.end,new V(o,0,0),r.length,!0));let i=0;for(let d=0;d<r.length;d++)r[d].type==s&&(i=d+1);let a=r.length-i,l=e.start+r.length-(n?2:0),c=e.parent;for(let d=e.startIndex,f=e.endIndex,m=!0;d<f;d++,m=!1)!m&&Wt(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return t}function Sk(t){return function(e,r){let{$from:n,$to:s}=e.selection,o=n.blockRange(s,i=>i.childCount>0&&i.firstChild.type==t);return o?r?n.node(o.depth-1).type==t?Fk(e,r,t,o):Ak(e,r,o):!0:!1}}function Fk(t,e,r,n){let s=t.tr,o=n.end,i=n.$to.end(n.depth);o<i&&(s.step(new Be(o-1,i,o,i,new V(_.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new qo(s.doc.resolve(n.$from.pos),s.doc.resolve(i),n.depth));const a=Hn(n);if(a==null)return!1;s.lift(n,a);let l=s.doc.resolve(s.mapping.map(o,-1)-1);return Fr(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function Ak(t,e,r){let n=t.tr,s=r.parent;for(let g=r.end,y=r.endIndex-1,x=r.startIndex;y>x;y--)g-=s.child(y).nodeSize,n.delete(g-1,g+1);let o=n.doc.resolve(r.start),i=o.nodeAfter;if(n.mapping.map(r.end)!=r.start+o.nodeAfter.nodeSize)return!1;let a=r.startIndex==0,l=r.endIndex==s.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+(a?0:1),d+1,i.content.append(l?_.empty:_.from(s))))return!1;let f=o.pos,m=f+i.nodeSize;return n.step(new Be(f-(a?1:0),m+(l?1:0),f+1,m-1,new V((a?_.empty:_.from(s.copy(_.empty))).append(l?_.empty:_.from(s.copy(_.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function Nk(t){return function(e,r){let{$from:n,$to:s}=e.selection,o=n.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let i=o.startIndex;if(i==0)return!1;let a=o.parent,l=a.child(i-1);if(l.type!=t)return!1;if(r){let c=l.lastChild&&l.lastChild.type==a.type,d=_.from(c?t.create():null),f=new V(_.from(t.create(null,_.from(a.type.create(null,d)))),c?3:1,0),m=o.start,g=o.end;r(e.tr.step(new Be(m-(c?3:1),g,m,g,f,1,!0)).scrollIntoView())}return!0}}const Re=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Bn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let kl=null;const Vt=function(t,e,r){let n=kl||(kl=document.createRange());return n.setEnd(t,r??t.nodeValue.length),n.setStart(t,e||0),n},Tk=function(){kl=null},tn=function(t,e,r,n){return r&&(Tp(t,e,r,n,-1)||Tp(t,e,r,n,1))},Mk=/^(img|br|input|textarea|hr)$/i;function Tp(t,e,r,n,s){for(var o;;){if(t==r&&e==n)return!0;if(e==(s<0?0:pt(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Hs(t)||Mk.test(t.nodeName)||t.contentEditable=="false")return!1;e=Re(t)+(s<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(s<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((o=i.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=s;else return!1;else t=i,e=s<0?pt(t):0}else return!1}}function pt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Bk(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=pt(t)}else if(t.parentNode&&!Hs(t))e=Re(t),t=t.parentNode;else return null}}function jk(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Hs(t))e=Re(t)+1,t=t.parentNode;else return null}}function Ok(t,e,r){for(let n=e==0,s=e==pt(t);n||s;){if(t==r)return!0;let o=Re(t);if(t=t.parentNode,!t)return!1;n=n&&o==0,s=s&&o==pt(t)}}function Hs(t){let e;for(let r=t;r&&!(e=r.pmViewDesc);r=r.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Hi=function(t){return t.focusNode&&tn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Pr(t,e){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=t,r.key=r.code=e,r}function Lk(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function _k(t,e,r){if(t.caretPositionFromPoint)try{let n=t.caretPositionFromPoint(e,r);if(n)return{node:n.offsetNode,offset:Math.min(pt(n.offsetNode),n.offset)}}catch{}if(t.caretRangeFromPoint){let n=t.caretRangeFromPoint(e,r);if(n)return{node:n.startContainer,offset:Math.min(pt(n.startContainer),n.startOffset)}}}const Mt=typeof navigator<"u"?navigator:null,Mp=typeof document<"u"?document:null,Ar=Mt&&Mt.userAgent||"",El=/Edge\/(\d+)/.exec(Ar),Pm=/MSIE \d/.exec(Ar),Sl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ar),tt=!!(Pm||Sl||El),xr=Pm?document.documentMode:Sl?+Sl[1]:El?+El[1]:0,ht=!tt&&/gecko\/(\d+)/i.test(Ar);ht&&+(/Firefox\/(\d+)/.exec(Ar)||[0,0])[1];const Fl=!tt&&/Chrome\/(\d+)/.exec(Ar),We=!!Fl,zm=Fl?+Fl[1]:0,Ye=!tt&&!!Mt&&/Apple Computer/.test(Mt.vendor),jn=Ye&&(/Mobile\/\w+/.test(Ar)||!!Mt&&Mt.maxTouchPoints>2),dt=jn||(Mt?/Mac/.test(Mt.platform):!1),Ik=Mt?/Win/.test(Mt.platform):!1,qt=/Android \d/.test(Ar),Vs=!!Mp&&"webkitFontSmoothing"in Mp.documentElement.style,Rk=Vs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Pk(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 Rt(t,e){return typeof t=="number"?t:t[e]}function zk(t){let e=t.getBoundingClientRect(),r=e.width/t.offsetWidth||1,n=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*r,top:e.top,bottom:e.top+t.clientHeight*n}}function Bp(t,e,r){let n=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let i=r||t.dom;i;){if(i.nodeType!=1){i=Bn(i);continue}let a=i,l=a==o.body,c=l?Pk(o):zk(a),d=0,f=0;if(e.top<c.top+Rt(n,"top")?f=-(c.top-e.top+Rt(s,"top")):e.bottom>c.bottom-Rt(n,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+Rt(s,"top")-c.top:e.bottom-c.bottom+Rt(s,"bottom")),e.left<c.left+Rt(n,"left")?d=-(c.left-e.left+Rt(s,"left")):e.right>c.right-Rt(n,"right")&&(d=e.right-c.right+Rt(s,"right")),d||f)if(l)o.defaultView.scrollBy(d,f);else{let g=a.scrollLeft,y=a.scrollTop;f&&(a.scrollTop+=f),d&&(a.scrollLeft+=d);let x=a.scrollLeft-g,w=a.scrollTop-y;e={left:e.left-x,top:e.top-w,right:e.right-x,bottom:e.bottom-w}}let m=l?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(m))break;i=m=="absolute"?i.offsetParent:Bn(i)}}function $k(t){let e=t.dom.getBoundingClientRect(),r=Math.max(0,e.top),n,s;for(let o=(e.left+e.right)/2,i=r+1;i<Math.min(innerHeight,e.bottom);i+=5){let a=t.root.elementFromPoint(o,i);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=r-20){n=a,s=l.top;break}}return{refDOM:n,refTop:s,stack:$m(t.dom)}}function $m(t){let e=[],r=t.ownerDocument;for(let n=t;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),t!=r);n=Bn(n));return e}function Hk({refDOM:t,refTop:e,stack:r}){let n=t?t.getBoundingClientRect().top:0;Hm(r,n==0?0:n-e)}function Hm(t,e){for(let r=0;r<t.length;r++){let{dom:n,top:s,left:o}=t[r];n.scrollTop!=s+e&&(n.scrollTop=s+e),n.scrollLeft!=o&&(n.scrollLeft=o)}}let bn=null;function Vk(t){if(t.setActive)return t.setActive();if(bn)return t.focus(bn);let e=$m(t);t.focus(bn==null?{get preventScroll(){return bn={preventScroll:!0},!0}}:void 0),bn||(bn=!1,Hm(e,0))}function Vm(t,e){let r,n=2e8,s,o=0,i=e.top,a=e.top,l,c;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let m;if(d.nodeType==1)m=d.getClientRects();else if(d.nodeType==3)m=Vt(d).getClientRects();else continue;for(let g=0;g<m.length;g++){let y=m[g];if(y.top<=i&&y.bottom>=a){i=Math.max(y.bottom,i),a=Math.min(y.top,a);let x=y.left>e.left?y.left-e.left:y.right<e.left?e.left-y.right:0;if(x<n){r=d,n=x,s=x&&r.nodeType==3?{left:y.right<e.left?y.right:y.left,top:e.top}:e,d.nodeType==1&&x&&(o=f+(e.left>=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!l&&y.left<=e.left&&y.right>=e.left&&(l=d,c={left:Math.max(y.left,Math.min(y.right,e.left)),top:y.top});!r&&(e.left>=y.right&&e.top>=y.top||e.left>=y.left&&e.top>=y.bottom)&&(o=f+1)}}return!r&&l&&(r=l,s=c,n=0),r&&r.nodeType==3?qk(r,s):!r||n&&r.nodeType==1?{node:t,offset:o}:Vm(r,s)}function qk(t,e){let r=t.nodeValue.length,n=document.createRange();for(let s=0;s<r;s++){n.setEnd(t,s+1),n.setStart(t,s);let o=ar(n,1);if(o.top!=o.bottom&&Tu(e,o))return{node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function Tu(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Wk(t,e){let r=t.parentNode;return r&&/^li$/i.test(r.nodeName)&&e.left<t.getBoundingClientRect().left?r:t}function Uk(t,e,r){let{node:n,offset:s}=Vm(e,r),o=-1;if(n.nodeType==1&&!n.firstChild){let i=n.getBoundingClientRect();o=i.left!=i.right&&r.left>(i.left+i.right)/2?1:-1}return t.docView.posFromDOM(n,s,o)}function Kk(t,e,r,n){let s=-1;for(let o=e,i=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!i&&l.left>n.left||l.top>n.top?s=a.posBefore:(!i&&l.right<n.left||l.bottom<n.top)&&(s=a.posAfter),i=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,r,-1)}function qm(t,e,r){let n=t.childNodes.length;if(n&&r.top<r.bottom)for(let s=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-r.top)/(r.bottom-r.top))-2)),o=s;;){let i=t.childNodes[o];if(i.nodeType==1){let a=i.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Tu(e,c))return qm(i,e,c)}}if((o=(o+1)%n)==s)break}return t}function Jk(t,e){let r=t.dom.ownerDocument,n,s=0,o=_k(r,e.left,e.top);o&&({node:n,offset:s}=o);let i=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top),a;if(!i||!t.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=t.dom.getBoundingClientRect();if(!Tu(e,c)||(i=qm(t.dom,e,c),!i))return null}if(Ye)for(let c=i;n&&c;c=Bn(c))c.draggable&&(n=void 0);if(i=Wk(i,e),n){if(ht&&n.nodeType==1&&(s=Math.min(s,n.childNodes.length),s<n.childNodes.length)){let d=n.childNodes[s],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&s++}let c;Vs&&s&&n.nodeType==1&&(c=n.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,n==t.dom&&s==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||n.nodeType!=1||n.childNodes[s-1].nodeName!="BR")&&(a=Kk(t,n,s,e))}a==null&&(a=Uk(t,i,e));let l=t.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function jp(t){return t.top<t.bottom||t.left<t.right}function ar(t,e){let r=t.getClientRects();if(r.length){let n=r[e<0?0:r.length-1];if(jp(n))return n}return Array.prototype.find.call(r,jp)||t.getBoundingClientRect()}const Gk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Wm(t,e,r){let{node:n,offset:s,atom:o}=t.docView.domFromPos(e,r<0?-1:1),i=Vs||ht;if(n.nodeType==3)if(i&&(Gk.test(n.nodeValue)||(r<0?!s:s==n.nodeValue.length))){let l=ar(Vt(n,s,s),r);if(ht&&s&&/\s/.test(n.nodeValue[s-1])&&s<n.nodeValue.length){let c=ar(Vt(n,s-1,s-1),-1);if(c.top==l.top){let d=ar(Vt(n,s,s+1),-1);if(d.top!=l.top)return ls(d,d.left<c.left)}}return l}else{let l=s,c=s,d=r<0?1:-1;return r<0&&!s?(c++,d=-1):r>=0&&s==n.nodeValue.length?(l--,d=1):r<0?l--:c++,ls(ar(Vt(n,l,c),d),d<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&s&&(r<0||s==pt(n))){let l=n.childNodes[s-1];if(l.nodeType==1)return $a(l.getBoundingClientRect(),!1)}if(o==null&&s<pt(n)){let l=n.childNodes[s];if(l.nodeType==1)return $a(l.getBoundingClientRect(),!0)}return $a(n.getBoundingClientRect(),r>=0)}if(o==null&&s&&(r<0||s==pt(n))){let l=n.childNodes[s-1],c=l.nodeType==3?Vt(l,pt(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ls(ar(c,1),!1)}if(o==null&&s<pt(n)){let l=n.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Vt(l,0,i?0:1):l.nodeType==1?l:null:null;if(c)return ls(ar(c,-1),!0)}return ls(ar(n.nodeType==3?Vt(n):n,-r),r>=0)}function ls(t,e){if(t.width==0)return t;let r=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:r,right:r}}function $a(t,e){if(t.height==0)return t;let r=e?t.top:t.bottom;return{top:r,bottom:r,left:t.left,right:t.right}}function Um(t,e,r){let n=t.state,s=t.root.activeElement;n!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return r()}finally{n!=e&&t.updateState(n),s!=t.dom&&s&&s.focus()}}function Yk(t,e,r){let n=e.selection,s=r=="up"?n.$from:n.$to;return Um(t,e,()=>{let{node:o}=t.docView.domFromPos(s.pos,r=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let i=Wm(t,s.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Vt(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(r=="up"?i.top-d.top>(d.bottom-i.top)*2:d.bottom-i.bottom>(i.bottom-d.top)*2))return!1}}return!0})}const Zk=/[\u0590-\u08ac]/;function Xk(t,e,r){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let s=n.parentOffset,o=!s,i=s==n.parent.content.size,a=t.domSelection();return a?!Zk.test(n.parent.textContent)||!a.modify?r=="left"||r=="backward"?o:i:Um(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),m=a.caretBidiLevel;a.modify("move",r,"character");let g=n.depth?t.docView.domAfterPos(n.before()):t.dom,{focusNode:y,focusOffset:x}=t.domSelectionRange(),w=y&&!g.contains(y.nodeType==1?y:y.parentNode)||l==y&&c==x;try{a.collapse(d,f),l&&(l!=d||c!=f)&&a.extend&&a.extend(l,c)}catch{}return m!=null&&(a.caretBidiLevel=m),w}):n.pos==n.start()||n.pos==n.end()}let Op=null,Lp=null,_p=!1;function Qk(t,e,r){return Op==e&&Lp==r?_p:(Op=e,Lp=r,_p=r=="up"||r=="down"?Yk(t,e,r):Xk(t,e,r))}const ft=0,Ip=1,Hr=2,Bt=3;class qs{constructor(e,r,n,s){this.parent=e,this.children=r,this.dom=n,this.contentDOM=s,this.dirty=ft,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,r,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let r=0;r<this.children.length;r++)e+=this.children[r].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let r=0,n=this.posAtStart;;r++){let s=this.children[r];if(s==e)return n;n+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,r,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let o,i;if(e==this.contentDOM)o=e.childNodes[r-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(i)+i.size:this.posAtStart}else{let o,i;if(e==this.contentDOM)o=e.childNodes[r];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(i):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=r>Re(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(r==0)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!1;break}if(o.previousSibling)break}if(s==null&&r==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!0;break}if(o.nextSibling)break}}return s??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,r=!1){for(let n=!0,s=e;s;s=s.parentNode){let o=this.getDesc(s),i;if(o&&(!r||o.node))if(n&&(i=o.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))n=!1;else return o}}getDesc(e){let r=e.pmViewDesc;for(let n=r;n;n=n.parent)if(n==this)return r}posFromDOM(e,r,n){for(let s=e;s;s=s.parentNode){let o=this.getDesc(s);if(o)return o.localPosFromDOM(e,r,n)}return-1}descAt(e){for(let r=0,n=0;r<this.children.length;r++){let s=this.children[r],o=n+s.size;if(n==e&&o!=n){for(;!s.border&&s.children.length;)for(let i=0;i<s.children.length;i++){let a=s.children[i];if(a.size){s=a;break}}return s}if(e<o)return s.descAt(e-n-s.border);n=o}}domFromPos(e,r){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,s=0;for(let o=0;n<this.children.length;n++){let i=this.children[n],a=o+i.size;if(a>e||i instanceof Jm){s=e-o;break}o=a}if(s)return this.children[n].domFromPos(s-this.children[n].border,r);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof Km&&o.side>=0;n--);if(r<=0){let o,i=!0;for(;o=n?this.children[n-1]:null,!(!o||o.dom.parentNode==this.contentDOM);n--,i=!1);return o&&r&&i&&!o.border&&!o.domAtom?o.domFromPos(o.size,r):{node:this.contentDOM,offset:o?Re(o.dom)+1:0}}else{let o,i=!0;for(;o=n<this.children.length?this.children[n]:null,!(!o||o.dom.parentNode==this.contentDOM);n++,i=!1);return o&&i&&!o.border&&!o.domAtom?o.domFromPos(0,r):{node:this.contentDOM,offset:o?Re(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,r,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:r,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,o=-1;for(let i=n,a=0;;a++){let l=this.children[a],c=i+l.size;if(s==-1&&e<=c){let d=i+l.border;if(e>=d&&r<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,r,d);e=i;for(let f=a;f>0;f--){let m=this.children[f-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){s=Re(m.dom)+1;break}e-=m.size}s==-1&&(s=0)}if(s>-1&&(c>r||a==this.children.length-1)){r=c;for(let d=a+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Re(f.dom);break}r+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:r,fromOffset:s,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let r=this.children[e<0?0:this.children.length-1];return r.size==0||r.emptyChildAt(e)}domAfterPos(e){let{node:r,offset:n}=this.domFromPos(e,0);if(r.nodeType!=1||n==r.childNodes.length)throw new RangeError("No node after pos "+e);return r.childNodes[n]}setSelection(e,r,n,s=!1){let o=Math.min(e,r),i=Math.max(e,r);for(let g=0,y=0;g<this.children.length;g++){let x=this.children[g],w=y+x.size;if(o>y&&i<w)return x.setSelection(e-y-x.border,r-y-x.border,n,s);y=w}let a=this.domFromPos(e,e?-1:1),l=r==e?a:this.domFromPos(r,r?-1:1),c=n.root.getSelection(),d=n.domSelectionRange(),f=!1;if((ht||Ye)&&e==r){let{node:g,offset:y}=a;if(g.nodeType==3){if(f=!!(y&&g.nodeValue[y-1]==`
72
+ `),f&&y==g.nodeValue.length)for(let x=g,w;x;x=x.parentNode){if(w=x.nextSibling){w.nodeName=="BR"&&(a=l={node:w.parentNode,offset:Re(w)+1});break}let D=x.pmViewDesc;if(D&&D.node&&D.node.isBlock)break}}else{let x=g.childNodes[y-1];f=x&&(x.nodeName=="BR"||x.contentEditable=="false")}}if(ht&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let g=d.focusNode.childNodes[d.focusOffset];g&&g.contentEditable=="false"&&(s=!0)}if(!(s||f&&Ye)&&tn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&tn(l.node,l.offset,d.focusNode,d.focusOffset))return;let m=!1;if((c.extend||e==r)&&!(f&&ht)){c.collapse(a.node,a.offset);try{e!=r&&c.extend(l.node,l.offset),m=!0}catch{}}if(!m){if(e>r){let y=a;a=l,l=y}let g=document.createRange();g.setEnd(l.node,l.offset),g.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(g)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,r){for(let n=0,s=0;s<this.children.length;s++){let o=this.children[s],i=n+o.size;if(n==i?e<=i&&r>=n:e<i&&r>n){let a=n+o.border,l=i-o.border;if(e>=a&&r<=l){this.dirty=e==n||r==i?Hr:Ip,e==a&&r==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Bt:o.markDirty(e-a,r-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Hr:Bt}n=i}this.dirty=Hr}markParentsDirty(){let e=1;for(let r=this.parent;r;r=r.parent,e++){let n=e==1?Hr:Ip;r.dirty<n&&(r.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Km extends qs{constructor(e,r,n,s){let o,i=r.type.toDOM;if(typeof i=="function"&&(i=i(n,()=>{if(!o)return s;if(o.parent)return o.parent.posBeforeChild(o)})),!r.type.spec.raw){if(i.nodeType!=1){let a=document.createElement("span");a.appendChild(i),i=a}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=r,this.widget=r,o=this}matchesWidget(e){return this.dirty==ft&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let r=this.widget.spec.stopEvent;return r?r(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class eE extends qs{constructor(e,r,n,s){super(e,[],r,null),this.textDOM=n,this.text=s}get size(){return this.text.length}localPosFromDOM(e,r){return e!=this.textDOM?this.posAtStart+(r?this.size:0):this.posAtStart+r}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class rn extends qs{constructor(e,r,n,s,o){super(e,[],n,s),this.mark=r,this.spec=o}static create(e,r,n,s){let o=s.nodeViews[r.type.name],i=o&&o(r,s,n);return(!i||!i.dom)&&(i=an.renderSpec(document,r.type.spec.toDOM(r,n),null,r.attrs)),new rn(e,r,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&Bt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Bt&&this.mark.eq(e)}markDirty(e,r){if(super.markDirty(e,r),this.dirty!=ft){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=ft}}slice(e,r,n){let s=rn.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;r<i&&(o=Nl(o,r,i,n)),e>0&&(o=Nl(o,0,e,n));for(let a=0;a<o.length;a++)o[a].parent=s;return s.children=o,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class vr extends qs{constructor(e,r,n,s,o,i,a,l,c){super(e,[],o,i),this.node=r,this.outerDeco=n,this.innerDeco=s,this.nodeDOM=a}static create(e,r,n,s,o,i){let a=o.nodeViews[r.type.name],l,c=a&&a(r,o,()=>{if(!l)return i;if(l.parent)return l.parent.posBeforeChild(l)},n,s),d=c&&c.dom,f=c&&c.contentDOM;if(r.isText){if(!d)d=document.createTextNode(r.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=an.renderSpec(document,r.type.spec.toDOM(r),null,r.attrs));!f&&!r.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),r.type.spec.draggable&&(d.draggable=!0));let m=d;return d=Zm(d,n,r),c?l=new tE(e,r,n,s,d,f||null,m,c,o,i+1):r.isText?new Vi(e,r,n,s,d,m,o):new vr(e,r,n,s,d,f||null,m,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let n=this.children[r];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>_.empty)}return e}matchesNode(e,r,n){return this.dirty==ft&&e.eq(this.node)&&Uo(r,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,r){let n=this.node.inlineContent,s=r,o=e.composing?this.localCompositionInfo(e,r):null,i=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new nE(this,i&&i.node,e);iE(this.node,this.innerDeco,(c,d,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,n,e):c.type.side>=0&&!f&&l.syncToMarks(d==this.node.childCount?ue.none:this.node.child(d).marks,n,e),l.placeWidget(c,e,s)},(c,d,f,m)=>{l.syncToMarks(c.marks,n,e);let g;l.findNodeMatch(c,d,f,m)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(g=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,d,f,g,e)||l.updateNextNode(c,d,f,e,m,s)||l.addNode(c,d,f,e,s),s+=c.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Hr)&&(i&&this.protectLocalComposition(e,i),Gm(this.contentDOM,this.children,e),jn&&aE(this.dom))}localCompositionInfo(e,r){let{from:n,to:s}=e.state.selection;if(!(e.state.selection instanceof X)||n<r||s>r+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let i=o.nodeValue,a=lE(this.node.content,i,n-r,s-r);return a<0?null:{node:o,pos:a,text:i}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:r,pos:n,text:s}){if(this.getDesc(r))return;let o=r;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new eE(this,o,r,s);e.input.compositionNodes.push(i),this.children=Nl(this.children,n,n+s.length,e,i)}update(e,r,n,s){return this.dirty==Bt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,r,n,s),!0)}updateInner(e,r,n,s){this.updateOuterDeco(r),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=ft}updateOuterDeco(e){if(Uo(e,this.outerDeco))return;let r=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Ym(this.dom,this.nodeDOM,Al(this.outerDeco,this.node,r),Al(e,this.node,r)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Rp(t,e,r,n,s){Zm(n,e,t);let o=new vr(void 0,t,e,r,n,n,n,s,0);return o.contentDOM&&o.updateChildren(s,0),o}class Vi extends vr{constructor(e,r,n,s,o,i,a){super(e,r,n,s,o,null,i,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,r,n,s){return this.dirty==Bt||this.dirty!=ft&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(r),(this.dirty!=ft||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=ft,!0)}inParent(){let e=this.parent.contentDOM;for(let r=this.nodeDOM;r;r=r.parentNode)if(r==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,r,n){return e==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):super.localPosFromDOM(e,r,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,r,n){let s=this.node.cut(e,r),o=document.createTextNode(s.text);return new Vi(this.parent,s,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,r){super.markDirty(e,r),this.dom!=this.nodeDOM&&(e==0||r==this.nodeDOM.nodeValue.length)&&(this.dirty=Bt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Jm extends qs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ft&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class tE extends vr{constructor(e,r,n,s,o,i,a,l,c,d){super(e,r,n,s,o,i,a,c,d),this.spec=l}update(e,r,n,s){if(this.dirty==Bt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,r,n);return o&&this.updateInner(e,r,n,s),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,r,n,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,r,n,s){this.spec.setSelection?this.spec.setSelection(e,r,n.root):super.setSelection(e,r,n,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Gm(t,e,r){let n=t.firstChild,s=!1;for(let o=0;o<e.length;o++){let i=e[o],a=i.dom;if(a.parentNode==t){for(;a!=n;)n=Pp(n),s=!0;n=n.nextSibling}else s=!0,t.insertBefore(a,n);if(i instanceof rn){let l=n?n.previousSibling:t.lastChild;Gm(i.contentDOM,i.children,r),n=l?l.nextSibling:t.firstChild}}for(;n;)n=Pp(n),s=!0;s&&r.trackWrites==t&&(r.trackWrites=null)}const ws=function(t){t&&(this.nodeName=t)};ws.prototype=Object.create(null);const Vr=[new ws];function Al(t,e,r){if(t.length==0)return Vr;let n=r?Vr[0]:new ws,s=[n];for(let o=0;o<t.length;o++){let i=t[o].type.attrs;if(i){i.nodeName&&s.push(n=new ws(i.nodeName));for(let a in i){let l=i[a];l!=null&&(r&&s.length==1&&s.push(n=new ws(e.isInline?"span":"div")),a=="class"?n.class=(n.class?n.class+" ":"")+l:a=="style"?n.style=(n.style?n.style+";":"")+l:a!="nodeName"&&(n[a]=l))}}}return s}function Ym(t,e,r,n){if(r==Vr&&n==Vr)return e;let s=e;for(let o=0;o<n.length;o++){let i=n[o],a=r[o];if(o){let l;a&&a.nodeName==i.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==i.nodeName||(l=document.createElement(i.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=Vr[0]),s=l}rE(s,a||Vr[0],i)}return s}function rE(t,e,r){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in r)&&t.removeAttribute(n);for(let n in r)n!="class"&&n!="style"&&n!="nodeName"&&r[n]!=e[n]&&t.setAttribute(n,r[n]);if(e.class!=r.class){let n=e.class?e.class.split(" ").filter(Boolean):[],s=r.class?r.class.split(" ").filter(Boolean):[];for(let o=0;o<n.length;o++)s.indexOf(n[o])==-1&&t.classList.remove(n[o]);for(let o=0;o<s.length;o++)n.indexOf(s[o])==-1&&t.classList.add(s[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=r.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=n.exec(e.style);)t.style.removeProperty(s[1])}r.style&&(t.style.cssText+=r.style)}}function Zm(t,e,r){return Ym(t,t,Vr,Al(e,r,t.nodeType!=1))}function Uo(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].type.eq(e[r].type))return!1;return!0}function Pp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class nE{constructor(e,r,n){this.lock=r,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=sE(e.node.content,e)}destroyBetween(e,r){if(e!=r){for(let n=e;n<r;n++)this.top.children[n].destroy();this.top.children.splice(e,r-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,r,n){let s=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;s<i&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=ft,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[o])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=rn.create(this.top,e[o],r,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(e,r,n,s){let o=-1,i;if(s>=this.preMatch.index&&(i=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&i.matchesNode(e,r,n))o=this.top.children.indexOf(i,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,r,n)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,r,n,s,o){let i=this.top.children[s];return i.dirty==Bt&&i.dom==i.contentDOM&&(i.dirty=Hr),i.update(e,r,n,o)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let r=e.parentNode;if(!r)return-1;if(r==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==n)return s}return-1}e=r}}updateNextNode(e,r,n,s,o,i){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof vr){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let d=l.dom,f,m=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Bt&&Uo(r,l.outerDeco));if(!m&&l.update(e,r,n,s))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!m&&(f=this.recreateWrapper(l,e,r,n,s,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Hr,f.updateChildren(s,i+1),f.dirty=ft),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,r,n,s,o,i){if(e.dirty||r.isAtom||!e.children.length||!e.node.content.eq(r.content)||!Uo(n,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=vr.create(this.top,r,n,s,o,i);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,r,n,s,o){let i=vr.create(this.top,e,r,n,s,o);i.contentDOM&&i.updateChildren(s,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,r,n){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let o=new Km(this.top,e,r,n);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],r=this.top;for(;e instanceof rn;)r=e,e=r.children[r.children.length-1];(!e||!(e instanceof Vi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ye||We)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",r),this.addHackNode("BR",this.top))}addHackNode(e,r){if(r==this.top&&this.index<r.children.length&&r.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let s=new Jm(this.top,[],n,null);r!=this.top?r.children.push(s):r.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function sE(t,e){let r=e,n=r.children.length,s=t.childCount,o=new Map,i=[];e:for(;s>0;){let a;for(;;)if(n){let c=r.children[n-1];if(c instanceof rn)r=c,n=c.children.length;else{a=c,n--;break}}else{if(r==e)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=a.node;if(l){if(l!=t.child(s-1))break;--s,o.set(a,s),i.push(a)}}return{index:s,matched:o,matches:i.reverse()}}function oE(t,e){return t.type.side-e.type.side}function iE(t,e,r,n){let s=e.locals(t),o=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);n(d,s,e.forChild(o,d),c),o+=d.nodeSize}return}let i=0,a=[],l=null;for(let c=0;;){let d,f;for(;i<s.length&&s[i].to==o;){let w=s[i++];w.widget&&(d?(f||(f=[d])).push(w):d=w)}if(d)if(f){f.sort(oE);for(let w=0;w<f.length;w++)r(f[w],c,!!l)}else r(d,c,!!l);let m,g;if(l)g=-1,m=l,l=null;else if(c<t.childCount)g=c,m=t.child(c++);else break;for(let w=0;w<a.length;w++)a[w].to<=o&&a.splice(w--,1);for(;i<s.length&&s[i].from<=o&&s[i].to>o;)a.push(s[i++]);let y=o+m.nodeSize;if(m.isText){let w=y;i<s.length&&s[i].from<w&&(w=s[i].from);for(let D=0;D<a.length;D++)a[D].to<w&&(w=a[D].to);w<y&&(l=m.cut(w-o),m=m.cut(0,w-o),y=w,g=-1)}else for(;i<s.length&&s[i].to<y;)i++;let x=m.isInline&&!m.isLeaf?a.filter(w=>!w.inline):a.slice();n(m,x,e.forChild(o,m),g),o=y}}function aE(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function lE(t,e,r,n){for(let s=0,o=0;s<t.childCount&&o<=n;){let i=t.child(s++),a=o;if(o+=i.nodeSize,!i.isText)continue;let l=i.text;for(;s<t.childCount;){let c=t.child(s++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=r){if(o>=n&&l.slice(n-e.length-a,n-a)==e)return n-e.length;let c=a<n?l.lastIndexOf(e,n-a-1):-1;if(c>=0&&c+e.length+a>=r)return a+c;if(r==n&&l.length>=n+e.length-a&&l.slice(n-a,n-a+e.length)==e)return n}}return-1}function Nl(t,e,r,n,s){let o=[];for(let i=0,a=0;i<t.length;i++){let l=t[i],c=a,d=a+=l.size;c>=r||d<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,n)),s&&(o.push(s),s=void 0),d>r&&o.push(l.slice(r-c,l.size,n)))}return o}function Mu(t,e=null){let r=t.domSelectionRange(),n=t.state.doc;if(!r.focusNode)return null;let s=t.docView.nearestDesc(r.focusNode),o=s&&s.size==0,i=t.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(i<0)return null;let a=n.resolve(i),l,c;if(Hi(r)){for(l=i;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&G.isSelectable(f)&&s.parent&&!(f.isInline&&Ok(r.focusNode,r.focusOffset,s.dom))){let m=s.posBefore;c=new G(i==m?a:n.resolve(m))}}else{if(r instanceof t.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let f=i,m=i;for(let g=0;g<r.rangeCount;g++){let y=r.getRangeAt(g);f=Math.min(f,t.docView.posFromDOM(y.startContainer,y.startOffset,1)),m=Math.max(m,t.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(f<0)return null;[l,i]=m==t.state.selection.anchor?[m,f]:[f,m],a=n.resolve(i)}else l=t.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}let d=n.resolve(l);if(!c){let f=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=Bu(t,d,a,f)}return c}function Xm(t){return t.editable?t.hasFocus():eg(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ut(t,e=!1){let r=t.state.selection;if(Qm(t,r),!!Xm(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&We){let n=t.domSelectionRange(),s=t.domObserver.currentSelection;if(n.anchorNode&&s.anchorNode&&tn(n.anchorNode,n.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)cE(t);else{let{anchor:n,head:s}=r,o,i;zp&&!(r instanceof X)&&(r.$from.parent.inlineContent||(o=$p(t,r.from)),!r.empty&&!r.$from.parent.inlineContent&&(i=$p(t,r.to))),t.docView.setSelection(n,s,t,e),zp&&(o&&Hp(o),i&&Hp(i)),r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&uE(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const zp=Ye||We&&zm<63;function $p(t,e){let{node:r,offset:n}=t.docView.domFromPos(e,0),s=n<r.childNodes.length?r.childNodes[n]:null,o=n?r.childNodes[n-1]:null;if(Ye&&s&&s.contentEditable=="false")return Ha(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return Ha(s);if(o)return Ha(o)}}function Ha(t){return t.contentEditable="true",Ye&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Hp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function uE(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let r=t.domSelectionRange(),n=r.anchorNode,s=r.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(r.anchorNode!=n||r.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Xm(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function cE(t){let e=t.domSelection();if(!e)return;let r=t.cursorWrapper.dom,n=r.nodeName=="IMG";n?e.collapse(r.parentNode,Re(r)+1):e.collapse(r,0),!n&&!t.state.selection.visible&&tt&&xr<=11&&(r.disabled=!0,r.disabled=!1)}function Qm(t,e){if(e instanceof G){let r=t.docView.descAt(e.from);r!=t.lastSelectedViewDesc&&(Vp(t),r&&r.selectNode(),t.lastSelectedViewDesc=r)}else Vp(t)}function Vp(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Bu(t,e,r,n){return t.someProp("createSelectionBetween",s=>s(t,e,r))||X.between(e,r,n)}function qp(t){return t.editable&&!t.hasFocus()?!1:eg(t)}function eg(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function dE(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),r=t.domSelectionRange();return tn(e.node,e.offset,r.anchorNode,r.anchorOffset)}function Tl(t,e){let{$anchor:r,$head:n}=t.selection,s=e>0?r.max(n):r.min(n),o=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return o&&ne.findFrom(o,e)}function lr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Wp(t,e,r){let n=t.state.selection;if(n instanceof X)if(r.indexOf("s")>-1){let{$head:s}=n,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=t.state.doc.resolve(s.pos+o.nodeSize*(e<0?-1:1));return lr(t,new X(n.$anchor,i))}else if(n.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Tl(t.state,e);return s&&s instanceof G?lr(t,s):!1}else if(!(dt&&r.indexOf("m")>-1)){let s=n.$head,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,i;if(!o||o.isText)return!1;let a=e<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(i=t.docView.descAt(a))&&!i.contentDOM?G.isSelectable(o)?lr(t,new G(e<0?t.state.doc.resolve(s.pos-o.nodeSize):s)):Vs?lr(t,new X(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(n instanceof G&&n.node.isInline)return lr(t,new X(e>0?n.$to:n.$from));{let s=Tl(t.state,e);return s?lr(t,s):!1}}}function Ko(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ds(t,e){let r=t.pmViewDesc;return r&&r.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function yn(t,e){return e<0?pE(t):hE(t)}function pE(t){let e=t.domSelectionRange(),r=e.focusNode,n=e.focusOffset;if(!r)return;let s,o,i=!1;for(ht&&r.nodeType==1&&n<Ko(r)&&Ds(r.childNodes[n],-1)&&(i=!0);;)if(n>0){if(r.nodeType!=1)break;{let a=r.childNodes[n-1];if(Ds(a,-1))s=r,o=--n;else if(a.nodeType==3)r=a,n=r.nodeValue.length;else break}}else{if(tg(r))break;{let a=r.previousSibling;for(;a&&Ds(a,-1);)s=r.parentNode,o=Re(a),a=a.previousSibling;if(a)r=a,n=Ko(r);else{if(r=r.parentNode,r==t.dom)break;n=0}}}i?Ml(t,r,n):s&&Ml(t,s,o)}function hE(t){let e=t.domSelectionRange(),r=e.focusNode,n=e.focusOffset;if(!r)return;let s=Ko(r),o,i;for(;;)if(n<s){if(r.nodeType!=1)break;let a=r.childNodes[n];if(Ds(a,1))o=r,i=++n;else break}else{if(tg(r))break;{let a=r.nextSibling;for(;a&&Ds(a,1);)o=a.parentNode,i=Re(a)+1,a=a.nextSibling;if(a)r=a,n=0,s=Ko(r);else{if(r=r.parentNode,r==t.dom)break;n=s=0}}}o&&Ml(t,o,i)}function tg(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function fE(t,e){for(;t&&e==t.childNodes.length&&!Hs(t);)e=Re(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let r=t.childNodes[e];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r,e=0}}function mE(t,e){for(;t&&!e&&!Hs(t);)e=Re(t),t=t.parentNode;for(;t&&e;){let r=t.childNodes[e-1];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r,e=t.childNodes.length}}function Ml(t,e,r){if(e.nodeType!=3){let o,i;(i=fE(e,r))?(e=i,r=0):(o=mE(e,r))&&(e=o,r=o.nodeValue.length)}let n=t.domSelection();if(!n)return;if(Hi(n)){let o=document.createRange();o.setEnd(e,r),o.setStart(e,r),n.removeAllRanges(),n.addRange(o)}else n.extend&&n.extend(e,r);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Ut(t)},50)}function Up(t,e){let r=t.state.doc.resolve(e);if(!(We||Ik)&&r.parent.inlineContent){let s=t.coordsAtPos(e);if(e>r.start()){let o=t.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(e<r.end()){let o=t.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Kp(t,e,r){let n=t.state.selection;if(n instanceof X&&!n.empty||r.indexOf("s")>-1||dt&&r.indexOf("m")>-1)return!1;let{$from:s,$to:o}=n;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=Tl(t.state,e);if(i&&i instanceof G)return lr(t,i)}if(!s.parent.inlineContent){let i=e<0?s:o,a=n instanceof ot?ne.near(i,e):ne.findFrom(i,e);return a?lr(t,a):!1}return!1}function Jp(t,e){if(!(t.state.selection instanceof X))return!0;let{$head:r,$anchor:n,empty:s}=t.state.selection;if(!r.sameParent(n))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(o&&!o.isText){let i=t.state.tr;return e<0?i.delete(r.pos-o.nodeSize,r.pos):i.delete(r.pos,r.pos+o.nodeSize),t.dispatch(i),!0}return!1}function Gp(t,e,r){t.domObserver.stop(),e.contentEditable=r,t.domObserver.start()}function gE(t){if(!Ye||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:r}=t.domSelectionRange();if(e&&e.nodeType==1&&r==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;Gp(t,n,"true"),setTimeout(()=>Gp(t,n,"false"),20)}return!1}function bE(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function yE(t,e){let r=e.keyCode,n=bE(e);if(r==8||dt&&r==72&&n=="c")return Jp(t,-1)||yn(t,-1);if(r==46&&!e.shiftKey||dt&&r==68&&n=="c")return Jp(t,1)||yn(t,1);if(r==13||r==27)return!0;if(r==37||dt&&r==66&&n=="c"){let s=r==37?Up(t,t.state.selection.from)=="ltr"?-1:1:-1;return Wp(t,s,n)||yn(t,s)}else if(r==39||dt&&r==70&&n=="c"){let s=r==39?Up(t,t.state.selection.from)=="ltr"?1:-1:1;return Wp(t,s,n)||yn(t,s)}else{if(r==38||dt&&r==80&&n=="c")return Kp(t,-1,n)||yn(t,-1);if(r==40||dt&&r==78&&n=="c")return gE(t)||Kp(t,1,n)||yn(t,1);if(n==(dt?"m":"c")&&(r==66||r==73||r==89||r==90))return!0}return!1}function ju(t,e){t.someProp("transformCopied",g=>{e=g(e,t)});let r=[],{content:n,openStart:s,openEnd:o}=e;for(;s>1&&o>1&&n.childCount==1&&n.firstChild.childCount==1;){s--,o--;let g=n.firstChild;r.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),n=g.content}let i=t.someProp("clipboardSerializer")||an.fromSchema(t.state.schema),a=ag(),l=a.createElement("div");l.appendChild(i.serializeFragment(n,{document:a}));let c=l.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=ig[c.nodeName.toLowerCase()]);){for(let g=d.length-1;g>=0;g--){let y=a.createElement(d[g]);for(;l.firstChild;)y.appendChild(l.firstChild);l.appendChild(y),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${o}${f?` -${f}`:""} ${JSON.stringify(r)}`);let m=t.someProp("clipboardTextSerializer",g=>g(e,t))||e.content.textBetween(0,e.content.size,`
73
+
74
+ `);return{dom:l,text:m,slice:e}}function rg(t,e,r,n,s){let o=s.parent.type.spec.code,i,a;if(!r&&!e)return null;let l=!!e&&(n||o||!r);if(l){if(t.someProp("transformPastedText",m=>{e=m(e,o||n,t)}),o)return a=new V(_.from(t.state.schema.text(e.replace(/\r\n?/g,`
75
+ `))),0,0),t.someProp("transformPasted",m=>{a=m(a,t,!0)}),a;let f=t.someProp("clipboardTextParser",m=>m(e,s,n,t));if(f)a=f;else{let m=s.marks(),{schema:g}=t.state,y=an.fromSchema(g);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(x=>{let w=i.appendChild(document.createElement("p"));x&&w.appendChild(y.serializeNode(g.text(x,m)))})}}else t.someProp("transformPastedHTML",f=>{r=f(r,t)}),i=DE(r),Vs&&CE(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let m=i.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;i=m}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||yr.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||d),context:s,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!xE.test(m.parentNode.nodeName)?{ignore:!0}:null}})),d)a=kE(Yp(a,+d[1],+d[2]),d[4]);else if(a=V.maxOpen(vE(a.content,s),!0),a.openStart||a.openEnd){let f=0,m=0;for(let g=a.content.firstChild;f<a.openStart&&!g.type.spec.isolating;f++,g=g.firstChild);for(let g=a.content.lastChild;m<a.openEnd&&!g.type.spec.isolating;m++,g=g.lastChild);a=Yp(a,f,m)}return t.someProp("transformPasted",f=>{a=f(a,t,l)}),a}const xE=/^(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 vE(t,e){if(t.childCount<2)return t;for(let r=e.depth;r>=0;r--){let s=e.node(r).contentMatchAt(e.index(r)),o,i=[];if(t.forEach(a=>{if(!i)return;let l=s.findWrapping(a.type),c;if(!l)return i=null;if(c=i.length&&o.length&&sg(l,o,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=og(i[i.length-1],o.length));let d=ng(a,l);i.push(d),s=s.matchType(d.type),o=l}}),i)return _.from(i)}return t}function ng(t,e,r=0){for(let n=e.length-1;n>=r;n--)t=e[n].create(null,_.from(t));return t}function sg(t,e,r,n,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let o=sg(t,e,r,n.lastChild,s+1);if(o)return n.copy(n.content.replaceChild(n.childCount-1,o));if(n.contentMatchAt(n.childCount).matchType(s==t.length-1?r.type:t[s+1]))return n.copy(n.content.append(_.from(ng(r,t,s+1))))}}function og(t,e){if(e==0)return t;let r=t.content.replaceChild(t.childCount-1,og(t.lastChild,e-1)),n=t.contentMatchAt(t.childCount).fillBefore(_.empty,!0);return t.copy(r.append(n))}function Bl(t,e,r,n,s,o){let i=e<0?t.firstChild:t.lastChild,a=i.content;return t.childCount>1&&(o=0),s<n-1&&(a=Bl(a,e,r,n,s+1,o)),s>=r&&(a=e<0?i.contentMatchAt(0).fillBefore(a,o<=s).append(a):a.append(i.contentMatchAt(i.childCount).fillBefore(_.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(a))}function Yp(t,e,r){return e<t.openStart&&(t=new V(Bl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),r<t.openEnd&&(t=new V(Bl(t.content,1,r,t.openEnd,0,0),t.openStart,r)),t}const ig={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 Zp=null;function ag(){return Zp||(Zp=document.implementation.createHTMLDocument("title"))}let Va=null;function wE(t){let e=window.trustedTypes;return e?(Va||(Va=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:r=>r})),Va.createHTML(t)):t}function DE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let r=ag().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(t),s;if((s=n&&ig[n[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=wE(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;return r}function CE(t){let e=t.querySelectorAll(We?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<e.length;r++){let n=e[r];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),n)}}function kE(t,e){if(!t.size)return t;let r=t.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return t}let{content:s,openStart:o,openEnd:i}=t;for(let a=n.length-2;a>=0;a-=2){let l=r.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;s=_.from(l.create(n[a+1],s)),o++,i++}return new V(s,o,i)}const Ze={},Xe={},EE={touchstart:!0,touchmove:!0};class SE{constructor(){this.shiftKey=!1,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=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function FE(t){for(let e in Ze){let r=Ze[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=n=>{NE(t,n)&&!Ou(t,n)&&(t.editable||!(n.type in Xe))&&r(t,n)},EE[e]?{passive:!0}:void 0)}Ye&&t.dom.addEventListener("input",()=>null),jl(t)}function mr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function AE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function jl(t){t.someProp("handleDOMEvents",e=>{for(let r in e)t.input.eventHandlers[r]||t.dom.addEventListener(r,t.input.eventHandlers[r]=n=>Ou(t,n))})}function Ou(t,e){return t.someProp("handleDOMEvents",r=>{let n=r[e.type];return n?n(t,e)||e.defaultPrevented:!1})}function NE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let r=e.target;r!=t.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(e))return!1;return!0}function TE(t,e){!Ou(t,e)&&Ze[e.type]&&(t.editable||!(e.type in Xe))&&Ze[e.type](t,e)}Xe.keydown=(t,e)=>{let r=e;if(t.input.shiftKey=r.keyCode==16||r.shiftKey,!ug(t,r)&&(t.input.lastKeyCode=r.keyCode,t.input.lastKeyCodeTime=Date.now(),!(qt&&We&&r.keyCode==13)))if(r.keyCode!=229&&t.domObserver.forceFlush(),jn&&r.keyCode==13&&!r.ctrlKey&&!r.altKey&&!r.metaKey){let n=Date.now();t.input.lastIOSEnter=n,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==n&&(t.someProp("handleKeyDown",s=>s(t,Pr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",n=>n(t,r))||yE(t,r)?r.preventDefault():mr(t,"key")};Xe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Xe.keypress=(t,e)=>{let r=e;if(ug(t,r)||!r.charCode||r.ctrlKey&&!r.altKey||dt&&r.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,r))){r.preventDefault();return}let n=t.state.selection;if(!(n instanceof X)||!n.$from.sameParent(n.$to)){let s=String.fromCharCode(r.charCode),o=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",i=>i(t,n.$from.pos,n.$to.pos,s,o))&&t.dispatch(o()),r.preventDefault()}};function qi(t){return{left:t.clientX,top:t.clientY}}function ME(t,e){let r=e.x-t.clientX,n=e.y-t.clientY;return r*r+n*n<100}function Lu(t,e,r,n,s){if(n==-1)return!1;let o=t.state.doc.resolve(n);for(let i=o.depth+1;i>0;i--)if(t.someProp(e,a=>i>o.depth?a(t,r,o.nodeAfter,o.before(i),s,!0):a(t,r,o.node(i),o.before(i),s,!1)))return!0;return!1}function Fn(t,e,r){if(t.focused||t.focus(),t.state.selection.eq(e))return;let n=t.state.tr.setSelection(e);n.setMeta("pointer",!0),t.dispatch(n)}function BE(t,e){if(e==-1)return!1;let r=t.state.doc.resolve(e),n=r.nodeAfter;return n&&n.isAtom&&G.isSelectable(n)?(Fn(t,new G(r)),!0):!1}function jE(t,e){if(e==-1)return!1;let r=t.state.selection,n,s;r instanceof G&&(n=r.node);let o=t.state.doc.resolve(e);for(let i=o.depth+1;i>0;i--){let a=i>o.depth?o.nodeAfter:o.node(i);if(G.isSelectable(a)){n&&r.$from.depth>0&&i>=r.$from.depth&&o.before(r.$from.depth+1)==r.$from.pos?s=o.before(r.$from.depth):s=o.before(i);break}}return s!=null?(Fn(t,G.create(t.state.doc,s)),!0):!1}function OE(t,e,r,n,s){return Lu(t,"handleClickOn",e,r,n)||t.someProp("handleClick",o=>o(t,e,n))||(s?jE(t,r):BE(t,r))}function LE(t,e,r,n){return Lu(t,"handleDoubleClickOn",e,r,n)||t.someProp("handleDoubleClick",s=>s(t,e,n))}function _E(t,e,r,n){return Lu(t,"handleTripleClickOn",e,r,n)||t.someProp("handleTripleClick",s=>s(t,e,n))||IE(t,r,n)}function IE(t,e,r){if(r.button!=0)return!1;let n=t.state.doc;if(e==-1)return n.inlineContent?(Fn(t,X.create(n,0,n.content.size)),!0):!1;let s=n.resolve(e);for(let o=s.depth+1;o>0;o--){let i=o>s.depth?s.nodeAfter:s.node(o),a=s.before(o);if(i.inlineContent)Fn(t,X.create(n,a+1,a+1+i.content.size));else if(G.isSelectable(i))Fn(t,G.create(n,a));else continue;return!0}}function _u(t){return Jo(t)}const lg=dt?"metaKey":"ctrlKey";Ze.mousedown=(t,e)=>{let r=e;t.input.shiftKey=r.shiftKey;let n=_u(t),s=Date.now(),o="singleClick";s-t.input.lastClick.time<500&&ME(r,t.input.lastClick)&&!r[lg]&&t.input.lastClick.button==r.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:s,x:r.clientX,y:r.clientY,type:o,button:r.button};let i=t.posAtCoords(qi(r));i&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new RE(t,i,r,!!n)):(o=="doubleClick"?LE:_E)(t,i.pos,i.inside,r)?r.preventDefault():mr(t,"pointer"))};class RE{constructor(e,r,n,s){this.view=e,this.pos=r,this.event=n,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[lg],this.allowDefault=n.shiftKey;let o,i;if(r.inside>-1)o=e.state.doc.nodeAt(r.inside),i=r.inside;else{let d=e.state.doc.resolve(r.pos);o=d.parent,i=d.depth?d.before():0}const a=s?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(n.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof G&&c.from<=i&&c.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ht&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),mr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ut(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let r=this.pos;this.view.state.doc!=this.startDoc&&(r=this.view.posAtCoords(qi(e))),this.updateAllowDefault(e),this.allowDefault||!r?mr(this.view,"pointer"):OE(this.view,r.pos,r.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ye&&this.mightDrag&&!this.mightDrag.node.isAtom||We&&!this.view.state.selection.visible&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(Fn(this.view,ne.near(this.view.state.doc.resolve(r.pos))),e.preventDefault()):mr(this.view,"pointer")}move(e){this.updateAllowDefault(e),mr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ze.touchstart=t=>{t.input.lastTouch=Date.now(),_u(t),mr(t,"pointer")};Ze.touchmove=t=>{t.input.lastTouch=Date.now(),mr(t,"pointer")};Ze.contextmenu=t=>_u(t);function ug(t,e){return t.composing?!0:Ye&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const PE=qt?5e3:-1;Xe.compositionstart=Xe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,r=e.selection.$to;if(e.selection instanceof X&&(e.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||r.marks(),Jo(t,!0),t.markCursor=null;else if(Jo(t,!e.selection.empty),ht&&e.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let n=t.domSelectionRange();for(let s=n.focusNode,o=n.focusOffset;s&&s.nodeType==1&&o!=0;){let i=o<0?s.lastChild:s.childNodes[o-1];if(!i)break;if(i.nodeType==3){let a=t.domSelection();a&&a.collapse(i,i.nodeValue.length);break}else s=i,o=-1}}t.input.composing=!0}cg(t,PE)};Xe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,cg(t,20))};function cg(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jo(t),e))}function dg(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=$E());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function zE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let r=Bk(e.focusNode,e.focusOffset),n=jk(e.focusNode,e.focusOffset);if(r&&n&&r!=n){let s=n.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(r==o||n==o)return o;if(!s||!s.isText(n.nodeValue))return n;if(t.input.compositionNode==n){let i=r.pmViewDesc;if(!(!i||!i.isText(r.nodeValue)))return n}}return r||n}function $E(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Jo(t,e=!1){if(!(qt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),dg(t),e||t.docView&&t.docView.dirty){let r=Mu(t),n=t.state.selection;return r&&!r.eq(n)?t.dispatch(t.state.tr.setSelection(r)):(t.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function HE(t,e){if(!t.dom.parentNode)return;let r=t.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(e),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),n.removeAllRanges(),n.addRange(s),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),t.focus()},50)}const js=tt&&xr<15||jn&&Rk<604;Ze.copy=Xe.cut=(t,e)=>{let r=e,n=t.state.selection,s=r.type=="cut";if(n.empty)return;let o=js?null:r.clipboardData,i=n.content(),{dom:a,text:l}=ju(t,i);o?(r.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):HE(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function VE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function qE(t,e){if(!t.dom.parentNode)return;let r=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,n=t.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),n.parentNode&&n.parentNode.removeChild(n),r?Os(t,n.value,null,s,e):Os(t,n.textContent,n.innerHTML,s,e)},50)}function Os(t,e,r,n,s){let o=rg(t,e,r,n,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,o||V.empty)))return!0;if(!o)return!1;let i=VE(o),a=i?t.state.tr.replaceSelectionWith(i,n):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pg(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let r=t.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}Xe.paste=(t,e)=>{let r=e;if(t.composing&&!qt)return;let n=js?null:r.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;n&&Os(t,pg(n),n.getData("text/html"),s,r)?r.preventDefault():qE(t,r)};class hg{constructor(e,r,n){this.slice=e,this.move=r,this.node=n}}const WE=dt?"altKey":"ctrlKey";function fg(t,e){let r=t.someProp("dragCopies",n=>!n(e));return r??!e[WE]}Ze.dragstart=(t,e)=>{let r=e,n=t.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let s=t.state.selection,o=s.empty?null:t.posAtCoords(qi(r)),i;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof G?s.to-1:s.to))){if(n&&n.mightDrag)i=G.create(t.state.doc,n.mightDrag.pos);else if(r.target&&r.target.nodeType==1){let f=t.docView.nearestDesc(r.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(i=G.create(t.state.doc,f.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:c,slice:d}=ju(t,a);(!r.dataTransfer.files.length||!We||zm>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(js?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",js||r.dataTransfer.setData("text/plain",c),t.dragging=new hg(d,fg(t,r),i)};Ze.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Xe.dragover=Xe.dragenter=(t,e)=>e.preventDefault();Xe.drop=(t,e)=>{let r=e,n=t.dragging;if(t.dragging=null,!r.dataTransfer)return;let s=t.posAtCoords(qi(r));if(!s)return;let o=t.state.doc.resolve(s.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=rg(t,pg(r.dataTransfer),js?null:r.dataTransfer.getData("text/html"),!1,o);let a=!!(n&&fg(t,r));if(t.someProp("handleDrop",y=>y(t,r,i||V.empty,a))){r.preventDefault();return}if(!i)return;r.preventDefault();let l=i?xm(t.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let c=t.state.tr;if(a){let{node:y}=n;y?y.replace(c):c.deleteSelection()}let d=c.mapping.map(l),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=c.doc;if(f?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(m))return;let g=c.doc.resolve(d);if(f&&G.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new G(g));else{let y=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((x,w,D,E)=>y=E),c.setSelection(Bu(t,g,c.doc.resolve(y)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Ze.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ut(t)},20))};Ze.blur=(t,e)=>{let r=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),r.relatedTarget&&t.dom.contains(r.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ze.beforeinput=(t,e)=>{if(We&&qt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Pr(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Xe)Ze[t]=Xe[t];function Ls(t,e){if(t==e)return!0;for(let r in t)if(t[r]!==e[r])return!1;for(let r in e)if(!(r in t))return!1;return!0}class Go{constructor(e,r){this.toDOM=e,this.spec=r||Gr,this.side=this.spec.side||0}map(e,r,n,s){let{pos:o,deleted:i}=e.mapResult(r.from+s,this.side<0?-1:1);return i?null:new Ge(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Go&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ls(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wr{constructor(e,r){this.attrs=e,this.spec=r||Gr}map(e,r,n,s){let o=e.map(r.from+s,this.spec.inclusiveStart?-1:1)-n,i=e.map(r.to+s,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Ge(o,i,this)}valid(e,r){return r.from<r.to}eq(e){return this==e||e instanceof wr&&Ls(this.attrs,e.attrs)&&Ls(this.spec,e.spec)}static is(e){return e.type instanceof wr}destroy(){}}class Iu{constructor(e,r){this.attrs=e,this.spec=r||Gr}map(e,r,n,s){let o=e.mapResult(r.from+s,1);if(o.deleted)return null;let i=e.mapResult(r.to+s,-1);return i.deleted||i.pos<=o.pos?null:new Ge(o.pos-n,i.pos-n,this)}valid(e,r){let{index:n,offset:s}=e.content.findIndex(r.from),o;return s==r.from&&!(o=e.child(n)).isText&&s+o.nodeSize==r.to}eq(e){return this==e||e instanceof Iu&&Ls(this.attrs,e.attrs)&&Ls(this.spec,e.spec)}destroy(){}}class Ge{constructor(e,r,n){this.from=e,this.to=r,this.type=n}copy(e,r){return new Ge(e,r,this.type)}eq(e,r=0){return this.type.eq(e.type)&&this.from+r==e.from&&this.to+r==e.to}map(e,r,n){return this.type.map(e,this,r,n)}static widget(e,r,n){return new Ge(e,e,new Go(r,n))}static inline(e,r,n,s){return new Ge(e,r,new wr(n,s))}static node(e,r,n,s){return new Ge(e,r,new Iu(n,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof wr}get widget(){return this.type instanceof Go}}const vn=[],Gr={};class me{constructor(e,r){this.local=e.length?e:vn,this.children=r.length?r:vn}static create(e,r){return r.length?Yo(r,e,0,Gr):qe}find(e,r,n){let s=[];return this.findInner(e??0,r??1e9,s,0,n),s}findInner(e,r,n,s,o){for(let i=0;i<this.local.length;i++){let a=this.local[i];a.from<=r&&a.to>=e&&(!o||o(a.spec))&&n.push(a.copy(a.from+s,a.to+s))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<r&&this.children[i+1]>e){let a=this.children[i]+1;this.children[i+2].findInner(e-a,r-a,n,s+a,o)}}map(e,r,n){return this==qe||e.maps.length==0?this:this.mapInner(e,r,0,0,n||Gr)}mapInner(e,r,n,s,o){let i;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,s);l&&l.type.valid(r,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?UE(this.children,i||[],e,r,n,s,o):i?new me(i.sort(Yr),vn):qe}add(e,r){return r.length?this==qe?me.create(e,r):this.addInner(e,r,0):this}addInner(e,r,n){let s,o=0;e.forEach((a,l)=>{let c=l+n,d;if(d=gg(r,a,c)){for(s||(s=this.children.slice());o<s.length&&s[o]<l;)o+=3;s[o]==l?s[o+2]=s[o+2].addInner(a,d,c+1):s.splice(o,0,l,l+a.nodeSize,Yo(d,a,c+1,Gr)),o+=3}});let i=mg(o?bg(r):r,-n);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new me(i.length?this.local.concat(i).sort(Yr):this.local,s||this.children)}remove(e){return e.length==0||this==qe?this:this.removeInner(e,0)}removeInner(e,r){let n=this.children,s=this.local;for(let o=0;o<n.length;o+=3){let i,a=n[o]+r,l=n[o+1]+r;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>a&&f.to<l&&(e[d]=null,(i||(i=[])).push(f));if(!i)continue;n==this.children&&(n=this.children.slice());let c=n[o+2].removeInner(i,a+1);c!=qe?n[o+2]=c:(n.splice(o,3),o-=3)}if(s.length){for(let o=0,i;o<e.length;o++)if(i=e[o])for(let a=0;a<s.length;a++)s[a].eq(i,r)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return n==this.children&&s==this.local?this:s.length||n.length?new me(s,n):qe}forChild(e,r){if(this==qe)return this;if(r.isLeaf)return me.empty;let n,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let o=e+1,i=o+r.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<i&&l.to>o&&l.type instanceof wr){let c=Math.max(o,l.from)-o,d=Math.min(i,l.to)-o;c<d&&(s||(s=[])).push(l.copy(c,d))}}if(s){let a=new me(s.sort(Yr),vn);return n?new dr([a,n]):a}return n||qe}eq(e){if(this==e)return!0;if(!(e instanceof me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let r=0;r<this.local.length;r++)if(!this.local[r].eq(e.local[r]))return!1;for(let r=0;r<this.children.length;r+=3)if(this.children[r]!=e.children[r]||this.children[r+1]!=e.children[r+1]||!this.children[r+2].eq(e.children[r+2]))return!1;return!0}locals(e){return Ru(this.localsInner(e))}localsInner(e){if(this==qe)return vn;if(e.inlineContent||!this.local.some(wr.is))return this.local;let r=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof wr||r.push(this.local[n]);return r}forEachSet(e){e(this)}}me.empty=new me([],[]);me.removeOverlap=Ru;const qe=me.empty;class dr{constructor(e){this.members=e}map(e,r){const n=this.members.map(s=>s.map(e,r,Gr));return dr.from(n)}forChild(e,r){if(r.isLeaf)return me.empty;let n=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(e,r);o!=qe&&(o instanceof dr?n=n.concat(o.members):n.push(o))}return dr.from(n)}eq(e){if(!(e instanceof dr)||e.members.length!=this.members.length)return!1;for(let r=0;r<this.members.length;r++)if(!this.members[r].eq(e.members[r]))return!1;return!0}locals(e){let r,n=!0;for(let s=0;s<this.members.length;s++){let o=this.members[s].localsInner(e);if(o.length)if(!r)r=o;else{n&&(r=r.slice(),n=!1);for(let i=0;i<o.length;i++)r.push(o[i])}}return r?Ru(n?r:r.sort(Yr)):vn}static from(e){switch(e.length){case 0:return qe;case 1:return e[0];default:return new dr(e.every(r=>r instanceof me)?e:e.reduce((r,n)=>r.concat(n instanceof me?n:n.members),[]))}}forEachSet(e){for(let r=0;r<this.members.length;r++)this.members[r].forEachSet(e)}}function UE(t,e,r,n,s,o,i){let a=t.slice();for(let c=0,d=o;c<r.maps.length;c++){let f=0;r.maps[c].forEach((m,g,y,x)=>{let w=x-y-(g-m);for(let D=0;D<a.length;D+=3){let E=a[D+1];if(E<0||m>E+d-f)continue;let S=a[D]+d-f;g>=S?a[D+1]=m<=S?-2:-1:m>=d&&w&&(a[D]+=w,a[D+1]+=w)}f+=w}),d=r.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=r.map(t[c]+o),f=d-s;if(f<0||f>=n.content.size){l=!0;continue}let m=r.map(t[c+1]+o,-1),g=m-s,{index:y,offset:x}=n.content.findIndex(f),w=n.maybeChild(y);if(w&&x==f&&x+w.nodeSize==g){let D=a[c+2].mapInner(r,w,d+1,t[c]+o+1,i);D!=qe?(a[c]=f,a[c+1]=g,a[c+2]=D):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=KE(a,t,e,r,s,o,i),d=Yo(c,n,0,i);e=d.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,m=0;f<d.children.length;f+=3){let g=d.children[f];for(;m<a.length&&a[m]<g;)m+=3;a.splice(m,0,d.children[f],d.children[f+1],d.children[f+2])}}return new me(e.sort(Yr),a)}function mg(t,e){if(!e||!t.length)return t;let r=[];for(let n=0;n<t.length;n++){let s=t[n];r.push(new Ge(s.from+e,s.to+e,s.type))}return r}function KE(t,e,r,n,s,o,i){function a(l,c){for(let d=0;d<l.local.length;d++){let f=l.local[d].map(n,s,c);f?r.push(f):i.onRemove&&i.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return r}function gg(t,e,r){if(e.isLeaf)return null;let n=r+e.nodeSize,s=null;for(let o=0,i;o<t.length;o++)(i=t[o])&&i.from>r&&i.to<n&&((s||(s=[])).push(i),t[o]=null);return s}function bg(t){let e=[];for(let r=0;r<t.length;r++)t[r]!=null&&e.push(t[r]);return e}function Yo(t,e,r,n){let s=[],o=!1;e.forEach((a,l)=>{let c=gg(t,a,l+r);if(c){o=!0;let d=Yo(c,a,r+l+1,n);d!=qe&&s.push(l,l+a.nodeSize,d)}});let i=mg(o?bg(t):t,-r).sort(Yr);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||(n.onRemove&&n.onRemove(i[a].spec),i.splice(a--,1));return i.length||s.length?new me(i,s):qe}function Yr(t,e){return t.from-e.from||t.to-e.to}function Ru(t){let e=t;for(let r=0;r<e.length-1;r++){let n=e[r];if(n.from!=n.to)for(let s=r+1;s<e.length;s++){let o=e[s];if(o.from==n.from){o.to!=n.to&&(e==t&&(e=t.slice()),e[s]=o.copy(o.from,n.to),Xp(e,s+1,o.copy(n.to,o.to)));continue}else{o.from<n.to&&(e==t&&(e=t.slice()),e[r]=n.copy(n.from,o.from),Xp(e,s,n.copy(o.from,n.to)));break}}}return e}function Xp(t,e,r){for(;e<t.length&&Yr(r,t[e])>0;)e++;t.splice(e,0,r)}function qa(t){let e=[];return t.someProp("decorations",r=>{let n=r(t.state);n&&n!=qe&&e.push(n)}),t.cursorWrapper&&e.push(me.create(t.state.doc,[t.cursorWrapper.deco])),dr.from(e)}const JE={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},GE=tt&&xr<=11;class YE{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class ZE{constructor(e,r){this.view=e,this.handleDOMChange=r,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new YE,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let s=0;s<n.length;s++)this.queue.push(n[s]);tt&&xr<=11&&n.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),GE&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,JE)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let r=0;r<e.length;r++)this.queue.push(e[r]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(qp(this.view)){if(this.suppressingSelectionUpdates)return Ut(this.view);if(tt&&xr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let r=new Set,n;for(let o=e.focusNode;o;o=Bn(o))r.add(o);for(let o=e.anchorNode;o;o=Bn(o))if(r.has(o)){n=o;break}let s=n&&this.view.docView.nearestDesc(n);if(s&&s.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&qp(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,a=!1,l=[];if(e.editable)for(let d=0;d<r.length;d++){let f=this.registerMutation(r[d],l);f&&(o=o<0?f.from:Math.min(f.from,o),i=i<0?f.to:Math.max(f.to,i),f.typeOver&&(a=!0))}if(ht&&l.length){let d=l.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,m]=d;f.parentNode&&f.parentNode.parentNode==m.parentNode?m.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let m of d){let g=m.parentNode;g&&g.nodeName=="LI"&&(!f||eS(e,f)!=g)&&m.remove()}}}let c=null;o<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Hi(n)&&(c=Mu(e))&&c.eq(ne.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ut(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||s)&&(o>-1&&(e.docView.markDirty(o,i),XE(e)),this.handleDOMChange(o,i,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Ut(e),this.currentSelection.set(n))}registerMutation(e,r){if(r.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];r.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let s=e.previousSibling,o=e.nextSibling;if(tt&&xr<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:m}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f),(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(o=m)}let i=s&&s.parentNode==e.target?Re(s)+1:0,a=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?Re(o):e.target.childNodes.length,c=n.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Qp=new WeakMap,eh=!1;function XE(t){if(!Qp.has(t)&&(Qp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ht,eh)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),eh=!0}}function th(t,e){let r=e.startContainer,n=e.startOffset,s=e.endContainer,o=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return tn(i.node,i.offset,s,o)&&([r,n,s,o]=[s,o,r,n]),{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:o}}function QE(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return th(t,s)}let r;function n(s){s.preventDefault(),s.stopImmediatePropagation(),r=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0),r?th(t,r):null}function eS(t,e){for(let r=e.parentNode;r&&r!=t.dom;r=r.parentNode){let n=t.docView.nearestDesc(r,!0);if(n&&n.node.isBlock)return r}return null}function tS(t,e,r){let{node:n,fromOffset:s,toOffset:o,from:i,to:a}=t.docView.parseRange(e,r),l=t.domSelectionRange(),c,d=l.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Hi(l)||c.push({node:l.focusNode,offset:l.focusOffset})),We&&t.input.lastKeyCode===8)for(let w=o;w>s;w--){let D=n.childNodes[w-1],E=D.pmViewDesc;if(D.nodeName=="BR"&&!E){o=w;break}if(!E||E.size)break}let f=t.state.doc,m=t.someProp("domParser")||yr.fromSchema(t.state.schema),g=f.resolve(i),y=null,x=m.parse(n,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:s,to:o,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:rS,context:g});if(c&&c[0].pos!=null){let w=c[0].pos,D=c[1]&&c[1].pos;D==null&&(D=w),y={anchor:w+i,head:D+i}}return{doc:x,sel:y,from:i,to:a}}function rS(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ye&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(t.parentNode.lastChild==t||Ye&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const nS=/^(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 sS(t,e,r,n,s){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let B=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,$=Mu(t,B);if($&&!t.state.selection.eq($)){if(We&&qt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,Pr(13,"Enter"))))return;let O=t.state.tr.setSelection($);B=="pointer"?O.setMeta("pointer",!0):B=="key"&&O.scrollIntoView(),o&&O.setMeta("composition",o),t.dispatch(O)}return}let i=t.state.doc.resolve(e),a=i.sharedDepth(r);e=i.before(a+1),r=t.state.doc.resolve(r).after(a+1);let l=t.state.selection,c=tS(t,e,r),d=t.state.doc,f=d.slice(c.from,c.to),m,g;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,g="end"):(m=t.state.selection.from,g="start"),t.input.lastKeyCode=null;let y=aS(f.content,c.doc.content,c.from,m,g);if(y&&t.input.domChangeCount++,(jn&&t.input.lastIOSEnter>Date.now()-225||qt)&&s.some(B=>B.nodeType==1&&!nS.test(B.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",B=>B(t,Pr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(n&&l instanceof X&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))y={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let B=rh(t,t.state.doc,c.sel);if(B&&!B.eq(t.state.selection)){let $=t.state.tr.setSelection(B);o&&$.setMeta("composition",o),t.dispatch($)}}return}t.state.selection.from<t.state.selection.to&&y.start==y.endB&&t.state.selection instanceof X&&(y.start>t.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?y.start=t.state.selection.from:y.endA<t.state.selection.to&&y.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),tt&&xr<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>c.from&&c.doc.textBetween(y.start-c.from-1,y.start-c.from+1)=="  "&&(y.start--,y.endA--,y.endB--);let x=c.doc.resolveNoCache(y.start-c.from),w=c.doc.resolveNoCache(y.endB-c.from),D=d.resolve(y.start),E=x.sameParent(w)&&x.parent.inlineContent&&D.end()>=y.endA;if((jn&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!E&&x.pos<c.doc.content.size&&(!x.sameParent(w)||!x.parent.inlineContent)&&x.pos<w.pos&&!/\S/.test(c.doc.textBetween(x.pos,w.pos,"","")))&&t.someProp("handleKeyDown",B=>B(t,Pr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&iS(d,y.start,y.endA,x,w)&&t.someProp("handleKeyDown",B=>B(t,Pr(8,"Backspace")))){qt&&We&&t.domObserver.suppressSelectionUpdates();return}We&&y.endB==y.start&&(t.input.lastChromeDelete=Date.now()),qt&&!E&&x.start()!=w.start()&&w.parentOffset==0&&x.depth==w.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==y.endA&&(y.endB-=2,w=c.doc.resolveNoCache(y.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(B){return B(t,Pr(13,"Enter"))})},20));let S=y.start,A=y.endA,T=B=>{let $=B||t.state.tr.replace(S,A,c.doc.slice(y.start-c.from,y.endB-c.from));if(c.sel){let O=rh(t,$.doc,c.sel);O&&!(We&&t.composing&&O.empty&&(y.start!=y.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==S||O.head==$.mapping.map(A)-1)||tt&&O.empty&&O.head==S)&&$.setSelection(O)}return o&&$.setMeta("composition",o),$.scrollIntoView()},j;if(E)if(x.pos==w.pos){tt&&xr<=11&&x.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ut(t),20));let B=T(t.state.tr.delete(S,A)),$=d.resolve(y.start).marksAcross(d.resolve(y.endA));$&&B.ensureMarks($),t.dispatch(B)}else if(y.endA==y.endB&&(j=oS(x.parent.content.cut(x.parentOffset,w.parentOffset),D.parent.content.cut(D.parentOffset,y.endA-D.start())))){let B=T(t.state.tr);j.type=="add"?B.addMark(S,A,j.mark):B.removeMark(S,A,j.mark),t.dispatch(B)}else if(x.parent.child(x.index()).isText&&x.index()==w.index()-(w.textOffset?0:1)){let B=x.parent.textBetween(x.parentOffset,w.parentOffset),$=()=>T(t.state.tr.insertText(B,S,A));t.someProp("handleTextInput",O=>O(t,S,A,B,$))||t.dispatch($())}else t.dispatch(T());else t.dispatch(T())}function rh(t,e,r){return Math.max(r.anchor,r.head)>e.content.size?null:Bu(t,e.resolve(r.anchor),e.resolve(r.head))}function oS(t,e){let r=t.firstChild.marks,n=e.firstChild.marks,s=r,o=n,i,a,l;for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);for(let d=0;d<r.length;d++)o=r[d].removeFromSet(o);if(s.length==1&&o.length==0)a=s[0],i="add",l=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&o.length==1)a=o[0],i="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(_.from(c).eq(t))return{mark:a,type:i}}function iS(t,e,r,n,s){if(r-e<=s.pos-n.pos||Wa(n,!0,!1)<s.pos)return!1;let o=t.resolve(e);if(!n.parent.isTextblock){let a=o.nodeAfter;return a!=null&&r==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let i=t.resolve(Wa(o,!0,!0));return!i.parent.isTextblock||i.pos>r||Wa(i,!0,!1)<r?!1:n.parent.content.cut(n.parentOffset).eq(i.parent.content)}function Wa(t,e,r){let n=t.depth,s=e?t.end():t.pos;for(;n>0&&(e||t.indexAfter(n)==t.node(n).childCount);)n--,s++,e=!1;if(r){let o=t.node(n).maybeChild(t.indexAfter(n));for(;o&&!o.isLeaf;)o=o.firstChild,s++}return s}function aS(t,e,r,n,s){let o=t.findDiffStart(e,r);if(o==null)return null;let{a:i,b:a}=t.findDiffEnd(e,r+t.size,r+e.size);if(s=="end"){let l=Math.max(0,o-Math.min(i,a));n-=i+l-o}if(i<o&&t.size<e.size){let l=n<=o&&n>=i?o-n:0;o-=l,o&&o<e.size&&nh(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-i),i=o}else if(a<o){let l=n<=o&&n>=a?o-n:0;o-=l,o&&o<t.size&&nh(t.textBetween(o-1,o+1))&&(o+=l?1:-1),i=o+(i-a),a=o}return{start:o,endA:i,endB:a}}function nh(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),r=t.charCodeAt(1);return e>=56320&&e<=57343&&r>=55296&&r<=56319}class yg{constructor(e,r){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new SE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=r,this.state=r.state,this.directPlugins=r.plugins||[],this.directPlugins.forEach(lh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ih(this),oh(this),this.nodeViews=ah(this),this.docView=Rp(this.state.doc,sh(this),qa(this),this.dom,this),this.domObserver=new ZE(this,(n,s,o,i)=>sS(this,n,s,o,i)),this.domObserver.start(),FE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let r in e)this._props[r]=e[r];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&jl(this);let r=this._props;this._props=e,e.plugins&&(e.plugins.forEach(lh),this.directPlugins=e.plugins),this.updateStateInner(e.state,r)}setProps(e){let r={};for(let n in this._props)r[n]=this._props[n];r.state=this.state;for(let n in e)r[n]=e[n];this.update(r)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,r){var n;let s=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(dg(this),i=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=r.plugins;if(a||this._props.plugins!=r.plugins||this._props.nodeViews!=r.nodeViews){let g=ah(this);uS(g,this.nodeViews)&&(this.nodeViews=g,o=!0)}(a||r.handleDOMEvents!=this._props.handleDOMEvents)&&jl(this),this.editable=ih(this),oh(this);let l=qa(this),c=sh(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(s.selection))&&(i=!0);let m=d=="preserve"&&i&&this.dom.style.overflowAnchor==null&&$k(this);if(i){this.domObserver.stop();let g=f&&(tt||We)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&lS(s.selection,e.selection);if(f){let y=We?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=zE(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Rp(e.doc,c,l,this.dom,this)),y&&!this.trackWrites&&(g=!0)}g||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&dE(this))?Ut(this,g):(Qm(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((n=this.dragging)===null||n===void 0)&&n.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():m&&Hk(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",r=>r(this)))if(this.state.selection instanceof G){let r=this.docView.domAfterPos(this.state.selection.from);r.nodeType==1&&Bp(this,r.getBoundingClientRect(),e)}else Bp(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let r=0;r<this.directPlugins.length;r++){let n=this.directPlugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let r=0;r<this.state.plugins.length;r++){let n=this.state.plugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let r=0;r<this.pluginViews.length;r++){let n=this.pluginViews[r];n.update&&n.update(this,e)}}updateDraggedNode(e,r){let n=e.node,s=-1;if(this.state.doc.nodeAt(n.from)==n.node)s=n.from;else{let o=n.from+(this.state.doc.content.size-r.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==n.node&&(s=o)}this.dragging=new hg(e.slice,e.move,s<0?void 0:G.create(this.state.doc,s))}someProp(e,r){let n=this._props&&this._props[e],s;if(n!=null&&(s=r?r(n):n))return s;for(let i=0;i<this.directPlugins.length;i++){let a=this.directPlugins[i].props[e];if(a!=null&&(s=r?r(a):a))return s}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let a=o[i].props[e];if(a!=null&&(s=r?r(a):a))return s}}hasFocus(){if(tt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Vk(this.dom),Ut(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Jk(this,e)}coordsAtPos(e,r=1){return Wm(this,e,r)}domAtPos(e,r=0){return this.docView.domFromPos(e,r)}nodeDOM(e){let r=this.docView.descAt(e);return r?r.nodeDOM:null}posAtDOM(e,r,n=-1){let s=this.docView.posFromDOM(e,r,n);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,r){return Qk(this,r||this.state,e)}pasteHTML(e,r){return Os(this,"",e,!1,r||new ClipboardEvent("paste"))}pasteText(e,r){return Os(this,e,null,!0,r||new ClipboardEvent("paste"))}serializeForClipboard(e){return ju(this,e)}destroy(){this.docView&&(AE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Tk())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return TE(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ye&&this.root.nodeType===11&&Lk(this.dom.ownerDocument)==this.dom&&QE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}yg.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function sh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",r=>{if(typeof r=="function"&&(r=r(t.state)),r)for(let n in r)n=="class"?e.class+=" "+r[n]:n=="style"?e.style=(e.style?e.style+";":"")+r[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(r[n]))}),e.translate||(e.translate="no"),[Ge.node(0,t.state.doc.content.size,e)]}function oh(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:Ge.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ih(t){return!t.someProp("editable",e=>e(t.state)===!1)}function lS(t,e){let r=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(r)!=e.$anchor.start(r)}function ah(t){let e=Object.create(null);function r(n){for(let s in n)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=n[s])}return t.someProp("nodeViews",r),t.someProp("markViews",r),e}function uS(t,e){let r=0,n=0;for(let s in t){if(t[s]!=e[s])return!0;r++}for(let s in e)n++;return r!=n}function lh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Cr={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:"'"},Zo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cS=typeof navigator<"u"&&/Mac/.test(navigator.platform),dS=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Pe=0;Pe<10;Pe++)Cr[48+Pe]=Cr[96+Pe]=String(Pe);for(var Pe=1;Pe<=24;Pe++)Cr[Pe+111]="F"+Pe;for(var Pe=65;Pe<=90;Pe++)Cr[Pe]=String.fromCharCode(Pe+32),Zo[Pe]=String.fromCharCode(Pe);for(var Ua in Cr)Zo.hasOwnProperty(Ua)||(Zo[Ua]=Cr[Ua]);function pS(t){var e=cS&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||dS&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",r=!e&&t.key||(t.shiftKey?Zo:Cr)[t.keyCode]||t.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}const hS=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),fS=typeof navigator<"u"&&/Win/.test(navigator.platform);function mS(t){let e=t.split(/-(?!$)/),r=e[e.length-1];r=="Space"&&(r=" ");let n,s,o,i;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))hS?i=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(r="Alt-"+r),s&&(r="Ctrl-"+r),i&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function gS(t){let e=Object.create(null);for(let r in t)e[mS(r)]=t[r];return e}function Ka(t,e,r=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),r&&e.shiftKey&&(t="Shift-"+t),t}function bS(t){return new ye({props:{handleKeyDown:xg(t)}})}function xg(t){let e=gS(t);return function(r,n){let s=pS(n),o,i=e[Ka(s,n)];if(i&&i(r.state,r.dispatch,r))return!0;if(s.length==1&&s!=" "){if(n.shiftKey){let a=e[Ka(s,n,!1)];if(a&&a(r.state,r.dispatch,r))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(fS&&n.ctrlKey&&n.altKey)&&(o=Cr[n.keyCode])&&o!=s){let a=e[Ka(o,n)];if(a&&a(r.state,r.dispatch,r))return!0}}return!1}}var yS=Object.defineProperty,Pu=(t,e)=>{for(var r in e)yS(t,r,{get:e[r],enumerable:!0})};function Wi(t){const{state:e,transaction:r}=t;let{selection:n}=r,{doc:s}=r,{storedMarks:o}=r;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 o},get selection(){return n},get doc(){return s},get tr(){return n=r.selection,s=r.doc,o=r.storedMarks,r}}}var Ui=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:r}=this,{view:n}=e,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([i,a])=>[i,(...c)=>{const d=a(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:r,editor:n,state:s}=this,{view:o}=n,i=[],a=!!t,l=t||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),i.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,m])=>[f,(...y)=>{const x=this.buildProps(l,e),w=m(...y)(x);return i.push(w),d}])),run:c};return d}createCan(t){const{rawCommands:e,state:r}=this,n=!1,s=t||r.tr,o=this.buildProps(s,n);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,n)}}buildProps(t,e=!0){const{rawCommands:r,editor:n,state:s}=this,{view:o}=n,i={tr:t,editor:n,view:o,state:Wi({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([a,l])=>[a,(...c)=>l(...c)(i)]))}};return i}},vg={};Pu(vg,{blur:()=>xS,clearContent:()=>vS,clearNodes:()=>wS,command:()=>DS,createParagraphNear:()=>CS,cut:()=>kS,deleteCurrentNode:()=>ES,deleteNode:()=>SS,deleteRange:()=>FS,deleteSelection:()=>AS,enter:()=>NS,exitCode:()=>TS,extendMarkRange:()=>MS,first:()=>BS,focus:()=>OS,forEach:()=>LS,insertContent:()=>_S,insertContentAt:()=>PS,joinBackward:()=>HS,joinDown:()=>$S,joinForward:()=>VS,joinItemBackward:()=>qS,joinItemForward:()=>WS,joinTextblockBackward:()=>US,joinTextblockForward:()=>KS,joinUp:()=>zS,keyboardShortcut:()=>GS,lift:()=>YS,liftEmptyBlock:()=>ZS,liftListItem:()=>XS,newlineInCode:()=>QS,resetAttributes:()=>eF,scrollIntoView:()=>tF,selectAll:()=>rF,selectNodeBackward:()=>nF,selectNodeForward:()=>sF,selectParentNode:()=>oF,selectTextblockEnd:()=>iF,selectTextblockStart:()=>aF,setContent:()=>lF,setMark:()=>SF,setMeta:()=>FF,setNode:()=>AF,setNodeSelection:()=>NF,setTextSelection:()=>TF,sinkListItem:()=>MF,splitBlock:()=>BF,splitListItem:()=>jF,toggleList:()=>OF,toggleMark:()=>LF,toggleNode:()=>_F,toggleWrap:()=>IF,undoInputRule:()=>RF,unsetAllMarks:()=>PF,unsetMark:()=>zF,updateAttributes:()=>$F,wrapIn:()=>HF,wrapInList:()=>VF});var xS=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var r;t.isDestroyed||(e.dom.blur(),(r=window?.getSelection())==null||r.removeAllRanges())}),!0),vS=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),wS=()=>({state:t,tr:e,dispatch:r})=>{const{selection:n}=e,{ranges:s}=n;return r&&s.forEach(({$from:o,$to:i})=>{t.doc.nodesBetween(o.pos,i.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,f=c.resolve(d.map(l)),m=c.resolve(d.map(l+a.nodeSize)),g=f.blockRange(m);if(!g)return;const y=Hn(g);if(a.type.isTextblock){const{defaultType:x}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(g.start,x)}(y||y===0)&&e.lift(g,y)})}),!0},DS=t=>e=>t(e),CS=()=>({state:t,dispatch:e})=>Lm(t,e),kS=(t,e)=>({editor:r,tr:n})=>{const{state:s}=r,o=s.doc.slice(t.from,t.to);n.deleteRange(t.from,t.to);const i=n.mapping.map(e);return n.insert(i,o.content),n.setSelection(new X(n.doc.resolve(Math.max(i-1,0)))),!0},ES=()=>({tr:t,dispatch:e})=>{const{selection:r}=t,n=r.$anchor.node();if(n.content.size>0)return!1;const s=t.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===n.type){if(e){const a=s.before(o),l=s.after(o);t.delete(a,l).scrollIntoView()}return!0}return!1};function ke(t,e){if(typeof t=="string"){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}var SS=t=>({tr:e,state:r,dispatch:n})=>{const s=ke(t,r.schema),o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===s){if(n){const l=o.before(i),c=o.after(i);e.delete(l,c).scrollIntoView()}return!0}return!1},FS=t=>({tr:e,dispatch:r})=>{const{from:n,to:s}=t;return r&&e.delete(n,s),!0},AS=()=>({state:t,dispatch:e})=>Eu(t,e),NS=()=>({commands:t})=>t.keyboardShortcut("Enter"),TS=()=>({state:t,dispatch:e})=>mk(t,e);function zu(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Xo(t,e,r={strict:!0}){const n=Object.keys(e);return n.length?n.every(s=>r.strict?e[s]===t[s]:zu(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function wg(t,e,r={}){return t.find(n=>n.type===e&&Xo(Object.fromEntries(Object.keys(r).map(s=>[s,n.attrs[s]])),r))}function uh(t,e,r={}){return!!wg(t,e,r)}function $u(t,e,r){var n;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(d=>d.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(d=>d.type===e)||(r=r||((n=s.node.marks[0])==null?void 0:n.attrs),!wg([...s.node.marks],e,r)))return;let i=s.index,a=t.start()+s.offset,l=i+1,c=a+s.node.nodeSize;for(;i>0&&uh([...t.parent.child(i-1).marks],e,r);)i-=1,a-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&uh([...t.parent.child(l).marks],e,r);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function er(t,e){if(typeof t=="string"){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}var MS=(t,e={})=>({tr:r,state:n,dispatch:s})=>{const o=er(t,n.schema),{doc:i,selection:a}=r,{$from:l,from:c,to:d}=a;if(s){const f=$u(l,o,e);if(f&&f.from<=c&&f.to>=d){const m=X.create(i,f.from,f.to);r.setSelection(m)}}return!0},BS=t=>e=>{const r=typeof t=="function"?t(e):t;for(let n=0;n<r.length;n+=1)if(r[n](e))return!0;return!1};function Dg(t){return t instanceof X}function qr(t=0,e=0,r=0){return Math.min(Math.max(t,e),r)}function Cg(t,e=null){if(!e)return null;const r=ne.atStart(t),n=ne.atEnd(t);if(e==="start"||e===!0)return r;if(e==="end")return n;const s=r.from,o=n.to;return e==="all"?X.create(t,qr(0,s,o),qr(t.content.size,s,o)):X.create(t,qr(e,s,o),qr(e,s,o))}function jS(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Hu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var OS=(t=null,e={})=>({editor:r,view:n,tr:s,dispatch:o})=>{e={scrollIntoView:!0,...e};const i=()=>{(Hu()||jS())&&n.dom.focus(),requestAnimationFrame(()=>{r.isDestroyed||(n.focus(),e?.scrollIntoView&&r.commands.scrollIntoView())})};if(n.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!Dg(r.state.selection))return i(),!0;const a=Cg(s.doc,t)||r.state.selection,l=r.state.selection.eq(a);return o&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),i()),!0},LS=(t,e)=>r=>t.every((n,s)=>e(n,{...r,index:s})),_S=(t,e)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},t,e),kg=t=>{const e=t.childNodes;for(let r=e.length-1;r>=0;r-=1){const n=e[r];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?t.removeChild(n):n.nodeType===1&&kg(n)}return t};function wo(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,r=new window.DOMParser().parseFromString(e,"text/html").body;return kg(r)}function _s(t,e,r){if(t instanceof Ct||t instanceof _)return t;r={slice:!0,parseOptions:{},...r};const n=typeof t=="object"&&t!==null,s=typeof t=="string";if(n)try{if(Array.isArray(t)&&t.length>0)return _.fromArray(t.map(a=>e.nodeFromJSON(a)));const i=e.nodeFromJSON(t);return r.errorOnInvalidContent&&i.check(),i}catch(o){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),_s("",e,r)}if(s){if(r.errorOnInvalidContent){let i=!1,a="";const l=new lm({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(r.slice?yr.fromSchema(l).parseSlice(wo(t),r.parseOptions):yr.fromSchema(l).parse(wo(t),r.parseOptions),r.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=yr.fromSchema(e);return r.slice?o.parseSlice(wo(t),r.parseOptions).content:o.parse(wo(t),r.parseOptions)}return _s("",e,r)}function IS(t,e,r){const n=t.steps.length-1;if(n<e)return;const s=t.steps[n];if(!(s instanceof Me||s instanceof Be))return;const o=t.mapping.maps[n];let i=0;o.forEach((a,l,c,d)=>{i===0&&(i=d)}),t.setSelection(ne.near(t.doc.resolve(i),r))}var RS=t=>!("type"in t),PS=(t,e,r)=>({tr:n,dispatch:s,editor:o})=>{var i;if(s){r={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};let a;const l=w=>{o.emit("contentError",{editor:o,error:w,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{_s(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(w){l(w)}try{a=_s(e,o.schema,{parseOptions:c,errorOnInvalidContent:(i=r.errorOnInvalidContent)!=null?i:o.options.enableContentCheck})}catch(w){return l(w),!1}let{from:d,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},m=!0,g=!0;if((RS(a)?a:[a]).forEach(w=>{w.check(),m=m?w.isText&&w.marks.length===0:!1,g=g?w.isBlock:!1}),d===f&&g){const{parent:w}=n.doc.resolve(d);w.isTextblock&&!w.type.spec.code&&!w.childCount&&(d-=1,f+=1)}let x;if(m){if(Array.isArray(e))x=e.map(w=>w.text||"").join("");else if(e instanceof _){let w="";e.forEach(D=>{D.text&&(w+=D.text)}),x=w}else typeof e=="object"&&e&&e.text?x=e.text:x=e;n.insertText(x,d,f)}else{x=a;const w=n.doc.resolve(d),D=w.node(),E=w.parentOffset===0,S=D.isText||D.isTextblock,A=D.content.size>0;E&&S&&A&&(d=Math.max(0,d-1)),n.replaceWith(d,f,x)}r.updateSelection&&IS(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:d,text:x}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:d,text:x})}return!0},zS=()=>({state:t,dispatch:e})=>pk(t,e),$S=()=>({state:t,dispatch:e})=>hk(t,e),HS=()=>({state:t,dispatch:e})=>Am(t,e),VS=()=>({state:t,dispatch:e})=>Bm(t,e),qS=()=>({state:t,dispatch:e,tr:r})=>{try{const n=Pi(t.doc,t.selection.$from.pos,-1);return n==null?!1:(r.join(n,2),e&&e(r),!0)}catch{return!1}},WS=()=>({state:t,dispatch:e,tr:r})=>{try{const n=Pi(t.doc,t.selection.$from.pos,1);return n==null?!1:(r.join(n,2),e&&e(r),!0)}catch{return!1}},US=()=>({state:t,dispatch:e})=>ck(t,e),KS=()=>({state:t,dispatch:e})=>dk(t,e);function Eg(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function JS(t){const e=t.split(/-(?!$)/);let r=e[e.length-1];r==="Space"&&(r=" ");let n,s,o,i;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Hu()||Eg()?i=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(r=`Alt-${r}`),s&&(r=`Ctrl-${r}`),i&&(r=`Meta-${r}`),o&&(r=`Shift-${r}`),r}var GS=t=>({editor:e,view:r,tr:n,dispatch:s})=>{const o=JS(t).split(/-(?!$)/),i=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{r.someProp("handleKeyDown",c=>c(r,a))});return l?.steps.forEach(c=>{const d=c.map(n.mapping);d&&s&&n.maybeStep(d)}),!0};function kr(t,e,r={}){const{from:n,to:s,empty:o}=t.selection,i=e?ke(e,t.schema):null,a=[];t.doc.nodesBetween(n,s,(f,m)=>{if(f.isText)return;const g=Math.max(n,m),y=Math.min(s,m+f.nodeSize);a.push({node:f,from:g,to:y})});const l=s-n,c=a.filter(f=>i?i.name===f.node.type.name:!0).filter(f=>Xo(f.node.attrs,r,{strict:!1}));return o?!!c.length:c.reduce((f,m)=>f+m.to-m.from,0)>=l}var YS=(t,e={})=>({state:r,dispatch:n})=>{const s=ke(t,r.schema);return kr(r,s,e)?fk(r,n):!1},ZS=()=>({state:t,dispatch:e})=>_m(t,e),XS=t=>({state:e,dispatch:r})=>{const n=ke(t,e.schema);return Sk(n)(e,r)},QS=()=>({state:t,dispatch:e})=>Om(t,e);function Ki(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ch(t,e){const r=typeof e=="string"?[e]:e;return Object.keys(t).reduce((n,s)=>(r.includes(s)||(n[s]=t[s]),n),{})}var eF=(t,e)=>({tr:r,state:n,dispatch:s})=>{let o=null,i=null;const a=Ki(typeof t=="string"?t:t.name,n.schema);return a?(a==="node"&&(o=ke(t,n.schema)),a==="mark"&&(i=er(t,n.schema)),s&&r.selection.ranges.forEach(l=>{n.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{o&&o===c.type&&r.setNodeMarkup(d,void 0,ch(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(f=>{i===f.type&&r.addMark(d,d+c.nodeSize,i.create(ch(f.attrs,e)))})})}),!0):!1},tF=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),rF=()=>({tr:t,dispatch:e})=>{if(e){const r=new ot(t.doc);t.setSelection(r)}return!0},nF=()=>({state:t,dispatch:e})=>Tm(t,e),sF=()=>({state:t,dispatch:e})=>jm(t,e),oF=()=>({state:t,dispatch:e})=>yk(t,e),iF=()=>({state:t,dispatch:e})=>wk(t,e),aF=()=>({state:t,dispatch:e})=>vk(t,e);function Ol(t,e,r={},n={}){return _s(t,e,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var lF=(t,{errorOnInvalidContent:e,emitUpdate:r=!0,parseOptions:n={}}={})=>({editor:s,tr:o,dispatch:i,commands:a})=>{const{doc:l}=o;if(n.preserveWhitespace!=="full"){const c=Ol(t,s.schema,n,{errorOnInvalidContent:e??s.options.enableContentCheck});return i&&o.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!r),!0}return i&&o.setMeta("preventUpdate",!r),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:n,errorOnInvalidContent:e??s.options.enableContentCheck})};function Sg(t,e){const r=er(e,t.schema),{from:n,to:s,empty:o}=t.selection,i=[];o?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(n,s,l=>{i.push(...l.marks)});const a=i.find(l=>l.type.name===r.name);return a?{...a.attrs}:{}}function Fg(t,e){const r=new km(t);return e.forEach(n=>{n.steps.forEach(s=>{r.step(s)})}),r}function uF(t){for(let e=0;e<t.edgeCount;e+=1){const{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function cF(t,e,r){const n=[];return t.nodesBetween(e.from,e.to,(s,o)=>{r(s)&&n.push({node:s,pos:o})}),n}function dF(t,e){for(let r=t.depth;r>0;r-=1){const n=t.node(r);if(e(n))return{pos:r>0?t.before(r):0,start:t.start(r),depth:r,node:n}}}function Ji(t){return e=>dF(e.$from,t)}function J(t,e,r){return t.config[e]===void 0&&t.parent?J(t.parent,e,r):typeof t.config[e]=="function"?t.config[e].bind({...r,parent:t.parent?J(t.parent,e,r):null}):t.config[e]}function Vu(t){return t.map(e=>{const r={name:e.name,options:e.options,storage:e.storage},n=J(e,"addExtensions",r);return n?[e,...Vu(n())]:e}).flat(10)}function qu(t,e){const r=an.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(r),s.innerHTML}function Ag(t){return typeof t=="function"}function le(t,e=void 0,...r){return Ag(t)?e?t.bind(e)(...r):t(...r):t}function pF(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Is(t){const e=t.filter(s=>s.type==="extension"),r=t.filter(s=>s.type==="node"),n=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:r,markExtensions:n}}function Ng(t){const e=[],{nodeExtensions:r,markExtensions:n}=Is(t),s=[...r,...n],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage,extensions:s},l=J(i,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([m,g])=>{e.push({type:f,name:m,attribute:{...o,...g}})})})})}),s.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage},l=J(i,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,f])=>{const m={...o,...f};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:i.name,name:d,attribute:m})})}),e}function xe(...t){return t.filter(e=>!!e).reduce((e,r)=>{const n={...e};return Object.entries(r).forEach(([s,o])=>{if(!n[s]){n[s]=o;return}if(s==="class"){const a=o?String(o).split(" "):[],l=n[s]?n[s].split(" "):[],c=a.filter(d=>!l.includes(d));n[s]=[...l,...c].join(" ")}else if(s==="style"){const a=o?o.split(";").map(d=>d.trim()).filter(Boolean):[],l=n[s]?n[s].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[f,m]=d.split(":").map(g=>g.trim());c.set(f,m)}),a.forEach(d=>{const[f,m]=d.split(":").map(g=>g.trim());c.set(f,m)}),n[s]=Array.from(c.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else n[s]=o}),n},{})}function Qo(t,e){return e.filter(r=>r.type===t.type.name).filter(r=>r.attribute.rendered).map(r=>r.attribute.renderHTML?r.attribute.renderHTML(t.attrs)||{}:{[r.name]:t.attrs[r.name]}).reduce((r,n)=>xe(r,n),{})}function hF(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function dh(t,e){return"style"in t?t:{...t,getAttrs:r=>{const n=t.getAttrs?t.getAttrs(r):t.attrs;if(n===!1)return!1;const s=e.reduce((o,i)=>{const a=i.attribute.parseHTML?i.attribute.parseHTML(r):hF(r.getAttribute(i.name));return a==null?o:{...o,[i.name]:a}},{});return{...n,...s}}}}function ph(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>e==="attrs"&&pF(r)?!1:r!=null))}function fF(t,e){var r;const n=Ng(t),{nodeExtensions:s,markExtensions:o}=Is(t),i=(r=s.find(c=>J(c,"topNode")))==null?void 0:r.name,a=Object.fromEntries(s.map(c=>{const d=n.filter(D=>D.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((D,E)=>{const S=J(E,"extendNodeSchema",f);return{...D,...S?S(c):{}}},{}),g=ph({...m,content:le(J(c,"content",f)),marks:le(J(c,"marks",f)),group:le(J(c,"group",f)),inline:le(J(c,"inline",f)),atom:le(J(c,"atom",f)),selectable:le(J(c,"selectable",f)),draggable:le(J(c,"draggable",f)),code:le(J(c,"code",f)),whitespace:le(J(c,"whitespace",f)),linebreakReplacement:le(J(c,"linebreakReplacement",f)),defining:le(J(c,"defining",f)),isolating:le(J(c,"isolating",f)),attrs:Object.fromEntries(d.map(D=>{var E,S;return[D.name,{default:(E=D?.attribute)==null?void 0:E.default,validate:(S=D?.attribute)==null?void 0:S.validate}]}))}),y=le(J(c,"parseHTML",f));y&&(g.parseDOM=y.map(D=>dh(D,d)));const x=J(c,"renderHTML",f);x&&(g.toDOM=D=>x({node:D,HTMLAttributes:Qo(D,d)}));const w=J(c,"renderText",f);return w&&(g.toText=w),[c.name,g]})),l=Object.fromEntries(o.map(c=>{const d=n.filter(w=>w.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((w,D)=>{const E=J(D,"extendMarkSchema",f);return{...w,...E?E(c):{}}},{}),g=ph({...m,inclusive:le(J(c,"inclusive",f)),excludes:le(J(c,"excludes",f)),group:le(J(c,"group",f)),spanning:le(J(c,"spanning",f)),code:le(J(c,"code",f)),attrs:Object.fromEntries(d.map(w=>{var D,E;return[w.name,{default:(D=w?.attribute)==null?void 0:D.default,validate:(E=w?.attribute)==null?void 0:E.validate}]}))}),y=le(J(c,"parseHTML",f));y&&(g.parseDOM=y.map(w=>dh(w,d)));const x=J(c,"renderHTML",f);return x&&(g.toDOM=w=>x({mark:w,HTMLAttributes:Qo(w,d)})),[c.name,g]}));return new lm({topNode:i,nodes:a,marks:l})}function mF(t){const e=t.filter((r,n)=>t.indexOf(r)!==n);return Array.from(new Set(e))}function Wu(t){return t.sort((r,n)=>{const s=J(r,"priority")||100,o=J(n,"priority")||100;return s>o?-1:s<o?1:0})}function Tg(t){const e=Wu(Vu(t)),r=mF(e.map(n=>n.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function Mg(t,e,r){const{from:n,to:s}=e,{blockSeparator:o=`
76
+
77
+ `,textSerializers:i={}}=r||{};let a="";return t.nodesBetween(n,s,(l,c,d,f)=>{var m;l.isBlock&&c>n&&(a+=o);const g=i?.[l.type.name];if(g)return d&&(a+=g({node:l,pos:c,parent:d,index:f,range:e})),!1;l.isText&&(a+=(m=l?.text)==null?void 0:m.slice(Math.max(n,c)-c,s-c))}),a}function gF(t,e){const r={from:0,to:t.content.size};return Mg(t,r,e)}function Bg(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,r])=>[e,r.spec.toText]))}function bF(t,e){const r=ke(e,t.schema),{from:n,to:s}=t.selection,o=[];t.doc.nodesBetween(n,s,a=>{o.push(a)});const i=o.reverse().find(a=>a.type.name===r.name);return i?{...i.attrs}:{}}function jg(t,e){const r=Ki(typeof e=="string"?e:e.name,t.schema);return r==="node"?bF(t,e):r==="mark"?Sg(t,e):{}}function yF(t,e=JSON.stringify){const r={};return t.filter(n=>{const s=e(n);return Object.prototype.hasOwnProperty.call(r,s)?!1:r[s]=!0})}function xF(t){const e=yF(t);return e.length===1?e:e.filter((r,n)=>!e.filter((o,i)=>i!==n).some(o=>r.oldRange.from>=o.oldRange.from&&r.oldRange.to<=o.oldRange.to&&r.newRange.from>=o.newRange.from&&r.newRange.to<=o.newRange.to))}function Og(t){const{mapping:e,steps:r}=t,n=[];return e.maps.forEach((s,o)=>{const i=[];if(s.ranges.length)s.forEach((a,l)=>{i.push({from:a,to:l})});else{const{from:a,to:l}=r[o];if(a===void 0||l===void 0)return;i.push({from:a,to:l})}i.forEach(({from:a,to:l})=>{const c=e.slice(o).map(a,-1),d=e.slice(o).map(l),f=e.invert().map(c,-1),m=e.invert().map(d);n.push({oldRange:{from:f,to:m},newRange:{from:c,to:d}})})}),xF(n)}function Uu(t,e,r){const n=[];return t===e?r.resolve(t).marks().forEach(s=>{const o=r.resolve(t),i=$u(o,s.type);i&&n.push({mark:s,...i})}):r.nodesBetween(t,e,(s,o)=>{!s||s?.nodeSize===void 0||n.push(...s.marks.map(i=>({from:o,to:o+s.nodeSize,mark:i})))}),n}var vF=(t,e,r,n=20)=>{const s=t.doc.resolve(r);let o=n,i=null;for(;o>0&&i===null;){const a=s.node(o);a?.type.name===e?i=a:o-=1}return[i,o]};function Ja(t,e){return e.nodes[t]||e.marks[t]||null}function Lo(t,e,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{const s=t.find(o=>o.type===e&&o.name===n);return s?s.attribute.keepOnSplit:!1}))}var wF=(t,e=500)=>{let r="";const n=t.parentOffset;return t.parent.nodesBetween(Math.max(0,n-e),n,(s,o,i,a)=>{var l,c;const d=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:o,parent:i,index:a}))||s.textContent||"%leaf%";r+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,n-o))}),r};function Ll(t,e,r={}){const{empty:n,ranges:s}=t.selection,o=e?er(e,t.schema):null;if(n)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>Xo(f.attrs,r,{strict:!1}));let i=0;const a=[];if(s.forEach(({$from:f,$to:m})=>{const g=f.pos,y=m.pos;t.doc.nodesBetween(g,y,(x,w)=>{if(!x.isText&&!x.marks.length)return;const D=Math.max(g,w),E=Math.min(y,w+x.nodeSize),S=E-D;i+=S,a.push(...x.marks.map(A=>({mark:A,from:D,to:E})))})}),i===0)return!1;const l=a.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>Xo(f.mark.attrs,r,{strict:!1})).reduce((f,m)=>f+m.to-m.from,0),c=a.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,m)=>f+m.to-m.from,0);return(l>0?l+c:l)>=i}function DF(t,e,r={}){if(!e)return kr(t,null,r)||Ll(t,null,r);const n=Ki(e,t.schema);return n==="node"?kr(t,e,r):n==="mark"?Ll(t,e,r):!1}var CF=(t,e)=>{const{$from:r,$to:n,$anchor:s}=t.selection;if(e){const o=Ji(a=>a.type.name===e)(t.selection);if(!o)return!1;const i=t.doc.resolve(o.pos+1);return s.pos+1===i.end()}return!(n.parentOffset<n.parent.nodeSize-2||r.pos!==n.pos)},kF=t=>{const{$from:e,$to:r}=t.selection;return!(e.parentOffset>0||e.pos!==r.pos)};function hh(t,e){return Array.isArray(e)?e.some(r=>(typeof r=="string"?r:r.name)===t.name):e}function fh(t,e){const{nodeExtensions:r}=Is(e),n=r.find(i=>i.name===t);if(!n)return!1;const s={name:n.name,options:n.options,storage:n.storage},o=le(J(n,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function Gi(t,{checkChildren:e=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((n=t.text)!=null?n:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(o=>{s!==!1&&(Gi(o,{ignoreWhitespace:r,checkChildren:e})||(s=!1))}),s}return!1}function Lg(t){return t instanceof G}function EF(t,e,r){var n;const{selection:s}=e;let o=null;if(Dg(s)&&(o=s.$cursor),o){const a=(n=t.storedMarks)!=null?n:o.marks();return o.parent.type.allowsMarkType(r)&&(!!r.isInSet(a)||!a.some(c=>c.type.excludes(r)))}const{ranges:i}=s;return i.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(r):!1;return t.doc.nodesBetween(a.pos,l.pos,(d,f,m)=>{if(c)return!1;if(d.isInline){const g=!m||m.type.allowsMarkType(r),y=!!r.isInSet(d.marks)||!d.marks.some(x=>x.type.excludes(r));c=g&&y}return!c}),c})}var SF=(t,e={})=>({tr:r,state:n,dispatch:s})=>{const{selection:o}=r,{empty:i,ranges:a}=o,l=er(t,n.schema);if(s)if(i){const c=Sg(n,l);r.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,f=c.$to.pos;n.doc.nodesBetween(d,f,(m,g)=>{const y=Math.max(g,d),x=Math.min(g+m.nodeSize,f);m.marks.find(D=>D.type===l)?m.marks.forEach(D=>{l===D.type&&r.addMark(y,x,l.create({...D.attrs,...e}))}):r.addMark(y,x,l.create(e))})});return EF(n,r,l)},FF=(t,e)=>({tr:r})=>(r.setMeta(t,e),!0),AF=(t,e={})=>({state:r,dispatch:n,chain:s})=>{const o=ke(t,r.schema);let i;return r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:a})=>Np(o,{...i,...e})(r)?!0:a.clearNodes()).command(({state:a})=>Np(o,{...i,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},NF=t=>({tr:e,dispatch:r})=>{if(r){const{doc:n}=e,s=qr(t,0,n.content.size),o=G.create(n,s);e.setSelection(o)}return!0},TF=t=>({tr:e,dispatch:r})=>{if(r){const{doc:n}=e,{from:s,to:o}=typeof t=="number"?{from:t,to:t}:t,i=X.atStart(n).from,a=X.atEnd(n).to,l=qr(s,i,a),c=qr(o,i,a),d=X.create(n,l,c);e.setSelection(d)}return!0},MF=t=>({state:e,dispatch:r})=>{const n=ke(t,e.schema);return Nk(n)(e,r)};function mh(t,e){const r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(r){const n=r.filter(s=>e?.includes(s.type.name));t.tr.ensureMarks(n)}}var BF=({keepMarks:t=!0}={})=>({tr:e,state:r,dispatch:n,editor:s})=>{const{selection:o,doc:i}=e,{$from:a,$to:l}=o,c=s.extensionManager.attributes,d=Lo(c,a.node().type.name,a.node().attrs);if(o instanceof G&&o.node.isBlock)return!a.parentOffset||!Wt(i,a.pos)?!1:(n&&(t&&mh(r,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,m=a.depth===0?void 0:uF(a.node(-1).contentMatchAt(a.indexAfter(-1)));let g=f&&m?[{type:m,attrs:d}]:void 0,y=Wt(e.doc,e.mapping.map(a.pos),1,g);if(!g&&!y&&Wt(e.doc,e.mapping.map(a.pos),1,m?[{type:m}]:void 0)&&(y=!0,g=m?[{type:m,attrs:d}]:void 0),n){if(y&&(o instanceof X&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,g),m&&!f&&!a.parentOffset&&a.parent.type!==m)){const x=e.mapping.map(a.before()),w=e.doc.resolve(x);a.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(a.before()),m)}t&&mh(r,s.extensionManager.splittableMarks),e.scrollIntoView()}return y},jF=(t,e={})=>({tr:r,state:n,dispatch:s,editor:o})=>{var i;const a=ke(t,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const f=l.node(-1);if(f.type!==a)return!1;const m=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let D=_.empty;const E=l.index(-1)?1:l.index(-2)?2:3;for(let $=l.depth-E;$>=l.depth-3;$-=1)D=_.from(l.node($).copy(D));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,A={...Lo(m,l.node().type.name,l.node().attrs),...e},T=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill(A))||void 0;D=D.append(_.from(a.createAndFill(null,T)||void 0));const j=l.before(l.depth-(E-1));r.replace(j,l.after(-S),new V(D,4-E,0));let B=-1;r.doc.nodesBetween(j,r.doc.content.size,($,O)=>{if(B>-1)return!1;$.isTextblock&&$.content.size===0&&(B=O+1)}),B>-1&&r.setSelection(X.near(r.doc.resolve(B))),r.scrollIntoView()}return!0}const g=c.pos===l.end()?f.contentMatchAt(0).defaultType:null,y={...Lo(m,f.type.name,f.attrs),...e},x={...Lo(m,l.node().type.name,l.node().attrs),...e};r.delete(l.pos,c.pos);const w=g?[{type:a,attrs:y},{type:g,attrs:x}]:[{type:a,attrs:y}];if(!Wt(r.doc,l.pos,2))return!1;if(s){const{selection:D,storedMarks:E}=n,{splittableMarks:S}=o.extensionManager,A=E||D.$to.parentOffset&&D.$from.marks();if(r.split(l.pos,2,w).scrollIntoView(),!A||!s)return!0;const T=A.filter(j=>S.includes(j.type.name));r.ensureMarks(T)}return!0},Ga=(t,e)=>{const r=Ji(i=>i.type===e)(t.selection);if(!r)return!0;const n=t.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0)return!0;const s=t.doc.nodeAt(n);return r.node.type===s?.type&&Fr(t.doc,r.pos)&&t.join(r.pos),!0},Ya=(t,e)=>{const r=Ji(i=>i.type===e)(t.selection);if(!r)return!0;const n=t.doc.resolve(r.start).after(r.depth);if(n===void 0)return!0;const s=t.doc.nodeAt(n);return r.node.type===s?.type&&Fr(t.doc,n)&&t.join(n),!0},OF=(t,e,r,n={})=>({editor:s,tr:o,state:i,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:f,splittableMarks:m}=s.extensionManager,g=ke(t,i.schema),y=ke(e,i.schema),{selection:x,storedMarks:w}=i,{$from:D,$to:E}=x,S=D.blockRange(E),A=w||x.$to.parentOffset&&x.$from.marks();if(!S)return!1;const T=Ji(j=>fh(j.type.name,f))(x);if(S.depth>=1&&T&&S.depth-T.depth<=1){if(T.node.type===g)return c.liftListItem(y);if(fh(T.node.type.name,f)&&g.validContent(T.node.content)&&a)return l().command(()=>(o.setNodeMarkup(T.pos,g),!0)).command(()=>Ga(o,g)).command(()=>Ya(o,g)).run()}return!r||!A||!a?l().command(()=>d().wrapInList(g,n)?!0:c.clearNodes()).wrapInList(g,n).command(()=>Ga(o,g)).command(()=>Ya(o,g)).run():l().command(()=>{const j=d().wrapInList(g,n),B=A.filter($=>m.includes($.type.name));return o.ensureMarks(B),j?!0:c.clearNodes()}).wrapInList(g,n).command(()=>Ga(o,g)).command(()=>Ya(o,g)).run()},LF=(t,e={},r={})=>({state:n,commands:s})=>{const{extendEmptyMarkRange:o=!1}=r,i=er(t,n.schema);return Ll(n,i,e)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,e)},_F=(t,e,r={})=>({state:n,commands:s})=>{const o=ke(t,n.schema),i=ke(e,n.schema),a=kr(n,o,r);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?s.setNode(i,l):s.setNode(o,{...l,...r})},IF=(t,e={})=>({state:r,commands:n})=>{const s=ke(t,r.schema);return kr(r,s,e)?n.lift(s):n.wrapIn(s,e)},RF=()=>({state:t,dispatch:e})=>{const r=t.plugins;for(let n=0;n<r.length;n+=1){const s=r[n];let o;if(s.spec.isInputRules&&(o=s.getState(t))){if(e){const i=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)i.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=i.doc.resolve(o.from).marks();i.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else i.delete(o.from,o.to)}return!0}}return!1},PF=()=>({tr:t,dispatch:e})=>{const{selection:r}=t,{empty:n,ranges:s}=r;return n||e&&s.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},zF=(t,e={})=>({tr:r,state:n,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=r,l=er(t,n.schema),{$from:c,empty:d,ranges:f}=a;if(!s)return!0;if(d&&i){let{from:m,to:g}=a;const y=(o=c.marks().find(w=>w.type===l))==null?void 0:o.attrs,x=$u(c,l,y);x&&(m=x.from,g=x.to),r.removeMark(m,g,l)}else f.forEach(m=>{r.removeMark(m.$from.pos,m.$to.pos,l)});return r.removeStoredMark(l),!0},$F=(t,e={})=>({tr:r,state:n,dispatch:s})=>{let o=null,i=null;const a=Ki(typeof t=="string"?t:t.name,n.schema);return a?(a==="node"&&(o=ke(t,n.schema)),a==="mark"&&(i=er(t,n.schema)),s&&r.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let f,m,g,y;r.selection.empty?n.doc.nodesBetween(c,d,(x,w)=>{o&&o===x.type&&(g=Math.max(w,c),y=Math.min(w+x.nodeSize,d),f=w,m=x)}):n.doc.nodesBetween(c,d,(x,w)=>{w<c&&o&&o===x.type&&(g=Math.max(w,c),y=Math.min(w+x.nodeSize,d),f=w,m=x),w>=c&&w<=d&&(o&&o===x.type&&r.setNodeMarkup(w,void 0,{...x.attrs,...e}),i&&x.marks.length&&x.marks.forEach(D=>{if(i===D.type){const E=Math.max(w,c),S=Math.min(w+x.nodeSize,d);r.addMark(E,S,i.create({...D.attrs,...e}))}}))}),m&&(f!==void 0&&r.setNodeMarkup(f,void 0,{...m.attrs,...e}),i&&m.marks.length&&m.marks.forEach(x=>{i===x.type&&r.addMark(g,y,i.create({...x.attrs,...e}))}))}),!0):!1},HF=(t,e={})=>({state:r,dispatch:n})=>{const s=ke(t,r.schema);return Dk(s,e)(r,n)},VF=(t,e={})=>({state:r,dispatch:n})=>{const s=ke(t,r.schema);return Ck(s,e)(r,n)},qF=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const r=this.callbacks[t];return r&&r.forEach(n=>n.apply(this,e)),this}off(t,e){const r=this.callbacks[t];return r&&(e?this.callbacks[t]=r.filter(n=>n!==e):delete this.callbacks[t]),this}once(t,e){const r=(...n)=>{this.off(t,r),e.apply(this,n)};return this.on(t,r)}removeAllListeners(){this.callbacks={}}},Yi=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},WF=(t,e)=>{if(zu(e))return e.exec(t);const r=e(t);if(!r)return null;const n=[r.text];return n.index=r.index,n.input=t,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n};function Do(t){var e;const{editor:r,from:n,to:s,text:o,rules:i,plugin:a}=t,{view:l}=r;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(m=>m.type.spec.code))return!1;let d=!1;const f=wF(c)+o;return i.forEach(m=>{if(d)return;const g=WF(f,m.find);if(!g)return;const y=l.state.tr,x=Wi({state:l.state,transaction:y}),w={from:n-(g[0].length-o.length),to:s},{commands:D,chain:E,can:S}=new Ui({editor:r,state:x});m.handler({state:x,range:w,match:g,commands:D,chain:E,can:S})===null||!y.steps.length||(m.undoable&&y.setMeta(a,{transform:y,from:n,to:s,text:o}),l.dispatch(y),d=!0)}),d}function UF(t){const{editor:e,rules:r}=t,n=new ye({state:{init(){return null},apply(s,o,i){const a=s.getMeta(n);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=qu(_.from(d),i.schema);const{from:f}=l,m=f+d.length;Do({editor:e,from:f,to:m,text:d,rules:r,plugin:n})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,i,a){return Do({editor:e,from:o,to:i,text:a,rules:r,plugin:n})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&Do({editor:e,from:o.pos,to:o.pos,text:"",rules:r,plugin:n})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:i}=s.state.selection;return i?Do({editor:e,from:i.pos,to:i.pos,text:`
78
+ `,rules:r,plugin:n}):!1}},isInputRules:!0});return n}function KF(t){return Object.prototype.toString.call(t).slice(8,-1)}function Co(t){return KF(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function _g(t,e){const r={...t};return Co(t)&&Co(e)&&Object.keys(e).forEach(n=>{Co(e[n])&&Co(t[n])?r[n]=_g(t[n],e[n]):r[n]=e[n]}),r}var Ku=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{...le(J(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...le(J(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>_g(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}},Nr=class Ig extends Ku{constructor(){super(...arguments),this.type="mark"}static create(e={}){const r=typeof e=="function"?e():e;return new Ig(r)}static handleExit({editor:e,mark:r}){const{tr:n}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!!!i.find(c=>c?.type.name===r.name))return!1;const l=i.find(c=>c?.type.name===r.name);return l&&n.removeStoredMark(l),n.insertText(" ",s.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const r=typeof e=="function"?e():e;return super.extend(r)}};function JF(t){return typeof t=="number"}var GF=class{constructor(t){this.find=t.find,this.handler=t.handler}},YF=(t,e,r)=>{if(zu(e))return[...t.matchAll(e)];const n=e(t,r);return n?n.map(s=>{const o=[s.text];return o.index=s.index,o.input=t,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function ZF(t){const{editor:e,state:r,from:n,to:s,rule:o,pasteEvent:i,dropEvent:a}=t,{commands:l,chain:c,can:d}=new Ui({editor:e,state:r}),f=[];return r.doc.nodesBetween(n,s,(g,y)=>{var x,w,D,E,S;if((w=(x=g.type)==null?void 0:x.spec)!=null&&w.code||!(g.isText||g.isTextblock||g.isInline))return;const A=(S=(E=(D=g.content)==null?void 0:D.size)!=null?E:g.nodeSize)!=null?S:0,T=Math.max(n,y),j=Math.min(s,y+A);if(T>=j)return;const B=g.isText?g.text||"":g.textBetween(T-y,j-y,void 0,"");YF(B,o.find,i).forEach(O=>{if(O.index===void 0)return;const P=T+O.index+1,L=P+O[0].length,H={from:r.tr.mapping.map(P),to:r.tr.mapping.map(L)},Y=o.handler({state:r,range:H,match:O,commands:l,chain:c,can:d,pasteEvent:i,dropEvent:a});f.push(Y)})}),f.every(g=>g!==null)}var ko=null,XF=t=>{var e;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=r.clipboardData)==null||e.setData("text/html",t),r};function QF(t){const{editor:e,rules:r}=t;let n=null,s=!1,o=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:f,to:m,rule:g,pasteEvt:y})=>{const x=d.tr,w=Wi({state:d,transaction:x});if(!(!ZF({editor:e,state:w,from:Math.max(f-1,0),to:m.b-1,rule:g,pasteEvent:y,dropEvent:a})||!x.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,x}};return r.map(d=>new ye({view(f){const m=y=>{var x;n=(x=f.dom.parentElement)!=null&&x.contains(y.target)?f.dom.parentElement:null,n&&(ko=e)},g=()=>{ko&&(ko=null)};return window.addEventListener("dragstart",m),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",m),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(f,m)=>{if(o=n===f.dom.parentElement,a=m,!o){const g=ko;g?.isEditable&&setTimeout(()=>{const y=g.state.selection;y&&g.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(f,m)=>{var g;const y=(g=m.clipboardData)==null?void 0:g.getData("text/html");return i=m,s=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(f,m,g)=>{const y=f[0],x=y.getMeta("uiEvent")==="paste"&&!s,w=y.getMeta("uiEvent")==="drop"&&!o,D=y.getMeta("applyPasteRules"),E=!!D;if(!x&&!w&&!E)return;if(E){let{text:T}=D;typeof T=="string"?T=T:T=qu(_.from(T),g.schema);const{from:j}=D,B=j+T.length,$=XF(T);return l({rule:d,state:g,from:j,to:{b:B},pasteEvt:$})}const S=m.doc.content.findDiffStart(g.doc.content),A=m.doc.content.findDiffEnd(g.doc.content);if(!(!JF(S)||!A||S===A.b))return l({rule:d,state:g,from:S,to:A,pasteEvt:i})}}))}var Zi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Tg(t),this.schema=fF(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ja(e.name,this.schema)},n=J(e,"addCommands",r);return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this;return Wu([...this.extensions].reverse()).flatMap(n=>{const s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ja(n.name,this.schema)},o=[],i=J(n,"addKeyboardShortcuts",s);let a={};if(n.type==="mark"&&J(n,"exitable",s)&&(a.ArrowRight=()=>Nr.handleExit({editor:t,mark:n})),i){const m=Object.fromEntries(Object.entries(i()).map(([g,y])=>[g,()=>y({editor:t})]));a={...a,...m}}const l=bS(a);o.push(l);const c=J(n,"addInputRules",s);if(hh(n,t.options.enableInputRules)&&c){const m=c();if(m&&m.length){const g=UF({editor:t,rules:m}),y=Array.isArray(g)?g:[g];o.push(...y)}}const d=J(n,"addPasteRules",s);if(hh(n,t.options.enablePasteRules)&&d){const m=d();if(m&&m.length){const g=QF({editor:t,rules:m});o.push(...g)}}const f=J(n,"addProseMirrorPlugins",s);if(f){const m=f();o.push(...m)}return o})}get attributes(){return Ng(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Is(this.extensions);return Object.fromEntries(e.filter(r=>!!J(r,"addNodeView")).map(r=>{const n=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ke(r.name,this.schema)},o=J(r,"addNodeView",s);if(!o)return[];const i=(a,l,c,d,f)=>{const m=Qo(a,n);return o()({node:a,view:l,getPos:c,decorations:d,innerDecorations:f,editor:t,extension:r,HTMLAttributes:m})};return[r.name,i]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Is(this.extensions);return Object.fromEntries(e.filter(r=>!!J(r,"addMarkView")).map(r=>{const n=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:er(r.name,this.schema)},o=J(r,"addMarkView",s);if(!o)return[];const i=(a,l,c)=>{const d=Qo(a,n);return o()({mark:a,view:l,inline:c,editor:t,extension:r,HTMLAttributes:d,updateAttributes:f=>{hA(a,t,f)}})};return[r.name,i]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var r;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ja(e.name,this.schema)};e.type==="mark"&&((r=le(J(e,"keepOnSplit",n)))==null||r)&&this.splittableMarks.push(e.name);const s=J(e,"onBeforeCreate",n),o=J(e,"onCreate",n),i=J(e,"onUpdate",n),a=J(e,"onSelectionUpdate",n),l=J(e,"onTransaction",n),c=J(e,"onFocus",n),d=J(e,"onBlur",n),f=J(e,"onDestroy",n);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),i&&this.editor.on("update",i),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Zi.resolve=Tg;Zi.sort=Wu;Zi.flatten=Vu;var eA={};Pu(eA,{ClipboardTextSerializer:()=>Pg,Commands:()=>zg,Delete:()=>$g,Drop:()=>Hg,Editable:()=>Vg,FocusEvents:()=>Wg,Keymap:()=>Ug,Paste:()=>Kg,Tabindex:()=>Jg,focusEventsPluginKey:()=>qg});var de=class Rg extends Ku{constructor(){super(...arguments),this.type="extension"}static create(e={}){const r=typeof e=="function"?e():e;return new Rg(r)}configure(e){return super.configure(e)}extend(e){const r=typeof e=="function"?e():e;return super.extend(r)}},Pg=de.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ye({key:new Oe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:r}=t,{doc:n,selection:s}=e,{ranges:o}=s,i=Math.min(...o.map(d=>d.$from.pos)),a=Math.max(...o.map(d=>d.$to.pos)),l=Bg(r);return Mg(n,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),zg=de.create({name:"commands",addCommands(){return{...vg}}}),$g=de.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var r,n,s;const o=()=>{var i,a,l,c;if((c=(l=(a=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const d=Fg(t.before,[t,...e]);Og(d).forEach(g=>{d.mapping.mapResult(g.oldRange.from).deletedAfter&&d.mapping.mapResult(g.oldRange.to).deletedBefore&&d.before.nodesBetween(g.oldRange.from,g.oldRange.to,(y,x)=>{const w=x+y.nodeSize-2,D=g.oldRange.from<=x&&w<=g.oldRange.to;this.editor.emit("delete",{type:"node",node:y,from:x,to:w,newFrom:d.mapping.map(x),newTo:d.mapping.map(w),deletedRange:g.oldRange,newRange:g.newRange,partial:!D,editor:this.editor,transaction:t,combinedTransform:d})})});const m=d.mapping;d.steps.forEach((g,y)=>{var x,w;if(g instanceof Dt){const D=m.slice(y).map(g.from,-1),E=m.slice(y).map(g.to),S=m.invert().map(D,-1),A=m.invert().map(E),T=(x=d.doc.nodeAt(D-1))==null?void 0:x.marks.some(B=>B.eq(g.mark)),j=(w=d.doc.nodeAt(E))==null?void 0:w.marks.some(B=>B.eq(g.mark));this.editor.emit("delete",{type:"mark",mark:g.mark,from:g.from,to:g.to,deletedRange:{from:S,to:A},newRange:{from:D,to:E},partial:!!(j||T),editor:this.editor,transaction:t,combinedTransform:d})}})};(s=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.async)==null||s?setTimeout(o,0):o()}}),Hg=de.create({name:"drop",addProseMirrorPlugins(){return[new ye({key:new Oe("tiptapDrop"),props:{handleDrop:(t,e,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:r,moved:n})}}})]}}),Vg=de.create({name:"editable",addProseMirrorPlugins(){return[new ye({key:new Oe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),qg=new Oe("focusEvents"),Wg=de.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ye({key:qg,props:{handleDOMEvents:{focus:(e,r)=>{t.isFocused=!0;const n=t.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,r)=>{t.isFocused=!1;const n=t.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Ug=de.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:f}=l,{pos:m,parent:g}=f,y=f.parent.isTextblock&&m>0?a.doc.resolve(m-1):f,x=y.parent.type.spec.isolating,w=f.pos-f.parentOffset,D=x&&y.parent.childCount===1?w===f.pos:ne.atStart(c).from===m;return!d||!g.type.isTextblock||g.textContent.length||!D||D&&f.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.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()},s={...n},o={...n,"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 Hu()||Eg()?o:s},addProseMirrorPlugins(){return[new ye({key:new Oe("clearDocument"),appendTransaction:(t,e,r)=>{if(t.some(x=>x.getMeta("composition")))return;const n=t.some(x=>x.docChanged)&&!e.doc.eq(r.doc),s=t.some(x=>x.getMeta("preventClearDocument"));if(!n||s)return;const{empty:o,from:i,to:a}=e.selection,l=ne.atStart(e.doc).from,c=ne.atEnd(e.doc).to;if(o||!(i===l&&a===c)||!Gi(r.doc))return;const m=r.tr,g=Wi({state:r,transaction:m}),{commands:y}=new Ui({editor:this.editor,state:g});if(y.clearNodes(),!!m.steps.length)return m}})]}}),Kg=de.create({name:"paste",addProseMirrorPlugins(){return[new ye({key:new Oe("tiptapPaste"),props:{handlePaste:(t,e,r)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:r})}}})]}}),Jg=de.create({name:"tabindex",addProseMirrorPlugins(){return[new ye({key:new Oe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),tA=class wn{constructor(e,r,n=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=r,this.currentNode=s}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 e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let r=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}r=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:r,to:n},e)}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(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),r=this.resolvedPos.doc.resolve(e);return new wn(r,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 wn(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 wn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((r,n)=>{const s=r.isBlock&&!r.isTextblock,o=r.isAtom&&!r.isText,i=this.pos+n+(o?0:1);if(i<0||i>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(i);if(!s&&a.depth<=this.depth)return;const l=new wn(a,this.editor,s,s?r:null);s&&(l.actualDepth=this.depth+1),e.push(new wn(a,this.editor,s,s?r:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,r={}){let n=null,s=this.parent;for(;s&&!n;){if(s.node.type.name===e)if(Object.keys(r).length>0){const o=s.node.attrs,i=Object.keys(r);for(let a=0;a<i.length;a+=1){const l=i[a];if(o[l]!==r[l])break}}else n=s;s=s.parent}return n}querySelector(e,r={}){return this.querySelectorAll(e,r,!0)[0]||null}querySelectorAll(e,r={},n=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(r);return this.children.forEach(i=>{n&&s.length>0||(i.node.type.name===e&&o.every(l=>r[l]===i.node.attrs[l])&&s.push(i),!(n&&s.length>0)&&(s=s.concat(i.querySelectorAll(e,r,n))))}),s}setAttribute(e){const{tr:r}=this.editor.state;r.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(r)}},rA=`.ProseMirror {
91
79
  position: relative;
92
80
  }
93
81
 
@@ -157,29 +145,29 @@ img.ProseMirror-separator {
157
145
 
158
146
  .ProseMirror-focused .ProseMirror-gapcursor {
159
147
  display: block;
160
- }`;function UF(t,e,r){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var JF=class extends jF{constructor(t={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,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:n,slice:s,moved:o})=>this.options.onDrop(n,s,o)),this.on("paste",({event:n,slice:s})=>this.options.onPaste(n,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),r=xg(e,this.options.autofocus);this.editorState=kn.create({doc:e,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")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}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",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&&typeof document<"u"&&(this.css=UF(WF,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=!0){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.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")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 r=kg(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let r=e;if([].concat(t).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(i=>!i.key.startsWith(o))}),e.length===r.length)return;const n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[Pg,Lg.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),_g,$g,Hg,qg,Rg,Vg,Ig].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Ki(n,this)}createCommandManager(){this.commandManager=new Vi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Bl(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&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),t=Bl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new fg(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const n=this.view.dom;n.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=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:r}=this.state.applyTransaction(t),n=!this.state.selection.eq(e.selection),s=r.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:r.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=r.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=i?.getMeta("focus"),l=i?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:i}),l&&this.emit("blur",{editor:this,event:l.event,transaction:i}),!(t.getMeta("preventUpdate")||!r.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:r.slice(1)})}getAttributes(t){return Ng(this.state,t)}isActive(t,e){const r=typeof t=="string"?t:null,n=typeof t=="string"?e:t;return dF(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return zu(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
148
+ }`;function nA(t,e,r){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var sA=class extends qF{constructor(t={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,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:n,slice:s,moved:o})=>this.options.onDrop(n,s,o)),this.on("paste",({event:n,slice:s})=>this.options.onPaste(n,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),r=Cg(e,this.options.autofocus);this.editorState=En.create({doc:e,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")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}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",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&&typeof document<"u"&&(this.css=nA(rA,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=!0){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.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")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 r=Ag(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let r=e;if([].concat(t).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(i=>!i.key.startsWith(o))}),e.length===r.length)return;const n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[Vg,Pg.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),zg,Wg,Ug,Jg,Hg,Kg,$g].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Zi(n,this)}createCommandManager(){this.commandManager=new Ui({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Ol(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&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),t=Ol(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new yg(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const n=this.view.dom;n.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=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:r}=this.state.applyTransaction(t),n=!this.state.selection.eq(e.selection),s=r.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:r.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=r.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=i?.getMeta("focus"),l=i?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:i}),l&&this.emit("blur",{editor:this,event:l.event,transaction:i}),!(t.getMeta("preventUpdate")||!r.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:r.slice(1)})}getAttributes(t){return jg(this.state,t)}isActive(t,e){const r=typeof t=="string"?t:null,n=typeof t=="string"?e:t;return DF(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return qu(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
161
149
 
162
- `,textSerializers:r={}}=t||{};return oF(this.state.doc,{blockSeparator:e,textSerializers:{...Ag(this.schema),...r}})}get isEmpty(){return Ui(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var r;return((r=this.$doc)==null?void 0:r.querySelector(t,e))||null}$nodes(t,e){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new qF(e,this)}get $doc(){return this.$pos(0)}};function jn(t){return new Ji({find:t.find,handler:({state:e,range:r,match:n})=>{const s=le(t.getAttributes,void 0,n);if(s===!1||s===null)return null;const{tr:o}=e,i=n[n.length-1],a=n[0];if(i){const l=a.search(/\S/),c=r.from+a.indexOf(i),d=c+i.length;if(Hu(r.from,r.to,e.doc).filter(g=>g.mark.type.excluded.find(v=>v===t.type&&v!==g.mark.type)).filter(g=>g.to>c).length)return null;d<r.to&&o.delete(d,r.to),c>r.from&&o.delete(r.from+l,c);const m=r.from+l+i.length;o.addMark(r.from+l,m,t.type.create(s||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function KF(t){return new Ji({find:t.find,handler:({state:e,range:r,match:n})=>{const s=le(t.getAttributes,void 0,n)||{},{tr:o}=e,i=r.from;let a=r.to;const l=t.type.create(s);if(n[1]){const c=n[0].lastIndexOf(n[1]);let d=i+c;d>a?d=a:a=d+n[1].length;const f=n[0][n[0].length-1];o.insertText(f,i+n[0].length-1),o.replaceWith(d,a,l)}else if(n[0]){const c=t.type.isInline?i:i-1;o.insert(c,t.type.create(s)).delete(o.mapping.map(i),o.mapping.map(a))}o.scrollIntoView()},undoable:t.undoable})}function Ol(t){return new Ji({find:t.find,handler:({state:e,range:r,match:n})=>{const s=e.doc.resolve(r.from),o=le(t.getAttributes,void 0,n)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(r.from,r.to).setBlockType(r.from,r.from,t.type,o)},undoable:t.undoable})}function On(t){return new Ji({find:t.find,handler:({state:e,range:r,match:n,chain:s})=>{const o=le(t.getAttributes,void 0,n)||{},i=e.tr.delete(r.from,r.to),l=i.doc.resolve(r.from).blockRange(),c=l&&xu(l,t.type,o);if(!c)return null;if(i.wrap(l,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:m}=e,{splittableMarks:g}=t.editor.extensionManager,y=m||f.$to.parentOffset&&f.$from.marks();if(y){const v=y.filter(w=>g.includes(w.type.name));i.ensureMarks(v)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(f,o).run()}const d=i.doc.resolve(r.from-1).nodeBefore;d&&d.type===t.type&&Sr(i.doc,r.from-1)&&(!t.joinPredicate||t.joinPredicate(n,d))&&i.join(r.from-1)},undoable:t.undoable})}function GF(t,e){const{selection:r}=t,{$from:n}=r;if(r instanceof Y){const o=n.index();return n.parent.canReplaceWith(o,o+1,e)}let s=n.depth;for(;s>=0;){const o=n.index(s);if(n.node(s).contentMatchAt(o).matchType(e))return!0;s-=1}return!1}var YF={};Lu(YF,{createAtomBlockMarkdownSpec:()=>XF,createBlockMarkdownSpec:()=>QF,createInlineMarkdownSpec:()=>tA,parseAttributes:()=>qu,parseIndentedBlocks:()=>Ll,renderNestedMarkdownContent:()=>Uu,serializeAttributes:()=>Wu});function qu(t){if(!t?.trim())return{};const e={},r=[],n=t.replace(/["']([^"']*)["']/g,c=>(r.push(c),`__QUOTED_${r.length-1}__`)),s=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(d=>d.trim().slice(1));e.class=c.join(" ")}const o=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(i)).forEach(([,c,d])=>{var f;const m=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),g=r[m];g&&(e[c]=g.slice(1,-1))});const l=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Wu(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([r,n])=>{r==="class"||r==="id"||(n===!0?e.push(r):n!==!1&&n!=null&&e.push(`${r}="${String(n)}"`))}),e.join(" ")}function XF(t){const{nodeName:e,name:r,parseAttributes:n=qu,serializeAttributes:s=Wu,defaultAttributes:o={},requiredAttributes:i=[],allowedAttributes:a}=t,l=r||e,c=d=>{if(!a)return d;const f={};return a.forEach(m=>{m in d&&(f[m]=d[m])}),f};return{parseMarkdown:(d,f)=>{const m={...o,...d.attributes};return f.createNode(e,m,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const m=new RegExp(`^:::${l}(?:\\s|$)`,"m"),g=(f=d.match(m))==null?void 0:f.index;return g!==void 0?g:-1},tokenize(d,f,m){const g=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),y=d.match(g);if(!y)return;const v=y[1]||"",w=n(v);if(!i.find(E=>!(E in w)))return{type:e,raw:y[0],attributes:w}}},renderMarkdown:d=>{const f=c(d.attrs||{}),m=s(f),g=m?` {${m}}`:"";return`:::${l}${g} :::`}}}function QF(t){const{nodeName:e,name:r,getContent:n,parseAttributes:s=qu,serializeAttributes:o=Wu,defaultAttributes:i={},content:a="block",allowedAttributes:l}=t,c=r||e,d=f=>{if(!l)return f;const m={};return l.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{let g;if(n){const v=n(f);g=typeof v=="string"?[{type:"text",text:v}]:v}else a==="block"?g=m.parseChildren(f.tokens||[]):g=m.parseInline(f.tokens||[]);const y={...i,...f.attributes};return m.createNode(e,y,g)},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${c}`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){var y;const v=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),w=f.match(v);if(!w)return;const[D,E=""]=w,N=s(E);let A=1;const T=D.length;let j="";const B=/^:::([\w-]*)(\s.*)?/gm,$=f.slice(T);for(B.lastIndex=0;;){const O=B.exec($);if(O===null)break;const z=O.index,I=O[1];if(!((y=O[2])!=null&&y.endsWith(":::"))){if(I)A+=1;else if(A-=1,A===0){const q=$.slice(0,z);j=q.trim();const J=f.slice(0,T+z+O[0].length);let K=[];if(j)if(a==="block")for(K=g.blockTokens(q),K.forEach(ae=>{ae.text&&(!ae.tokens||ae.tokens.length===0)&&(ae.tokens=g.inlineTokens(ae.text))});K.length>0;){const ae=K[K.length-1];if(ae.type==="paragraph"&&(!ae.text||ae.text.trim()===""))K.pop();else break}else K=g.inlineTokens(j);return{type:e,raw:J,attributes:N,content:j,tokens:K}}}}}},renderMarkdown:(f,m)=>{const g=d(f.attrs||{}),y=o(g),v=y?` {${y}}`:"",w=m.renderChildren(f.content||[],`
150
+ `,textSerializers:r={}}=t||{};return gF(this.state.doc,{blockSeparator:e,textSerializers:{...Bg(this.schema),...r}})}get isEmpty(){return Gi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var r;return((r=this.$doc)==null?void 0:r.querySelector(t,e))||null}$nodes(t,e){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new tA(e,this)}get $doc(){return this.$pos(0)}};function On(t){return new Yi({find:t.find,handler:({state:e,range:r,match:n})=>{const s=le(t.getAttributes,void 0,n);if(s===!1||s===null)return null;const{tr:o}=e,i=n[n.length-1],a=n[0];if(i){const l=a.search(/\S/),c=r.from+a.indexOf(i),d=c+i.length;if(Uu(r.from,r.to,e.doc).filter(g=>g.mark.type.excluded.find(x=>x===t.type&&x!==g.mark.type)).filter(g=>g.to>c).length)return null;d<r.to&&o.delete(d,r.to),c>r.from&&o.delete(r.from+l,c);const m=r.from+l+i.length;o.addMark(r.from+l,m,t.type.create(s||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function oA(t){return new Yi({find:t.find,handler:({state:e,range:r,match:n})=>{const s=le(t.getAttributes,void 0,n)||{},{tr:o}=e,i=r.from;let a=r.to;const l=t.type.create(s);if(n[1]){const c=n[0].lastIndexOf(n[1]);let d=i+c;d>a?d=a:a=d+n[1].length;const f=n[0][n[0].length-1];o.insertText(f,i+n[0].length-1),o.replaceWith(d,a,l)}else if(n[0]){const c=t.type.isInline?i:i-1;o.insert(c,t.type.create(s)).delete(o.mapping.map(i),o.mapping.map(a))}o.scrollIntoView()},undoable:t.undoable})}function _l(t){return new Yi({find:t.find,handler:({state:e,range:r,match:n})=>{const s=e.doc.resolve(r.from),o=le(t.getAttributes,void 0,n)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(r.from,r.to).setBlockType(r.from,r.from,t.type,o)},undoable:t.undoable})}function Ln(t){return new Yi({find:t.find,handler:({state:e,range:r,match:n,chain:s})=>{const o=le(t.getAttributes,void 0,n)||{},i=e.tr.delete(r.from,r.to),l=i.doc.resolve(r.from).blockRange(),c=l&&Cu(l,t.type,o);if(!c)return null;if(i.wrap(l,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:m}=e,{splittableMarks:g}=t.editor.extensionManager,y=m||f.$to.parentOffset&&f.$from.marks();if(y){const x=y.filter(w=>g.includes(w.type.name));i.ensureMarks(x)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(f,o).run()}const d=i.doc.resolve(r.from-1).nodeBefore;d&&d.type===t.type&&Fr(i.doc,r.from-1)&&(!t.joinPredicate||t.joinPredicate(n,d))&&i.join(r.from-1)},undoable:t.undoable})}function iA(t,e){const{selection:r}=t,{$from:n}=r;if(r instanceof G){const o=n.index();return n.parent.canReplaceWith(o,o+1,e)}let s=n.depth;for(;s>=0;){const o=n.index(s);if(n.node(s).contentMatchAt(o).matchType(e))return!0;s-=1}return!1}var aA={};Pu(aA,{createAtomBlockMarkdownSpec:()=>lA,createBlockMarkdownSpec:()=>uA,createInlineMarkdownSpec:()=>pA,parseAttributes:()=>Ju,parseIndentedBlocks:()=>Il,renderNestedMarkdownContent:()=>Yu,serializeAttributes:()=>Gu});function Ju(t){if(!t?.trim())return{};const e={},r=[],n=t.replace(/["']([^"']*)["']/g,c=>(r.push(c),`__QUOTED_${r.length-1}__`)),s=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(d=>d.trim().slice(1));e.class=c.join(" ")}const o=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(i)).forEach(([,c,d])=>{var f;const m=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),g=r[m];g&&(e[c]=g.slice(1,-1))});const l=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Gu(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([r,n])=>{r==="class"||r==="id"||(n===!0?e.push(r):n!==!1&&n!=null&&e.push(`${r}="${String(n)}"`))}),e.join(" ")}function lA(t){const{nodeName:e,name:r,parseAttributes:n=Ju,serializeAttributes:s=Gu,defaultAttributes:o={},requiredAttributes:i=[],allowedAttributes:a}=t,l=r||e,c=d=>{if(!a)return d;const f={};return a.forEach(m=>{m in d&&(f[m]=d[m])}),f};return{parseMarkdown:(d,f)=>{const m={...o,...d.attributes};return f.createNode(e,m,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const m=new RegExp(`^:::${l}(?:\\s|$)`,"m"),g=(f=d.match(m))==null?void 0:f.index;return g!==void 0?g:-1},tokenize(d,f,m){const g=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),y=d.match(g);if(!y)return;const x=y[1]||"",w=n(x);if(!i.find(E=>!(E in w)))return{type:e,raw:y[0],attributes:w}}},renderMarkdown:d=>{const f=c(d.attrs||{}),m=s(f),g=m?` {${m}}`:"";return`:::${l}${g} :::`}}}function uA(t){const{nodeName:e,name:r,getContent:n,parseAttributes:s=Ju,serializeAttributes:o=Gu,defaultAttributes:i={},content:a="block",allowedAttributes:l}=t,c=r||e,d=f=>{if(!l)return f;const m={};return l.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{let g;if(n){const x=n(f);g=typeof x=="string"?[{type:"text",text:x}]:x}else a==="block"?g=m.parseChildren(f.tokens||[]):g=m.parseInline(f.tokens||[]);const y={...i,...f.attributes};return m.createNode(e,y,g)},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${c}`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){var y;const x=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),w=f.match(x);if(!w)return;const[D,E=""]=w,S=s(E);let A=1;const T=D.length;let j="";const B=/^:::([\w-]*)(\s.*)?/gm,$=f.slice(T);for(B.lastIndex=0;;){const O=B.exec($);if(O===null)break;const P=O.index,L=O[1];if(!((y=O[2])!=null&&y.endsWith(":::"))){if(L)A+=1;else if(A-=1,A===0){const H=$.slice(0,P);j=H.trim();const Y=f.slice(0,T+P+O[0].length);let q=[];if(j)if(a==="block")for(q=g.blockTokens(H),q.forEach(Z=>{Z.text&&(!Z.tokens||Z.tokens.length===0)&&(Z.tokens=g.inlineTokens(Z.text))});q.length>0;){const Z=q[q.length-1];if(Z.type==="paragraph"&&(!Z.text||Z.text.trim()===""))q.pop();else break}else q=g.inlineTokens(j);return{type:e,raw:Y,attributes:S,content:j,tokens:q}}}}}},renderMarkdown:(f,m)=>{const g=d(f.attrs||{}),y=o(g),x=y?` {${y}}`:"",w=m.renderChildren(f.content||[],`
163
151
 
164
- `);return`:::${c}${v}
152
+ `);return`:::${c}${x}
165
153
 
166
154
  ${w}
167
155
 
168
- :::`}}}function ZF(t){if(!t.trim())return{};const e={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=r.exec(t);for(;n!==null;){const[,s,o,i]=n;e[s]=o||i,n=r.exec(t)}return e}function eA(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>`${e}="${r}"`).join(" ")}function tA(t){const{nodeName:e,name:r,getContent:n,parseAttributes:s=ZF,serializeAttributes:o=eA,defaultAttributes:i={},selfClosing:a=!1,allowedAttributes:l}=t,c=r||e,d=m=>{if(!l)return m;const g={};return l.forEach(y=>{y in m&&(g[y]=m[y])}),g},f=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(m,g)=>{const y={...i,...m.attributes};if(a)return g.createNode(e,y);const v=n?n(m):m.content||"";return v?g.createNode(e,y,[g.createTextNode(v)]):g.createNode(e,y,[])},markdownTokenizer:{name:e,level:"inline",start(m){const g=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),y=m.match(g),v=y?.index;return v!==void 0?v:-1},tokenize(m,g,y){const v=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),w=m.match(v);if(!w)return;let D="",E="";if(a){const[,A]=w;E=A}else{const[,A,T]=w;E=A,D=T||""}const N=s(E.trim());return{type:e,raw:w[0],content:D.trim(),attributes:N}}},renderMarkdown:m=>{let g="";n?g=n(m):m.content&&m.content.length>0&&(g=m.content.filter(D=>D.type==="text").map(D=>D.text).join(""));const y=d(m.attrs||{}),v=o(y),w=v?` ${v}`:"";return a?`[${c}${w}]`:`[${c}${w}]${g}[/${c}]`}}}function Ll(t,e,r){var n,s,o,i;const a=t.split(`
169
- `),l=[];let c="",d=0;const f=e.baseIndentSize||2;for(;d<a.length;){const m=a[d],g=m.match(e.itemPattern);if(!g){if(l.length>0)break;if(m.trim()===""){d+=1;continue}else return}const y=e.extractItemData(g),{indentLevel:v,mainContent:w}=y;c=`${c}${m}
170
- `;const D=[w];for(d+=1;d<a.length;){const T=a[d];if(T.trim()===""){const B=a.slice(d+1).findIndex(z=>z.trim()!=="");if(B===-1)break;if((((s=(n=a[d+1+B].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:s.length)||0)>v){D.push(T),c=`${c}${T}
171
- `,d+=1;continue}else break}if((((i=(o=T.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:i.length)||0)>v)D.push(T),c=`${c}${T}
172
- `,d+=1;else break}let E;const N=D.slice(1);if(N.length>0){const T=N.map(j=>j.slice(v+f)).join(`
173
- `);T.trim()&&(e.customNestedParser?E=e.customNestedParser(T):E=r.blockTokens(T))}const A=e.createToken(y,E);l.push(A)}if(l.length!==0)return{items:l,raw:c.trim()}}function Uu(t,e,r,n){if(!t||!Array.isArray(t.content))return"";const s=typeof r=="function"?r(n):r,[o,...i]=t.content,a=e.renderChildren([o]),l=[`${s}${a}`];return i&&i.length>0&&i.forEach(c=>{const d=e.renderChildren([c]);if(d){const f=d.split(`
156
+ :::`}}}function cA(t){if(!t.trim())return{};const e={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=r.exec(t);for(;n!==null;){const[,s,o,i]=n;e[s]=o||i,n=r.exec(t)}return e}function dA(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>`${e}="${r}"`).join(" ")}function pA(t){const{nodeName:e,name:r,getContent:n,parseAttributes:s=cA,serializeAttributes:o=dA,defaultAttributes:i={},selfClosing:a=!1,allowedAttributes:l}=t,c=r||e,d=m=>{if(!l)return m;const g={};return l.forEach(y=>{y in m&&(g[y]=m[y])}),g},f=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(m,g)=>{const y={...i,...m.attributes};if(a)return g.createNode(e,y);const x=n?n(m):m.content||"";return x?g.createNode(e,y,[g.createTextNode(x)]):g.createNode(e,y,[])},markdownTokenizer:{name:e,level:"inline",start(m){const g=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),y=m.match(g),x=y?.index;return x!==void 0?x:-1},tokenize(m,g,y){const x=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),w=m.match(x);if(!w)return;let D="",E="";if(a){const[,A]=w;E=A}else{const[,A,T]=w;E=A,D=T||""}const S=s(E.trim());return{type:e,raw:w[0],content:D.trim(),attributes:S}}},renderMarkdown:m=>{let g="";n?g=n(m):m.content&&m.content.length>0&&(g=m.content.filter(D=>D.type==="text").map(D=>D.text).join(""));const y=d(m.attrs||{}),x=o(y),w=x?` ${x}`:"";return a?`[${c}${w}]`:`[${c}${w}]${g}[/${c}]`}}}function Il(t,e,r){var n,s,o,i;const a=t.split(`
157
+ `),l=[];let c="",d=0;const f=e.baseIndentSize||2;for(;d<a.length;){const m=a[d],g=m.match(e.itemPattern);if(!g){if(l.length>0)break;if(m.trim()===""){d+=1;continue}else return}const y=e.extractItemData(g),{indentLevel:x,mainContent:w}=y;c=`${c}${m}
158
+ `;const D=[w];for(d+=1;d<a.length;){const T=a[d];if(T.trim()===""){const B=a.slice(d+1).findIndex(P=>P.trim()!=="");if(B===-1)break;if((((s=(n=a[d+1+B].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:s.length)||0)>x){D.push(T),c=`${c}${T}
159
+ `,d+=1;continue}else break}if((((i=(o=T.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:i.length)||0)>x)D.push(T),c=`${c}${T}
160
+ `,d+=1;else break}let E;const S=D.slice(1);if(S.length>0){const T=S.map(j=>j.slice(x+f)).join(`
161
+ `);T.trim()&&(e.customNestedParser?E=e.customNestedParser(T):E=r.blockTokens(T))}const A=e.createToken(y,E);l.push(A)}if(l.length!==0)return{items:l,raw:c.trim()}}function Yu(t,e,r,n){if(!t||!Array.isArray(t.content))return"";const s=typeof r=="function"?r(n):r,[o,...i]=t.content,a=e.renderChildren([o]),l=[`${s}${a}`];return i&&i.length>0&&i.forEach(c=>{const d=e.renderChildren([c]);if(d){const f=d.split(`
174
162
  `).map(m=>m?e.indent(m):"").join(`
175
163
  `);l.push(f)}}),l.join(`
176
- `)}function rA(t,e,r={}){const{state:n}=e,{doc:s,tr:o}=n,i=t;s.descendants((a,l)=>{const c=o.mapping.map(l),d=o.mapping.map(l)+a.nodeSize;let f=null;if(a.marks.forEach(g=>{if(g!==i)return!1;f=g}),!f)return;let m=!1;if(Object.keys(r).forEach(g=>{r[g]!==f.attrs[g]&&(m=!0)}),m){const g=t.type.create({...t.attrs,...r});o.removeMark(c,d,t.type),o.addMark(c,d,g)}}),o.docChanged&&e.view.dispatch(o)}var ot=class Wg extends Vu{constructor(){super(...arguments),this.type="node"}static create(e={}){const r=typeof e=="function"?e():e;return new Wg(r)}configure(e){return super.configure(e)}extend(e){const r=typeof e=="function"?e():e;return super.extend(r)}};function rn(t){return new RF({find:t.find,handler:({state:e,range:r,match:n,pasteEvent:s})=>{const o=le(t.getAttributes,void 0,n,s);if(o===!1||o===null)return null;const{tr:i}=e,a=n[n.length-1],l=n[0];let c=r.to;if(a){const d=l.search(/\S/),f=r.from+l.indexOf(a),m=f+a.length;if(Hu(r.from,r.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.to>f).length)return null;m<r.to&&i.delete(m,r.to),f>r.from&&i.delete(r.from+d,f),c=r.from+d+a.length,i.addMark(r.from+d,c,t.type.create(o||{})),i.removeStoredMark(t.type)}}})}var Ug=ot.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ye(this.options.HTMLAttributes,t)]},renderText(){return`
164
+ `)}function hA(t,e,r={}){const{state:n}=e,{doc:s,tr:o}=n,i=t;s.descendants((a,l)=>{const c=o.mapping.map(l),d=o.mapping.map(l)+a.nodeSize;let f=null;if(a.marks.forEach(g=>{if(g!==i)return!1;f=g}),!f)return;let m=!1;if(Object.keys(r).forEach(g=>{r[g]!==f.attrs[g]&&(m=!0)}),m){const g=t.type.create({...t.attrs,...r});o.removeMark(c,d,t.type),o.addMark(c,d,g)}}),o.docChanged&&e.view.dispatch(o)}var it=class Gg extends Ku{constructor(){super(...arguments),this.type="node"}static create(e={}){const r=typeof e=="function"?e():e;return new Gg(r)}configure(e){return super.configure(e)}extend(e){const r=typeof e=="function"?e():e;return super.extend(r)}};function nn(t){return new GF({find:t.find,handler:({state:e,range:r,match:n,pasteEvent:s})=>{const o=le(t.getAttributes,void 0,n,s);if(o===!1||o===null)return null;const{tr:i}=e,a=n[n.length-1],l=n[0];let c=r.to;if(a){const d=l.search(/\S/),f=r.from+l.indexOf(a),m=f+a.length;if(Uu(r.from,r.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.to>f).length)return null;m<r.to&&i.delete(m,r.to),f>r.from&&i.delete(r.from+d,f),c=r.from+d+a.length,i.addMark(r.from+d,c,t.type.create(o||{})),i.removeStoredMark(t.type)}}})}var Yg=it.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",xe(this.options.HTMLAttributes,t)]},renderText(){return`
177
165
  `},renderMarkdown:(t,e)=>e.indent(`
178
- `),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:r,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:o}=r;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:a}=n.extensionManager,l=o||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&i){const f=l.filter(m=>a.includes(m.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),nA=Ug;const sA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",oA="ελ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",_l="numeric",Il="ascii",Rl="alpha",ws="asciinumeric",hs="alphanumeric",Pl="domain",Jg="emoji",iA="scheme",aA="slashscheme",Ka="whitespace";function lA(t,e){return t in e||(e[t]=[]),e[t]}function qr(t,e,r){e[_l]&&(e[ws]=!0,e[hs]=!0),e[Il]&&(e[ws]=!0,e[Rl]=!0),e[ws]&&(e[hs]=!0),e[Rl]&&(e[hs]=!0),e[hs]&&(e[Pl]=!0),e[Jg]&&(e[Pl]=!0);for(const n in e){const s=lA(n,r);s.indexOf(t)<0&&s.push(t)}}function uA(t,e){const r={};for(const n in e)e[n].indexOf(t)>=0&&(r[n]=!0);return r}function Qe(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Qe.groups={};Qe.prototype={accepts(){return!!this.t},go(t){const e=this,r=e.j[t];if(r)return r;for(let n=0;n<e.jr.length;n++){const s=e.jr[n][0],o=e.jr[n][1];if(o&&s.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,r,n){for(let s=0;s<t.length;s++)this.tt(t[s],e,r,n)},tr(t,e,r,n){n=n||Qe.groups;let s;return e&&e.j?s=e:(s=new Qe(e),r&&n&&qr(e,r,n)),this.jr.push([t,s]),s},ts(t,e,r,n){let s=this;const o=t.length;if(!o)return s;for(let i=0;i<o-1;i++)s=s.tt(t[i]);return s.tt(t[o-1],e,r,n)},tt(t,e,r,n){n=n||Qe.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const o=e;let i,a=s.go(t);if(a?(i=new Qe,Object.assign(i.j,a.j),i.jr.push.apply(i.jr,a.jr),i.jd=a.jd,i.t=a.t):i=new Qe,o){if(n)if(i.t&&typeof i.t=="string"){const l=Object.assign(uA(i.t,n),r);qr(o,l,n)}else r&&qr(o,r,n);i.t=o}return s.j[t]=i,i}};const te=(t,e,r,n,s)=>t.ta(e,r,n,s),me=(t,e,r,n,s)=>t.tr(e,r,n,s),ph=(t,e,r,n,s)=>t.ts(e,r,n,s),R=(t,e,r,n,s)=>t.tt(e,r,n,s),Vt="WORD",zl="UWORD",Kg="ASCIINUMERICAL",Gg="ALPHANUMERICAL",_s="LOCALHOST",$l="TLD",Hl="UTLD",Oo="SCHEME",wn="SLASH_SCHEME",Ju="NUM",Vl="WS",Ku="NL",Ds="OPENBRACE",Cs="CLOSEBRACE",Yo="OPENBRACKET",Xo="CLOSEBRACKET",Qo="OPENPAREN",Zo="CLOSEPAREN",ei="OPENANGLEBRACKET",ti="CLOSEANGLEBRACKET",ri="FULLWIDTHLEFTPAREN",ni="FULLWIDTHRIGHTPAREN",si="LEFTCORNERBRACKET",oi="RIGHTCORNERBRACKET",ii="LEFTWHITECORNERBRACKET",ai="RIGHTWHITECORNERBRACKET",li="FULLWIDTHLESSTHAN",ui="FULLWIDTHGREATERTHAN",ci="AMPERSAND",di="APOSTROPHE",pi="ASTERISK",ur="AT",hi="BACKSLASH",fi="BACKTICK",mi="CARET",pr="COLON",Gu="COMMA",gi="DOLLAR",Ft="DOT",bi="EQUALS",Yu="EXCLAMATION",ut="HYPHEN",ks="PERCENT",yi="PIPE",xi="PLUS",vi="POUND",Es="QUERY",Xu="QUOTE",Yg="FULLWIDTHMIDDLEDOT",Qu="SEMI",At="SLASH",Ss="TILDE",wi="UNDERSCORE",Xg="EMOJI",Di="SYM";var Qg=Object.freeze({__proto__:null,ALPHANUMERICAL:Gg,AMPERSAND:ci,APOSTROPHE:di,ASCIINUMERICAL:Kg,ASTERISK:pi,AT:ur,BACKSLASH:hi,BACKTICK:fi,CARET:mi,CLOSEANGLEBRACKET:ti,CLOSEBRACE:Cs,CLOSEBRACKET:Xo,CLOSEPAREN:Zo,COLON:pr,COMMA:Gu,DOLLAR:gi,DOT:Ft,EMOJI:Xg,EQUALS:bi,EXCLAMATION:Yu,FULLWIDTHGREATERTHAN:ui,FULLWIDTHLEFTPAREN:ri,FULLWIDTHLESSTHAN:li,FULLWIDTHMIDDLEDOT:Yg,FULLWIDTHRIGHTPAREN:ni,HYPHEN:ut,LEFTCORNERBRACKET:si,LEFTWHITECORNERBRACKET:ii,LOCALHOST:_s,NL:Ku,NUM:Ju,OPENANGLEBRACKET:ei,OPENBRACE:Ds,OPENBRACKET:Yo,OPENPAREN:Qo,PERCENT:ks,PIPE:yi,PLUS:xi,POUND:vi,QUERY:Es,QUOTE:Xu,RIGHTCORNERBRACKET:oi,RIGHTWHITECORNERBRACKET:ai,SCHEME:Oo,SEMI:Qu,SLASH:At,SLASH_SCHEME:wn,SYM:Di,TILDE:Ss,TLD:$l,UNDERSCORE:wi,UTLD:Hl,UWORD:zl,WORD:Vt,WS:Vl});const zt=/[a-z]/,as=/\p{L}/u,Ga=/\p{Emoji}/u,$t=/\d/,Ya=/\s/,hh="\r",Xa=`
179
- `,cA="️",dA="‍",Qa="";let ko=null,Eo=null;function pA(t=[]){const e={};Qe.groups=e;const r=new Qe;ko==null&&(ko=fh(sA)),Eo==null&&(Eo=fh(oA)),R(r,"'",di),R(r,"{",Ds),R(r,"}",Cs),R(r,"[",Yo),R(r,"]",Xo),R(r,"(",Qo),R(r,")",Zo),R(r,"<",ei),R(r,">",ti),R(r,"(",ri),R(r,")",ni),R(r,"「",si),R(r,"」",oi),R(r,"『",ii),R(r,"』",ai),R(r,"<",li),R(r,">",ui),R(r,"&",ci),R(r,"*",pi),R(r,"@",ur),R(r,"`",fi),R(r,"^",mi),R(r,":",pr),R(r,",",Gu),R(r,"$",gi),R(r,".",Ft),R(r,"=",bi),R(r,"!",Yu),R(r,"-",ut),R(r,"%",ks),R(r,"|",yi),R(r,"+",xi),R(r,"#",vi),R(r,"?",Es),R(r,'"',Xu),R(r,"/",At),R(r,";",Qu),R(r,"~",Ss),R(r,"_",wi),R(r,"\\",hi),R(r,"・",Yg);const n=me(r,$t,Ju,{[_l]:!0});me(n,$t,n);const s=me(n,zt,Kg,{[ws]:!0}),o=me(n,as,Gg,{[hs]:!0}),i=me(r,zt,Vt,{[Il]:!0});me(i,$t,s),me(i,zt,i),me(s,$t,s),me(s,zt,s);const a=me(r,as,zl,{[Rl]:!0});me(a,zt),me(a,$t,o),me(a,as,a),me(o,$t,o),me(o,zt),me(o,as,o);const l=R(r,Xa,Ku,{[Ka]:!0}),c=R(r,hh,Vl,{[Ka]:!0}),d=me(r,Ya,Vl,{[Ka]:!0});R(r,Qa,d),R(c,Xa,l),R(c,Qa,d),me(c,Ya,d),R(d,hh),R(d,Xa),me(d,Ya,d),R(d,Qa,d);const f=me(r,Ga,Xg,{[Jg]:!0});R(f,"#"),me(f,Ga,f),R(f,cA,f);const m=R(f,dA);R(m,"#"),me(m,Ga,f);const g=[[zt,i],[$t,s]],y=[[zt,null],[as,a],[$t,o]];for(let v=0;v<ko.length;v++)sr(r,ko[v],$l,Vt,g);for(let v=0;v<Eo.length;v++)sr(r,Eo[v],Hl,zl,y);qr($l,{tld:!0,ascii:!0},e),qr(Hl,{utld:!0,alpha:!0},e),sr(r,"file",Oo,Vt,g),sr(r,"mailto",Oo,Vt,g),sr(r,"http",wn,Vt,g),sr(r,"https",wn,Vt,g),sr(r,"ftp",wn,Vt,g),sr(r,"ftps",wn,Vt,g),qr(Oo,{scheme:!0,ascii:!0},e),qr(wn,{slashscheme:!0,ascii:!0},e),t=t.sort((v,w)=>v[0]>w[0]?1:-1);for(let v=0;v<t.length;v++){const w=t[v][0],E=t[v][1]?{[iA]:!0}:{[aA]:!0};w.indexOf("-")>=0?E[Pl]=!0:zt.test(w)?$t.test(w)?E[ws]=!0:E[Il]=!0:E[_l]=!0,ph(r,w,w,E)}return ph(r,"localhost",_s,{ascii:!0}),r.jd=new Qe(Di),{start:r,tokens:Object.assign({groups:e},Qg)}}function Zg(t,e){const r=hA(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=r.length,s=[];let o=0,i=0;for(;i<n;){let a=t,l=null,c=0,d=null,f=-1,m=-1;for(;i<n&&(l=a.go(r[i]));)a=l,a.accepts()?(f=0,m=0,d=a):f>=0&&(f+=r[i].length,m++),c+=r[i].length,o+=r[i].length,i++;o-=f,i-=m,c-=f,s.push({t:d.t,v:e.slice(o-c,o),s:o-c,e:o})}return s}function hA(t){const e=[],r=t.length;let n=0;for(;n<r;){let s=t.charCodeAt(n),o,i=s<55296||s>56319||n+1===r||(o=t.charCodeAt(n+1))<56320||o>57343?t[n]:t.slice(n,n+2);e.push(i),n+=i.length}return e}function sr(t,e,r,n,s){let o;const i=e.length;for(let a=0;a<i-1;a++){const l=e[a];t.j[l]?o=t.j[l]:(o=new Qe(n),o.jr=s.slice(),t.j[l]=o),t=o}return o=new Qe(r),o.jr=s.slice(),t.j[e[i-1]]=o,o}function fh(t){const e=[],r=[];let n=0,s="0123456789";for(;n<t.length;){let o=0;for(;s.indexOf(t[n+o])>=0;)o++;if(o>0){e.push(r.join(""));for(let i=parseInt(t.substring(n,n+o),10);i>0;i--)r.pop();n+=o}else r.push(t[n]),n++}return e}const Is={defaultProtocol:"http",events:null,format:mh,formatHref:mh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Zu(t,e=null){let r=Object.assign({},Is);t&&(r=Object.assign(r,t instanceof Zu?t.o:t));const n=r.ignoreTags,s=[];for(let o=0;o<n.length;o++)s.push(n[o].toUpperCase());this.o=r,e&&(this.defaultRender=e),this.ignoreTags=s}Zu.prototype={o:Is,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,r){const n=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=r.t in s?s[r.t]:Is[t],typeof s=="function"&&n&&(s=s(e,r))):typeof s=="function"&&n&&(s=s(e,r.t,r)),s)},getObj(t,e,r){let n=this.o[t];return typeof n=="function"&&e!=null&&(n=n(e,r.t,r)),n},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function mh(t){return t}function e0(t,e){this.t="token",this.v=t,this.tk=e}e0.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),r=t.get("truncate",e,this),n=t.get("format",e,this);return r&&n.length>r?n.substring(0,r)+"…":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=Is.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,r=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",r,this),s=t.get("tagName",r,e),o=this.toFormattedString(t),i={},a=t.get("className",r,e),l=t.get("target",r,e),c=t.get("rel",r,e),d=t.getObj("attributes",r,e),f=t.getObj("events",r,e);return i.href=n,a&&(i.class=a),l&&(i.target=l),c&&(i.rel=c),d&&Object.assign(i,d),{tagName:s,attributes:i,content:o,eventListeners:f}}};function Gi(t,e){class r extends e0{constructor(s,o){super(s,o),this.t=t}}for(const n in e)r.prototype[n]=e[n];return r.t=t,r}const gh=Gi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bh=Gi("text"),fA=Gi("nl"),So=Gi("url",{isLink:!0,toHref(t=Is.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==_s&&t[1].t===pr}}),at=t=>new Qe(t);function mA({groups:t}){const e=t.domain.concat([ci,pi,ur,hi,fi,mi,gi,bi,ut,Ju,ks,yi,xi,vi,At,Di,Ss,wi]),r=[di,pr,Gu,Ft,Yu,ks,Es,Xu,Qu,ei,ti,Ds,Cs,Xo,Yo,Qo,Zo,ri,ni,si,oi,ii,ai,li,ui],n=[ci,di,pi,hi,fi,mi,gi,bi,ut,Ds,Cs,ks,yi,xi,vi,Es,At,Di,Ss,wi],s=at(),o=R(s,Ss);te(o,n,o),te(o,t.domain,o);const i=at(),a=at(),l=at();te(s,t.domain,i),te(s,t.scheme,a),te(s,t.slashscheme,l),te(i,n,o),te(i,t.domain,i);const c=R(i,ur);R(o,ur,c),R(a,ur,c),R(l,ur,c);const d=R(o,Ft);te(d,n,o),te(d,t.domain,o);const f=at();te(c,t.domain,f),te(f,t.domain,f);const m=R(f,Ft);te(m,t.domain,f);const g=at(gh);te(m,t.tld,g),te(m,t.utld,g),R(c,_s,g);const y=R(f,ut);R(y,ut,y),te(y,t.domain,f),te(g,t.domain,f),R(g,Ft,m),R(g,ut,y);const v=R(g,pr);te(v,t.numeric,gh);const w=R(i,ut),D=R(i,Ft);R(w,ut,w),te(w,t.domain,i),te(D,n,o),te(D,t.domain,i);const E=at(So);te(D,t.tld,E),te(D,t.utld,E),te(E,t.domain,i),te(E,n,o),R(E,Ft,D),R(E,ut,w),R(E,ur,c);const N=R(E,pr),A=at(So);te(N,t.numeric,A);const T=at(So),j=at();te(T,e,T),te(T,r,j),te(j,e,T),te(j,r,j),R(E,At,T),R(A,At,T);const B=R(a,pr),$=R(l,pr),O=R($,At),z=R(O,At);te(a,t.domain,i),R(a,Ft,D),R(a,ut,w),te(l,t.domain,i),R(l,Ft,D),R(l,ut,w),te(B,t.domain,T),R(B,At,T),R(B,Es,T),te(z,t.domain,T),te(z,e,T),R(z,At,T);const I=[[Ds,Cs],[Yo,Xo],[Qo,Zo],[ei,ti],[ri,ni],[si,oi],[ii,ai],[li,ui]];for(let q=0;q<I.length;q++){const[J,K]=I[q],ae=R(T,J);R(j,J,ae),R(ae,K,T);const tt=at(So);te(ae,e,tt);const mt=at();te(ae,r),te(tt,e,tt),te(tt,r,mt),te(mt,e,tt),te(mt,r,mt),R(tt,K,T),R(mt,K,T)}return R(s,_s,E),R(s,Ku,fA),{start:s,tokens:Qg}}function gA(t,e,r){let n=r.length,s=0,o=[],i=[];for(;s<n;){let a=t,l=null,c=null,d=0,f=null,m=-1;for(;s<n&&!(l=a.go(r[s].t));)i.push(r[s++]);for(;s<n&&(c=l||a.go(r[s].t));)l=null,a=c,a.accepts()?(m=0,f=a):m>=0&&m++,s++,d++;if(m<0)s-=d,s<n&&(i.push(r[s]),s++);else{i.length>0&&(o.push(Za(bh,e,i)),i=[]),s-=m,d-=m;const g=f.t,y=r.slice(s-d,s);o.push(Za(g,e,y))}}return i.length>0&&o.push(Za(bh,e,i)),o}function Za(t,e,r){const n=r[0].s,s=r[r.length-1].e,o=e.slice(n,s);return new t(o,r)}const bA=typeof console<"u"&&console&&console.warn||(()=>{}),yA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",pe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function xA(){return Qe.groups={},pe.scanner=null,pe.parser=null,pe.tokenQueue=[],pe.pluginQueue=[],pe.customSchemes=[],pe.initialized=!1,pe}function yh(t,e=!1){if(pe.initialized&&bA(`linkifyjs: already initialized - will not register custom scheme "${t}" ${yA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
166
+ `),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:r,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:o}=r;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:a}=n.extensionManager,l=o||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&i){const f=l.filter(m=>a.includes(m.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),fA=Yg;const mA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",gA="ελ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",Rl="numeric",Pl="ascii",zl="alpha",Cs="asciinumeric",ms="alphanumeric",$l="domain",Zg="emoji",bA="scheme",yA="slashscheme",Za="whitespace";function xA(t,e){return t in e||(e[t]=[]),e[t]}function Wr(t,e,r){e[Rl]&&(e[Cs]=!0,e[ms]=!0),e[Pl]&&(e[Cs]=!0,e[zl]=!0),e[Cs]&&(e[ms]=!0),e[zl]&&(e[ms]=!0),e[ms]&&(e[$l]=!0),e[Zg]&&(e[$l]=!0);for(const n in e){const s=xA(n,r);s.indexOf(t)<0&&s.push(t)}}function vA(t,e){const r={};for(const n in e)e[n].indexOf(t)>=0&&(r[n]=!0);return r}function et(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}et.groups={};et.prototype={accepts(){return!!this.t},go(t){const e=this,r=e.j[t];if(r)return r;for(let n=0;n<e.jr.length;n++){const s=e.jr[n][0],o=e.jr[n][1];if(o&&s.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,r,n){for(let s=0;s<t.length;s++)this.tt(t[s],e,r,n)},tr(t,e,r,n){n=n||et.groups;let s;return e&&e.j?s=e:(s=new et(e),r&&n&&Wr(e,r,n)),this.jr.push([t,s]),s},ts(t,e,r,n){let s=this;const o=t.length;if(!o)return s;for(let i=0;i<o-1;i++)s=s.tt(t[i]);return s.tt(t[o-1],e,r,n)},tt(t,e,r,n){n=n||et.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const o=e;let i,a=s.go(t);if(a?(i=new et,Object.assign(i.j,a.j),i.jr.push.apply(i.jr,a.jr),i.jd=a.jd,i.t=a.t):i=new et,o){if(n)if(i.t&&typeof i.t=="string"){const l=Object.assign(vA(i.t,n),r);Wr(o,l,n)}else r&&Wr(o,r,n);i.t=o}return s.j[t]=i,i}};const re=(t,e,r,n,s)=>t.ta(e,r,n,s),ge=(t,e,r,n,s)=>t.tr(e,r,n,s),gh=(t,e,r,n,s)=>t.ts(e,r,n,s),R=(t,e,r,n,s)=>t.tt(e,r,n,s),Ht="WORD",Hl="UWORD",Xg="ASCIINUMERICAL",Qg="ALPHANUMERICAL",Rs="LOCALHOST",Vl="TLD",ql="UTLD",_o="SCHEME",Dn="SLASH_SCHEME",Zu="NUM",Wl="WS",Xu="NL",ks="OPENBRACE",Es="CLOSEBRACE",ei="OPENBRACKET",ti="CLOSEBRACKET",ri="OPENPAREN",ni="CLOSEPAREN",si="OPENANGLEBRACKET",oi="CLOSEANGLEBRACKET",ii="FULLWIDTHLEFTPAREN",ai="FULLWIDTHRIGHTPAREN",li="LEFTCORNERBRACKET",ui="RIGHTCORNERBRACKET",ci="LEFTWHITECORNERBRACKET",di="RIGHTWHITECORNERBRACKET",pi="FULLWIDTHLESSTHAN",hi="FULLWIDTHGREATERTHAN",fi="AMPERSAND",mi="APOSTROPHE",gi="ASTERISK",ur="AT",bi="BACKSLASH",yi="BACKTICK",xi="CARET",pr="COLON",Qu="COMMA",vi="DOLLAR",St="DOT",wi="EQUALS",ec="EXCLAMATION",ct="HYPHEN",Ss="PERCENT",Di="PIPE",Ci="PLUS",ki="POUND",Fs="QUERY",tc="QUOTE",e0="FULLWIDTHMIDDLEDOT",rc="SEMI",Ft="SLASH",As="TILDE",Ei="UNDERSCORE",t0="EMOJI",Si="SYM";var r0=Object.freeze({__proto__:null,ALPHANUMERICAL:Qg,AMPERSAND:fi,APOSTROPHE:mi,ASCIINUMERICAL:Xg,ASTERISK:gi,AT:ur,BACKSLASH:bi,BACKTICK:yi,CARET:xi,CLOSEANGLEBRACKET:oi,CLOSEBRACE:Es,CLOSEBRACKET:ti,CLOSEPAREN:ni,COLON:pr,COMMA:Qu,DOLLAR:vi,DOT:St,EMOJI:t0,EQUALS:wi,EXCLAMATION:ec,FULLWIDTHGREATERTHAN:hi,FULLWIDTHLEFTPAREN:ii,FULLWIDTHLESSTHAN:pi,FULLWIDTHMIDDLEDOT:e0,FULLWIDTHRIGHTPAREN:ai,HYPHEN:ct,LEFTCORNERBRACKET:li,LEFTWHITECORNERBRACKET:ci,LOCALHOST:Rs,NL:Xu,NUM:Zu,OPENANGLEBRACKET:si,OPENBRACE:ks,OPENBRACKET:ei,OPENPAREN:ri,PERCENT:Ss,PIPE:Di,PLUS:Ci,POUND:ki,QUERY:Fs,QUOTE:tc,RIGHTCORNERBRACKET:ui,RIGHTWHITECORNERBRACKET:di,SCHEME:_o,SEMI:rc,SLASH:Ft,SLASH_SCHEME:Dn,SYM:Si,TILDE:As,TLD:Vl,UNDERSCORE:Ei,UTLD:ql,UWORD:Hl,WORD:Ht,WS:Wl});const Pt=/[a-z]/,us=/\p{L}/u,Xa=/\p{Emoji}/u,zt=/\d/,Qa=/\s/,bh="\r",el=`
167
+ `,wA="️",DA="‍",tl="";let Eo=null,So=null;function CA(t=[]){const e={};et.groups=e;const r=new et;Eo==null&&(Eo=yh(mA)),So==null&&(So=yh(gA)),R(r,"'",mi),R(r,"{",ks),R(r,"}",Es),R(r,"[",ei),R(r,"]",ti),R(r,"(",ri),R(r,")",ni),R(r,"<",si),R(r,">",oi),R(r,"(",ii),R(r,")",ai),R(r,"「",li),R(r,"」",ui),R(r,"『",ci),R(r,"』",di),R(r,"<",pi),R(r,">",hi),R(r,"&",fi),R(r,"*",gi),R(r,"@",ur),R(r,"`",yi),R(r,"^",xi),R(r,":",pr),R(r,",",Qu),R(r,"$",vi),R(r,".",St),R(r,"=",wi),R(r,"!",ec),R(r,"-",ct),R(r,"%",Ss),R(r,"|",Di),R(r,"+",Ci),R(r,"#",ki),R(r,"?",Fs),R(r,'"',tc),R(r,"/",Ft),R(r,";",rc),R(r,"~",As),R(r,"_",Ei),R(r,"\\",bi),R(r,"・",e0);const n=ge(r,zt,Zu,{[Rl]:!0});ge(n,zt,n);const s=ge(n,Pt,Xg,{[Cs]:!0}),o=ge(n,us,Qg,{[ms]:!0}),i=ge(r,Pt,Ht,{[Pl]:!0});ge(i,zt,s),ge(i,Pt,i),ge(s,zt,s),ge(s,Pt,s);const a=ge(r,us,Hl,{[zl]:!0});ge(a,Pt),ge(a,zt,o),ge(a,us,a),ge(o,zt,o),ge(o,Pt),ge(o,us,o);const l=R(r,el,Xu,{[Za]:!0}),c=R(r,bh,Wl,{[Za]:!0}),d=ge(r,Qa,Wl,{[Za]:!0});R(r,tl,d),R(c,el,l),R(c,tl,d),ge(c,Qa,d),R(d,bh),R(d,el),ge(d,Qa,d),R(d,tl,d);const f=ge(r,Xa,t0,{[Zg]:!0});R(f,"#"),ge(f,Xa,f),R(f,wA,f);const m=R(f,DA);R(m,"#"),ge(m,Xa,f);const g=[[Pt,i],[zt,s]],y=[[Pt,null],[us,a],[zt,o]];for(let x=0;x<Eo.length;x++)sr(r,Eo[x],Vl,Ht,g);for(let x=0;x<So.length;x++)sr(r,So[x],ql,Hl,y);Wr(Vl,{tld:!0,ascii:!0},e),Wr(ql,{utld:!0,alpha:!0},e),sr(r,"file",_o,Ht,g),sr(r,"mailto",_o,Ht,g),sr(r,"http",Dn,Ht,g),sr(r,"https",Dn,Ht,g),sr(r,"ftp",Dn,Ht,g),sr(r,"ftps",Dn,Ht,g),Wr(_o,{scheme:!0,ascii:!0},e),Wr(Dn,{slashscheme:!0,ascii:!0},e),t=t.sort((x,w)=>x[0]>w[0]?1:-1);for(let x=0;x<t.length;x++){const w=t[x][0],E=t[x][1]?{[bA]:!0}:{[yA]:!0};w.indexOf("-")>=0?E[$l]=!0:Pt.test(w)?zt.test(w)?E[Cs]=!0:E[Pl]=!0:E[Rl]=!0,gh(r,w,w,E)}return gh(r,"localhost",Rs,{ascii:!0}),r.jd=new et(Si),{start:r,tokens:Object.assign({groups:e},r0)}}function n0(t,e){const r=kA(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=r.length,s=[];let o=0,i=0;for(;i<n;){let a=t,l=null,c=0,d=null,f=-1,m=-1;for(;i<n&&(l=a.go(r[i]));)a=l,a.accepts()?(f=0,m=0,d=a):f>=0&&(f+=r[i].length,m++),c+=r[i].length,o+=r[i].length,i++;o-=f,i-=m,c-=f,s.push({t:d.t,v:e.slice(o-c,o),s:o-c,e:o})}return s}function kA(t){const e=[],r=t.length;let n=0;for(;n<r;){let s=t.charCodeAt(n),o,i=s<55296||s>56319||n+1===r||(o=t.charCodeAt(n+1))<56320||o>57343?t[n]:t.slice(n,n+2);e.push(i),n+=i.length}return e}function sr(t,e,r,n,s){let o;const i=e.length;for(let a=0;a<i-1;a++){const l=e[a];t.j[l]?o=t.j[l]:(o=new et(n),o.jr=s.slice(),t.j[l]=o),t=o}return o=new et(r),o.jr=s.slice(),t.j[e[i-1]]=o,o}function yh(t){const e=[],r=[];let n=0,s="0123456789";for(;n<t.length;){let o=0;for(;s.indexOf(t[n+o])>=0;)o++;if(o>0){e.push(r.join(""));for(let i=parseInt(t.substring(n,n+o),10);i>0;i--)r.pop();n+=o}else r.push(t[n]),n++}return e}const Ps={defaultProtocol:"http",events:null,format:xh,formatHref:xh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function nc(t,e=null){let r=Object.assign({},Ps);t&&(r=Object.assign(r,t instanceof nc?t.o:t));const n=r.ignoreTags,s=[];for(let o=0;o<n.length;o++)s.push(n[o].toUpperCase());this.o=r,e&&(this.defaultRender=e),this.ignoreTags=s}nc.prototype={o:Ps,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,r){const n=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=r.t in s?s[r.t]:Ps[t],typeof s=="function"&&n&&(s=s(e,r))):typeof s=="function"&&n&&(s=s(e,r.t,r)),s)},getObj(t,e,r){let n=this.o[t];return typeof n=="function"&&e!=null&&(n=n(e,r.t,r)),n},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function xh(t){return t}function s0(t,e){this.t="token",this.v=t,this.tk=e}s0.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),r=t.get("truncate",e,this),n=t.get("format",e,this);return r&&n.length>r?n.substring(0,r)+"…":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=Ps.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,r=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",r,this),s=t.get("tagName",r,e),o=this.toFormattedString(t),i={},a=t.get("className",r,e),l=t.get("target",r,e),c=t.get("rel",r,e),d=t.getObj("attributes",r,e),f=t.getObj("events",r,e);return i.href=n,a&&(i.class=a),l&&(i.target=l),c&&(i.rel=c),d&&Object.assign(i,d),{tagName:s,attributes:i,content:o,eventListeners:f}}};function Xi(t,e){class r extends s0{constructor(s,o){super(s,o),this.t=t}}for(const n in e)r.prototype[n]=e[n];return r.t=t,r}const vh=Xi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),wh=Xi("text"),EA=Xi("nl"),Fo=Xi("url",{isLink:!0,toHref(t=Ps.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Rs&&t[1].t===pr}}),lt=t=>new et(t);function SA({groups:t}){const e=t.domain.concat([fi,gi,ur,bi,yi,xi,vi,wi,ct,Zu,Ss,Di,Ci,ki,Ft,Si,As,Ei]),r=[mi,pr,Qu,St,ec,Ss,Fs,tc,rc,si,oi,ks,Es,ti,ei,ri,ni,ii,ai,li,ui,ci,di,pi,hi],n=[fi,mi,gi,bi,yi,xi,vi,wi,ct,ks,Es,Ss,Di,Ci,ki,Fs,Ft,Si,As,Ei],s=lt(),o=R(s,As);re(o,n,o),re(o,t.domain,o);const i=lt(),a=lt(),l=lt();re(s,t.domain,i),re(s,t.scheme,a),re(s,t.slashscheme,l),re(i,n,o),re(i,t.domain,i);const c=R(i,ur);R(o,ur,c),R(a,ur,c),R(l,ur,c);const d=R(o,St);re(d,n,o),re(d,t.domain,o);const f=lt();re(c,t.domain,f),re(f,t.domain,f);const m=R(f,St);re(m,t.domain,f);const g=lt(vh);re(m,t.tld,g),re(m,t.utld,g),R(c,Rs,g);const y=R(f,ct);R(y,ct,y),re(y,t.domain,f),re(g,t.domain,f),R(g,St,m),R(g,ct,y);const x=R(g,pr);re(x,t.numeric,vh);const w=R(i,ct),D=R(i,St);R(w,ct,w),re(w,t.domain,i),re(D,n,o),re(D,t.domain,i);const E=lt(Fo);re(D,t.tld,E),re(D,t.utld,E),re(E,t.domain,i),re(E,n,o),R(E,St,D),R(E,ct,w),R(E,ur,c);const S=R(E,pr),A=lt(Fo);re(S,t.numeric,A);const T=lt(Fo),j=lt();re(T,e,T),re(T,r,j),re(j,e,T),re(j,r,j),R(E,Ft,T),R(A,Ft,T);const B=R(a,pr),$=R(l,pr),O=R($,Ft),P=R(O,Ft);re(a,t.domain,i),R(a,St,D),R(a,ct,w),re(l,t.domain,i),R(l,St,D),R(l,ct,w),re(B,t.domain,T),R(B,Ft,T),R(B,Fs,T),re(P,t.domain,T),re(P,e,T),R(P,Ft,T);const L=[[ks,Es],[ei,ti],[ri,ni],[si,oi],[ii,ai],[li,ui],[ci,di],[pi,hi]];for(let H=0;H<L.length;H++){const[Y,q]=L[H],Z=R(T,Y);R(j,Y,Z),R(Z,q,T);const he=lt(Fo);re(Z,e,he);const Ae=lt();re(Z,r),re(he,e,he),re(he,r,Ae),re(Ae,e,he),re(Ae,r,Ae),R(he,q,T),R(Ae,q,T)}return R(s,Rs,E),R(s,Xu,EA),{start:s,tokens:r0}}function FA(t,e,r){let n=r.length,s=0,o=[],i=[];for(;s<n;){let a=t,l=null,c=null,d=0,f=null,m=-1;for(;s<n&&!(l=a.go(r[s].t));)i.push(r[s++]);for(;s<n&&(c=l||a.go(r[s].t));)l=null,a=c,a.accepts()?(m=0,f=a):m>=0&&m++,s++,d++;if(m<0)s-=d,s<n&&(i.push(r[s]),s++);else{i.length>0&&(o.push(rl(wh,e,i)),i=[]),s-=m,d-=m;const g=f.t,y=r.slice(s-d,s);o.push(rl(g,e,y))}}return i.length>0&&o.push(rl(wh,e,i)),o}function rl(t,e,r){const n=r[0].s,s=r[r.length-1].e,o=e.slice(n,s);return new t(o,r)}const AA=typeof console<"u"&&console&&console.warn||(()=>{}),NA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",pe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function TA(){return et.groups={},pe.scanner=null,pe.parser=null,pe.tokenQueue=[],pe.pluginQueue=[],pe.customSchemes=[],pe.initialized=!1,pe}function Dh(t,e=!1){if(pe.initialized&&AA(`linkifyjs: already initialized - will not register custom scheme "${t}" ${NA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
180
168
  1. Must only contain digits, lowercase ASCII letters or "-"
181
169
  2. Cannot start or end with "-"
182
- 3. "-" cannot repeat`);pe.customSchemes.push([t,e])}function vA(){pe.scanner=pA(pe.customSchemes);for(let t=0;t<pe.tokenQueue.length;t++)pe.tokenQueue[t][1]({scanner:pe.scanner});pe.parser=mA(pe.scanner.tokens);for(let t=0;t<pe.pluginQueue.length;t++)pe.pluginQueue[t][1]({scanner:pe.scanner,parser:pe.parser});return pe.initialized=!0,pe}function ec(t){return pe.initialized||vA(),gA(pe.parser.start,t,Zg(pe.scanner.start,t))}ec.scan=Zg;function t0(t,e=null,r=null){if(e&&typeof e=="object"){if(r)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);r=e,e=null}const n=new Zu(r),s=ec(t),o=[];for(let i=0;i<s.length;i++){const a=s[i];a.isLink&&(!e||a.t===e)&&n.check(a)&&o.push(a.toFormattedObject(n))}return o}var tc="[\0-   ᠎ -\u2029  ]",wA=new RegExp(tc),DA=new RegExp(`${tc}$`),CA=new RegExp(tc,"g");function kA(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function EA(t){return new be({key:new je("autolink"),appendTransaction:(e,r,n)=>{const s=e.some(c=>c.docChanged)&&!r.doc.eq(n.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!s||o)return;const{tr:i}=n,a=Cg(r.doc,[...e]);if(Tg(a).forEach(({newRange:c})=>{const d=ZS(n.doc,c,g=>g.isTextblock);let f,m;if(d.length>1)f=d[0],m=n.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const g=n.doc.textBetween(c.from,c.to," "," ");if(!DA.test(g))return;f=d[0],m=n.doc.textBetween(f.pos,c.to,void 0," ")}if(f&&m){const g=m.split(wA).filter(Boolean);if(g.length<=0)return!1;const y=g[g.length-1],v=f.pos+m.lastIndexOf(y);if(!y)return!1;const w=ec(y).map(D=>D.toObject(t.defaultProtocol));if(!kA(w))return!1;w.filter(D=>D.isLink).map(D=>({...D,from:v+D.start+1,to:v+D.end+1})).filter(D=>n.schema.marks.code?!n.doc.rangeHasMark(D.from,D.to,n.schema.marks.code):!0).filter(D=>t.validate(D.value)).filter(D=>t.shouldAutoLink(D.value)).forEach(D=>{Hu(D.from,D.to,n.doc).some(E=>E.mark.type===t.type)||i.addMark(D.from,D.to,t.type.create({href:D.href}))})}}),!!i.steps.length)return i}})}function SA(t){return new be({key:new je("handleClickLink"),props:{handleClick:(e,r,n)=>{var s,o;if(n.button!==0||!e.editable)return!1;let i=null;if(n.target instanceof HTMLAnchorElement)i=n.target;else{let d=n.target;const f=[];for(;d.nodeName!=="DIV";)f.push(d),d=d.parentNode;i=f.find(m=>m.nodeName==="A")}if(!i)return!1;const a=Ng(e.state,t.type.name),l=(s=i?.href)!=null?s:a.href,c=(o=i?.target)!=null?o:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),i&&l?(window.open(l,c),!0):!1}}})}function FA(t){return new be({key:new je("handlePasteLink"),props:{handlePaste:(e,r,n)=>{const{shouldAutoLink:s}=t,{state:o}=e,{selection:i}=o,{empty:a}=i;if(a)return!1;let l="";n.content.forEach(d=>{l+=d.textContent});const c=t0(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||s!==void 0&&!s(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Or(t,e){const r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{const s=typeof n=="string"?n:n.scheme;s&&r.push(s)}),!t||t.replace(CA,"").match(new RegExp(`^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var r0=Ar.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){yh(t);return}yh(t.scheme,t.optionalSlashes)})},onDestroy(){xA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Or(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return 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:r=>!!Or(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Or(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ye(this.options.HTMLAttributes,t),0]:["a",ye(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var r;const n=((r=t.attrs)==null?void 0:r.href)||"";return`[${e.renderChildren(t)}](${n})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:r}=t;return this.options.isAllowedUri(r,{defaultValidate:n=>!!Or(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:r}=t||{};return r&&!this.options.isAllowedUri(r,{defaultValidate:n=>!!Or(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[rn({find:t=>{const e=[];if(t){const{protocols:r,defaultProtocol:n}=this.options,s=t0(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:i=>!!Or(i,r),protocols:r,defaultProtocol:n}));s.length&&s.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:r}=this.options;return this.options.autolink&&t.push(EA({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:s=>!!Or(s,e),protocols:e,defaultProtocol:r}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(SA({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(FA({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),AA=r0,NA=20,n0=(t,e=0)=>{const r=[];return!t.children.length||e>NA||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?r.push(n):n.children.length&&r.push(...n0(n,e+1))}),r},TA=t=>{if(!t.children.length)return;const e=n0(t);e&&e.forEach(r=>{var n,s;const o=r.getAttribute("style"),i=(s=(n=r.parentElement)==null?void 0:n.closest("span"))==null?void 0:s.getAttribute("style");r.setAttribute("style",`${i};${o}`)})},MA=Ar.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&TA(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",ye(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(r,n)=>{if(r.isTextblock)return!0;r.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(o=>!!o))||t.removeMark(n,n+r.nodeSize,this.type)}),!0}}}}),BA=de.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const r=t.getAttribute("style");if(r){const n=r.split(";").map(s=>s.trim()).filter(Boolean);for(let s=n.length-1;s>=0;s-=1){const o=n[s].split(":");if(o.length>=2){const i=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(i==="background-color")return a.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),jA=de.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const r=t.getAttribute("style");if(r){const n=r.split(";").map(s=>s.trim()).filter(Boolean);for(let s=n.length-1;s>=0;s-=1){const o=n[s].split(":");if(o.length>=2){const i=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(i==="color")return a.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),OA=de.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),LA=de.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),_A=de.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),IA=de.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(BA.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(jA.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(OA.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(LA.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(_A.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(MA.configure(this.options.textStyle)),t}}),s0={exports:{}},o0={};/**
170
+ 3. "-" cannot repeat`);pe.customSchemes.push([t,e])}function MA(){pe.scanner=CA(pe.customSchemes);for(let t=0;t<pe.tokenQueue.length;t++)pe.tokenQueue[t][1]({scanner:pe.scanner});pe.parser=SA(pe.scanner.tokens);for(let t=0;t<pe.pluginQueue.length;t++)pe.pluginQueue[t][1]({scanner:pe.scanner,parser:pe.parser});return pe.initialized=!0,pe}function sc(t){return pe.initialized||MA(),FA(pe.parser.start,t,n0(pe.scanner.start,t))}sc.scan=n0;function o0(t,e=null,r=null){if(e&&typeof e=="object"){if(r)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);r=e,e=null}const n=new nc(r),s=sc(t),o=[];for(let i=0;i<s.length;i++){const a=s[i];a.isLink&&(!e||a.t===e)&&n.check(a)&&o.push(a.toFormattedObject(n))}return o}var oc="[\0-   ᠎ -\u2029  ]",BA=new RegExp(oc),jA=new RegExp(`${oc}$`),OA=new RegExp(oc,"g");function LA(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function _A(t){return new ye({key:new Oe("autolink"),appendTransaction:(e,r,n)=>{const s=e.some(c=>c.docChanged)&&!r.doc.eq(n.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!s||o)return;const{tr:i}=n,a=Fg(r.doc,[...e]);if(Og(a).forEach(({newRange:c})=>{const d=cF(n.doc,c,g=>g.isTextblock);let f,m;if(d.length>1)f=d[0],m=n.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const g=n.doc.textBetween(c.from,c.to," "," ");if(!jA.test(g))return;f=d[0],m=n.doc.textBetween(f.pos,c.to,void 0," ")}if(f&&m){const g=m.split(BA).filter(Boolean);if(g.length<=0)return!1;const y=g[g.length-1],x=f.pos+m.lastIndexOf(y);if(!y)return!1;const w=sc(y).map(D=>D.toObject(t.defaultProtocol));if(!LA(w))return!1;w.filter(D=>D.isLink).map(D=>({...D,from:x+D.start+1,to:x+D.end+1})).filter(D=>n.schema.marks.code?!n.doc.rangeHasMark(D.from,D.to,n.schema.marks.code):!0).filter(D=>t.validate(D.value)).filter(D=>t.shouldAutoLink(D.value)).forEach(D=>{Uu(D.from,D.to,n.doc).some(E=>E.mark.type===t.type)||i.addMark(D.from,D.to,t.type.create({href:D.href}))})}}),!!i.steps.length)return i}})}function IA(t){return new ye({key:new Oe("handleClickLink"),props:{handleClick:(e,r,n)=>{var s,o;if(n.button!==0||!e.editable)return!1;let i=null;if(n.target instanceof HTMLAnchorElement)i=n.target;else{let d=n.target;const f=[];for(;d.nodeName!=="DIV";)f.push(d),d=d.parentNode;i=f.find(m=>m.nodeName==="A")}if(!i)return!1;const a=jg(e.state,t.type.name),l=(s=i?.href)!=null?s:a.href,c=(o=i?.target)!=null?o:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),i&&l?(window.open(l,c),!0):!1}}})}function RA(t){return new ye({key:new Oe("handlePasteLink"),props:{handlePaste:(e,r,n)=>{const{shouldAutoLink:s}=t,{state:o}=e,{selection:i}=o,{empty:a}=i;if(a)return!1;let l="";n.content.forEach(d=>{l+=d.textContent});const c=o0(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||s!==void 0&&!s(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Lr(t,e){const r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{const s=typeof n=="string"?n:n.scheme;s&&r.push(s)}),!t||t.replace(OA,"").match(new RegExp(`^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var i0=Nr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Dh(t);return}Dh(t.scheme,t.optionalSlashes)})},onDestroy(){TA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Lr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return 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:r=>!!Lr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Lr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xe(this.options.HTMLAttributes,t),0]:["a",xe(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var r;const n=((r=t.attrs)==null?void 0:r.href)||"";return`[${e.renderChildren(t)}](${n})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:r}=t;return this.options.isAllowedUri(r,{defaultValidate:n=>!!Lr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:r}=t||{};return r&&!this.options.isAllowedUri(r,{defaultValidate:n=>!!Lr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[nn({find:t=>{const e=[];if(t){const{protocols:r,defaultProtocol:n}=this.options,s=o0(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:i=>!!Lr(i,r),protocols:r,defaultProtocol:n}));s.length&&s.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:r}=this.options;return this.options.autolink&&t.push(_A({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:s=>!!Lr(s,e),protocols:e,defaultProtocol:r}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(IA({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(RA({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),PA=i0,zA=20,a0=(t,e=0)=>{const r=[];return!t.children.length||e>zA||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?r.push(n):n.children.length&&r.push(...a0(n,e+1))}),r},$A=t=>{if(!t.children.length)return;const e=a0(t);e&&e.forEach(r=>{var n,s;const o=r.getAttribute("style"),i=(s=(n=r.parentElement)==null?void 0:n.closest("span"))==null?void 0:s.getAttribute("style");r.setAttribute("style",`${i};${o}`)})},HA=Nr.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&$A(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",xe(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(r,n)=>{if(r.isTextblock)return!0;r.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(o=>!!o))||t.removeMark(n,n+r.nodeSize,this.type)}),!0}}}}),VA=de.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const r=t.getAttribute("style");if(r){const n=r.split(";").map(s=>s.trim()).filter(Boolean);for(let s=n.length-1;s>=0;s-=1){const o=n[s].split(":");if(o.length>=2){const i=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(i==="background-color")return a.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),qA=de.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const r=t.getAttribute("style");if(r){const n=r.split(";").map(s=>s.trim()).filter(Boolean);for(let s=n.length-1;s>=0;s-=1){const o=n[s].split(":");if(o.length>=2){const i=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(i==="color")return a.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),WA=de.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),UA=de.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),KA=de.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),JA=de.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(VA.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(qA.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(WA.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(UA.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(KA.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(HA.configure(this.options.textStyle)),t}}),l0={exports:{}},u0={};/**
183
171
  * @license React
184
172
  * use-sync-external-store-shim.production.js
185
173
  *
@@ -187,7 +175,7 @@ ${w}
187
175
  *
188
176
  * This source code is licensed under the MIT license found in the
189
177
  * LICENSE file in the root directory of this source tree.
190
- */var Ln=Be.default;function RA(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var PA=typeof Object.is=="function"?Object.is:RA,zA=Ln.useState,$A=Ln.useEffect,HA=Ln.useLayoutEffect,VA=Ln.useDebugValue;function qA(t,e){var r=e(),n=zA({inst:{value:r,getSnapshot:e}}),s=n[0].inst,o=n[1];return HA(function(){s.value=r,s.getSnapshot=e,el(s)&&o({inst:s})},[t,r,e]),$A(function(){return el(s)&&o({inst:s}),t(function(){el(s)&&o({inst:s})})},[t]),VA(r),r}function el(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!PA(t,r)}catch{return!0}}function WA(t,e){return e()}var UA=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?WA:qA;o0.useSyncExternalStore=Ln.useSyncExternalStore!==void 0?Ln.useSyncExternalStore:UA;s0.exports=o0;var rc=s0.exports,JA=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(s of e.entries())if(!r.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],r.get(s[0])))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(s of e.entries())if(!r.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(e[s]!==r[s])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!(i==="_owner"&&e.$$typeof)&&!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r};const KA=Kh(JA);var i0={exports:{}},a0={};/**
178
+ */var _n=ze.default;function GA(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var YA=typeof Object.is=="function"?Object.is:GA,ZA=_n.useState,XA=_n.useEffect,QA=_n.useLayoutEffect,eN=_n.useDebugValue;function tN(t,e){var r=e(),n=ZA({inst:{value:r,getSnapshot:e}}),s=n[0].inst,o=n[1];return QA(function(){s.value=r,s.getSnapshot=e,nl(s)&&o({inst:s})},[t,r,e]),XA(function(){return nl(s)&&o({inst:s}),t(function(){nl(s)&&o({inst:s})})},[t]),eN(r),r}function nl(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!YA(t,r)}catch{return!0}}function rN(t,e){return e()}var nN=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rN:tN;u0.useSyncExternalStore=_n.useSyncExternalStore!==void 0?_n.useSyncExternalStore:nN;l0.exports=u0;var ic=l0.exports,sN=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(s of e.entries())if(!r.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],r.get(s[0])))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(s of e.entries())if(!r.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(e[s]!==r[s])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!(i==="_owner"&&e.$$typeof)&&!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r};const oN=Gh(sN);var c0={exports:{}},d0={};/**
191
179
  * @license React
192
180
  * use-sync-external-store-shim/with-selector.production.js
193
181
  *
@@ -195,37 +183,37 @@ ${w}
195
183
  *
196
184
  * This source code is licensed under the MIT license found in the
197
185
  * LICENSE file in the root directory of this source tree.
198
- */var Yi=Be.default,GA=rc;function YA(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var XA=typeof Object.is=="function"?Object.is:YA,QA=GA.useSyncExternalStore,ZA=Yi.useRef,eN=Yi.useEffect,tN=Yi.useMemo,rN=Yi.useDebugValue;a0.useSyncExternalStoreWithSelector=function(t,e,r,n,s){var o=ZA(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=tN(function(){function l(g){if(!c){if(c=!0,d=g,g=n(g),s!==void 0&&i.hasValue){var y=i.value;if(s(y,g))return f=y}return f=g}if(y=f,XA(d,g))return y;var v=n(g);return s!==void 0&&s(y,v)?(d=g,y):(d=g,f=v)}var c=!1,d,f,m=r===void 0?null:r;return[function(){return l(e())},m===null?void 0:function(){return l(m())}]},[e,r,n,s]);var a=QA(t,o[0],o[1]);return eN(function(){i.hasValue=!0,i.value=a},[a]),rN(a),a};i0.exports=a0;var nN=i0.exports,sN=(...t)=>e=>{t.forEach(r=>{typeof r=="function"?r(e):r&&(r.current=e)})},oN=({contentComponent:t})=>{const e=rc.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return h.jsx(h.Fragment,{children:Object.values(e)})};function iN(){const t=new Set;let e={};return{subscribe(r){return t.add(r),()=>{t.delete(r)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(r,n){e={...e,[r]:U2.default.createPortal(n.reactElement,n.element,r)},t.forEach(s=>s())},removeRenderer(r){const n={...e};delete n[r],e=n,t.forEach(s=>s())}}}var aN=class extends Be.default.Component{constructor(t){var e;super(t),this.editorContentRef=Be.default.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=iN(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const r=document.createElement("div");r.append(e.view.dom),e.setOptions({element:r})}catch{}}}render(){const{editor:t,innerRef:e,...r}=this.props;return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:sN(e,this.editorContentRef),...r}),t?.contentComponent&&h.jsx(oN,{contentComponent:t.contentComponent})]})}},lN=S.forwardRef((t,e)=>{const r=Be.default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Be.default.createElement(aN,{key:r,innerRef:e,...t})}),uN=Be.default.memo(lN),cN=typeof window<"u"?S.useLayoutEffect:S.useEffect,dN=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},r=this.editor;return r.on("transaction",e),()=>{r.off("transaction",e)}}}};function l0(t){var e;const[r]=S.useState(()=>new dN(t.editor)),n=nN.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:KA);return cN(()=>r.watch(t.editor),[t.editor,r]),S.useDebugValue(n),n}var pN=!1,ql=typeof window>"u",hN=ql||!!(typeof window<"u"&&window.next),fN=class u0{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(r=>r())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?ql||hN?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var s,o;return(o=(s=this.options.current).onBeforeCreate)==null?void 0:o.call(s,...n)},onBlur:(...n)=>{var s,o;return(o=(s=this.options.current).onBlur)==null?void 0:o.call(s,...n)},onCreate:(...n)=>{var s,o;return(o=(s=this.options.current).onCreate)==null?void 0:o.call(s,...n)},onDestroy:(...n)=>{var s,o;return(o=(s=this.options.current).onDestroy)==null?void 0:o.call(s,...n)},onFocus:(...n)=>{var s,o;return(o=(s=this.options.current).onFocus)==null?void 0:o.call(s,...n)},onSelectionUpdate:(...n)=>{var s,o;return(o=(s=this.options.current).onSelectionUpdate)==null?void 0:o.call(s,...n)},onTransaction:(...n)=>{var s,o;return(o=(s=this.options.current).onTransaction)==null?void 0:o.call(s,...n)},onUpdate:(...n)=>{var s,o;return(o=(s=this.options.current).onUpdate)==null?void 0:o.call(s,...n)},onContentError:(...n)=>{var s,o;return(o=(s=this.options.current).onContentError)==null?void 0:o.call(s,...n)},onDrop:(...n)=>{var s,o;return(o=(s=this.options.current).onDrop)==null?void 0:o.call(s,...n)},onPaste:(...n)=>{var s,o;return(o=(s=this.options.current).onPaste)==null?void 0:o.call(s,...n)},onDelete:(...n)=>{var s,o;return(o=(s=this.options.current).onDelete)==null?void 0:o.call(s,...n)}};return new JF(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,r){return Object.keys(e).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&e.extensions&&r.extensions?e.extensions.length!==r.extensions.length?!1:e.extensions.every((s,o)=>{var i;return s===((i=r.extensions)==null?void 0:i[o])}):e[n]===r[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?u0.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,s)=>n===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,r=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){r&&r.setOptions(this.options.current);return}r&&!r.isDestroyed&&(r.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function mN(t={},e=[]){const r=S.useRef(t);r.current=t;const[n]=S.useState(()=>new fN(r)),s=rc.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return S.useDebugValue(s),S.useEffect(n.onRender(e)),l0({editor:s,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),s}var gN=S.createContext({editor:null});gN.Consumer;var bN=S.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),yN=()=>S.useContext(bN);Be.default.forwardRef((t,e)=>{const{onDragStart:r}=yN(),n=t.as||"div";return h.jsx(n,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})});Be.default.createContext({markViewContentRef:()=>{}});var Ci=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:r,...n}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,n,r]},xN=/^\s*>\s$/,vN=ot.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Ci("blockquote",{...ye(this.options.HTMLAttributes,t),children:Ci("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const r=[];return t.content.forEach(s=>{const i=e.renderChildren(s).split(`
186
+ */var Qi=ze.default,iN=ic;function aN(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var lN=typeof Object.is=="function"?Object.is:aN,uN=iN.useSyncExternalStore,cN=Qi.useRef,dN=Qi.useEffect,pN=Qi.useMemo,hN=Qi.useDebugValue;d0.useSyncExternalStoreWithSelector=function(t,e,r,n,s){var o=cN(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=pN(function(){function l(g){if(!c){if(c=!0,d=g,g=n(g),s!==void 0&&i.hasValue){var y=i.value;if(s(y,g))return f=y}return f=g}if(y=f,lN(d,g))return y;var x=n(g);return s!==void 0&&s(y,x)?(d=g,y):(d=g,f=x)}var c=!1,d,f,m=r===void 0?null:r;return[function(){return l(e())},m===null?void 0:function(){return l(m())}]},[e,r,n,s]);var a=uN(t,o[0],o[1]);return dN(function(){i.hasValue=!0,i.value=a},[a]),hN(a),a};c0.exports=d0;var fN=c0.exports,mN=(...t)=>e=>{t.forEach(r=>{typeof r=="function"?r(e):r&&(r.current=e)})},gN=({contentComponent:t})=>{const e=ic.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return h.jsx(h.Fragment,{children:Object.values(e)})};function bN(){const t=new Set;let e={};return{subscribe(r){return t.add(r),()=>{t.delete(r)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(r,n){e={...e,[r]:Y2.default.createPortal(n.reactElement,n.element,r)},t.forEach(s=>s())},removeRenderer(r){const n={...e};delete n[r],e=n,t.forEach(s=>s())}}}var yN=class extends ze.default.Component{constructor(t){var e;super(t),this.editorContentRef=ze.default.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=bN(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const r=document.createElement("div");r.append(e.view.dom),e.setOptions({element:r})}catch{}}}render(){const{editor:t,innerRef:e,...r}=this.props;return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:mN(e,this.editorContentRef),...r}),t?.contentComponent&&h.jsx(gN,{contentComponent:t.contentComponent})]})}},xN=F.forwardRef((t,e)=>{const r=ze.default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ze.default.createElement(yN,{key:r,innerRef:e,...t})}),vN=ze.default.memo(xN),wN=typeof window<"u"?F.useLayoutEffect:F.useEffect,DN=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},r=this.editor;return r.on("transaction",e),()=>{r.off("transaction",e)}}}};function p0(t){var e;const[r]=F.useState(()=>new DN(t.editor)),n=fN.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:oN);return wN(()=>r.watch(t.editor),[t.editor,r]),F.useDebugValue(n),n}var CN=!1,Ul=typeof window>"u",kN=Ul||!!(typeof window<"u"&&window.next),EN=class h0{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(r=>r())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Ul||kN?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var s,o;return(o=(s=this.options.current).onBeforeCreate)==null?void 0:o.call(s,...n)},onBlur:(...n)=>{var s,o;return(o=(s=this.options.current).onBlur)==null?void 0:o.call(s,...n)},onCreate:(...n)=>{var s,o;return(o=(s=this.options.current).onCreate)==null?void 0:o.call(s,...n)},onDestroy:(...n)=>{var s,o;return(o=(s=this.options.current).onDestroy)==null?void 0:o.call(s,...n)},onFocus:(...n)=>{var s,o;return(o=(s=this.options.current).onFocus)==null?void 0:o.call(s,...n)},onSelectionUpdate:(...n)=>{var s,o;return(o=(s=this.options.current).onSelectionUpdate)==null?void 0:o.call(s,...n)},onTransaction:(...n)=>{var s,o;return(o=(s=this.options.current).onTransaction)==null?void 0:o.call(s,...n)},onUpdate:(...n)=>{var s,o;return(o=(s=this.options.current).onUpdate)==null?void 0:o.call(s,...n)},onContentError:(...n)=>{var s,o;return(o=(s=this.options.current).onContentError)==null?void 0:o.call(s,...n)},onDrop:(...n)=>{var s,o;return(o=(s=this.options.current).onDrop)==null?void 0:o.call(s,...n)},onPaste:(...n)=>{var s,o;return(o=(s=this.options.current).onPaste)==null?void 0:o.call(s,...n)},onDelete:(...n)=>{var s,o;return(o=(s=this.options.current).onDelete)==null?void 0:o.call(s,...n)}};return new sA(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,r){return Object.keys(e).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&e.extensions&&r.extensions?e.extensions.length!==r.extensions.length?!1:e.extensions.every((s,o)=>{var i;return s===((i=r.extensions)==null?void 0:i[o])}):e[n]===r[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?h0.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,s)=>n===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,r=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){r&&r.setOptions(this.options.current);return}r&&!r.isDestroyed&&(r.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function SN(t={},e=[]){const r=F.useRef(t);r.current=t;const[n]=F.useState(()=>new EN(r)),s=ic.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return F.useDebugValue(s),F.useEffect(n.onRender(e)),p0({editor:s,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),s}var FN=F.createContext({editor:null});FN.Consumer;var AN=F.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),NN=()=>F.useContext(AN);ze.default.forwardRef((t,e)=>{const{onDragStart:r}=NN(),n=t.as||"div";return h.jsx(n,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})});ze.default.createContext({markViewContentRef:()=>{}});var Fi=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:r,...n}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,n,r]},TN=/^\s*>\s$/,MN=it.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Fi("blockquote",{...xe(this.options.HTMLAttributes,t),children:Fi("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const r=[];return t.content.forEach(s=>{const i=e.renderChildren(s).split(`
199
187
  `).map(a=>`> ${a}`).join(`
200
188
  `);r.push(i)}),r.flatMap(s=>[s,"> "]).slice(0,-1).join(`
201
- `)},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[On({find:xN,type:this.type})]}}),wN=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,DN=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,CN=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,kN=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,EN=Ar.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&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 Ci("strong",{...ye(this.options.HTMLAttributes,t),children:Ci("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,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[jn({find:wN,type:this.type}),jn({find:CN,type:this.type})]},addPasteRules(){return[rn({find:DN,type:this.type}),rn({find:kN,type:this.type})]}}),SN=/(^|[^`])`([^`]+)`(?!`)$/,FN=/(^|[^`])`([^`]+)`(?!`)/g,AN=Ar.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ye(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",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[jn({find:SN,type:this.type})]},addPasteRules(){return[rn({find:FN,type:this.type})]}}),tl=4,NN=/^```([a-z]+)?[\s\n]$/,TN=/^~~~([a-z]+)?[\s\n]$/,MN=ot.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:tl,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:r}=this.options;if(!r)return null;const o=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(i=>i.startsWith(r)).map(i=>i.replace(r,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ye(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var r;return((r=t.raw)==null?void 0:r.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var r;let n="";const s=((r=t.attrs)==null?void 0:r.language)||"";return t.content?n=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
189
+ `)},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[Ln({find:TN,type:this.type})]}}),BN=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,jN=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ON=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,LN=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,_N=Nr.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&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 Fi("strong",{...xe(this.options.HTMLAttributes,t),children:Fi("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,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[On({find:BN,type:this.type}),On({find:ON,type:this.type})]},addPasteRules(){return[nn({find:jN,type:this.type}),nn({find:LN,type:this.type})]}}),IN=/(^|[^`])`([^`]+)`(?!`)$/,RN=/(^|[^`])`([^`]+)`(?!`)/g,PN=Nr.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",xe(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",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[On({find:IN,type:this.type})]},addPasteRules(){return[nn({find:RN,type:this.type})]}}),sl=4,zN=/^```([a-z]+)?[\s\n]$/,$N=/^~~~([a-z]+)?[\s\n]$/,HN=it.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:sl,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:r}=this.options;if(!r)return null;const o=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(i=>i.startsWith(r)).map(i=>i.replace(r,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",xe(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var r;return((r=t.raw)==null?void 0:r.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var r;let n="";const s=((r=t.attrs)==null?void 0:r.language)||"";return t.content?n=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
202
190
  `):n=`\`\`\`${s}
203
191
 
204
- \`\`\``,n},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,r=e.pos===1;return!t||e.parent.type.name!==this.name?!1:r||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const r=(e=this.options.tabSize)!=null?e:tl,{state:n}=t,{selection:s}=n,{$from:o,empty:i}=s;if(o.parent.type!==this.type)return!1;const a=" ".repeat(r);return i?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:d}=s,g=n.doc.textBetween(c,d,`
192
+ \`\`\``,n},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,r=e.pos===1;return!t||e.parent.type.name!==this.name?!1:r||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const r=(e=this.options.tabSize)!=null?e:sl,{state:n}=t,{selection:s}=n,{$from:o,empty:i}=s;if(o.parent.type!==this.type)return!1;const a=" ".repeat(r);return i?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:d}=s,g=n.doc.textBetween(c,d,`
205
193
  `,`
206
194
  `).split(`
207
195
  `).map(y=>a+y).join(`
208
- `);return l.replaceWith(c,d,n.schema.text(g)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const r=(e=this.options.tabSize)!=null?e:tl,{state:n}=t,{selection:s}=n,{$from:o,empty:i}=s;return o.parent.type!==this.type?!1:i?t.commands.command(({tr:a})=>{var l;const{pos:c}=o,d=o.start(),f=o.end(),g=n.doc.textBetween(d,f,`
196
+ `);return l.replaceWith(c,d,n.schema.text(g)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const r=(e=this.options.tabSize)!=null?e:sl,{state:n}=t,{selection:s}=n,{$from:o,empty:i}=s;return o.parent.type!==this.type?!1:i?t.commands.command(({tr:a})=>{var l;const{pos:c}=o,d=o.start(),f=o.end(),g=n.doc.textBetween(d,f,`
209
197
  `,`
210
198
  `).split(`
211
- `);let y=0,v=0;const w=c-d;for(let j=0;j<g.length;j+=1){if(v+g[j].length>=w){y=j;break}v+=g[j].length+1}const E=((l=g[y].match(/^ */))==null?void 0:l[0])||"",N=Math.min(E.length,r);if(N===0)return!0;let A=d;for(let j=0;j<y;j+=1)A+=g[j].length+1;return a.delete(A,A+N),c-A<=N&&a.setSelection(X.create(a.doc,A)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=s,m=n.doc.textBetween(l,c,`
199
+ `);let y=0,x=0;const w=c-d;for(let j=0;j<g.length;j+=1){if(x+g[j].length>=w){y=j;break}x+=g[j].length+1}const E=((l=g[y].match(/^ */))==null?void 0:l[0])||"",S=Math.min(E.length,r);if(S===0)return!0;let A=d;for(let j=0;j<y;j+=1)A+=g[j].length+1;return a.delete(A,A+S),c-A<=S&&a.setSelection(X.create(a.doc,A)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=s,m=n.doc.textBetween(l,c,`
212
200
  `,`
213
201
  `).split(`
214
- `).map(g=>{var y;const v=((y=g.match(/^ */))==null?void 0:y[0])||"",w=Math.min(v.length,r);return g.slice(w)}).join(`
202
+ `).map(g=>{var y;const x=((y=g.match(/^ */))==null?void 0:y[0])||"",w=Math.min(x.length,r);return g.slice(w)}).join(`
215
203
  `);return a.replaceWith(l,c,n.schema.text(m)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:r}=e,{$from:n,empty:s}=r;if(!s||n.parent.type!==this.type)return!1;const o=n.parentOffset===n.parent.nodeSize-2,i=n.parent.textContent.endsWith(`
216
204
 
217
- `);return!o||!i?!1:t.chain().command(({tr:a})=>(a.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:r,doc:n}=e,{$from:s,empty:o}=r;if(!o||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:n.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(re.near(n.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ol({find:NN,type:this.type,getAttributes:t=>({language:t[1]})}),Ol({find:TN,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new be({key:new je("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const r=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),s=n?JSON.parse(n):void 0,o=s?.mode;if(!r||!o)return!1;const{tr:i,schema:a}=t.state,l=a.text(r.replace(/\r\n?/g,`
218
- `));return i.replaceSelectionWith(this.type.create({language:o},l)),i.selection.$from.parent.type!==this.type&&i.setSelection(X.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),BN=ot.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
205
+ `);return!o||!i?!1:t.chain().command(({tr:a})=>(a.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:r,doc:n}=e,{$from:s,empty:o}=r;if(!o||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:n.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(ne.near(n.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[_l({find:zN,type:this.type,getAttributes:t=>({language:t[1]})}),_l({find:$N,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ye({key:new Oe("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const r=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),s=n?JSON.parse(n):void 0,o=s?.mode;if(!r||!o)return!1;const{tr:i,schema:a}=t.state,l=a.text(r.replace(/\r\n?/g,`
206
+ `));return i.replaceSelectionWith(this.type.create({language:o},l)),i.selection.$from.parent.type!==this.type&&i.setSelection(X.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),VN=it.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
219
207
 
220
- `):""}),jN=ot.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},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]}`,ye(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var r;const n=(r=t.attrs)!=null&&r.level?parseInt(t.attrs.level,10):1,s="#".repeat(n);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},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=>Ol({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),ON=ot.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ye(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!GF(e,e.schema.nodes[this.name]))return!1;const{selection:r}=e,{$to:n}=r,s=t();return Mg(r)?s.insertContentAt(n.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:o,tr:i,dispatch:a})=>{if(a){const{$to:l}=i.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(X.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(Y.create(i.doc,l.pos)):i.setSelection(X.create(i.doc,l.pos));else{const d=o.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,f=d?.create();f&&(i.insert(c,f),i.setSelection(X.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[KF({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),LN=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,_N=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,IN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,RN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,PN=Ar.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ye(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)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[jn({find:LN,type:this.type}),jn({find:IN,type:this.type})]},addPasteRules(){return[rn({find:_N,type:this.type}),rn({find:RN,type:this.type})]}}),zN=Object.defineProperty,$N=(t,e)=>{for(var r in e)zN(t,r,{get:e[r],enumerable:!0})},HN="listItem",xh="textStyle",vh=/^\s*([-+*])\s$/,c0=ot.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ye(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
221
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(HN,this.editor.getAttributes(xh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=On({find:vh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=On({find:vh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(xh),editor:this.editor})),[t]}}),d0=ot.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ye(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let r=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))r=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(r=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const i=t.tokens.slice(1),a=e.parseChildren(i);r.push(...a)}}else r=e.parseChildren(t.tokens)}return r.length===0&&(r=[{type:"paragraph",content:[]}]),{type:"listItem",content:r}},renderMarkdown:(t,e,r)=>Uu(t,e,n=>n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${n.index+1}. `:"- ",r),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),VN={};$N(VN,{findListItemPos:()=>qs,getNextListDepth:()=>nc,handleBackspace:()=>Wl,handleDelete:()=>Ul,hasListBefore:()=>p0,hasListItemAfter:()=>qN,hasListItemBefore:()=>h0,listItemHasSubList:()=>f0,nextListIsDeeper:()=>m0,nextListIsHigher:()=>g0});var qs=(t,e)=>{const{$from:r}=e.selection,n=Ce(t,e.schema);let s=null,o=r.depth,i=r.pos,a=null;for(;o>0&&a===null;)s=r.node(o),s.type===n?a=o:(o-=1,i-=1);return a===null?null:{$pos:e.doc.resolve(i),depth:a}},nc=(t,e)=>{const r=qs(t,e);if(!r)return!1;const[,n]=uF(e,t,r.$pos.pos+4);return n},p0=(t,e,r)=>{const{$anchor:n}=t.selection,s=Math.max(0,n.pos-2),o=t.doc.resolve(s).node();return!(!o||!r.includes(o.type.name))},h0=(t,e)=>{var r;const{$anchor:n}=e.selection,s=e.doc.resolve(n.pos-2);return!(s.index()===0||((r=s.nodeBefore)==null?void 0:r.type.name)!==t)},f0=(t,e,r)=>{if(!r)return!1;const n=Ce(t,e.schema);let s=!1;return r.descendants(o=>{o.type===n&&(s=!0)}),s},Wl=(t,e,r)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Cr(t.state,e)&&p0(t.state,e,r)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((m,g)=>{m.type.name===e&&c.push({node:m,pos:g})});const d=c.at(-1);if(!d)return!1;const f=t.state.doc.resolve(l.start()+d.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Cr(t.state,e)||!hF(t.state))return!1;const n=qs(e,t.state);if(!n)return!1;const o=t.state.doc.resolve(n.$pos.pos-2).node(n.depth),i=f0(e,t.state,o);return h0(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},m0=(t,e)=>{const r=nc(t,e),n=qs(t,e);return!n||!r?!1:r>n.depth},g0=(t,e)=>{const r=nc(t,e),n=qs(t,e);return!n||!r?!1:r<n.depth},Ul=(t,e)=>{if(!Cr(t.state,e)||!pF(t.state,e))return!1;const{selection:r}=t.state,{$from:n,$to:s}=r;return!r.empty&&n.sameParent(s)?!1:m0(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():g0(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},qN=(t,e)=>{var r;const{$anchor:n}=e.selection,s=e.doc.resolve(n.pos-n.parentOffset-2);return!(s.index()===s.parent.childCount-1||((r=s.nodeAfter)==null?void 0:r.type.name)!==t)},b0=de.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r})=>{t.state.schema.nodes[r]!==void 0&&Ul(t,r)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r})=>{t.state.schema.nodes[r]!==void 0&&Ul(t,r)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{t.state.schema.nodes[r]!==void 0&&Wl(t,r,n)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{t.state.schema.nodes[r]!==void 0&&Wl(t,r,n)&&(e=!0)}),e}}}}),wh=/^(\s*)(\d+)\.\s+(.*)$/,WN=/^\s/;function UN(t){const e=[];let r=0,n=0;for(;r<t.length;){const s=t[r],o=s.match(wh);if(!o)break;const[,i,a,l]=o,c=i.length;let d=l,f=r+1;const m=[s];for(;f<t.length;){const g=t[f];if(g.match(wh))break;if(g.trim()==="")m.push(g),d+=`
222
- `,f+=1;else if(g.match(WN))m.push(g),d+=`
208
+ `):""}),qN=it.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},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]}`,xe(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var r;const n=(r=t.attrs)!=null&&r.level?parseInt(t.attrs.level,10):1,s="#".repeat(n);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},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=>_l({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),WN=it.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",xe(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!iA(e,e.schema.nodes[this.name]))return!1;const{selection:r}=e,{$to:n}=r,s=t();return Lg(r)?s.insertContentAt(n.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:o,tr:i,dispatch:a})=>{if(a){const{$to:l}=i.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(X.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(G.create(i.doc,l.pos)):i.setSelection(X.create(i.doc,l.pos));else{const d=o.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,f=d?.create();f&&(i.insert(c,f),i.setSelection(X.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[oA({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),UN=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,KN=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,JN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,YN=Nr.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",xe(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)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[On({find:UN,type:this.type}),On({find:JN,type:this.type})]},addPasteRules(){return[nn({find:KN,type:this.type}),nn({find:GN,type:this.type})]}}),ZN=Object.defineProperty,XN=(t,e)=>{for(var r in e)ZN(t,r,{get:e[r],enumerable:!0})},QN="listItem",Ch="textStyle",kh=/^\s*([-+*])\s$/,f0=it.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",xe(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
209
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QN,this.editor.getAttributes(Ch)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ln({find:kh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ln({find:kh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ch),editor:this.editor})),[t]}}),m0=it.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",xe(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let r=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))r=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(r=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const i=t.tokens.slice(1),a=e.parseChildren(i);r.push(...a)}}else r=e.parseChildren(t.tokens)}return r.length===0&&(r=[{type:"paragraph",content:[]}]),{type:"listItem",content:r}},renderMarkdown:(t,e,r)=>Yu(t,e,n=>n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${n.index+1}. `:"- ",r),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),eT={};XN(eT,{findListItemPos:()=>Ws,getNextListDepth:()=>ac,handleBackspace:()=>Kl,handleDelete:()=>Jl,hasListBefore:()=>g0,hasListItemAfter:()=>tT,hasListItemBefore:()=>b0,listItemHasSubList:()=>y0,nextListIsDeeper:()=>x0,nextListIsHigher:()=>v0});var Ws=(t,e)=>{const{$from:r}=e.selection,n=ke(t,e.schema);let s=null,o=r.depth,i=r.pos,a=null;for(;o>0&&a===null;)s=r.node(o),s.type===n?a=o:(o-=1,i-=1);return a===null?null:{$pos:e.doc.resolve(i),depth:a}},ac=(t,e)=>{const r=Ws(t,e);if(!r)return!1;const[,n]=vF(e,t,r.$pos.pos+4);return n},g0=(t,e,r)=>{const{$anchor:n}=t.selection,s=Math.max(0,n.pos-2),o=t.doc.resolve(s).node();return!(!o||!r.includes(o.type.name))},b0=(t,e)=>{var r;const{$anchor:n}=e.selection,s=e.doc.resolve(n.pos-2);return!(s.index()===0||((r=s.nodeBefore)==null?void 0:r.type.name)!==t)},y0=(t,e,r)=>{if(!r)return!1;const n=ke(t,e.schema);let s=!1;return r.descendants(o=>{o.type===n&&(s=!0)}),s},Kl=(t,e,r)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!kr(t.state,e)&&g0(t.state,e,r)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((m,g)=>{m.type.name===e&&c.push({node:m,pos:g})});const d=c.at(-1);if(!d)return!1;const f=t.state.doc.resolve(l.start()+d.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!kr(t.state,e)||!kF(t.state))return!1;const n=Ws(e,t.state);if(!n)return!1;const o=t.state.doc.resolve(n.$pos.pos-2).node(n.depth),i=y0(e,t.state,o);return b0(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},x0=(t,e)=>{const r=ac(t,e),n=Ws(t,e);return!n||!r?!1:r>n.depth},v0=(t,e)=>{const r=ac(t,e),n=Ws(t,e);return!n||!r?!1:r<n.depth},Jl=(t,e)=>{if(!kr(t.state,e)||!CF(t.state,e))return!1;const{selection:r}=t.state,{$from:n,$to:s}=r;return!r.empty&&n.sameParent(s)?!1:x0(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():v0(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},tT=(t,e)=>{var r;const{$anchor:n}=e.selection,s=e.doc.resolve(n.pos-n.parentOffset-2);return!(s.index()===s.parent.childCount-1||((r=s.nodeAfter)==null?void 0:r.type.name)!==t)},w0=de.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r})=>{t.state.schema.nodes[r]!==void 0&&Jl(t,r)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r})=>{t.state.schema.nodes[r]!==void 0&&Jl(t,r)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{t.state.schema.nodes[r]!==void 0&&Kl(t,r,n)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:r,wrapperNames:n})=>{t.state.schema.nodes[r]!==void 0&&Kl(t,r,n)&&(e=!0)}),e}}}}),Eh=/^(\s*)(\d+)\.\s+(.*)$/,rT=/^\s/;function nT(t){const e=[];let r=0,n=0;for(;r<t.length;){const s=t[r],o=s.match(Eh);if(!o)break;const[,i,a,l]=o,c=i.length;let d=l,f=r+1;const m=[s];for(;f<t.length;){const g=t[f];if(g.match(Eh))break;if(g.trim()==="")m.push(g),d+=`
210
+ `,f+=1;else if(g.match(rT))m.push(g),d+=`
223
211
  ${g.slice(c+2)}`,f+=1;else break}e.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:m.join(`
224
- `)}),n=f,r=f}return[e,n]}function y0(t,e,r){var n;const s=[];let o=0;for(;o<t.length;){const i=t[o];if(i.indent===e){const a=i.content.split(`
212
+ `)}),n=f,r=f}return[e,n]}function D0(t,e,r){var n;const s=[];let o=0;for(;o<t.length;){const i=t[o];if(i.indent===e){const a=i.content.split(`
225
213
  `),l=((n=a[0])==null?void 0:n.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:r.inlineTokens(l)});const d=a.slice(1).join(`
226
- `).trim();if(d){const g=r.blockTokens(d);c.push(...g)}let f=o+1;const m=[];for(;f<t.length&&t[f].indent>e;)m.push(t[f]),f+=1;if(m.length>0){const g=Math.min(...m.map(v=>v.indent)),y=y0(m,g,r);c.push({type:"list",ordered:!0,start:m[0].number,items:y,raw:m.map(v=>v.raw).join(`
227
- `)})}s.push({type:"list_item",raw:i.raw,tokens:c}),o=f}else o+=1}return s}function JN(t,e){return t.map(r=>{if(r.type!=="list_item")return e.parseChildren([r])[0];const n=[];return r.tokens&&r.tokens.length>0&&r.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")n.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const o=e.parseChildren([s]);n.push({type:"paragraph",content:o})}else{const o=e.parseChildren([s]);o.length>0&&n.push(...o)}}),{type:"listItem",content:n}})}var KN="listItem",Dh="textStyle",Ch=/^(\d+)\.\s$/,x0=ot.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...r}=t;return e===1?["ol",ye(this.options.HTMLAttributes,r),0]:["ol",ye(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const r=t.start||1,n=t.items?JN(t.items,e):[];return r!==1?{type:"orderedList",attrs:{start:r},content:n}:{type:"orderedList",content:n}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
214
+ `).trim();if(d){const g=r.blockTokens(d);c.push(...g)}let f=o+1;const m=[];for(;f<t.length&&t[f].indent>e;)m.push(t[f]),f+=1;if(m.length>0){const g=Math.min(...m.map(x=>x.indent)),y=D0(m,g,r);c.push({type:"list",ordered:!0,start:m[0].number,items:y,raw:m.map(x=>x.raw).join(`
215
+ `)})}s.push({type:"list_item",raw:i.raw,tokens:c}),o=f}else o+=1}return s}function sT(t,e){return t.map(r=>{if(r.type!=="list_item")return e.parseChildren([r])[0];const n=[];return r.tokens&&r.tokens.length>0&&r.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")n.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const o=e.parseChildren([s]);n.push({type:"paragraph",content:o})}else{const o=e.parseChildren([s]);o.length>0&&n.push(...o)}}),{type:"listItem",content:n}})}var oT="listItem",Sh="textStyle",Fh=/^(\d+)\.\s$/,C0=it.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...r}=t;return e===1?["ol",xe(this.options.HTMLAttributes,r),0]:["ol",xe(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const r=t.start||1,n=t.items?sT(t.items,e):[];return r!==1?{type:"orderedList",attrs:{start:r},content:n}:{type:"orderedList",content:n}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
228
216
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),r=e?.index;return r!==void 0?r:-1},tokenize:(t,e,r)=>{var n;const s=t.split(`
229
- `),[o,i]=UN(s);if(o.length===0)return;const a=y0(o,0,r);return a.length===0?void 0:{type:"list",ordered:!0,start:((n=o[0])==null?void 0:n.number)||1,items:a,raw:s.slice(0,i).join(`
230
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(KN,this.editor.getAttributes(Dh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=On({find:Ch,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,r)=>r.childCount+r.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=On({find:Ch,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Dh)}),joinPredicate:(e,r)=>r.childCount+r.attrs.start===+e[1],editor:this.editor})),[t]}}),GN=/^\s*(\[([( |x])?\])\s$/,YN=ot.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ye(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const r=[];if(t.tokens&&t.tokens.length>0?r.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?r.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):r.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const n=e.parseChildren(t.nestedTokens);r.push(...n)}return e.createNode("taskItem",{checked:t.checked||!1},r)},renderMarkdown:(t,e)=>{var r;const s=`- [${(r=t.attrs)!=null&&r.checked?"x":" "}] `;return Uu(t,e,s)},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:r,editor:n})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var f,m;a.ariaLabel=((m=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:m.call(f,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(t),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=d.target;n.isEditable&&typeof r=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const g=r();if(typeof g!="number")return!1;const y=m.doc.nodeAt(g);return m.setNodeMarkup(g,void 0,{...y?.attrs,checked:f}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,o.append(a,i),s.append(o,l),Object.entries(e).forEach(([d,f])=>{s.setAttribute(d,f)}),{dom:s,contentDOM:l,update:d=>d.type!==this.type?!1:(s.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[On({find:GN,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),XN=ot.create({name:"taskList",addOptions(){return{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",ye(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
231
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const r=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return r!==void 0?r:-1},tokenize(t,e,r){const n=o=>{const i=Ll(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:r.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:n},r);return i?[{type:"taskList",raw:i.raw,items:i.items}]:r.blockTokens(o)},s=Ll(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:r.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:n},r);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});de.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(c0.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(d0.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(b0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(x0.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(YN.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(XN.configure(this.options.taskList)),t}});var QN=ot.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ye(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const r=t.tokens||[];return r.length===1&&r[0].type==="image"?e.parseChildren([r[0]]):e.createNode("paragraph",void 0,e.parseInline(r))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ZN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,eT=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,tT=Ar.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ye(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,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[jn({find:ZN,type:this.type})]},addPasteRules(){return[rn({find:eT,type:this.type})]}}),rT=ot.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),nT=Ar.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",ye(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,r){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:r.inlineTokens(o)}}},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()}}});function sT(t={}){return new be({view(e){return new oT(e,t)}})}class oT{constructor(e,r){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=r.width)!==null&&n!==void 0?n:1,this.color=r.color===!1?void 0:r.color||"black",this.class=r.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:r})=>this.editorView.dom.removeEventListener(e,r))}update(e,r){this.cursorPos!=null&&r.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),r=!e.parent.inlineContent,n,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,a=o.height/s.offsetHeight;if(r){let f=e.nodeBefore,m=e.nodeAfter;if(f||m){let g=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(g){let y=g.getBoundingClientRect(),v=f?y.bottom:y.top;f&&m&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let w=this.width/2*a;n={left:y.left,right:y.right,top:v-w,bottom:v+w}}}}if(!n){let f=this.editorView.coordsAtPos(this.cursorPos),m=this.width/2*i;n={left:f.left-m,right:f.left+m,top:f.top,bottom:f.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let f=l.getBoundingClientRect(),m=f.width/l.offsetWidth,g=f.height/l.offsetHeight;c=f.left-l.scrollLeft*m,d=f.top-l.scrollTop*g}this.element.style.left=(n.left-c)/i+"px",this.element.style.top=(n.top-d)/a+"px",this.element.style.width=(n.right-n.left)/i+"px",this.element.style.height=(n.bottom-n.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let r=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=r&&r.inside>=0&&this.editorView.state.doc.nodeAt(r.inside),s=n&&n.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,r,e):s;if(r&&!o){let i=r.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=mm(this.editorView.state.doc,i,this.editorView.dragging.slice);a!=null&&(i=a)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ge extends re{constructor(e){super(e,e)}map(e,r){let n=e.resolve(r.map(this.head));return ge.valid(n)?new ge(n):re.near(n)}content(){return H.empty}eq(e){return e instanceof ge&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ge(e.resolve(r.pos))}getBookmark(){return new sc(this.anchor)}static valid(e){let r=e.parent;if(r.isTextblock||!iT(e)||!aT(e))return!1;let n=r.type.spec.allowGapCursor;if(n!=null)return n;let s=r.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,r,n=!1){e:for(;;){if(!n&&ge.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let a=e.node(i);if(r>0?e.indexAfter(i)<a.childCount:e.index(i)>0){o=a.child(r>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=r;let l=e.doc.resolve(s);if(ge.valid(l))return l}for(;;){let i=r>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Y.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*r),n=!1;continue e}break}o=i,s+=r;let a=e.doc.resolve(s);if(ge.valid(a))return a}return null}}}ge.prototype.visible=!1;ge.findFrom=ge.findGapCursorFrom;re.jsonID("gapcursor",ge);class sc{constructor(e){this.pos=e}map(e){return new sc(e.map(this.pos))}resolve(e){let r=e.resolve(this.pos);return ge.valid(r)?new ge(r):re.near(r)}}function v0(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function iT(t){for(let e=t.depth;e>=0;e--){let r=t.index(e),n=t.node(e);if(r==0){if(n.type.spec.isolating)return!0;continue}for(let s=n.child(r-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||v0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function aT(t){for(let e=t.depth;e>=0;e--){let r=t.indexAfter(e),n=t.node(e);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let s=n.child(r);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||v0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function lT(){return new be({props:{decorations:pT,createSelectionBetween(t,e,r){return e.pos==r.pos&&ge.valid(r)?new ge(r):null},handleClick:cT,handleKeyDown:uT,handleDOMEvents:{beforeinput:dT}}})}const uT=mg({ArrowLeft:Fo("horiz",-1),ArrowRight:Fo("horiz",1),ArrowUp:Fo("vert",-1),ArrowDown:Fo("vert",1)});function Fo(t,e){const r=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,s,o){let i=n.selection,a=e>0?i.$to:i.$from,l=i.empty;if(i instanceof X){if(!o.endOfTextblock(r)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let c=ge.findGapCursorFrom(a,e,l);return c?(s&&s(n.tr.setSelection(new ge(c))),!0):!1}}function cT(t,e,r){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!ge.valid(n))return!1;let s=t.posAtCoords({left:r.clientX,top:r.clientY});return s&&s.inside>-1&&Y.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ge(n))),!0)}function dT(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ge))return!1;let{$from:r}=t.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let s=L.empty;for(let i=n.length-1;i>=0;i--)s=L.from(n[i].createAndFill(null,s));let o=t.state.tr.replace(r.pos,r.pos,new H(s,0,0));return o.setSelection(X.near(o.doc.resolve(r.pos+1))),t.dispatch(o),!1}function pT(t){if(!(t.selection instanceof ge))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",fe.create(t.doc,[Je.widget(t.selection.head,e,{key:"gapcursor"})])}var ki=200,Me=function(){};Me.prototype.append=function(e){return e.length?(e=Me.from(e),!this.length&&e||e.length<ki&&this.leafAppend(e)||this.length<ki&&e.leafPrepend(this)||this.appendInner(e)):this};Me.prototype.prepend=function(e){return e.length?Me.from(e).append(this):this};Me.prototype.appendInner=function(e){return new hT(this,e)};Me.prototype.slice=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=this.length),e>=r?Me.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,r))};Me.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Me.prototype.forEach=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length),r<=n?this.forEachInner(e,r,n,0):this.forEachInvertedInner(e,r,n,0)};Me.prototype.map=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},r,n),s};Me.from=function(e){return e instanceof Me?e:e&&e.length?new w0(e):Me.empty};var w0=function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,a){for(var l=o;l<i;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,a){for(var l=o-1;l>=i;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=ki)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=ki)return new e(s.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(e.prototype,r),e}(Me);Me.empty=new w0([]);var hT=function(t){function e(r,n){t.call(this),this.left=r,this.right=n,this.length=r.length+n.length,this.depth=Math.max(r.depth,n.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(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,s,o,i){var a=this.left.length;if(s<a&&this.left.forEachInner(n,s,Math.min(o,a),i)===!1||o>a&&this.right.forEachInner(n,Math.max(s-a,0),Math.min(this.length,o)-a,i+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,s,o,i){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(n,s-a,Math.max(o,a)-a,i+a)===!1||o<a&&this.left.forEachInvertedInner(n,Math.min(s,a),o,i)===!1)return!1},e.prototype.sliceInner=function(n,s){if(n==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(n,s):n>=o?this.right.slice(n-o,s-o):this.left.slice(n,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(n){var s=this.right.leafAppend(n);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(n){var s=this.left.leafPrepend(n);if(s)return new e(s,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(Me);const fT=500;class wt{constructor(e,r){this.items=e,this.eventCount=r}popEvent(e,r){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let s,o;r&&(s=this.remapping(n,this.items.length),o=s.maps.length);let i=e.tr,a,l,c=[],d=[];return this.items.forEach((f,m)=>{if(!f.step){s||(s=this.remapping(n,m+1),o=s.maps.length),o--,d.push(f);return}if(s){d.push(new Nt(f.map));let g=f.step.map(s.slice(o)),y;g&&i.maybeStep(g).doc&&(y=i.mapping.maps[i.mapping.maps.length-1],c.push(new Nt(y,void 0,void 0,c.length+d.length))),o--,y&&s.appendMap(y,o)}else i.maybeStep(f.step);if(f.selection)return a=s?f.selection.map(s.slice(o)):f.selection,l=new wt(this.items.slice(0,n).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:i,selection:a}}addTransform(e,r,n,s){let o=[],i=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),m=new Nt(e.mapping.maps[d],f,r),g;(g=l&&l.merge(m))&&(m=g,d?o.pop():a=a.slice(0,a.length-1)),o.push(m),r&&(i++,r=void 0),s||(l=m)}let c=i-n.depth;return c>gT&&(a=mT(a,c),i-=c),new wt(a.append(o),i)}remapping(e,r){let n=new Ns;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?n.maps.length-s.mirrorOffset:void 0;n.appendMap(s.map,i)},e,r),n}addMaps(e){return this.eventCount==0?this:new wt(this.items.append(e.map(r=>new Nt(r))),this.eventCount)}rebased(e,r){if(!this.eventCount)return this;let n=[],s=Math.max(0,this.items.length-r),o=e.mapping,i=e.steps.length,a=this.eventCount;this.items.forEach(m=>{m.selection&&a--},s);let l=r;this.items.forEach(m=>{let g=o.getMirror(--l);if(g==null)return;i=Math.min(i,g);let y=o.maps[g];if(m.step){let v=e.steps[g].invert(e.docs[g]),w=m.selection&&m.selection.map(o.slice(l+1,g));w&&a++,n.push(new Nt(y,v,w))}else n.push(new Nt(y))},s);let c=[];for(let m=r;m<i;m++)c.push(new Nt(o.maps[m]));let d=this.items.slice(0,s).append(c).append(n),f=new wt(d,a);return f.emptyItemCount()>fT&&(f=f.compress(this.items.length-n.length)),f}emptyItemCount(){let e=0;return this.items.forEach(r=>{r.step||e++}),e}compress(e=this.items.length){let r=this.remapping(0,e),n=r.maps.length,s=[],o=0;return this.items.forEach((i,a)=>{if(a>=e)s.push(i),i.selection&&o++;else if(i.step){let l=i.step.map(r.slice(n)),c=l&&l.getMap();if(n--,c&&r.appendMap(c,n),l){let d=i.selection&&i.selection.map(r.slice(n));d&&o++;let f=new Nt(c.invert(),l,d),m,g=s.length-1;(m=s.length&&s[g].merge(f))?s[g]=m:s.push(f)}}else i.map&&n--},this.items.length,0),new wt(Me.from(s.reverse()),o)}}wt.empty=new wt(Me.empty,0);function mT(t,e){let r;return t.forEach((n,s)=>{if(n.selection&&e--==0)return r=s,!1}),t.slice(r)}class Nt{constructor(e,r,n,s){this.map=e,this.step=r,this.selection=n,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let r=e.step.merge(this.step);if(r)return new Nt(r.getMap().invert(),r,this.selection)}}}class cr{constructor(e,r,n,s,o){this.done=e,this.undone=r,this.prevRanges=n,this.prevTime=s,this.prevComposition=o}}const gT=20;function bT(t,e,r,n){let s=r.getMeta(Yr),o;if(s)return s.historyState;r.getMeta(vT)&&(t=new cr(t.done,t.undone,null,0,-1));let i=r.getMeta("appendedTransaction");if(r.steps.length==0)return t;if(i&&i.getMeta(Yr))return i.getMeta(Yr).redo?new cr(t.done.addTransform(r,void 0,n,Lo(e)),t.undone,kh(r.mapping.maps),t.prevTime,t.prevComposition):new cr(t.done,t.undone.addTransform(r,void 0,n,Lo(e)),null,t.prevTime,t.prevComposition);if(r.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let a=r.getMeta("composition"),l=t.prevTime==0||!i&&t.prevComposition!=a&&(t.prevTime<(r.time||0)-n.newGroupDelay||!yT(r,t.prevRanges)),c=i?rl(t.prevRanges,r.mapping):kh(r.mapping.maps);return new cr(t.done.addTransform(r,l?e.selection.getBookmark():void 0,n,Lo(e)),wt.empty,c,r.time,a??t.prevComposition)}else return(o=r.getMeta("rebased"))?new cr(t.done.rebased(r,o),t.undone.rebased(r,o),rl(t.prevRanges,r.mapping),t.prevTime,t.prevComposition):new cr(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),rl(t.prevRanges,r.mapping),t.prevTime,t.prevComposition)}function yT(t,e){if(!e)return!1;if(!t.docChanged)return!0;let r=!1;return t.mapping.maps[0].forEach((n,s)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&s>=e[o]&&(r=!0)}),r}function kh(t){let e=[];for(let r=t.length-1;r>=0&&e.length==0;r--)t[r].forEach((n,s,o,i)=>e.push(o,i));return e}function rl(t,e){if(!t)return null;let r=[];for(let n=0;n<t.length;n+=2){let s=e.map(t[n],1),o=e.map(t[n+1],-1);s<=o&&r.push(s,o)}return r}function xT(t,e,r){let n=Lo(e),s=Yr.get(e).spec.config,o=(r?t.undone:t.done).popEvent(e,n);if(!o)return null;let i=o.selection.resolve(o.transform.doc),a=(r?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),s,n),l=new cr(r?a:o.remaining,r?o.remaining:a,null,0,-1);return o.transform.setSelection(i).setMeta(Yr,{redo:r,historyState:l})}let nl=!1,Eh=null;function Lo(t){let e=t.plugins;if(Eh!=e){nl=!1,Eh=e;for(let r=0;r<e.length;r++)if(e[r].spec.historyPreserveItems){nl=!0;break}}return nl}const Yr=new je("history"),vT=new je("closeHistory");function wT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new be({key:Yr,state:{init(){return new cr(wt.empty,wt.empty,null,0,-1)},apply(e,r,n){return bT(r,n,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,r){let n=r.inputType,s=n=="historyUndo"?C0:n=="historyRedo"?k0:null;return s?(r.preventDefault(),s(e.state,e.dispatch)):!1}}}})}function D0(t,e){return(r,n)=>{let s=Yr.getState(r);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(n){let o=xT(s,r,t);o&&n(e?o.scrollIntoView():o)}return!0}}const C0=D0(!1,!0),k0=D0(!0,!0);de.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,r=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(r)}},addProseMirrorPlugins(){let t=!1;return[new be({key:new je("characterCount"),appendTransaction:(e,r,n)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const o=this.storage.characters({node:n.doc});if(o>s){const i=o-s,a=0,l=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=n.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,r)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const s=this.storage.characters({node:r.doc}),o=this.storage.characters({node:e.doc});if(o<=n||s>n&&o>n&&o<=s)return!0;if(s>n&&o>n&&o>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=o-n,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>n)}})]}});var DT=de.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[sT(this.options)]}});de.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new be({key:new je("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:r,isFocused:n}=this.editor,{anchor:s}=e,o=[];if(!r||!n)return fe.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;i+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&i-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(Je.node(c,c+l.nodeSize,{class:this.options.className}))}),fe.create(t,o)}}})]}});var CT=de.create({name:"gapCursor",addProseMirrorPlugins(){return[lT()]},extendNodeSchema(t){var e;const r={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=le(G(t,"allowGapCursor",r)))!=null?e:null}}});de.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new be({key:new je("placeholder"),props:{decorations:({doc:t,selection:e})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,s=[];if(!r)return null;const o=this.editor.isEmpty;return t.descendants((i,a)=>{const l=n>=a&&n<=a+i.nodeSize,c=!i.isLeaf&&Ui(i);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const f=Je.node(a,a+i.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:a,hasAnchor:l}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),fe.create(t,s)}}})]}});de.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new be({key:new je("selection"),props:{decorations(r){return r.selection.empty||t.isFocused||!t.isEditable||Mg(r.selection)||t.view.dragging?null:fe.create(r.doc,[Je.inline(r.selection.from,r.selection.to,{class:e.className})])}}})]}});function Sh({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var kT=de.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new je(this.name),r=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(r).includes(s.name));return[new be({key:e,appendTransaction:(s,o,i)=>{const{doc:a,tr:l,schema:c}=i,d=e.getState(i),f=a.content.size,m=c.nodes[r];if(d)return l.insert(f,m.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!Sh({node:i,types:n})},apply:(s,o)=>{if(!s.docChanged)return o;const i=s.doc.lastChild;return!Sh({node:i,types:n})}}})]}}),ET=de.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>C0(t,e),redo:()=>({state:t,dispatch:e})=>k0(t,e)}},addProseMirrorPlugins(){return[wT(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()}}}),ST=de.create({name:"starterKit",addExtensions(){var t,e,r,n;const s=[];return this.options.bold!==!1&&s.push(EN.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(vN.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(c0.configure(this.options.bulletList)),this.options.code!==!1&&s.push(AN.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(MN.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(BN.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(DT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(CT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Ug.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(jN.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(ET.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(ON.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(PN.configure(this.options.italic)),this.options.listItem!==!1&&s.push(d0.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(b0.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(r0.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(x0.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(QN.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(tT.configure(this.options.strike)),this.options.text!==!1&&s.push(rT.configure(this.options.text)),this.options.underline!==!1&&s.push(nT.configure((r=this.options)==null?void 0:r.underline)),this.options.trailingNode!==!1&&s.push(kT.configure((n=this.options)==null?void 0:n.trailingNode)),s}}),FT=ST;const AT=[IA,FT,nA.extend({addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.setHardBreak()}}}),AA.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https",protocols:["http","https"],isAllowedUri:(t,e)=>{try{const r=t.includes(":")?new URL(t):new URL(`${e.defaultProtocol}://${t}`);if(!e.defaultValidate(r.href))return!1;const n=["ftp","file","mailto"],s=r.protocol.replace(":","");if(n.includes(s)||!e.protocols.map(l=>typeof l=="string"?l:l.scheme).includes(s))return!1;const i=[""],a=r.hostname;return!i.includes(a)}catch{return!1}},shouldAutoLink:t=>{try{const e=t.includes(":")?new URL(t):new URL(`https://${t}`),r=[""],n=e.hostname;return!r.includes(n)}catch{return!1}}})];function Le({children:t,onClick:e,disabled:r=!1,isActive:n}){return h.jsx("button",{onClick:e,disabled:r,className:`w-[26px] h-[26px] p-1 rounded-md border border-[#170F4F] transition-colors duration-200 flex items-center justify-center hover:bg-gray-200 disabled:opacity-40 ${n?"bg-[#170F4F] text-white hover:bg-[#170F4F]":""}`,children:t})}function NT({editor:t}){const e=S.useCallback(()=>{const s=t.getAttributes("link").href,o=window.prompt("Please put a valid URL",s);if(o!==null){if(o===""){t.chain().focus().extendMarkRange("link").unsetLink().run();return}try{t.chain().focus().extendMarkRange("link").setLink({href:o}).run()}catch(i){alert(i.message)}}},[t]),r=S.useCallback(In(s=>{t.chain().focus().setColor(s).run()},300),[t]),n=l0({editor:t,selector:({editor:s})=>s?{color:s.getAttributes("textStyle")?.color??null,isBold:s.isActive("bold"),canBold:s.can().chain().toggleBold().run(),isItalic:s.isActive("italic"),canItalic:s.can().chain().toggleItalic().run(),isStrike:s.isActive("strike"),canStrike:s.can().chain().toggleStrike().run(),isUnderline:s.isActive("underline"),canUnderline:s.can().chain().toggleUnderline().run(),canClearMarks:s.can().chain().unsetAllMarks().run(),isParagraph:s.isActive("paragraph"),isHeading1:s.isActive("heading",{level:1}),isHeading2:s.isActive("heading",{level:2}),isHeading3:s.isActive("heading",{level:3}),isHeading4:s.isActive("heading",{level:4}),isHeading5:s.isActive("heading",{level:5}),isHeading6:s.isActive("heading",{level:6}),isBulletList:s.isActive("bulletList"),isOrderedList:s.isActive("orderedList"),canUndo:s.can().chain().undo().run(),canRedo:s.can().chain().redo().run(),isLink:s.isActive("link")}:{color:null,isBold:!1,canBold:!1,isItalic:!1,canItalic:!1,isStrike:!1,canStrike:!1,isUnderline:!1,canUnderline:!1,canClearMarks:!1,isParagraph:!1,isHeading1:!1,isHeading2:!1,isHeading3:!1,isHeading4:!1,isHeading5:!1,isHeading6:!1,isBulletList:!1,isOrderedList:!1,canUndo:!1,canRedo:!1,isLink:!1}});return h.jsx("div",{className:"control-group",children:h.jsxs("div",{className:"mb-[8px] flex flex-wrap gap-1 border border-[#e8e7ee] p-[2px]",children:[h.jsx(Le,{onClick:()=>t.chain().focus().toggleBold().run(),disabled:!n.canBold,isActive:n.isBold,children:h.jsx(lt.BiBold,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleItalic().run(),disabled:!n.canItalic,isActive:n.isItalic,children:h.jsx(lt.BiItalic,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleUnderline().run(),disabled:!n.canUnderline,isActive:n.isUnderline,children:h.jsx(lt.BiUnderline,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleStrike().run(),disabled:!n.canStrike,isActive:n.isStrike,children:h.jsx(lt.BiStrikethrough,{size:16})}),h.jsx(Le,{onClick:n.isLink?()=>t.chain().focus().unsetLink().run():()=>e(),isActive:n.isLink,children:n.isLink?h.jsx(lt.BiUnlink,{size:16}):h.jsx(lt.BiLink,{size:16})}),h.jsx("input",{type:"color",onInput:s=>r(s.currentTarget.value),className:"h-[26px] w-[26px]",value:n.color}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:n.isBulletList,children:h.jsx(lt.BiListUl,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:n.isOrderedList,children:h.jsx(lt.BiListOl,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().setHardBreak().run(),children:h.jsx(_.FiCornerDownLeft,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),isActive:n.isHeading1,children:h.jsx(jr.TbH1,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),isActive:n.isHeading2,children:h.jsx(jr.TbH2,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),isActive:n.isHeading3,children:h.jsx(jr.TbH3,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleHeading({level:4}).run(),isActive:n.isHeading4,children:h.jsx(jr.TbH4,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleHeading({level:5}).run(),isActive:n.isHeading5,children:h.jsx(jr.TbH5,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().toggleHeading({level:6}).run(),isActive:n.isHeading6,children:h.jsx(jr.TbH6,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().unsetAllMarks().run(),children:h.jsx(jr.TbClearFormatting,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().undo().run(),disabled:!n.canUndo,children:h.jsx(lt.BiUndo,{size:16})}),h.jsx(Le,{onClick:()=>t.chain().focus().redo().run(),disabled:!n.canRedo,children:h.jsx(lt.BiRedo,{size:16})})]})})}function TT({handleChange:t,text:e}){const r=mN({extensions:AT,content:e,onUpdate:({editor:n})=>{let s=n.getHTML();s=s.replace(/<p><\/p>/g,""),t(s)}});return h.jsxs("div",{children:[h.jsx(NT,{editor:r}),h.jsx(uN,{editor:r,className:"tiptap-global"})]})}function MT(){const{actions:{setProp:t},text:e}=Q.useNode(n=>({text:n.data.props.children})),r=n=>{t(s=>s.children=n)};return h.jsx("div",{className:"space-y-4 p-4",children:h.jsx(TT,{handleChange:r,text:e})})}function E0(){const{actions:{setProp:t},style:{backgroundColor:e}={}}=Q.useNode(n=>({style:n.data.props.style||{}})),r=S.useMemo(()=>In(n=>{t(s=>{s.style.backgroundColor=n})},300),[t]);return h.jsx(_n,{title:"Background",icon:h.jsx(_.FiEdit3,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:e,onChange:n=>r(n.target.value),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:e,onChange:n=>t(s=>s.style.backgroundColor=n.target.value),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})})}function S0(){const{actions:{setProp:t},style:{borderStyle:e,borderRadius:r,borderColor:n,borderWidth:s}={}}=Q.useNode(i=>({style:i.data.props.style||{}})),o=S.useMemo(()=>In(i=>{t(a=>{a.style.borderColor=i})},300),[t]);return h.jsx(_n,{title:"Border",icon:h.jsx(_.FiSquare,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Radius"}),h.jsx("div",{className:"grid grid-cols-4 gap-1",children:[{value:"",label:"0"},{value:"4px",label:"4px"},{value:"8px",label:"8px"},{value:"9999px",label:"1/2"}].map(i=>h.jsx("button",{onClick:()=>t(a=>a.style.borderRadius=i.value),className:`border border-[#E8E7EE] px-2 py-2 text-xs transition-all ${r===i.value?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:i.label},i.value))})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Width"}),h.jsx("div",{className:"grid grid-cols-4 gap-1",children:[{value:"0px",label:"0"},{value:"1px",label:"1px"},{value:"2px",label:"2px"},{value:"4px",label:"4px"}].map(i=>h.jsx("button",{onClick:()=>t(a=>a.style.borderWidth=i.value),className:`border border-[#E8E7EE] px-2 py-2 text-xs transition-all ${s===i.value?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:i.label},i.value))})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border type"}),h.jsxs("div",{className:"mb-2 grid grid-cols-2 gap-2",children:[h.jsx("button",{onClick:()=>t(i=>i.style.borderStyle="none"),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="none"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"None"}),h.jsx("button",{onClick:()=>t(i=>i.style.borderStyle="solid"),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="solid"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"Light"}),h.jsx("button",{onClick:()=>t(i=>i.style.borderStyle="dotted"),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="dotted"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"Dotted"}),h.jsx("button",{onClick:()=>t(i=>i.style.borderStyle="dashed"),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="dashed"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"Dashed"})]}),h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Color"}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:n,onChange:i=>o(i.target.value),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:n,onChange:i=>t(a=>a.style.borderColor=i.target.value),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})]})]})})}const vt=S.forwardRef(({value:t,onChange:e,min:r,max:n,defaultUnit:s="px",allowedUnits:o=[],className:i="",...a},l)=>{const[c,d]=S.useState(""),[f,m]=S.useState(!1),g=S.useCallback(A=>{if(typeof A=="number")return{value:A,unit:s,text:`${A}${s}`};if(typeof A=="string"&&A.trim()){const T=A.trim(),j=T.match(/^(-?\d*\.?\d+)(.*)$/);if(!j)return{value:0,unit:s,text:""};const[,B,$]=j,O=parseFloat(B),z=$.trim()||s,I=o.length>0&&!o.includes(z)?s:z;return{value:O,unit:I,text:T}}return{value:0,unit:s,text:""}},[s,o]),y=S.useMemo(()=>{if(!t||typeof t=="string"&&t.trim()==="")return"";const A=g(t);return`${A.value}${A.unit}`},[t,g]),v=S.useCallback(A=>{d(A.target.value)},[]),w=S.useCallback(A=>{if(A.key==="Enter"){A.currentTarget.blur();return}if(A.key==="ArrowUp"||A.key==="ArrowDown"){A.preventDefault();const T=f?c:y;if(!T.trim())return;const j=g(T);if(isNaN(j.value))return;const B=A.shiftKey?10:A.ctrlKey||A.metaKey?.1:1,$=A.key==="ArrowUp"?j.value+B:j.value-B,O=Math.min(n??$,Math.max(r??$,$)),z=`${O}${j.unit}`;d(z),e?.({value:O,unit:j.unit,text:z})}},[f,c,y,g,r,n,e]),D=S.useCallback(()=>{m(!0),!c&&t&&d(typeof t=="string"?t:y)},[c,t,y]),E=S.useCallback(()=>{if(m(!1),!c.trim()){d(""),e?.({value:0,unit:s,text:""});return}const A=g(c),T=Math.min(n??A.value,Math.max(r??A.value,A.value)),j=`${T}${A.unit}`;d(j),e?.({value:T,unit:A.unit,text:j})},[c,e,s,g,r,n]),N=`border border-[#E8E7EE] bg-white text-center text-xs transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F] disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-400 ${i.includes("px-")||i.includes("py-")?"":"px-1 py-0.5"}`;return h.jsx("input",{ref:l,type:"text",value:f?c:y,onChange:v,onFocus:D,onBlur:E,onKeyDown:w,className:`${N} ${i}`.trim(),...a})});vt.displayName="DimensionInput";const Fh={min:0,defaultUnit:"px",allowedUnits:["px","rem","%","vh","vw"],placeholder:"auto",className:"w-20 px-2 py-1 text-xs"};function F0(){const{actions:{setProp:t},style:{columns:e,columnSpacing:r,alignment:n,minHeight:s,width:o,height:i}={}}=Q.useNode(c=>({style:c.data.props.style||{}})),a=()=>{e<6&&t(c=>c.style.columns=e+1)},l=()=>{e>1&&t(c=>c.style.columns=e-1)};return h.jsx(_n,{title:"Layout",icon:h.jsx(_.FiLayout,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Width"}),h.jsx(vt,{value:o,onChange:c=>t(d=>d.style.width=c.text),...Fh})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Height"}),h.jsx(vt,{value:i,onChange:c=>t(d=>d.style.height=c.text),...Fh})]})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-[#A29FB9]",children:"Min Height"}),h.jsxs("span",{className:"bg-[#E8E7EE] px-2 py-1 font-mono text-xs text-[#170F4F]",children:[parseInt(s),"px"]})]}),h.jsx("input",{type:"range",min:"0",max:"400",step:"5",value:parseInt(s),onChange:c=>t(d=>d.style.minHeight=parseInt(c.target.value)),className:"slider-modern h-2 w-full cursor-pointer appearance-none bg-[#E8E7EE]",style:{background:`linear-gradient(to right, #170F4F 0%, #170F4F ${parseInt(s)/400*100}%, #E8E7EE ${parseInt(s)/400*100}%, #E8E7EE 100%)`}})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-[#A29FB9]",children:"Columns"}),h.jsx("span",{className:"bg-[#E8E7EE] px-2 py-1 font-mono text-xs text-[#170F4F]",children:e})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("button",{onClick:l,disabled:e<=1,className:"flex h-8 w-8 items-center justify-center border border-[#E8E7EE] bg-[#E8E7EE] text-[#A29FB9] transition-all hover:border-[#00BAC7] hover:bg-[#CCF1F4] disabled:cursor-not-allowed disabled:opacity-30",children:h.jsx(_.FiMinus,{size:14})}),h.jsx("div",{className:"flex flex-1 justify-center py-1",children:h.jsx("div",{className:"flex gap-1",children:Array.from({length:e},(c,d)=>h.jsx("div",{className:"h-8 w-4 border border-[#170F4F] bg-[#170F4F]"},d))})}),h.jsx("button",{onClick:a,disabled:e>=6,className:"flex h-8 w-8 items-center justify-center border border-[#E8E7EE] bg-[#E8E7EE] text-[#A29FB9] transition-all hover:border-[#00BAC7] hover:bg-[#CCF1F4] disabled:cursor-not-allowed disabled:opacity-30",children:h.jsx(_.FiPlus,{size:14})})]})]}),e>1&&h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-[#A29FB9]",children:"Column Gap"}),h.jsxs("span",{className:"bg-[#E8E7EE] px-2 py-1 font-mono text-xs text-[#170F4F]",children:[r,"px"]})]}),h.jsx("input",{type:"range",min:"0",max:"40",step:"2",value:r,onChange:c=>t(d=>d.style.columnSpacing=parseInt(c.target.value)),className:"slider-modern h-2 w-full cursor-pointer appearance-none bg-[#E8E7EE]",style:{background:`linear-gradient(to right, #170F4F 0%, #170F4F ${r/40*100}%, #E8E7EE ${r/40*100}%, #E8E7EE 100%)`}})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Alignment"}),h.jsx(Mt,{options:[{value:"left",label:"Left"},{value:"center",label:"Center"},{value:"right",label:"Right"}],value:n,onChange:c=>t(d=>d.style.alignment=c),placeholder:"Choose alignment"})]})]})})}function ls(t){if(t!=null){if(typeof t=="number")return t===0?"0":void 0;if(typeof t=="string"){const e=t.trim();return e==="0"?"0":/^-?\d+(\.\d+)?(px|em|rem|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc)$/i.test(e)?e:void 0}}}function Ah(t={},e){const r=ls(t[e]),n=ls(t[`${e}Top`]),s=ls(t[`${e}Right`]),o=ls(t[`${e}Bottom`]),i=ls(t[`${e}Left`]);if(r){const a=r.trim().split(/\s+/);switch(a.length){case 1:return{top:n||a[0],right:s||a[0],bottom:o||a[0],left:i||a[0]};case 2:return{top:n||a[0],right:s||a[1],bottom:o||a[0],left:i||a[1]};case 3:return{top:n||a[0],right:s||a[1],bottom:o||a[2],left:i||a[1]};case 4:return{top:n||a[0],right:s||a[1],bottom:o||a[2],left:i||a[3]}}}return{top:n,right:s,bottom:o,left:i}}const or={min:0,defaultUnit:"px",allowedUnits:["px","rem","%"],placeholder:"none",className:"w-10 px-0.5 py-0.5 text-xs"};function A0(){const{actions:{setProp:t},style:e={}}=Q.useNode(s=>({style:s.data.props.style||{}})),r=S.useMemo(()=>Ah(e,"margin"),[e]),n=S.useMemo(()=>Ah(e,"padding"),[e]);return h.jsx(_n,{title:"Spacing",icon:h.jsx(_.FiMove,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsx("div",{className:"space-y-3",children:h.jsx("div",{children:h.jsxs("div",{className:"relative border border-[#dce7fe] bg-[#F9FAFB] p-2",children:[h.jsx("div",{className:"absolute left-1 top-[-2px] -translate-y-1/2",children:h.jsx("span",{className:"bg-[#F9FAFB] px-1 text-xs text-[#A29FB9]",style:{background:"linear-gradient(to bottom,transparent 0%,transparent 50%, #F9FAFB 50%, #F9FAFB 100%)"},children:"Margin"})}),h.jsx("div",{className:"mb-1 flex justify-center",children:h.jsx(vt,{value:r.top,onChange:s=>t(o=>o.style.marginTop=s.text),...or})}),h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx(vt,{value:r.left,onChange:s=>t(o=>o.style.marginLeft=s.text),...or}),h.jsxs("div",{className:"relative mx-2 my-1 flex-1 border-2 border-dashed border-[#3B82F6] bg-[#EFF6FF] p-2",children:[h.jsx("div",{className:"absolute left-1 top-[-3px] -translate-y-1/2",children:h.jsx("span",{className:"bg-[#EFF6FF] px-1 text-xs text-[#3B82F6]",style:{background:"linear-gradient(to bottom, transparent 0%, transparent 50%, #EFF6FF 50%, #EFF6FF 100%)"},children:"Padding"})}),h.jsx("div",{className:"mb-1 flex justify-center",children:h.jsx(vt,{value:n.top,onChange:s=>t(o=>o.style.paddingTop=s.text),...or})}),h.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[h.jsx(vt,{value:n.left,onChange:s=>t(o=>o.style.paddingLeft=s.text),...or}),h.jsx("div",{className:"mx-2 my-1 flex h-6 flex-1 items-center justify-center border border-[#D1D5DB] bg-white px-2 py-1",children:h.jsx("span",{className:"text-[10px] font-medium text-[#6B7280] opacity-60",children:"Content"})}),h.jsx(vt,{value:n.right,onChange:s=>t(o=>o.style.paddingRight=s.text),...or})]}),h.jsx("div",{className:"flex justify-center",children:h.jsx(vt,{value:n.bottom,onChange:s=>t(o=>o.style.paddingBottom=s.text),...or})})]}),h.jsx(vt,{value:r.right,onChange:s=>t(o=>o.style.marginRight=s.text),...or})]}),h.jsx("div",{className:"flex justify-center",children:h.jsx(vt,{value:r.bottom,onChange:s=>t(o=>o.style.marginBottom=s.text),...or})})]})})})})}function BT(){return h.jsxs(h.Fragment,{children:[h.jsx(F0,{}),h.jsx(A0,{}),h.jsx(E0,{}),h.jsx(S0,{})]})}const jT=[{value:"Arial, Helvetica, sans-serif",label:"Arial"},{value:"Verdana, Geneva, sans-serif",label:"Verdana"},{value:"Tahoma, Geneva, sans-serif",label:"Tahoma"},{value:"'Trebuchet MS', Helvetica, sans-serif",label:"Trebuchet MS"},{value:"Helvetica, Arial, sans-serif",label:"Helvetica"},{value:"'Times New Roman', Times, serif",label:"Times New Roman"},{value:"Georgia, serif",label:"Georgia"},{value:"'Palatino Linotype', 'Book Antiqua', Palatino, serif",label:"Palatino Linotype"},{value:"'Courier New', Courier, monospace",label:"Courier New"},{value:"'Lucida Console', Monaco, monospace",label:"Lucida Console"}],OT=[{label:"Lighter",value:"lighter"},{label:"Normal",value:"normal"},{label:"Bold",value:"bold"},{label:"Bolder",value:"bolder"},{label:"100",value:"100"},{label:"200",value:"200"},{label:"300",value:"300"},{label:"400",value:"400"},{label:"500",value:"500"},{label:"600",value:"600"},{label:"700",value:"700"},{label:"800",value:"800"},{label:"900",value:"900"}],LT=[{label:"Normal",value:"normal"},{label:"No wrapped",value:"nowrap"}];function _T(){const{actions:{setProp:t},style:e={}}=Q.useNode(s=>({style:s.data.props.style})),r=S.useCallback(s=>{t(o=>{o.style={...o.style,...s}})},[t]),n=S.useMemo(()=>In(r,300),[r]);return h.jsx(_n,{title:"Typography",icon:h.jsx(ns.LuType,{size:14,className:"text-[#170F4F]"}),defaultOpen:!0,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Font"}),h.jsx(Mt,{options:jT,value:e.fontFamily||"Inter",onChange:s=>r({fontFamily:s}),placeholder:"Choose font family"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Size"}),h.jsx("input",{type:"number",min:8,max:96,value:e.fontSize||20,onChange:s=>r({fontSize:Number(s.target.value)}),className:"w-full border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Weight"}),h.jsx(Mt,{options:OT,value:e.fontWeight||"normal",onChange:s=>r({fontWeight:s}),placeholder:"Choose font weight"})]})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(_.FiMove,{size:14,className:"text-[#170F4F]"}),h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:"Alignment"})]}),h.jsx("div",{className:"flex gap-2",children:["left","center","right","justify"].map(s=>h.jsx("button",{className:`rounded border px-3 py-2 text-xs font-medium transition-all focus:outline-none focus:ring-2 focus:ring-[#170F4F] ${e.textAlign===s?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({textAlign:s}),children:s.charAt(0).toUpperCase()+s.slice(1)},s))}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Line Break"}),h.jsx(Mt,{options:LT,value:e.whiteSpace||"normal",onChange:s=>r({whiteSpace:s}),placeholder:"Choose whiteSpace"})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ns.LuRemoveFormatting,{size:14,className:"text-[#170F4F]"}),h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:"Formatting"})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{className:`rounded border px-3 py-2 text-xs font-bold ${e?.fontWeight==="bold"?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({fontWeight:e?.fontWeight==="bold"?"normal":"bold"}),children:h.jsx(ns.LuBold,{size:14,className:"text-[#170F4F]"})}),h.jsx("button",{className:`rounded border px-3 py-2 text-xs italic ${e?.fontStyle==="italic"?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({fontStyle:e?.fontStyle==="italic"?"normal":"italic"}),children:h.jsx(ns.LuItalic,{size:14,className:"text-[#170F4F]"})}),h.jsx("button",{className:`rounded border px-3 py-2 text-xs underline ${e?.textDecoration==="underline"?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({textDecoration:e?.textDecoration==="underline"?"none":"underline"}),children:h.jsx(ns.LuUnderline,{size:14,className:"text-[#170F4F]"})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(_.FiEdit3,{size:14,className:"text-[#170F4F]"}),h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:"Text Color"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:e.color||"#000000",onChange:s=>n({color:s.target.value}),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Text color"}),h.jsx("input",{type:"text",value:e.color||"#000000",onChange:s=>r({color:s.target.value}),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#000000"})]})]})]})})}const IT={default:BT,typography:_T,layout:F0,spacing:A0,background:E0,border:S0,box:Lh,text:MT,button:Kl,image:Xl,anchor:Jl,divider:Gl,table:Ql,conditional:Rh},RT=Object.entries(IT).map(([t,e])=>({id:t,component:e}));function PT(){const{selected:t,query:e}=Q.useEditor(s=>({selected:s.events.selected}));if(!t||t.size===0)return h.jsx("div",{className:"flex h-full items-center justify-center text-gray-500",children:h.jsxs("div",{className:"text-center",children:[h.jsx(_.FiSettings,{size:48,className:"mx-auto mb-4 text-gray-300"}),h.jsx("p",{className:"text-sm",children:"Select a component to see its settings"})]})});const r=Array.from(t)[0],n=e.node(r).get();if(!n)return null;if(n&&n.data.custom&&n.data.custom.settings){const s=n.data.custom.settings,i=(Array.isArray(s)?s:[s]).map(a=>RT.find(l=>l.id===a)).filter(Boolean);if(i.length>0)return h.jsx(h.Fragment,{children:i.map(a=>{const l=a.component;return Be.default.createElement(Q.NodeProvider,{id:r,related:!0,key:a.id},h.jsx(l,{}))})})}return h.jsx("div",{className:"p-4",children:h.jsx("p",{className:"text-sm text-gray-500",children:"No custom settings available for this component."})})}const zT=[{id:"settings",label:"Settings",icon:_.FiSettings},{id:"info",label:"Info",icon:_.FiInfo},{id:"actions",label:"Actions",icon:_.FiEye}];function $T(){const{selected:t,query:e}=Q.useEditor(a=>({selected:a.events.selected})),[r,n]=S.useState("settings"),s=Array.from(t)?.[0],o=S.useMemo(()=>({settings:h.jsx(PT,{},`settings_${s}`),info:h.jsx(nC,{}),actions:h.jsx(rC,{})}),[s]),i=S.useMemo(()=>{if(!t||t.size===0)return null;const a=e.node(s).get();return a?{id:s,type:a.data.type,displayName:a.data.displayName||String(a.data.type),props:a.data.props,isCanvas:a.data.isCanvas,isDeletable:!0,isDuplicateable:!0,parent:a.data.parent}:null},[t,e]);return h.jsxs("div",{className:"flex h-full w-80 flex-col border-l border-[#e8e7ee] bg-white",children:[i&&h.jsx(tC,{name:String(i.displayName)}),i&&h.jsx("div",{className:"flex border-b border-[#e8e7ee]",children:zT.map(a=>{const l=a.icon;return h.jsxs("button",{onClick:()=>n(a.id),className:`flex flex-1 items-center justify-center gap-2 px-3 py-2 text-xs font-medium transition-colors duration-200 ${r===a.id?"border-b-2 border-[#170f4f] bg-white text-[#170f4f]":"text-gray-500 hover:bg-gray-50 hover:text-[#170f4f]"}`,children:[h.jsx(l,{size:14}),a.label]},a.id)})}),h.jsx("div",{className:"flex-1 overflow-y-auto",children:o[r]})]})}function HT({blocks:t,searchTerm:e}){const{connectors:r,query:n}=Q.useEditor(),[s,o]=S.useState(new Set),i=S.useRef({}),l=S.useMemo(()=>e.trim()?(o(new Set),t.filter(v=>v.label.toLowerCase().includes(e.toLowerCase())||v.category?.toLowerCase().includes(e.toLowerCase()))):t,[t,e]).reduce((v,w)=>{const D=w.category||"other";return v[D]||(v[D]=[]),v[D].push(w),v},{}),c=v=>{o(w=>{const D=new Set(w);return D.has(v)?D.delete(v):D.add(v),D})};S.useEffect(()=>{const v=Object.keys(l);if(v[0]&&s.size===0){const D=new Set(v.slice(1));o(D)}},[]);const d=v=>h.jsxs("div",{ref:w=>{w&&r.create(w,Be.default.createElement(v.component,{}),{})},className:"group flex cursor-move flex-col items-center gap-1.5 rounded-md bg-white p-2.5 text-center transition-all duration-200 hover:bg-gray-50",draggable:!0,onDragStart:w=>{w.currentTarget.style.opacity="0.5"},onDragEnd:w=>{w.currentTarget.style.opacity="1"},title:`Drag to add ${v.label} component`,children:[h.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded bg-[#170F4F] text-sm text-white",children:v.icon}),h.jsx("span",{className:"text-xs font-medium leading-tight text-gray-700",children:v.label})]},v.id),f={layout:"Layout",content:"Content",interactive:"Interactive",media:"Media",dynamic:"Dynamic",other:"Other"},m={layout:h.jsx(_.FiGrid,{size:14}),content:h.jsx(_.FiType,{size:14}),interactive:h.jsx(_.FiMousePointer,{size:14}),media:h.jsx(_.FiImage,{size:14}),dynamic:h.jsx(_.FiCode,{size:14}),other:h.jsx(_.FiPackage,{size:14})},g=n.node("ROOT").get(),y=g&&g.data.nodes&&g.data.nodes.length>0;return h.jsxs("div",{className:"flex h-full flex-col",children:[!y&&h.jsx("div",{className:"border-b border-[#E8E7EE] bg-gray-50/50 px-3 py-2",children:h.jsx("p",{className:"text-xs text-gray-500",children:"Drag components to the canvas to add them"})}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[Object.entries(l).map(([v,w])=>{const D=s.has(v);return h.jsxs("div",{className:"last:mb-0",children:[h.jsxs("button",{onClick:()=>c(v),className:"mb-3 flex w-full items-center gap-2 rounded p-2 text-gray-700 transition-all duration-200 hover:bg-gray-50",children:[h.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded transition-colors hover:bg-gray-100",children:D?h.jsx(_.FiChevronRight,{size:12,className:"text-gray-400"}):h.jsx(_.FiChevronDown,{size:12,className:"text-gray-400"})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"text-gray-600",children:m[v]||m.other}),h.jsx("h3",{className:"text-sm font-medium text-gray-900",children:f[v]||v})]}),h.jsx("div",{className:"h-px flex-1 bg-gray-200"}),h.jsx("span",{className:"text-xs font-medium text-gray-500",children:w.length})]}),h.jsx("div",{ref:E=>{i.current[v]=E},style:{overflow:"hidden",transition:"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:!D&&h.jsx("div",{className:"pb-1",children:h.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:w.map(d)})})})]},v)}),Object.entries(l).length===0&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[h.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-gray-100",children:h.jsx("span",{className:"text-lg",children:"📦"})}),h.jsx("h3",{className:"mb-1 text-sm font-medium text-gray-900",children:e?"No components found":"No blocks available"}),h.jsx("p",{className:"text-xs text-gray-500",children:e?"Try different search terms":"Add components to get started"})]})]})]})}const VT=t=>Rs.find(r=>{const n=r.label.toLowerCase(),s=r.id.toLowerCase(),o=t.toLowerCase();return n===o||s===o})?.icon||h.jsx(_.FiMousePointer,{size:16});function qT({searchTerm:t}){const[e,r]=S.useState(new Set),{nodes:n,actions:s,selected:o}=Q.useEditor(g=>({nodes:g.nodes,selected:g.events.selected})),i=g=>{const y=new Set(e);y.has(g)?y.delete(g):y.add(g),r(y)},a=(g,y)=>{if(!y.trim())return g;const v=new RegExp(`(${y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return g.split(v).map((D,E)=>v.test(D)?h.jsx("span",{className:"rounded bg-yellow-200 px-0.5 text-yellow-900",children:D},E):D)},l=(g,y=0,v=!1,w=[])=>{const D=n[g];if(!D)return null;const E=D.data.isCanvas,N=D.data.nodes||[],A=D.data.displayName||(typeof D.data.type=="string"?D.data.type:D.data.type?.displayName)||g,T=o&&o.has(g),j=typeof D.data.name=="string"?D.data.name:D.data?.displayName||"",B=N.length>0,$=e.has(g),O=t.trim()===""||A.toLowerCase().includes(t.toLowerCase())||j.toLowerCase().includes(t.toLowerCase()),z=t.trim()!==""&&N.some(q=>{const J=n[q];if(!J)return!1;const K=J.data.displayName||(typeof J.data.type=="string"?J.data.type:J.data.type?.displayName)||q,ae=typeof J.data.name=="string"?J.data.name:J.data?.displayName||"";return K.toLowerCase().includes(t.toLowerCase())||ae.toLowerCase().includes(t.toLowerCase())});return O||z?h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("div",{className:"flex w-full items-center",children:[y>0&&h.jsx("div",{style:{width:y*20}}),h.jsxs("div",{className:`group flex w-full items-center rounded-md px-2 py-1.5 transition-colors ${T?"bg-[#170F4F]/10 hover:bg-[#170F4F]/15":"hover:bg-gray-50"} ${O&&t.trim()?"ring-1 ring-yellow-300":""}`,children:[B?h.jsx("button",{onClick:()=>i(g),className:"mr-1.5 flex h-4 w-4 items-center justify-center rounded opacity-0 transition-opacity hover:bg-gray-200 group-hover:opacity-100",children:$?h.jsx(_.FiChevronRight,{size:12,className:"text-gray-500"}):h.jsx(_.FiChevronDown,{size:12,className:"text-gray-500"})}):h.jsx("div",{className:"w-6"}),h.jsx("div",{className:`mr-2.5 flex h-5 w-5 items-center justify-center ${T?"text-[#170F4F]":"text-gray-600"}`,children:VT(j)}),h.jsx("button",{className:`flex-1 text-left text-sm font-medium transition-colors ${T?"text-[#170F4F]":"text-gray-700 group-hover:text-[#170F4F]"}`,onClick:()=>s.selectNode(g),children:a(A,t)})]})]}),E&&B&&(!$||t.trim()!=="")&&h.jsx("div",{className:"ml-0",children:N.map((q,J)=>l(q,y+1,J===N.length-1,[...w,v]))})]},g):null},d=n.ROOT?.data?.nodes||[],f=d.length>0,m=e.has("canvas");return h.jsx("div",{className:"flex h-full flex-col",children:h.jsxs("div",{className:"flex-1 space-y-0.5 overflow-y-auto p-2",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"flex w-full items-center",children:h.jsxs("div",{className:`group flex w-full items-center rounded-md px-2 py-1.5 transition-colors ${o&&o.has("ROOT")?"bg-[#170F4F]/10 hover:bg-[#170F4F]/15":"hover:bg-gray-50"}`,children:[f?h.jsx("button",{onClick:()=>i("canvas"),className:"mr-1.5 flex h-4 w-4 items-center justify-center rounded opacity-0 transition-opacity hover:bg-gray-200 group-hover:opacity-100",children:m?h.jsx(_.FiChevronRight,{size:12,className:"text-gray-500"}):h.jsx(_.FiChevronDown,{size:12,className:"text-gray-500"})}):h.jsx("div",{className:"w-6"}),h.jsx("div",{className:"mr-2.5 flex h-5 w-5 items-center justify-center text-[#170F4F]",children:h.jsx(_.FiFile,{size:14})}),h.jsx("button",{className:`flex-1 text-left text-sm font-medium transition-colors ${o&&o.has("ROOT")?"text-[#170F4F]":"text-gray-800 group-hover:text-[#170F4F]"}`,onClick:()=>s.selectNode("ROOT"),children:"Template"})]})}),f&&(!m||t.trim()!=="")&&h.jsx("div",{children:d.map((g,y)=>l(g,1,y===d.length-1,[!0]))})]}),!f&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[h.jsx("div",{className:"mb-2 flex h-10 w-10 items-center justify-center rounded-lg bg-gray-100",children:h.jsx(_.FiLayers,{size:16,className:"text-gray-400"})}),h.jsx("p",{className:"mb-1 text-xs text-gray-500",children:"No layers yet"}),h.jsx("p",{className:"text-xs text-gray-400",children:"Add components to see them here"})]})]})})}const WT=({blocks:t=Rs})=>{const[e,r]=S.useState("blocks"),[n,s]=S.useState("");return h.jsxs("div",{className:"flex h-full w-64 flex-col overflow-hidden border-r border-[#E8E7EE] bg-white",children:[h.jsx("div",{className:"border-b border-[#E8E7EE] bg-gray-50 p-3",children:h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:"text",placeholder:"Search components...",value:n,onChange:o=>s(o.target.value),className:"w-full border border-[#E8E7EE] bg-white px-3 py-2 pl-9 pr-9 text-sm text-gray-900 placeholder-gray-500 transition-all duration-200 focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]/20"}),h.jsx(_.FiSearch,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),n&&h.jsx("button",{onClick:()=>s(""),className:"absolute right-3 top-1/2 -translate-y-1/2 rounded p-0.5 text-gray-400 transition-colors duration-200 hover:bg-gray-100 hover:text-gray-600",children:h.jsx(_.FiX,{size:14})})]})}),h.jsxs("div",{className:"flex border-b border-[#E8E7EE]",children:[h.jsx("button",{className:`flex-1 border-b py-3 text-sm font-medium transition-colors duration-200 ${e==="blocks"?"border-[#170F4F] text-[#170F4F]":"border-transparent text-[#A29FB9] hover:text-[#00BAC7]"}`,onClick:()=>r("blocks"),children:"Blocks"}),h.jsx("button",{className:`flex-1 border-b py-3 text-sm font-medium transition-colors duration-200 ${e==="layers"?"border-[#170F4F] text-[#170F4F]":"border-transparent text-[#A29FB9] hover:text-[#00BAC7]"}`,onClick:()=>r("layers"),children:"Layers"})]}),h.jsx("div",{className:"flex-1 overflow-hidden",children:e==="blocks"?h.jsx(HT,{blocks:t,searchTerm:n}):h.jsx(qT,{searchTerm:n})})]})},UT=({hasChildren:t})=>{const{device:e}=Fi();return t?null:h.jsx("div",{className:`pointer-events-none absolute inset-0 left-auto right-auto z-10 flex items-center justify-center ${e==="mobile"?"w-[10%]":"w-[20%]"}`,children:h.jsxs("div",{className:"mx-auto p-6 text-center",children:[h.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center border border-[#170F4F] bg-[#E8E7EE]",children:h.jsx("span",{className:"text-2xl text-[#170F4F]",children:"📄"})}),h.jsx("h3",{className:"mb-2 text-lg font-medium text-[#170F4F]",children:"Start building your page"}),h.jsx("p",{className:"text-sm text-[#A29FB9]",children:"Drag components from the sidebar to create your page layout."})]})})},JT=({hasCanvasContent:t,showCodePanel:e})=>h.jsxs("div",{className:`${e?"w-1/2":"w-full"} mx-auto flex h-full flex-1 items-start justify-center overflow-scroll bg-gradient-to-br from-gray-100 to-gray-200 p-6 transition-all duration-300`,style:{maxHeight:"calc(100vh - 72px)"},children:[h.jsx(UT,{hasChildren:t}),h.jsx(Q.Frame,{children:h.jsx(Q.Element,{canvas:!0,is:"div",...il,style:{...il.style,maxWidth:Uh.desktop.width}})})]}),KT=()=>{const[t,e]=S.useState(!1),r=()=>{console.log("Export HTML clicked"),e(!1)},n=()=>{console.log("Data Source clicked"),e(!1)};return Be.default.useEffect(()=>{const s=o=>{t&&e(!1)};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[t]),h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>e(!t),className:"rounded p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F]",title:"Menu options",children:h.jsx(_.FiMenu,{size:16})}),t&&h.jsxs("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 rounded-md border border-[#E8E7EE] bg-white py-1 shadow-lg",children:[h.jsxs("button",{onClick:r,className:"flex w-full items-center gap-3 px-4 py-2 text-sm text-gray-700 hover:bg-gray-50",children:[h.jsx(_.FiDownload,{size:14}),"Export HTML"]}),h.jsxs("button",{onClick:n,className:"flex w-full items-center gap-3 px-4 py-2 text-sm text-gray-700 hover:bg-gray-50",children:[h.jsx(_.FiDatabase,{size:14}),"Data Source"]})]})]})},GT=({canvasSize:t,showCodePanel:e,onPreviewModeToggle:r,onCanvasSizeChange:n,onCodePanelToggle:s,onSave:o,templateIsModified:i=!1,templateName:a,onTemplateNameChange:l,templateReference:c,history:d})=>{const[f,m]=S.useState(!1),g=Be.default.useRef(null);S.useEffect(()=>{f&&g.current&&(g.current.focus(),g.current.select())},[f]),S.useEffect(()=>{const E=N=>{i&&(N.preventDefault(),N.returnValue="")};return window.addEventListener("beforeunload",E),()=>{window.removeEventListener("beforeunload",E)}},[i]);const y=()=>{m(!1)},v=E=>{E.key==="Enter"&&m(!1),E.key==="Escape"&&m(!1)},w=E=>{l?.(E.target.value)},D=async E=>{try{await navigator.clipboard.writeText(E)}catch(N){console.error("Failed to copy slug:",N)}};return h.jsx("div",{className:"border-b border-[#E8E7EE] bg-white",children:h.jsx("div",{className:"px-3 py-3 sm:px-8",children:h.jsxs("div",{className:"relative flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(KT,{}),h.jsx("div",{className:"group",children:f?h.jsx("input",{ref:g,className:"w-full truncate rounded border-none bg-transparent px-1.5 text-base font-bold text-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",value:a,onChange:w,onBlur:y,onKeyDown:v,placeholder:"Untitled Template","aria-label":"Template name"}):h.jsxs("div",{className:"flex items-center",children:[h.jsxs("h1",{className:"cursor-pointer rounded px-1.5 py-1 text-base font-bold text-[#170F4F] hover:bg-gray-50",title:"Double-click to edit",onDoubleClick:()=>m(!0),children:[h.jsx("span",{className:"truncate",children:a||"Untitled Template"}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"mx-1.5 text-gray-300",children:"•"}),h.jsx("span",{className:"rounded-sm bg-gray-100 px-1 py-0.5 font-mono text-[10px] font-medium text-gray-600",children:c})]})]}),c&&h.jsx("button",{onClick:()=>D(c),className:"rounded p-0.5 opacity-0 transition-opacity hover:bg-gray-50 hover:text-[#170F4F] group-hover:opacity-100",title:"Copy slug to clipboard",children:h.jsx(_.FiCopy,{size:9,className:"text-gray-400"})})]})})]}),h.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:h.jsx("div",{className:"flex items-center gap-1 border border-[#E8E7EE] bg-white p-1",children:["desktop","tablet","mobile"].map(E=>{const N={desktop:h.jsx(_.FiMonitor,{size:16}),tablet:h.jsx(_.FiTablet,{size:16}),mobile:h.jsx(_.FiSmartphone,{size:16})};return h.jsxs("button",{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium transition-all duration-200 ${t===E?"bg-[#170F4F] text-white":"text-[#170F4F] hover:bg-[#F5F5F7]"}`,onClick:()=>n(E),title:`Switch to ${E} view`,children:[h.jsx("span",{className:"inline sm:hidden",children:N[E]}),h.jsx("span",{className:"hidden sm:inline",children:E.charAt(0).toUpperCase()+E.slice(1)})]},E)})})}),h.jsxs("div",{className:"flex items-center gap-2",children:[i?h.jsxs("div",{className:"flex items-center gap-1 text-orange-600",children:[h.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-orange-500"}),h.jsx("span",{className:"text-xs font-medium",children:"Unsaved"})]}):h.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[h.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),h.jsx("span",{className:"text-xs font-medium",children:"Saved"})]}),h.jsx("button",{onClick:d.actionUndo,className:"p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F] disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-300",title:"Undo",disabled:!d.canUndo,children:h.jsx(lt.BiUndo,{size:16})}),h.jsx("button",{onClick:d.actionRedo,className:"p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F] disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-300",title:"Redo",disabled:!d.canRedo,children:h.jsx(lt.BiRedo,{size:16})}),h.jsx("button",{className:`p-1.5 transition-all duration-200 ${e?"bg-[#170F4F] text-white":"text-[#6B7280] hover:bg-[#F5F5F7] hover:text-[#170F4F]"}`,onClick:s,title:"Toggle Code Editor",children:h.jsx(_.FiCode,{size:16})}),h.jsx("button",{onClick:r,className:"p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F]",title:"Preview template",children:h.jsx(_.FiEye,{size:16})}),o&&h.jsxs("button",{className:"relative flex items-center gap-1.5 bg-[#170F4F] px-3 py-1.5 text-xs font-medium text-white transition-all duration-200 hover:bg-[#009CA8]",onClick:o,title:"Save changes",children:[h.jsx(_.FiSave,{size:14}),"Save",i&&h.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 animate-pulse bg-orange-500"})]})]})]})})})},YT=S.lazy(()=>Promise.resolve().then(function(){return b3}).then(t=>({default:t.DataSourceModal}))),XT=({showCodePanel:t=!1,onPreviewToggle:e,onCodePanelToggle:r,codePanelChildren:n})=>{eC();const s=Fi(),o=Zl(),{store:i,actions:a,canUndo:l,canRedo:c}=Q.useEditor((N,A)=>({canUndo:A.history.canUndo(),canRedo:A.history.canRedo()})),{template:d,updateTemplate:f,saveTemplate:m}=Pn(),[g,y]=S.useState(!1),[v,w]=S.useState(!1),D=()=>{},E=async()=>{if(!d){alert("No template loaded to save");return}try{f({snapshot:s.getState(),content:o.convertToHtml(s.getState())}),await m(),alert("Template saved successfully!")}catch(N){console.error("Error saving template:",N),alert("Error saving template. Please try again.")}};return S.useEffect(()=>{if(!v&&d&&d?.snapshot)try{s.loadState(d.snapshot)}catch(N){console.error("Error loading template into canvas:",N)}finally{w(!0)}},[d?.id]),S.useEffect(()=>{i.subscribe(In(()=>{f({snapshot:s.getState(),content:o.convertToHtml(s.getState())})},500),()=>{})},[]),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(GT,{canvasSize:s.device,showCodePanel:t,onPreviewModeToggle:e||(()=>{}),onCanvasSizeChange:s.setDevice,onCodePanelToggle:r||(()=>{}),onSave:E,templateIsModified:d?.isModified,templateName:d?.title,onTemplateNameChange:N=>{f({title:N})},templateReference:d?.slug,history:{actionUndo:()=>a.history.undo(),actionRedo:()=>a.history.redo(),canUndo:l,canRedo:c}}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!t&&h.jsx(WT,{}),h.jsxs("div",{className:`flex flex-1 ${t?"flex-row":"flex-col"}`,children:[t?n:null,h.jsx(JT,{canvasSize:s.device,hasCanvasContent:s.isEmpty,showCodePanel:t})]}),!t&&h.jsx($T,{})]}),g&&h.jsx(S.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(YT,{isOpen:g,onClose:()=>y(!1),onDataImport:D})})]})},N0=({children:t,isHover:e,isSelected:r,name:n,showIndicator:s=!0,width:o,height:i})=>{const a=e&&!r&&s,l=r&&s,c=a||l,d={outline:l?"1px solid #170f4fff":a?"1px dashed #00BAC7":"1px solid transparent",background:l?"rgba(23,15,79,0.03)":a?"rgba(0,186,199,0.02)":"transparent",cursor:"pointer",overflow:"visible",position:"relative",width:o,height:i};return h.jsxs("div",{style:d,className:r?"avoid-transition":"",children:[c&&h.jsxs("div",{className:`absolute left-0 top-0 flex items-center gap-1.5 px-2 py-1 text-xs font-medium backdrop-blur-sm ${l?"border border-[#170F4F] bg-[#170F4F] text-white shadow-lg":"border border-[#00BAC7] bg-[#00BAC7] text-white shadow-md"} `,style:{borderRadius:"4px",transform:"translateY(-100%)",transformOrigin:"left bottom",marginTop:"-2px",zIndex:99999,position:"absolute",transition:"all 0.15s ease-out"},onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault()},children:[h.jsx("div",{className:"flex h-3 w-3 items-center justify-center",children:l?h.jsx("div",{className:"h-2 w-2 rounded-full bg-white"}):h.jsx("div",{className:"h-2 w-2 rounded-full bg-white opacity-70"})}),h.jsx("span",{className:"select-none whitespace-nowrap leading-none",children:n})]}),t]})},Nh=6,ir=-3,QT={position:"absolute",width:`${Nh}px`,height:`${Nh}px`,background:"#170F4F",display:"block",pointerEvents:"none",boxShadow:"0 2px 8px rgba(23,15,79,0.3)",border:"0.5px solid #CCF1F4"},ZT={topLeft:{left:`${ir}px`,top:`${ir}px`},topRight:{right:`${ir}px`,top:`${ir}px`},bottomLeft:{left:`${ir}px`,bottom:`${ir}px`},bottomRight:{right:`${ir}px`,bottom:`${ir}px`}},e3=({children:t,propKey:e={width:"width",height:"height"}})=>{const{actions:r,connectors:{connect:n}}=Q.useNode(),{isSelected:s,isHover:o,nodeWidth:i,nodeHeight:a,name:l}=Q.useNode(D=>({isSelected:D.events.selected,isHover:D.events.hovered,nodeWidth:D.data.props.style?.[e.width]||D.data.props[e.width]||200,nodeHeight:D.data.props.style?.[e.height]||D.data.props[e.height]||100,name:D.data.custom?.displayName||D.data.displayName})),{maxWidth:c}=Q.useEditor(D=>{const N=D.nodes.ROOT?.data?.props?.style||{},A=N.maxWidth||N.width||1200;return{maxWidth:typeof A=="string"?parseInt(A):A}}),d=S.useRef(null),f=S.useRef(null),m=S.useMemo(()=>{const D=()=>{if(typeof i=="number")return Math.round(i);if(typeof i=="string"){if(i.includes("%")&&c){const N=parseFloat(i)/100;return Math.round(c*N)}return i||200}return 200},E=()=>a==="auto"?"auto":typeof a=="number"?Math.round(a):typeof a=="string"?a.includes("%")?a:a||100:100;return{width:D(),height:E()}},[i,a,c]),[g,y]=S.useState(m),v=S.useCallback(()=>{y(m)},[m]);S.useEffect(()=>{if(!c)return;const D=typeof i=="number"?i:parseFloat(i)||0;if(D>c){const E=c/D,N=Math.floor(D*E);r.setProp(A=>{A.style||(A.style={}),A.style[e.width]=N})}},[c,i,r,e.width]);const w=S.useCallback((D,E)=>{if(!f.current)return m;const{width:N,height:A}=f.current;let T=Math.round(N+D),j=Math.round(A+E);return c&&(T=Math.min(T,c)),T=Math.max(T,50),j=Math.max(j,20),{width:T,height:j}},[m,c]);return S.useEffect(()=>{v(),r.setCustom(D=>{D.resizable=!0})},[i,a,v,r]),h.jsx(N0,{isHover:o,isSelected:s,name:l||"Component",showIndicator:!0,width:g.width,height:g.height,children:h.jsxs(H2.Resizable,{ref:D=>{D&&D.resizable&&(d.current=D,n(D.resizable))},enable:{top:s,right:s,bottom:s,left:s,topLeft:s,topRight:s,bottomLeft:s,bottomRight:s},size:g,onResizeStart:D=>{D.preventDefault(),D.stopPropagation();const E=d.current?.resizable;if(!E)return;const N=E.getBoundingClientRect();f.current={width:Math.round(N.width),height:Math.round(N.height)}},onResize:(D,E,N,A)=>{const T=w(A.width,A.height);r.setProp(j=>{j.style||(j.style={}),j.style[e.width]=T.width,j.style[e.height]=T.height}),v()},onResizeStop:(D,E,N,A)=>{const T=w(A.width,A.height);r.setProp(j=>{j.style||(j.style={}),j.style[e.width]=T.width,j.style[e.height]=T.height}),v()},handleStyles:{topLeft:{display:"block"},topRight:{display:"block"},bottomLeft:{display:"block"},bottomRight:{display:"block"}},children:[t,h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:99999},children:s&&Object.entries(ZT).map(([D,E])=>h.jsx("span",{style:{...QT,...E}},D))})]})})},t3=({render:t})=>{const{id:e,isHover:r,isActive:n,name:s,isResizable:o,nodeWidth:i,nodeHeight:a}=Q.useNode(c=>({isHover:c.events.hovered,isActive:c.events.selected,name:c.data.custom?.displayName||c.data.displayName,isResizable:c.data.custom.resizable===!0,nodeWidth:c.data.props.style?.width||c.data.props.width||"min-content",nodeHeight:c.data.props.style?.height||c.data.props.height||"min-content"}));return e===$2.ROOT_NODE?h.jsx(h.Fragment,{children:t}):o?h.jsx(e3,{children:t}):h.jsx(N0,{isHover:r,isSelected:n,name:s,width:i,height:a,children:t})};class Fe{static isSchema(e){return e!==null&&typeof e=="object"&&"type"in e&&"value"in e}static getByPath(e,r){const n=r.split(".");let s=e;for(let o=0;o<n.length;o++){if(s==null)return;s=s[n[o]]}return s}static deepClone(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>this.deepClone(n));const r={};for(const n in e)r[n]=this.deepClone(e[n]);return r}static setByPath(e,r,n){const s=r.split("."),o=this.deepClone(e);let i=o;for(let a=0;a<s.length-1;a++)(!i[s[a]]||typeof i[s[a]]!="object")&&(i[s[a]]={}),i=i[s[a]];return i[s[s.length-1]]=n,o}static deleteByPath(e,r){const n=r.split("."),s=this.deepClone(e);let o=s;for(let i=0;i<n.length-1;i++){if(!o[n[i]])return e;o=o[n[i]]}return delete o[n[n.length-1]],s}static toSchema(e,r,n){if(this.isSchema(e))return e;const s=typeof e;let o="text";return s==="number"?o="number":s==="boolean"?o="boolean":s==="string"&&e.length===10&&e[4]==="-"&&e[7]==="-"&&(o="date"),{key:r,label:n||r,type:o,value:e}}static getAllSchemas(e,r=""){const n={};for(const s in e){const o=e[s],i=r?`${r}.${s}`:s;if(this.isSchema(o))n[i]={...o,key:i};else if(typeof o=="object"&&o!==null){const a=this.getAllSchemas(o,i);for(let l=0;l<a.length;l++)n[a[l].key]=a[l]}else{const a=this.toSchema(o,i,s);n[a.key]=a}}return Object.values(n)}static resolve(e){const r={};for(const n in e){const s=e[n];this.isSchema(s)?r[n]=s.value:typeof s=="object"&&s!==null?r[n]=this.resolve(s):r[n]=s}return r}}const Th={desktop:{width:1200,height:800,name:"Desktop"},tablet:{width:768,height:1024,name:"Tablet"},mobile:{width:375,height:667,name:"Mobile"}},r3=({canvasSize:t,hasCanvasContent:e,onZoomChange:r,placeholderData:n={}})=>{const{template:s}=Pn(),[o,i]=S.useState(100),[a,l]=S.useState(""),c=S.useMemo(()=>Th[t]||Th.desktop,[t]);return S.useEffect(()=>{const d=()=>{const f=window.innerWidth-100,m=window.innerHeight-200,g=f/c.width,y=m/c.height,v=Math.min(g,y,1)*100,w=Math.max(25,Math.min(100,v));i(w),r&&r(w)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[t,c.width,c.height,r]),S.useEffect(()=>{if(!e){l("");return}try{if(s&&s.id)if(typeof s.compile=="function"){const d=Fe.resolve(n),f=s.compile(d);l(f)}else console.warn("Template does not have compile method, using content"),l(s.content||"");else console.warn("Template not loaded or invalid"),l("")}catch(d){console.error("Error rendering template:",d),l("")}},[e,n,s]),h.jsx("div",{className:"relative flex flex-1 items-center justify-center overflow-auto bg-[#F5F5F7] p-8",children:h.jsx("div",{className:"flex h-full w-full items-center justify-center",children:h.jsxs("div",{className:"relative overflow-hidden rounded-none border border-[#E8E7EE] bg-white shadow-lg",style:{width:c.width*(o/100),height:c.height*(o/100),maxWidth:"100%",maxHeight:"100%"},children:[t==="mobile"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"absolute inset-x-0 top-0 z-10 flex h-6 items-center justify-center bg-black",children:h.jsx("div",{className:"h-1 w-12 rounded-full bg-gray-600"})}),h.jsx("div",{className:"absolute inset-x-0 bottom-1 z-10 flex justify-center",children:h.jsx("div",{className:"h-1 w-16 rounded-full bg-black opacity-30"})})]}),h.jsxs("div",{className:"h-full w-full overflow-hidden",style:{transform:`scale(${o/100})`,transformOrigin:"top left",width:`${100/(o/100)}%`,height:`${100/(o/100)}%`},children:[!e&&h.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50",children:h.jsxs("div",{className:"p-8 text-center",children:[h.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-none border-2 border-dashed border-[#E8E7EE] bg-[#F5F5F7]",children:h.jsx("span",{className:"text-2xl text-[#A29FB9]",children:"📄"})}),h.jsx("h3",{className:"mb-2 text-lg font-medium text-[#170F4F]",children:"No content to preview"}),h.jsx("p",{className:"text-sm text-[#A29FB9]",children:"Add components to see the preview"})]})}),h.jsx("div",{className:"h-full min-h-screen bg-white",style:{overflow:"visible",position:"relative",minHeight:"100%"},dangerouslySetInnerHTML:{__html:a}})]})]})})})},Mh={desktop:{width:1200,height:800,name:"Desktop",icon:_.FiMonitor},tablet:{width:768,height:1024,name:"Tablet",icon:_.FiTablet},mobile:{width:375,height:667,name:"Mobile",icon:_.FiSmartphone}},n3=({canvasSize:t,onCanvasSizeChange:e,onExitPreview:r,onDownload:n,onOpenInNewTab:s,showPlayground:o=!1,onTogglePlayground:i})=>h.jsx("div",{className:"border-b border-[#E8E7EE] bg-white px-2 py-2",children:h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 rounded-none px-2 py-1.5 text-sm font-medium text-[#170F4F] transition-colors hover:bg-[#F5F5F7]",title:"Exit Preview",children:[h.jsx(_.FiX,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Exit Preview"})]}),h.jsx("div",{className:"h-6 w-px bg-[#E8E7EE]"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(_.FiEye,{className:"h-4 w-4 text-[#00BAC7]"}),h.jsx("span",{className:"hidden text-sm font-medium text-[#170F4F] min-[900px]:inline",children:"Preview"})]})]}),h.jsx("div",{className:"flex items-center gap-1",children:Object.keys(Mh).map(a=>{const l=Mh[a],c=l.icon,d=t===a;return h.jsx("button",{onClick:()=>e(a),className:`flex items-center justify-center rounded-none p-2 transition-all duration-200 ${d?"bg-[#170F4F] text-white":"border border-[#E8E7EE] text-[#170F4F] hover:bg-[#F5F5F7]"} `,title:l.name,children:h.jsx(c,{className:"h-4 w-4"})},a)})}),h.jsxs("div",{className:"flex items-center gap-1",children:[i&&h.jsx("button",{onClick:i,className:`flex items-center justify-center rounded-none p-2 transition-all duration-200 ${o?"bg-[#170F4F] text-white":"border border-[#E8E7EE] text-[#170F4F] hover:bg-[#F5F5F7]"} `,title:"Toggle Data Playground",children:h.jsx(_.FiDatabase,{className:"h-4 w-4"})}),h.jsx("button",{onClick:n,className:"flex items-center justify-center rounded-none border border-[#E8E7EE] p-2 text-[#170F4F] transition-colors hover:bg-[#F5F5F7]",title:"Download",children:h.jsx(_.FiDownload,{className:"h-4 w-4"})}),h.jsx("button",{onClick:s,className:"flex items-center justify-center rounded-none bg-[#170F4F] p-2 text-white transition-colors hover:bg-[#00BAC7]",title:"Open in New Tab",children:h.jsx(_.FiExternalLink,{className:"h-4 w-4"})})]})]})}),s3=({isOpen:t,onToggle:e,children:r,side:n="right",minWidth:s=350,maxWidth:o=700,defaultWidth:i=450,showToggleButton:a=!0,toggleButtonLabel:l="Toggle",resizable:c=!0,showOverlay:d=!0})=>{const[f,m]=S.useState(i),[g,y]=S.useState(!1),v=S.useRef(null),w=S.useRef(null),D=S.useRef(0),E=S.useRef(0),N=S.useCallback(z=>{c&&(y(!0),D.current=z.clientX,E.current=f,z.preventDefault())},[f,c]),A=S.useCallback(z=>{if(!g)return;const I=n==="right"?D.current-z.clientX:z.clientX-D.current,q=Math.min(o,Math.max(s,E.current+I));m(q)},[g,n,s,o]),T=S.useCallback(()=>{y(!1)},[]);S.useEffect(()=>{if(g)return document.addEventListener("mousemove",A),document.addEventListener("mouseup",T),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",T),document.body.style.cursor="",document.body.style.userSelect=""}},[g,A,T]);const j=t?"translate-x-0":n==="right"?"translate-x-full":"-translate-x-full",B=n==="right"?"border-l":"border-r",$=n==="right"?"right-0":"left-0",O=n==="right"?"left-0":"right-0";return h.jsxs(h.Fragment,{children:[t&&d&&h.jsx("div",{className:"absolute inset-0 z-[90] bg-transparent",onClick:e}),h.jsxs("div",{ref:v,className:`absolute bottom-0 top-0 z-[100] flex flex-col border-[#E8E7EE] bg-white shadow-2xl transition-transform duration-300 ease-in-out ${B} ${$} ${j}`,style:{width:`${f}px`},children:[c&&h.jsx("div",{ref:w,className:`absolute bottom-0 top-0 w-1 cursor-col-resize transition-colors duration-200 hover:bg-[#00BAC7] ${g?"bg-[#00BAC7]":"bg-transparent"} group ${O}`,onMouseDown:N,children:h.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform opacity-0 transition-opacity group-hover:opacity-100",children:h.jsx(_.FiMoreVertical,{className:"h-3 w-3 text-[#A29FB9]"})})}),a&&!t&&h.jsxs("button",{onClick:e,className:`group absolute top-1/2 z-10 flex -translate-y-1/2 items-center gap-2 border border-[#E8E7EE] bg-white px-2 py-6 text-sm font-medium text-[#170F4F] shadow-lg transition-all hover:bg-[#F5F5F7] ${n==="right"?"right-full rounded-l-lg border-r-0":"left-full rounded-r-lg border-l-0"}`,style:{writingMode:"vertical-rl"},children:[n==="right"?h.jsx(_.FiChevronLeft,{className:"h-4 w-4",style:{writingMode:"horizontal-tb"}}):h.jsx(_.FiChevronRight,{className:"h-4 w-4",style:{writingMode:"horizontal-tb"}}),h.jsx("span",{children:l})]}),r]})]})},o3=["eq","ne","gt","lt"],i3=({placeholders:t,onPlaceholdersChange:e})=>{const{template:r}=Pn(),n=S.useMemo(()=>{const l=[...r.content.matchAll(/\{\{(.*?)\}\}/g)].map(d=>d[1].trim()).map(d=>d.startsWith("#if ")?d.slice(4).trim():d),c=new Set;return l.forEach(d=>{if(d==="/if"||d==="else")return;const f=d.split(/\s+/);f.length===1?c.add(f[0]):f.forEach((m,g)=>{if(o3.includes(m.replace(/[()"]/g,""))&&f[g+1]){const y=f[g+1];c.add(y)}})}),[...c]},[r.content]),s=Fe.getAllSchemas(t).map(l=>l.key),o=n.filter(l=>!s.includes(l)),i=l=>{const c={key:l,label:l,type:"text",value:"Sample text"};e(d=>Fe.setByPath(d,l,c))},a=S.useMemo(()=>{const l=Math.ceil(o.length/3);return[o.slice(0,l),o.slice(l,l*2),o.slice(l*2)].filter(c=>c.length>0)},[o]);return h.jsx("div",{className:"mt-2 max-h-32 space-y-2 overflow-x-auto pb-2",children:a.map((l,c)=>h.jsx("div",{className:"flex flex-row gap-2",children:l.map(d=>h.jsx("span",{onClick:()=>i(d),className:"inline-flex flex-shrink-0 cursor-pointer items-center rounded-none bg-[#170F4F] bg-opacity-100 px-3 py-1 text-sm font-medium text-white transition-colors hover:bg-[#00BAC7]",children:d},d))},c))})},a3=({isOpen:t,onToggle:e,placeholders:r,onPlaceholdersChange:n})=>{const{template:s}=Pn(),[o,i]=S.useState({type:"text"}),[a,l]=S.useState(!1),[c,d]=S.useState(""),[f,m]=S.useState(null),[g,y]=S.useState(null),v=S.useMemo(()=>Fe.getAllSchemas(r),[r]),[w,D]=S.useState(v.length===0),E=S.useMemo(()=>{if(!c)return v;const I=c.toLowerCase();return v.filter(q=>q.key.toLowerCase().includes(I)||q.label.toLowerCase().includes(I))},[v,c]),N=(I,q)=>{n(J=>{const K=Fe.getByPath(J,I);return Fe.isSchema(K)?Fe.setByPath(J,I,{...K,value:q}):Fe.setByPath(J,I,q)})},A=()=>{if(!o.key||!o.label||!o.type)return;const I={key:o.key,label:o.label,type:o.type,value:o.value||T(o.type),options:o.options};n({...r,[I.key]:I}),i({type:"text"}),l(!1)},T=I=>{switch(I){case"text":return"Sample text";case"number":return 0;case"boolean":return!1;case"date":return new Date().toISOString().split("T")[0];case"enum":return"";default:return""}},j=I=>{n(q=>Fe.deleteByPath(q,I))},B=(I,q)=>{n(J=>{const K=Fe.getByPath(J,I);if(!Fe.isSchema(K))return J;const ae={...K,type:q,value:T(q),options:q==="enum"?K.options||[]:void 0};return Fe.setByPath(J,I,ae)}),m(null)},$=(I,q)=>{n(J=>{const K=Fe.getByPath(J,I);if(!Fe.isSchema(K))return J;const ae={...K,options:q};return Fe.setByPath(J,I,ae)})},O=I=>{switch(I){case"boolean":return"True/False";case"enum":return"Multiple Choice";case"text":return"Text";case"number":return"Number";case"date":return"Date"}},z=I=>{const q=Fe.getByPath(r,I.key),J=Fe.isSchema(q)?q.value:q??I.value??"";switch(I.type){case"text":return h.jsx("input",{type:"text",value:String(J),onChange:K=>N(I.key,K.target.value),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",placeholder:"Enter text here..."});case"number":return h.jsx("input",{type:"number",value:Number(J),onChange:K=>N(I.key,parseFloat(K.target.value)||0),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",placeholder:"Enter a number..."});case"boolean":return h.jsxs("div",{className:"flex items-center gap-4 rounded-none border border-[#E8E7EE] bg-white p-3",children:[h.jsxs("label",{className:"flex cursor-pointer items-center",children:[h.jsx("input",{type:"radio",name:`${I.key}-bool`,checked:!!J,onChange:()=>N(I.key,!0),className:"h-4 w-4 border-[#E8E7EE] text-[#170F4F] focus:ring-2 focus:ring-[#170F4F]"}),h.jsx("span",{className:"ml-2 text-sm font-medium text-[#170F4F]",children:"Yes"})]}),h.jsxs("label",{className:"flex cursor-pointer items-center",children:[h.jsx("input",{type:"radio",name:`${I.key}-bool`,checked:!J,onChange:()=>N(I.key,!1),className:"h-4 w-4 border-[#E8E7EE] text-[#170F4F] focus:ring-2 focus:ring-[#170F4F]"}),h.jsx("span",{className:"ml-2 text-sm font-medium text-[#170F4F]",children:"No"})]})]});case"enum":return h.jsxs("select",{value:String(J),onChange:K=>N(I.key,K.target.value),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",children:[h.jsx("option",{value:"",children:"Choose an option..."}),I.options?.map((K,ae)=>typeof K=="string"?h.jsx("option",{value:K,children:K},ae):h.jsx("option",{value:String(K.value),children:K.label},ae))]});case"date":return h.jsx("input",{type:"date",value:String(J),onChange:K=>N(I.key,K.target.value),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]"});default:return null}};return h.jsxs(s3,{isOpen:t,onToggle:e,side:"right",minWidth:350,maxWidth:700,defaultWidth:450,toggleButtonLabel:`Data (${v.length})`,resizable:!0,children:[h.jsxs("div",{className:"flex-shrink-0 border-b border-[#E8E7EE] bg-white px-6 py-4",children:[h.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[h.jsx("h3",{className:"text-lg font-semibold text-[#170F4F]",children:"Placeholders"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 rounded-none bg-[#170F4F] px-4 py-2 text-sm font-medium text-white shadow-sm transition-all duration-200 hover:bg-[#00BAC7] hover:shadow-md disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-[#170F4F] disabled:hover:shadow-sm",disabled:a,children:[h.jsx(_.FiPlus,{className:"h-4 w-4"}),"Add"]}),h.jsx("button",{onClick:e,className:"flex items-center justify-center rounded-none p-2 text-[#170F4F] transition-colors hover:bg-[#F5F5F7]",title:"Close drawer",children:h.jsx(_.FiChevronRight,{className:"h-5 w-5"})})]})]}),h.jsx("p",{className:"mb-4 text-sm text-[#A29FB9]",children:"Customize the content that appears in your template."}),v.length>8&&h.jsx("div",{className:"mb-4",children:h.jsx("input",{type:"text",value:c,onChange:I=>d(I.target.value),placeholder:"Search placeholders...",className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]"})}),(()=>{const I=[...new Set([...(s?.content||"").matchAll(/\{\{(.*?)\}\}/g)].map(K=>K[1]))],q=v.map(K=>K.key),J=I.filter(K=>!q.includes(K));return J.length>0?h.jsxs("div",{className:"rounded-none border border-[#E8E7EE] bg-[#F9F8FE]",children:[h.jsxs("button",{onClick:()=>D(!w),className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-[#F5F5F7]",children:[h.jsxs("p",{className:"text-xs font-semibold text-[#170F4F]",children:["Suggested Placeholders (",J.length,")"]}),w?h.jsx(_.FiChevronDown,{className:"h-4 w-4 text-[#170F4F]"}):h.jsx(_.FiChevronRight,{className:"h-4 w-4 text-[#170F4F]"})]}),h.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${w?"max-h-96 opacity-100":"max-h-0 opacity-0"}`,children:h.jsx("div",{className:"px-3 pb-3",children:h.jsx(i3,{placeholders:r,onPlaceholdersChange:n})})})]}):null})(),a&&h.jsxs("div",{className:"mt-4 animate-fade-in rounded-none border border-[#E8E7EE] bg-white p-4 shadow-sm",children:[h.jsx("h4",{className:"mb-4 text-sm font-semibold text-[#170F4F]",children:"Add New Placeholder"}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-xs font-medium text-[#170F4F]",children:"Field Name"}),h.jsx("input",{type:"text",placeholder:"e.g., Customer Name",value:o.label||"",onChange:I=>{const q=I.target.value,J=q.replace(/[^a-zA-Z0-9\s]/g,"").replace(/\s+/g,"_").replace(/^_+|_+$/g,"");i({...o,label:q,key:J})},className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-xs font-medium text-[#170F4F]",children:"Data Type"}),h.jsxs("select",{value:o.type||"text",onChange:I=>i({...o,type:I.target.value}),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",children:[h.jsx("option",{value:"text",children:"Text"}),h.jsx("option",{value:"number",children:"Number"}),h.jsx("option",{value:"boolean",children:"True/False"}),h.jsx("option",{value:"enum",children:"Multiple Choice"}),h.jsx("option",{value:"date",children:"Date"})]})]})]}),h.jsxs("div",{className:"mt-6 flex gap-2 border-t border-[#E8E7EE] pt-4",children:[h.jsx("button",{onClick:A,disabled:!o.key||!o.label,className:"rounded-none bg-[#170F4F] px-4 py-2 text-sm font-medium text-white shadow-sm transition-colors duration-200 hover:bg-[#00BAC7] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-[#170F4F]",children:"Confirm"}),h.jsx("button",{onClick:()=>l(!1),className:"rounded-none border border-[#E8E7EE] px-4 py-2 text-sm font-medium text-[#A29FB9] transition-colors duration-200 hover:bg-[#F9F8FE] hover:text-[#170F4F]",children:"Cancel"})]})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:v.length===0?h.jsxs("div",{className:"py-12 text-center text-[#A29FB9]",children:[h.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE]",children:h.jsx(_.FiPlus,{className:"h-8 w-8 text-[#170F4F]"})}),h.jsx("h4",{className:"mb-2 text-lg font-medium text-[#170F4F]",children:"No data fields yet"}),h.jsx("p",{className:"mb-4 text-sm",children:"Add data fields to make your template dynamic"}),h.jsx("button",{onClick:()=>l(!0),className:"text-sm font-medium text-[#170F4F] transition-colors duration-200 hover:text-[#00BAC7]",children:"Add your first field"})]}):E.length===0?h.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:h.jsxs("p",{className:"text-sm text-[#A29FB9]",children:['No placeholders found matching "',c,'"']})}):h.jsx("div",{className:"space-y-2 pb-6",children:E.map(I=>h.jsxs("div",{className:"rounded-none border border-[#E8E7EE] bg-white p-4 transition-all duration-200 hover:border-[#170F4F] hover:shadow-sm",children:[h.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[h.jsx("div",{className:"min-w-0 flex-1",children:h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx("span",{className:"inline-flex items-center break-all rounded-none bg-[#170F4F] bg-opacity-100 px-2 py-[2px] text-sm font-medium text-white",children:I.key}),f===I.key?h.jsxs("select",{value:I.type,onChange:q=>B(I.key,q.target.value),onBlur:()=>m(null),autoFocus:!0,className:"inline-flex flex-shrink-0 items-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE] px-2 py-[2px] text-sm font-medium text-[#170F4F] transition-all hover:border-[#170F4F] focus:border-[#170F4F] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",children:[h.jsx("option",{value:"text",children:"Text"}),h.jsx("option",{value:"number",children:"Number"}),h.jsx("option",{value:"boolean",children:"True/False"}),h.jsx("option",{value:"enum",children:"Multiple Choice"}),h.jsx("option",{value:"date",children:"Date"})]}):h.jsx("button",{onClick:()=>m(I.key),className:"inline-flex flex-shrink-0 items-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE] px-2 py-[2px] text-sm font-medium text-[#170F4F] transition-all hover:border-[#170F4F] hover:bg-white",children:O(I.type)})]})}),h.jsx("button",{onClick:()=>j(I.key),className:"flex-shrink-0 rounded-none p-1 text-[#A29FB9] transition-colors duration-200 hover:bg-red-50 hover:text-red-500",title:"Remove field",children:h.jsx(_.FiTrash2,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"w-full",children:z(I)}),I.type==="enum"&&h.jsxs("div",{className:"mt-3 border-t border-[#E8E7EE] pt-3",children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("label",{className:"text-xs font-medium text-[#170F4F]",children:"Options"}),g!==I.key&&h.jsx("button",{onClick:()=>y(I.key),className:"text-xs font-medium text-[#170F4F] transition-colors hover:text-[#00BAC7]",children:"Edit options"})]}),g===I.key?h.jsxs("div",{className:"space-y-2",children:[(I.options||[]).map((q,J)=>{const K=typeof q=="string"?q:String(q.value);return h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:K,onChange:ae=>{const tt=[...I.options||[]];tt[J]=ae.target.value,$(I.key,tt)},className:"flex-1 rounded-none border border-[#E8E7EE] bg-white px-2 py-1 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"Option value"}),h.jsx("button",{onClick:()=>{const ae=(I.options||[]).filter((tt,mt)=>mt!==J);$(I.key,ae)},className:"rounded-none p-1 text-[#A29FB9] transition-colors hover:bg-red-50 hover:text-red-500",title:"Remove option",children:h.jsx(_.FiTrash2,{className:"h-4 w-4"})})]},J)}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("button",{onClick:()=>{const q=[...I.options||[],""];$(I.key,q)},className:"flex items-center gap-1 rounded-none border border-[#E8E7EE] bg-white px-2 py-1 text-xs font-medium text-[#170F4F] transition-colors hover:bg-[#F9F8FE]",children:[h.jsx(_.FiPlus,{className:"h-3 w-3"}),"Add option"]}),h.jsx("button",{onClick:()=>y(null),className:"rounded-none px-2 py-1 text-xs font-medium text-[#A29FB9] transition-colors hover:text-[#170F4F]",children:"Done"})]})]}):h.jsx("div",{className:"flex flex-wrap gap-1",children:(I.options||[]).length===0?h.jsx("p",{className:"text-xs text-[#A29FB9]",children:"No options added yet"}):(I.options||[]).map((q,J)=>{const K=typeof q=="string"?q:q.label||q.value;return h.jsx("span",{className:"inline-flex items-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE] px-2 py-[2px] text-xs text-[#170F4F]",children:K},J)})})]})]})]},I.key))})})]})},l3=()=>{const[t,e]=S.useState([]),r=S.useCallback((s,o="success")=>{const i=Date.now().toString();return e(a=>[...a,{id:i,message:s,type:o}]),i},[]),n=S.useCallback(s=>{e(o=>o.filter(i=>i.id!==s))},[]);return{toasts:t,showToast:r,hideToast:n}},Bh={[Pr.TemplateFormat.HTML]:{extension:"html",mimeType:"text/html"},[Pr.TemplateFormat.TEXT]:{extension:"txt",mimeType:"text/plain"},[Pr.TemplateFormat.PDF]:{extension:"pdf",mimeType:"application/pdf"}};class u3{static downloadFile(e,r){const n=URL.createObjectURL(e),s=document.createElement("a");s.href=n,s.download=r,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)}static getFileName(e,r){return`${e?.title||e.slug||"bolttech-page"}.${r}`}static html(e,r){const n=e.compile?e.compile(r):e.content,s=this.getFileName(e,"html"),o=new Blob([n],{type:"text/html"});this.downloadFile(o,s)}static async pdf(e,r){const n=await e.render(r),s=n instanceof Blob?n:new Blob([new Uint8Array(n)],{type:"application/pdf"}),o=this.getFileName(e,"pdf");this.downloadFile(s,o)}static async download(e,r){if(!e.format)throw new Error("Template format is missing. Please set a format for this template before downloading.");const n=Bh[e.format];if(!n)throw new Error(`Unsupported template format: ${e.format}. Supported formats: ${Object.keys(Bh).join(", ")}`);const{extension:s,mimeType:o}=n,i=await e.render(r),a=i instanceof Blob?i:new Blob([new Uint8Array(i)],{type:o}),l=this.getFileName(e,s);this.downloadFile(a,l)}}const c3=({message:t,type:e,onClose:r,duration:n=3e3})=>{const[s,o]=S.useState(!0),i=S.useMemo(()=>{const d=document.querySelector(".bolttech-template-editor");return d&&d.shadowRoot?d.shadowRoot:document.body},[]);S.useEffect(()=>{if(e!=="loading"&&n>0){const d=setTimeout(()=>{o(!1),setTimeout(r,300)},n);return()=>clearTimeout(d)}},[e,n,r]);const a=()=>{switch(e){case"loading":return h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#170F4F]",children:h.jsx(_.FiDownload,{className:"h-5 w-5 animate-pulse text-white"})});case"success":return h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#00BAC7]",children:h.jsx(_.FiCheck,{className:"h-5 w-5 text-white"})});case"error":return h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#FF3B30]",children:h.jsx(_.FiAlertCircle,{className:"h-5 w-5 text-white"})})}},l=()=>{switch(e){case"loading":return"Downloading...";case"success":return"Success";case"error":return"Error"}},c=h.jsxs("div",{className:`absolute bottom-4 right-4 z-[10000] flex min-w-[320px] items-center gap-3 rounded-none border border-[#E8E7EE] bg-white px-4 py-3 shadow-lg transition-all duration-300 ${s?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"}`,children:[a(),h.jsxs("div",{className:"flex flex-1 flex-col gap-0.5",children:[h.jsx("span",{className:"text-sm font-semibold text-[#170F4F]",children:l()}),h.jsx("span",{className:"text-sm text-[#A29FB9]",children:t})]}),e!=="loading"&&h.jsx("button",{onClick:()=>{o(!1),setTimeout(r,300)},className:"rounded-none p-1 text-[#A29FB9] transition-colors hover:bg-[#F5F5F7] hover:text-[#170F4F]",children:h.jsx(_.FiX,{className:"h-4 w-4"})})]});return Ei.createPortal(c,i)},sl={desktop:{width:1200,height:800,name:"Desktop"},tablet:{width:768,height:1024,name:"Tablet"},mobile:{width:375,height:667,name:"Mobile"}},d3=({isPreviewMode:t,onExitPreview:e,initialPlaceholders:r={}})=>{const{getState:n,device:s,setDevice:o,isEmpty:i}=Fi(),{convertToHtml:a}=Zl(),{template:l}=Pn(),{toasts:c,showToast:d,hideToast:f}=l3(),[m,g]=S.useState(!1),[y,v]=S.useState(100),[w,D]=S.useState(!1),[E,N]=S.useState(r),A=S.useMemo(()=>{const O=document.querySelector(".bolttech-template-editor");return O&&O.shadowRoot?O.shadowRoot:document.body},[]),T=()=>{g(!0),setTimeout(()=>{e(),g(!1)},300)},j=async()=>{const O=d("Preparing download...","loading");try{const z=Fe.resolve(E);await u3.download(l,z),f(O),d("Download completed successfully!","success")}catch(z){f(O);const I=z instanceof Error?z.message:"Unknown error";d(`Failed to download: ${I}`,"error"),console.error("Error downloading file:",z)}},B=()=>{D(!w)};if(!t)return null;const $=h.jsxs("div",{className:`absolute inset-0 z-50 bg-[#F5F5F7] ${m?"animate-fade-out":"animate-fade-in"}`,children:[h.jsx("div",{className:m?"animate-slide-up-out":"animate-slide-down",children:h.jsx(n3,{canvasSize:s,onCanvasSizeChange:o,onExitPreview:T,onDownload:j,onOpenInNewTab:()=>{window.open()?.document.write(a(n()))},showPlayground:w,onTogglePlayground:B})}),h.jsxs("div",{className:"relative flex h-full overflow-hidden",children:[h.jsx("div",{className:m?"animate-slide-down-out":"animate-slide-up",style:{flex:1},children:h.jsx(r3,{canvasSize:s,hasCanvasContent:i,onZoomChange:v,placeholderData:E})}),h.jsx(a3,{isOpen:w,onToggle:B,placeholders:E,onPlaceholdersChange:N})]}),h.jsxs("div",{className:"absolute bottom-4 left-4 z-[60] rounded-none bg-[#170F4F] px-3 py-2 text-sm text-white shadow-md",children:[sl[s].name," • ",sl[s].width,"×",sl[s].height,"px • ",y.toFixed(3),"%"]}),c.map(O=>h.jsx(c3,{message:O.message,type:O.type,onClose:()=>f(O.id)},O.id))]});return Ei.createPortal($,A)},p3=({message:t="Loading...",size:e="md",fullScreen:r=!1})=>{const n={sm:"h-10 w-10",md:"h-16 w-16",lg:"h-24 w-24"},s=r?"fixed inset-0 z-50 flex items-center justify-center bg-white":"flex items-center justify-center";return h.jsx("div",{className:s,children:h.jsxs("div",{className:"flex flex-col items-center gap-6",children:[h.jsxs("div",{className:`relative ${n[e]}`,role:"status","aria-label":t,children:[h.jsx("div",{className:"absolute inset-0 animate-spin rounded-full border-4 border-border border-t-primary",style:{animationDuration:"1s"}}),h.jsx("div",{className:"absolute inset-2 animate-spin rounded-full border-4 border-border border-t-secondary",style:{animationDuration:"1.5s",animationDirection:"reverse"}})]}),t&&h.jsxs("div",{className:"flex flex-col items-center gap-3",children:[h.jsx("p",{className:"text-sm font-medium text-primary",children:t}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-primary",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-secondary",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-accent",style:{animationDelay:"300ms"}})]})]})]})})},h3=Rs.reduce((t,e)=>(t[e.id]=e.component,t),{}),f3=({placeholders:t={}})=>{const e=Wh(),{error:r,loading:n,template:s}=Pn(),[o,i]=S.useState(!0);if(n)return h.jsx(p3,{message:"Loading template...",fullScreen:!0});const a=()=>{window.history.back()},l=()=>{i(!1)};return h.jsxs(h.Fragment,{children:[r&&o&&h.jsx(XD,{templateId:s?.id,errorMessage:r,onContinue:l,onGoBack:a}),h.jsxs(Q.Editor,{resolver:h3,onRender:t3,enabled:e.isEditorEnabled,children:[h.jsx(XT,{onPreviewToggle:e.togglePreview,showCodePanel:e.showCodePanel,onCodePanelToggle:e.toggleCodePanel,codePanelChildren:h.jsx(YD,{onClose:e.closeCodePanel})}),h.jsx(d3,{isPreviewMode:e.showPreview,onExitPreview:()=>e.togglePreview(),initialPlaceholders:t})]})]})},m3='@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Arial,Helvetica,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 480px){.container{max-width:480px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1440px){.container{max-width:1440px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-2{inset:.5rem}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-0\\.5{right:-.125rem}.-top-0\\.5{top:-.125rem}.bottom-0{bottom:0}.bottom-1{bottom:.25rem}.bottom-4{bottom:1rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-3{left:.75rem}.left-4{left:1rem}.left-\\[75\\%\\]{left:75%}.left-auto{left:auto}.left-full{left:100%}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-auto{right:auto}.right-full{right:100%}.top-0{top:0}.top-1\\/2{top:50%}.top-2{top:.5rem}.top-\\[-2px\\]{top:-2px}.top-\\[-3px\\]{top:-3px}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.z-\\[10000\\]{z-index:10000}.z-\\[100\\]{z-index:100}.z-\\[60\\]{z-index:60}.z-\\[90\\]{z-index:90}.z-\\[9999\\]{z-index:9999}.mx-1\\.5{margin-left:.375rem;margin-right:.375rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-\\[8px\\]{margin-bottom:8px}.ml-0{margin-left:0}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-1\\.5{margin-right:.375rem}.mr-2\\.5{margin-right:.625rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1{height:.25rem}.h-1\\.5{height:.375rem}.h-10{height:2.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\\[26px\\]{height:26px}.h-\\[400px\\]{height:400px}.h-\\[90vh\\]{height:90vh}.h-full{height:100%}.h-px{height:1px}.max-h-0{max-height:0px}.max-h-32{max-height:8rem}.max-h-96{max-height:24rem}.max-h-\\[42vh\\]{max-height:42vh}.min-h-\\[80px\\]{min-height:80px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\\.5{width:.375rem}.w-1\\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-80{width:20rem}.w-\\[10\\%\\]{width:10%}.w-\\[20\\%\\]{width:20%}.w-\\[26px\\]{width:26px}.w-\\[90\\%\\]{width:90%}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\\[120px\\]{min-width:120px}.min-w-\\[140px\\]{min-width:140px}.min-w-\\[180px\\]{min-width:180px}.min-w-\\[320px\\]{min-width:320px}.max-w-6xl{max-width:72rem}.max-w-\\[40vw\\]{max-width:40vw}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}.animate-fade-in{animation:fadeIn .4s ease-out}.animate-fade-out{animation:fadeOut .3s ease-in}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.animate-slide-down{animation:slideDown .5s ease-out .1s both}.animate-slide-down-out{animation:slideDownOut .3s ease-in both}.animate-slide-up{animation:slideUp .5s ease-out .2s both}.animate-slide-up-out{animation:slideUpOut .3s ease-in both}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0\\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:8px}.rounded-md{border-radius:4px}.rounded-none{border-radius:0}.rounded-sm{border-radius:2px}.rounded-l-lg{border-top-left-radius:8px;border-bottom-left-radius:8px}.rounded-r-lg{border-top-right-radius:8px;border-bottom-right-radius:8px}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\\[\\#00BAC7\\]{--tw-border-opacity: 1;border-color:rgb(0 186 199 / var(--tw-border-opacity, 1))}.border-\\[\\#170F4F\\],.border-\\[\\#170f4f\\]{--tw-border-opacity: 1;border-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.border-\\[\\#30aab3\\]{--tw-border-opacity: 1;border-color:rgb(48 170 179 / var(--tw-border-opacity, 1))}.border-\\[\\#3B82F6\\]{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-\\[\\#D1D5DB\\]{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-\\[\\#E8E7EE\\]{--tw-border-opacity: 1;border-color:rgb(232 231 238 / var(--tw-border-opacity, 1))}.border-\\[\\#dce7fe\\]{--tw-border-opacity: 1;border-color:rgb(220 231 254 / var(--tw-border-opacity, 1))}.border-\\[\\#e8e7ee\\]{--tw-border-opacity: 1;border-color:rgb(232 231 238 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-border{--tw-border-opacity: 1;border-color:rgb(232 231 238 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-t-primary{--tw-border-opacity: 1;border-top-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.border-t-secondary{--tw-border-opacity: 1;border-top-color:rgb(48 170 179 / var(--tw-border-opacity, 1))}.bg-\\[\\#00BAC7\\]{--tw-bg-opacity: 1;background-color:rgb(0 186 199 / var(--tw-bg-opacity, 1))}.bg-\\[\\#170F4F\\]{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.bg-\\[\\#170F4F\\]\\/10{background-color:#170f4f1a}.bg-\\[\\#170f4f\\]{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.bg-\\[\\#181c24\\]{--tw-bg-opacity: 1;background-color:rgb(24 28 36 / var(--tw-bg-opacity, 1))}.bg-\\[\\#23272f\\]{--tw-bg-opacity: 1;background-color:rgb(35 39 47 / var(--tw-bg-opacity, 1))}.bg-\\[\\#CCF1F4\\]{--tw-bg-opacity: 1;background-color:rgb(204 241 244 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E8E7EE\\]{--tw-bg-opacity: 1;background-color:rgb(232 231 238 / var(--tw-bg-opacity, 1))}.bg-\\[\\#EFF6FF\\]{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F5F5F7\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 247 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F9F8FE\\]{--tw-bg-opacity: 1;background-color:rgb(249 248 254 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F9FAFB\\]{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-\\[\\#FF3B30\\]{--tw-bg-opacity: 1;background-color:rgb(255 59 48 / var(--tw-bg-opacity, 1))}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(255 202 48 / var(--tw-bg-opacity, 1))}.bg-background-light{--tw-bg-opacity: 1;background-color:rgb(245 245 247 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\\/50{background-color:#00000080}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-50\\/50{background-color:#f9fafb80}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-secondary{--tw-bg-opacity: 1;background-color:rgb(48 170 179 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-opacity-100{--tw-bg-opacity: 1}.bg-opacity-40{--tw-bg-opacity: .4}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-gray-100{--tw-gradient-from: #f3f4f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(243 244 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-200{--tw-gradient-to: #e5e7eb var(--tw-gradient-to-position)}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\\[2px\\]{padding:2px}.px-0\\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\\[2px\\]{padding-top:2px;padding-bottom:2px}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-6{padding-bottom:1.5rem}.pb-8{padding-bottom:2rem}.pl-9{padding-left:2.25rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-9{padding-right:2.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\\[10px\\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-wide{letter-spacing:2px}.text-\\[\\#00BAC7\\]{--tw-text-opacity: 1;color:rgb(0 186 199 / var(--tw-text-opacity, 1))}.text-\\[\\#170F4F\\],.text-\\[\\#170f4f\\]{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.text-\\[\\#3B82F6\\]{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-\\[\\#6B7280\\]{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-\\[\\#A29FB9\\]{--tw-text-opacity: 1;color:rgb(162 159 185 / var(--tw-text-opacity, 1))}.text-\\[\\#FF3B30\\]{--tw-text-opacity: 1;color:rgb(255 59 48 / var(--tw-text-opacity, 1))}.text-\\[\\#FF9500\\]{--tw-text-opacity: 1;color:rgb(255 149 0 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted{--tw-text-opacity: 1;color:rgb(162 159 185 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-text{--tw-text-opacity: 1;color:rgb(53 65 86 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px rgba(0, 0, 0, .15);--tw-shadow-colored: 0 10px 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px rgba(0, 0, 0, .1);--tw-shadow-colored: 0 4px 6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px rgba(0, 0, 0, .05);--tw-shadow-colored: 0 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-yellow-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(253 224 71 / var(--tw-ring-opacity, 1))}.ring-yellow-400{--tw-ring-opacity: 1;--tw-ring-color: rgb(250 204 21 / var(--tw-ring-opacity, 1))}.ring-opacity-50{--tw-ring-opacity: .5}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.avoid-transition,.avoid-transition *{transition:none!important}#canvas,#canvas *{transition:width .3s ease-in-out,height .3s ease-in-out,max-width .3s ease-in-out}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes slideDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideUpOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes slideDownOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}@keyframes slideInRight{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}@keyframes slideOutRight{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(100%)}}.tiptap-global{border:1px solid #e8e7ee;padding:4px}#canvas ul,#canvas ol{padding:0 1rem;margin:1.25rem 1rem 1.25rem .4rem}#canvas ul li p,#canvas ol li p{margin-top:.25em;margin-bottom:.25em}#canvas ul{list-style:circle}#canvas ol{list-style:decimal}#canvas{h1,h2,h3,h4,h5,h6{line-height:1.1;text-wrap:pretty}h1,h2{margin-bottom:1.5rem}h1{font-size:1.4rem}h2{font-size:1.2rem}h3{font-size:1.1rem}h4,h5,h6{font-size:1rem}}.tiptap{:first-child{margin-top:0}padding:4px;min-height:100px;ul,ol{padding:0 1rem;margin:1.25rem 1rem 1.25rem .4rem;li p{margin-top:.25em;margin-bottom:.25em}}ul{list-style:circle}ol{list-style:decimal}h1,h2,h3,h4,h5,h6{line-height:1.1;text-wrap:pretty}h1,h2{margin-bottom:1.5rem}h1{font-size:1.4rem}h2{font-size:1.2rem}h3{font-size:1.1rem}h4,h5,h6{font-size:1rem}}.last\\:mb-0:last-child{margin-bottom:0}.hover\\:border-\\[\\#00BAC7\\]:hover{--tw-border-opacity: 1;border-color:rgb(0 186 199 / var(--tw-border-opacity, 1))}.hover\\:border-\\[\\#170F4F\\]:hover{--tw-border-opacity: 1;border-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.hover\\:border-\\[\\#170F4F\\]\\/30:hover{border-color:#170f4f4d}.hover\\:border-\\[\\#30aab3\\]:hover{--tw-border-opacity: 1;border-color:rgb(48 170 179 / var(--tw-border-opacity, 1))}.hover\\:border-red-300:hover{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.hover\\:bg-\\[\\#009CA8\\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 156 168 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#00BAC7\\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 186 199 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#170F4F\\]:hover{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#170F4F\\]\\/15:hover{background-color:#170f4f26}.hover\\:bg-\\[\\#30aab3\\]:hover{--tw-bg-opacity: 1;background-color:rgb(48 170 179 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#CCF1F4\\]:hover{--tw-bg-opacity: 1;background-color:rgb(204 241 244 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#F5F5F7\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 247 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#F9F8FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(249 248 254 / var(--tw-bg-opacity, 1))}.hover\\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\\:bg-secondary:hover{--tw-bg-opacity: 1;background-color:rgb(48 170 179 / var(--tw-bg-opacity, 1))}.hover\\:bg-surface:hover{--tw-bg-opacity: 1;background-color:rgb(243 242 247 / var(--tw-bg-opacity, 1))}.hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\\:text-\\[\\#00BAC7\\]:hover{--tw-text-opacity: 1;color:rgb(0 186 199 / var(--tw-text-opacity, 1))}.hover\\:text-\\[\\#170F4F\\]:hover,.hover\\:text-\\[\\#170f4f\\]:hover{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.hover\\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\\:text-gray-300:hover{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\\:shadow-md:hover{--tw-shadow: 0 4px 6px rgba(0, 0, 0, .1);--tw-shadow-colored: 0 4px 6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:shadow-sm:hover{--tw-shadow: 0 1px 2px rgba(0, 0, 0, .05);--tw-shadow-colored: 0 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\\:ring-gray-300:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1))}.hover\\:ring-yellow-300:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(253 224 71 / var(--tw-ring-opacity, 1))}.hover\\:ring-opacity-50:hover{--tw-ring-opacity: .5}.focus\\:border-\\[\\#170F4F\\]:focus{--tw-border-opacity: 1;border-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.focus\\:bg-\\[\\#F9F8FE\\]:focus{--tw-bg-opacity: 1;background-color:rgb(249 248 254 / var(--tw-bg-opacity, 1))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-inset:focus{--tw-ring-inset: inset}.focus\\:ring-\\[\\#170F4F\\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(23 15 79 / var(--tw-ring-opacity, 1))}.focus\\:ring-\\[\\#170F4F\\]\\/20:focus{--tw-ring-color: rgb(23 15 79 / .2)}.focus\\:ring-\\[\\#30aab3\\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(48 170 179 / var(--tw-ring-opacity, 1))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.disabled\\:bg-gray-50:disabled{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.disabled\\:text-gray-300:disabled{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.disabled\\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.disabled\\:text-gray-600:disabled{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.disabled\\:opacity-30:disabled{opacity:.3}.disabled\\:opacity-40:disabled{opacity:.4}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:opacity-60:disabled{opacity:.6}.disabled\\:hover\\:bg-\\[\\#170F4F\\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.disabled\\:hover\\:shadow-sm:hover:disabled{--tw-shadow: 0 1px 2px rgba(0, 0, 0, .05);--tw-shadow-colored: 0 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group:hover .group-hover\\:block{display:block}.group:hover .group-hover\\:text-\\[\\#170F4F\\]{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.group:hover .group-hover\\:opacity-100{opacity:1}@media (min-width: 768px){.sm\\:inline{display:inline}.sm\\:hidden{display:none}.sm\\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 900px){.min-\\[900px\\]\\:inline{display:inline}}';function T0({templateId:t,placeholders:e={},sdk:r={baseUrl:"",workspace:""},width:n="100%",height:s="100%"}){return h.jsxs(q2.default.div,{className:"bolttech-template-editor",style:{height:s,width:n,position:"relative",overflow:"hidden"},children:[h.jsx("style",{type:"text/css",children:m3}),h.jsx(JD,{templateId:t,baseUrl:r.baseUrl,workspace:r.workspace,children:h.jsx(f3,{placeholders:e})})]})}const ol=({name:t,value:e,path:r,onSelect:n,isSelected:s})=>{const o=typeof e=="object"&&e!==null&&!Array.isArray(e),i=Array.isArray(e),a=()=>e===null?"null":e===void 0?"undefined":typeof e=="string"?`"${e}"`:typeof e=="number"||typeof e=="boolean"?String(e):i?`Array(${e.length})`:o?`Object(${Object.keys(e).length})`:String(e),l=()=>e===null?"null":e===void 0?"undefined":typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":i?"array":o?"object":typeof e;return h.jsxs("button",{onClick:()=>n(r,e),className:`flex min-w-[120px] flex-col items-center gap-1 rounded-none border border-[#e8e7ee] p-3 transition-all duration-200 ${s?"border-[#30aab3] bg-[#170f4f] text-white":"bg-white text-[#170f4f] hover:border-[#30aab3] hover:bg-gray-50"}`,children:[h.jsx("div",{className:"text-xs font-medium",children:t}),h.jsx("div",{className:`text-xs ${l()==="string"?"text-green-600":l()==="number"?"text-blue-600":l()==="boolean"?"text-purple-600":l()==="null"?"text-gray-500":"text-orange-600"} ${s?"text-white":""}`,children:a()}),h.jsxs("div",{className:`text-xs ${s?"text-gray-300":"text-gray-400"}`,children:["(",l(),")"]})]})},M0=({data:t,onPathSelect:e})=>{const[r,n]=S.useState([]),[s,o]=S.useState(null),[i,a]=S.useState(!1),l=(y,v)=>v.reduce((w,D)=>{if(w!=null){if(D.startsWith("[")&&D.endsWith("]")){const E=parseInt(D.slice(1,-1),10);return w[E]}return w[D]}},y),d=(()=>{const y=[];let v=[],w=t;y.push({path:[],value:t,isRoot:!0});for(const D of r)v=[...v,D],w=l(t,v),w!=null&&typeof w=="object"&&y.push({path:[...v],value:w,isRoot:!1});return y})(),f=(y,v,w)=>{if(typeof w=="object"&&w!==null&&(n(D=>[...D.slice(0,y),v]),e)){const D=[...d[y].path,v];e(D.join("."))}},m=(y,v,w)=>{if(typeof w!="object"||w===null){if(o({path:[...d[y].path,v],value:w}),e){const D=[...d[y].path,v];e(D.join("."))}}else o(null)},g=(y,v)=>{const w=y.value;return y.isRoot?h.jsx("div",{className:"flex min-w-[140px] flex-col gap-2",children:Object.entries(t).map(([D,E])=>h.jsx(ol,{name:D,value:E,path:D,onSelect:(N,A)=>typeof A=="object"&&A!==null?f(0,D,A):m(0,D,A),isSelected:r.length===0},D))},v):Array.isArray(w)?h.jsx("div",{className:"flex min-w-[140px] flex-col gap-2",children:w.map((D,E)=>h.jsx(ol,{name:`[${E}]`,value:D,path:`[${E}]`,onSelect:(N,A)=>typeof A=="object"&&A!==null?f(v,`[${E}]`,A):m(v,`[${E}]`,A),isSelected:!1},E))},v):typeof w=="object"&&w!==null?h.jsx("div",{className:"flex min-w-[140px] flex-col gap-2",children:Object.entries(w).map(([D,E])=>h.jsx(ol,{name:D,value:E,path:D,onSelect:(N,A)=>typeof A=="object"&&A!==null?f(v,D,A):m(v,D,A),isSelected:!1},D))},v):null};return h.jsxs("div",{className:"overflow-x-auto rounded-none border border-[#e8e7ee] bg-white",children:[h.jsx("div",{className:"border-b border-[#e8e7ee] bg-gray-50 px-4 py-2",children:h.jsx("h3",{className:"text-sm font-medium text-[#170f4f]",children:"Data Structure"})}),h.jsxs("div",{className:"flex gap-6 overflow-x-auto p-4",children:[d.map((y,v)=>g(y,v)),s&&h.jsx("div",{className:"flex min-w-[180px] flex-col gap-2",children:h.jsxs("div",{className:"mt-2 rounded-none border border-[#e8e7ee] bg-gray-50 p-3",children:[h.jsx("h4",{className:"mb-1 text-xs font-medium text-gray-600",children:"Selected Value"}),h.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[h.jsx("span",{className:"font-medium",children:"Path:"})," ",s.path.join("."),h.jsx("button",{className:"ml-1 text-gray-400 hover:text-gray-600",onClick:()=>{navigator.clipboard.writeText(s.path.join(".")),a(!0),setTimeout(()=>a(!1),2e3)},title:"Copy path",children:i?h.jsx(_.FiCheck,{size:14}):h.jsx(_.FiCopy,{size:14})})]}),h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:"font-medium",children:"Value:"})," ",String(s.value)]}),h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:"font-medium",children:"Type:"})," ",typeof s.value]})]})})]})]})},g3=({isOpen:t,onClose:e,onDataImport:r})=>{const[n,s]=S.useState("url"),[o,i]=S.useState(""),[a,l]=S.useState(""),[c,d]=S.useState(""),[f,m]=S.useState(!1),[g,y]=S.useState(""),[v,w]=S.useState(!1),[D,E]=S.useState(null);S.useEffect(()=>{if(t){const O=localStorage.getItem("bolttech_datasource");if(O)try{const z=JSON.parse(O);z&&typeof z=="object"&&z.data&&(E(z.data),z.url&&l(z.url))}catch{}}},[t]);const N=O=>{const z=O.target.files?.[0];if(!z)return;if(!z.name.endsWith(".json")){y("Please select a JSON file");return}const I=new FileReader;I.onload=q=>{try{const J=q.target?.result,K=JSON.parse(J);i(J),E(K),y("")}catch{y("Invalid JSON file"),i(""),E(null)}},I.readAsText(z)},A=async()=>{if(!a.trim()){y("Please enter a URL");return}m(!0),y("");try{const O=await fetch(a);if(!O.ok)throw new Error("Failed to fetch data");const z=await O.json();d(JSON.stringify(z,null,2)),E(z),y("")}catch{y("Failed to fetch data from URL")}finally{m(!1)}},T=O=>{d(O),y("");try{if(O.trim()){const z=JSON.parse(O);E(z)}else E(null)}catch{y("Invalid JSON format"),E(null)}},j=()=>{let O;try{switch(n){case"file":if(!o){y("Please select a file");return}O=JSON.parse(o);break;case"url":if(!c){y("Please fetch data from URL first");return}O=JSON.parse(c);break;case"code":if(!c.trim()){y("Please enter JSON data");return}O=JSON.parse(c);break}n==="url"?localStorage.setItem("bolttech_datasource",JSON.stringify({from:n,data:O,url:a})):localStorage.setItem("bolttech_datasource",JSON.stringify({from:n,data:O})),r(O),e()}catch{y("Invalid JSON data")}},B=()=>{navigator.clipboard.writeText(c),w(!0),setTimeout(()=>w(!1),2e3)},$=()=>{try{return c.trim()?(JSON.parse(c),!0):!1}catch{return!1}};return t?h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:O=>{O.target===O.currentTarget&&e()},children:h.jsxs("div",{className:"flex h-[90vh] w-full max-w-6xl flex-col rounded-none bg-white shadow-xl",children:[h.jsxs("div",{className:"flex items-center justify-between border-b border-[#e8e7ee] bg-white p-6",children:[h.jsx("h2",{className:"text-lg font-bold tracking-wide text-[#170f4f]",children:"DataSource"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>{localStorage.removeItem("bolttech_datasource"),E(null),i(""),l(""),d("")},className:"rounded-none p-2 text-gray-400 transition-colors duration-200 hover:bg-red-50 hover:text-red-600",title:"Clean Data",children:"🧹"}),h.jsx("button",{onClick:e,className:"rounded-none p-2 text-gray-400 transition-colors duration-200 hover:bg-gray-50 hover:text-gray-600",children:h.jsx(_.FiX,{size:18})})]})]}),h.jsx("div",{className:"max-h-[42vh] overflow-y-auto border-b border-[#e8e7ee] px-6 py-4",children:h.jsx(M0,{data:{root:D||{}}})}),h.jsxs("div",{className:"flex border-b border-[#e8e7ee]",children:[h.jsxs("button",{onClick:()=>s("url"),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors duration-200 ${n==="url"?"border-b-2 border-[#30aab3] text-[#170f4f]":"text-gray-500 hover:text-[#170f4f]"}`,children:[h.jsx(_.FiLink,{size:16}),"URL"]}),h.jsxs("button",{onClick:()=>s("file"),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors duration-200 ${n==="file"?"border-b-2 border-[#30aab3] text-[#170f4f]":"text-gray-500 hover:text-[#170f4f]"}`,children:[h.jsx(_.FiUpload,{size:16}),"Import File"]}),h.jsxs("button",{onClick:()=>s("code"),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors duration-200 ${n==="code"?"border-b-2 border-[#30aab3] text-[#170f4f]":"text-gray-500 hover:text-[#170f4f]"}`,children:[h.jsx(_.FiCode,{size:16}),"Custom Code"]})]}),h.jsxs("div",{className:"flex-1 overflow-hidden p-6",children:[n==="code"&&h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx("div",{className:"mb-4",children:h.jsx("p",{className:"mb-1 text-sm text-gray-500",children:"Enter your JSON data below"})}),h.jsxs("div",{className:"flex-1 overflow-hidden rounded-none bg-gray-900",children:[h.jsxs("div",{className:"flex items-center justify-between border-b border-gray-700 bg-gray-800 px-4 py-2",children:[h.jsx("span",{className:"text-sm font-medium text-gray-300",children:"JSON Editor"}),c&&h.jsxs("button",{onClick:B,className:"flex items-center gap-1 text-xs text-gray-400 hover:text-gray-300",children:[v?h.jsx(_.FiCheck,{size:12}):h.jsx(_.FiCopy,{size:12}),v?"Copied!":"Copy"]})]}),h.jsx("div",{className:"h-full overflow-auto pb-8",children:h.jsx("textarea",{value:c,onChange:O=>T(O.target.value),placeholder:'{"name": "John", "age": 30, "city": "New York"}',className:"h-full w-full resize-none border-none bg-transparent p-4 font-mono text-sm text-gray-300 outline-none"})})]})]}),n==="url"&&h.jsx("div",{className:"bte:flex bte:h-full bte:flex-col",children:h.jsxs("div",{className:"bte:mb-4",children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"JSON URL"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"url",value:a,onChange:O=>l(O.target.value),placeholder:"https://api.example.com/data.json",className:"flex-1 rounded-none border border-[#e8e7ee] px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[#30aab3]"}),h.jsx("button",{onClick:A,disabled:f||!a.trim(),className:"rounded-none bg-[#170f4f] px-4 py-2 text-white transition-colors duration-200 hover:bg-[#30aab3] disabled:cursor-not-allowed disabled:opacity-50",children:f?"Loading...":"Fetch"})]})]})}),n==="file"&&h.jsxs("div",{className:"bte:flex bte:h-full bte:flex-col",children:[h.jsxs("div",{className:"bte:mb-4",children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Select JSON File"}),h.jsxs("div",{className:"rounded-none border-2 border-dashed border-[#e8e7ee] p-8 text-center transition-colors duration-200 hover:border-[#30aab3]",children:[h.jsx("input",{type:"file",accept:".json",onChange:N,className:"hidden",id:"file-upload"}),h.jsxs("label",{htmlFor:"file-upload",className:"flex cursor-pointer flex-col items-center",children:[h.jsx(_.FiUpload,{size:48,className:"mb-4 text-gray-400"}),h.jsx(_.FiUpload,{size:48,className:"mb-4 text-gray-400"}),h.jsx("span",{className:"text-lg font-medium text-gray-700",children:"Click to upload JSON file"}),h.jsx("span",{className:"mt-1 text-sm text-gray-500",children:"or drag and drop"})]})]})]}),o&&h.jsxs("div",{className:"flex-1 overflow-hidden rounded-none bg-gray-900",children:[h.jsx("div",{className:"flex items-center justify-between border-b border-gray-700 bg-gray-800 px-4 py-2",children:h.jsx("span",{className:"text-sm font-medium text-gray-300",children:"File Preview"})}),h.jsx("div",{className:"h-32 overflow-auto",children:h.jsx("pre",{className:"whitespace-pre-wrap p-4 font-mono text-sm text-gray-300",children:h.jsx("code",{children:o})})})]})]}),g&&h.jsx("div",{className:"mt-4 rounded-none border border-red-200 bg-red-50 p-3",children:h.jsx("p",{className:"text-sm text-red-600",children:g})})]}),h.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-[#e8e7ee] p-6",children:[h.jsx("button",{onClick:e,className:"rounded-none bg-gray-100 px-4 py-2 text-gray-700 transition-colors duration-200 hover:bg-gray-200",children:"Cancel"}),h.jsx("button",{onClick:j,disabled:n==="file"&&!o||n==="url"&&!c||n==="code"&&!c||!$(),className:"rounded-none bg-[#170f4f] px-4 py-2 text-white transition-colors duration-200 hover:bg-[#30aab3] disabled:cursor-not-allowed disabled:opacity-50",children:"Import Data"})]})]})}):null},b3=Object.freeze({__proto__:null,DataSourceModal:g3,HorizontalDataView:M0});exports.TemplateEditor=T0;exports.default=T0;
217
+ `),[o,i]=nT(s);if(o.length===0)return;const a=D0(o,0,r);return a.length===0?void 0:{type:"list",ordered:!0,start:((n=o[0])==null?void 0:n.number)||1,items:a,raw:s.slice(0,i).join(`
218
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(oT,this.editor.getAttributes(Sh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ln({find:Fh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,r)=>r.childCount+r.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ln({find:Fh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sh)}),joinPredicate:(e,r)=>r.childCount+r.attrs.start===+e[1],editor:this.editor})),[t]}}),iT=/^\s*(\[([( |x])?\])\s$/,aT=it.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const r=[];if(t.tokens&&t.tokens.length>0?r.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?r.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):r.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const n=e.parseChildren(t.nestedTokens);r.push(...n)}return e.createNode("taskItem",{checked:t.checked||!1},r)},renderMarkdown:(t,e)=>{var r;const s=`- [${(r=t.attrs)!=null&&r.checked?"x":" "}] `;return Yu(t,e,s)},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:r,editor:n})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var f,m;a.ariaLabel=((m=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:m.call(f,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(t),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=d.target;n.isEditable&&typeof r=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const g=r();if(typeof g!="number")return!1;const y=m.doc.nodeAt(g);return m.setNodeMarkup(g,void 0,{...y?.attrs,checked:f}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,o.append(a,i),s.append(o,l),Object.entries(e).forEach(([d,f])=>{s.setAttribute(d,f)}),{dom:s,contentDOM:l,update:d=>d.type!==this.type?!1:(s.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[Ln({find:iT,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),lT=it.create({name:"taskList",addOptions(){return{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",xe(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
219
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const r=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return r!==void 0?r:-1},tokenize(t,e,r){const n=o=>{const i=Il(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:r.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:n},r);return i?[{type:"taskList",raw:i.raw,items:i.items}]:r.blockTokens(o)},s=Il(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:r.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:n},r);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});de.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(f0.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(m0.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(w0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(C0.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(aT.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(lT.configure(this.options.taskList)),t}});var uT=it.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",xe(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const r=t.tokens||[];return r.length===1&&r[0].type==="image"?e.parseChildren([r[0]]):e.createNode("paragraph",void 0,e.parseInline(r))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cT=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,dT=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,pT=Nr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",xe(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,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[On({find:cT,type:this.type})]},addPasteRules(){return[nn({find:dT,type:this.type})]}}),hT=it.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),fT=Nr.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",xe(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,r){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:r.inlineTokens(o)}}},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()}}});function mT(t={}){return new ye({view(e){return new gT(e,t)}})}class gT{constructor(e,r){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=r.width)!==null&&n!==void 0?n:1,this.color=r.color===!1?void 0:r.color||"black",this.class=r.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:r})=>this.editorView.dom.removeEventListener(e,r))}update(e,r){this.cursorPos!=null&&r.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),r=!e.parent.inlineContent,n,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,a=o.height/s.offsetHeight;if(r){let f=e.nodeBefore,m=e.nodeAfter;if(f||m){let g=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(g){let y=g.getBoundingClientRect(),x=f?y.bottom:y.top;f&&m&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let w=this.width/2*a;n={left:y.left,right:y.right,top:x-w,bottom:x+w}}}}if(!n){let f=this.editorView.coordsAtPos(this.cursorPos),m=this.width/2*i;n={left:f.left-m,right:f.left+m,top:f.top,bottom:f.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let f=l.getBoundingClientRect(),m=f.width/l.offsetWidth,g=f.height/l.offsetHeight;c=f.left-l.scrollLeft*m,d=f.top-l.scrollTop*g}this.element.style.left=(n.left-c)/i+"px",this.element.style.top=(n.top-d)/a+"px",this.element.style.width=(n.right-n.left)/i+"px",this.element.style.height=(n.bottom-n.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let r=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=r&&r.inside>=0&&this.editorView.state.doc.nodeAt(r.inside),s=n&&n.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,r,e):s;if(r&&!o){let i=r.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=xm(this.editorView.state.doc,i,this.editorView.dragging.slice);a!=null&&(i=a)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class be extends ne{constructor(e){super(e,e)}map(e,r){let n=e.resolve(r.map(this.head));return be.valid(n)?new be(n):ne.near(n)}content(){return V.empty}eq(e){return e instanceof be&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new be(e.resolve(r.pos))}getBookmark(){return new lc(this.anchor)}static valid(e){let r=e.parent;if(r.isTextblock||!bT(e)||!yT(e))return!1;let n=r.type.spec.allowGapCursor;if(n!=null)return n;let s=r.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,r,n=!1){e:for(;;){if(!n&&be.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let a=e.node(i);if(r>0?e.indexAfter(i)<a.childCount:e.index(i)>0){o=a.child(r>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=r;let l=e.doc.resolve(s);if(be.valid(l))return l}for(;;){let i=r>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!G.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*r),n=!1;continue e}break}o=i,s+=r;let a=e.doc.resolve(s);if(be.valid(a))return a}return null}}}be.prototype.visible=!1;be.findFrom=be.findGapCursorFrom;ne.jsonID("gapcursor",be);class lc{constructor(e){this.pos=e}map(e){return new lc(e.map(this.pos))}resolve(e){let r=e.resolve(this.pos);return be.valid(r)?new be(r):ne.near(r)}}function k0(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function bT(t){for(let e=t.depth;e>=0;e--){let r=t.index(e),n=t.node(e);if(r==0){if(n.type.spec.isolating)return!0;continue}for(let s=n.child(r-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||k0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function yT(t){for(let e=t.depth;e>=0;e--){let r=t.indexAfter(e),n=t.node(e);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let s=n.child(r);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||k0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function xT(){return new ye({props:{decorations:CT,createSelectionBetween(t,e,r){return e.pos==r.pos&&be.valid(r)?new be(r):null},handleClick:wT,handleKeyDown:vT,handleDOMEvents:{beforeinput:DT}}})}const vT=xg({ArrowLeft:Ao("horiz",-1),ArrowRight:Ao("horiz",1),ArrowUp:Ao("vert",-1),ArrowDown:Ao("vert",1)});function Ao(t,e){const r=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,s,o){let i=n.selection,a=e>0?i.$to:i.$from,l=i.empty;if(i instanceof X){if(!o.endOfTextblock(r)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let c=be.findGapCursorFrom(a,e,l);return c?(s&&s(n.tr.setSelection(new be(c))),!0):!1}}function wT(t,e,r){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!be.valid(n))return!1;let s=t.posAtCoords({left:r.clientX,top:r.clientY});return s&&s.inside>-1&&G.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new be(n))),!0)}function DT(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof be))return!1;let{$from:r}=t.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let s=_.empty;for(let i=n.length-1;i>=0;i--)s=_.from(n[i].createAndFill(null,s));let o=t.state.tr.replace(r.pos,r.pos,new V(s,0,0));return o.setSelection(X.near(o.doc.resolve(r.pos+1))),t.dispatch(o),!1}function CT(t){if(!(t.selection instanceof be))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",me.create(t.doc,[Ge.widget(t.selection.head,e,{key:"gapcursor"})])}var Ai=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length<Ai&&this.leafAppend(e)||this.length<Ai&&e.leafPrepend(this)||this.appendInner(e)):this};je.prototype.prepend=function(e){return e.length?je.from(e).append(this):this};je.prototype.appendInner=function(e){return new kT(this,e)};je.prototype.slice=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=this.length),e>=r?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,r))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.prototype.forEach=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length),r<=n?this.forEachInner(e,r,n,0):this.forEachInvertedInner(e,r,n,0)};je.prototype.map=function(e,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},r,n),s};je.from=function(e){return e instanceof je?e:e&&e.length?new E0(e):je.empty};var E0=function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,a){for(var l=o;l<i;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,a){for(var l=o-1;l>=i;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Ai)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Ai)return new e(s.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(e.prototype,r),e}(je);je.empty=new E0([]);var kT=function(t){function e(r,n){t.call(this),this.left=r,this.right=n,this.length=r.length+n.length,this.depth=Math.max(r.depth,n.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(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,s,o,i){var a=this.left.length;if(s<a&&this.left.forEachInner(n,s,Math.min(o,a),i)===!1||o>a&&this.right.forEachInner(n,Math.max(s-a,0),Math.min(this.length,o)-a,i+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,s,o,i){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(n,s-a,Math.max(o,a)-a,i+a)===!1||o<a&&this.left.forEachInvertedInner(n,Math.min(s,a),o,i)===!1)return!1},e.prototype.sliceInner=function(n,s){if(n==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(n,s):n>=o?this.right.slice(n-o,s-o):this.left.slice(n,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(n){var s=this.right.leafAppend(n);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(n){var s=this.left.leafPrepend(n);if(s)return new e(s,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(je);const ET=500;class wt{constructor(e,r){this.items=e,this.eventCount=r}popEvent(e,r){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let s,o;r&&(s=this.remapping(n,this.items.length),o=s.maps.length);let i=e.tr,a,l,c=[],d=[];return this.items.forEach((f,m)=>{if(!f.step){s||(s=this.remapping(n,m+1),o=s.maps.length),o--,d.push(f);return}if(s){d.push(new At(f.map));let g=f.step.map(s.slice(o)),y;g&&i.maybeStep(g).doc&&(y=i.mapping.maps[i.mapping.maps.length-1],c.push(new At(y,void 0,void 0,c.length+d.length))),o--,y&&s.appendMap(y,o)}else i.maybeStep(f.step);if(f.selection)return a=s?f.selection.map(s.slice(o)):f.selection,l=new wt(this.items.slice(0,n).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:i,selection:a}}addTransform(e,r,n,s){let o=[],i=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),m=new At(e.mapping.maps[d],f,r),g;(g=l&&l.merge(m))&&(m=g,d?o.pop():a=a.slice(0,a.length-1)),o.push(m),r&&(i++,r=void 0),s||(l=m)}let c=i-n.depth;return c>FT&&(a=ST(a,c),i-=c),new wt(a.append(o),i)}remapping(e,r){let n=new Ms;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?n.maps.length-s.mirrorOffset:void 0;n.appendMap(s.map,i)},e,r),n}addMaps(e){return this.eventCount==0?this:new wt(this.items.append(e.map(r=>new At(r))),this.eventCount)}rebased(e,r){if(!this.eventCount)return this;let n=[],s=Math.max(0,this.items.length-r),o=e.mapping,i=e.steps.length,a=this.eventCount;this.items.forEach(m=>{m.selection&&a--},s);let l=r;this.items.forEach(m=>{let g=o.getMirror(--l);if(g==null)return;i=Math.min(i,g);let y=o.maps[g];if(m.step){let x=e.steps[g].invert(e.docs[g]),w=m.selection&&m.selection.map(o.slice(l+1,g));w&&a++,n.push(new At(y,x,w))}else n.push(new At(y))},s);let c=[];for(let m=r;m<i;m++)c.push(new At(o.maps[m]));let d=this.items.slice(0,s).append(c).append(n),f=new wt(d,a);return f.emptyItemCount()>ET&&(f=f.compress(this.items.length-n.length)),f}emptyItemCount(){let e=0;return this.items.forEach(r=>{r.step||e++}),e}compress(e=this.items.length){let r=this.remapping(0,e),n=r.maps.length,s=[],o=0;return this.items.forEach((i,a)=>{if(a>=e)s.push(i),i.selection&&o++;else if(i.step){let l=i.step.map(r.slice(n)),c=l&&l.getMap();if(n--,c&&r.appendMap(c,n),l){let d=i.selection&&i.selection.map(r.slice(n));d&&o++;let f=new At(c.invert(),l,d),m,g=s.length-1;(m=s.length&&s[g].merge(f))?s[g]=m:s.push(f)}}else i.map&&n--},this.items.length,0),new wt(je.from(s.reverse()),o)}}wt.empty=new wt(je.empty,0);function ST(t,e){let r;return t.forEach((n,s)=>{if(n.selection&&e--==0)return r=s,!1}),t.slice(r)}class At{constructor(e,r,n,s){this.map=e,this.step=r,this.selection=n,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let r=e.step.merge(this.step);if(r)return new At(r.getMap().invert(),r,this.selection)}}}class cr{constructor(e,r,n,s,o){this.done=e,this.undone=r,this.prevRanges=n,this.prevTime=s,this.prevComposition=o}}const FT=20;function AT(t,e,r,n){let s=r.getMeta(Zr),o;if(s)return s.historyState;r.getMeta(MT)&&(t=new cr(t.done,t.undone,null,0,-1));let i=r.getMeta("appendedTransaction");if(r.steps.length==0)return t;if(i&&i.getMeta(Zr))return i.getMeta(Zr).redo?new cr(t.done.addTransform(r,void 0,n,Io(e)),t.undone,Ah(r.mapping.maps),t.prevTime,t.prevComposition):new cr(t.done,t.undone.addTransform(r,void 0,n,Io(e)),null,t.prevTime,t.prevComposition);if(r.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let a=r.getMeta("composition"),l=t.prevTime==0||!i&&t.prevComposition!=a&&(t.prevTime<(r.time||0)-n.newGroupDelay||!NT(r,t.prevRanges)),c=i?ol(t.prevRanges,r.mapping):Ah(r.mapping.maps);return new cr(t.done.addTransform(r,l?e.selection.getBookmark():void 0,n,Io(e)),wt.empty,c,r.time,a??t.prevComposition)}else return(o=r.getMeta("rebased"))?new cr(t.done.rebased(r,o),t.undone.rebased(r,o),ol(t.prevRanges,r.mapping),t.prevTime,t.prevComposition):new cr(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),ol(t.prevRanges,r.mapping),t.prevTime,t.prevComposition)}function NT(t,e){if(!e)return!1;if(!t.docChanged)return!0;let r=!1;return t.mapping.maps[0].forEach((n,s)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&s>=e[o]&&(r=!0)}),r}function Ah(t){let e=[];for(let r=t.length-1;r>=0&&e.length==0;r--)t[r].forEach((n,s,o,i)=>e.push(o,i));return e}function ol(t,e){if(!t)return null;let r=[];for(let n=0;n<t.length;n+=2){let s=e.map(t[n],1),o=e.map(t[n+1],-1);s<=o&&r.push(s,o)}return r}function TT(t,e,r){let n=Io(e),s=Zr.get(e).spec.config,o=(r?t.undone:t.done).popEvent(e,n);if(!o)return null;let i=o.selection.resolve(o.transform.doc),a=(r?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),s,n),l=new cr(r?a:o.remaining,r?o.remaining:a,null,0,-1);return o.transform.setSelection(i).setMeta(Zr,{redo:r,historyState:l})}let il=!1,Nh=null;function Io(t){let e=t.plugins;if(Nh!=e){il=!1,Nh=e;for(let r=0;r<e.length;r++)if(e[r].spec.historyPreserveItems){il=!0;break}}return il}const Zr=new Oe("history"),MT=new Oe("closeHistory");function BT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ye({key:Zr,state:{init(){return new cr(wt.empty,wt.empty,null,0,-1)},apply(e,r,n){return AT(r,n,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,r){let n=r.inputType,s=n=="historyUndo"?F0:n=="historyRedo"?A0:null;return s?(r.preventDefault(),s(e.state,e.dispatch)):!1}}}})}function S0(t,e){return(r,n)=>{let s=Zr.getState(r);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(n){let o=TT(s,r,t);o&&n(e?o.scrollIntoView():o)}return!0}}const F0=S0(!1,!0),A0=S0(!0,!0);de.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,r=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(r)}},addProseMirrorPlugins(){let t=!1;return[new ye({key:new Oe("characterCount"),appendTransaction:(e,r,n)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const o=this.storage.characters({node:n.doc});if(o>s){const i=o-s,a=0,l=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=n.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,r)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const s=this.storage.characters({node:r.doc}),o=this.storage.characters({node:e.doc});if(o<=n||s>n&&o>n&&o<=s)return!0;if(s>n&&o>n&&o>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=o-n,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>n)}})]}});var jT=de.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[mT(this.options)]}});de.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ye({key:new Oe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:r,isFocused:n}=this.editor,{anchor:s}=e,o=[];if(!r||!n)return me.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;i+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&i-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(Ge.node(c,c+l.nodeSize,{class:this.options.className}))}),me.create(t,o)}}})]}});var OT=de.create({name:"gapCursor",addProseMirrorPlugins(){return[xT()]},extendNodeSchema(t){var e;const r={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=le(J(t,"allowGapCursor",r)))!=null?e:null}}});de.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ye({key:new Oe("placeholder"),props:{decorations:({doc:t,selection:e})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,s=[];if(!r)return null;const o=this.editor.isEmpty;return t.descendants((i,a)=>{const l=n>=a&&n<=a+i.nodeSize,c=!i.isLeaf&&Gi(i);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const f=Ge.node(a,a+i.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:a,hasAnchor:l}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),me.create(t,s)}}})]}});de.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ye({key:new Oe("selection"),props:{decorations(r){return r.selection.empty||t.isFocused||!t.isEditable||Lg(r.selection)||t.view.dragging?null:me.create(r.doc,[Ge.inline(r.selection.from,r.selection.to,{class:e.className})])}}})]}});function Th({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var LT=de.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Oe(this.name),r=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(r).includes(s.name));return[new ye({key:e,appendTransaction:(s,o,i)=>{const{doc:a,tr:l,schema:c}=i,d=e.getState(i),f=a.content.size,m=c.nodes[r];if(d)return l.insert(f,m.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!Th({node:i,types:n})},apply:(s,o)=>{if(!s.docChanged)return o;const i=s.doc.lastChild;return!Th({node:i,types:n})}}})]}}),_T=de.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>F0(t,e),redo:()=>({state:t,dispatch:e})=>A0(t,e)}},addProseMirrorPlugins(){return[BT(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()}}}),IT=de.create({name:"starterKit",addExtensions(){var t,e,r,n;const s=[];return this.options.bold!==!1&&s.push(_N.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(MN.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(f0.configure(this.options.bulletList)),this.options.code!==!1&&s.push(PN.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(HN.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(VN.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(jT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(OT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Yg.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(qN.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(_T.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(WN.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(YN.configure(this.options.italic)),this.options.listItem!==!1&&s.push(m0.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(w0.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(i0.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(C0.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(uT.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(pT.configure(this.options.strike)),this.options.text!==!1&&s.push(hT.configure(this.options.text)),this.options.underline!==!1&&s.push(fT.configure((r=this.options)==null?void 0:r.underline)),this.options.trailingNode!==!1&&s.push(LT.configure((n=this.options)==null?void 0:n.trailingNode)),s}}),RT=IT;const PT=[JA,RT,fA.extend({addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.setHardBreak()}}}),PA.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https",protocols:["http","https"],isAllowedUri:(t,e)=>{try{const r=t.includes(":")?new URL(t):new URL(`${e.defaultProtocol}://${t}`);if(!e.defaultValidate(r.href))return!1;const n=["ftp","file","mailto"],s=r.protocol.replace(":","");if(n.includes(s)||!e.protocols.map(l=>typeof l=="string"?l:l.scheme).includes(s))return!1;const i=[""],a=r.hostname;return!i.includes(a)}catch{return!1}},shouldAutoLink:t=>{try{const e=t.includes(":")?new URL(t):new URL(`https://${t}`),r=[""],n=e.hostname;return!r.includes(n)}catch{return!1}}})];function _e({children:t,onClick:e,disabled:r=!1,isActive:n}){return h.jsx("button",{onClick:e,disabled:r,className:`w-[26px] h-[26px] p-1 rounded-md border border-[#170F4F] transition-colors duration-200 flex items-center justify-center hover:bg-gray-200 disabled:opacity-40 ${n?"bg-[#170F4F] text-white hover:bg-[#170F4F]":""}`,children:t})}function zT({editor:t}){const e=F.useCallback(()=>{const s=t.getAttributes("link").href,o=window.prompt("Please put a valid URL",s);if(o!==null){if(o===""){t.chain().focus().extendMarkRange("link").unsetLink().run();return}try{t.chain().focus().extendMarkRange("link").setLink({href:o}).run()}catch(i){alert(i.message)}}},[t]),r=F.useCallback(Rn(s=>{t.chain().focus().setColor(s).run()},300),[t]),n=p0({editor:t,selector:({editor:s})=>s?{color:s.getAttributes("textStyle")?.color??null,isBold:s.isActive("bold"),canBold:s.can().chain().toggleBold().run(),isItalic:s.isActive("italic"),canItalic:s.can().chain().toggleItalic().run(),isStrike:s.isActive("strike"),canStrike:s.can().chain().toggleStrike().run(),isUnderline:s.isActive("underline"),canUnderline:s.can().chain().toggleUnderline().run(),canClearMarks:s.can().chain().unsetAllMarks().run(),isParagraph:s.isActive("paragraph"),isHeading1:s.isActive("heading",{level:1}),isHeading2:s.isActive("heading",{level:2}),isHeading3:s.isActive("heading",{level:3}),isHeading4:s.isActive("heading",{level:4}),isHeading5:s.isActive("heading",{level:5}),isHeading6:s.isActive("heading",{level:6}),isBulletList:s.isActive("bulletList"),isOrderedList:s.isActive("orderedList"),canUndo:s.can().chain().undo().run(),canRedo:s.can().chain().redo().run(),isLink:s.isActive("link")}:{color:null,isBold:!1,canBold:!1,isItalic:!1,canItalic:!1,isStrike:!1,canStrike:!1,isUnderline:!1,canUnderline:!1,canClearMarks:!1,isParagraph:!1,isHeading1:!1,isHeading2:!1,isHeading3:!1,isHeading4:!1,isHeading5:!1,isHeading6:!1,isBulletList:!1,isOrderedList:!1,canUndo:!1,canRedo:!1,isLink:!1}});return h.jsx("div",{className:"control-group",children:h.jsxs("div",{className:"mb-[8px] flex flex-wrap gap-1 border border-[#e8e7ee] p-[2px]",children:[h.jsx(_e,{onClick:()=>t.chain().focus().toggleBold().run(),disabled:!n.canBold,isActive:n.isBold,children:h.jsx(ut.BiBold,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleItalic().run(),disabled:!n.canItalic,isActive:n.isItalic,children:h.jsx(ut.BiItalic,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleUnderline().run(),disabled:!n.canUnderline,isActive:n.isUnderline,children:h.jsx(ut.BiUnderline,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleStrike().run(),disabled:!n.canStrike,isActive:n.isStrike,children:h.jsx(ut.BiStrikethrough,{size:16})}),h.jsx(_e,{onClick:n.isLink?()=>t.chain().focus().unsetLink().run():()=>e(),isActive:n.isLink,children:n.isLink?h.jsx(ut.BiUnlink,{size:16}):h.jsx(ut.BiLink,{size:16})}),h.jsx("input",{type:"color",onInput:s=>r(s.currentTarget.value),className:"h-[26px] w-[26px]",value:n.color}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:n.isBulletList,children:h.jsx(ut.BiListUl,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:n.isOrderedList,children:h.jsx(ut.BiListOl,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().setHardBreak().run(),children:h.jsx(I.FiCornerDownLeft,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),isActive:n.isHeading1,children:h.jsx(Or.TbH1,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),isActive:n.isHeading2,children:h.jsx(Or.TbH2,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),isActive:n.isHeading3,children:h.jsx(Or.TbH3,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleHeading({level:4}).run(),isActive:n.isHeading4,children:h.jsx(Or.TbH4,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleHeading({level:5}).run(),isActive:n.isHeading5,children:h.jsx(Or.TbH5,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().toggleHeading({level:6}).run(),isActive:n.isHeading6,children:h.jsx(Or.TbH6,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().unsetAllMarks().run(),children:h.jsx(Or.TbClearFormatting,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().undo().run(),disabled:!n.canUndo,children:h.jsx(ut.BiUndo,{size:16})}),h.jsx(_e,{onClick:()=>t.chain().focus().redo().run(),disabled:!n.canRedo,children:h.jsx(ut.BiRedo,{size:16})})]})})}function $T({handleChange:t,text:e}){const r=SN({extensions:PT,content:e,onUpdate:({editor:n})=>{let s=n.getHTML();s=s.replace(/<p><\/p>/g,""),t(s)}});return h.jsxs("div",{children:[h.jsx(zT,{editor:r}),h.jsx(vN,{editor:r,className:"tiptap-global"})]})}function HT(){const{actions:{setProp:t},text:e}=Q.useNode(n=>({text:n.data.props.children})),r=n=>{t(s=>s.children=n)};return h.jsx("div",{className:"space-y-4 p-4",children:h.jsx($T,{handleChange:r,text:e})})}function N0(){const{actions:{setProp:t},style:{backgroundColor:e}={}}=Q.useNode(n=>({style:n.data.props.style||{}})),r=F.useMemo(()=>Rn(n=>{t(s=>{s.style||(s.style={}),s.style.backgroundColor=n})},300),[t]);return h.jsx(In,{title:"Background",icon:h.jsx(I.FiEdit3,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:e,onChange:n=>r(n.target.value),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:e,onChange:n=>t(s=>{s.style||(s.style={}),s.style.backgroundColor=n.target.value}),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})})}function T0(){const{actions:{setProp:t},style:{borderStyle:e,borderRadius:r,borderColor:n,borderWidth:s}={}}=Q.useNode(i=>({style:i.data.props.style||{}})),o=F.useMemo(()=>Rn(i=>{t(a=>{a.style||(a.style={}),a.style.borderColor=i})},300),[t]);return h.jsx(In,{title:"Border",icon:h.jsx(I.FiSquare,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Radius"}),h.jsx("div",{className:"grid grid-cols-4 gap-1",children:[{value:"",label:"0"},{value:"4px",label:"4px"},{value:"8px",label:"8px"},{value:"9999px",label:"1/2"}].map(i=>h.jsx("button",{onClick:()=>t(a=>{a.style||(a.style={}),a.style.borderRadius=i.value}),className:`border border-[#E8E7EE] px-2 py-2 text-xs transition-all ${r===i.value?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:i.label},i.value))})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Width"}),h.jsx("div",{className:"grid grid-cols-4 gap-1",children:[{value:"0px",label:"0"},{value:"1px",label:"1px"},{value:"2px",label:"2px"},{value:"4px",label:"4px"}].map(i=>h.jsx("button",{onClick:()=>t(a=>{a.style||(a.style={}),a.style.borderWidth=i.value}),className:`border border-[#E8E7EE] px-2 py-2 text-xs transition-all ${s===i.value?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:i.label},i.value))})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border type"}),h.jsxs("div",{className:"mb-2 grid grid-cols-2 gap-2",children:[h.jsx("button",{onClick:()=>t(i=>{i.style||(i.style={}),i.style.borderStyle="none"}),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="none"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"None"}),h.jsx("button",{onClick:()=>t(i=>{i.style||(i.style={}),i.style.borderStyle="solid"}),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="solid"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"Light"}),h.jsx("button",{onClick:()=>t(i=>{i.style||(i.style={}),i.style.borderStyle="dotted"}),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="dotted"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"Dotted"}),h.jsx("button",{onClick:()=>t(i=>{i.style||(i.style={}),i.style.borderStyle="dashed"}),className:`border border-[#E8E7EE] px-3 py-2 text-xs transition-all ${e==="dashed"?"border-[#170F4F] bg-[#170F4F] text-white":"text-[#A29FB9] hover:border-[#00BAC7] hover:bg-[#CCF1F4]"}`,children:"Dashed"})]}),h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Border Color"}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:n,onChange:i=>o(i.target.value),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Background color"}),h.jsx("input",{type:"text",value:n,onChange:i=>t(a=>{a.style||(a.style={}),a.style.borderColor=i.target.value}),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#ffffff"})]})]})]})})}const vt=F.forwardRef(({value:t,onChange:e,min:r,max:n,defaultUnit:s="px",allowedUnits:o=[],className:i="",...a},l)=>{const[c,d]=F.useState(""),[f,m]=F.useState(!1),g=F.useCallback(A=>{if(typeof A=="number")return{value:A,unit:s,text:`${A}${s}`};if(typeof A=="string"&&A.trim()){const T=A.trim(),j=T.match(/^(-?\d*\.?\d+)(.*)$/);if(!j)return{value:0,unit:s,text:""};const[,B,$]=j,O=parseFloat(B),P=$.trim()||s,L=o.length>0&&!o.includes(P)?s:P;return{value:O,unit:L,text:T}}return{value:0,unit:s,text:""}},[s,o]),y=F.useMemo(()=>{if(!t||typeof t=="string"&&t.trim()==="")return"";const A=g(t);return`${A.value}${A.unit}`},[t,g]),x=F.useCallback(A=>{d(A.target.value)},[]),w=F.useCallback(A=>{if(A.key==="Enter"){A.currentTarget.blur();return}if(A.key==="ArrowUp"||A.key==="ArrowDown"){A.preventDefault();const T=f?c:y;if(!T.trim())return;const j=g(T);if(isNaN(j.value))return;const B=A.shiftKey?10:A.ctrlKey||A.metaKey?.1:1,$=A.key==="ArrowUp"?j.value+B:j.value-B,O=Math.min(n??$,Math.max(r??$,$)),P=`${O}${j.unit}`;d(P),e?.({value:O,unit:j.unit,text:P})}},[f,c,y,g,r,n,e]),D=F.useCallback(()=>{m(!0),!c&&t&&d(typeof t=="string"?t:y)},[c,t,y]),E=F.useCallback(()=>{if(m(!1),!c.trim()){d(""),e?.({value:0,unit:s,text:""});return}const A=g(c),T=Math.min(n??A.value,Math.max(r??A.value,A.value)),j=`${T}${A.unit}`;d(j),e?.({value:T,unit:A.unit,text:j})},[c,e,s,g,r,n]),S=`border border-[#E8E7EE] bg-white text-center text-xs transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F] disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-400 ${i.includes("px-")||i.includes("py-")?"":"px-1 py-0.5"}`;return h.jsx("input",{ref:l,type:"text",value:f?c:y,onChange:x,onFocus:D,onBlur:E,onKeyDown:w,className:`${S} ${i}`.trim(),...a})});vt.displayName="DimensionInput";const Mh={min:0,defaultUnit:"px",allowedUnits:["px","rem","%","vh","vw"],placeholder:"auto",className:"w-20 px-2 py-1 text-xs"};function M0(){const{actions:{setProp:t},style:{columns:e,columnSpacing:r,alignment:n,minHeight:s,width:o,height:i}={}}=Q.useNode(c=>({style:c.data.props.style||{}})),a=()=>{e<6&&t(c=>{c.style||(c.style={}),c.style.columns=e+1})},l=()=>{e>1&&t(c=>{c.style||(c.style={}),c.style.columns=e-1})};return h.jsx(In,{title:"Layout",icon:h.jsx(I.FiLayout,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Width"}),h.jsx(vt,{value:o,onChange:c=>t(d=>{d.style||(d.style={}),d.style.width=c.text}),...Mh})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Height"}),h.jsx(vt,{value:i,onChange:c=>t(d=>{d.style||(d.style={}),d.style.height=c.text}),...Mh})]})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-[#A29FB9]",children:"Min Height"}),h.jsxs("span",{className:"bg-[#E8E7EE] px-2 py-1 font-mono text-xs text-[#170F4F]",children:[parseInt(s),"px"]})]}),h.jsx("input",{type:"range",min:"0",max:"400",step:"5",value:parseInt(s),onChange:c=>t(d=>{d.style||(d.style={}),d.style.minHeight=parseInt(c.target.value)}),className:"slider-modern h-2 w-full cursor-pointer appearance-none bg-[#E8E7EE]",style:{background:`linear-gradient(to right, #170F4F 0%, #170F4F ${parseInt(s)/400*100}%, #E8E7EE ${parseInt(s)/400*100}%, #E8E7EE 100%)`}})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-[#A29FB9]",children:"Columns"}),h.jsx("span",{className:"bg-[#E8E7EE] px-2 py-1 font-mono text-xs text-[#170F4F]",children:e})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("button",{onClick:l,disabled:e<=1,className:"flex h-8 w-8 items-center justify-center border border-[#E8E7EE] bg-[#E8E7EE] text-[#A29FB9] transition-all hover:border-[#00BAC7] hover:bg-[#CCF1F4] disabled:cursor-not-allowed disabled:opacity-30",children:h.jsx(I.FiMinus,{size:14})}),h.jsx("div",{className:"flex flex-1 justify-center py-1",children:h.jsx("div",{className:"flex gap-1",children:Array.from({length:e},(c,d)=>h.jsx("div",{className:"h-8 w-4 border border-[#170F4F] bg-[#170F4F]"},d))})}),h.jsx("button",{onClick:a,disabled:e>=6,className:"flex h-8 w-8 items-center justify-center border border-[#E8E7EE] bg-[#E8E7EE] text-[#A29FB9] transition-all hover:border-[#00BAC7] hover:bg-[#CCF1F4] disabled:cursor-not-allowed disabled:opacity-30",children:h.jsx(I.FiPlus,{size:14})})]})]}),e>1&&h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-[#A29FB9]",children:"Column Gap"}),h.jsxs("span",{className:"bg-[#E8E7EE] px-2 py-1 font-mono text-xs text-[#170F4F]",children:[r,"px"]})]}),h.jsx("input",{type:"range",min:"0",max:"40",step:"2",value:r,onChange:c=>t(d=>{d.style||(d.style={}),d.style.columnSpacing=parseInt(c.target.value)}),className:"slider-modern h-2 w-full cursor-pointer appearance-none bg-[#E8E7EE]",style:{background:`linear-gradient(to right, #170F4F 0%, #170F4F ${r/40*100}%, #E8E7EE ${r/40*100}%, #E8E7EE 100%)`}})]}),h.jsxs("div",{children:[h.jsx("span",{className:"mb-2 block text-xs text-[#A29FB9]",children:"Alignment"}),h.jsx(Tt,{options:[{value:"left",label:"Left"},{value:"center",label:"Center"},{value:"right",label:"Right"}],value:n,onChange:c=>t(d=>{d.style||(d.style={}),d.style.alignment=c}),placeholder:"Choose alignment"})]})]})})}function cs(t){if(t!=null){if(typeof t=="number")return t===0?"0":void 0;if(typeof t=="string"){const e=t.trim();return e==="0"?"0":/^-?\d+(\.\d+)?(px|em|rem|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc)$/i.test(e)?e:void 0}}}function Bh(t={},e){const r=cs(t[e]),n=cs(t[`${e}Top`]),s=cs(t[`${e}Right`]),o=cs(t[`${e}Bottom`]),i=cs(t[`${e}Left`]);if(r){const a=r.trim().split(/\s+/);switch(a.length){case 1:return{top:n||a[0],right:s||a[0],bottom:o||a[0],left:i||a[0]};case 2:return{top:n||a[0],right:s||a[1],bottom:o||a[0],left:i||a[1]};case 3:return{top:n||a[0],right:s||a[1],bottom:o||a[2],left:i||a[1]};case 4:return{top:n||a[0],right:s||a[1],bottom:o||a[2],left:i||a[3]}}}return{top:n,right:s,bottom:o,left:i}}const or={min:0,defaultUnit:"px",allowedUnits:["px","rem","%"],placeholder:"none",className:"w-10 px-0.5 py-0.5 text-xs"};function B0(){const{actions:{setProp:t},style:e={}}=Q.useNode(s=>({style:s.data.props.style||{}})),r=F.useMemo(()=>Bh(e,"margin"),[e]),n=F.useMemo(()=>Bh(e,"padding"),[e]);return h.jsx(In,{title:"Spacing",icon:h.jsx(I.FiMove,{size:14,className:"text-[#170F4F]"}),defaultOpen:!1,children:h.jsx("div",{className:"space-y-3",children:h.jsx("div",{children:h.jsxs("div",{className:"relative border border-[#dce7fe] bg-[#F9FAFB] p-2",children:[h.jsx("div",{className:"absolute left-1 top-[-2px] -translate-y-1/2",children:h.jsx("span",{className:"bg-[#F9FAFB] px-1 text-xs text-[#A29FB9]",style:{background:"linear-gradient(to bottom,transparent 0%,transparent 50%, #F9FAFB 50%, #F9FAFB 100%)"},children:"Margin"})}),h.jsx("div",{className:"mb-1 flex justify-center",children:h.jsx(vt,{value:r.top,onChange:s=>t(o=>{o.style||(o.style={}),o.style.marginTop=s.text}),...or})}),h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx(vt,{value:r.left,onChange:s=>t(o=>{o.style||(o.style={}),o.style.marginLeft=s.text}),...or}),h.jsxs("div",{className:"relative mx-2 my-1 flex-1 border-2 border-dashed border-[#3B82F6] bg-[#EFF6FF] p-2",children:[h.jsx("div",{className:"absolute left-1 top-[-3px] -translate-y-1/2",children:h.jsx("span",{className:"bg-[#EFF6FF] px-1 text-xs text-[#3B82F6]",style:{background:"linear-gradient(to bottom, transparent 0%, transparent 50%, #EFF6FF 50%, #EFF6FF 100%)"},children:"Padding"})}),h.jsx("div",{className:"mb-1 flex justify-center",children:h.jsx(vt,{value:n.top,onChange:s=>t(o=>{o.style||(o.style={}),o.style.paddingTop=s.text}),...or})}),h.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[h.jsx(vt,{value:n.left,onChange:s=>t(o=>{o.style||(o.style={}),o.style.paddingLeft=s.text}),...or}),h.jsx("div",{className:"mx-2 my-1 flex h-6 flex-1 items-center justify-center border border-[#D1D5DB] bg-white px-2 py-1",children:h.jsx("span",{className:"text-[10px] font-medium text-[#6B7280] opacity-60",children:"Content"})}),h.jsx(vt,{value:n.right,onChange:s=>t(o=>{o.style||(o.style={}),o.style.paddingRight=s.text}),...or})]}),h.jsx("div",{className:"flex justify-center",children:h.jsx(vt,{value:n.bottom,onChange:s=>t(o=>{o.style||(o.style={}),o.style.paddingBottom=s.text}),...or})})]}),h.jsx(vt,{value:r.right,onChange:s=>t(o=>{o.style||(o.style={}),o.style.marginRight=s.text}),...or})]}),h.jsx("div",{className:"flex justify-center",children:h.jsx(vt,{value:r.bottom,onChange:s=>t(o=>{o.style||(o.style={}),o.style.marginBottom=s.text}),...or})})]})})})})}function VT(){return h.jsxs(h.Fragment,{children:[h.jsx(M0,{}),h.jsx(B0,{}),h.jsx(N0,{}),h.jsx(T0,{})]})}const qT=[{value:"Arial, Helvetica, sans-serif",label:"Arial"},{value:"Verdana, Geneva, sans-serif",label:"Verdana"},{value:"Tahoma, Geneva, sans-serif",label:"Tahoma"},{value:"'Trebuchet MS', Helvetica, sans-serif",label:"Trebuchet MS"},{value:"Helvetica, Arial, sans-serif",label:"Helvetica"},{value:"'Times New Roman', Times, serif",label:"Times New Roman"},{value:"Georgia, serif",label:"Georgia"},{value:"'Palatino Linotype', 'Book Antiqua', Palatino, serif",label:"Palatino Linotype"},{value:"'Courier New', Courier, monospace",label:"Courier New"},{value:"'Lucida Console', Monaco, monospace",label:"Lucida Console"}],WT=[{label:"Lighter",value:"lighter"},{label:"Normal",value:"normal"},{label:"Bold",value:"bold"},{label:"Bolder",value:"bolder"},{label:"100",value:"100"},{label:"200",value:"200"},{label:"300",value:"300"},{label:"400",value:"400"},{label:"500",value:"500"},{label:"600",value:"600"},{label:"700",value:"700"},{label:"800",value:"800"},{label:"900",value:"900"}],UT=[{label:"Normal",value:"normal"},{label:"No wrapped",value:"nowrap"}];function KT(){const{actions:{setProp:t},style:e={}}=Q.useNode(s=>({style:s.data.props.style})),r=F.useCallback(s=>{t(o=>{o.style={...o.style,...s}})},[t]),n=F.useMemo(()=>Rn(r,300),[r]);return h.jsx(In,{title:"Typography",icon:h.jsx(is.LuType,{size:14,className:"text-[#170F4F]"}),defaultOpen:!0,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Font"}),h.jsx(Tt,{options:qT,value:e.fontFamily||"Inter",onChange:s=>r({fontFamily:s}),placeholder:"Choose font family"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Size"}),h.jsx("input",{type:"number",min:8,max:96,value:e.fontSize||20,onChange:s=>r({fontSize:Number(s.target.value)}),className:"w-full border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Weight"}),h.jsx(Tt,{options:WT,value:e.fontWeight||"normal",onChange:s=>r({fontWeight:s}),placeholder:"Choose font weight"})]})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(I.FiMove,{size:14,className:"text-[#170F4F]"}),h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:"Alignment"})]}),h.jsx("div",{className:"flex gap-2",children:["left","center","right","justify"].map(s=>h.jsx("button",{className:`rounded border px-3 py-2 text-xs font-medium transition-all focus:outline-none focus:ring-2 focus:ring-[#170F4F] ${e.textAlign===s?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({textAlign:s}),children:s.charAt(0).toUpperCase()+s.slice(1)},s))}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-1 block text-xs text-[#A29FB9]",children:"Line Break"}),h.jsx(Tt,{options:UT,value:e.whiteSpace||"normal",onChange:s=>r({whiteSpace:s}),placeholder:"Choose whiteSpace"})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(is.LuRemoveFormatting,{size:14,className:"text-[#170F4F]"}),h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:"Formatting"})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{className:`rounded border px-3 py-2 text-xs font-bold ${e?.fontWeight==="bold"?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({fontWeight:e?.fontWeight==="bold"?"normal":"bold"}),children:h.jsx(is.LuBold,{size:14,className:"text-[#170F4F]"})}),h.jsx("button",{className:`rounded border px-3 py-2 text-xs italic ${e?.fontStyle==="italic"?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({fontStyle:e?.fontStyle==="italic"?"normal":"italic"}),children:h.jsx(is.LuItalic,{size:14,className:"text-[#170F4F]"})}),h.jsx("button",{className:`rounded border px-3 py-2 text-xs underline ${e?.textDecoration==="underline"?"border-[#00BAC7] bg-[#CCF1F4]":"border-[#E8E7EE] bg-white"}`,onClick:()=>r({textDecoration:e?.textDecoration==="underline"?"none":"underline"}),children:h.jsx(is.LuUnderline,{size:14,className:"text-[#170F4F]"})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(I.FiEdit3,{size:14,className:"text-[#170F4F]"}),h.jsx("h3",{className:"text-sm font-medium text-[#170F4F]",children:"Text Color"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("input",{type:"color",value:e.color||"#000000",onChange:s=>n({color:s.target.value}),className:"h-10 w-10 cursor-pointer border border-[#E8E7EE] transition-colors hover:border-[#170F4F]","aria-label":"Text color"}),h.jsx("input",{type:"text",value:e.color||"#000000",onChange:s=>r({color:s.target.value}),className:"flex-1 border border-[#E8E7EE] px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"#000000"})]})]})]})})}const JT={default:VT,typography:KT,layout:M0,spacing:B0,background:N0,border:T0,box:Ph,text:HT,button:Yl,image:Ql,anchor:Gl,divider:Zl,table:eu,conditional:Hh},GT=Object.entries(JT).map(([t,e])=>({id:t,component:e}));function YT(){const{selected:t,query:e}=Q.useEditor(s=>({selected:s.events.selected}));if(!t||t.size===0)return h.jsx("div",{className:"flex h-full items-center justify-center text-gray-500",children:h.jsxs("div",{className:"text-center",children:[h.jsx(I.FiSettings,{size:48,className:"mx-auto mb-4 text-gray-300"}),h.jsx("p",{className:"text-sm",children:"Select a component to see its settings"})]})});const r=Array.from(t)[0],n=e.node(r).get();if(!n)return null;if(n&&n.data.custom&&n.data.custom.settings){const s=n.data.custom.settings,i=(Array.isArray(s)?s:[s]).map(a=>GT.find(l=>l.id===a)).filter(Boolean);if(i.length>0)return h.jsx(h.Fragment,{children:i.map(a=>{const l=a.component;return ze.default.createElement(Q.NodeProvider,{id:r,related:!0,key:a.id},h.jsx(l,{}))})})}return h.jsx("div",{className:"p-4",children:h.jsx("p",{className:"text-sm text-gray-500",children:"No custom settings available for this component."})})}const ZT=[{id:"settings",label:"Settings",icon:I.FiSettings},{id:"info",label:"Info",icon:I.FiInfo},{id:"actions",label:"Actions",icon:I.FiEye}];function XT(){const{selected:t,query:e}=Q.useEditor(a=>({selected:a.events.selected})),[r,n]=F.useState("settings"),s=Array.from(t)?.[0],o=F.useMemo(()=>({settings:h.jsx(YT,{},`settings_${s}`),info:h.jsx(fC,{}),actions:h.jsx(hC,{})}),[s]),i=F.useMemo(()=>{if(!t||t.size===0)return null;const a=e.node(s).get();return a?{id:s,type:a.data.type,name:a.data.name,displayName:a.data.custom.displayName||a.data.displayName||(typeof a.data.type=="object"&&a.data.type!==null?a.data.type.resolvedName:a.data.type)||s,props:a.data.props,isCanvas:a.data.isCanvas,isDeletable:!0,isDuplicateable:!0,parent:a.data.parent}:null},[t,e]);return h.jsxs("div",{className:"flex h-full w-80 flex-col border-l border-[#e8e7ee] bg-white",children:[i&&h.jsx(pC,{displayName:String(i.displayName),name:i.name}),i&&h.jsx("div",{className:"flex border-b border-[#e8e7ee]",children:ZT.map(a=>{const l=a.icon;return h.jsxs("button",{onClick:()=>n(a.id),className:`flex flex-1 items-center justify-center gap-2 px-3 py-2 text-xs font-medium transition-colors duration-200 ${r===a.id?"border-b-2 border-[#170f4f] bg-white text-[#170f4f]":"text-gray-500 hover:bg-gray-50 hover:text-[#170f4f]"}`,children:[h.jsx(l,{size:14}),a.label]},a.id)})}),h.jsx("div",{className:"flex-1 overflow-y-auto",children:o[r]})]})}function QT({blocks:t,searchTerm:e}){const{connectors:r,query:n}=Q.useEditor(),[s,o]=F.useState(new Set),i=F.useRef({}),l=F.useMemo(()=>e.trim()?(o(new Set),t.filter(x=>x.label.toLowerCase().includes(e.toLowerCase())||x.category?.toLowerCase().includes(e.toLowerCase()))):t,[t,e]).reduce((x,w)=>{const D=w.category||"other";return x[D]||(x[D]=[]),x[D].push(w),x},{}),c=x=>{o(w=>{const D=new Set(w);return D.has(x)?D.delete(x):D.add(x),D})};F.useEffect(()=>{const x=Object.keys(l);if(x[0]&&s.size===0){const D=new Set(x.slice(1));o(D)}},[]);const d=x=>h.jsxs("div",{ref:w=>{w&&r.create(w,ze.default.createElement(x.component,{}),{})},className:"group flex cursor-move flex-col items-center gap-1.5 rounded-md bg-white p-2.5 text-center transition-all duration-200 hover:bg-gray-50",draggable:!0,onDragStart:w=>{w.currentTarget.style.opacity="0.5"},onDragEnd:w=>{w.currentTarget.style.opacity="1"},title:`Drag to add ${x.label} component`,children:[h.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded bg-[#170F4F] text-sm text-white",children:x.icon}),h.jsx("span",{className:"text-xs font-medium leading-tight text-gray-700",children:x.label})]},x.id),f={layout:"Layout",content:"Content",interactive:"Interactive",media:"Media",dynamic:"Dynamic",other:"Other"},m={layout:h.jsx(I.FiGrid,{size:14}),content:h.jsx(I.FiType,{size:14}),interactive:h.jsx(I.FiMousePointer,{size:14}),media:h.jsx(I.FiImage,{size:14}),dynamic:h.jsx(I.FiCode,{size:14}),other:h.jsx(I.FiPackage,{size:14})},g=n.node("ROOT").get(),y=g&&g.data.nodes&&g.data.nodes.length>0;return h.jsxs("div",{className:"flex h-full flex-col",children:[!y&&h.jsx("div",{className:"border-b border-[#E8E7EE] bg-gray-50/50 px-3 py-2",children:h.jsx("p",{className:"text-xs text-gray-500",children:"Drag components to the canvas to add them"})}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[Object.entries(l).map(([x,w])=>{const D=s.has(x);return h.jsxs("div",{className:"last:mb-0",children:[h.jsxs("button",{onClick:()=>c(x),className:"mb-3 flex w-full items-center gap-2 rounded p-2 text-gray-700 transition-all duration-200 hover:bg-gray-50",children:[h.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded transition-colors hover:bg-gray-100",children:D?h.jsx(I.FiChevronRight,{size:12,className:"text-gray-400"}):h.jsx(I.FiChevronDown,{size:12,className:"text-gray-400"})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"text-gray-600",children:m[x]||m.other}),h.jsx("h3",{className:"text-sm font-medium text-gray-900",children:f[x]||x})]}),h.jsx("div",{className:"h-px flex-1 bg-gray-200"}),h.jsx("span",{className:"text-xs font-medium text-gray-500",children:w.length})]}),h.jsx("div",{ref:E=>{i.current[x]=E},style:{overflow:"hidden",transition:"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:!D&&h.jsx("div",{className:"pb-1",children:h.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:w.map(d)})})})]},x)}),Object.entries(l).length===0&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[h.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-gray-100",children:h.jsx("span",{className:"text-lg",children:"📦"})}),h.jsx("h3",{className:"mb-1 text-sm font-medium text-gray-900",children:e?"No components found":"No blocks available"}),h.jsx("p",{className:"text-xs text-gray-500",children:e?"Try different search terms":"Add components to get started"})]})]})]})}const e3=t=>Pn.find(r=>{const n=r.label.toLowerCase(),s=r.id.toLowerCase(),o=t.toLowerCase();return n===o||s===o})?.icon||h.jsx(I.FiMousePointer,{size:16});function t3({searchTerm:t}){const[e,r]=F.useState(new Set),{nodes:n,actions:s,selected:o}=Q.useEditor(x=>({nodes:x.nodes,selected:x.events.selected})),[i,a]=F.useState(),l=x=>{const w=new Set(e);w.has(x)?w.delete(x):w.add(x),r(w)},c=(x,w)=>{if(!w.trim())return x;const D=new RegExp(`(${w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return x.split(D).map((S,A)=>D.test(S)?h.jsx("span",{className:"rounded bg-yellow-200 px-0.5 text-yellow-900",children:S},A):S)},d=(x,w=0,D=!1,E=[])=>{const S=n[x];if(!S)return null;const A=S.data.isCanvas,T=S.data.nodes||[],j=S.data.custom.displayName||(typeof S.data.type=="string"?S.data.type:S.data.type?.displayName)||x,B=o&&o.has(x),$=typeof S.data.name=="string"?S.data.name:S.data?.displayName||"",O=T.length>0,P=e.has(x),L=t.trim()===""||j.toLowerCase().includes(t.toLowerCase())||$.toLowerCase().includes(t.toLowerCase()),H=t.trim()!==""&&T.some(q=>{const Z=n[q];if(!Z)return!1;const he=Z.data.displayName||(typeof Z.data.type=="string"?Z.data.type:Z.data.type?.displayName)||q,Ae=typeof Z.data.name=="string"?Z.data.name:Z.data?.displayName||"";return he.toLowerCase().includes(t.toLowerCase())||Ae.toLowerCase().includes(t.toLowerCase())});return L||H?h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("div",{className:"flex w-full items-center",children:[w>0&&h.jsx("div",{style:{width:w*20}}),h.jsxs("div",{className:`group flex w-full items-center rounded-md px-2 py-1.5 transition-colors ${B?"bg-[#170F4F]/10 hover:bg-[#170F4F]/15":"hover:bg-gray-50"} ${L&&t.trim()?"ring-1 ring-yellow-300":""}`,children:[O?h.jsx("button",{onClick:()=>l(x),className:"mr-1.5 flex h-4 w-4 items-center justify-center rounded opacity-0 transition-opacity hover:bg-gray-200 group-hover:opacity-100",children:P?h.jsx(I.FiChevronRight,{size:12,className:"text-gray-500"}):h.jsx(I.FiChevronDown,{size:12,className:"text-gray-500"})}):h.jsx("div",{className:"w-6"}),h.jsx("div",{className:`mr-2.5 flex h-5 w-5 items-center justify-center ${B?"text-[#170F4F]":"text-gray-600"}`,children:e3($)}),i===x?h.jsx("input",{className:"max-w-[150px] flex-1",defaultValue:S.data.custom?.displayName||S.data.displayName,onKeyDown:q=>{q.key==="Enter"&&(s.setCustom(x,Z=>{Z.displayName=q.currentTarget.value}),a(void 0))},onBlur:q=>{s.setCustom(x,Z=>{Z.displayName=q.currentTarget.value}),a(void 0)}}):h.jsx("button",{className:`flex-1 text-left text-sm font-medium transition-colors ${B?"text-[#170F4F]":"text-gray-700 group-hover:text-[#170F4F]"}`,onClick:()=>s.selectNode(x),onDoubleClick:()=>{a(x)},children:c(j,t)})]})]}),A&&O&&(!P||t.trim()!=="")&&h.jsx("div",{className:"ml-0",children:T.map((q,Z)=>d(q,w+1,Z===T.length-1,[...E,D]))})]},x):null},m=n.ROOT?.data?.nodes||[],g=m.length>0,y=e.has("canvas");return h.jsx("div",{className:"flex h-full flex-col",children:h.jsxs("div",{className:"flex-1 space-y-0.5 overflow-y-auto p-2",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"flex w-full items-center",children:h.jsxs("div",{className:`group flex w-full items-center rounded-md px-2 py-1.5 transition-colors ${o&&o.has("ROOT")?"bg-[#170F4F]/10 hover:bg-[#170F4F]/15":"hover:bg-gray-50"}`,children:[g?h.jsx("button",{onClick:()=>l("canvas"),className:"mr-1.5 flex h-4 w-4 items-center justify-center rounded opacity-0 transition-opacity hover:bg-gray-200 group-hover:opacity-100",children:y?h.jsx(I.FiChevronRight,{size:12,className:"text-gray-500"}):h.jsx(I.FiChevronDown,{size:12,className:"text-gray-500"})}):h.jsx("div",{className:"w-6"}),h.jsx("div",{className:"mr-2.5 flex h-5 w-5 items-center justify-center text-[#170F4F]",children:h.jsx(I.FiFile,{size:14})}),h.jsx("button",{className:`flex-1 text-left text-sm font-medium transition-colors ${o&&o.has("ROOT")?"text-[#170F4F]":"text-gray-800 group-hover:text-[#170F4F]"}`,onClick:()=>s.selectNode("ROOT"),children:"Template"})]})}),g&&(!y||t.trim()!=="")&&h.jsx("div",{children:m.map((x,w)=>d(x,1,w===m.length-1,[!0]))})]}),!g&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[h.jsx("div",{className:"mb-2 flex h-10 w-10 items-center justify-center rounded-lg bg-gray-100",children:h.jsx(I.FiLayers,{size:16,className:"text-gray-400"})}),h.jsx("p",{className:"mb-1 text-xs text-gray-500",children:"No layers yet"}),h.jsx("p",{className:"text-xs text-gray-400",children:"Add components to see them here"})]})]})})}const r3=({blocks:t=Pn})=>{const[e,r]=F.useState("blocks"),[n,s]=F.useState("");return h.jsxs("div",{className:"flex h-full w-64 flex-col overflow-hidden border-r border-[#E8E7EE] bg-white",children:[h.jsx("div",{className:"border-b border-[#E8E7EE] bg-gray-50 p-3",children:h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:"text",placeholder:"Search components...",value:n,onChange:o=>s(o.target.value),className:"w-full border border-[#E8E7EE] bg-white px-3 py-2 pl-9 pr-9 text-sm text-gray-900 placeholder-gray-500 transition-all duration-200 focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]/20"}),h.jsx(I.FiSearch,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),n&&h.jsx("button",{onClick:()=>s(""),className:"absolute right-3 top-1/2 -translate-y-1/2 rounded p-0.5 text-gray-400 transition-colors duration-200 hover:bg-gray-100 hover:text-gray-600",children:h.jsx(I.FiX,{size:14})})]})}),h.jsxs("div",{className:"flex border-b border-[#E8E7EE]",children:[h.jsx("button",{className:`flex-1 border-b py-3 text-sm font-medium transition-colors duration-200 ${e==="blocks"?"border-[#170F4F] text-[#170F4F]":"border-transparent text-[#A29FB9] hover:text-[#00BAC7]"}`,onClick:()=>r("blocks"),children:"Blocks"}),h.jsx("button",{className:`flex-1 border-b py-3 text-sm font-medium transition-colors duration-200 ${e==="layers"?"border-[#170F4F] text-[#170F4F]":"border-transparent text-[#A29FB9] hover:text-[#00BAC7]"}`,onClick:()=>r("layers"),children:"Layers"})]}),h.jsx("div",{className:"flex-1 overflow-hidden",children:e==="blocks"?h.jsx(QT,{blocks:t,searchTerm:n}):h.jsx(t3,{searchTerm:n})})]})};function n3({scale:t=1,zoom:e=100,panOffset:r={x:0,y:0},onPanOffsetChange:n,onContainerResize:s,contentWidth:o=0,contentHeight:i=0,onZoomToLevel:a}){const{connectors:l}=Q.useEditor(),c=F.useRef(null),d=F.useRef(null),{isDragging:f,handleMouseDown:m,handleMouseMove:g,handleMouseUp:y}=nC({scale:t,zoom:e,panOffset:r,onPanOffsetChange:n,onZoomToLevel:a,containerRef:c});return F.useEffect(()=>{if(!c.current||!s)return;const x=new ResizeObserver(w=>{const D=w[0];if(D){const{width:E,height:S}=D.contentRect;s(E,S)}});return x.observe(c.current),()=>x.disconnect()},[s]),F.useEffect(()=>{if(!c.current||t===1)return;const x=o*t,w=i*t;tC(c.current,x,w)},[o,i,t]),h.jsx("div",{id:"bte-canvas",ref:c,className:"canvas-scrollbar relative flex flex-1 items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 p-6",style:{cursor:t>1?f?"grabbing":"grab":"default",overflow:t===1?"hidden":"auto"},onMouseDown:m,onMouseMove:g,onMouseUp:y,onMouseLeave:y,children:h.jsx("div",{ref:d,style:{transform:`scale(${t}) translate(${r.x/t}px, ${r.y/t}px)`,transformOrigin:"center center",transition:f?"none":"transform 0.2s ease-out"},children:h.jsx("div",{ref:x=>{x&&l.select(l.hover(x,""),"")},children:h.jsx(Q.Frame,{children:h.jsx(Q.Element,{canvas:!0,is:vu})})})})})}const s3=[{value:10,label:"10%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"Fit (100%)"},{value:125,label:"125%"},{value:150,label:"150%"},{value:200,label:"200%"},{value:300,label:"300%"},{value:400,label:"400%"}],o3=({zoom:t,onZoomChange:e,onZoomIn:r,onZoomOut:n,canZoomIn:s,canZoomOut:o})=>{const[i,a]=F.useState(!1),l=F.useRef(null);F.useEffect(()=>{const m=g=>{l.current&&!l.current.contains(g.target)&&a(!1)};if(i){const g=setTimeout(()=>{document.addEventListener("click",m)},0);return()=>{clearTimeout(g),document.removeEventListener("click",m)}}},[i]);const c=t==="fit"?100:t,d=typeof c=="number"?`${c%1===0?c:c.toFixed(1)}%`:"100%",f=(m,g)=>{m.stopPropagation(),e(g),a(!1)};return h.jsxs("div",{className:"absolute bottom-4 right-4 z-50 select-none",ref:l,children:[h.jsxs("div",{className:"flex h-8 items-center gap-1 border border-gray-200 bg-white/90 px-2 shadow-sm backdrop-blur-sm",children:[h.jsx("button",{onClick:n,disabled:!o,className:"flex h-6 w-6 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-30",title:"Zoom out",children:h.jsx(I.FiMinus,{size:12,strokeWidth:2.5})}),h.jsx("button",{onClick:()=>a(!i),className:"min-w-[52px] px-2 text-center text-sm font-semibold text-gray-700 transition-colors hover:text-gray-900",title:"Click to select zoom level",children:d}),h.jsx("button",{onClick:r,disabled:!s,className:"flex h-6 w-6 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-30",title:"Zoom in",children:h.jsx(I.FiPlus,{size:12,strokeWidth:2.5})})]}),i&&h.jsx("div",{className:"absolute bottom-full right-0 mb-2 w-36 overflow-hidden border border-gray-200 bg-white shadow-lg",children:h.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:s3.map(m=>h.jsx("button",{onClick:g=>f(g,m.value),className:`w-full px-3 py-1.5 text-left text-sm transition-colors hover:bg-gray-100 ${c===m.value?"bg-[#F3F2F7] font-semibold text-primary":"text-gray-700"}`,children:m.label},m.value))})})]})},i3=()=>{const[t,e]=F.useState(!1),r=()=>{console.log("Export HTML clicked"),e(!1)},n=()=>{console.log("Data Source clicked"),e(!1)};return ze.default.useEffect(()=>{const s=o=>{t&&e(!1)};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[t]),h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>e(!t),className:"rounded p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F]",title:"Menu options",children:h.jsx(I.FiMenu,{size:16})}),t&&h.jsxs("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 rounded-md border border-[#E8E7EE] bg-white py-1 shadow-lg",children:[h.jsxs("button",{onClick:r,className:"flex w-full items-center gap-3 px-4 py-2 text-sm text-gray-700 hover:bg-gray-50",children:[h.jsx(I.FiDownload,{size:14}),"Export HTML"]}),h.jsxs("button",{onClick:n,className:"flex w-full items-center gap-3 px-4 py-2 text-sm text-gray-700 hover:bg-gray-50",children:[h.jsx(I.FiDatabase,{size:14}),"Data Source"]})]})]})},a3=({canvasSize:t,showCodePanel:e,onPreviewModeToggle:r,onCanvasSizeChange:n,onCodePanelToggle:s,onSave:o,templateIsModified:i=!1,templateName:a,onTemplateNameChange:l,templateReference:c,history:d})=>{const[f,m]=F.useState(!1),g=ze.default.useRef(null);F.useEffect(()=>{f&&g.current&&(g.current.focus(),g.current.select())},[f]),F.useEffect(()=>{const E=S=>{i&&(S.preventDefault(),S.returnValue="")};return window.addEventListener("beforeunload",E),()=>{window.removeEventListener("beforeunload",E)}},[i]);const y=()=>{m(!1)},x=E=>{E.key==="Enter"&&m(!1),E.key==="Escape"&&m(!1)},w=E=>{l?.(E.target.value)},D=async E=>{try{await navigator.clipboard.writeText(E)}catch(S){console.error("Failed to copy slug:",S)}};return h.jsx("div",{className:"border-b border-[#E8E7EE] bg-white",children:h.jsx("div",{className:"px-3 py-3 sm:px-8",children:h.jsxs("div",{className:"relative flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(i3,{}),h.jsx("div",{className:"group",children:f?h.jsx("input",{ref:g,className:"w-full truncate rounded border-none bg-transparent px-1.5 text-base font-bold text-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",value:a,onChange:w,onBlur:y,onKeyDown:x,placeholder:"Untitled Template","aria-label":"Template name"}):h.jsxs("div",{className:"flex items-center",children:[h.jsxs("h1",{className:"cursor-pointer rounded px-1.5 py-1 text-base font-bold text-[#170F4F] hover:bg-gray-50",title:"Double-click to edit",onDoubleClick:()=>m(!0),children:[h.jsx("span",{className:"truncate",children:a||"Untitled Template"}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"mx-1.5 text-gray-300",children:"•"}),h.jsx("span",{className:"rounded-sm bg-gray-100 px-1 py-0.5 font-mono text-[10px] font-medium text-gray-600",children:c})]})]}),c&&h.jsx("button",{onClick:()=>D(c),className:"rounded p-0.5 opacity-0 transition-opacity hover:bg-gray-50 hover:text-[#170F4F] group-hover:opacity-100",title:"Copy slug to clipboard",children:h.jsx(I.FiCopy,{size:9,className:"text-gray-400"})})]})})]}),h.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:h.jsx("div",{className:"flex items-center gap-1 border border-[#E8E7EE] bg-white p-1",children:["desktop","tablet","mobile"].map(E=>{const S={desktop:h.jsx(I.FiMonitor,{size:16}),tablet:h.jsx(I.FiTablet,{size:16}),mobile:h.jsx(I.FiSmartphone,{size:16})};return h.jsxs("button",{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium transition-all duration-200 ${t===E?"bg-[#170F4F] text-white":"text-[#170F4F] hover:bg-[#F5F5F7]"}`,onClick:()=>n(E),title:`Switch to ${E} view`,children:[h.jsx("span",{className:"inline sm:hidden",children:S[E]}),h.jsx("span",{className:"hidden sm:inline",children:E.charAt(0).toUpperCase()+E.slice(1)})]},E)})})}),h.jsxs("div",{className:"flex items-center gap-2",children:[i?h.jsxs("div",{className:"flex items-center gap-1 text-orange-600",children:[h.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-orange-500"}),h.jsx("span",{className:"text-xs font-medium",children:"Unsaved"})]}):h.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[h.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),h.jsx("span",{className:"text-xs font-medium",children:"Saved"})]}),d&&h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:d.actionUndo,className:"p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F] disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-300",title:"Undo",disabled:!d.canUndo,children:h.jsx(ut.BiUndo,{size:16})}),h.jsx("button",{onClick:d.actionRedo,className:"p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F] disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-300",title:"Redo",disabled:!d.canRedo,children:h.jsx(ut.BiRedo,{size:16})})]}),h.jsx("button",{className:`p-1.5 transition-all duration-200 ${e?"bg-[#170F4F] text-white":"text-[#6B7280] hover:bg-[#F5F5F7] hover:text-[#170F4F]"}`,onClick:s,title:"Toggle Code Editor",children:h.jsx(I.FiCode,{size:16})}),h.jsx("button",{onClick:r,className:"p-1.5 text-[#6B7280] transition-all duration-200 hover:bg-[#F5F5F7] hover:text-[#170F4F]",title:"Preview template",children:h.jsx(I.FiEye,{size:16})}),o&&h.jsxs("button",{className:"relative flex items-center gap-1.5 bg-[#170F4F] px-3 py-1.5 text-xs font-medium text-white transition-all duration-200 hover:bg-[#009CA8]",onClick:o,title:"Save changes",children:[h.jsx(I.FiSave,{size:14}),"Save",i&&h.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 animate-pulse bg-orange-500"})]})]})]})})})},l3=F.lazy(()=>Promise.resolve().then(function(){return N3}).then(t=>({default:t.DataSourceModal}))),u3=({showCodePanel:t=!1,onPreviewToggle:e,onCodePanelToggle:r,codePanelChildren:n})=>{dC();const s=tu(),o=ru(),{store:i,actions:a,canUndo:l,canRedo:c}=Q.useEditor((he,Ae)=>({canUndo:Ae.history.canUndo(),canRedo:Ae.history.canRedo()})),{template:d,updateTemplate:f,saveTemplate:m}=$n(),[g,y]=F.useState(!1),[x,w]=F.useState(!1),[D,E]=F.useState({width:0,height:0}),S=zo[s.device]||zo.desktop,{zoom:A,scale:T,panOffset:j,setPanOffset:B,zoomIn:$,zoomOut:O,setZoomLevel:P,setZoomToLevel:L,canZoomIn:H,canZoomOut:Y}=ZD({containerWidth:D.width,containerHeight:D.height,contentWidth:S.width,contentHeight:S.height}),q=()=>{},Z=async()=>{if(!d){alert("No template loaded to save");return}try{f({snapshot:s.getState(),content:o.convertToHtml(s.getState())}),await m(),alert("Template saved successfully!")}catch(he){console.error("Error saving template:",he),alert("Error saving template. Please try again.")}};return F.useEffect(()=>{if(!x&&d&&d?.snapshot)try{s.loadState(d.snapshot)}catch(he){console.error("Error loading template into canvas:",he)}finally{w(!0)}},[d?.id]),F.useEffect(()=>{i.subscribe(Rn(()=>{f({snapshot:s.getState(),content:o.convertToHtml(s.getState())})},500),()=>{})},[]),h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx(a3,{canvasSize:s.device,showCodePanel:t,onPreviewModeToggle:e||(()=>{}),onCanvasSizeChange:s.setDevice,onCodePanelToggle:r||(()=>{}),onSave:Z,templateIsModified:d?.isModified,templateName:d?.title,onTemplateNameChange:he=>{f({title:he})},templateReference:d?.slug,history:{actionUndo:()=>a.history.undo(),actionRedo:()=>a.history.redo(),canUndo:l,canRedo:c}}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!t&&h.jsx(r3,{}),h.jsxs("div",{className:`relative flex ${t?"flex-row":"flex-col"} ${t?"w-full":"w-[60%] xl:w-[62%] 2xl:w-[80%]"} bg-gray-50`,children:[t?n:null,h.jsx(n3,{scale:T,zoom:A,panOffset:j,onPanOffsetChange:B,onContainerResize:(he,Ae)=>E({width:he,height:Ae}),contentWidth:S.width,contentHeight:S.height,onZoomIn:$,onZoomOut:O,onZoomToLevel:L,canZoomIn:H,canZoomOut:Y}),!t&&h.jsx(o3,{zoom:A,onZoomChange:P,onZoomIn:$,onZoomOut:O,canZoomIn:H,canZoomOut:Y})]}),!t&&h.jsx(XT,{})]}),g&&h.jsx(F.Suspense,{fallback:h.jsx("div",{children:"Loading..."}),children:h.jsx(l3,{isOpen:g,onClose:()=>y(!1),onDataImport:q})})]})},j0=({children:t,isHover:e,isSelected:r,name:n,showIndicator:s=!0,width:o,height:i})=>{const a=e&&!r&&s,l=r&&s,c=a||l,d={outline:l?"1px solid #170f4fff":a?"1px dashed #00BAC7":"1px solid transparent",background:l?"rgba(23,15,79,0.03)":a?"rgba(0,186,199,0.02)":"transparent",cursor:"pointer",overflow:"visible",position:"relative",width:o,height:i};return h.jsxs("div",{style:d,className:r?"avoid-transition":"",children:[c&&h.jsxs("div",{className:`absolute left-0 top-0 flex items-center gap-1.5 px-2 py-1 text-xs font-medium backdrop-blur-sm ${l?"border border-[#170F4F] bg-[#170F4F] text-white shadow-lg":"border border-[#00BAC7] bg-[#00BAC7] text-white shadow-md"} `,style:{borderRadius:"4px",transform:"translateY(-100%)",transformOrigin:"left bottom",marginTop:"-2px",zIndex:99999,position:"absolute",transition:"all 0.15s ease-out"},onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault()},children:[h.jsx("div",{className:"flex h-3 w-3 items-center justify-center",children:l?h.jsx("div",{className:"h-2 w-2 rounded-full bg-white"}):h.jsx("div",{className:"h-2 w-2 rounded-full bg-white opacity-70"})}),h.jsx("span",{className:"select-none whitespace-nowrap leading-none",children:n})]}),t]})},jh=6,ir=-3,c3={position:"absolute",width:`${jh}px`,height:`${jh}px`,background:"#170F4F",display:"block",pointerEvents:"none",boxShadow:"0 2px 8px rgba(23,15,79,0.3)",border:"0.5px solid #CCF1F4"},d3={topLeft:{left:`${ir}px`,top:`${ir}px`},topRight:{right:`${ir}px`,top:`${ir}px`},bottomLeft:{left:`${ir}px`,bottom:`${ir}px`},bottomRight:{right:`${ir}px`,bottom:`${ir}px`}},p3=({children:t,propKey:e={width:"width",height:"height"}})=>{const{actions:r,connectors:{connect:n}}=Q.useNode(),{isSelected:s,isHover:o,nodeWidth:i,nodeHeight:a,name:l}=Q.useNode(D=>({isSelected:D.events.selected,isHover:D.events.hovered,nodeWidth:D.data.props.style?.[e.width]||D.data.props[e.width]||200,nodeHeight:D.data.props.style?.[e.height]||D.data.props[e.height]||100,name:D.data.custom?.displayName||D.data.displayName})),{maxWidth:c}=Q.useEditor(D=>{const S=D.nodes.ROOT?.data?.props?.style||{},A=S.maxWidth||S.width||1200;return{maxWidth:typeof A=="string"?parseInt(A):A}}),d=F.useRef(null),f=F.useRef(null),m=F.useMemo(()=>{const D=()=>{if(typeof i=="number")return Math.round(i);if(typeof i=="string"){if(i.includes("%")&&c){const S=parseFloat(i)/100;return Math.round(c*S)}return i||200}return 200},E=()=>a==="auto"?"auto":typeof a=="number"?Math.round(a):typeof a=="string"?a.includes("%")?a:a||100:100;return{width:D(),height:E()}},[i,a,c]),[g,y]=F.useState(m),x=F.useCallback(()=>{y(m)},[m]);F.useEffect(()=>{if(!c)return;const D=typeof i=="number"?i:parseFloat(i)||0;if(D>c){const E=c/D,S=Math.floor(D*E);r.setProp(A=>{A.style||(A.style={}),A.style[e.width]=S})}},[c,i,r,e.width]);const w=F.useCallback((D,E)=>{if(!f.current)return m;const{width:S,height:A}=f.current;let T=Math.round(S+D),j=Math.round(A+E);return c&&(T=Math.min(T,c)),T=Math.max(T,50),j=Math.max(j,20),{width:T,height:j}},[m,c]);return F.useEffect(()=>{x(),r.setCustom(D=>{D.resizable=!0})},[i,a,x,r]),h.jsx(j0,{isHover:o,isSelected:s,name:l||"Component",showIndicator:!0,width:g.width,height:g.height,children:h.jsxs(U2.Resizable,{ref:D=>{D&&D.resizable&&(d.current=D,n(D.resizable))},enable:{top:s,right:s,bottom:s,left:s,topLeft:s,topRight:s,bottomLeft:s,bottomRight:s},size:g,onResizeStart:D=>{D.preventDefault(),D.stopPropagation();const E=d.current?.resizable;if(!E)return;const S=E.getBoundingClientRect();f.current={width:Math.round(S.width),height:Math.round(S.height)}},onResize:(D,E,S,A)=>{const T=w(A.width,A.height);r.setProp(j=>{j.style||(j.style={}),j.style[e.width]=T.width,j.style[e.height]=T.height}),x()},onResizeStop:(D,E,S,A)=>{const T=w(A.width,A.height);r.setProp(j=>{j.style||(j.style={}),j.style[e.width]=T.width,j.style[e.height]=T.height}),x()},handleStyles:{topLeft:{display:"block"},topRight:{display:"block"},bottomLeft:{display:"block"},bottomRight:{display:"block"}},children:[t,h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:99999},children:s&&Object.entries(d3).map(([D,E])=>h.jsx("span",{style:{...c3,...E}},D))})]})})},h3=({render:t})=>{const{id:e,isHover:r,isActive:n,name:s,isResizable:o,nodeWidth:i,nodeHeight:a}=Q.useNode(c=>({isHover:c.events.hovered,isActive:c.events.selected,name:c.data.custom?.displayName||c.data.displayName,isResizable:c.data.custom.resizable===!0,nodeWidth:c.data.props.style?.width||c.data.props.width||"min-content",nodeHeight:c.data.props.style?.height||c.data.props.height||"min-content"}));return e===W2.ROOT_NODE?h.jsx(h.Fragment,{children:t}):o?h.jsx(p3,{children:t}):h.jsx(j0,{isHover:r,isSelected:n,name:s,width:i,height:a,children:t})};class Ne{static isSchema(e){return e!==null&&typeof e=="object"&&"type"in e&&"value"in e}static getByPath(e,r){const n=r.split(".");let s=e;for(let o=0;o<n.length;o++){if(s==null)return;s=s[n[o]]}return s}static deepClone(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>this.deepClone(n));const r={};for(const n in e)r[n]=this.deepClone(e[n]);return r}static setByPath(e,r,n){const s=r.split("."),o=this.deepClone(e);let i=o;for(let a=0;a<s.length-1;a++)(!i[s[a]]||typeof i[s[a]]!="object")&&(i[s[a]]={}),i=i[s[a]];return i[s[s.length-1]]=n,o}static deleteByPath(e,r){const n=r.split("."),s=this.deepClone(e);let o=s;for(let i=0;i<n.length-1;i++){if(!o[n[i]])return e;o=o[n[i]]}return delete o[n[n.length-1]],s}static toSchema(e,r,n){if(this.isSchema(e))return e;const s=typeof e;let o="text";return s==="number"?o="number":s==="boolean"?o="boolean":s==="string"&&e.length===10&&e[4]==="-"&&e[7]==="-"&&(o="date"),{key:r,label:n||r,type:o,value:e}}static getAllSchemas(e,r=""){const n={};for(const s in e){const o=e[s],i=r?`${r}.${s}`:s;if(this.isSchema(o))n[i]={...o,key:i};else if(typeof o=="object"&&o!==null){const a=this.getAllSchemas(o,i);for(let l=0;l<a.length;l++)n[a[l].key]=a[l]}else{const a=this.toSchema(o,i,s);n[a.key]=a}}return Object.values(n)}static resolve(e){const r={};for(const n in e){const s=e[n];this.isSchema(s)?r[n]=s.value:typeof s=="object"&&s!==null?r[n]=this.resolve(s):r[n]=s}return r}}const Oh={desktop:{width:1200,height:800,name:"Desktop"},tablet:{width:768,height:1024,name:"Tablet"},mobile:{width:375,height:667,name:"Mobile"}},f3=({canvasSize:t,hasCanvasContent:e,onZoomChange:r,placeholderData:n={}})=>{const{template:s}=$n(),[o,i]=F.useState(100),[a,l]=F.useState(""),c=F.useMemo(()=>Oh[t]||Oh.desktop,[t]);return F.useEffect(()=>{const d=()=>{const f=window.innerWidth-100,m=window.innerHeight-200,g=f/c.width,y=m/c.height,x=Math.min(g,y,1)*100,w=Math.max(25,Math.min(100,x));i(w),r&&r(w)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[t,c.width,c.height,r]),F.useEffect(()=>{if(!e){l("");return}try{if(s&&s.id)if(typeof s.compile=="function"){const d=Ne.resolve(n),f=s.compile(d);l(f)}else console.warn("Template does not have compile method, using content"),l(s.content||"");else console.warn("Template not loaded or invalid"),l("")}catch(d){console.error("Error rendering template:",d),l("")}},[e,n,s]),h.jsx("div",{className:"relative flex flex-1 items-center justify-center overflow-auto bg-[#F5F5F7] p-8",children:h.jsx("div",{className:"flex h-full w-full items-center justify-center",children:h.jsxs("div",{className:"relative overflow-hidden rounded-none border border-[#E8E7EE] bg-white shadow-lg",style:{width:c.width*(o/100),height:c.height*(o/100),maxWidth:"100%",maxHeight:"100%"},children:[t==="mobile"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"absolute inset-x-0 top-0 z-10 flex h-6 items-center justify-center bg-black",children:h.jsx("div",{className:"h-1 w-12 rounded-full bg-gray-600"})}),h.jsx("div",{className:"absolute inset-x-0 bottom-1 z-10 flex justify-center",children:h.jsx("div",{className:"h-1 w-16 rounded-full bg-black opacity-30"})})]}),h.jsxs("div",{className:"h-full w-full overflow-hidden",style:{transform:`scale(${o/100})`,transformOrigin:"top left",width:`${100/(o/100)}%`,height:`${100/(o/100)}%`},children:[!e&&h.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50",children:h.jsxs("div",{className:"p-8 text-center",children:[h.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-none border-2 border-dashed border-[#E8E7EE] bg-[#F5F5F7]",children:h.jsx("span",{className:"text-2xl text-[#A29FB9]",children:"📄"})}),h.jsx("h3",{className:"mb-2 text-lg font-medium text-[#170F4F]",children:"No content to preview"}),h.jsx("p",{className:"text-sm text-[#A29FB9]",children:"Add components to see the preview"})]})}),h.jsx("div",{className:"h-full min-h-screen bg-white",style:{overflow:"visible",position:"relative",minHeight:"100%"},dangerouslySetInnerHTML:{__html:a}})]})]})})})},Lh={desktop:{width:1200,height:800,name:"Desktop",icon:I.FiMonitor},tablet:{width:768,height:1024,name:"Tablet",icon:I.FiTablet},mobile:{width:375,height:667,name:"Mobile",icon:I.FiSmartphone}},m3=({canvasSize:t,onCanvasSizeChange:e,onExitPreview:r,onDownload:n,onOpenInNewTab:s,showPlayground:o=!1,onTogglePlayground:i})=>h.jsx("div",{className:"border-b border-[#E8E7EE] bg-white px-2 py-2",children:h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 rounded-none px-2 py-1.5 text-sm font-medium text-[#170F4F] transition-colors hover:bg-[#F5F5F7]",title:"Exit Preview",children:[h.jsx(I.FiX,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Exit Preview"})]}),h.jsx("div",{className:"h-6 w-px bg-[#E8E7EE]"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(I.FiEye,{className:"h-4 w-4 text-[#00BAC7]"}),h.jsx("span",{className:"hidden text-sm font-medium text-[#170F4F] min-[900px]:inline",children:"Preview"})]})]}),h.jsx("div",{className:"flex items-center gap-1",children:Object.keys(Lh).map(a=>{const l=Lh[a],c=l.icon,d=t===a;return h.jsx("button",{onClick:()=>e(a),className:`flex items-center justify-center rounded-none p-2 transition-all duration-200 ${d?"bg-[#170F4F] text-white":"border border-[#E8E7EE] text-[#170F4F] hover:bg-[#F5F5F7]"} `,title:l.name,children:h.jsx(c,{className:"h-4 w-4"})},a)})}),h.jsxs("div",{className:"flex items-center gap-1",children:[i&&h.jsx("button",{onClick:i,className:`flex items-center justify-center rounded-none p-2 transition-all duration-200 ${o?"bg-[#170F4F] text-white":"border border-[#E8E7EE] text-[#170F4F] hover:bg-[#F5F5F7]"} `,title:"Toggle Data Playground",children:h.jsx(I.FiDatabase,{className:"h-4 w-4"})}),h.jsx("button",{onClick:n,className:"flex items-center justify-center rounded-none border border-[#E8E7EE] p-2 text-[#170F4F] transition-colors hover:bg-[#F5F5F7]",title:"Download",children:h.jsx(I.FiDownload,{className:"h-4 w-4"})}),h.jsx("button",{onClick:s,className:"flex items-center justify-center rounded-none bg-[#170F4F] p-2 text-white transition-colors hover:bg-[#00BAC7]",title:"Open in New Tab",children:h.jsx(I.FiExternalLink,{className:"h-4 w-4"})})]})]})}),g3=({isOpen:t,onToggle:e,children:r,side:n="right",minWidth:s=350,maxWidth:o=700,defaultWidth:i=450,showToggleButton:a=!0,toggleButtonLabel:l="Toggle",resizable:c=!0,showOverlay:d=!0})=>{const[f,m]=F.useState(i),[g,y]=F.useState(!1),x=F.useRef(null),w=F.useRef(null),D=F.useRef(0),E=F.useRef(0),S=F.useCallback(P=>{c&&(y(!0),D.current=P.clientX,E.current=f,P.preventDefault())},[f,c]),A=F.useCallback(P=>{if(!g)return;const L=n==="right"?D.current-P.clientX:P.clientX-D.current,H=Math.min(o,Math.max(s,E.current+L));m(H)},[g,n,s,o]),T=F.useCallback(()=>{y(!1)},[]);F.useEffect(()=>{if(g)return document.addEventListener("mousemove",A),document.addEventListener("mouseup",T),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",T),document.body.style.cursor="",document.body.style.userSelect=""}},[g,A,T]);const j=t?"translate-x-0":n==="right"?"translate-x-full":"-translate-x-full",B=n==="right"?"border-l":"border-r",$=n==="right"?"right-0":"left-0",O=n==="right"?"left-0":"right-0";return h.jsxs(h.Fragment,{children:[t&&d&&h.jsx("div",{className:"absolute inset-0 z-[90] bg-transparent",onClick:e}),h.jsxs("div",{ref:x,className:`absolute bottom-0 top-0 z-[100] flex flex-col border-[#E8E7EE] bg-white shadow-2xl transition-transform duration-300 ease-in-out ${B} ${$} ${j}`,style:{width:`${f}px`},children:[c&&h.jsx("div",{ref:w,className:`absolute bottom-0 top-0 w-1 cursor-col-resize transition-colors duration-200 hover:bg-[#00BAC7] ${g?"bg-[#00BAC7]":"bg-transparent"} group ${O}`,onMouseDown:S,children:h.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform opacity-0 transition-opacity group-hover:opacity-100",children:h.jsx(I.FiMoreVertical,{className:"h-3 w-3 text-[#A29FB9]"})})}),a&&!t&&h.jsxs("button",{onClick:e,className:`group absolute top-1/2 z-10 flex -translate-y-1/2 items-center gap-2 border border-[#E8E7EE] bg-white px-2 py-6 text-sm font-medium text-[#170F4F] shadow-lg transition-all hover:bg-[#F5F5F7] ${n==="right"?"right-full rounded-l-lg border-r-0":"left-full rounded-r-lg border-l-0"}`,style:{writingMode:"vertical-rl"},children:[n==="right"?h.jsx(I.FiChevronLeft,{className:"h-4 w-4",style:{writingMode:"horizontal-tb"}}):h.jsx(I.FiChevronRight,{className:"h-4 w-4",style:{writingMode:"horizontal-tb"}}),h.jsx("span",{children:l})]}),r]})]})},b3=["eq","ne","gt","lt"],y3=({placeholders:t,onPlaceholdersChange:e})=>{const{template:r}=$n(),n=F.useMemo(()=>{const l=[...r.content.matchAll(/\{\{(.*?)\}\}/g)].map(d=>d[1].trim()).map(d=>d.startsWith("#if ")?d.slice(4).trim():d),c=new Set;return l.forEach(d=>{if(d==="/if"||d==="else")return;const f=d.split(/\s+/);f.length===1?c.add(f[0]):f.forEach((m,g)=>{if(b3.includes(m.replace(/[()"]/g,""))&&f[g+1]){const y=f[g+1];c.add(y)}})}),[...c]},[r.content]),s=Ne.getAllSchemas(t).map(l=>l.key),o=n.filter(l=>!s.includes(l)),i=l=>{const c={key:l,label:l,type:"text",value:"Sample text"};e(d=>Ne.setByPath(d,l,c))},a=F.useMemo(()=>{const l=Math.ceil(o.length/3);return[o.slice(0,l),o.slice(l,l*2),o.slice(l*2)].filter(c=>c.length>0)},[o]);return h.jsx("div",{className:"mt-2 max-h-32 space-y-2 overflow-x-auto pb-2",children:a.map((l,c)=>h.jsx("div",{className:"flex flex-row gap-2",children:l.map(d=>h.jsx("span",{onClick:()=>i(d),className:"inline-flex flex-shrink-0 cursor-pointer items-center rounded-none bg-[#170F4F] bg-opacity-100 px-3 py-1 text-sm font-medium text-white transition-colors hover:bg-[#00BAC7]",children:d},d))},c))})},x3=({isOpen:t,onToggle:e,placeholders:r,onPlaceholdersChange:n})=>{const{template:s}=$n(),[o,i]=F.useState({type:"text"}),[a,l]=F.useState(!1),[c,d]=F.useState(""),[f,m]=F.useState(null),[g,y]=F.useState(null),x=F.useMemo(()=>Ne.getAllSchemas(r),[r]),[w,D]=F.useState(x.length===0),E=F.useMemo(()=>{if(!c)return x;const L=c.toLowerCase();return x.filter(H=>H.key.toLowerCase().includes(L)||H.label.toLowerCase().includes(L))},[x,c]),S=(L,H)=>{n(Y=>{const q=Ne.getByPath(Y,L);return Ne.isSchema(q)?Ne.setByPath(Y,L,{...q,value:H}):Ne.setByPath(Y,L,H)})},A=()=>{if(!o.key||!o.label||!o.type)return;const L={key:o.key,label:o.label,type:o.type,value:o.value||T(o.type),options:o.options};n({...r,[L.key]:L}),i({type:"text"}),l(!1)},T=L=>{switch(L){case"text":return"Sample text";case"number":return 0;case"boolean":return!1;case"date":return new Date().toISOString().split("T")[0];case"enum":return"";default:return""}},j=L=>{n(H=>Ne.deleteByPath(H,L))},B=(L,H)=>{n(Y=>{const q=Ne.getByPath(Y,L);if(!Ne.isSchema(q))return Y;const Z={...q,type:H,value:T(H),options:H==="enum"?q.options||[]:void 0};return Ne.setByPath(Y,L,Z)}),m(null)},$=(L,H)=>{n(Y=>{const q=Ne.getByPath(Y,L);if(!Ne.isSchema(q))return Y;const Z={...q,options:H};return Ne.setByPath(Y,L,Z)})},O=L=>{switch(L){case"boolean":return"True/False";case"enum":return"Multiple Choice";case"text":return"Text";case"number":return"Number";case"date":return"Date"}},P=L=>{const H=Ne.getByPath(r,L.key),Y=Ne.isSchema(H)?H.value:H??L.value??"";switch(L.type){case"text":return h.jsx("input",{type:"text",value:String(Y),onChange:q=>S(L.key,q.target.value),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",placeholder:"Enter text here..."});case"number":return h.jsx("input",{type:"number",value:Number(Y),onChange:q=>S(L.key,parseFloat(q.target.value)||0),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",placeholder:"Enter a number..."});case"boolean":return h.jsxs("div",{className:"flex items-center gap-4 rounded-none border border-[#E8E7EE] bg-white p-3",children:[h.jsxs("label",{className:"flex cursor-pointer items-center",children:[h.jsx("input",{type:"radio",name:`${L.key}-bool`,checked:!!Y,onChange:()=>S(L.key,!0),className:"h-4 w-4 border-[#E8E7EE] text-[#170F4F] focus:ring-2 focus:ring-[#170F4F]"}),h.jsx("span",{className:"ml-2 text-sm font-medium text-[#170F4F]",children:"Yes"})]}),h.jsxs("label",{className:"flex cursor-pointer items-center",children:[h.jsx("input",{type:"radio",name:`${L.key}-bool`,checked:!Y,onChange:()=>S(L.key,!1),className:"h-4 w-4 border-[#E8E7EE] text-[#170F4F] focus:ring-2 focus:ring-[#170F4F]"}),h.jsx("span",{className:"ml-2 text-sm font-medium text-[#170F4F]",children:"No"})]})]});case"enum":return h.jsxs("select",{value:String(Y),onChange:q=>S(L.key,q.target.value),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",children:[h.jsx("option",{value:"",children:"Choose an option..."}),L.options?.map((q,Z)=>typeof q=="string"?h.jsx("option",{value:q,children:q},Z):h.jsx("option",{value:String(q.value),children:q.label},Z))]});case"date":return h.jsx("input",{type:"date",value:String(Y),onChange:q=>S(L.key,q.target.value),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]"});default:return null}};return h.jsxs(g3,{isOpen:t,onToggle:e,side:"right",minWidth:350,maxWidth:700,defaultWidth:450,toggleButtonLabel:`Data (${x.length})`,resizable:!0,children:[h.jsxs("div",{className:"flex-shrink-0 border-b border-[#E8E7EE] bg-white px-6 py-4",children:[h.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[h.jsx("h3",{className:"text-lg font-semibold text-[#170F4F]",children:"Placeholders"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 rounded-none bg-[#170F4F] px-4 py-2 text-sm font-medium text-white shadow-sm transition-all duration-200 hover:bg-[#00BAC7] hover:shadow-md disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-[#170F4F] disabled:hover:shadow-sm",disabled:a,children:[h.jsx(I.FiPlus,{className:"h-4 w-4"}),"Add"]}),h.jsx("button",{onClick:e,className:"flex items-center justify-center rounded-none p-2 text-[#170F4F] transition-colors hover:bg-[#F5F5F7]",title:"Close drawer",children:h.jsx(I.FiChevronRight,{className:"h-5 w-5"})})]})]}),h.jsx("p",{className:"mb-4 text-sm text-[#A29FB9]",children:"Customize the content that appears in your template."}),x.length>8&&h.jsx("div",{className:"mb-4",children:h.jsx("input",{type:"text",value:c,onChange:L=>d(L.target.value),placeholder:"Search placeholders...",className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]"})}),(()=>{const L=[...new Set([...(s?.content||"").matchAll(/\{\{(.*?)\}\}/g)].map(q=>q[1]))],H=x.map(q=>q.key),Y=L.filter(q=>!H.includes(q));return Y.length>0?h.jsxs("div",{className:"rounded-none border border-[#E8E7EE] bg-[#F9F8FE]",children:[h.jsxs("button",{onClick:()=>D(!w),className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-[#F5F5F7]",children:[h.jsxs("p",{className:"text-xs font-semibold text-[#170F4F]",children:["Suggested Placeholders (",Y.length,")"]}),w?h.jsx(I.FiChevronDown,{className:"h-4 w-4 text-[#170F4F]"}):h.jsx(I.FiChevronRight,{className:"h-4 w-4 text-[#170F4F]"})]}),h.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${w?"max-h-96 opacity-100":"max-h-0 opacity-0"}`,children:h.jsx("div",{className:"px-3 pb-3",children:h.jsx(y3,{placeholders:r,onPlaceholdersChange:n})})})]}):null})(),a&&h.jsxs("div",{className:"mt-4 animate-fade-in rounded-none border border-[#E8E7EE] bg-white p-4 shadow-sm",children:[h.jsx("h4",{className:"mb-4 text-sm font-semibold text-[#170F4F]",children:"Add New Placeholder"}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-xs font-medium text-[#170F4F]",children:"Field Name"}),h.jsx("input",{type:"text",placeholder:"e.g., Customer Name",value:o.label||"",onChange:L=>{const H=L.target.value,Y=H.replace(/[^a-zA-Z0-9\s]/g,"").replace(/\s+/g,"_").replace(/^_+|_+$/g,"");i({...o,label:H,key:Y})},className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"mb-2 block text-xs font-medium text-[#170F4F]",children:"Data Type"}),h.jsxs("select",{value:o.type||"text",onChange:L=>i({...o,type:L.target.value}),className:"w-full rounded-none border border-[#E8E7EE] bg-white px-3 py-2 text-sm transition-all focus:border-[#170F4F] focus:bg-[#F9F8FE] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",children:[h.jsx("option",{value:"text",children:"Text"}),h.jsx("option",{value:"number",children:"Number"}),h.jsx("option",{value:"boolean",children:"True/False"}),h.jsx("option",{value:"enum",children:"Multiple Choice"}),h.jsx("option",{value:"date",children:"Date"})]})]})]}),h.jsxs("div",{className:"mt-6 flex gap-2 border-t border-[#E8E7EE] pt-4",children:[h.jsx("button",{onClick:A,disabled:!o.key||!o.label,className:"rounded-none bg-[#170F4F] px-4 py-2 text-sm font-medium text-white shadow-sm transition-colors duration-200 hover:bg-[#00BAC7] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-[#170F4F]",children:"Confirm"}),h.jsx("button",{onClick:()=>l(!1),className:"rounded-none border border-[#E8E7EE] px-4 py-2 text-sm font-medium text-[#A29FB9] transition-colors duration-200 hover:bg-[#F9F8FE] hover:text-[#170F4F]",children:"Cancel"})]})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:x.length===0?h.jsxs("div",{className:"py-12 text-center text-[#A29FB9]",children:[h.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE]",children:h.jsx(I.FiPlus,{className:"h-8 w-8 text-[#170F4F]"})}),h.jsx("h4",{className:"mb-2 text-lg font-medium text-[#170F4F]",children:"No data fields yet"}),h.jsx("p",{className:"mb-4 text-sm",children:"Add data fields to make your template dynamic"}),h.jsx("button",{onClick:()=>l(!0),className:"text-sm font-medium text-[#170F4F] transition-colors duration-200 hover:text-[#00BAC7]",children:"Add your first field"})]}):E.length===0?h.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:h.jsxs("p",{className:"text-sm text-[#A29FB9]",children:['No placeholders found matching "',c,'"']})}):h.jsx("div",{className:"space-y-2 pb-6",children:E.map(L=>h.jsxs("div",{className:"rounded-none border border-[#E8E7EE] bg-white p-4 transition-all duration-200 hover:border-[#170F4F] hover:shadow-sm",children:[h.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[h.jsx("div",{className:"min-w-0 flex-1",children:h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx("span",{className:"inline-flex items-center break-all rounded-none bg-[#170F4F] bg-opacity-100 px-2 py-[2px] text-sm font-medium text-white",children:L.key}),f===L.key?h.jsxs("select",{value:L.type,onChange:H=>B(L.key,H.target.value),onBlur:()=>m(null),autoFocus:!0,className:"inline-flex flex-shrink-0 items-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE] px-2 py-[2px] text-sm font-medium text-[#170F4F] transition-all hover:border-[#170F4F] focus:border-[#170F4F] focus:outline-none focus:ring-2 focus:ring-[#170F4F]",children:[h.jsx("option",{value:"text",children:"Text"}),h.jsx("option",{value:"number",children:"Number"}),h.jsx("option",{value:"boolean",children:"True/False"}),h.jsx("option",{value:"enum",children:"Multiple Choice"}),h.jsx("option",{value:"date",children:"Date"})]}):h.jsx("button",{onClick:()=>m(L.key),className:"inline-flex flex-shrink-0 items-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE] px-2 py-[2px] text-sm font-medium text-[#170F4F] transition-all hover:border-[#170F4F] hover:bg-white",children:O(L.type)})]})}),h.jsx("button",{onClick:()=>j(L.key),className:"flex-shrink-0 rounded-none p-1 text-[#A29FB9] transition-colors duration-200 hover:bg-red-50 hover:text-red-500",title:"Remove field",children:h.jsx(I.FiTrash2,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"w-full",children:P(L)}),L.type==="enum"&&h.jsxs("div",{className:"mt-3 border-t border-[#E8E7EE] pt-3",children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("label",{className:"text-xs font-medium text-[#170F4F]",children:"Options"}),g!==L.key&&h.jsx("button",{onClick:()=>y(L.key),className:"text-xs font-medium text-[#170F4F] transition-colors hover:text-[#00BAC7]",children:"Edit options"})]}),g===L.key?h.jsxs("div",{className:"space-y-2",children:[(L.options||[]).map((H,Y)=>{const q=typeof H=="string"?H:String(H.value);return h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:q,onChange:Z=>{const he=[...L.options||[]];he[Y]=Z.target.value,$(L.key,he)},className:"flex-1 rounded-none border border-[#E8E7EE] bg-white px-2 py-1 text-sm transition-all focus:border-[#170F4F] focus:outline-none focus:ring-1 focus:ring-[#170F4F]",placeholder:"Option value"}),h.jsx("button",{onClick:()=>{const Z=(L.options||[]).filter((he,Ae)=>Ae!==Y);$(L.key,Z)},className:"rounded-none p-1 text-[#A29FB9] transition-colors hover:bg-red-50 hover:text-red-500",title:"Remove option",children:h.jsx(I.FiTrash2,{className:"h-4 w-4"})})]},Y)}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("button",{onClick:()=>{const H=[...L.options||[],""];$(L.key,H)},className:"flex items-center gap-1 rounded-none border border-[#E8E7EE] bg-white px-2 py-1 text-xs font-medium text-[#170F4F] transition-colors hover:bg-[#F9F8FE]",children:[h.jsx(I.FiPlus,{className:"h-3 w-3"}),"Add option"]}),h.jsx("button",{onClick:()=>y(null),className:"rounded-none px-2 py-1 text-xs font-medium text-[#A29FB9] transition-colors hover:text-[#170F4F]",children:"Done"})]})]}):h.jsx("div",{className:"flex flex-wrap gap-1",children:(L.options||[]).length===0?h.jsx("p",{className:"text-xs text-[#A29FB9]",children:"No options added yet"}):(L.options||[]).map((H,Y)=>{const q=typeof H=="string"?H:H.label||H.value;return h.jsx("span",{className:"inline-flex items-center rounded-none border border-[#E8E7EE] bg-[#F9F8FE] px-2 py-[2px] text-xs text-[#170F4F]",children:q},Y)})})]})]})]},L.key))})})]})},v3=()=>{const[t,e]=F.useState([]),r=F.useCallback((s,o="success")=>{const i=Date.now().toString();return e(a=>[...a,{id:i,message:s,type:o}]),i},[]),n=F.useCallback(s=>{e(o=>o.filter(i=>i.id!==s))},[]);return{toasts:t,showToast:r,hideToast:n}},_h={[zr.TemplateFormat.HTML]:{extension:"html",mimeType:"text/html"},[zr.TemplateFormat.TEXT]:{extension:"txt",mimeType:"text/plain"},[zr.TemplateFormat.PDF]:{extension:"pdf",mimeType:"application/pdf"}};class w3{static downloadFile(e,r){const n=URL.createObjectURL(e),s=document.createElement("a");s.href=n,s.download=r,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)}static getFileName(e,r){return`${e?.title||e.slug||"bolttech-page"}.${r}`}static html(e,r){const n=e.compile?e.compile(r):e.content,s=this.getFileName(e,"html"),o=new Blob([n],{type:"text/html"});this.downloadFile(o,s)}static async pdf(e,r){const n=await e.render(r),s=n instanceof Blob?n:new Blob([new Uint8Array(n)],{type:"application/pdf"}),o=this.getFileName(e,"pdf");this.downloadFile(s,o)}static async download(e,r){if(!e.format)throw new Error("Template format is missing. Please set a format for this template before downloading.");const n=_h[e.format];if(!n)throw new Error(`Unsupported template format: ${e.format}. Supported formats: ${Object.keys(_h).join(", ")}`);const{extension:s,mimeType:o}=n,i=await e.render(r),a=i instanceof Blob?i:new Blob([new Uint8Array(i)],{type:o}),l=this.getFileName(e,s);this.downloadFile(a,l)}}const D3=({message:t,type:e,onClose:r,duration:n=3e3})=>{const[s,o]=F.useState(!0),i=F.useMemo(()=>{const d=document.querySelector(".bolttech-template-editor");return d&&d.shadowRoot?d.shadowRoot:document.body},[]);F.useEffect(()=>{if(e!=="loading"&&n>0){const d=setTimeout(()=>{o(!1),setTimeout(r,300)},n);return()=>clearTimeout(d)}},[e,n,r]);const a=()=>{switch(e){case"loading":return h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#170F4F]",children:h.jsx(I.FiDownload,{className:"h-5 w-5 animate-pulse text-white"})});case"success":return h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#00BAC7]",children:h.jsx(I.FiCheck,{className:"h-5 w-5 text-white"})});case"error":return h.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#FF3B30]",children:h.jsx(I.FiAlertCircle,{className:"h-5 w-5 text-white"})})}},l=()=>{switch(e){case"loading":return"Downloading...";case"success":return"Success";case"error":return"Error"}},c=h.jsxs("div",{className:`absolute bottom-4 right-4 z-[10000] flex min-w-[320px] items-center gap-3 rounded-none border border-[#E8E7EE] bg-white px-4 py-3 shadow-lg transition-all duration-300 ${s?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"}`,children:[a(),h.jsxs("div",{className:"flex flex-1 flex-col gap-0.5",children:[h.jsx("span",{className:"text-sm font-semibold text-[#170F4F]",children:l()}),h.jsx("span",{className:"text-sm text-[#A29FB9]",children:t})]}),e!=="loading"&&h.jsx("button",{onClick:()=>{o(!1),setTimeout(r,300)},className:"rounded-none p-1 text-[#A29FB9] transition-colors hover:bg-[#F5F5F7] hover:text-[#170F4F]",children:h.jsx(I.FiX,{className:"h-4 w-4"})})]});return Ni.createPortal(c,i)},al={desktop:{width:1200,height:800,name:"Desktop"},tablet:{width:768,height:1024,name:"Tablet"},mobile:{width:375,height:667,name:"Mobile"}},C3=({isPreviewMode:t,onExitPreview:e,initialPlaceholders:r={}})=>{const{getState:n,device:s,setDevice:o,isEmpty:i}=tu(),{convertToHtml:a}=ru(),{template:l}=$n(),{toasts:c,showToast:d,hideToast:f}=v3(),[m,g]=F.useState(!1),[y,x]=F.useState(100),[w,D]=F.useState(!1),[E,S]=F.useState(r),A=F.useMemo(()=>{const O=document.querySelector(".bolttech-template-editor");return O&&O.shadowRoot?O.shadowRoot:document.body},[]),T=()=>{g(!0),setTimeout(()=>{e(),g(!1)},300)},j=async()=>{const O=d("Preparing download...","loading");try{const P=Ne.resolve(E);await w3.download(l,P),f(O),d("Download completed successfully!","success")}catch(P){f(O);const L=P instanceof Error?P.message:"Unknown error";d(`Failed to download: ${L}`,"error"),console.error("Error downloading file:",P)}},B=()=>{D(!w)};if(!t)return null;const $=h.jsxs("div",{className:`absolute inset-0 z-50 bg-[#F5F5F7] ${m?"animate-fade-out":"animate-fade-in"}`,children:[h.jsx("div",{className:m?"animate-slide-up-out":"animate-slide-down",children:h.jsx(m3,{canvasSize:s,onCanvasSizeChange:o,onExitPreview:T,onDownload:j,onOpenInNewTab:()=>{window.open()?.document.write(a(n()))},showPlayground:w,onTogglePlayground:B})}),h.jsxs("div",{className:"relative flex h-full overflow-hidden",children:[h.jsx("div",{className:m?"animate-slide-down-out":"animate-slide-up",style:{flex:1},children:h.jsx(f3,{canvasSize:s,hasCanvasContent:i,onZoomChange:x,placeholderData:E})}),h.jsx(x3,{isOpen:w,onToggle:B,placeholders:E,onPlaceholdersChange:S})]}),h.jsxs("div",{className:"absolute bottom-4 left-4 z-[60] rounded-none bg-[#170F4F] px-3 py-2 text-sm text-white shadow-md",children:[al[s].name," • ",al[s].width,"×",al[s].height,"px • ",y.toFixed(3),"%"]}),c.map(O=>h.jsx(D3,{message:O.message,type:O.type,onClose:()=>f(O.id)},O.id))]});return Ni.createPortal($,A)},k3=({message:t="Loading...",size:e="md",fullScreen:r=!1})=>{const n={sm:"h-10 w-10",md:"h-16 w-16",lg:"h-24 w-24"},s=r?"fixed inset-0 z-50 flex items-center justify-center bg-white":"flex items-center justify-center";return h.jsx("div",{className:s,children:h.jsxs("div",{className:"flex flex-col items-center gap-6",children:[h.jsxs("div",{className:`relative ${n[e]}`,role:"status","aria-label":t,children:[h.jsx("div",{className:"absolute inset-0 animate-spin rounded-full border-4 border-border border-t-primary",style:{animationDuration:"1s"}}),h.jsx("div",{className:"absolute inset-2 animate-spin rounded-full border-4 border-border border-t-secondary",style:{animationDuration:"1.5s",animationDirection:"reverse"}})]}),t&&h.jsxs("div",{className:"flex flex-col items-center gap-3",children:[h.jsx("p",{className:"text-sm font-medium text-primary",children:t}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-primary",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-secondary",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-accent",style:{animationDelay:"300ms"}})]})]})]})})},E3=Pn.reduce((t,e)=>(t[e.id]=e.component,t),{CanvasTemplate:vu}),S3=({placeholders:t={}})=>{const e=Kh(),{error:r,loading:n,template:s}=$n(),[o,i]=F.useState(!0);if(n)return h.jsx(k3,{message:"Loading template...",fullScreen:!0});const a=()=>{window.history.back()},l=()=>{i(!1)};return h.jsxs(h.Fragment,{children:[r&&o&&h.jsx(aC,{templateId:s?.id,errorMessage:r,onContinue:l,onGoBack:a}),h.jsxs(Q.Editor,{resolver:E3,onRender:h3,enabled:e.isEditorEnabled,children:[h.jsx(u3,{onPreviewToggle:e.togglePreview,showCodePanel:e.showCodePanel,onCodePanelToggle:e.toggleCodePanel,codePanelChildren:h.jsx(iC,{onClose:e.closeCodePanel})}),h.jsx(C3,{isPreviewMode:e.showPreview,onExitPreview:()=>e.togglePreview(),initialPlaceholders:t})]})]})},F3='@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Arial,Helvetica,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\\!container{width:100%!important}.container{width:100%}@media (min-width: 480px){.\\!container{max-width:480px!important}.container{max-width:480px}}@media (min-width: 768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width: 1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width: 1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width: 1440px){.\\!container{max-width:1440px!important}.container{max-width:1440px}}@media (min-width: 1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-2{inset:.5rem}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-0\\.5{right:-.125rem}.-top-0\\.5{top:-.125rem}.bottom-0{bottom:0}.bottom-1{bottom:.25rem}.bottom-4{bottom:1rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-3{left:.75rem}.left-4{left:1rem}.left-\\[75\\%\\]{left:75%}.left-auto{left:auto}.left-full{left:100%}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-auto{right:auto}.right-full{right:100%}.top-0{top:0}.top-1\\/2{top:50%}.top-2{top:.5rem}.top-\\[-2px\\]{top:-2px}.top-\\[-3px\\]{top:-3px}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.z-\\[10000\\]{z-index:10000}.z-\\[100\\]{z-index:100}.z-\\[60\\]{z-index:60}.z-\\[90\\]{z-index:90}.z-\\[9999\\]{z-index:9999}.mx-1\\.5{margin-left:.375rem;margin-right:.375rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-8{margin-bottom:2rem}.mb-\\[8px\\]{margin-bottom:8px}.ml-0{margin-left:0}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-1\\.5{margin-right:.375rem}.mr-2\\.5{margin-right:.625rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1{height:.25rem}.h-1\\.5{height:.375rem}.h-10{height:2.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\\[26px\\]{height:26px}.h-\\[400px\\]{height:400px}.h-\\[90vh\\]{height:90vh}.h-full{height:100%}.h-px{height:1px}.max-h-0{max-height:0px}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-96{max-height:24rem}.max-h-\\[42vh\\]{max-height:42vh}.min-h-\\[80px\\]{min-height:80px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\\.5{width:.375rem}.w-1\\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-36{width:9rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-80{width:20rem}.w-\\[10\\%\\]{width:10%}.w-\\[20\\%\\]{width:20%}.w-\\[26px\\]{width:26px}.w-\\[60\\%\\]{width:60%}.w-\\[90\\%\\]{width:90%}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\\[120px\\]{min-width:120px}.min-w-\\[140px\\]{min-width:140px}.min-w-\\[180px\\]{min-width:180px}.min-w-\\[320px\\]{min-width:320px}.min-w-\\[52px\\]{min-width:52px}.max-w-6xl{max-width:72rem}.max-w-\\[150px\\]{max-width:150px}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}.animate-fade-in{animation:fadeIn .4s ease-out}.animate-fade-out{animation:fadeOut .3s ease-in}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.animate-slide-down{animation:slideDown .5s ease-out .1s both}.animate-slide-down-out{animation:slideDownOut .3s ease-in both}.animate-slide-up{animation:slideUp .5s ease-out .2s both}.animate-slide-up-out{animation:slideUpOut .3s ease-in both}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0\\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:8px}.rounded-md{border-radius:4px}.rounded-none{border-radius:0}.rounded-sm{border-radius:2px}.rounded-l-lg{border-top-left-radius:8px;border-bottom-left-radius:8px}.rounded-r-lg{border-top-right-radius:8px;border-bottom-right-radius:8px}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\\[\\#00BAC7\\]{--tw-border-opacity: 1;border-color:rgb(0 186 199 / var(--tw-border-opacity, 1))}.border-\\[\\#00BAC7\\]\\/60{border-color:#00bac799}.border-\\[\\#170F4F\\]{--tw-border-opacity: 1;border-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.border-\\[\\#170F4F\\]\\/60{border-color:#170f4f99}.border-\\[\\#170f4f\\]{--tw-border-opacity: 1;border-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.border-\\[\\#30aab3\\]{--tw-border-opacity: 1;border-color:rgb(48 170 179 / var(--tw-border-opacity, 1))}.border-\\[\\#3B82F6\\]{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-\\[\\#D1D5DB\\]{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-\\[\\#E8E7EE\\]{--tw-border-opacity: 1;border-color:rgb(232 231 238 / var(--tw-border-opacity, 1))}.border-\\[\\#dce7fe\\]{--tw-border-opacity: 1;border-color:rgb(220 231 254 / var(--tw-border-opacity, 1))}.border-\\[\\#e8e7ee\\]{--tw-border-opacity: 1;border-color:rgb(232 231 238 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-border{--tw-border-opacity: 1;border-color:rgb(232 231 238 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-t-primary{--tw-border-opacity: 1;border-top-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.border-t-secondary{--tw-border-opacity: 1;border-top-color:rgb(48 170 179 / var(--tw-border-opacity, 1))}.bg-\\[\\#00BAC7\\]{--tw-bg-opacity: 1;background-color:rgb(0 186 199 / var(--tw-bg-opacity, 1))}.bg-\\[\\#00BAC7\\]\\/90{background-color:#00bac7e6}.bg-\\[\\#170F4F\\]{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.bg-\\[\\#170F4F\\]\\/10{background-color:#170f4f1a}.bg-\\[\\#170F4F\\]\\/90{background-color:#170f4fe6}.bg-\\[\\#170f4f\\]{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.bg-\\[\\#181c24\\]{--tw-bg-opacity: 1;background-color:rgb(24 28 36 / var(--tw-bg-opacity, 1))}.bg-\\[\\#23272f\\]{--tw-bg-opacity: 1;background-color:rgb(35 39 47 / var(--tw-bg-opacity, 1))}.bg-\\[\\#CCF1F4\\]{--tw-bg-opacity: 1;background-color:rgb(204 241 244 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E8E7EE\\]{--tw-bg-opacity: 1;background-color:rgb(232 231 238 / var(--tw-bg-opacity, 1))}.bg-\\[\\#EFF6FF\\]{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F3F2F7\\]{--tw-bg-opacity: 1;background-color:rgb(243 242 247 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F5F5F7\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 247 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F9F8FE\\]{--tw-bg-opacity: 1;background-color:rgb(249 248 254 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F9FAFB\\]{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-\\[\\#FF3B30\\]{--tw-bg-opacity: 1;background-color:rgb(255 59 48 / var(--tw-bg-opacity, 1))}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(255 202 48 / var(--tw-bg-opacity, 1))}.bg-background-light{--tw-bg-opacity: 1;background-color:rgb(245 245 247 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\\/50{background-color:#00000080}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-50\\/50{background-color:#f9fafb80}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-secondary{--tw-bg-opacity: 1;background-color:rgb(48 170 179 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/90{background-color:#ffffffe6}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-opacity-100{--tw-bg-opacity: 1}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-gray-100{--tw-gradient-from: #f3f4f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(243 244 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-200{--tw-gradient-to: #e5e7eb var(--tw-gradient-to-position)}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\\[2px\\]{padding:2px}.px-0\\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\\[2px\\]{padding-top:2px;padding-bottom:2px}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-6{padding-bottom:1.5rem}.pb-8{padding-bottom:2rem}.pl-9{padding-left:2.25rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-9{padding-right:2.25rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\\[10px\\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-wide{letter-spacing:2px}.text-\\[\\#00BAC7\\]{--tw-text-opacity: 1;color:rgb(0 186 199 / var(--tw-text-opacity, 1))}.text-\\[\\#170F4F\\],.text-\\[\\#170f4f\\]{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.text-\\[\\#3B82F6\\]{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-\\[\\#6B7280\\]{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-\\[\\#A29FB9\\]{--tw-text-opacity: 1;color:rgb(162 159 185 / var(--tw-text-opacity, 1))}.text-\\[\\#FF3B30\\]{--tw-text-opacity: 1;color:rgb(255 59 48 / var(--tw-text-opacity, 1))}.text-\\[\\#FF9500\\]{--tw-text-opacity: 1;color:rgb(255 149 0 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted{--tw-text-opacity: 1;color:rgb(162 159 185 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-text{--tw-text-opacity: 1;color:rgb(53 65 86 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px rgba(0, 0, 0, .15);--tw-shadow-colored: 0 10px 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px rgba(0, 0, 0, .1);--tw-shadow-colored: 0 4px 6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px rgba(0, 0, 0, .05);--tw-shadow-colored: 0 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-yellow-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(253 224 71 / var(--tw-ring-opacity, 1))}.ring-opacity-50{--tw-ring-opacity: .5}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.avoid-transition,.avoid-transition *{transition:none!important}#canvas,#canvas *{transition:width .3s ease-in-out,height .3s ease-in-out,max-width .3s ease-in-out}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes slideDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideUpOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes slideDownOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}@keyframes slideInRight{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}@keyframes slideOutRight{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(100%)}}.tiptap-global{border:1px solid #e8e7ee;padding:4px}#canvas ul,#canvas ol{padding:0 1rem;margin:1.25rem 1rem 1.25rem .4rem}#canvas ul li p,#canvas ol li p{margin-top:.25em;margin-bottom:.25em}#canvas ul{list-style:circle}#canvas ol{list-style:decimal}#canvas{h1,h2,h3,h4,h5,h6{line-height:1.1;text-wrap:pretty}h1,h2{margin-bottom:1.5rem}h1{font-size:1.4rem}h2{font-size:1.2rem}h3{font-size:1.1rem}h4,h5,h6{font-size:1rem}}.tiptap{:first-child{margin-top:0}padding:4px;min-height:100px;ul,ol{padding:0 1rem;margin:1.25rem 1rem 1.25rem .4rem;li p{margin-top:.25em;margin-bottom:.25em}}ul{list-style:circle}ol{list-style:decimal}h1,h2,h3,h4,h5,h6{line-height:1.1;text-wrap:pretty}h1,h2{margin-bottom:1.5rem}h1{font-size:1.4rem}h2{font-size:1.2rem}h3{font-size:1.1rem}h4,h5,h6{font-size:1rem}}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.last\\:mb-0:last-child{margin-bottom:0}.hover\\:border-\\[\\#00BAC7\\]:hover{--tw-border-opacity: 1;border-color:rgb(0 186 199 / var(--tw-border-opacity, 1))}.hover\\:border-\\[\\#170F4F\\]:hover{--tw-border-opacity: 1;border-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.hover\\:border-\\[\\#170F4F\\]\\/30:hover{border-color:#170f4f4d}.hover\\:border-\\[\\#30aab3\\]:hover{--tw-border-opacity: 1;border-color:rgb(48 170 179 / var(--tw-border-opacity, 1))}.hover\\:border-red-300:hover{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.hover\\:bg-\\[\\#009CA8\\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 156 168 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#00BAC7\\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 186 199 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#170F4F\\]:hover{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#170F4F\\]\\/15:hover{background-color:#170f4f26}.hover\\:bg-\\[\\#30aab3\\]:hover{--tw-bg-opacity: 1;background-color:rgb(48 170 179 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#CCF1F4\\]:hover{--tw-bg-opacity: 1;background-color:rgb(204 241 244 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#F5F5F7\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 247 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#F9F8FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(249 248 254 / var(--tw-bg-opacity, 1))}.hover\\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\\:bg-secondary:hover{--tw-bg-opacity: 1;background-color:rgb(48 170 179 / var(--tw-bg-opacity, 1))}.hover\\:bg-surface:hover{--tw-bg-opacity: 1;background-color:rgb(243 242 247 / var(--tw-bg-opacity, 1))}.hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\\:text-\\[\\#00BAC7\\]:hover{--tw-text-opacity: 1;color:rgb(0 186 199 / var(--tw-text-opacity, 1))}.hover\\:text-\\[\\#170F4F\\]:hover,.hover\\:text-\\[\\#170f4f\\]:hover{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.hover\\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\\:text-gray-300:hover{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\\:shadow-md:hover{--tw-shadow: 0 4px 6px rgba(0, 0, 0, .1);--tw-shadow-colored: 0 4px 6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:shadow-sm:hover{--tw-shadow: 0 1px 2px rgba(0, 0, 0, .05);--tw-shadow-colored: 0 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\\:ring-gray-300:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1))}.hover\\:ring-opacity-50:hover{--tw-ring-opacity: .5}.focus\\:border-\\[\\#170F4F\\]:focus{--tw-border-opacity: 1;border-color:rgb(23 15 79 / var(--tw-border-opacity, 1))}.focus\\:bg-\\[\\#F9F8FE\\]:focus{--tw-bg-opacity: 1;background-color:rgb(249 248 254 / var(--tw-bg-opacity, 1))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-inset:focus{--tw-ring-inset: inset}.focus\\:ring-\\[\\#170F4F\\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(23 15 79 / var(--tw-ring-opacity, 1))}.focus\\:ring-\\[\\#170F4F\\]\\/20:focus{--tw-ring-color: rgb(23 15 79 / .2)}.focus\\:ring-\\[\\#30aab3\\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(48 170 179 / var(--tw-ring-opacity, 1))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.disabled\\:bg-gray-50:disabled{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.disabled\\:text-gray-300:disabled{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.disabled\\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.disabled\\:text-gray-600:disabled{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.disabled\\:opacity-30:disabled{opacity:.3}.disabled\\:opacity-40:disabled{opacity:.4}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:opacity-60:disabled{opacity:.6}.disabled\\:hover\\:bg-\\[\\#170F4F\\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(23 15 79 / var(--tw-bg-opacity, 1))}.disabled\\:hover\\:shadow-sm:hover:disabled{--tw-shadow: 0 1px 2px rgba(0, 0, 0, .05);--tw-shadow-colored: 0 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group:hover .group-hover\\:block{display:block}.group:hover .group-hover\\:text-\\[\\#170F4F\\]{--tw-text-opacity: 1;color:rgb(23 15 79 / var(--tw-text-opacity, 1))}.group:hover .group-hover\\:opacity-100{opacity:1}@media (min-width: 768px){.sm\\:inline{display:inline}.sm\\:hidden{display:none}.sm\\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 900px){.min-\\[900px\\]\\:inline{display:inline}}@media (min-width: 1440px){.xl\\:w-\\[62\\%\\]{width:62%}}@media (min-width: 1536px){.\\32xl\\:w-\\[80\\%\\]{width:80%}}';function O0({templateId:t,placeholders:e={},sdk:r={baseUrl:"",workspace:""},width:n="100%",height:s="100%"}){return h.jsxs(J2.default.div,{className:"bolttech-template-editor",style:{height:s,width:n,position:"relative",overflow:"hidden"},children:[h.jsx("style",{type:"text/css",children:F3}),h.jsx(YD,{templateId:t,baseUrl:r.baseUrl,workspace:r.workspace,children:h.jsx(S3,{placeholders:e})})]})}const ll=({name:t,value:e,path:r,onSelect:n,isSelected:s})=>{const o=typeof e=="object"&&e!==null&&!Array.isArray(e),i=Array.isArray(e),a=()=>e===null?"null":e===void 0?"undefined":typeof e=="string"?`"${e}"`:typeof e=="number"||typeof e=="boolean"?String(e):i?`Array(${e.length})`:o?`Object(${Object.keys(e).length})`:String(e),l=()=>e===null?"null":e===void 0?"undefined":typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":i?"array":o?"object":typeof e;return h.jsxs("button",{onClick:()=>n(r,e),className:`flex min-w-[120px] flex-col items-center gap-1 rounded-none border border-[#e8e7ee] p-3 transition-all duration-200 ${s?"border-[#30aab3] bg-[#170f4f] text-white":"bg-white text-[#170f4f] hover:border-[#30aab3] hover:bg-gray-50"}`,children:[h.jsx("div",{className:"text-xs font-medium",children:t}),h.jsx("div",{className:`text-xs ${l()==="string"?"text-green-600":l()==="number"?"text-blue-600":l()==="boolean"?"text-purple-600":l()==="null"?"text-gray-500":"text-orange-600"} ${s?"text-white":""}`,children:a()}),h.jsxs("div",{className:`text-xs ${s?"text-gray-300":"text-gray-400"}`,children:["(",l(),")"]})]})},L0=({data:t,onPathSelect:e})=>{const[r,n]=F.useState([]),[s,o]=F.useState(null),[i,a]=F.useState(!1),l=(y,x)=>x.reduce((w,D)=>{if(w!=null){if(D.startsWith("[")&&D.endsWith("]")){const E=parseInt(D.slice(1,-1),10);return w[E]}return w[D]}},y),d=(()=>{const y=[];let x=[],w=t;y.push({path:[],value:t,isRoot:!0});for(const D of r)x=[...x,D],w=l(t,x),w!=null&&typeof w=="object"&&y.push({path:[...x],value:w,isRoot:!1});return y})(),f=(y,x,w)=>{if(typeof w=="object"&&w!==null&&(n(D=>[...D.slice(0,y),x]),e)){const D=[...d[y].path,x];e(D.join("."))}},m=(y,x,w)=>{if(typeof w!="object"||w===null){if(o({path:[...d[y].path,x],value:w}),e){const D=[...d[y].path,x];e(D.join("."))}}else o(null)},g=(y,x)=>{const w=y.value;return y.isRoot?h.jsx("div",{className:"flex min-w-[140px] flex-col gap-2",children:Object.entries(t).map(([D,E])=>h.jsx(ll,{name:D,value:E,path:D,onSelect:(S,A)=>typeof A=="object"&&A!==null?f(0,D,A):m(0,D,A),isSelected:r.length===0},D))},x):Array.isArray(w)?h.jsx("div",{className:"flex min-w-[140px] flex-col gap-2",children:w.map((D,E)=>h.jsx(ll,{name:`[${E}]`,value:D,path:`[${E}]`,onSelect:(S,A)=>typeof A=="object"&&A!==null?f(x,`[${E}]`,A):m(x,`[${E}]`,A),isSelected:!1},E))},x):typeof w=="object"&&w!==null?h.jsx("div",{className:"flex min-w-[140px] flex-col gap-2",children:Object.entries(w).map(([D,E])=>h.jsx(ll,{name:D,value:E,path:D,onSelect:(S,A)=>typeof A=="object"&&A!==null?f(x,D,A):m(x,D,A),isSelected:!1},D))},x):null};return h.jsxs("div",{className:"overflow-x-auto rounded-none border border-[#e8e7ee] bg-white",children:[h.jsx("div",{className:"border-b border-[#e8e7ee] bg-gray-50 px-4 py-2",children:h.jsx("h3",{className:"text-sm font-medium text-[#170f4f]",children:"Data Structure"})}),h.jsxs("div",{className:"flex gap-6 overflow-x-auto p-4",children:[d.map((y,x)=>g(y,x)),s&&h.jsx("div",{className:"flex min-w-[180px] flex-col gap-2",children:h.jsxs("div",{className:"mt-2 rounded-none border border-[#e8e7ee] bg-gray-50 p-3",children:[h.jsx("h4",{className:"mb-1 text-xs font-medium text-gray-600",children:"Selected Value"}),h.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[h.jsx("span",{className:"font-medium",children:"Path:"})," ",s.path.join("."),h.jsx("button",{className:"ml-1 text-gray-400 hover:text-gray-600",onClick:()=>{navigator.clipboard.writeText(s.path.join(".")),a(!0),setTimeout(()=>a(!1),2e3)},title:"Copy path",children:i?h.jsx(I.FiCheck,{size:14}):h.jsx(I.FiCopy,{size:14})})]}),h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:"font-medium",children:"Value:"})," ",String(s.value)]}),h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:"font-medium",children:"Type:"})," ",typeof s.value]})]})})]})]})},A3=({isOpen:t,onClose:e,onDataImport:r})=>{const[n,s]=F.useState("url"),[o,i]=F.useState(""),[a,l]=F.useState(""),[c,d]=F.useState(""),[f,m]=F.useState(!1),[g,y]=F.useState(""),[x,w]=F.useState(!1),[D,E]=F.useState(null);F.useEffect(()=>{if(t){const O=localStorage.getItem("bolttech_datasource");if(O)try{const P=JSON.parse(O);P&&typeof P=="object"&&P.data&&(E(P.data),P.url&&l(P.url))}catch{}}},[t]);const S=O=>{const P=O.target.files?.[0];if(!P)return;if(!P.name.endsWith(".json")){y("Please select a JSON file");return}const L=new FileReader;L.onload=H=>{try{const Y=H.target?.result,q=JSON.parse(Y);i(Y),E(q),y("")}catch{y("Invalid JSON file"),i(""),E(null)}},L.readAsText(P)},A=async()=>{if(!a.trim()){y("Please enter a URL");return}m(!0),y("");try{const O=await fetch(a);if(!O.ok)throw new Error("Failed to fetch data");const P=await O.json();d(JSON.stringify(P,null,2)),E(P),y("")}catch{y("Failed to fetch data from URL")}finally{m(!1)}},T=O=>{d(O),y("");try{if(O.trim()){const P=JSON.parse(O);E(P)}else E(null)}catch{y("Invalid JSON format"),E(null)}},j=()=>{let O;try{switch(n){case"file":if(!o){y("Please select a file");return}O=JSON.parse(o);break;case"url":if(!c){y("Please fetch data from URL first");return}O=JSON.parse(c);break;case"code":if(!c.trim()){y("Please enter JSON data");return}O=JSON.parse(c);break}n==="url"?localStorage.setItem("bolttech_datasource",JSON.stringify({from:n,data:O,url:a})):localStorage.setItem("bolttech_datasource",JSON.stringify({from:n,data:O})),r(O),e()}catch{y("Invalid JSON data")}},B=()=>{navigator.clipboard.writeText(c),w(!0),setTimeout(()=>w(!1),2e3)},$=()=>{try{return c.trim()?(JSON.parse(c),!0):!1}catch{return!1}};return t?h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:O=>{O.target===O.currentTarget&&e()},children:h.jsxs("div",{className:"flex h-[90vh] w-full max-w-6xl flex-col rounded-none bg-white shadow-xl",children:[h.jsxs("div",{className:"flex items-center justify-between border-b border-[#e8e7ee] bg-white p-6",children:[h.jsx("h2",{className:"text-lg font-bold tracking-wide text-[#170f4f]",children:"DataSource"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>{localStorage.removeItem("bolttech_datasource"),E(null),i(""),l(""),d("")},className:"rounded-none p-2 text-gray-400 transition-colors duration-200 hover:bg-red-50 hover:text-red-600",title:"Clean Data",children:"🧹"}),h.jsx("button",{onClick:e,className:"rounded-none p-2 text-gray-400 transition-colors duration-200 hover:bg-gray-50 hover:text-gray-600",children:h.jsx(I.FiX,{size:18})})]})]}),h.jsx("div",{className:"max-h-[42vh] overflow-y-auto border-b border-[#e8e7ee] px-6 py-4",children:h.jsx(L0,{data:{root:D||{}}})}),h.jsxs("div",{className:"flex border-b border-[#e8e7ee]",children:[h.jsxs("button",{onClick:()=>s("url"),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors duration-200 ${n==="url"?"border-b-2 border-[#30aab3] text-[#170f4f]":"text-gray-500 hover:text-[#170f4f]"}`,children:[h.jsx(I.FiLink,{size:16}),"URL"]}),h.jsxs("button",{onClick:()=>s("file"),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors duration-200 ${n==="file"?"border-b-2 border-[#30aab3] text-[#170f4f]":"text-gray-500 hover:text-[#170f4f]"}`,children:[h.jsx(I.FiUpload,{size:16}),"Import File"]}),h.jsxs("button",{onClick:()=>s("code"),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors duration-200 ${n==="code"?"border-b-2 border-[#30aab3] text-[#170f4f]":"text-gray-500 hover:text-[#170f4f]"}`,children:[h.jsx(I.FiCode,{size:16}),"Custom Code"]})]}),h.jsxs("div",{className:"flex-1 overflow-hidden p-6",children:[n==="code"&&h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsx("div",{className:"mb-4",children:h.jsx("p",{className:"mb-1 text-sm text-gray-500",children:"Enter your JSON data below"})}),h.jsxs("div",{className:"flex-1 overflow-hidden rounded-none bg-gray-900",children:[h.jsxs("div",{className:"flex items-center justify-between border-b border-gray-700 bg-gray-800 px-4 py-2",children:[h.jsx("span",{className:"text-sm font-medium text-gray-300",children:"JSON Editor"}),c&&h.jsxs("button",{onClick:B,className:"flex items-center gap-1 text-xs text-gray-400 hover:text-gray-300",children:[x?h.jsx(I.FiCheck,{size:12}):h.jsx(I.FiCopy,{size:12}),x?"Copied!":"Copy"]})]}),h.jsx("div",{className:"h-full overflow-auto pb-8",children:h.jsx("textarea",{value:c,onChange:O=>T(O.target.value),placeholder:'{"name": "John", "age": 30, "city": "New York"}',className:"h-full w-full resize-none border-none bg-transparent p-4 font-mono text-sm text-gray-300 outline-none"})})]})]}),n==="url"&&h.jsx("div",{className:"bte:flex bte:h-full bte:flex-col",children:h.jsxs("div",{className:"bte:mb-4",children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"JSON URL"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"url",value:a,onChange:O=>l(O.target.value),placeholder:"https://api.example.com/data.json",className:"flex-1 rounded-none border border-[#e8e7ee] px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[#30aab3]"}),h.jsx("button",{onClick:A,disabled:f||!a.trim(),className:"rounded-none bg-[#170f4f] px-4 py-2 text-white transition-colors duration-200 hover:bg-[#30aab3] disabled:cursor-not-allowed disabled:opacity-50",children:f?"Loading...":"Fetch"})]})]})}),n==="file"&&h.jsxs("div",{className:"bte:flex bte:h-full bte:flex-col",children:[h.jsxs("div",{className:"bte:mb-4",children:[h.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700",children:"Select JSON File"}),h.jsxs("div",{className:"rounded-none border-2 border-dashed border-[#e8e7ee] p-8 text-center transition-colors duration-200 hover:border-[#30aab3]",children:[h.jsx("input",{type:"file",accept:".json",onChange:S,className:"hidden",id:"file-upload"}),h.jsxs("label",{htmlFor:"file-upload",className:"flex cursor-pointer flex-col items-center",children:[h.jsx(I.FiUpload,{size:48,className:"mb-4 text-gray-400"}),h.jsx(I.FiUpload,{size:48,className:"mb-4 text-gray-400"}),h.jsx("span",{className:"text-lg font-medium text-gray-700",children:"Click to upload JSON file"}),h.jsx("span",{className:"mt-1 text-sm text-gray-500",children:"or drag and drop"})]})]})]}),o&&h.jsxs("div",{className:"flex-1 overflow-hidden rounded-none bg-gray-900",children:[h.jsx("div",{className:"flex items-center justify-between border-b border-gray-700 bg-gray-800 px-4 py-2",children:h.jsx("span",{className:"text-sm font-medium text-gray-300",children:"File Preview"})}),h.jsx("div",{className:"h-32 overflow-auto",children:h.jsx("pre",{className:"whitespace-pre-wrap p-4 font-mono text-sm text-gray-300",children:h.jsx("code",{children:o})})})]})]}),g&&h.jsx("div",{className:"mt-4 rounded-none border border-red-200 bg-red-50 p-3",children:h.jsx("p",{className:"text-sm text-red-600",children:g})})]}),h.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-[#e8e7ee] p-6",children:[h.jsx("button",{onClick:e,className:"rounded-none bg-gray-100 px-4 py-2 text-gray-700 transition-colors duration-200 hover:bg-gray-200",children:"Cancel"}),h.jsx("button",{onClick:j,disabled:n==="file"&&!o||n==="url"&&!c||n==="code"&&!c||!$(),className:"rounded-none bg-[#170f4f] px-4 py-2 text-white transition-colors duration-200 hover:bg-[#30aab3] disabled:cursor-not-allowed disabled:opacity-50",children:"Import Data"})]})]})}):null},N3=Object.freeze({__proto__:null,DataSourceModal:A3,HorizontalDataView:L0});exports.TemplateEditor=O0;exports.default=O0;