@nuasite/cms-studio 0.43.3 → 0.44.1

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,118 +0,0 @@
1
- var D2=t=>{throw TypeError(t)};var I2=(t,e,n)=>e.has(t)||D2("Cannot "+n);var Ze=(t,e,n)=>(I2(t,e,"read from private field"),n?n.call(t):e.get(t)),Ut=(t,e,n)=>e.has(t)?D2("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),eu=(t,e,n,i)=>(I2(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function uT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ky={exports:{}},Jc={};var _2;function o4(){if(_2)return Jc;_2=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,r,s){var o=null;if(s!==void 0&&(o=""+s),r.key!==void 0&&(o=""+r.key),"key"in r){s={};for(var u in r)u!=="key"&&(s[u]=r[u])}else s=r;return r=s.ref,{$$typeof:t,type:i,key:o,ref:r!==void 0?r:null,props:s}}return Jc.Fragment=e,Jc.jsx=n,Jc.jsxs=n,Jc}var z2;function l4(){return z2||(z2=1,Ky.exports=o4()),Ky.exports}var _=l4();const u4=409;class vr extends Error{constructor(e,n,i){super(i),this.status=e,this.code=n,this.name="CmsClientError"}get isUnauthorized(){return this.code==="unauthorized"||this.status===401}get isForbidden(){return this.code==="forbidden"||this.status===403}get isNotFound(){return this.code==="not_found"||this.status===404}}function L2(t){return ah(t)&&typeof t.error=="string"&&typeof t.code=="string"}function ah(t){return typeof t=="object"&&t!==null}function c4(t){return ah(t)?t.code==="conflict"&&typeof t.serverHash=="string"&&ah(t.serverFrontmatter):!1}const f4=["not_found","conflict","validation","parse_error","io_error","unsupported","unauthorized"];function h4(t){return f4.includes(t)}function B2(t){return t instanceof vr&&(t.status===501||t.code==="unsupported")}function p4(t){const e=t.endsWith("/")?t.slice(0,-1):t;async function n(h){const m=await fetch(`${e}${h}`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!m.ok)throw await i(m);return await m.json()}async function i(h){const m=await h.json().catch(()=>null);return s(h.status,m)}function r(h,m){if(L2(h))return h.error;if(ah(h)){const g=h.error;if(ah(g)&&typeof g.message=="string")return g.message}return m}function s(h,m){return h===403?new vr(403,"forbidden",r(m,"You do not have access to this project.")):L2(m)&&h4(m.code)?new vr(h,m.code,m.error):h===401?new vr(401,"unauthorized","Your session has expired. Please reload."):new vr(h,"unknown",r(m,`Request failed (${h})`))}function o(h,m){const g={method:h,credentials:"include",headers:{accept:"application/json"}};return m!==void 0&&(g.body=JSON.stringify(m),g.headers={accept:"application/json","content-type":"application/json"}),g}async function u(h,m,g){const y=await fetch(`${e}${h}`,o(m,g));if(!y.ok)throw await i(y);return await y.json()}function c(h,m){return`/collections/${encodeURIComponent(h)}/entries/${encodeURIComponent(m)}`}return{getProject(){return n("/project")},getCollections(){return n("/collections")},getComponents(){return n("/components")},getEntries(h,m={}){const g=new URLSearchParams;m.fields!==void 0&&g.set("fields",m.fields),m.draft!==void 0&&g.set("draft",m.draft),m.cursor!==void 0&&g.set("cursor",m.cursor),m.limit!==void 0&&g.set("limit",String(m.limit));const y=g.toString(),b=y===""?"":`?${y}`;return n(`/collections/${encodeURIComponent(h)}/entries${b}`)},getEntry(h,m){return n(c(h,m))},async updateEntry(h,m,g){const y=await fetch(`${e}${c(h,m)}`,o("PATCH",g));if(y.status===u4){const v=await y.json().catch(()=>null);if(c4(v))return{status:"conflict",conflict:v};throw s(y.status,v)}if(!y.ok)throw await i(y);return{status:"ok",result:await y.json()}},createEntry(h,m){return u(`/collections/${encodeURIComponent(h)}/entries`,"POST",m)},deleteEntry(h,m){return u(c(h,m),"DELETE")},renameEntry(h,m,g){return u(`${c(h,m)}/rename`,"POST",{to:g})},addArrayItem(h,m,g,y,b){const v=b===void 0?{field:g,value:y}:{field:g,value:y,index:b};return u(`${c(h,m)}/array`,"POST",v)},removeArrayItem(h,m,g,y){return u(`${c(h,m)}/array`,"DELETE",{field:g,index:y})},listMedia(h={}){const m=new URLSearchParams;h.folder!==void 0&&m.set("folder",h.folder),h.cursor!==void 0&&m.set("cursor",h.cursor),h.limit!==void 0&&m.set("limit",String(h.limit));const g=m.toString();return n(`/media${g===""?"":`?${g}`}`)},async uploadMedia(h,m={}){const g=new URLSearchParams;m.collection!==void 0&&g.set("collection",m.collection),m.entry!==void 0&&g.set("entry",m.entry),m.field!==void 0&&g.set("field",m.field),m.folder!==void 0&&g.set("folder",m.folder);const y=g.toString(),b=new FormData;b.append("file",h);const v=await fetch(`${e}/media${y===""?"":`?${y}`}`,{method:"POST",credentials:"include",headers:{accept:"application/json"},body:b});if(!v.ok)throw await i(v);return await v.json()},mediaFileUrl(h,m,g){return`${e}${c(h,m)}/asset?path=${encodeURIComponent(g)}`},deleteMedia(h){return u(`/media/${encodeURIComponent(h)}`,"DELETE")},createFolder(h){return u("/media","POST",{folder:h})}}}function d4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function cT(t,e){switch(t){case"boolean":return e==="true"||e==="1"||e.toLowerCase()==="yes";case"number":case"year":case"month":{const n=Number(e);return e.trim()===""||Number.isNaN(n)?e:n}case"array":case"object":return m4(e);default:return e}}function m4(t){const e=t.trim();if(e!==""){if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return t;try{return JSON.parse(e)}catch{return t}}}function g4(t,e){const n=new Map(e.map(r=>[r.name,r])),i={};for(const[r,s]of Object.entries(t.frontmatter)){const o=n.get(r);i[r]=o?cT(o.type,s.value):s.value}return{frontmatter:i,body:t.body}}function y4(t){const e={};for(const n of t)if(!n.hidden){if(n.defaultValue!==void 0){e[n.name]=n.defaultValue;continue}e[n.name]=fT(n.type)}return{frontmatter:e,body:""}}function fT(t){switch(t){case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function x4(t,e,n){const i=new Map(n.map(s=>[s.name,s])),r={};for(const[s,o]of Object.entries(t)){const u=i.get(s);r[s]=u&&typeof o=="string"?cT(u.type,o):o}return{frontmatter:r,body:e??""}}function Jb(t,e){switch(t){case"boolean":return e==="true";case"number":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}case"year":case"month":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}default:return e}}function zs(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function b4(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"||t==="1"||t.toLowerCase()==="yes":!!t}function S4(t){return Array.isArray(t)?t:[]}function k4(t){return d4(t)?t:{}}function hT(t,e,n){return{...t,frontmatter:{...t.frontmatter,[e]:n}}}var Gy={exports:{}},He={};var V2;function v4(){if(V2)return He;V2=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function b(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,T={};function M(P,ne,B){this.props=P,this.context=ne,this.refs=T,this.updater=B||v}M.prototype.isReactComponent={},M.prototype.setState=function(P,ne){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,ne,"setState")},M.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function j(){}j.prototype=M.prototype;function F(P,ne,B){this.props=P,this.context=ne,this.refs=T,this.updater=B||v}var J=F.prototype=new j;J.constructor=F,E(J,M.prototype),J.isPureReactComponent=!0;var V=Array.isArray;function C(){}var L={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function re(P,ne,B){var be=B.ref;return{$$typeof:t,type:P,key:ne,ref:be!==void 0?be:null,props:B}}function K(P,ne){return re(P.type,ne,P.props)}function pe(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function he(P){var ne={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(B){return ne[B]})}var ke=/\/+/g;function Ie(P,ne){return typeof P=="object"&&P!==null&&P.key!=null?he(""+P.key):ne.toString(36)}function De(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(C,C):(P.status="pending",P.then(function(ne){P.status==="pending"&&(P.status="fulfilled",P.value=ne)},function(ne){P.status==="pending"&&(P.status="rejected",P.reason=ne)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function W(P,ne,B,be,Re){var Me=typeof P;(Me==="undefined"||Me==="boolean")&&(P=null);var Xe=!1;if(P===null)Xe=!0;else switch(Me){case"bigint":case"string":case"number":Xe=!0;break;case"object":switch(P.$$typeof){case t:case e:Xe=!0;break;case m:return Xe=P._init,W(Xe(P._payload),ne,B,be,Re)}}if(Xe)return Re=Re(P),Xe=be===""?"."+Ie(P,0):be,V(Re)?(B="",Xe!=null&&(B=Xe.replace(ke,"$&/")+"/"),W(Re,ne,B,"",function(zt){return zt})):Re!=null&&(pe(Re)&&(Re=K(Re,B+(Re.key==null||P&&P.key===Re.key?"":(""+Re.key).replace(ke,"$&/")+"/")+Xe)),ne.push(Re)),1;Xe=0;var Ct=be===""?".":be+":";if(V(P))for(var Qe=0;Qe<P.length;Qe++)be=P[Qe],Me=Ct+Ie(be,Qe),Xe+=W(be,ne,B,Me,Re);else if(Qe=b(P),typeof Qe=="function")for(P=Qe.call(P),Qe=0;!(be=P.next()).done;)be=be.value,Me=Ct+Ie(be,Qe++),Xe+=W(be,ne,B,Me,Re);else if(Me==="object"){if(typeof P.then=="function")return W(De(P),ne,B,be,Re);throw ne=String(P),Error("Objects are not valid as a React child (found: "+(ne==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":ne)+"). If you meant to render a collection of children, use an array instead.")}return Xe}function oe(P,ne,B){if(P==null)return P;var be=[],Re=0;return W(P,be,"","",function(Me){return ne.call(B,Me,Re++)}),be}function de(P){if(P._status===-1){var ne=P._result;ne=ne(),ne.then(function(B){(P._status===0||P._status===-1)&&(P._status=1,P._result=B)},function(B){(P._status===0||P._status===-1)&&(P._status=2,P._result=B)}),P._status===-1&&(P._status=0,P._result=ne)}if(P._status===1)return P._result.default;throw P._result}var ve=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ne=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(ne))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},D={map:oe,forEach:function(P,ne,B){oe(P,function(){ne.apply(this,arguments)},B)},count:function(P){var ne=0;return oe(P,function(){ne++}),ne},toArray:function(P){return oe(P,function(ne){return ne})||[]},only:function(P){if(!pe(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return He.Activity=g,He.Children=D,He.Component=M,He.Fragment=n,He.Profiler=r,He.PureComponent=F,He.StrictMode=i,He.Suspense=c,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,He.__COMPILER_RUNTIME={__proto__:null,c:function(P){return L.H.useMemoCache(P)}},He.cache=function(P){return function(){return P.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(P,ne,B){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var be=E({},P.props),Re=P.key;if(ne!=null)for(Me in ne.key!==void 0&&(Re=""+ne.key),ne)!q.call(ne,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&ne.ref===void 0||(be[Me]=ne[Me]);var Me=arguments.length-2;if(Me===1)be.children=B;else if(1<Me){for(var Xe=Array(Me),Ct=0;Ct<Me;Ct++)Xe[Ct]=arguments[Ct+2];be.children=Xe}return re(P.type,Re,be)},He.createContext=function(P){return P={$$typeof:o,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:s,_context:P},P},He.createElement=function(P,ne,B){var be,Re={},Me=null;if(ne!=null)for(be in ne.key!==void 0&&(Me=""+ne.key),ne)q.call(ne,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(Re[be]=ne[be]);var Xe=arguments.length-2;if(Xe===1)Re.children=B;else if(1<Xe){for(var Ct=Array(Xe),Qe=0;Qe<Xe;Qe++)Ct[Qe]=arguments[Qe+2];Re.children=Ct}if(P&&P.defaultProps)for(be in Xe=P.defaultProps,Xe)Re[be]===void 0&&(Re[be]=Xe[be]);return re(P,Me,Re)},He.createRef=function(){return{current:null}},He.forwardRef=function(P){return{$$typeof:u,render:P}},He.isValidElement=pe,He.lazy=function(P){return{$$typeof:m,_payload:{_status:-1,_result:P},_init:de}},He.memo=function(P,ne){return{$$typeof:h,type:P,compare:ne===void 0?null:ne}},He.startTransition=function(P){var ne=L.T,B={};L.T=B;try{var be=P(),Re=L.S;Re!==null&&Re(B,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(C,ve)}catch(Me){ve(Me)}finally{ne!==null&&B.types!==null&&(ne.types=B.types),L.T=ne}},He.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},He.use=function(P){return L.H.use(P)},He.useActionState=function(P,ne,B){return L.H.useActionState(P,ne,B)},He.useCallback=function(P,ne){return L.H.useCallback(P,ne)},He.useContext=function(P){return L.H.useContext(P)},He.useDebugValue=function(){},He.useDeferredValue=function(P,ne){return L.H.useDeferredValue(P,ne)},He.useEffect=function(P,ne){return L.H.useEffect(P,ne)},He.useEffectEvent=function(P){return L.H.useEffectEvent(P)},He.useId=function(){return L.H.useId()},He.useImperativeHandle=function(P,ne,B){return L.H.useImperativeHandle(P,ne,B)},He.useInsertionEffect=function(P,ne){return L.H.useInsertionEffect(P,ne)},He.useLayoutEffect=function(P,ne){return L.H.useLayoutEffect(P,ne)},He.useMemo=function(P,ne){return L.H.useMemo(P,ne)},He.useOptimistic=function(P,ne){return L.H.useOptimistic(P,ne)},He.useReducer=function(P,ne,B){return L.H.useReducer(P,ne,B)},He.useRef=function(P){return L.H.useRef(P)},He.useState=function(P){return L.H.useState(P)},He.useSyncExternalStore=function(P,ne,B){return L.H.useSyncExternalStore(P,ne,B)},He.useTransition=function(){return L.H.useTransition()},He.version="19.2.7",He}var F2;function Hb(){return F2||(F2=1,Gy.exports=v4()),Gy.exports}var fe=Hb();function C4(t){const e={};for(const n of t.props)e[n.name]=n.defaultValue??"";return e}const w4={position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:1e3},E4={width:"min(440px, 92vw)",maxHeight:"70vh",display:"flex",flexDirection:"column",background:"#fff",border:"1px solid #d4d4d8",borderRadius:10,boxShadow:"0 12px 32px rgba(0,0,0,0.18)",overflow:"hidden",fontSize:13},N4={border:"none",borderBottom:"1px solid #ececed",padding:"10px 12px",font:"inherit",outline:"none"},A4={textAlign:"left",border:"none",background:"transparent",padding:"8px 12px",cursor:"pointer",borderRadius:0};function T4({open:t,components:e,onInsert:n,onClose:i}){const[r,s]=fe.useState(""),o=fe.useMemo(()=>{const u=r.trim().toLowerCase();return e.filter(c=>u===""||c.name.toLowerCase().includes(u)||(c.description??"").toLowerCase().includes(u))},[e,r]);return t?_.jsx("div",{style:w4,onMouseDown:i,children:_.jsxs("div",{style:E4,onMouseDown:u=>u.stopPropagation(),children:[_.jsx("input",{style:N4,placeholder:"Search components…",autoFocus:!0,value:r,onChange:u=>s(u.target.value)}),_.jsxs("div",{style:{overflowY:"auto"},children:[o.length===0?_.jsx("div",{style:{padding:12,color:"#a1a1aa"},children:"No components"}):null,o.map(u=>_.jsxs("button",{type:"button",style:A4,onClick:()=>{n(u.name,C4(u)),i()},children:[_.jsx("div",{style:{fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},children:u.name}),u.description?_.jsx("div",{style:{color:"#71717a",fontSize:12},children:u.description}):null]},u.name))]})]})}):null}var sr=(function(t){return t.docTypeError="docTypeError",t.contextNotFound="contextNotFound",t.timerNotFound="timerNotFound",t.ctxCallOutOfScope="ctxCallOutOfScope",t.createNodeInParserFail="createNodeInParserFail",t.stackOverFlow="stackOverFlow",t.parserMatchError="parserMatchError",t.serializerMatchError="serializerMatchError",t.getAtomFromSchemaFail="getAtomFromSchemaFail",t.expectDomTypeError="expectDomTypeError",t.callCommandBeforeEditorView="callCommandBeforeEditorView",t.missingRootElement="missingRootElement",t.missingNodeInSchema="missingNodeInSchema",t.missingMarkInSchema="missingMarkInSchema",t.ctxNotBind="ctxNotBind",t.missingYjsDoc="missingYjsDoc",t})({}),ar=class extends Error{constructor(t,e){super(e),this.name="MilkdownError",this.code=t}},M4=(t,e)=>typeof e=="function"?"[Function]":e,fg=t=>JSON.stringify(t,M4);function O4(t){return new ar(sr.docTypeError,`Doc type error, unsupported type: ${fg(t)}`)}function R4(t){return new ar(sr.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function D4(t){return new ar(sr.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function hg(){return new ar(sr.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function I4(t,e,n){const i=`Cannot create node for ${"name"in t?t.name:t}`,r=o=>{if(o==null)return"null";if(Array.isArray(o))return`[${o.map(r).join(", ")}]`;if(typeof o=="object")return"toJSON"in o&&typeof o.toJSON=="function"?JSON.stringify(o.toJSON()):"spec"in o?JSON.stringify(o.spec):JSON.stringify(o);if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return JSON.stringify(o);if(typeof o=="function")return`[Function: ${o.name||"anonymous"}]`;try{return String(o)}catch{return"[Unserializable]"}},s=[["[Description]",i],["[Attributes]",e],["[Content]",(n??[]).map(o=>o?typeof o=="object"&&"type"in o?`${o}`:r(o):"null")]].reduce((o,[u,c])=>{const h=`${u}: ${r(c)}.`;return o.concat(h)},[]);return new ar(sr.createNodeInParserFail,s.join(`
2
- `))}function pT(){return new ar(sr.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function _4(t){return new ar(sr.parserMatchError,`Cannot match target parser for node: ${fg(t)}.`)}function z4(t){return new ar(sr.serializerMatchError,`Cannot match target serializer for node: ${fg(t)}.`)}function Jr(t){return new ar(sr.expectDomTypeError,`Expect to be a dom, but get: ${fg(t)}.`)}function Yy(){return new ar(sr.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function L4(t){return new ar(sr.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${t}" in schema.`)}function B4(t){return new ar(sr.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${t}" in schema.`)}var dT=class{constructor(){this.sliceMap=new Map,this.get=t=>{const e=typeof t=="string"?[...this.sliceMap.values()].find(n=>n.type.name===t):this.sliceMap.get(t.id);if(!e)throw R4(typeof t=="string"?t:t.name);return e},this.remove=t=>{const e=typeof t=="string"?[...this.sliceMap.values()].find(n=>n.type.name===t):this.sliceMap.get(t.id);e&&this.sliceMap.delete(e.type.id)},this.has=t=>typeof t=="string"?[...this.sliceMap.values()].some(e=>e.type.name===t):this.sliceMap.has(t.id)}},V4=class{#t=[];#e;#i=()=>{this.#t.forEach(e=>e(this.#e))};constructor(e,n,i){this.set=r=>{this.#e=r,this.#i()},this.get=()=>this.#e,this.update=r=>{this.#e=r(this.#e),this.#i()},this.type=i,this.#e=n,e.set(i.id,this)}on(e){return this.#t.push(e),()=>{this.#t=this.#t.filter(n=>n!==e)}}once(e){const n=this.on(i=>{e(i),n()});return n}off(e){this.#t=this.#t.filter(n=>n!==e)}offAll(){this.#t=[]}},F4=class{constructor(t,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=t,this._typeInfo=()=>{throw hg()}}create(t,e=this._defaultValue){return new V4(t,e,this)}},st=(t,e)=>new F4(t,e),P4=class{#t;#e;#i;#n=new Set;#o=new Set;#s=new Map;#r=new Map;constructor(t,e,n){this.read=()=>({metadata:this.#t,injectedSlices:[...this.#n].map(i=>({name:typeof i=="string"?i:i.name,value:this.#a(i)})),consumedSlices:[...this.#o].map(i=>({name:typeof i=="string"?i:i.name,value:this.#a(i)})),recordedTimers:[...this.#s].map(([i,{duration:r}])=>({name:i.name,duration:r,status:this.#l(i)})),waitTimers:[...this.#r].map(([i,{duration:r}])=>({name:i.name,duration:r,status:this.#l(i)}))}),this.onRecord=i=>{this.#s.set(i,{start:Date.now(),duration:0})},this.onClear=i=>{this.#s.delete(i)},this.onDone=i=>{const r=this.#s.get(i);r&&(r.duration=Date.now()-r.start)},this.onWait=(i,r)=>{const s=Date.now();r.finally(()=>{this.#r.set(i,{duration:Date.now()-s})}).catch(console.error)},this.onInject=i=>{this.#n.add(i)},this.onRemove=i=>{this.#n.delete(i)},this.onUse=i=>{this.#o.add(i)},this.#e=t,this.#i=e,this.#t=n}#a=t=>this.#e.get(t).get();#l=t=>this.#i.get(t).status},j4=class mT{#t;#e;#i;#n;constructor(e,n,i){this.produce=r=>r&&Object.keys(r).length?new mT(this.#t,this.#e,{...r}):this,this.inject=(r,s)=>{const o=r.create(this.#t.sliceMap);return s!=null&&o.set(s),this.#n?.onInject(r),this},this.remove=r=>(this.#t.remove(r),this.#n?.onRemove(r),this),this.record=r=>(r.create(this.#e.store),this.#n?.onRecord(r),this),this.clearTimer=r=>(this.#e.remove(r),this.#n?.onClear(r),this),this.isInjected=r=>this.#t.has(r),this.isRecorded=r=>this.#e.has(r),this.use=r=>(this.#n?.onUse(r),this.#t.get(r)),this.get=r=>this.use(r).get(),this.set=(r,s)=>this.use(r).set(s),this.update=(r,s)=>this.use(r).update(s),this.timer=r=>this.#e.get(r),this.done=r=>{this.timer(r).done(),this.#n?.onDone(r)},this.wait=r=>{const s=this.timer(r).start();return this.#n?.onWait(r,s),s},this.waitTimers=async r=>{await Promise.all(this.get(r).map(s=>this.wait(s)))},this.#t=e,this.#e=n,this.#i=i,i&&(this.#n=new P4(e,n,i))}get meta(){return this.#i}get inspector(){return this.#n}},$4=class{constructor(){this.store=new Map,this.get=t=>{const e=this.store.get(t.id);if(!e)throw D4(t.name);return e},this.remove=t=>{this.store.delete(t.id)},this.has=t=>this.store.has(t.id)}},U4=class{#t=null;#e=null;#i;#n="pending";constructor(t,e){this.start=()=>(this.#t??=new Promise((n,i)=>{this.#e=r=>{r instanceof CustomEvent&&r.detail.id===this.#i&&(this.#n="resolved",this.#o(),r.stopImmediatePropagation(),n())},this.#s(()=>{this.#n==="pending"&&(this.#n="rejected"),this.#o(),i(new Error(`Timing ${this.type.name} timeout.`))}),this.#n="pending",addEventListener(this.type.name,this.#e)}),this.#t),this.done=()=>{const n=new CustomEvent(this.type.name,{detail:{id:this.#i}});dispatchEvent(n)},this.#i=Symbol(e.name),this.type=e,t.set(e.id,this)}get status(){return this.#n}#o=()=>{this.#e&&removeEventListener(this.type.name,this.#e)};#s=t=>{setTimeout(()=>{t()},this.type.timeout)}},J4=class{constructor(t,e=3e3){this.create=n=>new U4(n,this),this.id=Symbol(`Timer-${t}`),this.name=t,this.timeout=e}},Hr=(t,e=3e3)=>new J4(t,e);const H4={};function qb(t,e){const n=H4,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return gT(t,i,r)}function gT(t,e,n){if(q4(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return P2(t.children,e,n)}return Array.isArray(t)?P2(t,e,n):""}function P2(t,e,n){const i=[];let r=-1;for(;++r<t.length;)i[r]=gT(t[r],e,n);return i.join("")}function q4(t){return!!(t&&typeof t=="object")}const j2=document.createElement("i");function oh(t){const e="&"+t+";";j2.innerHTML=e;const n=j2.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function wi(t,e,n,i){const r=t.length;let s=0,o;if(e<0?e=-e>r?0:r+e:e=e>r?r:e,n=n>0?n:0,i.length<1e4)o=Array.from(i),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<i.length;)o=i.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Qi(t,e){return t.length>0?(wi(t,t.length,0,e),t):e}const $2={}.hasOwnProperty;function Kb(t){const e={};let n=-1;for(;++n<t.length;)K4(e,t[n]);return e}function K4(t,e){let n;for(n in e){const r=($2.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){$2.call(r,o)||(r[o]=[]);const u=s[o];G4(r[o],Array.isArray(u)?u:u?[u]:[])}}}function G4(t,e){let n=-1;const i=[];for(;++n<e.length;)(e[n].add==="after"?t:i).push(e[n]);wi(t,0,0,i)}function yT(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Cr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bn=qa(/[A-Za-z]/),oi=qa(/[\dA-Za-z]/),Y4=qa(/[#-'*+\--9=?A-Z^-~]/);function xm(t){return t!==null&&(t<32||t===127)}const yx=qa(/\d/),X4=qa(/[\dA-Fa-f]/),Q4=qa(/[!-/:-@[-`{-~]/);function Te(t){return t!==null&&t<-2}function ct(t){return t!==null&&(t<0||t===32)}function Ge(t){return t===-2||t===-1||t===32}const pg=qa(new RegExp("\\p{P}|\\p{S}","u")),Bn=qa(/\s/);function qa(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function nt(t,e,n,i){const r=i?i-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return Ge(c)?(t.enter(n),u(c)):e(c)}function u(c){return Ge(c)&&s++<r?(t.consume(c),u):(t.exit(n),e(c))}}const W4={tokenize:Z4};function Z4(t){const e=t.attempt(this.parser.constructs.contentInitial,i,r);let n;return e;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),nt(t,e,"linePrefix")}function r(u){return t.enter("paragraph"),s(u)}function s(u){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(u)}function o(u){if(u===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(u);return}return Te(u)?(t.consume(u),t.exit("chunkText"),s):(t.consume(u),o)}}const ez={tokenize:tz},U2={tokenize:nz};function tz(t){const e=this,n=[];let i=0,r,s,o;return u;function u(F){if(i<n.length){const J=n[i];return e.containerState=J[1],t.attempt(J[0].continuation,c,h)(F)}return h(F)}function c(F){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,r&&j();const J=e.events.length;let V=J,C;for(;V--;)if(e.events[V][0]==="exit"&&e.events[V][1].type==="chunkFlow"){C=e.events[V][1].end;break}M(i);let L=J;for(;L<e.events.length;)e.events[L][1].end={...C},L++;return wi(e.events,V+1,0,e.events.slice(J)),e.events.length=L,h(F)}return u(F)}function h(F){if(i===n.length){if(!r)return y(F);if(r.currentConstruct&&r.currentConstruct.concrete)return v(F);e.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(U2,m,g)(F)}function m(F){return r&&j(),M(i),y(F)}function g(F){return e.parser.lazy[e.now().line]=i!==n.length,o=e.now().offset,v(F)}function y(F){return e.containerState={},t.attempt(U2,b,v)(F)}function b(F){return i++,n.push([e.currentConstruct,e.containerState]),y(F)}function v(F){if(F===null){r&&j(),M(0),t.consume(F);return}return r=r||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:s}),E(F)}function E(F){if(F===null){T(t.exit("chunkFlow"),!0),M(0),t.consume(F);return}return Te(F)?(t.consume(F),T(t.exit("chunkFlow")),i=0,e.interrupt=void 0,u):(t.consume(F),E)}function T(F,J){const V=e.sliceStream(F);if(J&&V.push(null),F.previous=s,s&&(s.next=F),s=F,r.defineSkip(F.start),r.write(V),e.parser.lazy[F.start.line]){let C=r.events.length;for(;C--;)if(r.events[C][1].start.offset<o&&(!r.events[C][1].end||r.events[C][1].end.offset>o))return;const L=e.events.length;let q=L,re,K;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(re){K=e.events[q][1].end;break}re=!0}for(M(i),C=L;C<e.events.length;)e.events[C][1].end={...K},C++;wi(e.events,q+1,0,e.events.slice(L)),e.events.length=C}}function M(F){let J=n.length;for(;J-- >F;){const V=n[J];e.containerState=V[1],V[0].exit.call(e,t)}n.length=F}function j(){r.write([null]),s=void 0,r=void 0,e.containerState._closeFlow=void 0}}function nz(t,e,n){return nt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Tu(t){if(t===null||ct(t)||Bn(t))return 1;if(pg(t))return 2}function dg(t,e,n){const i=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!i.includes(s)&&(e=s(e,n),i.push(s))}return e}const xx={name:"attention",resolveAll:iz,tokenize:rz};function iz(t,e){let n=-1,i,r,s,o,u,c,h,m;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(i=n;i--;)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&e.sliceSerialize(t[i][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[i][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[i][1].end.offset-t[i][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const g={...t[i][1].end},y={...t[n][1].start};J2(g,-c),J2(y,c),o={type:c>1?"strongSequence":"emphasisSequence",start:g,end:{...t[i][1].end}},u={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:y},s={type:c>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...u.end}},t[i][1].end={...o.start},t[n][1].start={...u.end},h=[],t[i][1].end.offset-t[i][1].start.offset&&(h=Qi(h,[["enter",t[i][1],e],["exit",t[i][1],e]])),h=Qi(h,[["enter",r,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=Qi(h,dg(e.parser.constructs.insideSpan.null,t.slice(i+1,n),e)),h=Qi(h,[["exit",s,e],["enter",u,e],["exit",u,e],["exit",r,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=Qi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,wi(t,i-1,n-i+3,h),n=i+h.length-m-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function rz(t,e){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,r=Tu(i);let s;return o;function o(c){return s=c,t.enter("attentionSequence"),u(c)}function u(c){if(c===s)return t.consume(c),u;const h=t.exit("attentionSequence"),m=Tu(c),g=!m||m===2&&r||n.includes(c),y=!r||r===2&&m||n.includes(i);return h._open=!!(s===42?g:g&&(r||!y)),h._close=!!(s===42?y:y&&(m||!g)),e(c)}}function J2(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const sz={name:"autolink",tokenize:az};function az(t,e,n){let i=0;return r;function r(b){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(b){return bn(b)?(t.consume(b),o):b===64?n(b):h(b)}function o(b){return b===43||b===45||b===46||oi(b)?(i=1,u(b)):h(b)}function u(b){return b===58?(t.consume(b),i=0,c):(b===43||b===45||b===46||oi(b))&&i++<32?(t.consume(b),u):(i=0,h(b))}function c(b){return b===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):b===null||b===32||b===60||xm(b)?n(b):(t.consume(b),c)}function h(b){return b===64?(t.consume(b),m):Y4(b)?(t.consume(b),h):n(b)}function m(b){return oi(b)?g(b):n(b)}function g(b){return b===46?(t.consume(b),i=0,m):b===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):y(b)}function y(b){if((b===45||oi(b))&&i++<63){const v=b===45?y:g;return t.consume(b),v}return n(b)}}const Lu={partial:!0,tokenize:oz};function oz(t,e,n){return i;function i(s){return Ge(s)?nt(t,r,"linePrefix")(s):r(s)}function r(s){return s===null||Te(s)?e(s):n(s)}}const xT={continuation:{tokenize:uz},exit:cz,name:"blockQuote",tokenize:lz};function lz(t,e,n){const i=this;return r;function r(o){if(o===62){const u=i.containerState;return u.open||(t.enter("blockQuote",{_container:!0}),u.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ge(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function uz(t,e,n){const i=this;return r;function r(o){return Ge(o)?nt(t,s,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(xT,e,n)(o)}}function cz(t){t.exit("blockQuote")}const bT={name:"characterEscape",tokenize:fz};function fz(t,e,n){return i;function i(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),r}function r(s){return Q4(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const ST={name:"characterReference",tokenize:hz};function hz(t,e,n){const i=this;let r=0,s,o;return u;function u(g){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),c}function c(g){return g===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(g),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),s=31,o=oi,m(g))}function h(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=X4,m):(t.enter("characterReferenceValue"),s=7,o=yx,m(g))}function m(g){if(g===59&&r){const y=t.exit("characterReferenceValue");return o===oi&&!oh(i.sliceSerialize(y))?n(g):(t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(g)&&r++<s?(t.consume(g),m):n(g)}}const H2={partial:!0,tokenize:dz},q2={concrete:!0,name:"codeFenced",tokenize:pz};function pz(t,e,n){const i=this,r={partial:!0,tokenize:V};let s=0,o=0,u;return c;function c(C){return h(C)}function h(C){const L=i.events[i.events.length-1];return s=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,u=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),m(C)}function m(C){return C===u?(o++,t.consume(C),m):o<3?n(C):(t.exit("codeFencedFenceSequence"),Ge(C)?nt(t,g,"whitespace")(C):g(C))}function g(C){return C===null||Te(C)?(t.exit("codeFencedFence"),i.interrupt?e(C):t.check(H2,E,J)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||Te(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(C)):Ge(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),nt(t,b,"whitespace")(C)):C===96&&C===u?n(C):(t.consume(C),y)}function b(C){return C===null||Te(C)?g(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===null||Te(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(C)):C===96&&C===u?n(C):(t.consume(C),v)}function E(C){return t.attempt(r,J,T)(C)}function T(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),M}function M(C){return s>0&&Ge(C)?nt(t,j,"linePrefix",s+1)(C):j(C)}function j(C){return C===null||Te(C)?t.check(H2,E,J)(C):(t.enter("codeFlowValue"),F(C))}function F(C){return C===null||Te(C)?(t.exit("codeFlowValue"),j(C)):(t.consume(C),F)}function J(C){return t.exit("codeFenced"),e(C)}function V(C,L,q){let re=0;return K;function K(De){return C.enter("lineEnding"),C.consume(De),C.exit("lineEnding"),pe}function pe(De){return C.enter("codeFencedFence"),Ge(De)?nt(C,he,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(De):he(De)}function he(De){return De===u?(C.enter("codeFencedFenceSequence"),ke(De)):q(De)}function ke(De){return De===u?(re++,C.consume(De),ke):re>=o?(C.exit("codeFencedFenceSequence"),Ge(De)?nt(C,Ie,"whitespace")(De):Ie(De)):q(De)}function Ie(De){return De===null||Te(De)?(C.exit("codeFencedFence"),L(De)):q(De)}}}function dz(t,e,n){const i=this;return r;function r(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return i.parser.lazy[i.now().line]?n(o):e(o)}}const Xy={name:"codeIndented",tokenize:gz},mz={partial:!0,tokenize:yz};function gz(t,e,n){const i=this;return r;function r(h){return t.enter("codeIndented"),nt(t,s,"linePrefix",5)(h)}function s(h){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?o(h):n(h)}function o(h){return h===null?c(h):Te(h)?t.attempt(mz,o,c)(h):(t.enter("codeFlowValue"),u(h))}function u(h){return h===null||Te(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),u)}function c(h){return t.exit("codeIndented"),e(h)}}function yz(t,e,n){const i=this;return r;function r(o){return i.parser.lazy[i.now().line]?n(o):Te(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),r):nt(t,s,"linePrefix",5)(o)}function s(o){const u=i.events[i.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(o):Te(o)?r(o):n(o)}}const xz={name:"codeText",previous:Sz,resolve:bz,tokenize:kz};function bz(t){let e=t.length-4,n=3,i,r;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(i=n;++i<e;)if(t[i][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(i=n-1,e++;++i<=e;)r===void 0?i!==e&&t[i][1].type!=="lineEnding"&&(r=i):(i===e||t[i][1].type==="lineEnding")&&(t[r][1].type="codeTextData",i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),e-=i-r-2,i=r+2),r=void 0);return t}function Sz(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function kz(t,e,n){let i=0,r,s;return o;function o(g){return t.enter("codeText"),t.enter("codeTextSequence"),u(g)}function u(g){return g===96?(t.consume(g),i++,u):(t.exit("codeTextSequence"),c(g))}function c(g){return g===null?n(g):g===32?(t.enter("space"),t.consume(g),t.exit("space"),c):g===96?(s=t.enter("codeTextSequence"),r=0,m(g)):Te(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),c):(t.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Te(g)?(t.exit("codeTextData"),c(g)):(t.consume(g),h)}function m(g){return g===96?(t.consume(g),r++,m):r===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(g)):(s.type="codeTextData",h(g))}}class vz{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(e,i):e>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,n,i){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return i&&Hc(this.left,i),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Hc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Hc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Hc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Hc(this.left,n.reverse())}}}function Hc(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function kT(t){const e={};let n=-1,i,r,s,o,u,c,h;const m=new vz(t);for(;++n<m.length;){for(;n in e;)n=e[n];if(i=m.get(n),n&&i[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(c=i[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(i[0]==="enter")i[1].contentType&&(Object.assign(e,Cz(m,n)),n=e[n],h=!0);else if(i[1]._container){for(s=n,r=void 0;s--;)if(o=m.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(m.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(i[1].end={...m.get(r)[1].start},u=m.slice(r,n),u.unshift(i),m.splice(r,n-r+1,u))}}return wi(t,0,Number.POSITIVE_INFINITY,m.slice(0)),!h}function Cz(t,e){const n=t.get(e)[1],i=t.get(e)[2];let r=e-1;const s=[];let o=n._tokenizer;o||(o=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const u=o.events,c=[],h={};let m,g,y=-1,b=n,v=0,E=0;const T=[E];for(;b;){for(;t.get(++r)[1]!==b;);s.push(r),b._tokenizer||(m=i.sliceStream(b),b.next||m.push(null),g&&o.defineSkip(b.start),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(m),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(E=y+1,T.push(E),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(o.events=[],b?(b._tokenizer=void 0,b.previous=void 0):T.pop(),y=T.length;y--;){const M=u.slice(T[y],T[y+1]),j=s.pop();c.push([j,j+M.length-1]),t.splice(j,2,M)}for(c.reverse(),y=-1;++y<c.length;)h[v+c[y][0]]=v+c[y][1],v+=c[y][1]-c[y][0]-1;return h}const wz={resolve:Nz,tokenize:Az},Ez={partial:!0,tokenize:Tz};function Nz(t){return kT(t),t}function Az(t,e){let n;return i;function i(u){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),r(u)}function r(u){return u===null?s(u):Te(u)?t.check(Ez,o,s)(u):(t.consume(u),r)}function s(u){return t.exit("chunkContent"),t.exit("content"),e(u)}function o(u){return t.consume(u),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function Tz(t,e,n){const i=this;return r;function r(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),nt(t,s,"linePrefix")}function s(o){if(o===null||Te(o))return n(o);const u=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(o):t.interrupt(i.parser.constructs.flow,n,e)(o)}}function vT(t,e,n,i,r,s,o,u,c){const h=c||Number.POSITIVE_INFINITY;let m=0;return g;function g(M){return M===60?(t.enter(i),t.enter(r),t.enter(s),t.consume(M),t.exit(s),y):M===null||M===32||M===41||xm(M)?n(M):(t.enter(i),t.enter(o),t.enter(u),t.enter("chunkString",{contentType:"string"}),E(M))}function y(M){return M===62?(t.enter(s),t.consume(M),t.exit(s),t.exit(r),t.exit(i),e):(t.enter(u),t.enter("chunkString",{contentType:"string"}),b(M))}function b(M){return M===62?(t.exit("chunkString"),t.exit(u),y(M)):M===null||M===60||Te(M)?n(M):(t.consume(M),M===92?v:b)}function v(M){return M===60||M===62||M===92?(t.consume(M),b):b(M)}function E(M){return!m&&(M===null||M===41||ct(M))?(t.exit("chunkString"),t.exit(u),t.exit(o),t.exit(i),e(M)):m<h&&M===40?(t.consume(M),m++,E):M===41?(t.consume(M),m--,E):M===null||M===32||M===40||xm(M)?n(M):(t.consume(M),M===92?T:E)}function T(M){return M===40||M===41||M===92?(t.consume(M),E):E(M)}}function CT(t,e,n,i,r,s){const o=this;let u=0,c;return h;function h(b){return t.enter(i),t.enter(r),t.consume(b),t.exit(r),t.enter(s),m}function m(b){return u>999||b===null||b===91||b===93&&!c||b===94&&!u&&"_hiddenFootnoteSupport"in o.parser.constructs?n(b):b===93?(t.exit(s),t.enter(r),t.consume(b),t.exit(r),t.exit(i),e):Te(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||Te(b)||u++>999?(t.exit("chunkString"),m(b)):(t.consume(b),c||(c=!Ge(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(t.consume(b),u++,g):g(b)}}function wT(t,e,n,i,r,s){let o;return u;function u(y){return y===34||y===39||y===40?(t.enter(i),t.enter(r),t.consume(y),t.exit(r),o=y===40?41:y,c):n(y)}function c(y){return y===o?(t.enter(r),t.consume(y),t.exit(r),t.exit(i),e):(t.enter(s),h(y))}function h(y){return y===o?(t.exit(s),c(o)):y===null?n(y):Te(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),nt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===o||y===null||Te(y)?(t.exit("chunkString"),h(y)):(t.consume(y),y===92?g:m)}function g(y){return y===o||y===92?(t.consume(y),m):m(y)}}function Bf(t,e){let n;return i;function i(r){return Te(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,i):Ge(r)?nt(t,i,n?"linePrefix":"lineSuffix")(r):e(r)}}const Mz={name:"definition",tokenize:Rz},Oz={partial:!0,tokenize:Dz};function Rz(t,e,n){const i=this;let r;return s;function s(b){return t.enter("definition"),o(b)}function o(b){return CT.call(i,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return r=Cr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),c):n(b)}function c(b){return ct(b)?Bf(t,h)(b):h(b)}function h(b){return vT(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function m(b){return t.attempt(Oz,g,g)(b)}function g(b){return Ge(b)?nt(t,y,"whitespace")(b):y(b)}function y(b){return b===null||Te(b)?(t.exit("definition"),i.parser.defined.push(r),e(b)):n(b)}}function Dz(t,e,n){return i;function i(u){return ct(u)?Bf(t,r)(u):n(u)}function r(u){return wT(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return Ge(u)?nt(t,o,"whitespace")(u):o(u)}function o(u){return u===null||Te(u)?e(u):n(u)}}const Iz={name:"hardBreakEscape",tokenize:_z};function _z(t,e,n){return i;function i(s){return t.enter("hardBreakEscape"),t.consume(s),r}function r(s){return Te(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const zz={name:"headingAtx",resolve:Lz,tokenize:Bz};function Lz(t,e){let n=t.length-2,i=3,r,s;return t[i][1].type==="whitespace"&&(i+=2),n-2>i&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&t[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(r={type:"atxHeadingText",start:t[i][1].start,end:t[n][1].end},s={type:"chunkText",start:t[i][1].start,end:t[n][1].end,contentType:"text"},wi(t,i,n-i+1,[["enter",r,e],["enter",s,e],["exit",s,e],["exit",r,e]])),t}function Bz(t,e,n){let i=0;return r;function r(m){return t.enter("atxHeading"),s(m)}function s(m){return t.enter("atxHeadingSequence"),o(m)}function o(m){return m===35&&i++<6?(t.consume(m),o):m===null||ct(m)?(t.exit("atxHeadingSequence"),u(m)):n(m)}function u(m){return m===35?(t.enter("atxHeadingSequence"),c(m)):m===null||Te(m)?(t.exit("atxHeading"),e(m)):Ge(m)?nt(t,u,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function c(m){return m===35?(t.consume(m),c):(t.exit("atxHeadingSequence"),u(m))}function h(m){return m===null||m===35||ct(m)?(t.exit("atxHeadingText"),u(m)):(t.consume(m),h)}}const Vz=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],K2=["pre","script","style","textarea"],Fz={concrete:!0,name:"htmlFlow",resolveTo:$z,tokenize:Uz},Pz={partial:!0,tokenize:Hz},jz={partial:!0,tokenize:Jz};function $z(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Uz(t,e,n){const i=this;let r,s,o,u,c;return h;function h(B){return m(B)}function m(B){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(B),g}function g(B){return B===33?(t.consume(B),y):B===47?(t.consume(B),s=!0,E):B===63?(t.consume(B),r=3,i.interrupt?e:D):bn(B)?(t.consume(B),o=String.fromCharCode(B),T):n(B)}function y(B){return B===45?(t.consume(B),r=2,b):B===91?(t.consume(B),r=5,u=0,v):bn(B)?(t.consume(B),r=4,i.interrupt?e:D):n(B)}function b(B){return B===45?(t.consume(B),i.interrupt?e:D):n(B)}function v(B){const be="CDATA[";return B===be.charCodeAt(u++)?(t.consume(B),u===be.length?i.interrupt?e:he:v):n(B)}function E(B){return bn(B)?(t.consume(B),o=String.fromCharCode(B),T):n(B)}function T(B){if(B===null||B===47||B===62||ct(B)){const be=B===47,Re=o.toLowerCase();return!be&&!s&&K2.includes(Re)?(r=1,i.interrupt?e(B):he(B)):Vz.includes(o.toLowerCase())?(r=6,be?(t.consume(B),M):i.interrupt?e(B):he(B)):(r=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(B):s?j(B):F(B))}return B===45||oi(B)?(t.consume(B),o+=String.fromCharCode(B),T):n(B)}function M(B){return B===62?(t.consume(B),i.interrupt?e:he):n(B)}function j(B){return Ge(B)?(t.consume(B),j):K(B)}function F(B){return B===47?(t.consume(B),K):B===58||B===95||bn(B)?(t.consume(B),J):Ge(B)?(t.consume(B),F):K(B)}function J(B){return B===45||B===46||B===58||B===95||oi(B)?(t.consume(B),J):V(B)}function V(B){return B===61?(t.consume(B),C):Ge(B)?(t.consume(B),V):F(B)}function C(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(t.consume(B),c=B,L):Ge(B)?(t.consume(B),C):q(B)}function L(B){return B===c?(t.consume(B),c=null,re):B===null||Te(B)?n(B):(t.consume(B),L)}function q(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ct(B)?V(B):(t.consume(B),q)}function re(B){return B===47||B===62||Ge(B)?F(B):n(B)}function K(B){return B===62?(t.consume(B),pe):n(B)}function pe(B){return B===null||Te(B)?he(B):Ge(B)?(t.consume(B),pe):n(B)}function he(B){return B===45&&r===2?(t.consume(B),W):B===60&&r===1?(t.consume(B),oe):B===62&&r===4?(t.consume(B),P):B===63&&r===3?(t.consume(B),D):B===93&&r===5?(t.consume(B),ve):Te(B)&&(r===6||r===7)?(t.exit("htmlFlowData"),t.check(Pz,ne,ke)(B)):B===null||Te(B)?(t.exit("htmlFlowData"),ke(B)):(t.consume(B),he)}function ke(B){return t.check(jz,Ie,ne)(B)}function Ie(B){return t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),De}function De(B){return B===null||Te(B)?ke(B):(t.enter("htmlFlowData"),he(B))}function W(B){return B===45?(t.consume(B),D):he(B)}function oe(B){return B===47?(t.consume(B),o="",de):he(B)}function de(B){if(B===62){const be=o.toLowerCase();return K2.includes(be)?(t.consume(B),P):he(B)}return bn(B)&&o.length<8?(t.consume(B),o+=String.fromCharCode(B),de):he(B)}function ve(B){return B===93?(t.consume(B),D):he(B)}function D(B){return B===62?(t.consume(B),P):B===45&&r===2?(t.consume(B),D):he(B)}function P(B){return B===null||Te(B)?(t.exit("htmlFlowData"),ne(B)):(t.consume(B),P)}function ne(B){return t.exit("htmlFlow"),e(B)}}function Jz(t,e,n){const i=this;return r;function r(o){return Te(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return i.parser.lazy[i.now().line]?n(o):e(o)}}function Hz(t,e,n){return i;function i(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),t.attempt(Lu,e,n)}}const qz={name:"htmlText",tokenize:Kz};function Kz(t,e,n){const i=this;let r,s,o;return u;function u(D){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(D),c}function c(D){return D===33?(t.consume(D),h):D===47?(t.consume(D),V):D===63?(t.consume(D),F):bn(D)?(t.consume(D),q):n(D)}function h(D){return D===45?(t.consume(D),m):D===91?(t.consume(D),s=0,v):bn(D)?(t.consume(D),j):n(D)}function m(D){return D===45?(t.consume(D),b):n(D)}function g(D){return D===null?n(D):D===45?(t.consume(D),y):Te(D)?(o=g,oe(D)):(t.consume(D),g)}function y(D){return D===45?(t.consume(D),b):g(D)}function b(D){return D===62?W(D):D===45?y(D):g(D)}function v(D){const P="CDATA[";return D===P.charCodeAt(s++)?(t.consume(D),s===P.length?E:v):n(D)}function E(D){return D===null?n(D):D===93?(t.consume(D),T):Te(D)?(o=E,oe(D)):(t.consume(D),E)}function T(D){return D===93?(t.consume(D),M):E(D)}function M(D){return D===62?W(D):D===93?(t.consume(D),M):E(D)}function j(D){return D===null||D===62?W(D):Te(D)?(o=j,oe(D)):(t.consume(D),j)}function F(D){return D===null?n(D):D===63?(t.consume(D),J):Te(D)?(o=F,oe(D)):(t.consume(D),F)}function J(D){return D===62?W(D):F(D)}function V(D){return bn(D)?(t.consume(D),C):n(D)}function C(D){return D===45||oi(D)?(t.consume(D),C):L(D)}function L(D){return Te(D)?(o=L,oe(D)):Ge(D)?(t.consume(D),L):W(D)}function q(D){return D===45||oi(D)?(t.consume(D),q):D===47||D===62||ct(D)?re(D):n(D)}function re(D){return D===47?(t.consume(D),W):D===58||D===95||bn(D)?(t.consume(D),K):Te(D)?(o=re,oe(D)):Ge(D)?(t.consume(D),re):W(D)}function K(D){return D===45||D===46||D===58||D===95||oi(D)?(t.consume(D),K):pe(D)}function pe(D){return D===61?(t.consume(D),he):Te(D)?(o=pe,oe(D)):Ge(D)?(t.consume(D),pe):re(D)}function he(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(t.consume(D),r=D,ke):Te(D)?(o=he,oe(D)):Ge(D)?(t.consume(D),he):(t.consume(D),Ie)}function ke(D){return D===r?(t.consume(D),r=void 0,De):D===null?n(D):Te(D)?(o=ke,oe(D)):(t.consume(D),ke)}function Ie(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ct(D)?re(D):(t.consume(D),Ie)}function De(D){return D===47||D===62||ct(D)?re(D):n(D)}function W(D){return D===62?(t.consume(D),t.exit("htmlTextData"),t.exit("htmlText"),e):n(D)}function oe(D){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),de}function de(D){return Ge(D)?nt(t,ve,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ve(D)}function ve(D){return t.enter("htmlTextData"),o(D)}}const Gb={name:"labelEnd",resolveAll:Qz,resolveTo:Wz,tokenize:Zz},Gz={tokenize:e5},Yz={tokenize:t5},Xz={tokenize:n5};function Qz(t){let e=-1;const n=[];for(;++e<t.length;){const i=t[e][1];if(n.push(t[e]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const r=i.type==="labelImage"?4:2;i.type="data",e+=r}}return t.length!==n.length&&wi(t,0,t.length,n),t}function Wz(t,e){let n=t.length,i=0,r,s,o,u;for(;n--;)if(r=t[n][1],s){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;t[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(s=n,r.type!=="labelLink")){i=2;break}}else r.type==="labelEnd"&&(o=n);const c={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},h={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},m={type:"labelText",start:{...t[s+i+2][1].end},end:{...t[o-2][1].start}};return u=[["enter",c,e],["enter",h,e]],u=Qi(u,t.slice(s+1,s+i+3)),u=Qi(u,[["enter",m,e]]),u=Qi(u,dg(e.parser.constructs.insideSpan.null,t.slice(s+i+4,o-3),e)),u=Qi(u,[["exit",m,e],t[o-2],t[o-1],["exit",h,e]]),u=Qi(u,t.slice(o+1)),u=Qi(u,[["exit",c,e]]),wi(t,s,t.length,u),t}function Zz(t,e,n){const i=this;let r=i.events.length,s,o;for(;r--;)if((i.events[r][1].type==="labelImage"||i.events[r][1].type==="labelLink")&&!i.events[r][1]._balanced){s=i.events[r][1];break}return u;function u(y){return s?s._inactive?g(y):(o=i.parser.defined.includes(Cr(i.sliceSerialize({start:s.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(y),t.exit("labelMarker"),t.exit("labelEnd"),c):n(y)}function c(y){return y===40?t.attempt(Gz,m,o?m:g)(y):y===91?t.attempt(Yz,m,o?h:g)(y):o?m(y):g(y)}function h(y){return t.attempt(Xz,m,g)(y)}function m(y){return e(y)}function g(y){return s._balanced=!0,n(y)}}function e5(t,e,n){return i;function i(g){return t.enter("resource"),t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),r}function r(g){return ct(g)?Bf(t,s)(g):s(g)}function s(g){return g===41?m(g):vT(t,o,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function o(g){return ct(g)?Bf(t,c)(g):m(g)}function u(g){return n(g)}function c(g){return g===34||g===39||g===40?wT(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function h(g){return ct(g)?Bf(t,m)(g):m(g)}function m(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),e):n(g)}}function t5(t,e,n){const i=this;return r;function r(u){return CT.call(i,t,s,o,"reference","referenceMarker","referenceString")(u)}function s(u){return i.parser.defined.includes(Cr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function o(u){return n(u)}}function n5(t,e,n){return i;function i(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),r}function r(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const i5={name:"labelStartImage",resolveAll:Gb.resolveAll,tokenize:r5};function r5(t,e,n){const i=this;return r;function r(u){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(u),t.exit("labelImageMarker"),s}function s(u){return u===91?(t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelImage"),o):n(u)}function o(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):e(u)}}const s5={name:"labelStartLink",resolveAll:Gb.resolveAll,tokenize:a5};function a5(t,e,n){const i=this;return r;function r(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(o):e(o)}}const Qy={name:"lineEnding",tokenize:o5};function o5(t,e){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),nt(t,e,"linePrefix")}}const zd={name:"thematicBreak",tokenize:l5};function l5(t,e,n){let i=0,r;return s;function s(h){return t.enter("thematicBreak"),o(h)}function o(h){return r=h,u(h)}function u(h){return h===r?(t.enter("thematicBreakSequence"),c(h)):i>=3&&(h===null||Te(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===r?(t.consume(h),i++,c):(t.exit("thematicBreakSequence"),Ge(h)?nt(t,u,"whitespace")(h):u(h))}}const ai={continuation:{tokenize:h5},exit:d5,name:"list",tokenize:f5},u5={partial:!0,tokenize:m5},c5={partial:!0,tokenize:p5};function f5(t,e,n){const i=this,r=i.events[i.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return u;function u(b){const v=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:yx(b)){if(i.containerState.type||(i.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(zd,n,h)(b):h(b);if(!i.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(b)}return n(b)}function c(b){return yx(b)&&++o<10?(t.consume(b),c):(!i.interrupt||o<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),h(b)):n(b)}function h(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,t.check(Lu,i.interrupt?n:m,t.attempt(u5,y,g))}function m(b){return i.containerState.initialBlankLine=!0,s++,y(b)}function g(b){return Ge(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=s+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(b)}}function h5(t,e,n){const i=this;return i.containerState._closeFlow=void 0,t.check(Lu,r,s);function r(u){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,nt(t,e,"listItemIndent",i.containerState.size+1)(u)}function s(u){return i.containerState.furtherBlankLines||!Ge(u)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(u)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(c5,e,o)(u))}function o(u){return i.containerState._closeFlow=!0,i.interrupt=void 0,nt(t,t.attempt(ai,e,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function p5(t,e,n){const i=this;return nt(t,r,"listItemIndent",i.containerState.size+1);function r(s){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?e(s):n(s)}}function d5(t){t.exit(this.containerState.type)}function m5(t,e,n){const i=this;return nt(t,r,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(s){const o=i.events[i.events.length-1];return!Ge(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const G2={name:"setextUnderline",resolveTo:g5,tokenize:y5};function g5(t,e){let n=t.length,i,r,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){i=n;break}t[n][1].type==="paragraph"&&(r=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[r][1].type="setextHeadingText",s?(t.splice(r,0,["enter",o,e]),t.splice(s+1,0,["exit",t[i][1],e]),t[i][1].end={...t[s][1].end}):t[i][1]=o,t.push(["exit",o,e]),t}function y5(t,e,n){const i=this;let r;return s;function s(h){let m=i.events.length,g;for(;m--;)if(i.events[m][1].type!=="lineEnding"&&i.events[m][1].type!=="linePrefix"&&i.events[m][1].type!=="content"){g=i.events[m][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(t.enter("setextHeadingLine"),r=h,o(h)):n(h)}function o(h){return t.enter("setextHeadingLineSequence"),u(h)}function u(h){return h===r?(t.consume(h),u):(t.exit("setextHeadingLineSequence"),Ge(h)?nt(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||Te(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const x5={tokenize:b5};function b5(t){const e=this,n=t.attempt(Lu,i,t.attempt(this.parser.constructs.flowInitial,r,nt(t,t.attempt(this.parser.constructs.flow,r,t.attempt(wz,r)),"linePrefix")));return n;function i(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function r(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const S5={resolveAll:NT()},k5=ET("string"),v5=ET("text");function ET(t){return{resolveAll:NT(t==="text"?C5:void 0),tokenize:e};function e(n){const i=this,r=this.parser.constructs[t],s=n.attempt(r,o,u);return o;function o(m){return h(m)?s(m):u(m)}function u(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),c}function c(m){return h(m)?(n.exit("data"),s(m)):(n.consume(m),c)}function h(m){if(m===null)return!0;const g=r[m];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function NT(t){return e;function e(n,i){let r=-1,s;for(;++r<=n.length;)s===void 0?n[r]&&n[r][1].type==="data"&&(s=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==s+2&&(n[s][1].end=n[r-1][1].end,n.splice(s+2,r-s-2),r=s+2),s=void 0);return t?t(n,i):n}}function C5(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const i=t[n-1][1],r=e.sliceStream(i);let s=r.length,o=-1,u=0,c;for(;s--;){const h=r[s];if(typeof h=="string"){for(o=h.length;h.charCodeAt(o-1)===32;)u++,o--;if(o)break;o=-1}else if(h===-2)c=!0,u++;else if(h!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(u=0),u){const h={type:n===t.length||c||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:i.start._bufferIndex+o,_index:i.start._index+s,line:i.end.line,column:i.end.column-u,offset:i.end.offset-u},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(t.splice(n,0,["enter",h,e],["exit",h,e]),n+=2)}n++}return t}const w5={42:ai,43:ai,45:ai,48:ai,49:ai,50:ai,51:ai,52:ai,53:ai,54:ai,55:ai,56:ai,57:ai,62:xT},E5={91:Mz},N5={[-2]:Xy,[-1]:Xy,32:Xy},A5={35:zz,42:zd,45:[G2,zd],60:Fz,61:G2,95:zd,96:q2,126:q2},T5={38:ST,92:bT},M5={[-5]:Qy,[-4]:Qy,[-3]:Qy,33:i5,38:ST,42:xx,60:[sz,qz],91:s5,92:[Iz,bT],93:Gb,95:xx,96:xz},O5={null:[xx,S5]},R5={null:[42,95]},D5={null:[]},I5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:R5,contentInitial:E5,disable:D5,document:w5,flow:A5,flowInitial:N5,insideSpan:O5,string:T5,text:M5},Symbol.toStringTag,{value:"Module"}));function _5(t,e,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let o=[],u=[];const c={attempt:L(V),check:L(C),consume:j,enter:F,exit:J,interrupt:L(C,{interrupt:!0})},h={code:null,containerState:{},defineSkip:E,events:[],now:v,parser:t,previous:null,sliceSerialize:y,sliceStream:b,write:g};let m=e.tokenize.call(h,c);return e.resolveAll&&s.push(e),h;function g(pe){return o=Qi(o,pe),T(),o[o.length-1]!==null?[]:(q(e,0),h.events=dg(s,h.events,h),h.events)}function y(pe,he){return L5(b(pe),he)}function b(pe){return z5(o,pe)}function v(){const{_bufferIndex:pe,_index:he,line:ke,column:Ie,offset:De}=i;return{_bufferIndex:pe,_index:he,line:ke,column:Ie,offset:De}}function E(pe){r[pe.line]=pe.column,K()}function T(){let pe;for(;i._index<o.length;){const he=o[i._index];if(typeof he=="string")for(pe=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===pe&&i._bufferIndex<he.length;)M(he.charCodeAt(i._bufferIndex));else M(he)}}function M(pe){m=m(pe)}function j(pe){Te(pe)?(i.line++,i.column=1,i.offset+=pe===-3?2:1,K()):pe!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=pe}function F(pe,he){const ke=he||{};return ke.type=pe,ke.start=v(),h.events.push(["enter",ke,h]),u.push(ke),ke}function J(pe){const he=u.pop();return he.end=v(),h.events.push(["exit",he,h]),he}function V(pe,he){q(pe,he.from)}function C(pe,he){he.restore()}function L(pe,he){return ke;function ke(Ie,De,W){let oe,de,ve,D;return Array.isArray(Ie)?ne(Ie):"tokenize"in Ie?ne([Ie]):P(Ie);function P(Me){return Xe;function Xe(Ct){const Qe=Ct!==null&&Me[Ct],zt=Ct!==null&&Me.null,Lt=[...Array.isArray(Qe)?Qe:Qe?[Qe]:[],...Array.isArray(zt)?zt:zt?[zt]:[]];return ne(Lt)(Ct)}}function ne(Me){return oe=Me,de=0,Me.length===0?W:B(Me[de])}function B(Me){return Xe;function Xe(Ct){return D=re(),ve=Me,Me.partial||(h.currentConstruct=Me),Me.name&&h.parser.constructs.disable.null.includes(Me.name)?Re():Me.tokenize.call(he?Object.assign(Object.create(h),he):h,c,be,Re)(Ct)}}function be(Me){return pe(ve,D),De}function Re(Me){return D.restore(),++de<oe.length?B(oe[de]):W}}}function q(pe,he){pe.resolveAll&&!s.includes(pe)&&s.push(pe),pe.resolve&&wi(h.events,he,h.events.length-he,pe.resolve(h.events.slice(he),h)),pe.resolveTo&&(h.events=pe.resolveTo(h.events,h))}function re(){const pe=v(),he=h.previous,ke=h.currentConstruct,Ie=h.events.length,De=Array.from(u);return{from:Ie,restore:W};function W(){i=pe,h.previous=he,h.currentConstruct=ke,h.events.length=Ie,u=De,K()}}function K(){i.line in r&&i.column<2&&(i.column=r[i.line],i.offset+=r[i.line]-1)}}function z5(t,e){const n=e.start._index,i=e.start._bufferIndex,r=e.end._index,s=e.end._bufferIndex;let o;if(n===r)o=[t[n].slice(i,s)];else{if(o=t.slice(n,r),i>-1){const u=o[0];typeof u=="string"?o[0]=u.slice(i):o.shift()}s>0&&o.push(t[r].slice(0,s))}return o}function L5(t,e){let n=-1;const i=[];let r;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
3
- `;break}case-3:{o=`\r
4
- `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&r)continue;o=" ";break}default:o=String.fromCharCode(s)}r=s===-2,i.push(o)}return i.join("")}function B5(t){const i={constructs:Kb([I5,...(t||{}).extensions||[]]),content:r(W4),defined:[],document:r(ez),flow:r(x5),lazy:{},string:r(k5),text:r(v5)};return i;function r(s){return o;function o(u){return _5(i,s,u)}}}function V5(t){for(;!kT(t););return t}const Y2=/[\0\t\n\r]/g;function F5(){let t=1,e="",n=!0,i;return r;function r(s,o,u){const c=[];let h,m,g,y,b;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),g=0,e="",n&&(s.charCodeAt(0)===65279&&g++,n=void 0);g<s.length;){if(Y2.lastIndex=g,h=Y2.exec(s),y=h&&h.index!==void 0?h.index:s.length,b=s.charCodeAt(y),!h){e=s.slice(g);break}if(b===10&&g===y&&i)c.push(-3),i=void 0;else switch(i&&(c.push(-5),i=void 0),g<y&&(c.push(s.slice(g,y)),t+=y-g),b){case 0:{c.push(65533),t++;break}case 9:{for(m=Math.ceil(t/4)*4,c.push(-2);t++<m;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:i=!0,t=1}g=y+1}return u&&(i&&c.push(-5),e&&c.push(e),c.push(null)),c}}const P5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function AT(t){return t.replace(P5,j5)}function j5(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),s=r===120||r===88;return yT(n.slice(s?2:1),s?16:10)}return oh(n)||t}function Es(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?X2(t.position):"start"in t||"end"in t?X2(t):"line"in t||"column"in t?bx(t):""}function bx(t){return Q2(t&&t.line)+":"+Q2(t&&t.column)}function X2(t){return bx(t&&t.start)+"-"+bx(t&&t.end)}function Q2(t){return t&&typeof t=="number"?t:1}const TT={}.hasOwnProperty;function $5(t,e,n){return typeof e!="string"&&(n=e,e=void 0),U5(n)(V5(B5(n).document().write(F5()(t,e,!0))))}function U5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(cr),autolinkProtocol:re,autolinkEmail:re,atxHeading:s(pi),blockQuote:s(zt),characterEscape:re,characterReference:re,codeFenced:s(Lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Lt,o),codeText:s(Tr,o),codeTextData:re,data:re,codeFlowValue:re,definition:s(ur),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Xn),hardBreakEscape:s(Mi),hardBreakTrailing:s(Mi),htmlFlow:s(Qn,o),htmlFlowData:re,htmlText:s(Qn,o),htmlTextData:re,image:s(di),label:o,link:s(cr),listItem:s(Oi),listItemValue:y,listOrdered:s(On,g),listUnordered:s(On),paragraph:s(Mr),reference:B,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(pi),strong:s(Ri),thematicBreak:s(Xr)},exit:{atxHeading:c(),atxHeadingSequence:V,autolink:c(),autolinkEmail:Qe,autolinkProtocol:Ct,blockQuote:c(),characterEscapeValue:K,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:Me,characterReference:Xe,codeFenced:c(T),codeFencedFence:E,codeFencedFenceInfo:b,codeFencedFenceMeta:v,codeFlowValue:K,codeIndented:c(M),codeText:c(De),codeTextData:K,data:K,definition:c(),definitionDestinationString:J,definitionLabelString:j,definitionTitleString:F,emphasis:c(),hardBreakEscape:c(he),hardBreakTrailing:c(he),htmlFlow:c(ke),htmlFlowData:K,htmlText:c(Ie),htmlTextData:K,image:c(oe),label:ve,labelText:de,lineEnding:pe,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:be,resourceDestinationString:D,resourceTitleString:P,resource:ne,setextHeading:c(q),setextHeadingLineSequence:L,setextHeadingText:C,strong:c(),thematicBreak:c()}};MT(e,(t||{}).mdastExtensions||[]);const n={};return i;function i(ae){let me={type:"root",children:[]};const I={stack:[me],tokenStack:[],config:e,enter:u,exit:h,buffer:o,resume:m,data:n},_e=[];let Pe=-1;for(;++Pe<ae.length;)if(ae[Pe][1].type==="listOrdered"||ae[Pe][1].type==="listUnordered")if(ae[Pe][0]==="enter")_e.push(Pe);else{const tn=_e.pop();Pe=r(ae,tn,Pe)}for(Pe=-1;++Pe<ae.length;){const tn=e[ae[Pe][0]];TT.call(tn,ae[Pe][1].type)&&tn[ae[Pe][1].type].call(Object.assign({sliceSerialize:ae[Pe][2].sliceSerialize},I),ae[Pe][1])}if(I.tokenStack.length>0){const tn=I.tokenStack[I.tokenStack.length-1];(tn[1]||W2).call(I,void 0,tn[0])}for(me.position={start:ba(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:ba(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<e.transforms.length;)me=e.transforms[Pe](me)||me;return me}function r(ae,me,I){let _e=me-1,Pe=-1,tn=!1,Wn,Se,_t,mn;for(;++_e<=I;){const St=ae[_e];switch(St[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{St[0]==="enter"?Pe++:Pe--,mn=void 0;break}case"lineEndingBlank":{St[0]==="enter"&&(Wn&&!mn&&!Pe&&!_t&&(_t=_e),mn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mn=void 0}if(!Pe&&St[0]==="enter"&&St[1].type==="listItemPrefix"||Pe===-1&&St[0]==="exit"&&(St[1].type==="listUnordered"||St[1].type==="listOrdered")){if(Wn){let Zn=_e;for(Se=void 0;Zn--;){const Rn=ae[Zn];if(Rn[1].type==="lineEnding"||Rn[1].type==="lineEndingBlank"){if(Rn[0]==="exit")continue;Se&&(ae[Se][1].type="lineEndingBlank",tn=!0),Rn[1].type="lineEnding",Se=Zn}else if(!(Rn[1].type==="linePrefix"||Rn[1].type==="blockQuotePrefix"||Rn[1].type==="blockQuotePrefixWhitespace"||Rn[1].type==="blockQuoteMarker"||Rn[1].type==="listItemIndent"))break}_t&&(!Se||_t<Se)&&(Wn._spread=!0),Wn.end=Object.assign({},Se?ae[Se][1].start:St[1].end),ae.splice(Se||_e,0,["exit",Wn,St[2]]),_e++,I++}if(St[1].type==="listItemPrefix"){const Zn={type:"listItem",_spread:!1,start:Object.assign({},St[1].start),end:void 0};Wn=Zn,ae.splice(_e,0,["enter",Zn,St[2]]),_e++,I++,_t=void 0,mn=!0}}}return ae[me][1]._spread=tn,I}function s(ae,me){return I;function I(_e){u.call(this,ae(_e),_e),me&&me.call(this,_e)}}function o(){this.stack.push({type:"fragment",children:[]})}function u(ae,me,I){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([me,I||void 0]),ae.position={start:ba(me.start),end:void 0}}function c(ae){return me;function me(I){ae&&ae.call(this,I),h.call(this,I)}}function h(ae,me){const I=this.stack.pop(),_e=this.tokenStack.pop();if(_e)_e[0].type!==ae.type&&(me?me.call(this,ae,_e[0]):(_e[1]||W2).call(this,ae,_e[0]));else throw new Error("Cannot close `"+ae.type+"` ("+Es({start:ae.start,end:ae.end})+"): it’s not open");I.position.end=ba(ae.end)}function m(){return qb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.lang=ae}function v(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.meta=ae}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae.replace(/(\r?\n|\r)$/g,"")}function j(ae){const me=this.resume(),I=this.stack[this.stack.length-1];I.label=me,I.identifier=Cr(this.sliceSerialize(ae)).toLowerCase()}function F(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.title=ae}function J(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.url=ae}function V(ae){const me=this.stack[this.stack.length-1];if(!me.depth){const I=this.sliceSerialize(ae).length;me.depth=I}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function L(ae){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function re(ae){const I=this.stack[this.stack.length-1].children;let _e=I[I.length-1];(!_e||_e.type!=="text")&&(_e=$e(),_e.position={start:ba(ae.start),end:void 0},I.push(_e)),this.stack.push(_e)}function K(ae){const me=this.stack.pop();me.value+=this.sliceSerialize(ae),me.position.end=ba(ae.end)}function pe(ae){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const I=me.children[me.children.length-1];I.position.end=ba(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(me.type)&&(re.call(this,ae),K.call(this,ae))}function he(){this.data.atHardBreak=!0}function ke(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae}function Ie(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae}function De(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.value=ae}function W(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=me,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function oe(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=me,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function de(ae){const me=this.sliceSerialize(ae),I=this.stack[this.stack.length-2];I.label=AT(me),I.identifier=Cr(me).toLowerCase()}function ve(){const ae=this.stack[this.stack.length-1],me=this.resume(),I=this.stack[this.stack.length-1];if(this.data.inReference=!0,I.type==="link"){const _e=ae.children;I.children=_e}else I.alt=me}function D(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.url=ae}function P(){const ae=this.resume(),me=this.stack[this.stack.length-1];me.title=ae}function ne(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function be(ae){const me=this.resume(),I=this.stack[this.stack.length-1];I.label=me,I.identifier=Cr(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function Re(ae){this.data.characterReferenceType=ae.type}function Me(ae){const me=this.sliceSerialize(ae),I=this.data.characterReferenceType;let _e;I?(_e=yT(me,I==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_e=oh(me);const Pe=this.stack[this.stack.length-1];Pe.value+=_e}function Xe(ae){const me=this.stack.pop();me.position.end=ba(ae.end)}function Ct(ae){K.call(this,ae);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ae)}function Qe(ae){K.call(this,ae);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ae)}function zt(){return{type:"blockquote",children:[]}}function Lt(){return{type:"code",lang:null,meta:null,value:""}}function Tr(){return{type:"inlineCode",value:""}}function ur(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xn(){return{type:"emphasis",children:[]}}function pi(){return{type:"heading",depth:0,children:[]}}function Mi(){return{type:"break"}}function Qn(){return{type:"html",value:""}}function di(){return{type:"image",title:null,url:"",alt:null}}function cr(){return{type:"link",title:null,url:"",children:[]}}function On(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function Oi(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Mr(){return{type:"paragraph",children:[]}}function Ri(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function Xr(){return{type:"thematicBreak"}}}function ba(t){return{line:t.line,column:t.column,offset:t.offset}}function MT(t,e){let n=-1;for(;++n<e.length;){const i=e[n];Array.isArray(i)?MT(t,i):J5(t,i)}}function J5(t,e){let n;for(n in e)if(TT.call(e,n))switch(n){case"canContainEols":{const i=e[n];i&&t[n].push(...i);break}case"transforms":{const i=e[n];i&&t[n].push(...i);break}case"enter":case"exit":{const i=e[n];i&&Object.assign(t[n],i);break}}}function W2(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Es({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Es({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Es({start:e.start,end:e.end})+") is still open")}function bm(t){const e=this;e.parser=n;function n(i){return $5(i,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const Z2={}.hasOwnProperty;function H5(t,e){const n=e||{};function i(r,...s){let o=i.invalid;const u=i.handlers;if(r&&Z2.call(r,t)){const c=String(r[t]);o=Z2.call(u,c)?u[c]:i.unknown}if(o)return o.call(this,r,...s)}return i.handlers=n.handlers||{},i.invalid=n.invalid,i.unknown=n.unknown,i}const q5={}.hasOwnProperty;function OT(t,e){let n=-1,i;if(e.extensions)for(;++n<e.extensions.length;)OT(t,e.extensions[n]);for(i in e)if(q5.call(e,i))switch(i){case"extensions":break;case"unsafe":{eE(t[i],e[i]);break}case"join":{eE(t[i],e[i]);break}case"handlers":{K5(t[i],e[i]);break}default:t.options[i]=e[i]}return t}function eE(t,e){e&&t.push(...e)}function K5(t,e){e&&Object.assign(t,e)}function G5(t,e,n,i){const r=n.enter("blockquote"),s=n.createTracker(i);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(t,s.current()),Y5);return r(),o}function Y5(t,e,n){return">"+(n?"":" ")+t}function RT(t,e){return tE(t,e.inConstruct,!0)&&!tE(t,e.notInConstruct,!1)}function tE(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let i=-1;for(;++i<e.length;)if(t.includes(e[i]))return!0;return!1}function nE(t,e,n,i){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
5
- `&&RT(n.stack,n.unsafe[r]))return/[ \t]/.test(i.before)?"":" ";return`\\
6
- `}function X5(t,e){const n=String(t);let i=n.indexOf(e),r=i,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===r?++s>o&&(o=s):s=1,r=i+e.length,i=n.indexOf(e,r);return o}function Sx(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function Q5(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function W5(t,e,n,i){const r=Q5(n),s=t.value||"",o=r==="`"?"GraveAccent":"Tilde";if(Sx(t,n)){const g=n.enter("codeIndented"),y=n.indentLines(s,Z5);return g(),y}const u=n.createTracker(i),c=r.repeat(Math.max(X5(s,r)+1,3)),h=n.enter("codeFenced");let m=u.move(c);if(t.lang){const g=n.enter(`codeFencedLang${o}`);m+=u.move(n.safe(t.lang,{before:m,after:" ",encode:["`"],...u.current()})),g()}if(t.lang&&t.meta){const g=n.enter(`codeFencedMeta${o}`);m+=u.move(" "),m+=u.move(n.safe(t.meta,{before:m,after:`
7
- `,encode:["`"],...u.current()})),g()}return m+=u.move(`
8
- `),s&&(m+=u.move(s+`
9
- `)),m+=u.move(c),h(),m}function Z5(t,e,n){return(n?"":" ")+t}function Yb(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function eL(t,e,n,i){const r=Yb(n),s=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let u=n.enter("label");const c=n.createTracker(i);let h=c.move("[");return h+=c.move(n.safe(n.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),u(),!t.url||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(u=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":`
10
- `,...c.current()}))),u(),t.title&&(u=n.enter(`title${s}`),h+=c.move(" "+r),h+=c.move(n.safe(t.title,{before:h,after:r,...c.current()})),h+=c.move(r),u()),o(),h}function tL(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Fa(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Sm(t,e,n){const i=Tu(t),r=Tu(e);return i===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}DT.peek=nL;function DT(t,e,n,i){const r=tL(n),s=n.enter("emphasis"),o=n.createTracker(i),u=o.move(r);let c=o.move(n.containerPhrasing(t,{after:r,before:u,...o.current()}));const h=c.charCodeAt(0),m=Sm(i.before.charCodeAt(i.before.length-1),h,r);m.inside&&(c=Fa(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Sm(i.after.charCodeAt(0),g,r);y.inside&&(c=c.slice(0,-1)+Fa(g));const b=o.move(r);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},u+c+b}function nL(t,e,n){return n.options.emphasis||"*"}const mg=(function(t){if(t==null)return aL;if(typeof t=="function")return gg(t);if(typeof t=="object")return Array.isArray(t)?iL(t):rL(t);if(typeof t=="string")return sL(t);throw new Error("Expected function, string, or object as test")});function iL(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=mg(t[n]);return gg(i);function i(...r){let s=-1;for(;++s<e.length;)if(e[s].apply(this,r))return!0;return!1}}function rL(t){const e=t;return gg(n);function n(i){const r=i;let s;for(s in t)if(r[s]!==e[s])return!1;return!0}}function sL(t){return gg(e);function e(n){return n&&n.type===t}}function gg(t){return e;function e(n,i,r){return!!(oL(n)&&t.call(this,n,typeof i=="number"?i:void 0,r||void 0))}}function aL(){return!0}function oL(t){return t!==null&&typeof t=="object"&&"type"in t}const IT=[],lL=!0,kx=!1,vx="skip";function Bu(t,e,n,i){let r;typeof e=="function"&&typeof n!="function"?(i=n,n=e):r=e;const s=mg(r),o=i?-1:1;u(t,void 0,[])();function u(c,h,m){const g=c&&typeof c=="object"?c:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(c.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=IT,v,E,T;if((!e||s(c,h,m[m.length-1]||void 0))&&(b=uL(n(c,m)),b[0]===kx))return b;if("children"in c&&c.children){const M=c;if(M.children&&b[0]!==vx)for(E=(i?M.children.length:-1)+o,T=m.concat(M);E>-1&&E<M.children.length;){const j=M.children[E];if(v=u(j,E,T)(),v[0]===kx)return v;E=typeof v[1]=="number"?v[1]:E+o}}return b}}}function uL(t){return Array.isArray(t)?t:typeof t=="number"?[lL,t]:t==null?IT:[t]}function cL(t,e,n,i){let r,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,r=n):(s=e,o=n,r=i),Bu(t,s,u,r);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function _T(t,e){let n=!1;return cL(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,kx}),!!((!t.depth||t.depth<3)&&qb(t)&&(e.options.setext||n))}function fL(t,e,n,i){const r=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(i);if(_T(t,n)){const m=n.enter("headingSetext"),g=n.enter("phrasing"),y=n.containerPhrasing(t,{...s.current(),before:`
11
- `,after:`
12
- `});return g(),m(),y+`
13
- `+(r===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
14
- `))+1))}const o="#".repeat(r),u=n.enter("headingAtx"),c=n.enter("phrasing");s.move(o+" ");let h=n.containerPhrasing(t,{before:"# ",after:`
15
- `,...s.current()});return/^[\t ]/.test(h)&&(h=Fa(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,n.options.closeAtx&&(h+=" "+o),c(),u(),h}zT.peek=hL;function zT(t){return t.value||""}function hL(){return"<"}LT.peek=pL;function LT(t,e,n,i){const r=Yb(n),s=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let u=n.enter("label");const c=n.createTracker(i);let h=c.move("![");return h+=c.move(n.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(u=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),u(),t.title&&(u=n.enter(`title${s}`),h+=c.move(" "+r),h+=c.move(n.safe(t.title,{before:h,after:r,...c.current()})),h+=c.move(r),u()),h+=c.move(")"),o(),h}function pL(){return"!"}BT.peek=dL;function BT(t,e,n,i){const r=t.referenceType,s=n.enter("imageReference");let o=n.enter("label");const u=n.createTracker(i);let c=u.move("![");const h=n.safe(t.alt,{before:c,after:"]",...u.current()});c+=u.move(h+"]["),o();const m=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return o(),n.stack=m,s(),r==="full"||!h||h!==g?c+=u.move(g+"]"):r==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function dL(){return"!"}VT.peek=mL;function VT(t,e,n){let i=t.value||"",r="`",s=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(i);)r+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++s<n.unsafe.length;){const o=n.unsafe[s],u=n.compilePattern(o);let c;if(o.atBreak)for(;c=u.exec(i);){let h=c.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(c.index+1)}}return r+i+r}function mL(){return"`"}function FT(t,e){const n=qb(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}PT.peek=gL;function PT(t,e,n,i){const r=Yb(n),s=r==='"'?"Quote":"Apostrophe",o=n.createTracker(i);let u,c;if(FT(t,n)){const m=n.stack;n.stack=[],u=n.enter("autolink");let g=o.move("<");return g+=o.move(n.containerPhrasing(t,{before:g,after:">",...o.current()})),g+=o.move(">"),u(),n.stack=m,g}u=n.enter("link"),c=n.enter("label");let h=o.move("[");return h+=o.move(n.containerPhrasing(t,{before:h,after:"](",...o.current()})),h+=o.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=o.move("<"),h+=o.move(n.safe(t.url,{before:h,after:">",...o.current()})),h+=o.move(">")):(c=n.enter("destinationRaw"),h+=o.move(n.safe(t.url,{before:h,after:t.title?" ":")",...o.current()}))),c(),t.title&&(c=n.enter(`title${s}`),h+=o.move(" "+r),h+=o.move(n.safe(t.title,{before:h,after:r,...o.current()})),h+=o.move(r),c()),h+=o.move(")"),u(),h}function gL(t,e,n){return FT(t,n)?"<":"["}jT.peek=yL;function jT(t,e,n,i){const r=t.referenceType,s=n.enter("linkReference");let o=n.enter("label");const u=n.createTracker(i);let c=u.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...u.current()});c+=u.move(h+"]["),o();const m=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return o(),n.stack=m,s(),r==="full"||!h||h!==g?c+=u.move(g+"]"):r==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function yL(){return"["}function Xb(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function xL(t){const e=Xb(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function bL(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function $T(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function SL(t,e,n,i){const r=n.enter("list"),s=n.bulletCurrent;let o=t.ordered?bL(n):Xb(n);const u=t.ordered?o==="."?")":".":xL(n);let c=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),$T(n)===o&&m){let g=-1;for(;++g<t.children.length;){const y=t.children[g];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=u),n.bulletCurrent=o;const h=n.containerFlow(t,i);return n.bulletLastUsed=o,n.bulletCurrent=s,r(),h}function kL(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function vL(t,e,n,i){const r=kL(n);let s=n.bulletCurrent||Xb(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(r==="tab"||r==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const u=n.createTracker(i);u.move(s+" ".repeat(o-s.length)),u.shift(o);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,u.current()),m);return c(),h;function m(g,y,b){return y?(b?"":" ".repeat(o))+g:(b?s:s+" ".repeat(o-s.length))+g}}function CL(t,e,n,i){const r=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,i);return s(),r(),o}const wL=mg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function EL(t,e,n,i){return(t.children.some(function(o){return wL(o)})?n.containerPhrasing:n.containerFlow).call(n,t,i)}function NL(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}UT.peek=AL;function UT(t,e,n,i){const r=NL(n),s=n.enter("strong"),o=n.createTracker(i),u=o.move(r+r);let c=o.move(n.containerPhrasing(t,{after:r,before:u,...o.current()}));const h=c.charCodeAt(0),m=Sm(i.before.charCodeAt(i.before.length-1),h,r);m.inside&&(c=Fa(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Sm(i.after.charCodeAt(0),g,r);y.inside&&(c=c.slice(0,-1)+Fa(g));const b=o.move(r+r);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},u+c+b}function AL(t,e,n){return n.options.strong||"*"}function TL(t,e,n,i){return n.safe(t.value,i)}function ML(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function OL(t,e,n){const i=($T(n)+(n.options.ruleSpaces?" ":"")).repeat(ML(n));return n.options.ruleSpaces?i.slice(0,-1):i}const Qb={blockquote:G5,break:nE,code:W5,definition:eL,emphasis:DT,hardBreak:nE,heading:fL,html:zT,image:LT,imageReference:BT,inlineCode:VT,link:PT,linkReference:jT,list:SL,listItem:vL,paragraph:CL,root:EL,strong:UT,text:TL,thematicBreak:OL},RL=[DL];function DL(t,e,n,i){if(e.type==="code"&&Sx(e,i)&&(t.type==="list"||t.type===e.type&&Sx(t,i)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&_T(e,i))?void 0:n.spread?1:0}const ko=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],IL=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
16
- `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ko},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
17
- ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ko},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
18
- *])`},{character:"*",inConstruct:"phrasing",notInConstruct:ko},{atBreak:!0,character:"+",after:`(?:[ \r
19
- ])`},{atBreak:!0,character:"-",after:`(?:[ \r
20
- -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
21
- ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ko},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ko},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ko},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ko},{atBreak:!0,character:"~"}];function _L(t){return t.label||!t.identifier?t.label||"":AT(t.identifier)}function zL(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function LL(t,e,n){const i=e.indexStack,r=t.children||[],s=[];let o=-1,u=n.before,c;i.push(-1);let h=e.createTracker(n);for(;++o<r.length;){const m=r[o];let g;if(i[i.length-1]=o,o+1<r.length){let v=e.handle.handlers[r[o+1].type];v&&v.peek&&(v=v.peek),g=v?v(r[o+1],t,e,{before:"",after:"",...h.current()}).charAt(0):""}else g=n.after;s.length>0&&(u==="\r"||u===`
22
- `)&&m.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),u=" ",h=e.createTracker(n),h.move(s.join("")));let y=e.handle(m,t,e,{...h.current(),after:g,before:u});c&&c===y.slice(0,1)&&(y=Fa(c.charCodeAt(0))+y.slice(1));const b=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,c=void 0,b&&(s.length>0&&b.before&&u===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Fa(u.charCodeAt(0))),b.after&&(c=g)),h.move(y),s.push(y),u=y.slice(-1)}return i.pop(),s.join("")}function BL(t,e,n){const i=e.indexStack,r=t.children||[],s=e.createTracker(n),o=[];let u=-1;for(i.push(-1);++u<r.length;){const c=r[u];i[i.length-1]=u,o.push(s.move(e.handle(c,t,e,{before:`
23
- `,after:`
24
- `,...s.current()}))),c.type!=="list"&&(e.bulletLastUsed=void 0),u<r.length-1&&o.push(s.move(VL(c,r[u+1],t,e)))}return i.pop(),o.join("")}function VL(t,e,n,i){let r=i.join.length;for(;r--;){const s=i.join[r](t,e,n,i);if(s===!0||s===1)break;if(typeof s=="number")return`
25
- `.repeat(1+s);if(s===!1)return`
26
-
27
- <!---->
28
-
29
- `}return`
30
-
31
- `}const FL=/\r?\n|\r/g;function PL(t,e){const n=[];let i=0,r=0,s;for(;s=FL.exec(t);)o(t.slice(i,s.index)),n.push(s[0]),i=s.index+s[0].length,r++;return o(t.slice(i)),n.join("");function o(u){n.push(e(u,r,!u))}}function jL(t,e,n){const i=(n.before||"")+(e||"")+(n.after||""),r=[],s=[],o={};let u=-1;for(;++u<t.unsafe.length;){const m=t.unsafe[u];if(!RT(t.stack,m))continue;const g=t.compilePattern(m);let y;for(;y=g.exec(i);){const b="before"in m||!!m.atBreak,v="after"in m,E=y.index+(b?y[1].length:0);r.includes(E)?(o[E].before&&!b&&(o[E].before=!1),o[E].after&&!v&&(o[E].after=!1)):(r.push(E),o[E]={before:b,after:v})}}r.sort($L);let c=n.before?n.before.length:0;const h=i.length-(n.after?n.after.length:0);for(u=-1;++u<r.length;){const m=r[u];m<c||m>=h||m+1<h&&r[u+1]===m+1&&o[m].after&&!o[m+1].before&&!o[m+1].after||r[u-1]===m-1&&o[m].before&&!o[m-1].before&&!o[m-1].after||(c!==m&&s.push(iE(i.slice(c,m),"\\")),c=m,/[!-/:-@[-`{-~]/.test(i.charAt(m))&&(!n.encode||!n.encode.includes(i.charAt(m)))?s.push("\\"):(s.push(Fa(i.charCodeAt(m))),c++))}return s.push(iE(i.slice(c,h),n.after)),s.join("")}function $L(t,e){return t-e}function iE(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,i=[],r=[],s=t+e;let o=-1,u=0,c;for(;c=n.exec(s);)i.push(c.index);for(;++o<i.length;)u!==i[o]&&r.push(t.slice(u,i[o])),r.push("\\"),u=i[o];return r.push(t.slice(u)),r.join("")}function UL(t){const e=t||{},n=e.now||{};let i=e.lineShift||0,r=n.line||1,s=n.column||1;return{move:c,current:o,shift:u};function o(){return{now:{line:r,column:s},lineShift:i}}function u(h){i+=h}function c(h){const m=h||"",g=m.split(/\r?\n|\r/g),y=g[g.length-1];return r+=g.length-1,s=g.length===1?s+y.length:1+y.length+i,m}}function JL(t,e){const n=e||{},i={associationId:_L,containerPhrasing:GL,containerFlow:YL,createTracker:UL,compilePattern:zL,enter:s,handlers:{...Qb},handle:void 0,indentLines:PL,indexStack:[],join:[...RL],options:{},safe:XL,stack:[],unsafe:[...IL]};OT(i,n),i.options.tightDefinitions&&i.join.push(KL),i.handle=H5("type",{invalid:HL,unknown:qL,handlers:i.handlers});let r=i.handle(t,void 0,i,{before:`
32
- `,after:`
33
- `,now:{line:1,column:1},lineShift:0});return r&&r.charCodeAt(r.length-1)!==10&&r.charCodeAt(r.length-1)!==13&&(r+=`
34
- `),r;function s(o){return i.stack.push(o),u;function u(){i.stack.pop()}}}function HL(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function qL(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function KL(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function GL(t,e){return LL(t,this,e)}function YL(t,e){return BL(t,this,e)}function XL(t,e){return jL(this,t,e)}function Cx(t){const e=this;e.compiler=n;function n(i){return JL(i,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function rE(t){if(t)throw t}var Wy,sE;function QL(){if(sE)return Wy;sE=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},s=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var m=t.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!g)return!1;var y;for(y in h);return typeof y>"u"||t.call(h,y)},o=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},u=function(h,m){if(m==="__proto__")if(t.call(h,m)){if(i)return i(h,m).value}else return;return h[m]};return Wy=function c(){var h,m,g,y,b,v,E=arguments[0],T=1,M=arguments.length,j=!1;for(typeof E=="boolean"&&(j=E,E=arguments[1]||{},T=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});T<M;++T)if(h=arguments[T],h!=null)for(m in h)g=u(E,m),y=u(h,m),E!==y&&(j&&y&&(s(y)||(b=r(y)))?(b?(b=!1,v=g&&r(g)?g:[]):v=g&&s(g)?g:{},o(E,{name:m,newValue:c(j,v,y)})):typeof y<"u"&&o(E,{name:m,newValue:y}));return E},Wy}var WL=QL();const Zy=uT(WL);function wx(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function ZL(){const t=[],e={run:n,use:i};return e;function n(...r){let s=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);u(null,...r);function u(c,...h){const m=t[++s];let g=-1;if(c){o(c);return}for(;++g<r.length;)(h[g]===null||h[g]===void 0)&&(h[g]=r[g]);r=h,m?e9(m,u)(...h):o(null,...h)}}function i(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return t.push(r),e}}function e9(t,e){let n;return i;function i(...o){const u=t.length>o.length;let c;u&&o.push(r);try{c=t.apply(this,o)}catch(h){const m=h;if(u&&n)throw m;return r(m)}u||(c&&c.then&&typeof c.then=="function"?c.then(s,r):c instanceof Error?r(c):s(c))}function r(o,...u){n||(n=!0,e(o,...u))}function s(o){r(null,o)}}class mt extends Error{constructor(e,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let r="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?r=e:!s.cause&&e&&(o=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof i=="string"){const c=i.indexOf(":");c===-1?s.ruleId=i:(s.source=i.slice(0,c),s.ruleId=i.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const u=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=u?u.line:void 0,this.name=Es(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}mt.prototype.file="";mt.prototype.name="";mt.prototype.reason="";mt.prototype.message="";mt.prototype.stack="";mt.prototype.column=void 0;mt.prototype.line=void 0;mt.prototype.ancestors=void 0;mt.prototype.cause=void 0;mt.prototype.fatal=void 0;mt.prototype.place=void 0;mt.prototype.ruleId=void 0;mt.prototype.source=void 0;const zr={basename:t9,dirname:n9,extname:i9,join:r9,sep:"/"};function t9(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ph(t);let n=0,i=-1,r=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;r--;)if(t.codePointAt(r)===47){if(s){n=r+1;break}}else i<0&&(s=!0,i=r+1);return i<0?"":t.slice(n,i)}if(e===t)return"";let o=-1,u=e.length-1;for(;r--;)if(t.codePointAt(r)===47){if(s){n=r+1;break}}else o<0&&(s=!0,o=r+1),u>-1&&(t.codePointAt(r)===e.codePointAt(u--)?u<0&&(i=r):(u=-1,i=o));return n===i?i=o:i<0&&(i=t.length),t.slice(n,i)}function n9(t){if(Ph(t),t.length===0)return".";let e=-1,n=t.length,i;for(;--n;)if(t.codePointAt(n)===47){if(i){e=n;break}}else i||(i=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function i9(t){Ph(t);let e=t.length,n=-1,i=0,r=-1,s=0,o;for(;e--;){const u=t.codePointAt(e);if(u===47){if(o){i=e+1;break}continue}n<0&&(o=!0,n=e+1),u===46?r<0?r=e:s!==1&&(s=1):r>-1&&(s=-1)}return r<0||n<0||s===0||s===1&&r===n-1&&r===i+1?"":t.slice(r,n)}function r9(...t){let e=-1,n;for(;++e<t.length;)Ph(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":s9(n)}function s9(t){Ph(t);const e=t.codePointAt(0)===47;let n=a9(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function a9(t,e){let n="",i=0,r=-1,s=0,o=-1,u,c;for(;++o<=t.length;){if(o<t.length)u=t.codePointAt(o);else{if(u===47)break;u=47}if(u===47){if(!(r===o-1||s===1))if(r!==o-1&&s===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",i=0):(n=n.slice(0,c),i=n.length-1-n.lastIndexOf("/")),r=o,s=0;continue}}else if(n.length>0){n="",i=0,r=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+t.slice(r+1,o):n=t.slice(r+1,o),i=o-r-1;r=o,s=0}else u===46&&s>-1?s++:s=-1}return n}function Ph(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const o9={cwd:l9};function l9(){return"/"}function Ex(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function u9(t){if(typeof t=="string")t=new URL(t);else if(!Ex(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return c9(t)}function c9(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const i=e.codePointAt(n+2);if(i===70||i===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(e)}const e1=["history","path","basename","stem","extname","dirname"];class f9{constructor(e){let n;e?Ex(e)?n={path:e}:typeof e=="string"||h9(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":o9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<e1.length;){const s=e1[i];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let r;for(r in n)e1.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?zr.basename(this.path):void 0}set basename(e){n1(e,"basename"),t1(e,"basename"),this.path=zr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?zr.dirname(this.path):void 0}set dirname(e){aE(this.basename,"dirname"),this.path=zr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?zr.extname(this.path):void 0}set extname(e){if(t1(e,"extname"),aE(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Ex(e)&&(e=u9(e)),n1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?zr.basename(this.path,this.extname):void 0}set stem(e){n1(e,"stem"),t1(e,"stem"),this.path=zr.join(this.dirname||"",e+(this.extname||""))}fail(e,n,i){const r=this.message(e,n,i);throw r.fatal=!0,r}info(e,n,i){const r=this.message(e,n,i);return r.fatal=void 0,r}message(e,n,i){const r=new mt(e,n,i);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function t1(t,e){if(t&&t.includes(zr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+zr.sep+"`")}function n1(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function aE(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function h9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const p9=(function(t){const i=this.constructor.prototype,r=i[t],s=function(){return r.apply(s,arguments)};return Object.setPrototypeOf(s,i),s}),d9={}.hasOwnProperty;class Wb extends p9{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ZL()}copy(){const e=new Wb;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];e.use(...i)}return e.data(Zy(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(s1("data",this.frozen),this.namespace[e]=n,this):d9.call(this.namespace,e)&&this.namespace[e]||void 0:e?(s1("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const r=n.call(e,...i);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Ad(e),i=this.parser||this.Parser;return i1("parse",i),i(String(n),n)}process(e,n){const i=this;return this.freeze(),i1("process",this.parser||this.Parser),r1("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(s,o){const u=Ad(e),c=i.parse(u);i.run(c,u,function(m,g,y){if(m||!g||!y)return h(m);const b=g,v=i.stringify(b,y);g9(v)?y.value=v:y.result=v,h(m,y)});function h(m,g){m||!g?o(m):s?s(g):n(void 0,g)}}}processSync(e){let n=!1,i;return this.freeze(),i1("processSync",this.parser||this.Parser),r1("processSync",this.compiler||this.Compiler),this.process(e,r),lE("processSync","process",n),i;function r(s,o){n=!0,rE(s),i=o}}run(e,n,i){oE(e),this.freeze();const r=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?s(void 0,i):new Promise(s);function s(o,u){const c=Ad(n);r.run(e,c,h);function h(m,g,y){const b=g||e;m?u(m):o?o(b):i(void 0,b,y)}}}runSync(e,n){let i=!1,r;return this.run(e,n,s),lE("runSync","run",i),r;function s(o,u){rE(o),r=u,i=!0}}stringify(e,n){this.freeze();const i=Ad(n),r=this.compiler||this.Compiler;return r1("stringify",r),oE(e),r(e,i)}use(e,...n){const i=this.attachers,r=this.namespace;if(s1("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?u(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(h){if(typeof h=="function")c(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[m,...g]=h;c(m,g)}else o(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function o(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(h.plugins),h.settings&&(r.settings=Zy(!0,r.settings,h.settings))}function u(h){let m=-1;if(h!=null)if(Array.isArray(h))for(;++m<h.length;){const g=h[m];s(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function c(h,m){let g=-1,y=-1;for(;++g<i.length;)if(i[g][0]===h){y=g;break}if(y===-1)i.push([h,...m]);else if(m.length>0){let[b,...v]=m;const E=i[y][1];wx(E)&&wx(b)&&(b=Zy(!0,E,b)),i[y]=[h,b,...v]}}}}const km=new Wb().freeze();function i1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function r1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function s1(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function oE(t){if(!wx(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function lE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ad(t){return m9(t)?t:new f9(t)}function m9(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function g9(t){return typeof t=="string"||y9(t)}function y9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function fn(t){this.content=t}fn.prototype={constructor:fn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var i=n&&n!=t?this.remove(n):this,r=i.find(t),s=i.content.slice();return r==-1?s.push(n||t,e):(s[r+1]=e,n&&(s[r]=n)),new fn(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new fn(n)},addToStart:function(t,e){return new fn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new fn(n)},addBefore:function(t,e,n){var i=this.remove(e),r=i.content.slice(),s=i.find(t);return r.splice(s==-1?r.length:s,0,e,n),new fn(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=fn.from(t),t.size?new fn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=fn.from(t),t.size?new fn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=fn.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};fn.from=function(t){if(t instanceof fn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new fn(e)};function JT(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(i),s=e.child(i);if(r==s){n+=r.nodeSize;continue}if(!r.sameMarkup(s))return n;if(r.isText&&r.text!=s.text){for(let o=0;r.text[o]==s.text[o];o++)n++;return n}if(r.content.size||s.content.size){let o=JT(r.content,s.content,n+1);if(o!=null)return o}n+=r.nodeSize}}function HT(t,e,n,i){for(let r=t.childCount,s=e.childCount;;){if(r==0||s==0)return r==s?null:{a:n,b:i};let o=t.child(--r),u=e.child(--s),c=o.nodeSize;if(o==u){n-=c,i-=c;continue}if(!o.sameMarkup(u))return{a:n,b:i};if(o.isText&&o.text!=u.text){let h=0,m=Math.min(o.text.length,u.text.length);for(;h<m&&o.text[o.text.length-h-1]==u.text[u.text.length-h-1];)h++,n--,i--;return{a:n,b:i}}if(o.content.size||u.content.size){let h=HT(o.content,u.content,n-1,i-1);if(h)return h}n-=c,i-=c}}class G{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,s){for(let o=0,u=0;u<n;o++){let c=this.content[o],h=u+c.nodeSize;if(h>e&&i(c,r+u,s||null,o)!==!1&&c.content.size){let m=u+1;c.nodesBetween(Math.max(0,e-m),Math.min(c.content.size,n-m),i,r+m)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,r){let s="",o=!0;return this.nodesBetween(e,n,(u,c)=>{let h=u.isText?u.text.slice(Math.max(e,c)-c,n-c):u.isLeaf?r?typeof r=="function"?r(u):r:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&h||u.isTextblock)&&i&&(o?o=!1:s+=i),s+=h},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),s=1);s<e.content.length;s++)r.push(e.content[s]);return new G(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let s=0,o=0;o<n;s++){let u=this.content[s],c=o+u.nodeSize;c>e&&((o<e||c>n)&&(u.isText?u=u.cut(Math.max(0,e-o),Math.min(u.text.length,n-o)):u=u.cut(Math.max(0,e-o-1),Math.min(u.content.size,n-o-1))),i.push(u),r+=u.nodeSize),o=c}return new G(i,r)}cutByIndex(e,n){return e==n?G.empty:e==0&&n==this.content.length?this:new G(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),s=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new G(r,s)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return JT(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return HT(this,e,n,i)}findIndex(e){if(e==0)return Td(0,e);if(e==this.size)return Td(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let r=this.child(n),s=i+r.nodeSize;if(s>=e)return s==e?Td(n+1,s):Td(n,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return G.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new G(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let n,i=0;for(let r=0;r<e.length;r++){let s=e[r];i+=s.nodeSize,r&&s.isText&&e[r-1].sameMarkup(s)?(n||(n=e.slice(0,r)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new G(n||e,i)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const a1={index:0,offset:0};function Td(t,e){return a1.index=t,a1.offset=e,a1}function vm(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!vm(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!vm(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}class ut{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,r));else{if(s.type.excludes(this.type))return e;!i&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),i=!0),n&&n.push(s)}}return n||(n=e.slice()),i||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&vm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=i.create(n.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ut.none;if(e instanceof ut)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}}ut.none=[];class wr extends Error{}class H{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=KT(this.content,e+this.openStart,n);return i&&new H(i,this.openStart,this.openEnd)}removeBetween(e,n){return new H(qT(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return H.empty;let i=n.openStart||0,r=n.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(G.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)i++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)r++;return new H(e,i,r)}}H.empty=new H(G.empty,0,0);function qT(t,e,n){let{index:i,offset:r}=t.findIndex(e),s=t.maybeChild(i),{index:o,offset:u}=t.findIndex(n);if(r==e||s.isText){if(u!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(qT(s.content,e-r-1,n-r-1)))}function KT(t,e,n,i){let{index:r,offset:s}=t.findIndex(e),o=t.maybeChild(r);if(s==e||o.isText)return i&&!i.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=KT(o.content,e-s-1,n,o);return u&&t.replaceChild(r,o.copy(u))}function x9(t,e,n){if(n.openStart>t.depth)throw new wr("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new wr("Inconsistent open depths");return GT(t,e,n,0)}function GT(t,e,n,i){let r=t.index(i),s=t.node(i);if(r==e.index(i)&&i<t.depth-n.openStart){let o=GT(t,e,n,i+1);return s.copy(s.content.replaceChild(r,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let o=t.parent,u=o.content;return Fo(o,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:o,end:u}=b9(n,t);return Fo(s,XT(t,o,u,e,i))}else return Fo(s,Cm(t,e,i))}function YT(t,e){if(!e.type.compatibleContent(t.type))throw new wr("Cannot join "+e.type.name+" onto "+t.type.name)}function Nx(t,e,n){let i=t.node(n);return YT(i,e.node(n)),i}function Vo(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Vf(t,e,n,i){let r=(e||t).node(n),s=0,o=e?e.index(n):r.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Vo(t.nodeAfter,i),s++));for(let u=s;u<o;u++)Vo(r.child(u),i);e&&e.depth==n&&e.textOffset&&Vo(e.nodeBefore,i)}function Fo(t,e){return t.type.checkContent(e),t.copy(e)}function XT(t,e,n,i,r){let s=t.depth>r&&Nx(t,e,r+1),o=i.depth>r&&Nx(n,i,r+1),u=[];return Vf(null,t,r,u),s&&o&&e.index(r)==n.index(r)?(YT(s,o),Vo(Fo(s,XT(t,e,n,i,r+1)),u)):(s&&Vo(Fo(s,Cm(t,e,r+1)),u),Vf(e,n,r,u),o&&Vo(Fo(o,Cm(n,i,r+1)),u)),Vf(i,null,r,u),new G(u)}function Cm(t,e,n){let i=[];if(Vf(null,t,n,i),t.depth>n){let r=Nx(t,e,n+1);Vo(Fo(r,Cm(t,e,n+1)),i)}return Vf(e,null,n,i),new G(i)}function b9(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)r=e.node(s).copy(G.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class lh{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)r+=i.child(s).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ut.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),r=e.maybeChild(n);if(!i){let u=i;i=r,r=u}let s=i.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!r||!s[o].isInSet(r.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,r=e.parent.maybeChild(e.index());for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new QT(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let i=[],r=0,s=n;for(let o=e;;){let{index:u,offset:c}=o.content.findIndex(s),h=s-c;if(i.push(o,u,r+c),!h||(o=o.child(u),o.isText))break;s=h-1,r+=c+1}return new lh(n,i,s)}static resolveCached(e,n){let i=uE.get(e);if(i)for(let s=0;s<i.elts.length;s++){let o=i.elts[s];if(o.pos==n)return o}else uE.set(e,i=new S9);let r=i.elts[i.i]=lh.resolve(e,n);return i.i=(i.i+1)%k9,r}}class S9{constructor(){this.elts=[],this.i=0}}const k9=12,uE=new WeakMap;class QT{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const v9=Object.create(null);let As=class Ax{constructor(e,n,i,r=ut.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||G.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&vm(this.attrs,n||e.defaultAttrs||v9)&&ut.sameSet(this.marks,i||ut.none)}copy(e=null){return e==this.content?this:new Ax(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ax(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,i=!1){if(e==n)return H.empty;let r=this.resolve(e),s=this.resolve(n),o=i?0:r.sharedDepth(n),u=r.start(o),h=r.node(o).content.cut(r.pos-u,s.pos-u);return new H(h,r.depth-o,s.depth-o)}replace(e,n,i){return x9(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let r=this.content.child(n-1);return{node:r,index:n-1,offset:i-r.nodeSize}}resolve(e){return lh.resolveCached(this,e)}resolveNoCache(e){return lh.resolve(this,e)}rangeHasMark(e,n,i){let r=!1;return n>e&&this.nodesBetween(e,n,s=>(i.isInSet(s.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),WT(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=G.empty,r=0,s=i.childCount){let o=this.contentMatchAt(e).matchFragment(i,r,s),u=o&&o.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let c=r;c<s;c++)if(!this.type.allowsMarks(i.child(c).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let s=this.contentMatchAt(e).matchType(i),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ut.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!ut.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=G.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,r,i);return s.type.checkAttrs(s.attrs),s}};As.prototype.text=void 0;class wm extends As{constructor(e,n,i,r){if(super(e,n,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):WT(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new wm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new wm(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function WT(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new C9(e,n);if(i.next==null)return Wo.empty;let r=ZT(i);i.next&&i.err("Unexpected trailing text");let s=O9(M9(r));return R9(s,i),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let s=n;r&&s<i;s++)r=r.matchType(e.child(s).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function s(o,u){let c=o.matchFragment(e,i);if(c&&(!n||c.validEnd))return G.from(u.map(h=>h.createAndFill()));for(let h=0;h<o.next.length;h++){let{type:m,next:g}=o.next[h];if(!(m.isText||m.hasRequiredAttrs())&&r.indexOf(g)==-1){r.push(g);let y=s(g,u.concat(m));if(y)return y}}return null}return s(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),s=r.match;if(s.matchType(e)){let o=[];for(let u=r;u.type;u=u.via)o.push(u.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:u,next:c}=s.next[o];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in n)&&(!r.type||c.validEnd)&&(i.push({match:u.contentMatch,type:u,via:r}),n[u.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&n(i.next[r].next)}return n(this),e.map((i,r)=>{let s=r+(i.validEnd?"*":" ")+" ";for(let o=0;o<i.next.length;o++)s+=(o?", ":"")+i.next[o].type.name+"->"+e.indexOf(i.next[o].next);return s}).join(`
35
- `)}}Wo.empty=new Wo(!0);class C9{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function ZT(t){let e=[];do e.push(w9(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function w9(t){let e=[];do e.push(E9(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function E9(t){let e=T9(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=N9(t,e);else break;return e}function cE(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function N9(t,e){let n=cE(t),i=n;return t.eat(",")&&(t.next!="}"?i=cE(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function A9(t,e){let n=t.nodeTypes,i=n[e];if(i)return[i];let r=[];for(let s in n){let o=n[s];o.isInGroup(e)&&r.push(o)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function T9(t){if(t.eat("(")){let e=ZT(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=A9(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function M9(t){let e=[[]];return r(s(t,0),n()),e;function n(){return e.push([])-1}function i(o,u,c){let h={term:c,to:u};return e[o].push(h),h}function r(o,u){o.forEach(c=>c.to=u)}function s(o,u){if(o.type=="choice")return o.exprs.reduce((c,h)=>c.concat(s(h,u)),[]);if(o.type=="seq")for(let c=0;;c++){let h=s(o.exprs[c],u);if(c==o.exprs.length-1)return h;r(h,u=n())}else if(o.type=="star"){let c=n();return i(u,c),r(s(o.expr,c),c),[i(c)]}else if(o.type=="plus"){let c=n();return r(s(o.expr,u),c),r(s(o.expr,c),c),[i(c)]}else{if(o.type=="opt")return[i(u)].concat(s(o.expr,u));if(o.type=="range"){let c=u;for(let h=0;h<o.min;h++){let m=n();r(s(o.expr,c),m),c=m}if(o.max==-1)r(s(o.expr,c),c);else for(let h=o.min;h<o.max;h++){let m=n();i(c,m),r(s(o.expr,c),m),c=m}return[i(c)]}else{if(o.type=="name")return[i(u,void 0,o.value)];throw new Error("Unknown expr type")}}}}function eM(t,e){return e-t}function fE(t,e){let n=[];return i(e),n.sort(eM);function i(r){let s=t[r];if(s.length==1&&!s[0].term)return i(s[0].to);n.push(r);for(let o=0;o<s.length;o++){let{term:u,to:c}=s[o];!u&&n.indexOf(c)==-1&&i(c)}}}function O9(t){let e=Object.create(null);return n(fE(t,0));function n(i){let r=[];i.forEach(o=>{t[o].forEach(({term:u,to:c})=>{if(!u)return;let h;for(let m=0;m<r.length;m++)r[m][0]==u&&(h=r[m][1]);fE(t,c).forEach(m=>{h||r.push([u,h=[]]),h.indexOf(m)==-1&&h.push(m)})})});let s=e[i.join(",")]=new Wo(i.indexOf(t.length-1)>-1);for(let o=0;o<r.length;o++){let u=r[o][1].sort(eM);s.next.push({type:r[o][0],next:e[u.join(",")]||n(u)})}return s}}function R9(t,e){for(let n=0,i=[t];n<i.length;n++){let r=i[n],s=!r.validEnd,o=[];for(let u=0;u<r.next.length;u++){let{type:c,next:h}=r.next[u];o.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),i.indexOf(h)==-1&&i.push(h)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function tM(t){let e=Object.create(null);for(let n in t){let i=t[n];if(!i.hasDefault)return null;e[n]=i.default}return e}function nM(t,e){let n=Object.create(null);for(let i in t){let r=e&&e[i];if(r===void 0){let s=t[i];if(s.hasDefault)r=s.default;else throw new RangeError("No value supplied for attribute "+i)}n[i]=r}return n}function iM(t,e,n,i){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let s=t[r];s.validate&&s.validate(e[r])}}function rM(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new I9(t,i,e[i]);return n}let Em=class sM{constructor(e,n,i){this.name=e,this.schema=n,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=rM(e,i.attrs),this.defaultAttrs=tM(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Wo.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:nM(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new As(this,this.computeAttrs(e),G.from(n),ut.setFrom(i))}createChecked(e=null,n,i){return n=G.from(n),this.checkContent(n),new As(this,this.computeAttrs(e),n,ut.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=G.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let r=this.contentMatch.matchFragment(n),s=r&&r.fillBefore(G.empty,!0);return s?new As(this,e,n.append(s),ut.setFrom(i)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){iM(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?n&&n.push(e[i]):n||(n=e.slice(0,i));return n?n.length?n:ut.none:e}static compile(e,n){let i=Object.create(null);e.forEach((s,o)=>i[s]=new sM(s,n,o));let r=n.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let s in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function D9(t,e,n){let i=n.split("|");return r=>{let s=r===null?"null":typeof r;if(i.indexOf(s)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${s}`)}}class I9{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?D9(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class jh{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=rM(e,r.attrs),this.excluded=null;let s=tM(this.attrs);this.instance=s?new ut(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ut(this,nM(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((s,o)=>i[s]=new jh(s,r++,n,o)),i}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){iM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class _9{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=fn.from(e.nodes),n.marks=fn.from(e.marks||{}),this.nodes=Em.compile(this.spec.nodes,this),this.marks=jh.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let s=this.nodes[r],o=s.spec.content||"",u=s.spec.marks;if(s.contentMatch=i[o]||(i[o]=Wo.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=u=="_"?null:u?hE(this,u.split(" ")):u==""||!s.inlineContent?[]:null}for(let r in this.marks){let s=this.marks[r],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:hE(this,o.split(" "))}this.nodeFromJSON=r=>As.fromJSON(this,r),this.markFromJSON=r=>ut.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,i,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Em){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,i,r)}text(e,n){let i=this.nodes.text;return new wm(i,i.defaultAttrs,e,ut.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function hE(t,e){let n=[];for(let i=0;i<e.length;i++){let r=e[i],s=t.marks[r],o=s;if(s)n.push(s);else for(let u in t.marks){let c=t.marks[u];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return n}function z9(t){return t.tag!=null}function L9(t){return t.style!=null}class Pa{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(z9(r))this.tags.push(r);else if(L9(r)){let s=/[^=]*/.exec(r.style)[0];i.indexOf(s)<0&&i.push(s),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let s=e.nodes[r.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let i=new dE(this,n,!1);return i.addAll(e,ut.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new dE(this,n,!0);return i.addAll(e,ut.none,n.from,n.to),H.maxOpen(i.finish())}matchTag(e,n,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let s=this.tags[r];if(F9(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,i,r){for(let s=r?this.styles.indexOf(r)+1:0;s<this.styles.length;s++){let o=this.styles[s],u=o.style;if(!(u.indexOf(e)!=0||o.context&&!i.matchesContext(o.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=n))){if(o.getAttrs){let c=o.getAttrs(n);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let n=[];function i(r){let s=r.priority==null?50:r.priority,o=0;for(;o<n.length;o++){let u=n[o];if((u.priority==null?50:u.priority)<s)break}n.splice(o,0,r)}for(let r in e.marks){let s=e.marks[r].spec.parseDOM;s&&s.forEach(o=>{i(o=mE(o)),o.mark||o.ignore||o.clearMark||(o.mark=r)})}for(let r in e.nodes){let s=e.nodes[r].spec.parseDOM;s&&s.forEach(o=>{i(o=mE(o)),o.node||o.ignore||o.mark||(o.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Pa(e,Pa.schemaRules(e)))}}const aM={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},B9={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oM={ol:!0,ul:!0},uh=1,Tx=2,Ff=4;function pE(t,e,n){return e!=null?(e?uh:0)|(e==="full"?Tx:0):t&&t.whitespace=="pre"?uh|Tx:n&~Ff}class Md{constructor(e,n,i,r,s,o){this.type=e,this.attrs=n,this.marks=i,this.solid=r,this.options=o,this.content=[],this.activeMarks=ut.none,this.match=s||(o&Ff?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(G.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&uh)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let s=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-r[0].length))}}let n=G.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!aM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class dE{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let r=n.topNode,s,o=pE(null,n.preserveWhitespace,0)|(i?Ff:0);r?s=new Md(r.type,r.attrs,ut.none,!0,n.topMatch||r.type.contentMatch,o):i?s=new Md(null,null,ut.none,!0,null,o):s=new Md(e.schema.topNodeType,null,ut.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let i=e.nodeValue,r=this.top,s=r.options&Tx?"full":this.localPreserveWS||(r.options&uh)>0,{schema:o}=this.parser;if(s==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(s)if(s==="full")i=i.replace(/\r\n?/g,`
36
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(o.linebreakReplacement.create())){let u=i.split(/\r?\n|\r/);for(let c=0;c<u.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),n,!0),u[c]&&this.insertNode(o.text(u[c]),n,!/\S/.test(u[c]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let u=r.content[r.content.length-1],c=e.previousSibling;(!u||c&&c.nodeName=="BR"||u.isText&&/[ \t\r\n\u000c]$/.test(u.text))&&(i=i.slice(1))}i&&this.insertNode(o.text(i),n,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,n,i){let r=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),u;oM.hasOwnProperty(o)&&this.parser.normalizeLists&&V9(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,i));e:if(c?c.ignore:B9.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let h,m=this.needsBlock;if(aM.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),h=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let g=c&&c.skip?n:this.readStyles(e,n);g&&this.addAll(e,g),h&&this.sync(s),this.needsBlock=m}else{let h=this.readStyles(e,n);h&&this.addElementByRule(e,c,h,c.consuming===!1?u:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
37
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let i=e.style;if(i&&i.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let s=this.parser.matchedStyles[r],o=i.getPropertyValue(s);if(o)for(let u=void 0;;){let c=this.parser.matchStyle(s,o,this,u);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(h=>!c.clearMark(h)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)u=c;else break}}return n}addElementByRule(e,n,i,r){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let c=this.enter(o,n.attrs||null,i,n.preserveWhitespace);c&&(s=!0,i=c)}else{let c=this.parser.schema.marks[n.mark];i=i.concat(c.create(n.attrs))}let u=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,i,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,i),this.findAround(e,c,!1)}s&&this.sync(u)&&this.open--}addAll(e,n,i,r){let s=i||0;for(let o=i?e.childNodes[i]:e.firstChild,u=r==null?null:e.childNodes[r];o!=u;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,i){let r,s;for(let o=this.open,u=0;o>=0;o--){let c=this.nodes[o],h=c.findWrapping(e);if(h&&(!r||r.length>h.length+u)&&(r=h,s=c,!h.length))break;if(c.solid){if(i)break;u+=2}}if(!r)return null;this.sync(s);for(let o=0;o<r.length;o++)n=this.enterInner(r[o],null,n,!1);return n}insertNode(e,n,i){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let r=this.findPlace(e,n,i);if(r){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=ut.none;for(let u of r.concat(e.marks))(s.type?s.type.allowsMarkType(u.type):gE(u.type,e.type))&&(o=u.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,i,r){let s=this.findPlace(e.create(n),i,!1);return s&&(s=this.enterInner(e,n,i,!0,r)),s}enterInner(e,n,i,r=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let u=pE(e,s,o.options);o.options&Ff&&o.content.length==0&&(u|=Ff);let c=ut.none;return i=i.filter(h=>(o.type?o.type.allowsMarkType(h.type):gE(h.type,e))?(c=h.addToSet(c),!1):!0),this.nodes.push(new Md(e,n,c,r,null,u)),this.open++,i}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=uh)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let i=this.nodes[n].content;for(let r=i.length-1;r>=0;r--)e+=i[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==n&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,i){if(e!=n&&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)&&n.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),i=this.options.context,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),s=-(i?i.depth+1:0)+(r?0:1),o=(u,c)=>{for(;u>=0;u--){let h=n[u];if(h==""){if(u==n.length-1||u==0)continue;for(;c>=s;c--)if(o(u-1,c))return!0;return!1}else{let m=c>0||c==0&&r?this.nodes[c].type:i&&c>=s?i.node(c-s).type:null;if(!m||m.name!=h&&!m.isInGroup(h))return!1;c--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let n in this.parser.schema.nodes){let i=this.parser.schema.nodes[n];if(i.isTextblock&&i.defaultAttrs)return i}}}function V9(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&oM.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function F9(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function mE(t){let e={};for(let n in t)e[n]=t[n];return e}function gE(t,e){let n=e.schema.nodes;for(let i in n){let r=n[i];if(!r.allowsMarkType(t))continue;let s=[],o=u=>{s.push(u);for(let c=0;c<u.edgeCount;c++){let{type:h,next:m}=u.edge(c);if(h==e||s.indexOf(m)<0&&o(m))return!0}};if(o(r.contentMatch))return!0}}class qr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=o1(n).createDocumentFragment());let r=i,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let u=0,c=0;for(;u<s.length&&c<o.marks.length;){let h=o.marks[c];if(!this.marks[h.type.name]){c++;continue}if(!h.eq(s[u][0])||h.type.spec.spanning===!1)break;u++,c++}for(;u<s.length;)r=s.pop()[1];for(;c<o.marks.length;){let h=o.marks[c++],m=this.serializeMark(h,o.isInline,n);m&&(s.push([h,r]),r.appendChild(m.dom),r=m.contentDOM||m.dom)}}r.appendChild(this.serializeNodeInner(o,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=Ld(o1(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return i}serializeNode(e,n={}){let i=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let s=this.serializeMark(e.marks[r],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(i),i=s.dom)}return i}serializeMark(e,n,i={}){let r=this.marks[e.type.name];return r&&Ld(o1(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return Ld(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new qr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=yE(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return yE(e.marks)}}function yE(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function o1(t){return t.document||window.document}const xE=new WeakMap;function P9(t){let e=xE.get(t);return e===void 0&&xE.set(t,e=j9(t)),e}function j9(t){let e=null;function n(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let r=0;r<i.length;r++)n(i[r]);else for(let r in i)n(i[r])}return n(t),e}function Ld(t,e,n,i){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 r=e[0],s;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(s=P9(i))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));let u,c=n?t.createElementNS(n,r):t.createElement(r),h=e[1],m=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){m=2;for(let g in h)if(h[g]!=null){let y=g.indexOf(" ");y>0?c.setAttributeNS(g.slice(0,y),g.slice(y+1),h[g]):g=="style"&&c.style?c.style.cssText=h[g]:c.setAttribute(g,h[g])}}for(let g=m;g<e.length;g++){let y=e[g];if(y===0){if(g<e.length-1||g>m)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:b,contentDOM:v}=Ld(t,y,n,i);if(c.appendChild(b),v){if(u)throw new RangeError("Multiple content holes");u=v}}}return{dom:c,contentDOM:u}}const lM=65535,uM=Math.pow(2,16);function $9(t,e){return t+e*uM}function bE(t){return t&lM}function U9(t){return(t-(t&lM))/uM}const cM=1,fM=2,Bd=4,hM=8;let SE=class{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&hM)>0}get deletedBefore(){return(this.delInfo&(cM|Bd))>0}get deletedAfter(){return(this.delInfo&(fM|Bd))>0}get deletedAcross(){return(this.delInfo&Bd)>0}},Zo=class su{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&su.empty)return su.empty}recover(e){let n=0,i=bE(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+U9(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:$9(u/3,e-c),E=e==c?fM:e==g?cM:Bd;return(n<0?e!=c:e!=g)&&(E|=hM),new SE(b,E,v)}r+=m-h}return i?e+r:new SE(e+r,0,null)}touches(e,n){let i=0,r=bE(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new su(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?su.empty:new su(e<0?[0,-e,0]:[0,0,e])}};Zo.empty=new Zo([]);const l1=Object.create(null);let vn=class{getMap(){return Zo.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=l1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in l1)throw new RangeError("Duplicate use of step JSON ID "+e);return l1[e]=n,n.prototype.jsonID=e,n}},Vn=class Qc{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Qc(e,null)}static fail(e){return new Qc(null,e)}static fromReplace(e,n,i,r){try{return Qc.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return Qc.fail(s.message);throw s}}};function Zb(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(Zb(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}let pM=class Wc extends vn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(Zb(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,s)}invert(){return new dM(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Wc(n.pos,i.pos,this.mark)}merge(e){return e instanceof Wc&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Wc(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Wc(n.from,n.to,e.markFromJSON(n.mark))}};vn.jsonID("addMark",pM);let dM=class Zc extends vn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(Zb(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,i)}invert(){return new pM(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Zc(n.pos,i.pos,this.mark)}merge(e){return e instanceof Zc&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zc(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Zc(n.from,n.to,e.markFromJSON(n.mark))}};vn.jsonID("removeMark",dM);let mM=class ef extends vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new ef(this.pos,n.marks[r]);return new ef(this.pos,this.mark)}}return new gM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ef(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ef(n.pos,e.markFromJSON(n.mark))}};vn.jsonID("addNodeMark",mM);let gM=class Mx extends vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Vn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new mM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Mx(n.pos,e.markFromJSON(n.mark))}};vn.jsonID("removeNodeMark",gM);let yg=class Co extends vn{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Ox(e,this.from,this.to)?Vn.fail("Structure replace would overwrite content"):Vn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Zo([this.from,this.to-this.from,this.slice.size])}invert(e){return new Co(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Co(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Co)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Co(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Co(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Co(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};vn.jsonID("replace",yg);let Nm=class Vd extends vn{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Ox(e,this.from,this.gapFrom)||Ox(e,this.gapTo,this.to)))return Vn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Vn.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?Vn.fromReplace(e,this.from,this.to,i):Vn.fail("Content does not fit in gap")}getMap(){return new Zo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Vd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new Vd(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Vd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};vn.jsonID("replaceAround",Nm);function Ox(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function J9(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function eS(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth,r=0,s=0;;--i){let o=t.$from.node(i),u=t.$from.index(i)+r,c=t.$to.indexAfter(i)-s;if(i<t.depth&&o.canReplace(u,c,n))return i;if(i==0||o.type.spec.isolating||!J9(o,u,c))break;u&&(r=1),c<o.childCount&&(s=1)}return null}function H9(t,e,n=null,i=t){let r=q9(t,e),s=r&&K9(i,e);return s?r.map(kE).concat({type:e,attrs:n}).concat(s.map(kE)):null}function kE(t){return{type:t,attrs:null}}function q9(t,e){let{parent:n,startIndex:i,endIndex:r}=t,s=n.contentMatchAt(i).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(i,r,o)?s:null}function K9(t,e){let{parent:n,startIndex:i,endIndex:r}=t,s=n.child(i),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=i;c&&h<r;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}function Fd(t,e,n=1,i){let r=t.resolve(e),s=r.depth-n,o=i&&i[i.length-1]||r.parent;if(s<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!o.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let h=r.depth-1,m=n-2;h>s;h--,m--){let g=r.node(h),y=r.index(h);if(g.type.spec.isolating)return!1;let b=g.content.cutByIndex(y,g.childCount),v=i&&i[m+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let E=i&&i[m]||g;if(!g.canReplace(y+1,g.childCount)||!E.type.validContent(b))return!1}let u=r.indexAfter(s),c=i&&i[0];return r.node(s).canReplaceWith(u,u,c?c.type:r.node(s+1).type)}function yM(t,e){let n=t.resolve(e),i=n.index();return Y9(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function G9(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:i}=t.type.schema;for(let r=0;r<e.childCount;r++){let s=e.child(r),o=s.type==i?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Y9(t,e){return!!(t&&e&&!t.isLeaf&&G9(t,e))}function tS(t,e,n=e,i=H.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),s=t.resolve(n);return X9(r,s,i)?new yg(e,n,i):new Q9(r,s,i).fit()}function X9(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let Q9=class{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=G.empty;for(let r=0;r<=e.depth;r++){let s=e.node(r);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=G.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,i=this.$from,r=this.close(e<0?this.$to:i.doc.resolve(e));if(!r)return null;let s=this.placed,o=i.depth,u=r.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new Nm(i.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||i.pos!=this.$to.pos?new yg(i.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let s=n.firstChild;if(n.childCount>1&&(r=0),s.type.spec.isolating&&r<=i){e=i;break}n=s.content}for(let n=1;n<=2;n++)for(let i=n==1?e:this.unplaced.openStart;i>=0;i--){let r,s=null;i?(s=u1(this.unplaced.content,i-1).firstChild,r=s.content):r=this.unplaced.content;let o=r.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],m,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(G.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:i,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(m=h.findWrapping(o.type)))return{sliceDepth:i,frontierDepth:u,parent:s,wrap:m};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=u1(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(i,r.size+n>=e.size-i?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=u1(e,n);if(r.childCount<=1&&n>0){let s=e.size-n<=n+r.size;this.unplaced=new H(tf(e,n-1,1),n-1,s?n-1:i)}else this.unplaced=new H(tf(e,n,1),n,i)}placeNodes({sliceDepth:e,frontierDepth:n,parent:i,inject:r,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let E=0;E<s.length;E++)this.openFrontierNode(s[E]);let o=this.unplaced,u=i?i.content:o.content,c=o.openStart-e,h=0,m=[],{match:g,type:y}=this.frontier[n];if(r){for(let E=0;E<r.childCount;E++)m.push(r.child(E));g=g.matchFragment(r)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let E=u.child(h),T=g.matchType(E.type);if(!T)break;h++,(h>1||c==0||E.content.size)&&(g=T,m.push(xM(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?b:-1)))}let v=h==u.childCount;v||(b=-1),this.placed=nf(this.placed,n,G.from(m)),this.frontier[n].match=g,v&&b<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,T=u;E<b;E++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=v?e==0?H.empty:new H(tf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(tf(o.content,e,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!c1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:i}=this.$to,r=this.$to.after(i);for(;i>1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:i,type:r}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=c1(e,n,r,i,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],m=c1(e,u,h,c,!0);if(!m||m.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=nf(this.placed,n.depth,n.fit)),e=n.move;for(let i=n.depth+1;i<=e.depth;i++){let r=e.node(i),s=r.type.contentMatch.fillBefore(r.content,!0,e.index(i));this.openFrontierNode(r.type,r.attrs,s)}return e}openFrontierNode(e,n=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=nf(this.placed,this.depth,G.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=nf(this.placed,this.frontier.length,n))}};function tf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(tf(t.firstChild.content,e-1,n)))}function nf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(nf(t.lastChild.content,e-1,n)))}function u1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function xM(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,xM(i.firstChild,e-1,i.childCount==1?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(G.empty,!0)))),t.copy(i)}function c1(t,e,n,i,r){let s=t.node(e),o=r?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=i.fillBefore(s.content,!0,o);return u&&!W9(n,s.content,o)?u:null}function W9(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}let Z9=class Pd extends vn{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return Vn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return Zo.empty}invert(e){return new Pd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Pd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Pd(n.pos,n.attr,n.value)}};vn.jsonID("attr",Z9);let e8=class Rx extends vn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return Vn.ok(i)}getMap(){return Zo.empty}invert(e){return new Rx(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Rx(n.attr,n.value)}};vn.jsonID("docAttr",e8);let ch=class extends Error{};ch=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ch.prototype=Object.create(Error.prototype);ch.prototype.constructor=ch;ch.prototype.name="TransformError";const bM=65535,SM=Math.pow(2,16);function t8(t,e){return t+e*SM}function vE(t){return t&bM}function n8(t){return(t-(t&bM))/SM}const kM=1,vM=2,jd=4,CM=8;let Dx=class{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&CM)>0}get deletedBefore(){return(this.delInfo&(kM|jd))>0}get deletedAfter(){return(this.delInfo&(vM|jd))>0}get deletedAcross(){return(this.delInfo&jd)>0}},el=class au{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&au.empty)return au.empty}recover(e){let n=0,i=vE(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+n8(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:t8(u/3,e-c),E=e==c?vM:e==g?kM:jd;return(n<0?e!=c:e!=g)&&(E|=CM),new Dx(b,E,v)}r+=m-h}return i?e+r:new Dx(e+r,0,null)}touches(e,n){let i=0,r=vE(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new au(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?au.empty:new au(e<0?[0,-e,0]:[0,0,e])}};el.empty=new el([]);let i8=class Ix{constructor(e,n,i=0,r=e?e.length:0){this.mirror=n,this.from=i,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ix(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,i=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?i+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?i-r-1:void 0)}}invert(){let e=new Ix;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let r=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],u=o.mapResult(e,n);if(u.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(u.recover);continue}}r|=u.delInfo,e=u.pos}return i?e:new Dx(e,r,null)}};const f1=Object.create(null);let Cn=class{getMap(){return el.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=f1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in f1)throw new RangeError("Duplicate use of step JSON ID "+e);return f1[e]=n,n.prototype.jsonID=e,n}},Fn=class rf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new rf(e,null)}static fail(e){return new rf(null,e)}static fromReplace(e,n,i,r){try{return rf.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return rf.fail(s.message);throw s}}};function nS(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(nS(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}let iS=class sf extends Cn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(nS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return Fn.fromReplace(e,this.from,this.to,s)}invert(){return new $h(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new sf(n.pos,i.pos,this.mark)}merge(e){return e instanceof sf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new sf(n.from,n.to,e.markFromJSON(n.mark))}};Cn.jsonID("addMark",iS);let $h=class af extends Cn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(nS(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Fn.fromReplace(e,this.from,this.to,i)}invert(){return new iS(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new af(n.pos,i.pos,this.mark)}merge(e){return e instanceof af&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new af(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new af(n.from,n.to,e.markFromJSON(n.mark))}};Cn.jsonID("removeMark",$h);let rS=class of extends Cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Fn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new of(this.pos,n.marks[r]);return new of(this.pos,this.mark)}}return new Am(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new of(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new of(n.pos,e.markFromJSON(n.mark))}};Cn.jsonID("addNodeMark",rS);let Am=class _x extends Cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Fn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new rS(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _x(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new _x(n.pos,e.markFromJSON(n.mark))}};Cn.jsonID("removeNodeMark",Am);let Rs=class wo extends Cn{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&zx(e,this.from,this.to)?Fn.fail("Structure replace would overwrite content"):Fn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new el([this.from,this.to-this.from,this.slice.size])}invert(e){return new wo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new wo(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof wo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new wo(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new wo(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wo(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Cn.jsonID("replace",Rs);let cl=class $d extends Cn{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(zx(e,this.from,this.gapFrom)||zx(e,this.gapTo,this.to)))return Fn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Fn.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?Fn.fromReplace(e,this.from,this.to,i):Fn.fail("Content does not fit in gap")}getMap(){return new el([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new $d(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new $d(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new $d(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Cn.jsonID("replaceAround",cl);function zx(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function r8(t,e,n,i){let r=[],s=[],o,u;t.doc.nodesBetween(e,n,(c,h,m)=>{if(!c.isInline)return;let g=c.marks;if(!i.isInSet(g)&&m.type.allowsMarkType(i.type)){let y=Math.max(h,e),b=Math.min(h+c.nodeSize,n),v=i.addToSet(g);for(let E=0;E<g.length;E++)g[E].isInSet(v)||(o&&o.to==y&&o.mark.eq(g[E])?o.to=b:r.push(o=new $h(y,b,g[E])));u&&u.to==y?u.to=b:s.push(u=new iS(y,b,i))}}),r.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function s8(t,e,n,i){let r=[],s=0;t.doc.nodesBetween(e,n,(o,u)=>{if(!o.isInline)return;s++;let c=null;if(i instanceof jh){let h=o.marks,m;for(;m=i.isInSet(h);)(c||(c=[])).push(m),h=m.removeFromSet(h)}else i?i.isInSet(o.marks)&&(c=[i]):c=o.marks;if(c&&c.length){let h=Math.min(u+o.nodeSize,n);for(let m=0;m<c.length;m++){let g=c[m],y;for(let b=0;b<r.length;b++){let v=r[b];v.step==s-1&&g.eq(r[b].style)&&(y=v)}y?(y.to=h,y.step=s):r.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),r.forEach(o=>t.step(new $h(o.from,o.to,o.style)))}function sS(t,e,n,i=n.contentMatch,r=!0){let s=t.doc.nodeAt(e),o=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),m=u+h.nodeSize,g=i.matchType(h.type);if(!g)o.push(new Rs(u,m,H.empty));else{i=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new $h(u,m,h.marks[y]));if(r&&h.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,v;for(;y=b.exec(h.text);)v||(v=new H(G.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new Rs(u+y.index,u+y.index+y[0].length,v))}}u=m}if(!i.validEnd){let c=i.fillBefore(G.empty,!0);t.replace(u,u,new H(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function a8(t,e,n){let{$from:i,$to:r,depth:s}=e,o=i.before(s+1),u=r.after(s+1),c=o,h=u,m=G.empty,g=0;for(let v=s,E=!1;v>n;v--)E||i.index(v)>0?(E=!0,m=G.from(i.node(v).copy(m)),g++):c--;let y=G.empty,b=0;for(let v=s,E=!1;v>n;v--)E||r.after(v+1)<r.end(v)?(E=!0,y=G.from(r.node(v).copy(y)),b++):h++;t.step(new cl(c,h,o,u,new H(m.append(y),g,b),m.size-g,!0))}function o8(t,e,n){let i=G.empty;for(let o=n.length-1;o>=0;o--){if(i.size){let u=n[o].type.contentMatch.matchFragment(i);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=G.from(n[o].type.create(n[o].attrs,i))}let r=e.start,s=e.end;t.step(new cl(r,s,r,s,new H(i,0,0),n.length,!0))}function l8(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,u)=>{let c=typeof r=="function"?r(o):r;if(o.isTextblock&&!o.hasMarkup(i,c)&&u8(t.doc,t.mapping.slice(s).map(u),i)){let h=null;if(i.schema.linebreakReplacement){let b=i.whitespace=="pre",v=!!i.contentMatch.matchType(i.schema.linebreakReplacement);b&&!v?h=!1:!b&&v&&(h=!0)}h===!1&&EM(t,o,u,s),sS(t,t.mapping.slice(s).map(u,1),i,void 0,h===null);let m=t.mapping.slice(s),g=m.map(u,1),y=m.map(u+o.nodeSize,1);return t.step(new cl(g,y,g+1,y-1,new H(G.from(i.create(c,null,o.marks)),0,0),1,!0)),h===!0&&wM(t,o,u,s),!1}})}function wM(t,e,n,i){e.forEach((r,s)=>{if(r.isText){let o,u=/\r?\n|\r/g;for(;o=u.exec(r.text);){let c=t.mapping.slice(i).map(n+1+s+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function EM(t,e,n,i){e.forEach((r,s)=>{if(r.type==r.type.schema.linebreakReplacement){let o=t.mapping.slice(i).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
38
- `))}})}function u8(t,e,n){let i=t.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,n)}function c8(t,e,n,i,r){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(i,null,r||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new cl(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new H(G.from(o),0,0),1,!0))}function f8(t,e,n=1,i){let r=t.doc.resolve(e),s=G.empty,o=G.empty;for(let u=r.depth,c=r.depth-n,h=n-1;u>c;u--,h--){s=G.from(r.node(u).copy(s));let m=i&&i[h];o=G.from(m?m.type.create(m.attrs,o):r.node(u).copy(o))}t.step(new Rs(e,e,new H(s.append(o),n,n),!0))}function h8(t,e,n){let i=null,{linebreakReplacement:r}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(r&&o.inlineContent){let m=o.whitespace=="pre",g=!!o.contentMatch.matchType(r);m&&!g?i=!1:!m&&g&&(i=!0)}let u=t.steps.length;if(i===!1){let m=t.doc.resolve(e+n);EM(t,m.node(),m.before(),u)}o.inlineContent&&sS(t,e+n-1,o,s.node().contentMatchAt(s.index()),i==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new Rs(h,c.map(e+n,-1),H.empty,!0)),i===!0){let m=t.doc.resolve(h);wM(t,m.node(),m.before(),t.steps.length)}return t}function p8(t,e,n){let i=t.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),n))return e;if(i.parentOffset==0)for(let r=i.depth-1;r>=0;r--){let s=i.index(r);if(i.node(r).canReplaceWith(s,s,n))return i.before(r+1);if(s>0)return null}if(i.parentOffset==i.parent.content.size)for(let r=i.depth-1;r>=0;r--){let s=i.indexAfter(r);if(i.node(r).canReplaceWith(s,s,n))return i.after(r+1);if(s<i.node(r).childCount)return null}return null}function d8(t,e,n=e,i=H.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),s=t.resolve(n);return NM(r,s,i)?new Rs(e,n,i):new m8(r,s,i).fit()}function NM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let m8=class{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=G.empty;for(let r=0;r<=e.depth;r++){let s=e.node(r);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=G.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,i=this.$from,r=this.close(e<0?this.$to:i.doc.resolve(e));if(!r)return null;let s=this.placed,o=i.depth,u=r.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new cl(i.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||i.pos!=this.$to.pos?new Rs(i.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let s=n.firstChild;if(n.childCount>1&&(r=0),s.type.spec.isolating&&r<=i){e=i;break}n=s.content}for(let n=1;n<=2;n++)for(let i=n==1?e:this.unplaced.openStart;i>=0;i--){let r,s=null;i?(s=h1(this.unplaced.content,i-1).firstChild,r=s.content):r=this.unplaced.content;let o=r.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],m,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(G.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:i,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(m=h.findWrapping(o.type)))return{sliceDepth:i,frontierDepth:u,parent:s,wrap:m};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=h1(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(i,r.size+n>=e.size-i?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=h1(e,n);if(r.childCount<=1&&n>0){let s=e.size-n<=n+r.size;this.unplaced=new H(lf(e,n-1,1),n-1,s?n-1:i)}else this.unplaced=new H(lf(e,n,1),n,i)}placeNodes({sliceDepth:e,frontierDepth:n,parent:i,inject:r,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let E=0;E<s.length;E++)this.openFrontierNode(s[E]);let o=this.unplaced,u=i?i.content:o.content,c=o.openStart-e,h=0,m=[],{match:g,type:y}=this.frontier[n];if(r){for(let E=0;E<r.childCount;E++)m.push(r.child(E));g=g.matchFragment(r)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let E=u.child(h),T=g.matchType(E.type);if(!T)break;h++,(h>1||c==0||E.content.size)&&(g=T,m.push(AM(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?b:-1)))}let v=h==u.childCount;v||(b=-1),this.placed=uf(this.placed,n,G.from(m)),this.frontier[n].match=g,v&&b<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,T=u;E<b;E++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=v?e==0?H.empty:new H(lf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(lf(o.content,e,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!p1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:i}=this.$to,r=this.$to.after(i);for(;i>1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:i,type:r}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=p1(e,n,r,i,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],m=p1(e,u,h,c,!0);if(!m||m.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=uf(this.placed,n.depth,n.fit)),e=n.move;for(let i=n.depth+1;i<=e.depth;i++){let r=e.node(i),s=r.type.contentMatch.fillBefore(r.content,!0,e.index(i));this.openFrontierNode(r.type,r.attrs,s)}return e}openFrontierNode(e,n=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=uf(this.placed,this.depth,G.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=uf(this.placed,this.frontier.length,n))}};function lf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(lf(t.firstChild.content,e-1,n)))}function uf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(uf(t.lastChild.content,e-1,n)))}function h1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function AM(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,AM(i.firstChild,e-1,i.childCount==1?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(G.empty,!0)))),t.copy(i)}function p1(t,e,n,i,r){let s=t.node(e),o=r?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=i.fillBefore(s.content,!0,o);return u&&!g8(n,s.content,o)?u:null}function g8(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function y8(t){return t.spec.defining||t.spec.definingForContent}function x8(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),s=t.doc.resolve(n);if(NM(r,s,i))return t.step(new Rs(e,n,i));let o=MM(r,s);o[o.length-1]==0&&o.pop();let u=-(r.depth+1);o.unshift(u);for(let y=r.depth,b=r.pos-1;y>0;y--,b--){let v=r.node(y).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(y)>-1?u=y:r.before(y)==b&&o.splice(1,0,-y)}let c=o.indexOf(u),h=[],m=i.openStart;for(let y=i.content,b=0;;b++){let v=y.firstChild;if(h.push(v),b==i.openStart)break;y=v.content}for(let y=m-1;y>=0;y--){let b=h[y],v=y8(b.type);if(v&&!b.sameMarkup(r.node(Math.abs(u)-1)))m=y;else if(v||!b.type.isTextblock)break}for(let y=i.openStart;y>=0;y--){let b=(y+m+1)%(i.openStart+1),v=h[b];if(v)for(let E=0;E<o.length;E++){let T=o[(E+c)%o.length],M=!0;T<0&&(M=!1,T=-T);let j=r.node(T-1),F=r.index(T-1);if(j.canReplaceWith(F,F,v.type,v.marks))return t.replace(r.before(T),M?s.after(T):n,new H(TM(i.content,0,i.openStart,b),b,i.openEnd))}}let g=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,i),!(t.steps.length>g));y--){let b=o[y];b<0||(e=r.before(b),n=s.after(b))}}function TM(t,e,n,i,r){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(TM(s.content,e+1,n,i,s)))}if(e>i){let s=r.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(G.empty,!0))}return t}function b8(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=p8(t.doc,e,i.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new H(G.from(i),0,0))}function S8(t,e,n){let i=t.doc.resolve(e),r=t.doc.resolve(n),s=MM(i,r);for(let o=0;o<s.length;o++){let u=s[o],c=o==s.length-1;if(c&&u==0||i.node(u).type.contentMatch.validEnd)return t.delete(i.start(u),r.end(u));if(u>0&&(c||i.node(u-1).canReplace(i.index(u-1),r.indexAfter(u-1))))return t.delete(i.before(u),r.after(u))}for(let o=1;o<=i.depth&&o<=r.depth;o++)if(e-i.start(o)==i.depth-o&&n>i.end(o)&&r.end(o)-n!=r.depth-o&&i.start(o-1)==r.start(o-1)&&i.node(o-1).canReplace(i.index(o-1),r.index(o-1)))return t.delete(i.before(o),n);t.delete(e,n)}function MM(t,e){let n=[],i=Math.min(t.depth,e.depth);for(let r=i;r>=0;r--){let s=t.start(r);if(s<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(s==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==s-1)&&n.push(r)}return n}let OM=class Ud extends Cn{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fn.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return Fn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return el.empty}invert(e){return new Ud(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ud(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ud(n.pos,n.attr,n.value)}};Cn.jsonID("attr",OM);let RM=class Lx extends Cn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return Fn.ok(i)}getMap(){return el.empty}invert(e){return new Lx(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Lx(n.attr,n.value)}};Cn.jsonID("docAttr",RM);let Mu=class extends Error{};Mu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Mu.prototype=Object.create(Error.prototype);Mu.prototype.constructor=Mu;Mu.prototype.name="TransformError";let k8=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new i8}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Mu(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let i=0;i<this.mapping.maps.length;i++){let r=this.mapping.maps[i];i&&(e=r.map(e,1),n=r.map(n,-1)),r.forEach((s,o,u,c)=>{e=Math.min(e,u),n=Math.max(n,c)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,i=H.empty){let r=d8(this.doc,e,n,i);return r&&this.step(r),this}replaceWith(e,n,i){return this.replace(e,n,new H(G.from(i),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return x8(this,e,n,i),this}replaceRangeWith(e,n,i){return b8(this,e,n,i),this}deleteRange(e,n){return S8(this,e,n),this}lift(e,n){return a8(this,e,n),this}join(e,n=1){return h8(this,e,n),this}wrap(e,n){return o8(this,e,n),this}setBlockType(e,n=e,i,r=null){return l8(this,e,n,i,r),this}setNodeMarkup(e,n,i=null,r){return c8(this,e,n,i,r),this}setNodeAttribute(e,n,i){return this.step(new OM(e,n,i)),this}setDocAttribute(e,n){return this.step(new RM(e,n)),this}addNodeMark(e,n){return this.step(new rS(e,n)),this}removeNodeMark(e,n){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(n instanceof ut)n.isInSet(i.marks)&&this.step(new Am(e,n));else{let r=i.marks,s,o=[];for(;s=n.isInSet(r);)o.push(new Am(e,s)),r=s.removeFromSet(r);for(let u=o.length-1;u>=0;u--)this.step(o[u])}return this}split(e,n=1,i){return f8(this,e,n,i),this}addMark(e,n,i){return r8(this,e,n,i),this}removeMark(e,n,i){return s8(this,e,n,i),this}clearIncompatible(e,n,i){return sS(this,e,n,i),this}};const d1=Object.create(null);class Ve{constructor(e,n,i){this.$anchor=e,this.$head=n,this.ranges=i||[new DM(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=H.empty){let i=n.content.lastChild,r=null;for(let u=0;u<n.openEnd;u++)r=i,i=i.lastChild;let s=e.steps.length,o=this.ranges;for(let u=0;u<o.length;u++){let{$from:c,$to:h}=o[u],m=e.mapping.slice(s);e.replaceRange(m.map(c.pos),m.map(h.pos),u?H.empty:n),u==0&&EE(e,s,(i?i.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let i=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){let{$from:o,$to:u}=r[s],c=e.mapping.slice(i),h=c.map(o.pos),m=c.map(u.pos);s?e.deleteRange(h,m):(e.replaceRangeWith(h,m,n),EE(e,i,n.isInline?-1:1))}}static findFrom(e,n,i=!1){let r=e.parent.inlineContent?new Ee(e):ou(e.node(0),e.parent,e.pos,e.index(),n,i);if(r)return r;for(let s=e.depth-1;s>=0;s--){let o=n<0?ou(e.node(0),e.node(s),e.before(s+1),e.index(s),n,i):ou(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,i);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Hn(e.node(0))}static atStart(e){return ou(e,e,0,0,1)||new Hn(e)}static atEnd(e){return ou(e,e,e.content.size,e.childCount,-1)||new Hn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=d1[n.type];if(!i)throw new RangeError(`No selection type ${n.type} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in d1)throw new RangeError("Duplicate use of selection JSON ID "+e);return d1[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ee.between(this.$anchor,this.$head).getBookmark()}}Ve.prototype.visible=!0;class DM{constructor(e,n){this.$from=e,this.$to=n}}let CE=!1;function wE(t){!CE&&!t.parent.inlineContent&&(CE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ee extends Ve{constructor(e,n=e){wE(e),wE(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let i=e.resolve(n.map(this.head));if(!i.parent.inlineContent)return Ve.near(i);let r=e.resolve(n.map(this.anchor));return new Ee(r.parent.inlineContent?r:i,i)}replace(e,n=H.empty){if(super.replace(e,n),n==H.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof Ee&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new xg(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ee(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,i=n){let r=e.resolve(n);return new this(r,i==n?r:e.resolve(i))}static between(e,n,i){let r=e.pos-n.pos;if((!i||r)&&(i=r>=0?1:-1),!n.parent.inlineContent){let s=Ve.findFrom(n,i,!0)||Ve.findFrom(n,-i,!0);if(s)n=s.$head;else return Ve.near(n,i)}return e.parent.inlineContent||(r==0?e=n:(e=(Ve.findFrom(e,-i,!0)||Ve.findFrom(e,i,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Ee(e,n)}}Ve.jsonID("text",Ee);class xg{constructor(e,n){this.anchor=e,this.head=n}map(e){return new xg(e.map(this.anchor),e.map(this.head))}resolve(e){return Ee.between(e.resolve(this.anchor),e.resolve(this.head))}}class ye extends Ve{constructor(e){let n=e.nodeAfter,i=e.node(0).resolve(e.pos+n.nodeSize);super(e,i),this.node=n}map(e,n){let{deleted:i,pos:r}=n.mapResult(this.anchor),s=e.resolve(r);return i?Ve.near(s):new ye(s)}content(){return new H(G.from(this.node),0,0)}eq(e){return e instanceof ye&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new aS(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ye(e.resolve(n.anchor))}static create(e,n){return new ye(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ye.prototype.visible=!1;Ve.jsonID("node",ye);class aS{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:i}=e.mapResult(this.anchor);return n?new xg(i,i):new aS(i)}resolve(e){let n=e.resolve(this.anchor),i=n.nodeAfter;return i&&ye.isSelectable(i)?new ye(n):Ve.near(n)}}class Hn extends Ve{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=H.empty){if(n==H.empty){e.delete(0,e.doc.content.size);let i=Ve.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Hn(e)}map(e){return new Hn(e)}eq(e){return e instanceof Hn}getBookmark(){return v8}}Ve.jsonID("all",Hn);const v8={map(){return this},resolve(t){return new Hn(t)}};function ou(t,e,n,i,r,s=!1){if(e.inlineContent)return Ee.create(t,n);for(let o=i-(r>0?0:1);r>0?o<e.childCount:o>=0;o+=r){let u=e.child(o);if(u.isAtom){if(!s&&ye.isSelectable(u))return ye.create(t,n-(r<0?u.nodeSize:0))}else{let c=ou(t,u,n+r,r<0?u.childCount:0,r,s);if(c)return c}n+=u.nodeSize*r}return null}function EE(t,e,n){let i=t.steps.length-1;if(i<e)return;let r=t.steps[i];if(!(r instanceof Rs||r instanceof cl))return;let s=t.mapping.maps[i],o;s.forEach((u,c,h,m)=>{o==null&&(o=m)}),t.setSelection(Ve.near(t.doc.resolve(o),n))}const NE=1,Od=2,AE=4;class C8 extends k8{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|NE)&~Od,this.storedMarks=null,this}get selectionSet(){return(this.updated&NE)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Od,this}ensureMarks(e){return ut.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&Od)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Od,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let i=this.selection;return n&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||ut.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,i){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(i==null&&(i=n),!e)return this.deleteRange(n,i);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=i==n?o.marks():o.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(n,i,r.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ve.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=AE,this}get scrolledIntoView(){return(this.updated&AE)>0}}function TE(t,e){return!e||!t?t:t.bind(e)}class cf{constructor(e,n,i){this.name=e,this.init=TE(n.init,i),this.apply=TE(n.apply,i)}}const w8=[new cf("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new cf("selection",{init(t,e){return t.selection||Ve.atStart(e.doc)},apply(t){return t.selection}}),new cf("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,i){return i.selection.$cursor?t.storedMarks:null}}),new cf("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class m1{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=w8.slice(),n&&n.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new cf(i.key,i.spec.state,i))})}}class Ro{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=n){let r=this.config.plugins[i];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],i=this.applyInner(e),r=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let u=this.config.plugins[o];if(u.spec.appendTransaction){let c=r?r[o].n:0,h=r?r[o].state:this,m=c<n.length&&u.spec.appendTransaction.call(u,c?n.slice(c):n,h,i);if(m&&i.filterTransaction(m,o)){if(m.setMeta("appendedTransaction",e),!r){r=[];for(let g=0;g<this.config.plugins.length;g++)r.push(g<o?{state:i,n:n.length}:{state:this,n:0})}n.push(m),i=i.applyInner(m),s=!0}r&&(r[o]={state:i,n:n.length})}}if(!s)return{state:i,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ro(this.config),i=this.config.fields;for(let r=0;r<i.length;r++){let s=i[r];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new C8(this)}static create(e){let n=new m1(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new Ro(n);for(let r=0;r<n.fields.length;r++)i[n.fields[r].name]=n.fields[r].init(e,i);return i}reconfigure(e){let n=new m1(this.schema,e.plugins),i=n.fields,r=new Ro(n);for(let s=0;s<i.length;s++){let o=i[s].name;r[o]=this.hasOwnProperty(o)?this[o]:i[s].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[i],s=r.spec.state;s&&s.toJSON&&(n[i]=s.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,i){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new m1(e.schema,e.plugins),s=new Ro(r);return r.fields.forEach(o=>{if(o.name=="doc")s.doc=As.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Ve.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let u in i){let c=i[u],h=c.spec.state;if(c.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){s[o.name]=h.fromJSON.call(c,e,n[u],s);return}}s[o.name]=o.init(e,s)}}),s}}function IM(t,e,n){for(let i in t){let r=t[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=IM(r,e,{})),n[i]=r}return n}class ci{constructor(e){this.spec=e,this.props={},e.props&&IM(e.props,this,this.props),this.key=e.key?e.key.key:_M("plugin")}getState(e){return e[this.key]}}const g1=Object.create(null);function _M(t){return t in g1?t+"$"+ ++g1[t]:(g1[t]=0,t+"$")}class fi{constructor(e="key"){this.key=_M(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const oS=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function zM(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const LM=(t,e,n)=>{let i=zM(t,n);if(!i)return!1;let r=lS(i);if(!r){let o=i.blockRange(),u=o&&eS(o);return u==null?!1:(e&&e(t.tr.lift(o,u).scrollIntoView()),!0)}let s=r.nodeBefore;if(FM(t,r,e,-1))return!0;if(i.parent.content.size==0&&(Ou(s,"end")||ye.isSelectable(s)))for(let o=i.depth;;o--){let u=tS(t.doc,i.before(o),i.after(o),H.empty);if(u&&u.slice.size<u.to-u.from){if(e){let c=t.tr.step(u);c.setSelection(Ou(s,"end")?Ve.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):ye.create(c.doc,r.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||i.node(o-1).childCount>1)break}return s.isAtom&&r.depth==i.depth-1?(e&&e(t.tr.delete(r.pos-s.nodeSize,r.pos).scrollIntoView()),!0):!1},E8=(t,e,n)=>{let i=zM(t,n);if(!i)return!1;let r=lS(i);return r?N8(t,r,e):!1};function N8(t,e,n){let i=e.nodeBefore,r=i,s=e.pos-1;for(;!r.isTextblock;s--){if(r.type.spec.isolating)return!1;let m=r.lastChild;if(!m)return!1;r=m}let o=e.nodeAfter,u=o,c=e.pos+1;for(;!u.isTextblock;c++){if(u.type.spec.isolating)return!1;let m=u.firstChild;if(!m)return!1;u=m}let h=tS(t.doc,s,c,H.empty);if(!h||h.from!=s||h instanceof yg&&h.slice.size>=c-s)return!1;if(n){let m=t.tr.step(h);m.setSelection(Ee.create(m.doc,s)),n(m.scrollIntoView())}return!0}function Ou(t,e,n=!1){for(let i=t;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(n&&i.childCount!=1)return!1}return!1}const BM=(t,e,n)=>{let{$head:i,empty:r}=t.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):i.parentOffset>0)return!1;s=lS(i)}let o=s&&s.nodeBefore;return!o||!ye.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ye.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function lS(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 A8(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const T8=(t,e,n)=>{let i=A8(t,n);if(!i)return!1;let r=VM(i);if(!r)return!1;let s=r.nodeAfter;if(FM(t,r,e,1))return!0;if(i.parent.content.size==0&&(Ou(s,"start")||ye.isSelectable(s))){let o=tS(t.doc,i.before(),i.after(),H.empty);if(o&&o.slice.size<o.to-o.from){if(e){let u=t.tr.step(o);u.setSelection(Ou(s,"start")?Ve.findFrom(u.doc.resolve(u.mapping.map(r.pos)),1):ye.create(u.doc,u.mapping.map(r.pos))),e(u.scrollIntoView())}return!0}}return s.isAtom&&r.depth==i.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+s.nodeSize).scrollIntoView()),!0):!1},M8=(t,e,n)=>{let{$head:i,empty:r}=t.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):i.parentOffset<i.parent.content.size)return!1;s=VM(i)}let o=s&&s.nodeAfter;return!o||!ye.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ye.create(t.doc,s.pos)).scrollIntoView()),!0)};function VM(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const O8=(t,e)=>{let{$head:n,$anchor:i}=t.selection;return!n.parent.type.spec.code||!n.sameParent(i)?!1:(e&&e(t.tr.insertText(`
39
- `).scrollIntoView()),!0)};function uS(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const R8=(t,e)=>{let{$head:n,$anchor:i}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let r=n.node(-1),s=n.indexAfter(-1),o=uS(r.contentMatchAt(s));if(!o||!r.canReplaceWith(s,s,o))return!1;if(e){let u=n.after(),c=t.tr.replaceWith(u,u,o.createAndFill());c.setSelection(Ve.near(c.doc.resolve(u),1)),e(c.scrollIntoView())}return!0},D8=(t,e)=>{let n=t.selection,{$from:i,$to:r}=n;if(n instanceof Hn||i.parent.inlineContent||r.parent.inlineContent)return!1;let s=uS(r.parent.contentMatchAt(r.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!i.parentOffset&&r.index()<r.parent.childCount?i:r).pos,u=t.tr.insert(o,s.createAndFill());u.setSelection(Ee.create(u.doc,o+1)),e(u.scrollIntoView())}return!0},I8=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Fd(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let i=n.blockRange(),r=i&&eS(i);return r==null?!1:(e&&e(t.tr.lift(i,r).scrollIntoView()),!0)};function _8(t){return(e,n)=>{let{$from:i,$to:r}=e.selection;if(e.selection instanceof ye&&e.selection.node.isBlock)return!i.parentOffset||!Fd(e.doc,i.pos)?!1:(n&&n(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let s=[],o,u,c=!1,h=!1;for(let b=i.depth;;b--)if(i.node(b).isBlock){c=i.end(b)==i.pos+(i.depth-b),h=i.start(b)==i.pos-(i.depth-b),u=uS(i.node(b-1).contentMatchAt(i.indexAfter(b-1))),s.unshift(c&&u?{type:u}:null),o=b;break}else{if(b==1)return!1;s.unshift(null)}let m=e.tr;(e.selection instanceof Ee||e.selection instanceof Hn)&&m.deleteSelection();let g=m.mapping.map(i.pos),y=Fd(m.doc,g,s.length,s);if(y||(s[0]=u?{type:u}:null,y=Fd(m.doc,g,s.length,s)),!y)return!1;if(m.split(g,s.length,s),!c&&h&&i.node(o).type!=u){let b=m.mapping.map(i.before(o)),v=m.doc.resolve(b);u&&i.node(o-1).canReplaceWith(v.index(),v.index()+1,u)&&m.setNodeMarkup(m.mapping.map(i.before(o)),u)}return n&&n(m.scrollIntoView()),!0}}const z8=_8(),L8=(t,e)=>(e&&e(t.tr.setSelection(new Hn(t.doc))),!0);function B8(t,e,n){let i=e.nodeBefore,r=e.nodeAfter,s=e.index();return!i||!r||!i.type.compatibleContent(r.type)?!1:!i.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(r.isTextblock||yM(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function FM(t,e,n,i){let r=e.nodeBefore,s=e.nodeAfter,o,u,c=r.type.spec.isolating||s.type.spec.isolating;if(!c&&B8(t,e,n))return!0;let h=!c&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(u=r.contentMatchAt(r.childCount)).findWrapping(s.type))&&u.matchType(o[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,v=G.empty;for(let M=o.length-1;M>=0;M--)v=G.from(o[M].create(null,v));v=G.from(r.copy(v));let E=t.tr.step(new Nm(e.pos-1,b,e.pos,b,new H(v,1,0),o.length,!0)),T=E.doc.resolve(b+2*o.length);T.nodeAfter&&T.nodeAfter.type==r.type&&yM(E.doc,T.pos)&&E.join(T.pos),n(E.scrollIntoView())}return!0}let m=s.type.spec.isolating||i>0&&c?null:Ve.findFrom(e,1),g=m&&m.$from.blockRange(m.$to),y=g&&eS(g);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(g,y).scrollIntoView()),!0;if(h&&Ou(s,"start",!0)&&Ou(r,"end")){let b=r,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let E=s,T=1;for(;!E.isTextblock;E=E.firstChild)T++;if(b.canReplace(b.childCount,b.childCount,E.content)){if(n){let M=G.empty;for(let F=v.length-1;F>=0;F--)M=G.from(v[F].copy(M));let j=t.tr.step(new Nm(e.pos-v.length,e.pos+s.nodeSize,e.pos+T,e.pos+s.nodeSize-T,new H(M,v.length,0),0,!0));n(j.scrollIntoView())}return!0}}return!1}function PM(t){return function(e,n){let i=e.selection,r=t<0?i.$from:i.$to,s=r.depth;for(;r.node(s).isInline;){if(!s)return!1;s--}return r.node(s).isTextblock?(n&&n(e.tr.setSelection(Ee.create(e.doc,t<0?r.start(s):r.end(s)))),!0):!1}}const V8=PM(-1),F8=PM(1);function cS(t,e=null){return function(n,i){let{$from:r,$to:s}=n.selection,o=r.blockRange(s),u=o&&H9(o,t,e);return u?(i&&i(n.tr.wrap(o,u).scrollIntoView()),!0):!1}}function fh(t,e=null){return function(n,i){let r=!1;for(let s=0;s<n.selection.ranges.length&&!r;s++){let{$from:{pos:o},$to:{pos:u}}=n.selection.ranges[s];n.doc.nodesBetween(o,u,(c,h)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let m=n.doc.resolve(h),g=m.index();r=m.parent.canReplaceWith(g,g+1,t)}})}if(!r)return!1;if(i){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:u},$to:{pos:c}}=n.selection.ranges[o];s.setBlockType(u,c,t,e)}i(s.scrollIntoView())}return!0}}function P8(t,e,n,i){for(let r=0;r<e.length;r++){let{$from:s,$to:o}=e[r],u=s.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(s.pos,o.pos,(c,h)=>{if(u)return!1;u=c.inlineContent&&c.type.allowsMarkType(n)}),u)return!0}return!1}function bg(t,e=null,n){return function(i,r){let{empty:s,$cursor:o,ranges:u}=i.selection;if(s&&!o||!P8(i.doc,u,t))return!1;if(r)if(o)t.isInSet(i.storedMarks||o.marks())?r(i.tr.removeStoredMark(t)):r(i.tr.addStoredMark(t.create(e)));else{let c,h=i.tr;c=!u.some(m=>i.doc.rangeHasMark(m.$from.pos,m.$to.pos,t));for(let m=0;m<u.length;m++){let{$from:g,$to:y}=u[m];if(!c)h.removeMark(g.pos,y.pos,t);else{let b=g.pos,v=y.pos,E=g.nodeAfter,T=y.nodeBefore,M=E&&E.isText?/^\s*/.exec(E.text)[0].length:0,j=T&&T.isText?/\s*$/.exec(T.text)[0].length:0;b+M<v&&(b+=M,v-=j),h.addMark(b,v,t.create(e))}}r(h.scrollIntoView())}return!0}}function Vu(...t){return function(e,n,i){for(let r=0;r<t.length;r++)if(t[r](e,n,i))return!0;return!1}}let y1=Vu(oS,LM,BM),ME=Vu(oS,T8,M8);const Cs={Enter:Vu(O8,D8,I8,z8),"Mod-Enter":R8,Backspace:y1,"Mod-Backspace":y1,"Shift-Backspace":y1,Delete:ME,"Mod-Delete":ME,"Mod-a":L8},jM={"Ctrl-h":Cs.Backspace,"Alt-Backspace":Cs["Mod-Backspace"],"Ctrl-d":Cs.Delete,"Ctrl-Alt-Backspace":Cs["Mod-Delete"],"Alt-Delete":Cs["Mod-Delete"],"Alt-d":Cs["Mod-Delete"],"Ctrl-a":V8,"Ctrl-e":F8};for(let t in Cs)jM[t]=Cs[t];const j8=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,$8=j8?jM:Cs,$M=65535,UM=Math.pow(2,16);function U8(t,e){return t+e*UM}function OE(t){return t&$M}function J8(t){return(t-(t&$M))/UM}const JM=1,HM=2,Jd=4,qM=8;let RE=class{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&qM)>0}get deletedBefore(){return(this.delInfo&(JM|Jd))>0}get deletedAfter(){return(this.delInfo&(HM|Jd))>0}get deletedAcross(){return(this.delInfo&Jd)>0}},tl=class lu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&lu.empty)return lu.empty}recover(e){let n=0,i=OE(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+J8(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:U8(u/3,e-c),E=e==c?HM:e==g?JM:Jd;return(n<0?e!=c:e!=g)&&(E|=qM),new RE(b,E,v)}r+=m-h}return i?e+r:new RE(e+r,0,null)}touches(e,n){let i=0,r=OE(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new lu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?lu.empty:new lu(e<0?[0,-e,0]:[0,0,e])}};tl.empty=new tl([]);const x1=Object.create(null);let wn=class{getMap(){return tl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=x1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in x1)throw new RangeError("Duplicate use of step JSON ID "+e);return x1[e]=n,n.prototype.jsonID=e,n}},Pn=class ff{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ff(e,null)}static fail(e){return new ff(null,e)}static fromReplace(e,n,i,r){try{return ff.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return ff.fail(s.message);throw s}}};function fS(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(fS(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}let KM=class hf extends wn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(fS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,s)}invert(){return new GM(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new hf(n.pos,i.pos,this.mark)}merge(e){return e instanceof hf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new hf(n.from,n.to,e.markFromJSON(n.mark))}};wn.jsonID("addMark",KM);let GM=class pf extends wn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(fS(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,i)}invert(){return new KM(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new pf(n.pos,i.pos,this.mark)}merge(e){return e instanceof pf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new pf(n.from,n.to,e.markFromJSON(n.mark))}};wn.jsonID("removeMark",GM);let YM=class df extends wn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new df(this.pos,n.marks[r]);return new df(this.pos,this.mark)}}return new XM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new df(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new df(n.pos,e.markFromJSON(n.mark))}};wn.jsonID("addNodeMark",YM);let XM=class Bx extends wn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new YM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Bx(n.pos,e.markFromJSON(n.mark))}};wn.jsonID("removeNodeMark",XM);let H8=class Eo extends wn{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Vx(e,this.from,this.to)?Pn.fail("Structure replace would overwrite content"):Pn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new tl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Eo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Eo(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Eo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Eo(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Eo(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Eo(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};wn.jsonID("replace",H8);let q8=class Hd extends wn{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Vx(e,this.from,this.gapFrom)||Vx(e,this.gapTo,this.to)))return Pn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Pn.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?Pn.fromReplace(e,this.from,this.to,i):Pn.fail("Content does not fit in gap")}getMap(){return new tl([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Hd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new Hd(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Hd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};wn.jsonID("replaceAround",q8);function Vx(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function K8(t,e,n=null,i=t){let r=G8(t,e),s=r&&Y8(i,e);return s?r.map(DE).concat({type:e,attrs:n}).concat(s.map(DE)):null}function DE(t){return{type:t,attrs:null}}function G8(t,e){let{parent:n,startIndex:i,endIndex:r}=t,s=n.contentMatchAt(i).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(i,r,o)?s:null}function Y8(t,e){let{parent:n,startIndex:i,endIndex:r}=t,s=n.child(i),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=i;c&&h<r;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}function X8(t,e){let n=t.resolve(e),i=n.index();return W8(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function Q8(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:i}=t.type.schema;for(let r=0;r<e.childCount;r++){let s=e.child(r),o=s.type==i?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function W8(t,e){return!!(t&&e&&!t.isLeaf&&Q8(t,e))}let Z8=class qd extends wn{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return Pn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return tl.empty}invert(e){return new qd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new qd(n.pos,n.attr,n.value)}};wn.jsonID("attr",Z8);let eB=class Fx extends wn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return Pn.ok(i)}getMap(){return tl.empty}invert(e){return new Fx(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Fx(n.attr,n.value)}};wn.jsonID("docAttr",eB);let hh=class extends Error{};hh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};hh.prototype=Object.create(Error.prototype);hh.prototype.constructor=hh;hh.prototype.name="TransformError";class Ai{constructor(e,n,i={}){this.match=e,this.match=e,this.handler=typeof n=="string"?tB(n):n,this.undoable=i.undoable!==!1,this.inCode=i.inCode||!1,this.inCodeMark=i.inCodeMark!==!1}}function tB(t){return function(e,n,i,r){let s=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);s+=n[0].slice(o+n[1].length),i+=o;let u=i-r;u>0&&(s=n[0].slice(o-u,o)+s,i=r)}return e.tr.insertText(s,i,r)}}const nB=(t,e)=>{let n=t.plugins;for(let i=0;i<n.length;i++){let r=n[i],s;if(r.spec.isInputRules&&(s=r.getState(t))){if(e){let o=t.tr,u=s.transform;for(let c=u.steps.length-1;c>=0;c--)o.step(u.steps[c].invert(u.docs[c]));if(s.text){let c=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,c))}else o.delete(s.from,s.to);e(o)}return!0}}return!1};new Ai(/--$/,"—",{inCodeMark:!1});new Ai(/\.\.\.$/,"…",{inCodeMark:!1});new Ai(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Ai(/"$/,"”",{inCodeMark:!1});new Ai(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Ai(/'$/,"’",{inCodeMark:!1});function hS(t,e,n=null,i){return new Ai(t,(r,s,o,u)=>{let c=n instanceof Function?n(s):n,h=r.tr.delete(o,u),m=h.doc.resolve(o),g=m.blockRange(),y=g&&K8(g,e,c);if(!y)return null;h.wrap(g,y);let b=h.doc.resolve(o-1).nodeBefore;return b&&b.type==e&&X8(h.doc,o-1)&&(!i||i(s,b))&&h.join(o-1),h})}function QM(t,e,n=null){return new Ai(t,(i,r,s,o)=>{let u=i.doc.resolve(s),c=n instanceof Function?n(r):n;return u.node(-1).canReplaceWith(u.index(-1),u.indexAfter(-1),e)?i.tr.delete(s,o).setBlockType(s,s,e,c):null})}const ja=typeof navigator<"u"?navigator:null,IE=typeof document<"u"?document:null,Ka=ja&&ja.userAgent||"",Px=/Edge\/(\d+)/.exec(Ka),WM=/MSIE \d/.exec(Ka),jx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ka),pS=!!(WM||jx||Px);WM?document.documentMode:jx?+jx[1]:Px&&+Px[1];const iB=!pS&&/gecko\/(\d+)/i.test(Ka);iB&&+(/Firefox\/(\d+)/.exec(Ka)||[0,0])[1];const $x=!pS&&/Chrome\/(\d+)/.exec(Ka),rB=!!$x;$x&&+$x[1];const sB=!pS&&!!ja&&/Apple Computer/.test(ja.vendor),aB=sB&&(/Mobile\/\w+/.test(Ka)||!!ja&&ja.maxTouchPoints>2);aB||ja&&/Mac/.test(ja.platform);const oB=/Android \d/.test(Ka),lB=!!IE&&"webkitFontSmoothing"in IE.documentElement.style;lB&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];function b1(t,e,n,i,r,s){if(t.composing)return!1;const o=t.state,u=o.doc.resolve(e);if(u.parent.type.spec.code)return!1;const c=u.parent.textBetween(Math.max(0,u.parentOffset-500),u.parentOffset,void 0,"")+i;for(let h of r){const m=h,g=m.match.exec(c),y=g&&g[0]&&m.handler(o,g,e-(g[0].length-i.length),n);if(y)return m.undoable!==!1&&y.setMeta(s,{transform:y,from:e,to:n,text:i}),t.dispatch(y),!0}return!1}const uB=new fi("MILKDOWN_CUSTOM_INPUTRULES");function cB({rules:t}){const e=new ci({key:uB,isInputRules:!0,state:{init(){return null},apply(n,i){const r=n.getMeta(this);return r||(n.selectionSet||n.docChanged?null:i)}},props:{handleTextInput(n,i,r,s){return b1(n,i,r,s,t,e)},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:i}=n.state.selection;i&&b1(n,i.pos,i.pos,"",t,e)}),!1),keydown:(n,i)=>!(oB&&rB&&i.key==="Enter")||n.composing?!1:n.someProp("handleKeyDown",r=>r(n,i))?(i.preventDefault(),!0):!1},handleKeyDown(n,i){if(i.key!=="Enter")return!1;const{$cursor:r}=n.state.selection;return r?b1(n,r.pos,r.pos,`
40
- `,t,e):!1}}});return e}function Uh(t,e,n={}){return new Ai(t,(i,r,s,o)=>{var u,c,h,m;const{tr:g}=i,y=r.length;let b=r[y-1],v=r[0],E=[],T;const M={group:b,fullMatch:v,start:s,end:o},j=(u=n.updateCaptured)==null?void 0:u.call(n,M);if(Object.assign(M,j),{group:b,fullMatch:v,start:s,end:o}=M,v===null||b?.trim()==="")return null;if(b){const F=v.search(/\S/),J=s+v.indexOf(b),V=J+b.length;E=(c=g.storedMarks)!=null?c:[],V<o&&g.delete(V,o),J>s&&g.delete(s+F,J),T=s+F+b.length;const C=(h=n.getAttr)==null?void 0:h.call(n,r);g.addMark(s,T,e.create(C)),g.setStoredMarks(E),(m=n.beforeDispatch)==null||m.call(n,{match:r,start:s,end:o,tr:g})}return g})}function ZM(t){return Object.assign(Object.create(t),t).setTime(Date.now())}function fB(t,e){return Array.isArray(t)&&t.includes(e.type)||e.type===t}function hB(t){return e=>{for(let n=e.depth;n>0;n-=1){const i=e.node(n);if(t(i)){const r=e.before(n),s=e.after(n);return{from:r,to:s,node:i}}}}}function pB(t,e){return hB(n=>n.type===e)(t)}function dB(t){return e=>{for(let n=e.depth;n>0;n--){const i=e.node(n);if(t(i))return{pos:e.before(n),start:e.start(n),depth:n,node:i}}}}function mB(t,e){if(!(t instanceof ye))return;const{node:n,$from:i}=t;if(fB(e,n))return{node:n,pos:i.pos,start:i.start(i.depth),depth:i.depth}}const gB=(t,e)=>{const{selection:n,doc:i}=t;if(n instanceof ye)return{hasNode:n.node.type===e,pos:n.from,target:n.node};const{from:r,to:s}=n;let o=!1,u=-1,c=null;return i.nodesBetween(r,s,(h,m)=>c?!1:h.type===e?(o=!0,u=m,c=h,!1):!0),{hasNode:o,pos:u,target:c}};var $a={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:"'"},Tm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},yB=typeof navigator<"u"&&/Mac/.test(navigator.platform),xB=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var hn=0;hn<10;hn++)$a[48+hn]=$a[96+hn]=String(hn);for(var hn=1;hn<=24;hn++)$a[hn+111]="F"+hn;for(var hn=65;hn<=90;hn++)$a[hn]=String.fromCharCode(hn+32),Tm[hn]=String.fromCharCode(hn);for(var S1 in $a)Tm.hasOwnProperty(S1)||(Tm[S1]=$a[S1]);function bB(t){var e=yB&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||xB&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Tm:$a)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const SB=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),kB=typeof navigator<"u"&&/Win/.test(navigator.platform);function vB(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let i,r,s,o;for(let u=0;u<e.length-1;u++){let c=e[u];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))SB?o=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(n="Alt-"+n),r&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function CB(t){let e=Object.create(null);for(let n in t)e[vB(n)]=t[n];return e}function k1(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function wB(t){return new ci({props:{handleKeyDown:eO(t)}})}function eO(t){let e=CB(t);return function(n,i){let r=bB(i),s,o=e[k1(r,i)];if(o&&o(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(i.shiftKey){let u=e[k1(r,i,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(kB&&i.ctrlKey&&i.altKey)&&(s=$a[i.keyCode])&&s!=r){let u=e[k1(s,i)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}var tO=class{},nO=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=t=>{this.top()?.push(t)},this.open=t=>{this.elements.push(t)},this.close=()=>{const t=this.elements.pop();if(!t)throw pT();return t}}},EB=class iO extends tO{constructor(e,n,i){super(),this.type=e,this.content=n,this.attrs=i}push(e,...n){this.content.push(e,...n)}pop(){return this.content.pop()}static create(e,n,i){return new iO(e,n,i)}},Lr,Ih,ng,ig,rg,_h,zh,Yo,NB=(Yo=class extends nO{constructor(n){super();Ut(this,Lr,ut.none);Ut(this,Ih,n=>n.isText);Ut(this,ng,(n,i)=>{if(Ze(this,Ih).call(this,n)&&Ze(this,Ih).call(this,i)&&ut.sameSet(n.marks,i.marks))return this.schema.text(n.text+i.text,n.marks)});Ut(this,ig,n=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(r=>r.spec.parseMarkdown.match(n));if(!i)throw _4(n);return i});Ut(this,rg,n=>{const i=Ze(this,ig).call(this,n);i.spec.parseMarkdown.runner(this,n,i)});Ut(this,_h,()=>{eu(this,Lr,ut.none);const n=this.close();return Ze(this,zh).call(this,n.type,n.attrs,n.content)});Ut(this,zh,(n,i,r)=>{const s=n.createAndFill(i,r,Ze(this,Lr));if(!s)throw I4(n,i,r);return this.push(s),s});this.injectRoot=(i,r,s)=>(this.openNode(r,s),this.next(i.children),this),this.openNode=(i,r)=>(this.open(EB.create(i,[],r)),this),this.closeNode=()=>{try{Ze(this,_h).call(this)}catch(i){console.error(i)}return this},this.addNode=(i,r,s)=>{try{Ze(this,zh).call(this,i,r,s)}catch(o){console.error(o)}return this},this.openMark=(i,r)=>(eu(this,Lr,i.create(r).addToSet(Ze(this,Lr))),this),this.closeMark=i=>(eu(this,Lr,i.removeFromSet(Ze(this,Lr))),this),this.addText=i=>{try{const r=this.top();if(!r)throw pT();const s=r.pop(),o=this.schema.text(i,Ze(this,Lr));if(!s)return r.push(o),this;const u=Ze(this,ng).call(this,s,o);return u?(r.push(u),this):(r.push(s,o),this)}catch(r){return console.error(r),this}},this.build=()=>{let i;do i=Ze(this,_h).call(this);while(this.size());return i},this.next=(i=[])=>([i].flat().forEach(r=>Ze(this,rg).call(this,r)),this),this.toDoc=()=>this.build(),this.run=(i,r)=>{const s=i.runSync(i.parse(r),r);return this.next(s),this},this.schema=n}},Lr=new WeakMap,Ih=new WeakMap,ng=new WeakMap,ig=new WeakMap,rg=new WeakMap,_h=new WeakMap,zh=new WeakMap,Yo.create=(n,i)=>{const r=new Yo(n);return s=>(r.run(i,s),r.toDoc())},Yo),Xo,_E=(Xo=class extends tO{constructor(e,n,i,r={}){super(),this.type=e,this.children=n,this.value=i,this.props=r,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>this.children?.pop()}},Xo.create=(e,n,i,r={})=>new Xo(e,n,i,r),Xo),AB=t=>Object.prototype.hasOwnProperty.call(t,"size"),ws,Lh,sg,ag,Bh,og,Vh,lg,ug,Au,Bo,cg,Fh,Qo,TB=(Qo=class extends nO{constructor(n){super();Ut(this,ws,ut.none);Ut(this,Lh,n=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(r=>r.spec.toMarkdown.match(n));if(!i)throw z4(n.type);return i});Ut(this,sg,n=>Ze(this,Lh).call(this,n).spec.toMarkdown.runner(this,n));Ut(this,ag,(n,i)=>Ze(this,Lh).call(this,n).spec.toMarkdown.runner(this,n,i));Ut(this,Bh,n=>{const{marks:i}=n,r=s=>s.type.spec.priority??50;[...i].sort((s,o)=>r(s)-r(o)).every(s=>!Ze(this,ag).call(this,s,n))&&Ze(this,sg).call(this,n),i.forEach(s=>Ze(this,Fh).call(this,s))});Ut(this,og,(n,i)=>{if(n.type===i||n.children?.length!==1)return n;const r=c=>{if(c.type===i)return c.value!=null?null:c;if(c.children?.length!==1)return null;const[h]=c.children;return h?r(h):null},s=r(n);if(!s)return n;const o=s.children?[...s.children]:void 0,u={...n,children:o};return u.children=o,s.children=[u],s});Ut(this,Vh,n=>{const{children:i}=n;return i&&(n.children=i.reduce((r,s,o)=>{if(o===0)return[s];const u=r.at(-1);if(u&&u.isMark&&s.isMark){s=Ze(this,og).call(this,s,u.type);const{children:c,...h}=s,{children:m,...g}=u;if(s.type===u.type&&c&&m&&JSON.stringify(h)===JSON.stringify(g)){const y={...g,children:[...m,...c]};return r.slice(0,-1).concat(Ze(this,Vh).call(this,y))}}return r.concat(s)},[])),n});Ut(this,lg,n=>{const i={...n.props,type:n.type};return n.children&&(i.children=n.children),n.value&&(i.value=n.value),i});Ut(this,ug,(n,i)=>{let r="",s="";const o=n.children;let u=-1,c=-1;const h=g=>{g&&g.forEach((y,b)=>{y.type==="text"&&y.value&&(u<0&&(u=b),c=b)})};if(o){h(o);const g=o?.[c],y=o?.[u];if(g&&g.value.endsWith(" ")){const b=g.value,v=b.trimEnd();s=b.slice(v.length),g.value=v}if(y&&y.value.startsWith(" ")){const b=y.value,v=b.trimStart();r=b.slice(0,b.length-v.length),y.value=v}}r.length&&Ze(this,Bo).call(this,"text",void 0,r);const m=i();return s.length&&Ze(this,Bo).call(this,"text",void 0,s),m});Ut(this,Au,(n=!1)=>{const i=this.close(),r=()=>Ze(this,Bo).call(this,i.type,i.children,i.value,i.props);return n?Ze(this,ug).call(this,i,r):r()});Ut(this,Bo,(n,i,r,s)=>{const o=_E.create(n,i,r,s),u=Ze(this,Vh).call(this,Ze(this,lg).call(this,o));return this.push(u),u});Ut(this,cg,(n,i,r,s)=>n.isInSet(Ze(this,ws))?this:(eu(this,ws,n.addToSet(Ze(this,ws))),this.openNode(i,r,{...s,isMark:!0})));Ut(this,Fh,n=>{n.isInSet(Ze(this,ws))&&(eu(this,ws,n.type.removeFromSet(Ze(this,ws))),Ze(this,Au).call(this,!0))});this.openNode=(i,r,s)=>(this.open(_E.create(i,void 0,r,s)),this),this.closeNode=()=>(Ze(this,Au).call(this),this),this.addNode=(i,r,s,o)=>(Ze(this,Bo).call(this,i,r,s,o),this),this.withMark=(i,r,s,o)=>(Ze(this,cg).call(this,i,r,s,o),this),this.closeMark=i=>(Ze(this,Fh).call(this,i),this),this.build=()=>{let i=null;do i=Ze(this,Au).call(this);while(this.size());return i},this.next=i=>AB(i)?(i.forEach(r=>{Ze(this,Bh).call(this,r)}),this):(Ze(this,Bh).call(this,i),this),this.toString=i=>i.stringify(this.build()),this.run=i=>(this.next(i),this),this.schema=n}},ws=new WeakMap,Lh=new WeakMap,sg=new WeakMap,ag=new WeakMap,Bh=new WeakMap,og=new WeakMap,Vh=new WeakMap,lg=new WeakMap,ug=new WeakMap,Au=new WeakMap,Bo=new WeakMap,cg=new WeakMap,Fh=new WeakMap,Qo.create=(n,i)=>{const r=new Qo(n);return s=>(r.run(s),r.toString(i))},Qo);const rO=65535,sO=Math.pow(2,16);function MB(t,e){return t+e*sO}function zE(t){return t&rO}function OB(t){return(t-(t&rO))/sO}const aO=1,oO=2,Kd=4,lO=8;let LE=class{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&lO)>0}get deletedBefore(){return(this.delInfo&(aO|Kd))>0}get deletedAfter(){return(this.delInfo&(oO|Kd))>0}get deletedAcross(){return(this.delInfo&Kd)>0}},nl=class uu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&uu.empty)return uu.empty}recover(e){let n=0,i=zE(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+OB(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:MB(u/3,e-c),E=e==c?oO:e==g?aO:Kd;return(n<0?e!=c:e!=g)&&(E|=lO),new LE(b,E,v)}r+=m-h}return i?e+r:new LE(e+r,0,null)}touches(e,n){let i=0,r=zE(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new uu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?uu.empty:new uu(e<0?[0,-e,0]:[0,0,e])}};nl.empty=new nl([]);const v1=Object.create(null);let En=class{getMap(){return nl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=v1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in v1)throw new RangeError("Duplicate use of step JSON ID "+e);return v1[e]=n,n.prototype.jsonID=e,n}},jn=class mf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new mf(e,null)}static fail(e){return new mf(null,e)}static fromReplace(e,n,i,r){try{return mf.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return mf.fail(s.message);throw s}}};function dS(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(dS(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}let uO=class gf extends En{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(dS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,s)}invert(){return new cO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new gf(n.pos,i.pos,this.mark)}merge(e){return e instanceof gf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new gf(n.from,n.to,e.markFromJSON(n.mark))}};En.jsonID("addMark",uO);let cO=class yf extends En{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(dS(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,i)}invert(){return new uO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new yf(n.pos,i.pos,this.mark)}merge(e){return e instanceof yf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new yf(n.from,n.to,e.markFromJSON(n.mark))}};En.jsonID("removeMark",cO);let fO=class xf extends En{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new xf(this.pos,n.marks[r]);return new xf(this.pos,this.mark)}}return new hO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new xf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xf(n.pos,e.markFromJSON(n.mark))}};En.jsonID("addNodeMark",fO);let hO=class Ux extends En{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ux(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ux(n.pos,e.markFromJSON(n.mark))}};En.jsonID("removeNodeMark",hO);let RB=class No extends En{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Jx(e,this.from,this.to)?jn.fail("Structure replace would overwrite content"):jn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nl([this.from,this.to-this.from,this.slice.size])}invert(e){return new No(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new No(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof No)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new No(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new No(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new No(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};En.jsonID("replace",RB);let DB=class Gd extends En{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Jx(e,this.from,this.gapFrom)||Jx(e,this.gapTo,this.to)))return jn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return jn.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?jn.fromReplace(e,this.from,this.to,i):jn.fail("Content does not fit in gap")}getMap(){return new nl([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Gd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new Gd(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Gd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};En.jsonID("replaceAround",DB);function Jx(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function IB(t,e,n){let i=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let s=0;s<n.openStart;s++)r=r.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=i.depth;o>=0;o--){let u=o==i.depth?0:i.pos<=(i.start(o+1)+i.end(o+1))/2?-1:1,c=i.index(o)+(u>0?1:0),h=i.node(o),m=!1;if(s==1)m=h.canReplace(c,c,r);else{let g=h.contentMatchAt(c).findWrapping(r.firstChild.type);m=g&&h.canReplaceWith(c,c,g[0])}if(m)return u==0?i.pos:u<0?i.before(o+1):i.after(o+1)}return null}let _B=class Yd extends En{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return nl.empty}invert(e){return new Yd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yd(n.pos,n.attr,n.value)}};En.jsonID("attr",_B);let zB=class Hx extends En{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return jn.ok(i)}getMap(){return nl.empty}invert(e){return new Hx(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Hx(n.attr,n.value)}};En.jsonID("docAttr",zB);let ph=class extends Error{};ph=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ph.prototype=Object.create(Error.prototype);ph.prototype.constructor=ph;ph.prototype.name="TransformError";const pn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ru=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let qx=null;const vs=function(t,e,n){let i=qx||(qx=document.createRange());return i.setEnd(t,n??t.nodeValue.length),i.setStart(t,e||0),i},LB=function(){qx=null},il=function(t,e,n,i){return n&&(BE(t,e,n,i,-1)||BE(t,e,n,i,1))},BB=/^(img|br|input|textarea|hr)$/i;function BE(t,e,n,i,r){for(var s;;){if(t==n&&e==i)return!0;if(e==(r<0?0:Wi(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Jh(t)||BB.test(t.nodeName)||t.contentEditable=="false")return!1;e=pn(t)+(r<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(r<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=r;else return!1;else t=o,e=r<0?Wi(t):0}else return!1}}function Wi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function VB(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=Wi(t)}else if(t.parentNode&&!Jh(t))e=pn(t),t=t.parentNode;else return null}}function FB(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&&!Jh(t))e=pn(t)+1,t=t.parentNode;else return null}}function PB(t,e,n){for(let i=e==0,r=e==Wi(t);i||r;){if(t==n)return!0;let s=pn(t);if(t=t.parentNode,!t)return!1;i=i&&s==0,r=r&&s==Wi(t)}}function Jh(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Sg=function(t){return t.focusNode&&il(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Mo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function jB(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function $B(t,e,n){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(e,n);if(i)return{node:i.offsetNode,offset:Math.min(Wi(i.offsetNode),i.offset)}}catch{}if(t.caretRangeFromPoint){let i=t.caretRangeFromPoint(e,n);if(i)return{node:i.startContainer,offset:Math.min(Wi(i.startContainer),i.startOffset)}}}const Vr=typeof navigator<"u"?navigator:null,VE=typeof document<"u"?document:null,Ga=Vr&&Vr.userAgent||"",Kx=/Edge\/(\d+)/.exec(Ga),pO=/MSIE \d/.exec(Ga),Gx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ga),li=!!(pO||Gx||Kx),La=pO?document.documentMode:Gx?+Gx[1]:Kx?+Kx[1]:0,er=!li&&/gecko\/(\d+)/i.test(Ga);er&&+(/Firefox\/(\d+)/.exec(Ga)||[0,0])[1];const Yx=!li&&/Chrome\/(\d+)/.exec(Ga),dn=!!Yx,dO=Yx?+Yx[1]:0,kn=!li&&!!Vr&&/Apple Computer/.test(Vr.vendor),Du=kn&&(/Mobile\/\w+/.test(Ga)||!!Vr&&Vr.maxTouchPoints>2),Gi=Du||(Vr?/Mac/.test(Vr.platform):!1),mO=Vr?/Win/.test(Vr.platform):!1,Ns=/Android \d/.test(Ga),Hh=!!VE&&"webkitFontSmoothing"in VE.documentElement.style,UB=Hh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function JB(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 Ss(t,e){return typeof t=="number"?t:t[e]}function HB(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,i=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*i}}function FE(t,e,n){let i=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Ru(o);continue}let u=o,c=u==s.body,h=c?JB(s):HB(u),m=0,g=0;if(e.top<h.top+Ss(i,"top")?g=-(h.top-e.top+Ss(r,"top")):e.bottom>h.bottom-Ss(i,"bottom")&&(g=e.bottom-e.top>h.bottom-h.top?e.top+Ss(r,"top")-h.top:e.bottom-h.bottom+Ss(r,"bottom")),e.left<h.left+Ss(i,"left")?m=-(h.left-e.left+Ss(r,"left")):e.right>h.right-Ss(i,"right")&&(m=e.right-h.right+Ss(r,"right")),m||g)if(c)s.defaultView.scrollBy(m,g);else{let b=u.scrollLeft,v=u.scrollTop;g&&(u.scrollTop+=g),m&&(u.scrollLeft+=m);let E=u.scrollLeft-b,T=u.scrollTop-v;e={left:e.left-E,top:e.top-T,right:e.right-E,bottom:e.bottom-T}}let y=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(y))break;o=y=="absolute"?o.offsetParent:Ru(o)}}function qB(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),i,r;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let u=t.root.elementFromPoint(s,o);if(!u||u==t.dom||!t.dom.contains(u))continue;let c=u.getBoundingClientRect();if(c.top>=n-20){i=u,r=c.top;break}}return{refDOM:i,refTop:r,stack:gO(t.dom)}}function gO(t){let e=[],n=t.ownerDocument;for(let i=t;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),t!=n);i=Ru(i));return e}function KB({refDOM:t,refTop:e,stack:n}){let i=t?t.getBoundingClientRect().top:0;yO(n,i==0?0:i-e)}function yO(t,e){for(let n=0;n<t.length;n++){let{dom:i,top:r,left:s}=t[n];i.scrollTop!=r+e&&(i.scrollTop=r+e),i.scrollLeft!=s&&(i.scrollLeft=s)}}let tu=null;function GB(t){if(t.setActive)return t.setActive();if(tu)return t.focus(tu);let e=gO(t);t.focus(tu==null?{get preventScroll(){return tu={preventScroll:!0},!0}}:void 0),tu||(tu=!1,yO(e,0))}function xO(t,e){let n,i=2e8,r,s=0,o=e.top,u=e.top,c,h;for(let m=t.firstChild,g=0;m;m=m.nextSibling,g++){let y;if(m.nodeType==1)y=m.getClientRects();else if(m.nodeType==3)y=vs(m).getClientRects();else continue;for(let b=0;b<y.length;b++){let v=y[b];if(v.top<=o&&v.bottom>=u){o=Math.max(v.bottom,o),u=Math.min(v.top,u);let E=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(E<i){n=m,i=E,r=E&&n.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,m.nodeType==1&&E&&(s=g+(e.left>=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!c&&v.left<=e.left&&v.right>=e.left&&(c=m,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(s=g+1)}}return!n&&c&&(n=c,r=h,i=0),n&&n.nodeType==3?YB(n,r):!n||i&&n.nodeType==1?{node:t,offset:s}:xO(n,r)}function YB(t,e){let n=t.nodeValue.length,i=document.createRange(),r;for(let s=0;s<n;s++){i.setEnd(t,s+1),i.setStart(t,s);let o=Sa(i,1);if(o.top!=o.bottom&&mS(e,o)){r={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return i.detach(),r||{node:t,offset:0}}function mS(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function XB(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function QB(t,e,n){let{node:i,offset:r}=xO(e,n),s=-1;if(i.nodeType==1&&!i.firstChild){let o=i.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(i,r,s)}function WB(t,e,n,i){let r=-1;for(let s=e,o=!1;s!=t.dom;){let u=t.docView.nearestDesc(s,!0),c;if(!u)return null;if(u.dom.nodeType==1&&(u.node.isBlock&&u.parent||!u.contentDOM)&&((c=u.dom.getBoundingClientRect()).width||c.height)&&(u.node.isBlock&&u.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(u.dom.nodeName)&&(!o&&c.left>i.left||c.top>i.top?r=u.posBefore:(!o&&c.right<i.left||c.bottom<i.top)&&(r=u.posAfter),o=!0),!u.contentDOM&&r<0&&!u.node.isText))return(u.node.isBlock?i.top<(c.top+c.bottom)/2:i.left<(c.left+c.right)/2)?u.posBefore:u.posAfter;s=u.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function bO(t,e,n){let i=t.childNodes.length;if(i&&n.top<n.bottom)for(let r=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-n.top)/(n.bottom-n.top))-2)),s=r;;){let o=t.childNodes[s];if(o.nodeType==1){let u=o.getClientRects();for(let c=0;c<u.length;c++){let h=u[c];if(mS(e,h))return bO(o,e,h)}}if((s=(s+1)%i)==r)break}return t}function ZB(t,e){let n=t.dom.ownerDocument,i,r=0,s=$B(n,e.left,e.top);s&&({node:i,offset:r}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),u;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let h=t.dom.getBoundingClientRect();if(!mS(e,h)||(o=bO(t.dom,e,h),!o))return null}if(kn)for(let h=o;i&&h;h=Ru(h))h.draggable&&(i=void 0);if(o=XB(o,e),i){if(er&&i.nodeType==1&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let m=i.childNodes[r],g;m.nodeName=="IMG"&&(g=m.getBoundingClientRect()).right<=e.left&&g.bottom>e.top&&r++}let h;Hh&&r&&i.nodeType==1&&(h=i.childNodes[r-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&r--,i==t.dom&&r==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:(r==0||i.nodeType!=1||i.childNodes[r-1].nodeName!="BR")&&(u=WB(t,i,r,e))}u==null&&(u=QB(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:u,inside:c?c.posAtStart-c.border:-1}}function PE(t){return t.top<t.bottom||t.left<t.right}function Sa(t,e){let n=t.getClientRects();if(n.length){let i=n[e<0?0:n.length-1];if(PE(i))return i}return Array.prototype.find.call(n,PE)||t.getBoundingClientRect()}const e7=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function SO(t,e,n){let{node:i,offset:r,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Hh||er;if(i.nodeType==3)if(o&&(e7.test(i.nodeValue)||(n<0?!r:r==i.nodeValue.length))){let c=Sa(vs(i,r,r),n);if(er&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let h=Sa(vs(i,r-1,r-1),-1);if(h.top==c.top){let m=Sa(vs(i,r,r+1),-1);if(m.top!=c.top)return qc(m,m.left<h.left)}}return c}else{let c=r,h=r,m=n<0?1:-1;return n<0&&!r?(h++,m=-1):n>=0&&r==i.nodeValue.length?(c--,m=1):n<0?c--:h++,qc(Sa(vs(i,c,h),m),m<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&r&&(n<0||r==Wi(i))){let c=i.childNodes[r-1];if(c.nodeType==1)return C1(c.getBoundingClientRect(),!1)}if(s==null&&r<Wi(i)){let c=i.childNodes[r];if(c.nodeType==1)return C1(c.getBoundingClientRect(),!0)}return C1(i.getBoundingClientRect(),n>=0)}if(s==null&&r&&(n<0||r==Wi(i))){let c=i.childNodes[r-1],h=c.nodeType==3?vs(c,Wi(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(h)return qc(Sa(h,1),!1)}if(s==null&&r<Wi(i)){let c=i.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let h=c?c.nodeType==3?vs(c,0,o?0:1):c.nodeType==1?c:null:null;if(h)return qc(Sa(h,-1),!0)}return qc(Sa(i.nodeType==3?vs(i):i,-n),n>=0)}function qc(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function C1(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function kO(t,e,n){let i=t.state,r=t.root.activeElement;i!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{i!=e&&t.updateState(i),r!=t.dom&&r&&r.focus()}}function t7(t,e,n){let i=e.selection,r=n=="up"?i.$from:i.$to;return kO(t,e,()=>{let{node:s}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let u=t.docView.nearestDesc(s,!0);if(!u)break;if(u.node.isBlock){s=u.contentDOM||u.dom;break}s=u.dom.parentNode}let o=SO(t,r.pos,1);for(let u=s.firstChild;u;u=u.nextSibling){let c;if(u.nodeType==1)c=u.getClientRects();else if(u.nodeType==3)c=vs(u,0,u.nodeValue.length).getClientRects();else continue;for(let h=0;h<c.length;h++){let m=c[h];if(m.bottom>m.top+1&&(n=="up"?o.top-m.top>(m.bottom-o.top)*2:m.bottom-o.bottom>(o.bottom-m.top)*2))return!1}}return!0})}const n7=/[\u0590-\u08ac]/;function i7(t,e,n){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let r=i.parentOffset,s=!r,o=r==i.parent.content.size,u=t.domSelection();return u?!n7.test(i.parent.textContent)||!u.modify?n=="left"||n=="backward"?s:o:kO(t,e,()=>{let{focusNode:c,focusOffset:h,anchorNode:m,anchorOffset:g}=t.domSelectionRange(),y=u.caretBidiLevel;u.modify("move",n,"character");let b=i.depth?t.docView.domAfterPos(i.before()):t.dom,{focusNode:v,focusOffset:E}=t.domSelectionRange(),T=v&&!b.contains(v.nodeType==1?v:v.parentNode)||c==v&&h==E;try{u.collapse(m,g),c&&(c!=m||h!=g)&&u.extend&&u.extend(c,h)}catch{}return y!=null&&(u.caretBidiLevel=y),T}):i.pos==i.start()||i.pos==i.end()}let jE=null,$E=null,UE=!1;function r7(t,e,n){return jE==e&&$E==n?UE:(jE=e,$E=n,UE=n=="up"||n=="down"?t7(t,e,n):i7(t,e,n))}const tr=0,JE=1,Do=2,Fr=3;class qh{constructor(e,n,i,r){this.parent=e,this.children=n,this.dom=i,this.contentDOM=r,this.dirty=tr,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,i=this.posAtStart;;n++){let r=this.children[n];if(r==e)return i;i+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>pn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){r=!1;break}if(s.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){r=!0;break}if(s.nextSibling)break}}return r??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let i=!0,r=e;r;r=r.parentNode){let s=this.getDesc(r),o;if(s&&(!n||s.node))if(i&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))i=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let i=n;i;i=i.parent)if(i==this)return n}posFromDOM(e,n,i){for(let r=e;r;r=r.parentNode){let s=this.getDesc(r);if(s)return s.localPosFromDOM(e,n,i)}return-1}descAt(e){for(let n=0,i=0;n<this.children.length;n++){let r=this.children[n],s=i+r.size;if(i==e&&s!=i){for(;!r.border&&r.children.length;)for(let o=0;o<r.children.length;o++){let u=r.children[o];if(u.size){r=u;break}}return r}if(e<s)return r.descAt(e-i-r.border);i=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,r=0;for(let s=0;i<this.children.length;i++){let o=this.children[i],u=s+o.size;if(u>e||o instanceof CO){r=e-s;break}s=u}if(r)return this.children[i].domFromPos(r-this.children[i].border,n);for(let s;i&&!(s=this.children[i-1]).size&&s instanceof vO&&s.side>=0;i--);if(n<=0){let s,o=!0;for(;s=i?this.children[i-1]:null,!(!s||s.dom.parentNode==this.contentDOM);i--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?pn(s.dom)+1:0}}else{let s,o=!0;for(;s=i<this.children.length?this.children[i]:null,!(!s||s.dom.parentNode==this.contentDOM);i++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?pn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,s=-1;for(let o=i,u=0;;u++){let c=this.children[u],h=o+c.size;if(r==-1&&e<=h){let m=o+c.border;if(e>=m&&n<=h-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,m);e=o;for(let g=u;g>0;g--){let y=this.children[g-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){r=pn(y.dom)+1;break}e-=y.size}r==-1&&(r=0)}if(r>-1&&(h>n||u==this.children.length-1)){n=h;for(let m=u+1;m<this.children.length;m++){let g=this.children[m];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(-1)){s=pn(g.dom);break}n+=g.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=h}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:i}=this.domFromPos(e,0);if(n.nodeType!=1||i==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[i]}setSelection(e,n,i,r=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let b=0,v=0;b<this.children.length;b++){let E=this.children[b],T=v+E.size;if(s>v&&o<T)return E.setSelection(e-v-E.border,n-v-E.border,i,r);v=T}let u=this.domFromPos(e,e?-1:1),c=n==e?u:this.domFromPos(n,n?-1:1),h=i.root.getSelection(),m=i.domSelectionRange(),g=!1;if((er||kn)&&e==n){let{node:b,offset:v}=u;if(b.nodeType==3){if(g=!!(v&&b.nodeValue[v-1]==`
41
- `),g&&v==b.nodeValue.length)for(let E=b,T;E;E=E.parentNode){if(T=E.nextSibling){T.nodeName=="BR"&&(u=c={node:T.parentNode,offset:pn(T)+1});break}let M=E.pmViewDesc;if(M&&M.node&&M.node.isBlock)break}}else{let E=b.childNodes[v-1];g=E&&(E.nodeName=="BR"||E.contentEditable=="false")}}if(er&&m.focusNode&&m.focusNode!=c.node&&m.focusNode.nodeType==1){let b=m.focusNode.childNodes[m.focusOffset];b&&b.contentEditable=="false"&&(r=!0)}if(!(r||g&&kn)&&il(u.node,u.offset,m.anchorNode,m.anchorOffset)&&il(c.node,c.offset,m.focusNode,m.focusOffset))return;let y=!1;if((h.extend||e==n)&&!(g&&er)){h.collapse(u.node,u.offset);try{e!=n&&h.extend(c.node,c.offset),y=!0}catch{}}if(!y){if(e>n){let v=u;u=c,c=v}let b=document.createRange();b.setEnd(c.node,c.offset),b.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let i=0,r=0;r<this.children.length;r++){let s=this.children[r],o=i+s.size;if(i==o?e<=o&&n>=i:e<o&&n>i){let u=i+s.border,c=o-s.border;if(e>=u&&n<=c){this.dirty=e==i||n==o?Do:JE,e==u&&n==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Fr:s.markDirty(e-u,n-u);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Do:Fr}i=o}this.dirty=Do}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let i=e==1?Do:JE;n.dirty<i&&(n.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class vO extends qh{constructor(e,n,i,r){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(i,()=>{if(!s)return r;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let u=document.createElement("span");u.appendChild(o),o=u}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==tr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class s7 extends qh{constructor(e,n,i,r){super(e,[],n,null),this.textDOM=i,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class rl extends qh{constructor(e,n,i,r,s){super(e,[],i,r),this.mark=n,this.spec=s}static create(e,n,i,r){let s=r.nodeViews[n.type.name],o=s&&s(n,r,i);return(!o||!o.dom)&&(o=qr.renderSpec(document,n.type.spec.toDOM(n,i),null,n.attrs)),new rl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Fr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Fr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=tr){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=tr}}slice(e,n,i){let r=rl.create(this.parent,this.mark,!0,i),s=this.children,o=this.size;n<o&&(s=Qx(s,n,o,i)),e>0&&(s=Qx(s,0,e,i));for(let u=0;u<s.length;u++)s[u].parent=r;return r.children=s,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ba extends qh{constructor(e,n,i,r,s,o,u,c,h){super(e,[],s,o),this.node=n,this.outerDeco=i,this.innerDeco=r,this.nodeDOM=u}static create(e,n,i,r,s,o){let u=s.nodeViews[n.type.name],c,h=u&&u(n,s,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},i,r),m=h&&h.dom,g=h&&h.contentDOM;if(n.isText){if(!m)m=document.createTextNode(n.text);else if(m.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else m||({dom:m,contentDOM:g}=qr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!g&&!n.isText&&m.nodeName!="BR"&&(m.hasAttribute("contenteditable")||(m.contentEditable="false"),n.type.spec.draggable&&(m.draggable=!0));let y=m;return m=NO(m,i,n),h?c=new a7(e,n,i,r,m,g||null,y,h,s,o+1):n.isText?new kg(e,n,i,r,m,y,s):new Ba(e,n,i,r,m,g||null,y,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let i=this.children[n];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>G.empty)}return e}matchesNode(e,n,i){return this.dirty==tr&&e.eq(this.node)&&Mm(n,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let i=this.node.inlineContent,r=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,u=s&&s.pos<0,c=new l7(this,o&&o.node,e);f7(this.node,this.innerDeco,(h,m,g)=>{h.spec.marks?c.syncToMarks(h.spec.marks,i,e,m):h.type.side>=0&&!g&&c.syncToMarks(m==this.node.childCount?ut.none:this.node.child(m).marks,i,e,m),c.placeWidget(h,e,r)},(h,m,g,y)=>{c.syncToMarks(h.marks,i,e,y);let b;c.findNodeMatch(h,m,g,y)||u&&e.state.selection.from>r&&e.state.selection.to<r+h.nodeSize&&(b=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(h,m,g,b,e)||c.updateNextNode(h,m,g,e,y,r)||c.addNode(h,m,g,e,r),r+=h.nodeSize}),c.syncToMarks([],i,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Do)&&(o&&this.protectLocalComposition(e,o),wO(this.contentDOM,this.children,e),Du&&h7(this.dom))}localCompositionInfo(e,n){let{from:i,to:r}=e.state.selection;if(!(e.state.selection instanceof Ee)||i<n||r>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,u=p7(this.node.content,o,i-n,r-n);return u<0?null:{node:s,pos:u,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:i,text:r}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new s7(this,s,n,r);e.input.compositionNodes.push(o),this.children=Qx(this.children,i,i+r.length,e,o)}update(e,n,i,r){return this.dirty==Fr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,i,r),!0)}updateInner(e,n,i,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=tr}updateOuterDeco(e){if(Mm(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=EO(this.dom,this.nodeDOM,Xx(this.outerDeco,this.node,n),Xx(e,this.node,n)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.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 HE(t,e,n,i,r){NO(i,e,t);let s=new Ba(void 0,t,e,n,i,i,i,r,0);return s.contentDOM&&s.updateChildren(r,0),s}class kg extends Ba{constructor(e,n,i,r,s,o,u){super(e,n,i,r,s,null,o,u,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,i,r){return this.dirty==Fr||this.dirty!=tr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=tr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=tr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,i){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,i){let r=this.node.cut(e,n),s=document.createTextNode(r.text);return new kg(this.parent,r,this.outerDeco,this.innerDeco,s,s,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Fr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class CO extends qh{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==tr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class a7 extends Ba{constructor(e,n,i,r,s,o,u,c,h,m){super(e,n,i,r,s,o,u,h,m),this.spec=c}update(e,n,i,r){if(this.dirty==Fr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,i);return s&&this.updateInner(e,n,i,r),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,i,r){this.spec.setSelection?this.spec.setSelection(e,n,i.root):super.setSelection(e,n,i,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function wO(t,e,n){let i=t.firstChild,r=!1;for(let s=0;s<e.length;s++){let o=e[s],u=o.dom;if(u.parentNode==t){for(;u!=i;)i=qE(i),r=!0;i=i.nextSibling}else r=!0,t.insertBefore(u,i);if(o instanceof rl){let c=i?i.previousSibling:t.lastChild;wO(o.contentDOM,o.children,n),i=c?c.nextSibling:t.firstChild}}for(;i;)i=qE(i),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Pf=function(t){t&&(this.nodeName=t)};Pf.prototype=Object.create(null);const Io=[new Pf];function Xx(t,e,n){if(t.length==0)return Io;let i=n?Io[0]:new Pf,r=[i];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&r.push(i=new Pf(o.nodeName));for(let u in o){let c=o[u];c!=null&&(n&&r.length==1&&r.push(i=new Pf(e.isInline?"span":"div")),u=="class"?i.class=(i.class?i.class+" ":"")+c:u=="style"?i.style=(i.style?i.style+";":"")+c:u!="nodeName"&&(i[u]=c))}}}return r}function EO(t,e,n,i){if(n==Io&&i==Io)return e;let r=e;for(let s=0;s<i.length;s++){let o=i[s],u=n[s];if(s){let c;u&&u.nodeName==o.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(r),u=Io[0]),r=c}o7(r,u||Io[0],o)}return r}function o7(t,e,n){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in n)&&t.removeAttribute(i);for(let i in n)i!="class"&&i!="style"&&i!="nodeName"&&n[i]!=e[i]&&t.setAttribute(i,n[i]);if(e.class!=n.class){let i=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.remove(i[s]);for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.add(r[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=i.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function NO(t,e,n){return EO(t,t,Io,Xx(e,n,t.nodeType!=1))}function Mm(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function qE(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class l7{constructor(e,n,i){this.lock=n,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=u7(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let i=e;i<n;i++)this.top.children[i].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,i,r){let s=0,o=this.stack.length>>1,u=Math.min(o,e.length);for(;s<u&&(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=tr,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,h=this.top.children.length;r<this.preMatch.index&&(h=Math.min(this.index+3,h));for(let m=this.index;m<h;m++){let g=this.top.children[m];if(g.matchesMark(e[o])&&!this.isLocked(g.dom)){c=m;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let m=rl.create(this.top,e[o],n,i);this.top.children.splice(this.index,0,m),this.top=m,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,i,r){let s=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,i))s=this.top.children.indexOf(o,this.index);else for(let u=this.index,c=Math.min(this.top.children.length,u+5);u<c;u++){let h=this.top.children[u];if(h.matchesNode(e,n,i)&&!this.preMatch.matched.has(h)){s=u;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,i,r,s){let o=this.top.children[r];return o.dirty==Fr&&o.dom==o.contentDOM&&(o.dirty=Do),o.update(e,n,i,s)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==i)return r}return-1}e=n}}updateNextNode(e,n,i,r,s,o){for(let u=this.index;u<this.top.children.length;u++){let c=this.top.children[u];if(c instanceof Ba){let h=this.preMatch.matched.get(c);if(h!=null&&h!=s)return!1;let m=c.dom,g,y=this.isLocked(m)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Fr&&Mm(n,c.outerDeco));if(!y&&c.update(e,n,i,r))return this.destroyBetween(this.index,u),c.dom!=m&&(this.changed=!0),this.index++,!0;if(!y&&(g=this.recreateWrapper(c,e,n,i,r,o)))return this.destroyBetween(this.index,u),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=Do,g.updateChildren(r,o+1),g.dirty=tr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,i,r,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Mm(i,e.outerDeco)||!r.eq(e.innerDeco))return null;let u=Ba.create(this.top,n,i,r,s,o);if(u.contentDOM){u.children=e.children,e.children=[];for(let c of u.children)c.parent=u}return e.destroy(),u}addNode(e,n,i,r,s){let o=Ba.create(this.top,e,n,i,r,s);o.contentDOM&&o.updateChildren(r,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,i){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let s=new vO(this.top,e,n,i);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof rl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof kg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((kn||dn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let r=new CO(this.top,[],i,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function u7(t,e){let n=e,i=n.children.length,r=t.childCount,s=new Map,o=[];e:for(;r>0;){let u;for(;;)if(i){let h=n.children[i-1];if(h instanceof rl)n=h,i=h.children.length;else{u=h,i--;break}}else{if(n==e)break e;i=n.parent.children.indexOf(n),n=n.parent}let c=u.node;if(c){if(c!=t.child(r-1))break;--r,s.set(u,r),o.push(u)}}return{index:r,matched:s,matches:o.reverse()}}function c7(t,e){return t.type.side-e.type.side}function f7(t,e,n,i){let r=e.locals(t),s=0;if(r.length==0){for(let h=0;h<t.childCount;h++){let m=t.child(h);i(m,r,e.forChild(s,m),h),s+=m.nodeSize}return}let o=0,u=[],c=null;for(let h=0;;){let m,g;for(;o<r.length&&r[o].to==s;){let T=r[o++];T.widget&&(m?(g||(g=[m])).push(T):m=T)}if(m)if(g){g.sort(c7);for(let T=0;T<g.length;T++)n(g[T],h,!!c)}else n(m,h,!!c);let y,b;if(c)b=-1,y=c,c=null;else if(h<t.childCount)b=h,y=t.child(h++);else break;for(let T=0;T<u.length;T++)u[T].to<=s&&u.splice(T--,1);for(;o<r.length&&r[o].from<=s&&r[o].to>s;)u.push(r[o++]);let v=s+y.nodeSize;if(y.isText){let T=v;o<r.length&&r[o].from<T&&(T=r[o].from);for(let M=0;M<u.length;M++)u[M].to<T&&(T=u[M].to);T<v&&(c=y.cut(T-s),y=y.cut(0,T-s),v=T,b=-1)}else for(;o<r.length&&r[o].to<v;)o++;let E=y.isInline&&!y.isLeaf?u.filter(T=>!T.inline):u.slice();i(y,E,e.forChild(s,y),b),s=v}}function h7(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 p7(t,e,n,i){for(let r=0,s=0;r<t.childCount&&s<=i;){let o=t.child(r++),u=s;if(s+=o.nodeSize,!o.isText)continue;let c=o.text;for(;r<t.childCount;){let h=t.child(r++);if(s+=h.nodeSize,!h.isText)break;c+=h.text}if(s>=n){if(s>=i&&c.slice(i-e.length-u,i-u)==e)return i-e.length;let h=u<i?c.lastIndexOf(e,i-u-1):-1;if(h>=0&&h+e.length+u>=n)return u+h;if(n==i&&c.length>=i+e.length-u&&c.slice(i-u,i-u+e.length)==e)return i}}return-1}function Qx(t,e,n,i,r){let s=[];for(let o=0,u=0;o<t.length;o++){let c=t[o],h=u,m=u+=c.size;h>=n||m<=e?s.push(c):(h<e&&s.push(c.slice(0,e-h,i)),r&&(s.push(r),r=void 0),m>n&&s.push(c.slice(n-h,c.size,i)))}return s}function gS(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),s=r&&r.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=i.resolve(o),c,h;if(Sg(n)){for(c=o;r&&!r.node;)r=r.parent;let g=r.node;if(r&&g.isAtom&&ye.isSelectable(g)&&r.parent&&!(g.isInline&&PB(n.focusNode,n.focusOffset,r.dom))){let y=r.posBefore;h=new ye(o==y?u:i.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=o,y=o;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=i.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let m=i.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=yS(t,m,u,g)}return h}function AO(t){return t.editable?t.hasFocus():MO(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ts(t,e=!1){let n=t.state.selection;if(TO(t,n),!!AO(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&dn){let i=t.domSelectionRange(),r=t.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&il(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)m7(t);else{let{anchor:i,head:r}=n,s,o;KE&&!(n instanceof Ee)&&(n.$from.parent.inlineContent||(s=GE(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=GE(t,n.to))),t.docView.setSelection(i,r,t,e),KE&&(s&&YE(s),o&&YE(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&d7(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const KE=kn||dn&&dO<63;function GE(t,e){let{node:n,offset:i}=t.docView.domFromPos(e,0),r=i<n.childNodes.length?n.childNodes[i]:null,s=i?n.childNodes[i-1]:null;if(kn&&r&&r.contentEditable=="false")return w1(r);if((!r||r.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(r)return w1(r);if(s)return w1(s)}}function w1(t){return t.contentEditable="true",kn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function YE(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function d7(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),i=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=i||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!AO(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function m7(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,i=n.nodeName=="IMG";i?e.collapse(n.parentNode,pn(n)+1):e.collapse(n,0),!i&&!t.state.selection.visible&&li&&La<=11&&(n.disabled=!0,n.disabled=!1)}function TO(t,e){if(e instanceof ye){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(XE(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else XE(t)}function XE(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function yS(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Ee.between(e,n,i)}function QE(t){return t.editable&&!t.hasFocus()?!1:MO(t)}function MO(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 g7(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return il(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Wx(t,e){let{$anchor:n,$head:i}=t.selection,r=e>0?n.max(i):n.min(i),s=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return s&&Ve.findFrom(s,e)}function wa(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function WE(t,e,n){let i=t.state.selection;if(i instanceof Ee)if(n.indexOf("s")>-1){let{$head:r}=i,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(r.pos+s.nodeSize*(e<0?-1:1));return wa(t,new Ee(i.$anchor,o))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=Wx(t.state,e);return r&&r instanceof ye?wa(t,r):!1}else if(!(Gi&&n.indexOf("m")>-1)){let r=i.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?r.pos-s.nodeSize:r.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ye.isSelectable(s)?wa(t,new ye(e<0?t.state.doc.resolve(r.pos-s.nodeSize):r)):Hh?wa(t,new Ee(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(i instanceof ye&&i.node.isInline)return wa(t,new Ee(e>0?i.$to:i.$from));{let r=Wx(t.state,e);return r?wa(t,r):!1}}}function Om(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function jf(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function nu(t,e){return e<0?y7(t):x7(t)}function y7(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,s,o=!1;for(er&&n.nodeType==1&&i<Om(n)&&jf(n.childNodes[i],-1)&&(o=!0);;)if(i>0){if(n.nodeType!=1)break;{let u=n.childNodes[i-1];if(jf(u,-1))r=n,s=--i;else if(u.nodeType==3)n=u,i=n.nodeValue.length;else break}}else{if(OO(n))break;{let u=n.previousSibling;for(;u&&jf(u,-1);)r=n.parentNode,s=pn(u),u=u.previousSibling;if(u)n=u,i=Om(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}o?Zx(t,n,i):r&&Zx(t,r,s)}function x7(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r=Om(n),s,o;for(;;)if(i<r){if(n.nodeType!=1)break;let u=n.childNodes[i];if(jf(u,1))s=n,o=++i;else break}else{if(OO(n))break;{let u=n.nextSibling;for(;u&&jf(u,1);)s=u.parentNode,o=pn(u)+1,u=u.nextSibling;if(u)n=u,i=0,r=Om(n);else{if(n=n.parentNode,n==t.dom)break;i=r=0}}}s&&Zx(t,s,o)}function OO(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function b7(t,e){for(;t&&e==t.childNodes.length&&!Jh(t);)e=pn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function S7(t,e){for(;t&&!e&&!Jh(t);)e=pn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Zx(t,e,n){if(e.nodeType!=3){let s,o;(o=b7(e,n))?(e=o,n=0):(s=S7(e,n))&&(e=s,n=s.nodeValue.length)}let i=t.domSelection();if(!i)return;if(Sg(i)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),i.removeAllRanges(),i.addRange(s)}else i.extend&&i.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&Ts(t)},50)}function ZE(t,e){let n=t.state.doc.resolve(e);if(!(dn||mO)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left<r.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function eN(t,e,n){let i=t.state.selection;if(i instanceof Ee&&!i.empty||n.indexOf("s")>-1||Gi&&n.indexOf("m")>-1)return!1;let{$from:r,$to:s}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Wx(t.state,e);if(o&&o instanceof ye)return wa(t,o)}if(!r.parent.inlineContent){let o=e<0?r:s,u=i instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?wa(t,u):!1}return!1}function tN(t,e){if(!(t.state.selection instanceof Ee))return!0;let{$head:n,$anchor:i,empty:r}=t.state.selection;if(!n.sameParent(i))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function nN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function k7(t){if(!kn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;nN(t,i,"true"),setTimeout(()=>nN(t,i,"false"),20)}return!1}function v7(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function C7(t,e){let n=e.keyCode,i=v7(e);if(n==8||Gi&&n==72&&i=="c")return tN(t,-1)||nu(t,-1);if(n==46&&!e.shiftKey||Gi&&n==68&&i=="c")return tN(t,1)||nu(t,1);if(n==13||n==27)return!0;if(n==37||Gi&&n==66&&i=="c"){let r=n==37?ZE(t,t.state.selection.from)=="ltr"?-1:1:-1;return WE(t,r,i)||nu(t,r)}else if(n==39||Gi&&n==70&&i=="c"){let r=n==39?ZE(t,t.state.selection.from)=="ltr"?1:-1:1;return WE(t,r,i)||nu(t,r)}else{if(n==38||Gi&&n==80&&i=="c")return eN(t,-1,i)||nu(t,-1);if(n==40||Gi&&n==78&&i=="c")return k7(t)||eN(t,1,i)||nu(t,1);if(i==(Gi?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function xS(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:i,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&i.childCount==1&&i.firstChild.childCount==1;){r--,s--;let b=i.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),i=b.content}let o=t.someProp("clipboardSerializer")||qr.fromSchema(t.state.schema),u=LO(),c=u.createElement("div");c.appendChild(o.serializeFragment(i,{document:u}));let h=c.firstChild,m,g=0;for(;h&&h.nodeType==1&&(m=zO[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let v=u.createElement(m[b]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${r} ${s}${g?` -${g}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
42
-
43
- `);return{dom:c,text:y,slice:e}}function RO(t,e,n,i,r){let s=r.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(i||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||i,t)}),s)return u=new H(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
44
- `))),0,0),t.someProp("transformPasted",y=>{u=y(u,t,!0)}),u;let g=t.someProp("clipboardTextParser",y=>y(e,r,i,t));if(g)u=g;else{let y=r.marks(),{schema:b}=t.state,v=qr.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let T=o.appendChild(document.createElement("p"));E&&T.appendChild(v.serializeNode(b.text(E,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=A7(n),Hh&&T7(o);let h=o&&o.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let g=+m[3];g>0;g--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||Pa.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||m),context:r,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!w7.test(y.parentNode.nodeName)?{ignore:!0}:null}})),m)u=M7(iN(u,+m[1],+m[2]),m[4]);else if(u=H.maxOpen(E7(u.content,r),!0),u.openStart||u.openEnd){let g=0,y=0;for(let b=u.content.firstChild;g<u.openStart&&!b.type.spec.isolating;g++,b=b.firstChild);for(let b=u.content.lastChild;y<u.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);u=iN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const w7=/^(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 E7(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=r.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&IO(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=_O(o[o.length-1],s.length));let m=DO(u,c);o.push(m),r=r.matchType(m.type),s=c}}),o)return G.from(o)}return t}function DO(t,e,n=0){for(let i=e.length-1;i>=n;i--)t=e[i].create(null,G.from(t));return t}function IO(t,e,n,i,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let s=IO(t,e,n,i.lastChild,r+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(r==t.length-1?n.type:t[r+1]))return i.copy(i.content.append(G.from(DO(n,t,r+1))))}}function _O(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,_O(t.lastChild,e-1)),i=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(i))}function eb(t,e,n,i,r,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),r<i-1&&(u=eb(u,e,n,i,r+1,s)),r>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=r).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function iN(t,e,n){return e<t.openStart&&(t=new H(eb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(eb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const zO={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 rN=null;function LO(){return rN||(rN=document.implementation.createHTMLDocument("title"))}let E1=null;function N7(t){let e=window.trustedTypes;return e?(E1||(E1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),E1.createHTML(t)):t}function A7(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=LO().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t),r;if((r=i&&zO[i[1].toLowerCase()])&&(t=r.map(s=>"<"+s+">").join("")+t+r.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=N7(t),r)for(let s=0;s<r.length;s++)n=n.querySelector(r[s])||n;return n}function T7(t){let e=t.querySelectorAll(dn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let i=e[n];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),i)}}function M7(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return t}let{content:r,openStart:s,openEnd:o}=t;for(let u=i.length-2;u>=0;u-=2){let c=n.nodes[i[u]];if(!c||c.hasRequiredAttrs())break;r=G.from(c.create(i[u+1],r)),s++,o++}return new H(r,s,o)}const Kn={},Gn={},O7={touchstart:!0,touchmove:!0};class R7{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function D7(t){for(let e in Kn){let n=Kn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=i=>{_7(t,i)&&!bS(t,i)&&(t.editable||!(i.type in Gn))&&n(t,i)},O7[e]?{passive:!0}:void 0)}kn&&t.dom.addEventListener("input",()=>null),tb(t)}function Ra(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function I7(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 tb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=i=>bS(t,i))})}function bS(t,e){return t.someProp("handleDOMEvents",n=>{let i=n[e.type];return i?i(t,e)||e.defaultPrevented:!1})}function _7(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function z7(t,e){!bS(t,e)&&Kn[e.type]&&(t.editable||!(e.type in Gn))&&Kn[e.type](t,e)}Gn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!VO(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ns&&dn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Du&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let i=Date.now();t.input.lastIOSEnter=i,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==i&&(t.someProp("handleKeyDown",r=>r(t,Mo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",i=>i(t,n))||C7(t,n)?n.preventDefault():Ra(t,"key")};Gn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Gn.keypress=(t,e)=>{let n=e;if(VO(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gi&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let i=t.state.selection;if(!(i instanceof Ee)||!i.$from.sameParent(i.$to)){let r=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",o=>o(t,i.$from.pos,i.$to.pos,r,s))&&t.dispatch(s()),n.preventDefault()}};function vg(t){return{left:t.clientX,top:t.clientY}}function L7(t,e){let n=e.x-t.clientX,i=e.y-t.clientY;return n*n+i*i<100}function SS(t,e,n,i,r){if(i==-1)return!1;let s=t.state.doc.resolve(i);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,u=>o>s.depth?u(t,n,s.nodeAfter,s.before(o),r,!0):u(t,n,s.node(o),s.before(o),r,!1)))return!0;return!1}function Cu(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let i=t.state.tr.setSelection(e);i.setMeta("pointer",!0),t.dispatch(i)}function B7(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return i&&i.isAtom&&ye.isSelectable(i)?(Cu(t,new ye(n)),!0):!1}function V7(t,e){if(e==-1)return!1;let n=t.state.selection,i,r;n instanceof ye&&(i=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let u=o>s.depth?s.nodeAfter:s.node(o);if(ye.isSelectable(u)){i&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?r=s.before(n.$from.depth):r=s.before(o);break}}return r!=null?(Cu(t,ye.create(t.state.doc,r)),!0):!1}function F7(t,e,n,i,r){return SS(t,"handleClickOn",e,n,i)||t.someProp("handleClick",s=>s(t,e,i))||(r?V7(t,n):B7(t,n))}function P7(t,e,n,i){return SS(t,"handleDoubleClickOn",e,n,i)||t.someProp("handleDoubleClick",r=>r(t,e,i))}function j7(t,e,n,i){return SS(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",r=>r(t,e,i))||$7(t,n,i)}function $7(t,e,n){if(n.button!=0)return!1;let i=t.state.doc;if(e==-1)return i.inlineContent?(Cu(t,Ee.create(i,0,i.content.size)),!0):!1;let r=i.resolve(e);for(let s=r.depth+1;s>0;s--){let o=s>r.depth?r.nodeAfter:r.node(s),u=r.before(s);if(o.inlineContent)Cu(t,Ee.create(i,u+1,u+1+o.content.size));else if(ye.isSelectable(o))Cu(t,ye.create(i,u));else continue;return!0}}function kS(t){return Rm(t)}const BO=Gi?"metaKey":"ctrlKey";Kn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let i=kS(t),r=Date.now(),s="singleClick";r-t.input.lastClick.time<500&&L7(n,t.input.lastClick)&&!n[BO]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(vg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new U7(t,o,n,!!i)):(s=="doubleClick"?P7:j7)(t,o.pos,o.inside,n)?n.preventDefault():Ra(t,"pointer"))};let U7=class{constructor(e,n,i,r){this.view=e,this.pos=n,this.event=i,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[BO],this.allowDefault=i.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let m=e.state.doc.resolve(n.pos);s=m.parent,o=m.depth?m.before():0}const u=r?null:i.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(i.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof ye&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&er&&!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)),Ra(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(()=>Ts(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(vg(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ra(this.view,"pointer"):F7(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||kn&&this.mightDrag&&!this.mightDrag.node.isAtom||dn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Cu(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ra(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ra(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)}};Kn.touchstart=t=>{t.input.lastTouch=Date.now(),kS(t),Ra(t,"pointer")};Kn.touchmove=t=>{t.input.lastTouch=Date.now(),Ra(t,"pointer")};Kn.contextmenu=t=>kS(t);function VO(t,e){return t.composing?!0:kn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const J7=Ns?5e3:-1;Gn.compositionstart=Gn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ee&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||dn&&mO&&H7(t)))t.markCursor=t.state.storedMarks||n.marks(),Rm(t,!0),t.markCursor=null;else if(Rm(t,!e.selection.empty),er&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let i=t.domSelectionRange();for(let r=i.focusNode,s=i.focusOffset;r&&r.nodeType==1&&s!=0;){let o=s<0?r.lastChild:r.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else r=o,s=-1}}t.input.composing=!0}FO(t,J7)};function H7(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let i=e.childNodes[n];return i.nodeType==1&&i.contentEditable=="false"}Gn.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.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,FO(t,20))};function FO(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Rm(t),e))}function PO(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=K7());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function q7(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=VB(e.focusNode,e.focusOffset),i=FB(e.focusNode,e.focusOffset);if(n&&i&&n!=i){let r=i.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||i==s)return s;if(!r||!r.isText(i.nodeValue))return i;if(t.input.compositionNode==i){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return i}}return n||i}function K7(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Rm(t,e=!1){if(!(Ns&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),PO(t),e||t.docView&&t.docView.dirty){let n=gS(t),i=t.state.selection;return n&&!n.eq(i)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function G7(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),i.removeAllRanges(),i.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const dh=li&&La<15||Du&&UB<604;Kn.copy=Gn.cut=(t,e)=>{let n=e,i=t.state.selection,r=n.type=="cut";if(i.empty)return;let s=dh?null:n.clipboardData,o=i.content(),{dom:u,text:c}=xS(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):G7(t,u),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Y7(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function X7(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,i=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),i.parentNode&&i.parentNode.removeChild(i),n?mh(t,i.value,null,r,e):mh(t,i.textContent,i.innerHTML,r,e)},50)}function mh(t,e,n,i,r){let s=RO(t,e,n,i,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,s||H.empty)))return!0;if(!s)return!1;let o=Y7(s),u=o?t.state.tr.replaceSelectionWith(o,i):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function jO(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Gn.paste=(t,e)=>{let n=e;if(t.composing&&!Ns)return;let i=dh?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;i&&mh(t,jO(i),i.getData("text/html"),r,n)?n.preventDefault():X7(t,n)};let $O=class{constructor(e,n,i){this.slice=e,this.move=n,this.node=i}};const Q7=Gi?"altKey":"ctrlKey";function UO(t,e){let n=t.someProp("dragCopies",i=>!i(e));return n??!e[Q7]}Kn.dragstart=(t,e)=>{let n=e,i=t.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let r=t.state.selection,s=r.empty?null:t.posAtCoords(vg(n)),o;if(!(s&&s.pos>=r.from&&s.pos<=(r instanceof ye?r.to-1:r.to))){if(i&&i.mightDrag)o=ye.create(t.state.doc,i.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=t.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=t.docView&&(o=ye.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:m}=xS(t,u);(!n.dataTransfer.files.length||!dn||dO>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(dh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",dh||n.dataTransfer.setData("text/plain",h),t.dragging=new $O(m,UO(t,n),o)};Kn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Gn.dragover=Gn.dragenter=(t,e)=>e.preventDefault();Gn.drop=(t,e)=>{try{W7(t,e,t.dragging)}finally{t.dragging=null}};function W7(t,e,n){if(!e.dataTransfer)return;let i=t.posAtCoords(vg(e));if(!i)return;let r=t.state.doc.resolve(i.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=RO(t,jO(e.dataTransfer),dh?null:e.dataTransfer.getData("text/html"),!1,r);let o=!!(n&&UO(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||H.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?IB(t.state.doc,r.pos,s):r.pos;u==null&&(u=r.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),m=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(m?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(m&&ye.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new ye(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((v,E,T,M)=>b=M),c.setSelection(yS(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Kn.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())&&Ts(t)},20))};Kn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Kn.beforeinput=(t,e)=>{if(dn&&Ns&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:i}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=i||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Mo(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Gn)Kn[t]=Gn[t];function gh(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let sN=class JO{constructor(e,n){this.toDOM=e,this.spec=n||Po,this.side=this.spec.side||0}map(e,n,i,r){let{pos:s,deleted:o}=e.mapResult(n.from+r,this.side<0?-1:1);return o?null:new Ua(s-i,s-i,this)}valid(){return!0}eq(e){return this==e||e instanceof JO&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},$f=class nb{constructor(e,n){this.attrs=e,this.spec=n||Po}map(e,n,i,r){let s=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-i,o=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-i;return s>=o?null:new Ua(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof nb&&gh(this.attrs,e.attrs)&&gh(this.spec,e.spec)}static is(e){return e.type instanceof nb}destroy(){}},Z7=class HO{constructor(e,n){this.attrs=e,this.spec=n||Po}map(e,n,i,r){let s=e.mapResult(n.from+r,1);if(s.deleted)return null;let o=e.mapResult(n.to+r,-1);return o.deleted||o.pos<=s.pos?null:new Ua(s.pos-i,o.pos-i,this)}valid(e,n){let{index:i,offset:r}=e.content.findIndex(n.from),s;return r==n.from&&!(s=e.child(i)).isText&&r+s.nodeSize==n.to}eq(e){return this==e||e instanceof HO&&gh(this.attrs,e.attrs)&&gh(this.spec,e.spec)}destroy(){}},Ua=class bf{constructor(e,n,i){this.from=e,this.to=n,this.type=i}copy(e,n){return new bf(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,i){return this.type.map(e,this,n,i)}static widget(e,n,i){return new bf(e,e,new sN(n,i))}static inline(e,n,i,r){return new bf(e,n,new $f(i,r))}static node(e,n,i,r){return new bf(e,n,new Z7(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof $f}get widget(){return this.type instanceof sN}};const cu=[],Po={};let nr=class ka{constructor(e,n){this.local=e.length?e:cu,this.children=n.length?n:cu}static create(e,n){return n.length?Dm(n,e,0,Po):yn}find(e,n,i){let r=[];return this.findInner(e??0,n??1e9,r,0,i),r}findInner(e,n,i,r,s){for(let o=0;o<this.local.length;o++){let u=this.local[o];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&i.push(u.copy(u.from+r,u.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let u=this.children[o]+1;this.children[o+2].findInner(e-u,n-u,i,r+u,s)}}map(e,n,i){return this==yn||e.maps.length==0?this:this.mapInner(e,n,0,0,i||Po)}mapInner(e,n,i,r,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,i,r);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?eV(this.children,o||[],e,n,i,r,s):o?new ka(o.sort(jo),cu):yn}add(e,n){return n.length?this==yn?ka.create(e,n):this.addInner(e,n,0):this}addInner(e,n,i){let r,s=0;e.forEach((u,c)=>{let h=c+i,m;if(m=GO(n,u,h)){for(r||(r=this.children.slice());s<r.length&&r[s]<c;)s+=3;r[s]==c?r[s+2]=r[s+2].addInner(u,m,h+1):r.splice(s,0,c,c+u.nodeSize,Dm(m,u,h+1,Po)),s+=3}});let o=KO(s?YO(n):n,-i);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new ka(o.length?this.local.concat(o).sort(jo):this.local,r||this.children)}remove(e){return e.length==0||this==yn?this:this.removeInner(e,0)}removeInner(e,n){let i=this.children,r=this.local;for(let s=0;s<i.length;s+=3){let o,u=i[s]+n,c=i[s+1]+n;for(let m=0,g;m<e.length;m++)(g=e[m])&&g.from>u&&g.to<c&&(e[m]=null,(o||(o=[])).push(g));if(!o)continue;i==this.children&&(i=this.children.slice());let h=i[s+2].removeInner(o,u+1);h!=yn?i[s+2]=h:(i.splice(s,3),s-=3)}if(r.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<r.length;u++)r[u].eq(o,n)&&(r==this.local&&(r=this.local.slice()),r.splice(u--,1))}return i==this.children&&r==this.local?this:r.length||i.length?new ka(r,i):yn}forChild(e,n){if(this==yn)return this;if(n.isLeaf)return ka.empty;let i,r;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(i=this.children[u+2]);break}let s=e+1,o=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<o&&c.to>s&&c.type instanceof $f){let h=Math.max(s,c.from)-s,m=Math.min(o,c.to)-s;h<m&&(r||(r=[])).push(c.copy(h,m))}}if(r){let u=new ka(r.sort(jo),cu);return i?new qO([u,i]):u}return i||yn}eq(e){if(this==e)return!0;if(!(e instanceof ka)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return vS(this.localsInner(e))}localsInner(e){if(this==yn)return cu;if(e.inlineContent||!this.local.some($f.is))return this.local;let n=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof $f||n.push(this.local[i]);return n}forEachSet(e){e(this)}};nr.empty=new nr([],[]);nr.removeOverlap=vS;const yn=nr.empty;let qO=class fu{constructor(e){this.members=e}map(e,n){const i=this.members.map(r=>r.map(e,n,Po));return fu.from(i)}forChild(e,n){if(n.isLeaf)return nr.empty;let i=[];for(let r=0;r<this.members.length;r++){let s=this.members[r].forChild(e,n);s!=yn&&(s instanceof fu?i=i.concat(s.members):i.push(s))}return fu.from(i)}eq(e){if(!(e instanceof fu)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,i=!0;for(let r=0;r<this.members.length;r++){let s=this.members[r].localsInner(e);if(s.length)if(!n)n=s;else{i&&(n=n.slice(),i=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?vS(i?n:n.sort(jo)):cu}static from(e){switch(e.length){case 0:return yn;case 1:return e[0];default:return new fu(e.every(n=>n instanceof nr)?e:e.reduce((n,i)=>n.concat(i instanceof nr?i:i.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function eV(t,e,n,i,r,s,o){let u=t.slice();for(let h=0,m=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,v,E)=>{let T=E-v-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+m-g)continue;let F=u[M]+m-g;b>=F?u[M+1]=y<=F?-2:-1:y>=m&&T&&(u[M]+=T,u[M+1]+=T)}g+=T}),m=n.maps[h].map(m,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let m=n.map(t[h]+s),g=m-r;if(g<0||g>=i.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-r,{index:v,offset:E}=i.content.findIndex(g),T=i.maybeChild(v);if(T&&E==g&&E+T.nodeSize==b){let M=u[h+2].mapInner(n,T,m+1,t[h]+s+1,o);M!=yn?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=tV(u,t,e,n,r,s,o),m=Dm(h,i,0,o);e=m.local;for(let g=0;g<u.length;g+=3)u[g+1]<0&&(u.splice(g,3),g-=3);for(let g=0,y=0;g<m.children.length;g+=3){let b=m.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,m.children[g],m.children[g+1],m.children[g+2])}}return new nr(e.sort(jo),u)}function KO(t,e){if(!e||!t.length)return t;let n=[];for(let i=0;i<t.length;i++){let r=t[i];n.push(new Ua(r.from+e,r.to+e,r.type))}return n}function tV(t,e,n,i,r,s,o){function u(c,h){for(let m=0;m<c.local.length;m++){let g=c.local[m].map(i,r,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[m].spec)}for(let m=0;m<c.children.length;m+=3)u(c.children[m+2],c.children[m]+h+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&u(t[c+2],e[c]+s+1);return n}function GO(t,e,n){if(e.isLeaf)return null;let i=n+e.nodeSize,r=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<i&&((r||(r=[])).push(o),t[s]=null);return r}function YO(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Dm(t,e,n,i){let r=[],s=!1;e.forEach((u,c)=>{let h=GO(t,u,c+n);if(h){s=!0;let m=Dm(h,u,n+c+1,i);m!=yn&&r.push(c,c+u.nodeSize,m)}});let o=KO(s?YO(t):t,-n).sort(jo);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(i.onRemove&&i.onRemove(o[u].spec),o.splice(u--,1));return o.length||r.length?new nr(o,r):yn}function jo(t,e){return t.from-e.from||t.to-e.to}function vS(t){let e=t;for(let n=0;n<e.length-1;n++){let i=e[n];if(i.from!=i.to)for(let r=n+1;r<e.length;r++){let s=e[r];if(s.from==i.from){s.to!=i.to&&(e==t&&(e=t.slice()),e[r]=s.copy(s.from,i.to),aN(e,r+1,s.copy(i.to,s.to)));continue}else{s.from<i.to&&(e==t&&(e=t.slice()),e[n]=i.copy(i.from,s.from),aN(e,r,i.copy(s.from,i.to)));break}}}return e}function aN(t,e,n){for(;e<t.length&&jo(n,t[e])>0;)e++;t.splice(e,0,n)}function N1(t){let e=[];return t.someProp("decorations",n=>{let i=n(t.state);i&&i!=yn&&e.push(i)}),t.cursorWrapper&&e.push(nr.create(t.state.doc,[t.cursorWrapper.deco])),qO.from(e)}const nV={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},iV=li&&La<=11;class rV{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 sV{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rV,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let r=0;r<i.length;r++)this.queue.push(i[r]);li&&La<=11&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():kn&&e.composing&&i.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),iV&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,nV)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(QE(this.view)){if(this.suppressingSelectionUpdates)return Ts(this.view);if(li&&La<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&il(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,i;for(let s=e.focusNode;s;s=Ru(s))n.add(s);for(let s=e.anchorNode;s;s=Ru(s))if(n.has(s)){i=s;break}let r=i&&this.view.docView.nearestDesc(i);if(r&&r.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let i=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&QE(e)&&!this.ignoreSelectionChange(i),s=-1,o=-1,u=!1,c=[];if(e.editable)for(let m=0;m<n.length;m++){let g=this.registerMutation(n[m],c);g&&(s=s<0?g.from:Math.min(g.from,s),o=o<0?g.to:Math.max(g.to,o),g.typeOver&&(u=!0))}if(c.some(m=>m.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let m of c)if(m.nodeName=="BR"&&m.parentNode){let g=m.nextSibling;for(;g&&g.nodeType==1;){if(g.contentEditable=="false"){m.parentNode.removeChild(m);break}g=g.firstChild}}}else if(er&&c.length){let m=c.filter(g=>g.nodeName=="BR");if(m.length==2){let[g,y]=m;g.parentNode&&g.parentNode.parentNode==y.parentNode?y.remove():g.remove()}else{let{focusNode:g}=this.currentSelection;for(let y of m){let b=y.parentNode;b&&b.nodeName=="LI"&&(!g||lV(e,g)!=b)&&y.remove()}}}let h=null;s<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Sg(i)&&(h=gS(e))&&h.eq(Ve.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ts(e),this.currentSelection.set(i),e.scrollToSelection()):(s>-1||r)&&(s>-1&&(e.docView.markDirty(s,o),aV(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,uV(e,c)),this.handleDOMChange(s,o,u,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||Ts(e),this.currentSelection.set(i))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let m=0;m<e.addedNodes.length;m++){let g=e.addedNodes[m];n.push(g),g.nodeType==3&&(this.lastChangedTextNode=g)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let r=e.previousSibling,s=e.nextSibling;if(li&&La<=11&&e.addedNodes.length)for(let m=0;m<e.addedNodes.length;m++){let{previousSibling:g,nextSibling:y}=e.addedNodes[m];(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(r=g),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(s=y)}let o=r&&r.parentNode==e.target?pn(r)+1:0,u=i.localPosFromDOM(e.target,o,-1),c=s&&s.parentNode==e.target?pn(s):e.target.childNodes.length,h=i.localPosFromDOM(e.target,c,1);return{from:u,to:h}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let oN=new WeakMap,lN=!1;function aV(t){if(!oN.has(t)&&(oN.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=er,lN)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."),lN=!0}}function uN(t,e){let n=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return il(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}function oV(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return uN(t,r)}let n;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",i,!0),n?uN(t,n):null}function lV(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let i=t.docView.nearestDesc(n,!0);if(i&&i.node.isBlock)return n}return null}function uV(t,e){var n;let{focusNode:i,focusOffset:r}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let u=o;for(;;){let c=u.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;u=c}u.insertBefore(s,u.firstChild),i==s&&t.domSelection().collapse(s,r)}else s.parentNode.removeChild(s)}}function cV(t,e,n){let{node:i,fromOffset:r,toOffset:s,from:o,to:u}=t.docView.parseRange(e,n),c=t.domSelectionRange(),h,m=c.anchorNode;if(m&&t.dom.contains(m.nodeType==1?m:m.parentNode)&&(h=[{node:m,offset:c.anchorOffset}],Sg(c)||h.push({node:c.focusNode,offset:c.focusOffset})),dn&&t.input.lastKeyCode===8)for(let T=s;T>r;T--){let M=i.childNodes[T-1],j=M.pmViewDesc;if(M.nodeName=="BR"&&!j){s=T;break}if(!j||j.size)break}let g=t.state.doc,y=t.someProp("domParser")||Pa.fromSchema(t.state.schema),b=g.resolve(o),v=null,E=y.parse(i,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:r,to:s,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:fV,context:b});if(h&&h[0].pos!=null){let T=h[0].pos,M=h[1]&&h[1].pos;M==null&&(M=T),v={anchor:T+o,head:M+o}}return{doc:E,sel:v,from:o,to:u}}function fV(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(kn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||kn&&/^(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 hV=/^(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 pV(t,e,n,i,r){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let L=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,q=gS(t,L);if(q&&!t.state.selection.eq(q)){if(dn&&Ns&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",K=>K(t,Mo(13,"Enter"))))return;let re=t.state.tr.setSelection(q);L=="pointer"?re.setMeta("pointer",!0):L=="key"&&re.scrollIntoView(),s&&re.setMeta("composition",s),t.dispatch(re)}return}let o=t.state.doc.resolve(e),u=o.sharedDepth(n);e=o.before(u+1),n=t.state.doc.resolve(n).after(u+1);let c=t.state.selection,h=cV(t,e,n),m=t.state.doc,g=m.slice(h.from,h.to),y,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(y=t.state.selection.to,b="end"):(y=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let v=gV(g.content,h.doc.content,h.from,y,b);if(v&&t.input.domChangeCount++,(Du&&t.input.lastIOSEnter>Date.now()-225||Ns)&&r.some(L=>L.nodeType==1&&!hV.test(L.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",L=>L(t,Mo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(i&&c instanceof Ee&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:c.from,endA:c.to,endB:c.to};else{if(h.sel){let L=cN(t,t.state.doc,h.sel);if(L&&!L.eq(t.state.selection)){let q=t.state.tr.setSelection(L);s&&q.setMeta("composition",s),t.dispatch(q)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof Ee&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),li&&La<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let E=h.doc.resolveNoCache(v.start-h.from),T=h.doc.resolveNoCache(v.endB-h.from),M=m.resolve(v.start),j=E.sameParent(T)&&E.parent.inlineContent&&M.end()>=v.endA;if((Du&&t.input.lastIOSEnter>Date.now()-225&&(!j||r.some(L=>L.nodeName=="DIV"||L.nodeName=="P"))||!j&&E.pos<h.doc.content.size&&(!E.sameParent(T)||!E.parent.inlineContent)&&E.pos<T.pos&&!/\S/.test(h.doc.textBetween(E.pos,T.pos,"","")))&&t.someProp("handleKeyDown",L=>L(t,Mo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&mV(m,v.start,v.endA,E,T)&&t.someProp("handleKeyDown",L=>L(t,Mo(8,"Backspace")))){Ns&&dn&&t.domObserver.suppressSelectionUpdates();return}dn&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),Ns&&!j&&E.start()!=T.start()&&T.parentOffset==0&&E.depth==T.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,T=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(L){return L(t,Mo(13,"Enter"))})},20));let F=v.start,J=v.endA,V=L=>{let q=L||t.state.tr.replace(F,J,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let re=cN(t,q.doc,h.sel);re&&!(dn&&t.composing&&re.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(re.head==F||re.head==q.mapping.map(J)-1)||li&&re.empty&&re.head==F)&&q.setSelection(re)}return s&&q.setMeta("composition",s),q.scrollIntoView()},C;if(j)if(E.pos==T.pos){li&&La<=11&&E.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ts(t),20));let L=V(t.state.tr.delete(F,J)),q=m.resolve(v.start).marksAcross(m.resolve(v.endA));q&&L.ensureMarks(q),t.dispatch(L)}else if(v.endA==v.endB&&(C=dV(E.parent.content.cut(E.parentOffset,T.parentOffset),M.parent.content.cut(M.parentOffset,v.endA-M.start())))){let L=V(t.state.tr);C.type=="add"?L.addMark(F,J,C.mark):L.removeMark(F,J,C.mark),t.dispatch(L)}else if(E.parent.child(E.index()).isText&&E.index()==T.index()-(T.textOffset?0:1)){let L=E.parent.textBetween(E.parentOffset,T.parentOffset),q=()=>V(t.state.tr.insertText(L,F,J));t.someProp("handleTextInput",re=>re(t,F,J,L,q))||t.dispatch(q())}else t.dispatch(V());else t.dispatch(V())}function cN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:yS(t,e.resolve(n.anchor),e.resolve(n.head))}function dV(t,e){let n=t.firstChild.marks,i=e.firstChild.marks,r=n,s=i,o,u,c;for(let m=0;m<i.length;m++)r=i[m].removeFromSet(r);for(let m=0;m<n.length;m++)s=n[m].removeFromSet(s);if(r.length==1&&s.length==0)u=r[0],o="add",c=m=>m.mark(u.addToSet(m.marks));else if(r.length==0&&s.length==1)u=s[0],o="remove",c=m=>m.mark(u.removeFromSet(m.marks));else return null;let h=[];for(let m=0;m<e.childCount;m++)h.push(c(e.child(m)));if(G.from(h).eq(t))return{mark:u,type:o}}function mV(t,e,n,i,r){if(n-e<=r.pos-i.pos||A1(i,!0,!1)<r.pos)return!1;let s=t.resolve(e);if(!i.parent.isTextblock){let u=s.nodeAfter;return u!=null&&n==e+u.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(A1(s,!0,!0));return!o.parent.isTextblock||o.pos>n||A1(o,!0,!1)<n?!1:i.parent.content.cut(i.parentOffset).eq(o.parent.content)}function A1(t,e,n){let i=t.depth,r=e?t.end():t.pos;for(;i>0&&(e||t.indexAfter(i)==t.node(i).childCount);)i--,r++,e=!1;if(n){let s=t.node(i).maybeChild(t.indexAfter(i));for(;s&&!s.isLeaf;)s=s.firstChild,r++}return r}function gV(t,e,n,i,r){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:u}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,s-Math.min(o,u));i-=o+c-s}if(o<s&&t.size<e.size){let c=i<=s&&i>=o?s-i:0;s-=c,s&&s<e.size&&fN(e.textBetween(s-1,s+1))&&(s+=c?1:-1),u=s+(u-o),o=s}else if(u<s){let c=i<=s&&i>=u?s-i:0;s-=c,s&&s<t.size&&fN(t.textBetween(s-1,s+1))&&(s+=c?1:-1),o=s+(o-u),u=s}return{start:s,endA:o,endB:u}}function fN(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class XO{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new R7,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(gN),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=dN(this),pN(this),this.nodeViews=mN(this),this.docView=HE(this.state.doc,hN(this),N1(this),this.dom,this),this.domObserver=new sV(this,(i,r,s,o)=>pV(this,i,r,s,o)),this.domObserver.start(),D7(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&tb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(gN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let i in this._props)n[i]=this._props[i];n.state=this.state;for(let i in e)n[i]=e[i];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var i;let r=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(PO(this),o=!0),this.state=e;let u=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(u||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=mN(this);xV(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&tb(this),this.editable=dN(this),pN(this);let c=N1(this),h=hN(this),m=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",g=s||!this.docView.matchesNode(e.doc,h,c);(g||!e.selection.eq(r.selection))&&(o=!0);let y=m=="preserve"&&o&&this.dom.style.overflowAnchor==null&&qB(this);if(o){this.domObserver.stop();let b=g&&(li||dn)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&yV(r.selection,e.selection);if(g){let v=dn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=q7(this)),(s||!this.docView.update(e.doc,h,c,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=HE(e.doc,h,c,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&g7(this))?Ts(this,b):(TO(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((i=this.dragging)===null||i===void 0)&&i.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),m=="reset"?this.dom.scrollTop=0:m=="to selection"?this.scrollToSelection():y&&KB(y)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ye){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&FE(this,n.getBoundingClientRect(),e)}else FE(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let i=this.state.plugins[n];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let i=this.pluginViews[n];i.update&&i.update(this,e)}}updateDraggedNode(e,n){let i=e.node,r=-1;if(i.from<this.state.doc.content.size&&this.state.doc.nodeAt(i.from)==i.node)r=i.from;else{let s=i.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==i.node&&(r=s)}this.dragging=new $O(e.slice,e.move,r<0?void 0:ye.create(this.state.doc,r))}someProp(e,n){let i=this._props&&this._props[e],r;if(i!=null&&(r=n?n(i):i))return r;for(let o=0;o<this.directPlugins.length;o++){let u=this.directPlugins[o].props[e];if(u!=null&&(r=n?n(u):u))return r}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let u=s[o].props[e];if(u!=null&&(r=n?n(u):u))return r}}hasFocus(){if(li){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&&GB(this.dom),Ts(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ZB(this,e)}coordsAtPos(e,n=1){return SO(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,i=-1){let r=this.docView.posFromDOM(e,n,i);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return r7(this,n||this.state,e)}pasteHTML(e,n){return mh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return mh(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return xS(this,e)}destroy(){this.docView&&(I7(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],N1(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,LB())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return z7(this,e)}domSelectionRange(){let e=this.domSelection();return e?kn&&this.root.nodeType===11&&jB(this.dom.ownerDocument)==this.dom&&oV(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}XO.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function hN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let i in n)i=="class"?e.class+=" "+n[i]:i=="style"?e.style=(e.style?e.style+";":"")+n[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(n[i]))}),e.translate||(e.translate="no"),[Ua.node(0,t.state.doc.content.size,e)]}function pN(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:Ua.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function dN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function yV(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function mN(t){let e=Object.create(null);function n(i){for(let r in i)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=i[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function xV(t,e){let n=0,i=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)i++;return n!=i}function gN(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")}function Ls(t,e){return t.meta={package:"@milkdown/core",group:"System",...e},t}var QO={text:(t,e,n,i)=>{const r=t.value;return/^[^*_\\]*\s+$/.test(r)?r:n.safe(r,{...i,encode:[]})},strong:(t,e,n,i)=>{const r=t.marker||n.options.strong||"*",s=n.enter("strong"),o=n.createTracker(i);let u=o.move(r+r);return u+=o.move(n.containerPhrasing(t,{before:u,after:r,...o.current()})),u+=o.move(r+r),s(),u},emphasis:(t,e,n,i)=>{const r=t.marker||n.options.emphasis||"*",s=n.enter("emphasis"),o=n.createTracker(i);let u=o.move(r);return u+=o.move(n.containerPhrasing(t,{before:u,after:r,...o.current()})),u+=o.move(r),s(),u}},Sn=st({},"editorView"),Sf=st({},"editorState"),T1=st([],"initTimer"),yN=st({},"editor"),yh=st([],"inputRules"),Ds=st([],"prosePlugins"),xh=st([],"remarkPlugins"),bh=st([],"nodeView"),Sh=st([],"markView"),$o=st(km().use(bm).use(Cx),"remark"),Uf=st({handlers:QO,encode:[]},"remarkStringifyOptions"),Xd=Hr("ConfigReady");function bV(t){const e=n=>(n.record(Xd),async()=>(await t(n),n.done(Xd),()=>{n.clearTimer(Xd)}));return Ls(e,{displayName:"Config"}),e}var Uo=Hr("InitReady");function SV(t){const e=n=>(n.inject(yN,t).inject(Ds,[]).inject(xh,[]).inject(yh,[]).inject(bh,[]).inject(Sh,[]).inject(Uf,{handlers:QO,encode:[]}).inject($o,km().use(bm).use(Cx)).inject(T1,[Xd]).record(Uo),async()=>{await n.waitTimers(T1);const i=n.get(Uf);return n.set($o,km().use(bm).use(Cx,i)),n.done(Uo),()=>{n.remove(yN).remove(Ds).remove(xh).remove(yh).remove(bh).remove(Sh).remove(Uf).remove($o).remove(T1).clearTimer(Uo)}});return Ls(e,{displayName:"Init"}),e}var qn=Hr("SchemaReady"),M1=st([],"schemaTimer"),Ms=st({},"schema"),Jf=st([],"nodes"),Hf=st([],"marks");function xN(t){return{...t,parseDOM:t.parseDOM?.map(e=>({priority:t.priority,...e}))}}var WO=t=>(t.inject(Ms,{}).inject(Jf,[]).inject(Hf,[]).inject(M1,[Uo]).record(qn),async()=>{await t.waitTimers(M1);const e=t.get($o),n=t.get(xh).reduce((r,s)=>r.use(s.plugin,s.options),e);t.set($o,n);const i=new _9({nodes:Object.fromEntries(t.get(Jf).map(([r,s])=>[r,xN(s)])),marks:Object.fromEntries(t.get(Hf).map(([r,s])=>[r,xN(s)]))});return t.set(Ms,i),t.done(qn),()=>{t.remove(Ms).remove(Jf).remove(Hf).remove(M1).clearTimer(qn)}});Ls(WO,{displayName:"Schema"});var ZO=class{constructor(){this.setCtx=t=>{this.#e=t},this.chain=()=>{if(this.#e==null)throw Yy();const t=this.#e,e=[],n=this.get.bind(this),i={run:()=>{const s=Vu(...e),o=t.get(Sn);return s(o.state,o.dispatch,o)},inline:s=>(e.push(s),i),pipe:r.bind(this)};function r(s,o){const u=n(s);return e.push(u(o)),i}return i}}#t=new dT;#e=null;get ctx(){return this.#e}create(t,e){const n=t.create(this.#t.sliceMap);return n.set(e),n}get(t){return this.#t.get(t).get()}remove(t){return this.#t.remove(t)}call(t,e){if(this.#e==null)throw Yy();const n=this.get(t)(e),i=this.#e.get(Sn);return n(i.state,i.dispatch,i)}inline(t){if(this.#e==null)throw Yy();const e=this.#e.get(Sn);return t(e.state,e.dispatch,e)}};function kV(t="cmdKey"){return st((()=>()=>!1),t)}var xt=st(new ZO,"commands"),O1=st([qn],"commandsTimer"),qf=Hr("CommandsReady"),e3=t=>{const e=new ZO;return e.setCtx(t),t.inject(xt,e).inject(O1,[qn]).record(qf),async()=>(await t.waitTimers(O1),t.done(qf),()=>{t.remove(xt).remove(O1).clearTimer(qf)})};Ls(e3,{displayName:"Commands"});function vV(t){return t.Backspace=Vu(nB,oS,E8,BM),t}var t3=class{constructor(){this.setCtx=t=>{this.#t=t},this.add=t=>(this.#e.push(t),()=>{this.#e=this.#e.filter(e=>e!==t)}),this.addObjectKeymap=t=>{const e=[];return Object.entries(t).forEach(([n,i])=>{if(typeof i=="function"){const r={key:n,onRun:()=>i};this.#e.push(r),e.push(()=>{this.#e=this.#e.filter(s=>s!==r)})}else this.#e.push(i),e.push(()=>{this.#e=this.#e.filter(r=>r!==i)})}),()=>{e.forEach(n=>n())}},this.addBaseKeymap=()=>{const t=vV($8);return this.addObjectKeymap(t)},this.build=()=>{const t={};return this.#e.forEach(e=>{t[e.key]=[...t[e.key]||[],e]}),Object.fromEntries(Object.entries(t).map(([e,n])=>{const i=n.sort((s,o)=>(o.priority??50)-(s.priority??50));return[e,(s,o,u)=>{const c=this.#t;if(c==null)throw hg();return Vu(...i.map(h=>h.onRun(c)))(s,o,u)}]}))}}#t=null;#e=[];get ctx(){return this.#t}},Im=st(new t3,"keymap"),R1=st([qn],"keymapTimer"),Kf=Hr("KeymapReady"),CV=t=>{const e=new t3;return e.setCtx(t),t.inject(Im,e).inject(R1,[qn]).record(Kf),async()=>(await t.waitTimers(R1),t.done(Kf),()=>{t.remove(Im).remove(R1).clearTimer(Kf)})},Qd=Hr("ParserReady"),n3=(()=>{throw hg()}),Gf=st(n3,"parser"),D1=st([],"parserTimer"),i3=t=>(t.inject(Gf,n3).inject(D1,[qn]).record(Qd),async()=>{await t.waitTimers(D1);const e=t.get($o),n=t.get(Ms);return t.set(Gf,NB.create(n,e)),t.done(Qd),()=>{t.remove(Gf).remove(D1).clearTimer(Qd)}});Ls(i3,{displayName:"Parser"});var Yf=Hr("SerializerReady"),I1=st([],"serializerTimer"),r3=(()=>{throw hg()}),Wd=st(r3,"serializer"),s3=t=>(t.inject(Wd,r3).inject(I1,[qn]).record(Yf),async()=>{await t.waitTimers(I1);const e=t.get($o),n=t.get(Ms);return t.set(Wd,TB.create(n,e)),t.done(Yf),()=>{t.remove(Wd).remove(I1).clearTimer(Yf)}});Ls(s3,{displayName:"Serializer"});var Xf=st("","defaultValue"),Zd=st(t=>t,"stateOptions"),_1=st([],"editorStateTimer"),em=Hr("EditorStateReady");function wV(t,e,n){if(typeof t=="string")return e(t);if(t.type==="html")return Pa.fromSchema(n).parse(t.dom);if(t.type==="json")return As.fromJSON(n,t.value);throw O4(t)}var EV=new fi("MILKDOWN_STATE_TRACKER"),a3=t=>(t.inject(Xf,"").inject(Sf,{}).inject(Zd,e=>e).inject(_1,[Qd,Yf,qf,Kf]).record(em),async()=>{await t.waitTimers(_1);const e=t.get(Ms),n=t.get(Gf),i=t.get(yh),r=t.get(Zd),s=t.get(Ds),o=wV(t.get(Xf),n,e),u=t.get(Im),c=u.addBaseKeymap(),h=[...s,new ci({key:EV,state:{init:()=>{},apply:(y,b,v,E)=>{t.set(Sf,E)}}}),cB({rules:i}),wB(u.build())];t.set(Ds,h);const m=r({schema:e,doc:o,plugins:h}),g=Ro.create(m);return t.set(Sf,g),t.done(em),()=>{c(),t.remove(Xf).remove(Sf).remove(Zd).remove(_1).clearTimer(em)}});Ls(a3,{displayName:"EditorState"});var kh=st([],"pasteRule"),z1=st([qn],"pasteRuleTimer"),tm=Hr("PasteRuleReady"),o3=t=>(t.inject(kh,[]).inject(z1,[qn]).record(tm),async()=>(await t.waitTimers(z1),t.done(tm),()=>{t.remove(kh).remove(z1).clearTimer(tm)}));Ls(o3,{displayName:"PasteRule"});var nm=Hr("EditorViewReady"),L1=st([],"editorViewTimer"),B1=st({},"editorViewOptions"),Qf=st(null,"root"),ib=st(null,"rootDOM"),rb=st({},"rootAttrs");function NV(t,e){const n=document.createElement("div");n.className="milkdown",t.appendChild(n),e.set(ib,n);const i=e.get(rb);return Object.entries(i).forEach(([r,s])=>n.setAttribute(r,s)),n}function AV(t){t.classList.add("editor"),t.setAttribute("role","textbox")}var TV=new fi("MILKDOWN_VIEW_CLEAR"),l3=t=>(t.inject(Qf,document.body).inject(Sn,{}).inject(B1,{}).inject(ib,null).inject(rb,{}).inject(L1,[em,tm]).record(nm),async()=>{await t.wait(Uo);const e=t.get(Qf)||document.body,n=typeof e=="string"?document.querySelector(e):e;t.update(Ds,o=>[new ci({key:TV,view:u=>{const c=n?NV(n,t):void 0;return(()=>{if(c&&n){const m=u.dom;n.replaceChild(c,m),c.appendChild(m)}})(),{destroy:()=>{c?.parentNode&&c?.parentNode.replaceChild(u.dom,c),c?.remove()}}}}),...o]),await t.waitTimers(L1);const i=t.get(Sf),r=t.get(B1),s=new XO(n,{state:i,nodeViews:Object.fromEntries(t.get(bh)),markViews:Object.fromEntries(t.get(Sh)),transformPasted:(o,u,c)=>(t.get(kh).sort((h,m)=>(m.priority??50)-(h.priority??50)).map(h=>h.run).forEach(h=>{o=h(o,u,c)}),o),...r});return AV(s.dom),t.set(Sn,s),t.done(nm),()=>{s?.destroy(),t.remove(Qf).remove(Sn).remove(B1).remove(ib).remove(rb).remove(L1).clearTimer(nm)}});Ls(l3,{displayName:"EditorView"});var Ji=(function(t){return t.Idle="Idle",t.OnCreate="OnCreate",t.Created="Created",t.OnDestroy="OnDestroy",t.Destroyed="Destroyed",t})({}),u3=class c3{constructor(){this.enableInspector=(e=!0)=>(this.#t=e,this),this.onStatusChange=e=>(this.#n=e,this),this.config=e=>(this.#i.push(e),this),this.removeConfig=e=>(this.#i=this.#i.filter(n=>n!==e),this),this.use=e=>{const n=[e].flat();return n.flat().forEach(i=>{this.#r.set(i,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#e===Ji.Created&&this.#c(n,this.#r),this},this.remove=async e=>this.#e===Ji.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(n=>{setTimeout(()=>{n(this.remove(e))},50)})):(await this.#f([e].flat(),!0),this),this.create=async()=>this.#e===Ji.OnCreate?this:(this.#e===Ji.Created&&await this.destroy(),this.#u(Ji.OnCreate),this.#p(),this.#c([...this.#r.keys()],this.#r),await Promise.all([this.#h(this.#a),this.#h(this.#r)].flat()),this.#u(Ji.Created),this),this.destroy=async(e=!1)=>this.#e===Ji.Destroyed||this.#e===Ji.OnDestroy?this:this.#e===Ji.OnCreate?new Promise(n=>{setTimeout(()=>{n(this.destroy(e))},50)}):(e&&(this.#i=[]),this.#u(Ji.OnDestroy),await this.#f([...this.#r.keys()],e),await this.#d(),this.#u(Ji.Destroyed),this),this.action=e=>e(this.#l),this.inspect=()=>this.#t?[...this.#a.values(),...this.#r.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new c3}#t=!1;#e=Ji.Idle;#i=[];#n=()=>{};#o=new dT;#s=new $4;#r=new Map;#a=new Map;#l=new j4(this.#o,this.#s);#p=()=>{const e=bV(async i=>{await Promise.all(this.#i.map(r=>Promise.resolve(r(i))))}),n=[WO,i3,s3,e3,CV,o3,a3,l3,SV(this),e];this.#c(n,this.#a)};#c=(e,n)=>{e.forEach(i=>{const r=this.#l.produce(this.#t?i.meta:void 0),s=i(r);n.set(i,{ctx:r,handler:s,cleanup:void 0})})};#f=(e,n=!1)=>Promise.all([e].flat().map(async i=>{const r=this.#r.get(i)?.cleanup;return n?this.#r.delete(i):this.#r.set(i,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof r=="function"?r():r}));#d=async()=>{await Promise.all([...this.#a.entries()].map(async([e,{cleanup:n}])=>typeof n=="function"?n():n)),this.#a.clear()};#u=e=>{this.#e=e,this.#n(e)};#h=e=>[...e.entries()].map(async([n,i])=>{const{ctx:r,handler:s}=i;if(!s)return;const o=await s();e.set(n,{ctx:r,handler:s,cleanup:o})});get ctx(){return this.#l}get status(){return this.#e}};function Je(t,e){const n=kV(t),i=r=>async()=>{i.key=n,await r.wait(qf);const s=e(r);return r.get(xt).create(n,s),i.run=o=>r.get(xt).call(t,o),()=>{r.get(xt).remove(n)}};return i}function hi(t){const e=n=>async()=>{await n.wait(qn);const i=t(n);return n.update(yh,r=>[...r,i]),e.inputRule=i,()=>{n.update(yh,r=>r.filter(s=>s!==i))}};return e}function MV(t){const e=n=>async()=>{await n.wait(qn);const i=t(n);return n.update(kh,r=>[...r,i]),e.pasteRule=i,()=>{n.update(kh,r=>r.filter(s=>s!==i))}};return e}function OV(t,e){const n=i=>async()=>{const r=e(i);return i.update(Hf,s=>[...s.filter(o=>o[0]!==t),[t,r]]),n.id=t,n.schema=r,()=>{i.update(Hf,s=>s.filter(([o])=>o!==t))}};return n.type=i=>{const r=i.get(Ms).marks[t];if(!r)throw B4(t);return r},n}function Kh(t,e){const n=i=>async()=>{const r=e(i);return i.update(Jf,s=>[...s.filter(o=>o[0]!==t),[t,r]]),n.id=t,n.schema=r,()=>{i.update(Jf,s=>s.filter(([o])=>o!==t))}};return n.type=i=>{const r=i.get(Ms).nodes[t];if(!r)throw L4(t);return r},n}function Bs(t){let e;const n=i=>async()=>(await i.wait(qn),e=t(i),i.update(Ds,r=>[...r,e]),()=>{i.update(Ds,r=>r.filter(s=>s!==e))});return n.plugin=()=>e,n.key=()=>e.spec.key,n}function RV(t){const e=n=>async()=>{await n.wait(Kf);const i=n.get(Im),r=t(n),s=i.addObjectKeymap(r);return e.keymap=r,()=>{s()}};return e}function DV(t,e){const n=i=>async()=>{await i.wait(qn);const r=e(i);return t.type(i)instanceof Em?i.update(bh,s=>[...s,[t.id,r]]):i.update(Sh,s=>[...s,[t.id,r]]),n.view=r,n.type=t,()=>{t.type(i)instanceof Em?i.update(bh,s=>s.filter(o=>o[0]!==t.id)):i.update(Sh,s=>s.filter(o=>o[0]!==t.id))}};return n}function Ya(t,e){const n=st(t,e),i=r=>(r.inject(n),()=>()=>{r.remove(n)});return i.key=n,i}function en(t,e){const n=Ya(e,t),i=Kh(t,s=>s.get(n.key)(s)),r=[n,i];return r.id=i.id,r.node=i,r.type=s=>i.type(s),r.ctx=n,r.key=n.key,r.extendSchema=s=>en(t,s(e)),r}function Fu(t,e){const n=Ya(e,t),i=OV(t,s=>s.get(n.key)(s)),r=[n,i];return r.id=i.id,r.mark=i,r.type=s=>i.type(s),r.ctx=n,r.key=n.key,r.extendSchema=s=>Fu(t,s(e)),r}function Ti(t,e){const n=Ya(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:o,priority:u}])=>[s,{shortcuts:o,priority:u}])),`${t}Keymap`),i=RV(s=>{const o=s.get(n.key),u=Object.entries(e).flatMap(([c,{command:h}])=>{const m=o[c],g=[m.shortcuts].flat(),y=m.priority;return g.map(b=>[b,{key:b,onRun:h,priority:y}])});return Object.fromEntries(u)}),r=[n,i];return r.ctx=n,r.shortcuts=i,r.key=n.key,r.keymap=i.keymap,r}var Er=(t,e=()=>({}))=>Ya(e,`${t}Attr`),Gh=(t,e=()=>({}))=>Ya(e,`${t}Attr`);function Xa(t,e,n){const i=Ya({},t),r=o=>async()=>{await o.wait(Uo);const u={plugin:e(o),options:o.get(i.key)};return o.update(xh,c=>[...c,u]),()=>{o.update(xh,c=>c.filter(h=>h!==u))}},s=[i,r];return s.id=t,s.plugin=r,s.options=i,s}function Ma(t,e){return n=>n.get(xt).call(t,e)}function f3(t,e=!1){return n=>{const i=n.get(Sn),r=n.get(Gf)(t);if(!r)return;if(!e){const{state:c}=i;return i.dispatch(c.tr.replace(0,c.doc.content.size,new H(r.content,0,0)))}const s=n.get(Ms),o=n.get(Zd)({schema:s,doc:r,plugins:n.get(Ds)}),u=Ro.create(o);i.updateState(u)}}const h3=65535,p3=Math.pow(2,16);function IV(t,e){return t+e*p3}function bN(t){return t&h3}function _V(t){return(t-(t&h3))/p3}const d3=1,m3=2,im=4,g3=8;let SN=class{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&g3)>0}get deletedBefore(){return(this.delInfo&(d3|im))>0}get deletedAfter(){return(this.delInfo&(m3|im))>0}get deletedAcross(){return(this.delInfo&im)>0}},sl=class hu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&hu.empty)return hu.empty}recover(e){let n=0,i=bN(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+_V(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:IV(u/3,e-c),E=e==c?m3:e==g?d3:im;return(n<0?e!=c:e!=g)&&(E|=g3),new SN(b,E,v)}r+=m-h}return i?e+r:new SN(e+r,0,null)}touches(e,n){let i=0,r=bN(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new hu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?hu.empty:new hu(e<0?[0,-e,0]:[0,0,e])}};sl.empty=new sl([]);const V1=Object.create(null);let Nn=class{getMap(){return sl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=V1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in V1)throw new RangeError("Duplicate use of step JSON ID "+e);return V1[e]=n,n.prototype.jsonID=e,n}},$n=class kf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new kf(e,null)}static fail(e){return new kf(null,e)}static fromReplace(e,n,i,r){try{return kf.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return kf.fail(s.message);throw s}}};function CS(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(CS(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}let y3=class vf extends Nn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(CS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return $n.fromReplace(e,this.from,this.to,s)}invert(){return new x3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new vf(n.pos,i.pos,this.mark)}merge(e){return e instanceof vf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new vf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new vf(n.from,n.to,e.markFromJSON(n.mark))}};Nn.jsonID("addMark",y3);let x3=class Cf extends Nn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(CS(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return $n.fromReplace(e,this.from,this.to,i)}invert(){return new y3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Cf(n.pos,i.pos,this.mark)}merge(e){return e instanceof Cf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Cf(n.from,n.to,e.markFromJSON(n.mark))}};Nn.jsonID("removeMark",x3);let b3=class wf extends Nn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return $n.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return $n.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new wf(this.pos,n.marks[r]);return new wf(this.pos,this.mark)}}return new S3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new wf(n.pos,e.markFromJSON(n.mark))}};Nn.jsonID("addNodeMark",b3);let S3=class sb extends Nn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return $n.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return $n.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new b3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new sb(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new sb(n.pos,e.markFromJSON(n.mark))}};Nn.jsonID("removeNodeMark",S3);let zV=class Ao extends Nn{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&ab(e,this.from,this.to)?$n.fail("Structure replace would overwrite content"):$n.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new sl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ao(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Ao(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ao)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ao(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ao(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ao(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Nn.jsonID("replace",zV);let Cg=class rm extends Nn{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(ab(e,this.from,this.gapFrom)||ab(e,this.gapTo,this.to)))return $n.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return $n.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?$n.fromReplace(e,this.from,this.to,i):$n.fail("Content does not fit in gap")}getMap(){return new sl([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new rm(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new rm(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new rm(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Nn.jsonID("replaceAround",Cg);function ab(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function LV(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function BV(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth,r=0,s=0;;--i){let o=t.$from.node(i),u=t.$from.index(i)+r,c=t.$to.indexAfter(i)-s;if(i<t.depth&&o.canReplace(u,c,n))return i;if(i==0||o.type.spec.isolating||!LV(o,u,c))break;u&&(r=1),c<o.childCount&&(s=1)}return null}function VV(t,e,n=1,i){let r=t.resolve(e),s=r.depth-n,o=i&&i[i.length-1]||r.parent;if(s<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!o.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let h=r.depth-1,m=n-2;h>s;h--,m--){let g=r.node(h),y=r.index(h);if(g.type.spec.isolating)return!1;let b=g.content.cutByIndex(y,g.childCount),v=i&&i[m+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let E=i&&i[m]||g;if(!g.canReplace(y+1,g.childCount)||!E.type.validContent(b))return!1}let u=r.indexAfter(s),c=i&&i[0];return r.node(s).canReplaceWith(u,u,c?c.type:r.node(s+1).type)}function FV(t,e){let n=t.resolve(e),i=n.index();return jV(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function PV(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:i}=t.type.schema;for(let r=0;r<e.childCount;r++){let s=e.child(r),o=s.type==i?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function jV(t,e){return!!(t&&e&&!t.isLeaf&&PV(t,e))}let $V=class sm extends Nn{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return $n.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return $n.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return sl.empty}invert(e){return new sm(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new sm(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new sm(n.pos,n.attr,n.value)}};Nn.jsonID("attr",$V);let UV=class ob extends Nn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return $n.ok(i)}getMap(){return sl.empty}invert(e){return new ob(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ob(n.attr,n.value)}};Nn.jsonID("docAttr",UV);let vh=class extends Error{};vh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};vh.prototype=Object.create(Error.prototype);vh.prototype.constructor=vh;vh.prototype.name="TransformError";function JV(t,e){return function(n,i){let{$from:r,$to:s,node:o}=n.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(s))return!1;let u=r.node(-1);if(u.type!=t)return!1;if(r.parent.content.size==0&&r.node(-1).childCount==r.indexAfter(-1)){if(r.depth==3||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(i){let g=G.empty,y=r.index(-1)?1:r.index(-2)?2:3;for(let M=r.depth-y;M>=r.depth-3;M--)g=G.from(r.node(M).copy(g));let b=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;g=g.append(G.from(t.createAndFill()));let v=r.before(r.depth-(y-1)),E=n.tr.replace(v,r.after(-b),new H(g,4-y,0)),T=-1;E.doc.nodesBetween(v,E.doc.content.size,(M,j)=>{if(T>-1)return!1;M.isTextblock&&M.content.size==0&&(T=j+1)}),T>-1&&E.setSelection(Ve.near(E.doc.resolve(T))),i(E.scrollIntoView())}return!0}let c=s.pos==r.end()?u.contentMatchAt(0).defaultType:null,h=n.tr.delete(r.pos,s.pos),m=c?[null,{type:c}]:void 0;return VV(h.doc,r.pos,2,m)?(i&&i(h.split(r.pos,2,m).scrollIntoView()),!0):!1}}function HV(t){return function(e,n){let{$from:i,$to:r}=e.selection,s=i.blockRange(r,o=>o.childCount>0&&o.firstChild.type==t);return s?n?i.node(s.depth-1).type==t?qV(e,n,t,s):KV(e,n,s):!0:!1}}function qV(t,e,n,i){let r=t.tr,s=i.end,o=i.$to.end(i.depth);s<o&&(r.step(new Cg(s-1,o,s,o,new H(G.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new QT(r.doc.resolve(i.$from.pos),r.doc.resolve(o),i.depth));const u=BV(i);if(u==null)return!1;r.lift(i,u);let c=r.doc.resolve(r.mapping.map(s,-1)-1);return FV(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function KV(t,e,n){let i=t.tr,r=n.parent;for(let b=n.end,v=n.endIndex-1,E=n.startIndex;v>E;v--)b-=r.child(v).nodeSize,i.delete(b-1,b+1);let s=i.doc.resolve(n.start),o=s.nodeAfter;if(i.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let u=n.startIndex==0,c=n.endIndex==r.childCount,h=s.node(-1),m=s.index(-1);if(!h.canReplace(m+(u?0:1),m+1,o.content.append(c?G.empty:G.from(r))))return!1;let g=s.pos,y=g+o.nodeSize;return i.step(new Cg(g-(u?1:0),y+(c?1:0),g+1,y-1,new H((u?G.empty:G.from(r.copy(G.empty))).append(c?G.empty:G.from(r.copy(G.empty))),u?0:1,c?0:1),u?0:1)),e(i.scrollIntoView()),!0}function GV(t){return function(e,n){let{$from:i,$to:r}=e.selection,s=i.blockRange(r,h=>h.childCount>0&&h.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let u=s.parent,c=u.child(o-1);if(c.type!=t)return!1;if(n){let h=c.lastChild&&c.lastChild.type==u.type,m=G.from(h?t.create():null),g=new H(G.from(t.create(null,G.from(u.type.create(null,m)))),h?3:1,0),y=s.start,b=s.end;n(e.tr.step(new Cg(y-(h?3:1),b,y,b,g,1,!0)).scrollIntoView())}return!0}}const k3=65535,v3=Math.pow(2,16);function YV(t,e){return t+e*v3}function kN(t){return t&k3}function XV(t){return(t-(t&k3))/v3}const C3=1,w3=2,am=4,E3=8;let vN=class{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&E3)>0}get deletedBefore(){return(this.delInfo&(C3|am))>0}get deletedAfter(){return(this.delInfo&(w3|am))>0}get deletedAcross(){return(this.delInfo&am)>0}},al=class pu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pu.empty)return pu.empty}recover(e){let n=0,i=kN(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+XV(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:YV(u/3,e-c),E=e==c?w3:e==g?C3:am;return(n<0?e!=c:e!=g)&&(E|=E3),new vN(b,E,v)}r+=m-h}return i?e+r:new vN(e+r,0,null)}touches(e,n){let i=0,r=kN(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new pu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?pu.empty:new pu(e<0?[0,-e,0]:[0,0,e])}};al.empty=new al([]);const F1=Object.create(null);let An=class{getMap(){return al.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=F1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in F1)throw new RangeError("Duplicate use of step JSON ID "+e);return F1[e]=n,n.prototype.jsonID=e,n}},Un=class Ef{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ef(e,null)}static fail(e){return new Ef(null,e)}static fromReplace(e,n,i,r){try{return Ef.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return Ef.fail(s.message);throw s}}};function wS(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(wS(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}let ES=class Nf extends An{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(wS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return Un.fromReplace(e,this.from,this.to,s)}invert(){return new N3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Nf(n.pos,i.pos,this.mark)}merge(e){return e instanceof Nf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Nf(n.from,n.to,e.markFromJSON(n.mark))}};An.jsonID("addMark",ES);let N3=class Af extends An{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(wS(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Un.fromReplace(e,this.from,this.to,i)}invert(){return new ES(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Af(n.pos,i.pos,this.mark)}merge(e){return e instanceof Af&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Af(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Af(n.from,n.to,e.markFromJSON(n.mark))}};An.jsonID("removeMark",N3);let A3=class Tf extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Un.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Un.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new Tf(this.pos,n.marks[r]);return new Tf(this.pos,this.mark)}}return new T3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Tf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Tf(n.pos,e.markFromJSON(n.mark))}};An.jsonID("addNodeMark",A3);let T3=class lb extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Un.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Un.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new A3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lb(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new lb(n.pos,e.markFromJSON(n.mark))}};An.jsonID("removeNodeMark",T3);let NS=class va extends An{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&ub(e,this.from,this.to)?Un.fail("Structure replace would overwrite content"):Un.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new al([this.from,this.to-this.from,this.slice.size])}invert(e){return new va(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),i=this.from==this.to&&va.MAP_BIAS<0?n:e.mapResult(this.from,1);return i.deletedAcross&&n.deletedAcross?null:new va(i.pos,Math.max(i.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof va)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new va(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new va(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new va(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};NS.MAP_BIAS=1;An.jsonID("replace",NS);let QV=class om extends An{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(ub(e,this.from,this.gapFrom)||ub(e,this.gapTo,this.to)))return Un.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Un.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?Un.fromReplace(e,this.from,this.to,i):Un.fail("Content does not fit in gap")}getMap(){return new al([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new om(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new om(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new om(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};An.jsonID("replaceAround",QV);function ub(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function WV(t,e,n=null,i=t){let r=ZV(t,e),s=r&&eF(i,e);return s?r.map(CN).concat({type:e,attrs:n}).concat(s.map(CN)):null}function CN(t){return{type:t,attrs:null}}function ZV(t,e){let{parent:n,startIndex:i,endIndex:r}=t,s=n.contentMatchAt(i).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(i,r,o)?s:null}function eF(t,e){let{parent:n,startIndex:i,endIndex:r}=t,s=n.child(i),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=i;c&&h<r;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}let tF=class lm extends An{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return Un.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return Un.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return al.empty}invert(e){return new lm(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lm(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new lm(n.pos,n.attr,n.value)}};An.jsonID("attr",tF);let nF=class cb extends An{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return Un.ok(i)}getMap(){return al.empty}invert(e){return new cb(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new cb(n.attr,n.value)}};An.jsonID("docAttr",nF);let Ch=class extends Error{};Ch=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ch.prototype=Object.create(Error.prototype);Ch.prototype.constructor=Ch;Ch.prototype.name="TransformError";function AS(t,e,n,i){let r,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,r=n):(s=e,o=n,r=i),Bu(t,s,u,r);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function iF(t,e,n,i){let r,s,o;s=e,o=n,r=i,Bu(t,s,u,r);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function rF(t){const e=new Map;if(!t||!t.type)throw new Error("mdast-util-definitions expected node");return iF(t,"definition",function(i){const r=wN(i.identifier);r&&!e.get(r)&&e.set(r,i)}),n;function n(i){const r=wN(i);return e.get(r)}}function wN(t){return String(t||"").toUpperCase()}function sF(t,e,n,i){let r,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,r=n):(s=e,o=n,r=i),Bu(t,s,u,r);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function aF(){return function(t){const e=rF(t);sF(t,function(n,i,r){if(n.type==="definition"&&r!==void 0&&typeof i=="number")return r.children.splice(i,1),[vx,i];if(n.type==="imageReference"||n.type==="linkReference"){const s=e(n.identifier);if(s&&r&&typeof i=="number")return r.children[i]=n.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:n.alt}:{type:"link",url:s.url,title:s.title,children:n.children},[vx,i]}})}}function M3(t,e){if(!(e.childCount>=1&&e.lastChild?.type.name==="hardbreak")){t.next(e.content);return}const n=[];e.content.forEach((i,r,s)=>{s!==e.childCount-1&&n.push(i)}),t.next(G.fromArray(n))}function ue(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-commonmark",...e}}),t}var TS=Gh("emphasis");ue(TS,{displayName:"Attr<emphasis>",group:"Emphasis"});var Pu=Fu("emphasis",t=>({attrs:{marker:{default:t.get(Uf).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",t.get(TS.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,n,i)=>{e.openMark(i,{marker:n.marker}),e.next(n.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,n)=>{e.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));ue(Pu.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});ue(Pu.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var wg=Je("ToggleEmphasis",t=>()=>bg(Pu.type(t)));ue(wg,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var O3=hi(t=>Uh(/(?:^|[^*])\*([^*]+)\*$/,Pu.type(t),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:n+1}}));ue(O3,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var R3=hi(t=>Uh(/\b_(?![_\s])(.*?[^_\s])_\b/,Pu.type(t),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:n+1}}));ue(R3,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var MS=Ti("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:t=>{const e=t.get(xt);return()=>e.call(wg.key)}}});ue(MS.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});ue(MS.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var OS=Gh("strong");ue(OS,{displayName:"Attr<strong>",group:"Strong"});var Yh=Fu("strong",t=>({attrs:{marker:{default:t.get(Uf).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",t.get(OS.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,n,i)=>{e.openMark(i,{marker:n.marker}),e.next(n.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,n)=>{e.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));ue(Yh.mark,{displayName:"MarkSchema<strong>",group:"Strong"});ue(Yh.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var Eg=Je("ToggleStrong",t=>()=>bg(Yh.type(t)));ue(Eg,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var D3=hi(t=>Uh(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),Yh.type(t),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));ue(D3,{displayName:"InputRule<strong>",group:"Strong"});var RS=Ti("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:t=>{const e=t.get(xt);return()=>e.call(Eg.key)}}});ue(RS.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});ue(RS.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var DS=Gh("inlineCode");ue(DS,{displayName:"Attr<inlineCode>",group:"InlineCode"});var Da=Fu("inlineCode",t=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",t.get(DS.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,n,i)=>{e.openMark(i),e.addText(n.value),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,n,i)=>(e.withMark(n,"inlineCode",i.text||""),!0)}}));ue(Da.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});ue(Da.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var IS=Je("ToggleInlineCode",t=>()=>(e,n)=>{const{selection:i,tr:r}=e;if(i.empty)return!1;const{from:s,to:o}=i;return e.doc.rangeHasMark(s,o,Da.type(t))?(n?.(r.removeMark(s,o,Da.type(t))),!0):(Object.keys(e.schema.marks).filter(u=>u!==Da.type.name).map(u=>e.schema.marks[u]).forEach(u=>{r.removeMark(s,o,u)}),n?.(r.addMark(s,o,Da.type(t).create())),!0)});ue(IS,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var I3=hi(t=>Uh(/(?:`)([^`]+)(?:`)$/,Da.type(t)));ue(I3,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var _S=Ti("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:t=>{const e=t.get(xt);return()=>e.call(IS.key)}}});ue(_S.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});ue(_S.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var zS=Gh("link");ue(zS,{displayName:"Attr<link>",group:"Link"});var wu=Fu("link",t=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Jr(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...t.get(zS.key)(e),...e.attrs}],parseMarkdown:{match:e=>e.type==="link",runner:(e,n,i)=>{const r=n.url,s=n.title;e.openMark(i,{href:r,title:s}),e.next(n.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,n)=>{e.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));ue(wu.mark,{displayName:"MarkSchema<link>",group:"Link"});var LS=Je("ToggleLink",t=>(e={})=>bg(wu.type(t),e));ue(LS,{displayName:"Command<toggleLinkCommand>",group:"Link"});var BS=Je("UpdateLink",t=>(e={})=>(n,i)=>{if(!i)return!1;let r,s=-1;const{selection:o}=n,{from:u,to:c}=o;if(n.doc.nodesBetween(u,u===c?c+1:c,(v,E)=>{if(wu.type(t).isInSet(v.marks))return r=v,s=E,!1}),!r)return!1;const h=r.marks.find(({type:v})=>v===wu.type(t));if(!h)return!1;const m=s,g=s+r.nodeSize,{tr:y}=n,b=wu.type(t).create({...h.attrs,...e});return b?(i(y.removeMark(m,g,h).addMark(m,g,b).setSelection(new Ee(y.selection.$anchor)).scrollIntoView()),!0):!1});ue(BS,{displayName:"Command<updateLinkCommand>",group:"Link"});var _3=Kh("doc",()=>({content:"block+",parseMarkdown:{match:({type:t})=>t==="root",runner:(t,e,n)=>{t.injectRoot(e,n)}},toMarkdown:{match:t=>t.type.name==="doc",runner:(t,e)=>{t.openNode("root"),t.next(e.content)}}}));ue(_3,{displayName:"NodeSchema<doc>",group:"Doc"});function oF(t){return Bu(t,e=>e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,n)=>{if(!n.length)return;const i=n[n.length-1];if(!i)return;const r=i.children.indexOf(e);r!==-1&&i.children.splice(r,1)},!0)}var Ng=Xa("remark-preserve-empty-line",()=>()=>oF);ue(Ng.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});ue(Ng.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var VS=Er("paragraph");ue(VS,{displayName:"Attr<paragraph>",group:"Paragraph"});var Pr=en("paragraph",t=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",t.get(VS.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,n,i)=>{e.openNode(i),n.children?e.next(n.children):e.addText(n.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,n)=>{const i=t.get(Sn).state?.doc.lastChild;e.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==i&&lF(t)?e.addNode("html",void 0,"<br />"):M3(e,n),e.closeNode()}}}));function lF(t){let e=!1;try{t.get(Ng.id),e=!0}catch{e=!1}return e}ue(Pr.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});ue(Pr.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var FS=Je("TurnIntoText",t=>()=>fh(Pr.type(t)));ue(FS,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var PS=Ti("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:t=>{const e=t.get(xt);return()=>e.call(FS.key)}}});ue(PS.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});ue(PS.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var uF=Array(6).fill(0).map((t,e)=>e+1);function cF(t){return t.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var Ag=Ya(cF,"headingIdGenerator");ue(Ag,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var jS=Er("heading");ue(jS,{displayName:"Attr<heading>",group:"Heading"});var fl=en("heading",t=>{const e=t.get(Ag.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:uF.map(n=>({tag:`h${n}`,getAttrs:i=>{if(!(i instanceof HTMLElement))throw Jr(i);return{level:n,id:i.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...t.get(jS.key)(n),id:n.attrs.id||e(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,i,r)=>{const s=i.depth;n.openNode(r,{level:s}),n.next(i.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,i)=>{n.openNode("heading",void 0,{depth:i.attrs.level}),M3(n,i),n.closeNode()}}}});ue(fl.node,{displayName:"NodeSchema<heading>",group:"Heading"});ue(fl.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var z3=hi(t=>QM(/^(?<hashes>#+)\s$/,fl.type(t),e=>{const n=e.groups?.hashes?.length||0,{$from:i}=t.get(Sn).state.selection,r=i.node();if(r.type.name==="heading"){let s=Number(r.attrs.level)+Number(n);return s>6&&(s=6),{level:s}}return{level:n}}));ue(z3,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var Ea=Je("WrapInHeading",t=>e=>(e??=1,e<1?fh(Pr.type(t)):fh(fl.type(t),{level:e})));ue(Ea,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var $S=Je("DowngradeHeading",t=>()=>(e,n,i)=>{const{$from:r}=e.selection,s=r.node();if(s.type!==fl.type(t)||!e.selection.empty||r.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(n?.(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):fh(Pr.type(t))(e,n,i)});ue($S,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var US=Ti("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:t=>{const e=t.get(xt);return()=>e.call(Ea.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:t=>{const e=t.get(xt);return()=>e.call(Ea.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:t=>{const e=t.get(xt);return()=>e.call(Ea.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:t=>{const e=t.get(xt);return()=>e.call(Ea.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:t=>{const e=t.get(xt);return()=>e.call(Ea.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:t=>{const e=t.get(xt);return()=>e.call(Ea.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:t=>{const e=t.get(xt);return()=>e.call($S.key)}}});ue(US.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});ue(US.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var JS=Er("blockquote");ue(JS,{displayName:"Attr<blockquote>",group:"Blockquote"});var Xh=en("blockquote",t=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",t.get(JS.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,n,i)=>{e.openNode(i).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,n)=>{e.openNode("blockquote").next(n.content).closeNode()}}}));ue(Xh.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});ue(Xh.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var L3=hi(t=>hS(/^\s*>\s$/,Xh.type(t)));ue(L3,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var Tg=Je("WrapInBlockquote",t=>()=>cS(Xh.type(t)));ue(Tg,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var HS=Ti("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:t=>{const e=t.get(xt);return()=>e.call(Tg.key)}}});ue(HS.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});ue(HS.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var qS=Er("codeBlock",()=>({pre:{},code:{}}));ue(qS,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Qh=en("code_block",t=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Jr(e);return{language:e.dataset.language}}}],toDOM:e=>{const n=t.get(qS.key)(e),i=e.attrs.language,r=i&&i.length>0?{"data-language":i}:void 0;return["pre",{...n.pre,...r},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,n,i)=>{const r=n.lang??"",s=n.value;e.openNode(i,{language:r}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,n)=>{e.addNode("code",void 0,n.content.firstChild?.text||"",{lang:n.attrs.language})}}}));ue(Qh.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});ue(Qh.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var B3=hi(t=>QM(/^```(?<language>[a-z]*)?[\s\n]$/,Qh.type(t),e=>({language:e.groups?.language??""})));ue(B3,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var KS=Je("CreateCodeBlock",t=>(e="")=>fh(Qh.type(t),{language:e}));ue(KS,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var fF=Je("UpdateCodeBlockLanguage",()=>({pos:t,language:e}={pos:-1,language:""})=>(n,i)=>t>=0?(i?.(n.tr.setNodeAttribute(t,"language",e)),!0):!1);ue(fF,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var GS=Ti("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:t=>{const e=t.get(xt);return()=>e.call(KS.key)}}});ue(GS.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});ue(GS.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var YS=Er("image");ue(YS,{displayName:"Attr<image>",group:"Image"});var ju=en("image",t=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Jr(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...t.get(YS.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,n,i)=>{const r=n.url,s=n.alt,o=n.title;e.addNode(i,{src:r,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,n)=>{e.addNode("image",void 0,void 0,{title:n.attrs.title,url:n.attrs.src,alt:n.attrs.alt})}}}));ue(ju.node,{displayName:"NodeSchema<image>",group:"Image"});ue(ju.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var V3=Je("InsertImage",t=>(e={})=>(n,i)=>{if(!i)return!0;const{src:r="",alt:s="",title:o=""}=e,u=ju.type(t).create({src:r,alt:s,title:o});return u&&i(n.tr.replaceSelectionWith(u).scrollIntoView()),!0});ue(V3,{displayName:"Command<insertImageCommand>",group:"Image"});var F3=Je("UpdateImage",t=>(e={})=>(n,i)=>{const r=mB(n.selection,ju.type(t));if(!r)return!1;const{node:s,pos:o}=r,u={...s.attrs},{src:c,alt:h,title:m}=e;return c!==void 0&&(u.src=c),h!==void 0&&(u.alt=h),m!==void 0&&(u.title=m),i?.(n.tr.setNodeMarkup(o,void 0,u).scrollIntoView()),!0});ue(F3,{displayName:"Command<updateImageCommand>",group:"Image"});var hF=hi(t=>new Ai(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,n,i,r)=>{const[s,o,u="",c]=n;return s?e.tr.replaceWith(i,r,ju.type(t).create({src:u,alt:o,title:c})):null}));ue(hF,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var _m=Er("hardbreak",t=>({"data-type":"hardbreak","data-is-inline":t.attrs.isInline}));ue(_m,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var Jo=en("hardbreak",t=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",t.get(_m.key)(e)," "]:["br",t.get(_m.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,n,i)=>{e.addNode(i,{isInline:!!n.data?.isInline})}},leafText:()=>`
45
- `,toMarkdown:{match:e=>e.type.name==="hardbreak",runner:(e,n)=>{n.attrs.isInline?e.addNode("text",void 0,`
46
- `):e.addNode("break")}}}));ue(Jo.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});ue(Jo.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var XS=Je("InsertHardbreak",t=>()=>(e,n)=>{const{selection:i,tr:r}=e;if(!(i instanceof Ee))return!1;if(i.empty){const s=i.$from.node();if(s.childCount>0&&s.lastChild?.type.name==="hardbreak")return n?.(r.replaceRangeWith(i.to-1,i.to,e.schema.node("paragraph")).setSelection(Ve.near(r.doc.resolve(i.to))).scrollIntoView()),!0}return n?.(r.setMeta("hardbreak",!0).replaceSelectionWith(Jo.type(t).create()).scrollIntoView()),!0});ue(XS,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var QS=Ti("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:t=>{const e=t.get(xt);return()=>e.call(XS.key)}}});ue(QS.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});ue(QS.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var WS=Er("hr");ue(WS,{displayName:"Attr<hr>",group:"Hr"});var Wh=en("hr",t=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",t.get(WS.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,n,i)=>{e.addNode(i)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));ue(Wh.node,{displayName:"NodeSchema<hr>",group:"Hr"});ue(Wh.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var P3=hi(t=>new Ai(/^(?:---|___\s|\*\*\*\s)$/,(e,n,i,r)=>{const{tr:s}=e;return n[0]&&s.replaceWith(i-1,r,Wh.type(t).create()),s}));ue(P3,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var j3=Je("InsertHr",t=>()=>(e,n)=>{if(!n)return!0;const i=Pr.node.type(t).create(),{tr:r,selection:s}=e,{from:o}=s,u=Wh.type(t).create();if(!u)return!0;const c=r.replaceSelectionWith(u).insert(o,i),h=Ve.findFrom(c.doc.resolve(o),1,!0);return h&&n(c.setSelection(h).scrollIntoView()),!0});ue(j3,{displayName:"Command<insertHrCommand>",group:"Hr"});var ZS=Er("bulletList");ue(ZS,{displayName:"Attr<bulletList>",group:"BulletList"});var $u=en("bullet_list",t=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Jr(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...t.get(ZS.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:n})=>e==="list"&&!n,runner:(e,n,i)=>{const r=n.spread!=null?`${n.spread}`:"false";e.openNode(i,{spread:r}).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="bullet_list",runner:(e,n)=>{e.openNode("list",void 0,{ordered:!1,spread:n.attrs.spread}).next(n.content).closeNode()}}}));ue($u.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});ue($u.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var $3=hi(t=>hS(/^\s*([-+*])\s$/,$u.type(t)));ue($3,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var Mg=Je("WrapInBulletList",t=>()=>cS($u.type(t)));ue(Mg,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var ek=Ti("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:t=>{const e=t.get(xt);return()=>e.call(Mg.key)}}});ue(ek.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});ue(ek.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var tk=Er("orderedList");ue(tk,{displayName:"Attr<orderedList>",group:"OrderedList"});var Uu=en("ordered_list",t=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Jr(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...t.get(tk.key)(e),...e.attrs.order===1?{}:{start:e.attrs.order},"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:n})=>e==="list"&&!!n,runner:(e,n,i)=>{const r=n.spread!=null?`${n.spread}`:"true";e.openNode(i,{spread:r,order:n.start??1}).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="ordered_list",runner:(e,n)=>{e.openNode("list",void 0,{ordered:!0,start:n.attrs.order??1,spread:n.attrs.spread==="true"}),e.next(n.content),e.closeNode()}}}));ue(Uu.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});ue(Uu.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var U3=hi(t=>hS(/^\s*(\d+)\.\s$/,Uu.type(t),e=>({order:Number(e[1])}),(e,n)=>n.childCount+n.attrs.order===Number(e[1])));ue(U3,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var Og=Je("WrapInOrderedList",t=>()=>cS(Uu.type(t)));ue(Og,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var nk=Ti("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:t=>{const e=t.get(xt);return()=>e.call(Og.key)}}});ue(nk.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});ue(nk.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var ik=Er("listItem");ue(ik,{displayName:"Attr<listItem>",group:"ListItem"});var Vs=en("list_item",t=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Jr(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...t.get(ik.key)(e),"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e})=>e==="listItem",runner:(e,n,i)=>{const r=n.label!=null?`${n.label}.`:"•",s=n.label!=null?"ordered":"bullet",o=n.spread!=null?`${n.spread}`:"true";e.openNode(i,{label:r,listType:s,spread:o}),e.next(n.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="list_item",runner:(e,n)=>{e.openNode("listItem",void 0,{spread:n.attrs.spread}),e.next(n.content),e.closeNode()}}}));ue(Vs.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});ue(Vs.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var rk=Je("SinkListItem",t=>()=>GV(Vs.type(t)));ue(rk,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var Rg=Je("LiftListItem",t=>()=>HV(Vs.type(t)));ue(Rg,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var sk=Je("SplitListItem",t=>()=>JV(Vs.type(t)));ue(sk,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function pF(t){return(e,n,i)=>{const{selection:r}=e;if(!(r instanceof Ee))return!1;const{empty:s,$from:o}=r;return!s||o.parentOffset!==0||o.node(-1).type!==Vs.type(t)?!1:LM(e,n,i)}}var ak=Je("LiftFirstListItem",t=>()=>pF(t));ue(ak,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var ok=Ti("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:t=>{const e=t.get(xt);return()=>e.call(sk.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:t=>{const e=t.get(xt);return()=>e.call(rk.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:t=>{const e=t.get(xt);return()=>e.call(Rg.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:t=>{const e=t.get(xt);return()=>e.call(ak.key)}}});ue(ok.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});ue(ok.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var J3=Kh("text",()=>({group:"inline",parseMarkdown:{match:({type:t})=>t==="text",runner:(t,e)=>{t.addText(e.value)}},toMarkdown:{match:t=>t.type.name==="text",runner:(t,e)=>{t.addNode("text",void 0,e.text)}}}));ue(J3,{displayName:"NodeSchema<text>",group:"Text"});var lk=Er("html");ue(lk,{displayName:"Attr<html>",group:"Html"});var uk=en("html",t=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const n=document.createElement("span"),i={...t.get(lk.key)(e),"data-value":e.attrs.value,"data-type":"html"};return n.textContent=e.attrs.value,["span",i,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,n,i)=>{e.addNode(i,{value:n.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,n)=>{e.addNode("html",void 0,n.attrs.value)}}}));ue(uk.node,{displayName:"NodeSchema<html>",group:"Html"});ue(uk.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var dF=[_3,VS,Pr,Ag,jS,fl,_m,Jo,JS,Xh,qS,Qh,WS,Wh,YS,ju,ZS,$u,tk,Uu,ik,Vs,TS,Pu,OS,Yh,DS,Da,zS,wu,lk,uk,J3].flat(),mF=[L3,$3,U3,B3,P3,z3].flat(),gF=[O3,R3,I3,D3],yF=Je("IsMarkSelected",()=>t=>e=>{if(!t)return!1;const{doc:n,selection:i}=e;return n.rangeHasMark(i.from,i.to,t)}),xF=Je("IsNoteSelected",()=>t=>e=>t?gB(e,t).hasNode:!1),bF=Je("ClearTextInCurrentBlock",()=>()=>(t,e)=>{let n=t.tr;const{$from:i,$to:r}=n.selection,{pos:s}=i,{pos:o}=r,u=s-i.node().content.size;return u<0?!1:(n=n.deleteRange(u,o),e?.(n),!0)}),SF=Je("SetBlockType",()=>t=>(e,n)=>{const{nodeType:i,attrs:r=null}=t??{};if(!i)return!1;const s=e.tr,{from:o,to:u}=s.selection;try{s.setBlockType(o,u,i,r)}catch{return!1}return n?.(s),!0}),kF=Je("WrapInBlockType",()=>t=>(e,n)=>{const{nodeType:i,attrs:r=null}=t??{};if(!i)return!1;let s=e.tr;try{const{$from:o,$to:u}=s.selection,c=o.blockRange(u),h=c&&WV(c,i,r);if(!h)return!1;s=s.wrap(c,h)}catch{return!1}return n?.(s),!0}),vF=Je("AddBlockType",()=>t=>(e,n)=>{const{nodeType:i,attrs:r=null}=t??{};if(!i)return!1;const s=e.tr;try{const o=i instanceof As?i:i.createAndFill(r);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return n?.(s),!0}),CF=Je("SelectTextNearPos",()=>t=>(e,n)=>{const{pos:i}=t??{};if(i==null)return!1;const r=(o,u,c)=>Math.min(Math.max(o,u),c),s=e.tr;try{const o=e.doc.resolve(r(i,0,e.doc.content.size));s.setSelection(Ee.near(o))}catch{return!1}return n?.(s.scrollIntoView()),!0}),wF=[FS,Tg,Ea,$S,KS,XS,j3,V3,F3,Og,Mg,rk,sk,Rg,ak,wg,IS,Eg,LS,BS,yF,xF,bF,SF,kF,vF,CF],EF=[HS,GS,QS,US,ok,nk,ek,PS,MS,_S,RS].flat(),ck=Xa("remarkAddOrderInList",()=>()=>t=>{AS(t,"list",e=>{if(e.ordered){const n=e.start??1;e.children.forEach((i,r)=>{i.label=r+n})}})});ue(ck.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});ue(ck.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var fk=Xa("remarkLineBreak",()=>()=>t=>{const e=/[\t ]*(?:\r?\n|\r)/g;AS(t,"text",(n,i,r)=>{if(!n.value||typeof n.value!="string")return;const s=[];let o=0;e.lastIndex=0;let u=e.exec(n.value);for(;u;){const c=u.index;o!==c&&s.push({type:"text",value:n.value.slice(o,c)}),s.push({type:"break",data:{isInline:!0}}),o=c+u[0].length,u=e.exec(n.value)}if(s.length>0&&r&&typeof i=="number")return o<n.value.length&&s.push({type:"text",value:n.value.slice(o)}),r.children.splice(i,1,...s),i+s.length})});ue(fk.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});ue(fk.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var hk=Xa("remarkInlineLink",()=>aF);ue(hk.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});ue(hk.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var NF=t=>!!t.children,AF=t=>t.type==="html";function TF(t,e){return n(t,0,null)[0];function n(i,r,s){if(NF(i)){const o=[];for(let u=0,c=i.children.length;u<c;u++){const h=i.children[u];if(h){const m=n(h,u,i);if(m)for(let g=0,y=m.length;g<y;g++){const b=m[g];b&&o.push(b)}}}i.children=o}return e(i,r,s)}}var MF=["root","blockquote","listItem"],pk=Xa("remarkHTMLTransformer",()=>()=>t=>{TF(t,(e,n,i)=>AF(e)?(i&&MF.includes(i.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});ue(pk.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});ue(pk.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var dk=Xa("remarkMarker",()=>()=>(t,e)=>{const n=i=>e.value.charAt(i.position.start.offset);AS(t,i=>["strong","emphasis"].includes(i.type),i=>{i.marker=n(i)})});ue(dk.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});ue(dk.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var H3=Bs(()=>{let t=!1;const e=new ci({key:new fi("MILKDOWN_INLINE_NODES_CURSOR"),state:{init(){return!1},apply(n){if(!n.selection.empty)return!1;const i=n.selection.$from,r=i.nodeBefore,s=i.nodeAfter;return!!(r&&s&&r.isInline&&!r.isText&&s.isInline&&!s.isText)}},props:{handleDOMEvents:{compositionend:(n,i)=>t?(t=!1,requestAnimationFrame(()=>{if(e.getState(n.state)){const r=n.state.selection.from;i.preventDefault(),n.dispatch(n.state.tr.insertText(i.data||"",r))}}),!0):!1,compositionstart:n=>(e.getState(n.state)&&(t=!0),!1),beforeinput:(n,i)=>{if(e.getState(n.state)&&i instanceof InputEvent&&i.data&&!t){const r=n.state.selection.from;return i.preventDefault(),n.dispatch(n.state.tr.insertText(i.data||"",r)),!0}return!1}},decorations(n){if(e.getState(n)){const i=n.selection.$from.pos,r=document.createElement("span"),s=Ua.widget(i,r,{side:-1}),o=document.createElement("span"),u=Ua.widget(i,o);return setTimeout(()=>{r.contentEditable="true",o.contentEditable="true"}),nr.create(n.doc,[s,u])}return nr.empty}}});return e});ue(H3,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var q3=Bs(t=>new ci({key:new fi("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,n,i)=>{if(!e.length)return;const[r]=e;if(!r)return;const[s]=r.steps;if(r.getMeta("hardbreak")){if(!(s instanceof NS))return;const{from:o}=s;return i.tr.setNodeMarkup(o,Jo.type(t),void 0,[])}if(s instanceof ES){let o=i.tr;const{from:u,to:c}=s;return i.doc.nodesBetween(u,c,(h,m)=>{h.type===Jo.type(t)&&(o=o.setNodeMarkup(m,Jo.type(t),void 0,[]))}),o}}}));ue(q3,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var mk=Ya(["table","code_block"],"hardbreakFilterNodes");ue(mk,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var K3=Bs(t=>{const e=t.get(mk.key);return new ci({key:new fi("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,i)=>{const r=n.getMeta("hardbreak"),[s]=n.steps;if(r&&s){const{from:o}=s,u=i.doc.resolve(o);let c=u.depth,h=!0;for(;c>0;)e.includes(u.node(c).type.name)&&(h=!1),c--;return h}return!0}})});ue(K3,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var G3=Bs(t=>{const e=new fi("MILKDOWN_HEADING_ID"),n=i=>{if(i.composing)return;const r=t.get(Ag.key),s=i.state.tr.setMeta("addToHistory",!1);let o=!1;const u={};i.state.doc.descendants((c,h)=>{if(c.type===fl.type(t)){if(c.textContent.trim().length===0)return;const m=c.attrs;let g=r(c);u[g]?(u[g]+=1,g+=`-#${u[g]}`):u[g]=1,m.id!==g&&(o=!0,s.setMeta(e,!0).setNodeMarkup(h,void 0,{...m,id:g}))}}),o&&i.dispatch(s)};return new ci({key:e,view:i=>(n(i),{update:(r,s)=>{r.state.doc.eq(s.doc)||n(r)}})})});ue(G3,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var Y3=Bs(t=>{const e=(n,i,r)=>{if(!r.selection||n.some(g=>g.getMeta("addToHistory")===!1||!g.isGeneric))return null;const s=Uu.type(t),o=$u.type(t),u=Vs.type(t),c=(g,y,b=1)=>{let v=!1;const E=`${y+b}.`;return g.label!==E&&(g.label=E,v=!0),v};let h=r.tr,m=!1;return r.doc.descendants((g,y,b,v)=>{if(g.type===o){const E=g.maybeChild(0);E?.type===u&&E.attrs.listType==="ordered"&&(m=!0,h.setNodeMarkup(y,s,{spread:"true"}),g.descendants((T,M,j,F)=>{if(T.type===u){const J={...T.attrs};c(J,F)&&(h=h.setNodeMarkup(M,void 0,J))}return!1}))}else if(g.type===u&&b?.type===s){const E={...g.attrs};let T=!1;E.listType!=="ordered"&&(E.listType="ordered",T=!0),b?.maybeChild(0)&&(T=c(E,v,b?.attrs.order??1)),T&&(h=h.setNodeMarkup(y,void 0,E),m=!0)}}),m?h.setMeta("addToHistory",!1):null};return new ci({key:new fi("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});ue(Y3,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var OF=[q3,mk,K3,H3,ck,hk,fk,pk,dk,Ng,G3,Y3].flat(),X3=[dF,mF,gF,wF,EF,OF].flat();const Q3=65535,W3=Math.pow(2,16);function RF(t,e){return t+e*W3}function EN(t){return t&Q3}function DF(t){return(t-(t&Q3))/W3}const Z3=1,eR=2,um=4,tR=8;let fb=class{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&tR)>0}get deletedBefore(){return(this.delInfo&(Z3|um))>0}get deletedAfter(){return(this.delInfo&(eR|um))>0}get deletedAcross(){return(this.delInfo&um)>0}},ol=class du{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&du.empty)return du.empty}recover(e){let n=0,i=EN(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+DF(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:RF(u/3,e-c),E=e==c?eR:e==g?Z3:um;return(n<0?e!=c:e!=g)&&(E|=tR),new fb(b,E,v)}r+=m-h}return i?e+r:new fb(e+r,0,null)}touches(e,n){let i=0,r=EN(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new du(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?du.empty:new du(e<0?[0,-e,0]:[0,0,e])}};ol.empty=new ol([]);class zm{constructor(e,n,i=0,r=e?e.length:0){this.mirror=n,this.from=i,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new zm(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,i=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?i+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?i-r-1:void 0)}}invert(){let e=new zm;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let r=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],u=o.mapResult(e,n);if(u.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(u.recover);continue}}r|=u.delInfo,e=u.pos}return i?e:new fb(e,r,null)}}const P1=Object.create(null);let Tn=class{getMap(){return ol.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=P1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in P1)throw new RangeError("Duplicate use of step JSON ID "+e);return P1[e]=n,n.prototype.jsonID=e,n}},Jn=class Mf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Mf(e,null)}static fail(e){return new Mf(null,e)}static fromReplace(e,n,i,r){try{return Mf.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return Mf.fail(s.message);throw s}}};function gk(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(gk(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}let yk=class Of extends Tn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(gk(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return Jn.fromReplace(e,this.from,this.to,s)}invert(){return new Zh(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Of(n.pos,i.pos,this.mark)}merge(e){return e instanceof Of&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Of(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Of(n.from,n.to,e.markFromJSON(n.mark))}};Tn.jsonID("addMark",yk);let Zh=class Rf extends Tn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(gk(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Jn.fromReplace(e,this.from,this.to,i)}invert(){return new yk(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Rf(n.pos,i.pos,this.mark)}merge(e){return e instanceof Rf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Rf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Rf(n.from,n.to,e.markFromJSON(n.mark))}};Tn.jsonID("removeMark",Zh);let xk=class Df extends Tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new Df(this.pos,n.marks[r]);return new Df(this.pos,this.mark)}}return new Lm(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Df(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Df(n.pos,e.markFromJSON(n.mark))}};Tn.jsonID("addNodeMark",xk);let Lm=class hb extends Tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new xk(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hb(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new hb(n.pos,e.markFromJSON(n.mark))}};Tn.jsonID("removeNodeMark",Lm);let Ja=class To extends Tn{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&pb(e,this.from,this.to)?Jn.fail("Structure replace would overwrite content"):Jn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ol([this.from,this.to-this.from,this.slice.size])}invert(e){return new To(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new To(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof To)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new To(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new To(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new To(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Tn.jsonID("replace",Ja);let Ju=class cm extends Tn{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(pb(e,this.from,this.gapFrom)||pb(e,this.gapTo,this.to)))return Jn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Jn.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?Jn.fromReplace(e,this.from,this.to,i):Jn.fail("Content does not fit in gap")}getMap(){return new ol([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new cm(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new cm(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new cm(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Tn.jsonID("replaceAround",Ju);function pb(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function IF(t,e,n,i){let r=[],s=[],o,u;t.doc.nodesBetween(e,n,(c,h,m)=>{if(!c.isInline)return;let g=c.marks;if(!i.isInSet(g)&&m.type.allowsMarkType(i.type)){let y=Math.max(h,e),b=Math.min(h+c.nodeSize,n),v=i.addToSet(g);for(let E=0;E<g.length;E++)g[E].isInSet(v)||(o&&o.to==y&&o.mark.eq(g[E])?o.to=b:r.push(o=new Zh(y,b,g[E])));u&&u.to==y?u.to=b:s.push(u=new yk(y,b,i))}}),r.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function _F(t,e,n,i){let r=[],s=0;t.doc.nodesBetween(e,n,(o,u)=>{if(!o.isInline)return;s++;let c=null;if(i instanceof jh){let h=o.marks,m;for(;m=i.isInSet(h);)(c||(c=[])).push(m),h=m.removeFromSet(h)}else i?i.isInSet(o.marks)&&(c=[i]):c=o.marks;if(c&&c.length){let h=Math.min(u+o.nodeSize,n);for(let m=0;m<c.length;m++){let g=c[m],y;for(let b=0;b<r.length;b++){let v=r[b];v.step==s-1&&g.eq(r[b].style)&&(y=v)}y?(y.to=h,y.step=s):r.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),r.forEach(o=>t.step(new Zh(o.from,o.to,o.style)))}function bk(t,e,n,i=n.contentMatch,r=!0){let s=t.doc.nodeAt(e),o=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),m=u+h.nodeSize,g=i.matchType(h.type);if(!g)o.push(new Ja(u,m,H.empty));else{i=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new Zh(u,m,h.marks[y]));if(r&&h.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,v;for(;y=b.exec(h.text);)v||(v=new H(G.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new Ja(u+y.index,u+y.index+y[0].length,v))}}u=m}if(!i.validEnd){let c=i.fillBefore(G.empty,!0);t.replace(u,u,new H(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function zF(t,e,n){let{$from:i,$to:r,depth:s}=e,o=i.before(s+1),u=r.after(s+1),c=o,h=u,m=G.empty,g=0;for(let v=s,E=!1;v>n;v--)E||i.index(v)>0?(E=!0,m=G.from(i.node(v).copy(m)),g++):c--;let y=G.empty,b=0;for(let v=s,E=!1;v>n;v--)E||r.after(v+1)<r.end(v)?(E=!0,y=G.from(r.node(v).copy(y)),b++):h++;t.step(new Ju(c,h,o,u,new H(m.append(y),g,b),m.size-g,!0))}function LF(t,e,n){let i=G.empty;for(let o=n.length-1;o>=0;o--){if(i.size){let u=n[o].type.contentMatch.matchFragment(i);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=G.from(n[o].type.create(n[o].attrs,i))}let r=e.start,s=e.end;t.step(new Ju(r,s,r,s,new H(i,0,0),n.length,!0))}function BF(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,u)=>{let c=typeof r=="function"?r(o):r;if(o.isTextblock&&!o.hasMarkup(i,c)&&VF(t.doc,t.mapping.slice(s).map(u),i)){let h=null;if(i.schema.linebreakReplacement){let b=i.whitespace=="pre",v=!!i.contentMatch.matchType(i.schema.linebreakReplacement);b&&!v?h=!1:!b&&v&&(h=!0)}h===!1&&iR(t,o,u,s),bk(t,t.mapping.slice(s).map(u,1),i,void 0,h===null);let m=t.mapping.slice(s),g=m.map(u,1),y=m.map(u+o.nodeSize,1);return t.step(new Ju(g,y,g+1,y-1,new H(G.from(i.create(c,null,o.marks)),0,0),1,!0)),h===!0&&nR(t,o,u,s),!1}})}function nR(t,e,n,i){e.forEach((r,s)=>{if(r.isText){let o,u=/\r?\n|\r/g;for(;o=u.exec(r.text);){let c=t.mapping.slice(i).map(n+1+s+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function iR(t,e,n,i){e.forEach((r,s)=>{if(r.type==r.type.schema.linebreakReplacement){let o=t.mapping.slice(i).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
47
- `))}})}function VF(t,e,n){let i=t.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,n)}function FF(t,e,n,i,r){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(i,null,r||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ju(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new H(G.from(o),0,0),1,!0))}function PF(t,e,n=1,i){let r=t.doc.resolve(e),s=G.empty,o=G.empty;for(let u=r.depth,c=r.depth-n,h=n-1;u>c;u--,h--){s=G.from(r.node(u).copy(s));let m=i&&i[h];o=G.from(m?m.type.create(m.attrs,o):r.node(u).copy(o))}t.step(new Ja(e,e,new H(s.append(o),n,n),!0))}function jF(t,e,n){let i=null,{linebreakReplacement:r}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(r&&o.inlineContent){let m=o.whitespace=="pre",g=!!o.contentMatch.matchType(r);m&&!g?i=!1:!m&&g&&(i=!0)}let u=t.steps.length;if(i===!1){let m=t.doc.resolve(e+n);iR(t,m.node(),m.before(),u)}o.inlineContent&&bk(t,e+n-1,o,s.node().contentMatchAt(s.index()),i==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new Ja(h,c.map(e+n,-1),H.empty,!0)),i===!0){let m=t.doc.resolve(h);nR(t,m.node(),m.before(),t.steps.length)}return t}function $F(t,e,n){let i=t.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),n))return e;if(i.parentOffset==0)for(let r=i.depth-1;r>=0;r--){let s=i.index(r);if(i.node(r).canReplaceWith(s,s,n))return i.before(r+1);if(s>0)return null}if(i.parentOffset==i.parent.content.size)for(let r=i.depth-1;r>=0;r--){let s=i.indexAfter(r);if(i.node(r).canReplaceWith(s,s,n))return i.after(r+1);if(s<i.node(r).childCount)return null}return null}function UF(t,e,n){let i=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let s=0;s<n.openStart;s++)r=r.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=i.depth;o>=0;o--){let u=o==i.depth?0:i.pos<=(i.start(o+1)+i.end(o+1))/2?-1:1,c=i.index(o)+(u>0?1:0),h=i.node(o),m=!1;if(s==1)m=h.canReplace(c,c,r);else{let g=h.contentMatchAt(c).findWrapping(r.firstChild.type);m=g&&h.canReplaceWith(c,c,g[0])}if(m)return u==0?i.pos:u<0?i.before(o+1):i.after(o+1)}return null}function JF(t,e,n=e,i=H.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),s=t.resolve(n);return rR(r,s,i)?new Ja(e,n,i):new HF(r,s,i).fit()}function rR(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class HF{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=G.empty;for(let r=0;r<=e.depth;r++){let s=e.node(r);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=G.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,i=this.$from,r=this.close(e<0?this.$to:i.doc.resolve(e));if(!r)return null;let s=this.placed,o=i.depth,u=r.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new Ju(i.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||i.pos!=this.$to.pos?new Ja(i.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let s=n.firstChild;if(n.childCount>1&&(r=0),s.type.spec.isolating&&r<=i){e=i;break}n=s.content}for(let n=1;n<=2;n++)for(let i=n==1?e:this.unplaced.openStart;i>=0;i--){let r,s=null;i?(s=j1(this.unplaced.content,i-1).firstChild,r=s.content):r=this.unplaced.content;let o=r.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],m,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(G.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:i,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(m=h.findWrapping(o.type)))return{sliceDepth:i,frontierDepth:u,parent:s,wrap:m};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=j1(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(i,r.size+n>=e.size-i?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=j1(e,n);if(r.childCount<=1&&n>0){let s=e.size-n<=n+r.size;this.unplaced=new H(If(e,n-1,1),n-1,s?n-1:i)}else this.unplaced=new H(If(e,n,1),n,i)}placeNodes({sliceDepth:e,frontierDepth:n,parent:i,inject:r,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let E=0;E<s.length;E++)this.openFrontierNode(s[E]);let o=this.unplaced,u=i?i.content:o.content,c=o.openStart-e,h=0,m=[],{match:g,type:y}=this.frontier[n];if(r){for(let E=0;E<r.childCount;E++)m.push(r.child(E));g=g.matchFragment(r)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let E=u.child(h),T=g.matchType(E.type);if(!T)break;h++,(h>1||c==0||E.content.size)&&(g=T,m.push(sR(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?b:-1)))}let v=h==u.childCount;v||(b=-1),this.placed=_f(this.placed,n,G.from(m)),this.frontier[n].match=g,v&&b<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,T=u;E<b;E++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=v?e==0?H.empty:new H(If(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(If(o.content,e,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!$1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:i}=this.$to,r=this.$to.after(i);for(;i>1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:i,type:r}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=$1(e,n,r,i,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],m=$1(e,u,h,c,!0);if(!m||m.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=_f(this.placed,n.depth,n.fit)),e=n.move;for(let i=n.depth+1;i<=e.depth;i++){let r=e.node(i),s=r.type.contentMatch.fillBefore(r.content,!0,e.index(i));this.openFrontierNode(r.type,r.attrs,s)}return e}openFrontierNode(e,n=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=_f(this.placed,this.depth,G.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=_f(this.placed,this.frontier.length,n))}}function If(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(If(t.firstChild.content,e-1,n)))}function _f(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(_f(t.lastChild.content,e-1,n)))}function j1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function sR(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,sR(i.firstChild,e-1,i.childCount==1?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(G.empty,!0)))),t.copy(i)}function $1(t,e,n,i,r){let s=t.node(e),o=r?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=i.fillBefore(s.content,!0,o);return u&&!qF(n,s.content,o)?u:null}function qF(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function KF(t){return t.spec.defining||t.spec.definingForContent}function GF(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),s=t.doc.resolve(n);if(rR(r,s,i))return t.step(new Ja(e,n,i));let o=oR(r,s);o[o.length-1]==0&&o.pop();let u=-(r.depth+1);o.unshift(u);for(let y=r.depth,b=r.pos-1;y>0;y--,b--){let v=r.node(y).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(y)>-1?u=y:r.before(y)==b&&o.splice(1,0,-y)}let c=o.indexOf(u),h=[],m=i.openStart;for(let y=i.content,b=0;;b++){let v=y.firstChild;if(h.push(v),b==i.openStart)break;y=v.content}for(let y=m-1;y>=0;y--){let b=h[y],v=KF(b.type);if(v&&!b.sameMarkup(r.node(Math.abs(u)-1)))m=y;else if(v||!b.type.isTextblock)break}for(let y=i.openStart;y>=0;y--){let b=(y+m+1)%(i.openStart+1),v=h[b];if(v)for(let E=0;E<o.length;E++){let T=o[(E+c)%o.length],M=!0;T<0&&(M=!1,T=-T);let j=r.node(T-1),F=r.index(T-1);if(j.canReplaceWith(F,F,v.type,v.marks))return t.replace(r.before(T),M?s.after(T):n,new H(aR(i.content,0,i.openStart,b),b,i.openEnd))}}let g=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,i),!(t.steps.length>g));y--){let b=o[y];b<0||(e=r.before(b),n=s.after(b))}}function aR(t,e,n,i,r){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(aR(s.content,e+1,n,i,s)))}if(e>i){let s=r.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(G.empty,!0))}return t}function YF(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=$F(t.doc,e,i.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new H(G.from(i),0,0))}function XF(t,e,n){let i=t.doc.resolve(e),r=t.doc.resolve(n),s=oR(i,r);for(let o=0;o<s.length;o++){let u=s[o],c=o==s.length-1;if(c&&u==0||i.node(u).type.contentMatch.validEnd)return t.delete(i.start(u),r.end(u));if(u>0&&(c||i.node(u-1).canReplace(i.index(u-1),r.indexAfter(u-1))))return t.delete(i.before(u),r.after(u))}for(let o=1;o<=i.depth&&o<=r.depth;o++)if(e-i.start(o)==i.depth-o&&n>i.end(o)&&r.end(o)-n!=r.depth-o&&i.start(o-1)==r.start(o-1)&&i.node(o-1).canReplace(i.index(o-1),r.index(o-1)))return t.delete(i.before(o),n);t.delete(e,n)}function oR(t,e){let n=[],i=Math.min(t.depth,e.depth);for(let r=i;r>=0;r--){let s=t.start(r);if(s<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(s==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==s-1)&&n.push(r)}return n}let lR=class fm extends Tn{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jn.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return Jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return ol.empty}invert(e){return new fm(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fm(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new fm(n.pos,n.attr,n.value)}};Tn.jsonID("attr",lR);let uR=class db extends Tn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return Jn.ok(i)}getMap(){return ol.empty}invert(e){return new db(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new db(n.attr,n.value)}};Tn.jsonID("docAttr",uR);let Iu=class extends Error{};Iu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Iu.prototype=Object.create(Error.prototype);Iu.prototype.constructor=Iu;Iu.prototype.name="TransformError";class QF{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zm}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Iu(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let i=0;i<this.mapping.maps.length;i++){let r=this.mapping.maps[i];i&&(e=r.map(e,1),n=r.map(n,-1)),r.forEach((s,o,u,c)=>{e=Math.min(e,u),n=Math.max(n,c)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,i=H.empty){let r=JF(this.doc,e,n,i);return r&&this.step(r),this}replaceWith(e,n,i){return this.replace(e,n,new H(G.from(i),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return GF(this,e,n,i),this}replaceRangeWith(e,n,i){return YF(this,e,n,i),this}deleteRange(e,n){return XF(this,e,n),this}lift(e,n){return zF(this,e,n),this}join(e,n=1){return jF(this,e,n),this}wrap(e,n){return LF(this,e,n),this}setBlockType(e,n=e,i,r=null){return BF(this,e,n,i,r),this}setNodeMarkup(e,n,i=null,r){return FF(this,e,n,i,r),this}setNodeAttribute(e,n,i){return this.step(new lR(e,n,i)),this}setDocAttribute(e,n){return this.step(new uR(e,n)),this}addNodeMark(e,n){return this.step(new xk(e,n)),this}removeNodeMark(e,n){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(n instanceof ut)n.isInSet(i.marks)&&this.step(new Lm(e,n));else{let r=i.marks,s,o=[];for(;s=n.isInSet(r);)o.push(new Lm(e,s)),r=s.removeFromSet(r);for(let u=o.length-1;u>=0;u--)this.step(o[u])}return this}split(e,n=1,i){return PF(this,e,n,i),this}addMark(e,n,i){return IF(this,e,n,i),this}removeMark(e,n,i){return _F(this,e,n,i),this}clearIncompatible(e,n,i){return bk(this,e,n,i),this}}const hl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},cR=function(t,e,n,i){return n&&(NN(t,e,n,i,-1)||NN(t,e,n,i,1))},WF=/^(img|br|input|textarea|hr)$/i;function NN(t,e,n,i,r){for(var s;;){if(t==n&&e==i)return!0;if(e==(r<0?0:Bm(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Sk(t)||WF.test(t.nodeName)||t.contentEditable=="false")return!1;e=hl(t)+(r<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(r<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=r;else return!1;else t=o,e=r<0?Bm(t):0}else return!1}}function Bm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ZF(t,e,n){for(let i=e==0,r=e==Bm(t);i||r;){if(t==n)return!0;let s=hl(t);if(t=t.parentNode,!t)return!1;i=i&&s==0,r=r&&s==Bm(t)}}function Sk(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const fR=function(t){return t.focusNode&&cR(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function hR(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const jr=typeof navigator<"u"?navigator:null,AN=typeof document<"u"?document:null,Qa=jr&&jr.userAgent||"",mb=/Edge\/(\d+)/.exec(Qa),pR=/MSIE \d/.exec(Qa),gb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qa),ep=!!(pR||gb||mb),dR=pR?document.documentMode:gb?+gb[1]:mb?+mb[1]:0,Dg=!ep&&/gecko\/(\d+)/i.test(Qa);Dg&&+(/Firefox\/(\d+)/.exec(Qa)||[0,0])[1];const yb=!ep&&/Chrome\/(\d+)/.exec(Qa),Fs=!!yb,mR=yb?+yb[1]:0,pl=!ep&&!!jr&&/Apple Computer/.test(jr.vendor),kk=pl&&(/Mobile\/\w+/.test(Qa)||!!jr&&jr.maxTouchPoints>2),Yi=kk||(jr?/Mac/.test(jr.platform):!1),gR=jr?/Win/.test(jr.platform):!1,tp=/Android \d/.test(Qa),vk=!!AN&&"webkitFontSmoothing"in AN.documentElement.style,eP=vk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tP(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),s=r&&r.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=i.resolve(o),c,h;if(fR(n)){for(c=o;r&&!r.node;)r=r.parent;let g=r.node;if(r&&g.isAtom&&ye.isSelectable(g)&&r.parent&&!(g.isInline&&ZF(n.focusNode,n.focusOffset,r.dom))){let y=r.posBefore;h=new ye(o==y?u:i.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=o,y=o;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=i.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let m=i.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=xR(t,m,u,g)}return h}function yR(t){return t.editable?t.hasFocus():sP(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ck(t,e=!1){let n=t.state.selection;if(rP(t,n),!!yR(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Fs){let i=t.domSelectionRange(),r=t.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&cR(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)iP(t);else{let{anchor:i,head:r}=n,s,o;TN&&!(n instanceof Ee)&&(n.$from.parent.inlineContent||(s=MN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=MN(t,n.to))),t.docView.setSelection(i,r,t,e),TN&&(s&&ON(s),o&&ON(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&nP(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const TN=pl||Fs&&mR<63;function MN(t,e){let{node:n,offset:i}=t.docView.domFromPos(e,0),r=i<n.childNodes.length?n.childNodes[i]:null,s=i?n.childNodes[i-1]:null;if(pl&&r&&r.contentEditable=="false")return U1(r);if((!r||r.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(r)return U1(r);if(s)return U1(s)}}function U1(t){return t.contentEditable="true",pl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ON(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function nP(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),i=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=i||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!yR(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function iP(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,i=n.nodeName=="IMG";i?e.collapse(n.parentNode,hl(n)+1):e.collapse(n,0),!i&&!t.state.selection.visible&&ep&&dR<=11&&(n.disabled=!0,n.disabled=!1)}function rP(t,e){if(e instanceof ye){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(RN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else RN(t)}function RN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function xR(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Ee.between(e,n,i)}function sP(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 xb(t,e){let{$anchor:n,$head:i}=t.selection,r=e>0?n.max(i):n.min(i),s=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return s&&Ve.findFrom(s,e)}function Na(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function DN(t,e,n){let i=t.state.selection;if(i instanceof Ee)if(n.indexOf("s")>-1){let{$head:r}=i,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(r.pos+s.nodeSize*(e<0?-1:1));return Na(t,new Ee(i.$anchor,o))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=xb(t.state,e);return r&&r instanceof ye?Na(t,r):!1}else if(!(Yi&&n.indexOf("m")>-1)){let r=i.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?r.pos-s.nodeSize:r.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ye.isSelectable(s)?Na(t,new ye(e<0?t.state.doc.resolve(r.pos-s.nodeSize):r)):vk?Na(t,new Ee(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(i instanceof ye&&i.node.isInline)return Na(t,new Ee(e>0?i.$to:i.$from));{let r=xb(t.state,e);return r?Na(t,r):!1}}}function Vm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Wf(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function iu(t,e){return e<0?aP(t):oP(t)}function aP(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,s,o=!1;for(Dg&&n.nodeType==1&&i<Vm(n)&&Wf(n.childNodes[i],-1)&&(o=!0);;)if(i>0){if(n.nodeType!=1)break;{let u=n.childNodes[i-1];if(Wf(u,-1))r=n,s=--i;else if(u.nodeType==3)n=u,i=n.nodeValue.length;else break}}else{if(bR(n))break;{let u=n.previousSibling;for(;u&&Wf(u,-1);)r=n.parentNode,s=hl(u),u=u.previousSibling;if(u)n=u,i=Vm(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}o?bb(t,n,i):r&&bb(t,r,s)}function oP(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r=Vm(n),s,o;for(;;)if(i<r){if(n.nodeType!=1)break;let u=n.childNodes[i];if(Wf(u,1))s=n,o=++i;else break}else{if(bR(n))break;{let u=n.nextSibling;for(;u&&Wf(u,1);)s=u.parentNode,o=hl(u)+1,u=u.nextSibling;if(u)n=u,i=0,r=Vm(n);else{if(n=n.parentNode,n==t.dom)break;i=r=0}}}s&&bb(t,s,o)}function bR(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function lP(t,e){for(;t&&e==t.childNodes.length&&!Sk(t);)e=hl(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function uP(t,e){for(;t&&!e&&!Sk(t);)e=hl(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function bb(t,e,n){if(e.nodeType!=3){let s,o;(o=lP(e,n))?(e=o,n=0):(s=uP(e,n))&&(e=s,n=s.nodeValue.length)}let i=t.domSelection();if(!i)return;if(fR(i)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),i.removeAllRanges(),i.addRange(s)}else i.extend&&i.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&Ck(t)},50)}function IN(t,e){let n=t.state.doc.resolve(e);if(!(Fs||gR)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left<r.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function _N(t,e,n){let i=t.state.selection;if(i instanceof Ee&&!i.empty||n.indexOf("s")>-1||Yi&&n.indexOf("m")>-1)return!1;let{$from:r,$to:s}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=xb(t.state,e);if(o&&o instanceof ye)return Na(t,o)}if(!r.parent.inlineContent){let o=e<0?r:s,u=i instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Na(t,u):!1}return!1}function zN(t,e){if(!(t.state.selection instanceof Ee))return!0;let{$head:n,$anchor:i,empty:r}=t.state.selection;if(!n.sameParent(i))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function LN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function cP(t){if(!pl||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;LN(t,i,"true"),setTimeout(()=>LN(t,i,"false"),20)}return!1}function fP(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function hP(t,e){let n=e.keyCode,i=fP(e);if(n==8||Yi&&n==72&&i=="c")return zN(t,-1)||iu(t,-1);if(n==46&&!e.shiftKey||Yi&&n==68&&i=="c")return zN(t,1)||iu(t,1);if(n==13||n==27)return!0;if(n==37||Yi&&n==66&&i=="c"){let r=n==37?IN(t,t.state.selection.from)=="ltr"?-1:1:-1;return DN(t,r,i)||iu(t,r)}else if(n==39||Yi&&n==70&&i=="c"){let r=n==39?IN(t,t.state.selection.from)=="ltr"?1:-1:1;return DN(t,r,i)||iu(t,r)}else{if(n==38||Yi&&n==80&&i=="c")return _N(t,-1,i)||iu(t,-1);if(n==40||Yi&&n==78&&i=="c")return cP(t)||_N(t,1,i)||iu(t,1);if(i==(Yi?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function SR(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:i,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&i.childCount==1&&i.firstChild.childCount==1;){r--,s--;let b=i.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),i=b.content}let o=t.someProp("clipboardSerializer")||qr.fromSchema(t.state.schema),u=NR(),c=u.createElement("div");c.appendChild(o.serializeFragment(i,{document:u}));let h=c.firstChild,m,g=0;for(;h&&h.nodeType==1&&(m=ER[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let v=u.createElement(m[b]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${r} ${s}${g?` -${g}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
48
-
49
- `);return{dom:c,text:y,slice:e}}function kR(t,e,n,i,r){let s=r.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(i||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||i,t)}),s)return u=new H(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
50
- `))),0,0),t.someProp("transformPasted",y=>{u=y(u,t,!0)}),u;let g=t.someProp("clipboardTextParser",y=>y(e,r,i,t));if(g)u=g;else{let y=r.marks(),{schema:b}=t.state,v=qr.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let T=o.appendChild(document.createElement("p"));E&&T.appendChild(v.serializeNode(b.text(E,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=gP(n),vk&&yP(o);let h=o&&o.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let g=+m[3];g>0;g--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||Pa.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||m),context:r,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!pP.test(y.parentNode.nodeName)?{ignore:!0}:null}})),m)u=xP(BN(u,+m[1],+m[2]),m[4]);else if(u=H.maxOpen(dP(u.content,r),!0),u.openStart||u.openEnd){let g=0,y=0;for(let b=u.content.firstChild;g<u.openStart&&!b.type.spec.isolating;g++,b=b.firstChild);for(let b=u.content.lastChild;y<u.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);u=BN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const pP=/^(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 dP(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=r.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&CR(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=wR(o[o.length-1],s.length));let m=vR(u,c);o.push(m),r=r.matchType(m.type),s=c}}),o)return G.from(o)}return t}function vR(t,e,n=0){for(let i=e.length-1;i>=n;i--)t=e[i].create(null,G.from(t));return t}function CR(t,e,n,i,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let s=CR(t,e,n,i.lastChild,r+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(r==t.length-1?n.type:t[r+1]))return i.copy(i.content.append(G.from(vR(n,t,r+1))))}}function wR(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,wR(t.lastChild,e-1)),i=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(i))}function Sb(t,e,n,i,r,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),r<i-1&&(u=Sb(u,e,n,i,r+1,s)),r>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=r).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function BN(t,e,n){return e<t.openStart&&(t=new H(Sb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(Sb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const ER={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 VN=null;function NR(){return VN||(VN=document.implementation.createHTMLDocument("title"))}let J1=null;function mP(t){let e=window.trustedTypes;return e?(J1||(J1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),J1.createHTML(t)):t}function gP(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=NR().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t),r;if((r=i&&ER[i[1].toLowerCase()])&&(t=r.map(s=>"<"+s+">").join("")+t+r.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=mP(t),r)for(let s=0;s<r.length;s++)n=n.querySelector(r[s])||n;return n}function yP(t){let e=t.querySelectorAll(Fs?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let i=e[n];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),i)}}function xP(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return t}let{content:r,openStart:s,openEnd:o}=t;for(let u=i.length-2;u>=0;u-=2){let c=n.nodes[i[u]];if(!c||c.hasRequiredAttrs())break;r=G.from(c.create(i[u+1],r)),s++,o++}return new H(r,s,o)}const Nr={},Ei={};function Ia(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Ei.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!TR(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(tp&&Fs&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),kk&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let i=Date.now();t.input.lastIOSEnter=i,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==i&&(t.someProp("handleKeyDown",r=>r(t,hR(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",i=>i(t,n))||hP(t,n)?n.preventDefault():Ia(t,"key")};Ei.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ei.keypress=(t,e)=>{let n=e;if(TR(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Yi&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let i=t.state.selection;if(!(i instanceof Ee)||!i.$from.sameParent(i.$to)){let r=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",o=>o(t,i.$from.pos,i.$to.pos,r,s))&&t.dispatch(s()),n.preventDefault()}};function Ig(t){return{left:t.clientX,top:t.clientY}}function bP(t,e){let n=e.x-t.clientX,i=e.y-t.clientY;return n*n+i*i<100}function wk(t,e,n,i,r){if(i==-1)return!1;let s=t.state.doc.resolve(i);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,u=>o>s.depth?u(t,n,s.nodeAfter,s.before(o),r,!0):u(t,n,s.node(o),s.before(o),r,!1)))return!0;return!1}function Eu(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let i=t.state.tr.setSelection(e);i.setMeta("pointer",!0),t.dispatch(i)}function SP(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return i&&i.isAtom&&ye.isSelectable(i)?(Eu(t,new ye(n)),!0):!1}function kP(t,e){if(e==-1)return!1;let n=t.state.selection,i,r;n instanceof ye&&(i=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let u=o>s.depth?s.nodeAfter:s.node(o);if(ye.isSelectable(u)){i&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?r=s.before(n.$from.depth):r=s.before(o);break}}return r!=null?(Eu(t,ye.create(t.state.doc,r)),!0):!1}function vP(t,e,n,i,r){return wk(t,"handleClickOn",e,n,i)||t.someProp("handleClick",s=>s(t,e,i))||(r?kP(t,n):SP(t,n))}function CP(t,e,n,i){return wk(t,"handleDoubleClickOn",e,n,i)||t.someProp("handleDoubleClick",r=>r(t,e,i))}function wP(t,e,n,i){return wk(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",r=>r(t,e,i))||EP(t,n,i)}function EP(t,e,n){if(n.button!=0)return!1;let i=t.state.doc;if(e==-1)return i.inlineContent?(Eu(t,Ee.create(i,0,i.content.size)),!0):!1;let r=i.resolve(e);for(let s=r.depth+1;s>0;s--){let o=s>r.depth?r.nodeAfter:r.node(s),u=r.before(s);if(o.inlineContent)Eu(t,Ee.create(i,u+1,u+1+o.content.size));else if(ye.isSelectable(o))Eu(t,ye.create(i,u));else continue;return!0}}function Ek(t){return Fm(t)}const AR=Yi?"metaKey":"ctrlKey";Nr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let i=Ek(t),r=Date.now(),s="singleClick";r-t.input.lastClick.time<500&&bP(n,t.input.lastClick)&&!n[AR]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Ig(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new NP(t,o,n,!!i)):(s=="doubleClick"?CP:wP)(t,o.pos,o.inside,n)?n.preventDefault():Ia(t,"pointer"))};let NP=class{constructor(e,n,i,r){this.view=e,this.pos=n,this.event=i,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[AR],this.allowDefault=i.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let m=e.state.doc.resolve(n.pos);s=m.parent,o=m.depth?m.before():0}const u=r?null:i.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(i.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof ye&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dg&&!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)),Ia(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(()=>Ck(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ig(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ia(this.view,"pointer"):vP(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pl&&this.mightDrag&&!this.mightDrag.node.isAtom||Fs&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Eu(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ia(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ia(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)}};Nr.touchstart=t=>{t.input.lastTouch=Date.now(),Ek(t),Ia(t,"pointer")};Nr.touchmove=t=>{t.input.lastTouch=Date.now(),Ia(t,"pointer")};Nr.contextmenu=t=>Ek(t);function TR(t,e){return t.composing?!0:pl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const AP=tp?5e3:-1;Ei.compositionstart=Ei.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ee&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||Fs&&gR&&TP(t)))t.markCursor=t.state.storedMarks||n.marks(),Fm(t,!0),t.markCursor=null;else if(Fm(t,!e.selection.empty),Dg&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let i=t.domSelectionRange();for(let r=i.focusNode,s=i.focusOffset;r&&r.nodeType==1&&s!=0;){let o=s<0?r.lastChild:r.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else r=o,s=-1}}t.input.composing=!0}MR(t,AP)};function TP(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let i=e.childNodes[n];return i.nodeType==1&&i.contentEditable=="false"}Ei.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.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,MR(t,20))};function MR(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Fm(t),e))}function MP(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=OP());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function OP(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Fm(t,e=!1){if(!(tp&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),MP(t),e||t.docView&&t.docView.dirty){let n=tP(t),i=t.state.selection;return n&&!n.eq(i)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function RP(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),i.removeAllRanges(),i.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const wh=ep&&dR<15||kk&&eP<604;Nr.copy=Ei.cut=(t,e)=>{let n=e,i=t.state.selection,r=n.type=="cut";if(i.empty)return;let s=wh?null:n.clipboardData,o=i.content(),{dom:u,text:c}=SR(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):RP(t,u),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function DP(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function IP(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,i=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),i.parentNode&&i.parentNode.removeChild(i),n?kb(t,i.value,null,r,e):kb(t,i.textContent,i.innerHTML,r,e)},50)}function kb(t,e,n,i,r){let s=kR(t,e,n,i,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,s||H.empty)))return!0;if(!s)return!1;let o=DP(s),u=o?t.state.tr.replaceSelectionWith(o,i):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function OR(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ei.paste=(t,e)=>{let n=e;if(t.composing&&!tp)return;let i=wh?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;i&&kb(t,OR(i),i.getData("text/html"),r,n)?n.preventDefault():IP(t,n)};let _P=class{constructor(e,n,i){this.slice=e,this.move=n,this.node=i}};const zP=Yi?"altKey":"ctrlKey";function RR(t,e){let n=t.someProp("dragCopies",i=>!i(e));return n??!e[zP]}Nr.dragstart=(t,e)=>{let n=e,i=t.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let r=t.state.selection,s=r.empty?null:t.posAtCoords(Ig(n)),o;if(!(s&&s.pos>=r.from&&s.pos<=(r instanceof ye?r.to-1:r.to))){if(i&&i.mightDrag)o=ye.create(t.state.doc,i.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=t.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=t.docView&&(o=ye.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:m}=SR(t,u);(!n.dataTransfer.files.length||!Fs||mR>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(wh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",wh||n.dataTransfer.setData("text/plain",h),t.dragging=new _P(m,RR(t,n),o)};Nr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ei.dragover=Ei.dragenter=(t,e)=>e.preventDefault();Ei.drop=(t,e)=>{try{LP(t,e,t.dragging)}finally{t.dragging=null}};function LP(t,e,n){if(!e.dataTransfer)return;let i=t.posAtCoords(Ig(e));if(!i)return;let r=t.state.doc.resolve(i.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=kR(t,OR(e.dataTransfer),wh?null:e.dataTransfer.getData("text/html"),!1,r);let o=!!(n&&RR(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||H.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?UF(t.state.doc,r.pos,s):r.pos;u==null&&(u=r.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),m=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(m?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(m&&ye.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new ye(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((v,E,T,M)=>b=M),c.setSelection(xR(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Nr.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())&&Ck(t)},20))};Nr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Nr.beforeinput=(t,e)=>{if(Fs&&tp&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:i}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=i||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,hR(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Ei)Nr[t]=Ei[t];function Eh(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let FN=class DR{constructor(e,n){this.toDOM=e,this.spec=n||Ho,this.side=this.spec.side||0}map(e,n,i,r){let{pos:s,deleted:o}=e.mapResult(n.from+r,this.side<0?-1:1);return o?null:new ll(s-i,s-i,this)}valid(){return!0}eq(e){return this==e||e instanceof DR&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Eh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Zf=class vb{constructor(e,n){this.attrs=e,this.spec=n||Ho}map(e,n,i,r){let s=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-i,o=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-i;return s>=o?null:new ll(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof vb&&Eh(this.attrs,e.attrs)&&Eh(this.spec,e.spec)}static is(e){return e.type instanceof vb}destroy(){}},BP=class IR{constructor(e,n){this.attrs=e,this.spec=n||Ho}map(e,n,i,r){let s=e.mapResult(n.from+r,1);if(s.deleted)return null;let o=e.mapResult(n.to+r,-1);return o.deleted||o.pos<=s.pos?null:new ll(s.pos-i,o.pos-i,this)}valid(e,n){let{index:i,offset:r}=e.content.findIndex(n.from),s;return r==n.from&&!(s=e.child(i)).isText&&r+s.nodeSize==n.to}eq(e){return this==e||e instanceof IR&&Eh(this.attrs,e.attrs)&&Eh(this.spec,e.spec)}destroy(){}},ll=class zf{constructor(e,n,i){this.from=e,this.to=n,this.type=i}copy(e,n){return new zf(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,i){return this.type.map(e,this,n,i)}static widget(e,n,i){return new zf(e,e,new FN(n,i))}static inline(e,n,i,r){return new zf(e,n,new Zf(i,r))}static node(e,n,i,r){return new zf(e,n,new BP(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zf}get widget(){return this.type instanceof FN}};const mu=[],Ho={};let ir=class Ca{constructor(e,n){this.local=e.length?e:mu,this.children=n.length?n:mu}static create(e,n){return n.length?Pm(n,e,0,Ho):zn}find(e,n,i){let r=[];return this.findInner(e??0,n??1e9,r,0,i),r}findInner(e,n,i,r,s){for(let o=0;o<this.local.length;o++){let u=this.local[o];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&i.push(u.copy(u.from+r,u.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let u=this.children[o]+1;this.children[o+2].findInner(e-u,n-u,i,r+u,s)}}map(e,n,i){return this==zn||e.maps.length==0?this:this.mapInner(e,n,0,0,i||Ho)}mapInner(e,n,i,r,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,i,r);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?FP(this.children,o||[],e,n,i,r,s):o?new Ca(o.sort(qo),mu):zn}add(e,n){return n.length?this==zn?Ca.create(e,n):this.addInner(e,n,0):this}addInner(e,n,i){let r,s=0;e.forEach((u,c)=>{let h=c+i,m;if(m=zR(n,u,h)){for(r||(r=this.children.slice());s<r.length&&r[s]<c;)s+=3;r[s]==c?r[s+2]=r[s+2].addInner(u,m,h+1):r.splice(s,0,c,c+u.nodeSize,Pm(m,u,h+1,Ho)),s+=3}});let o=_R(s?LR(n):n,-i);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new Ca(o.length?this.local.concat(o).sort(qo):this.local,r||this.children)}remove(e){return e.length==0||this==zn?this:this.removeInner(e,0)}removeInner(e,n){let i=this.children,r=this.local;for(let s=0;s<i.length;s+=3){let o,u=i[s]+n,c=i[s+1]+n;for(let m=0,g;m<e.length;m++)(g=e[m])&&g.from>u&&g.to<c&&(e[m]=null,(o||(o=[])).push(g));if(!o)continue;i==this.children&&(i=this.children.slice());let h=i[s+2].removeInner(o,u+1);h!=zn?i[s+2]=h:(i.splice(s,3),s-=3)}if(r.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<r.length;u++)r[u].eq(o,n)&&(r==this.local&&(r=this.local.slice()),r.splice(u--,1))}return i==this.children&&r==this.local?this:r.length||i.length?new Ca(r,i):zn}forChild(e,n){if(this==zn)return this;if(n.isLeaf)return Ca.empty;let i,r;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(i=this.children[u+2]);break}let s=e+1,o=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<o&&c.to>s&&c.type instanceof Zf){let h=Math.max(s,c.from)-s,m=Math.min(o,c.to)-s;h<m&&(r||(r=[])).push(c.copy(h,m))}}if(r){let u=new Ca(r.sort(qo),mu);return i?new VP([u,i]):u}return i||zn}eq(e){if(this==e)return!0;if(!(e instanceof Ca)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Nk(this.localsInner(e))}localsInner(e){if(this==zn)return mu;if(e.inlineContent||!this.local.some(Zf.is))return this.local;let n=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Zf||n.push(this.local[i]);return n}forEachSet(e){e(this)}};ir.empty=new ir([],[]);ir.removeOverlap=Nk;const zn=ir.empty;let VP=class gu{constructor(e){this.members=e}map(e,n){const i=this.members.map(r=>r.map(e,n,Ho));return gu.from(i)}forChild(e,n){if(n.isLeaf)return ir.empty;let i=[];for(let r=0;r<this.members.length;r++){let s=this.members[r].forChild(e,n);s!=zn&&(s instanceof gu?i=i.concat(s.members):i.push(s))}return gu.from(i)}eq(e){if(!(e instanceof gu)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,i=!0;for(let r=0;r<this.members.length;r++){let s=this.members[r].localsInner(e);if(s.length)if(!n)n=s;else{i&&(n=n.slice(),i=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Nk(i?n:n.sort(qo)):mu}static from(e){switch(e.length){case 0:return zn;case 1:return e[0];default:return new gu(e.every(n=>n instanceof ir)?e:e.reduce((n,i)=>n.concat(i instanceof ir?i:i.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function FP(t,e,n,i,r,s,o){let u=t.slice();for(let h=0,m=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,v,E)=>{let T=E-v-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+m-g)continue;let F=u[M]+m-g;b>=F?u[M+1]=y<=F?-2:-1:y>=m&&T&&(u[M]+=T,u[M+1]+=T)}g+=T}),m=n.maps[h].map(m,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let m=n.map(t[h]+s),g=m-r;if(g<0||g>=i.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-r,{index:v,offset:E}=i.content.findIndex(g),T=i.maybeChild(v);if(T&&E==g&&E+T.nodeSize==b){let M=u[h+2].mapInner(n,T,m+1,t[h]+s+1,o);M!=zn?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=PP(u,t,e,n,r,s,o),m=Pm(h,i,0,o);e=m.local;for(let g=0;g<u.length;g+=3)u[g+1]<0&&(u.splice(g,3),g-=3);for(let g=0,y=0;g<m.children.length;g+=3){let b=m.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,m.children[g],m.children[g+1],m.children[g+2])}}return new ir(e.sort(qo),u)}function _R(t,e){if(!e||!t.length)return t;let n=[];for(let i=0;i<t.length;i++){let r=t[i];n.push(new ll(r.from+e,r.to+e,r.type))}return n}function PP(t,e,n,i,r,s,o){function u(c,h){for(let m=0;m<c.local.length;m++){let g=c.local[m].map(i,r,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[m].spec)}for(let m=0;m<c.children.length;m+=3)u(c.children[m+2],c.children[m]+h+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&u(t[c+2],e[c]+s+1);return n}function zR(t,e,n){if(e.isLeaf)return null;let i=n+e.nodeSize,r=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<i&&((r||(r=[])).push(o),t[s]=null);return r}function LR(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Pm(t,e,n,i){let r=[],s=!1;e.forEach((u,c)=>{let h=zR(t,u,c+n);if(h){s=!0;let m=Pm(h,u,n+c+1,i);m!=zn&&r.push(c,c+u.nodeSize,m)}});let o=_R(s?LR(t):t,-n).sort(qo);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(i.onRemove&&i.onRemove(o[u].spec),o.splice(u--,1));return o.length||r.length?new ir(o,r):zn}function qo(t,e){return t.from-e.from||t.to-e.to}function Nk(t){let e=t;for(let n=0;n<e.length-1;n++){let i=e[n];if(i.from!=i.to)for(let r=n+1;r<e.length;r++){let s=e[r];if(s.from==i.from){s.to!=i.to&&(e==t&&(e=t.slice()),e[r]=s.copy(s.from,i.to),PN(e,r+1,s.copy(i.to,s.to)));continue}else{s.from<i.to&&(e==t&&(e=t.slice()),e[n]=i.copy(i.from,s.from),PN(e,r,i.copy(s.from,i.to)));break}}}return e}function PN(t,e,n){for(;e<t.length&&qo(n,t[e])>0;)e++;t.splice(e,0,n)}let Cb,wb;if(typeof WeakMap<"u"){let t=new WeakMap;Cb=e=>t.get(e),wb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Cb=i=>{for(let r=0;r<t.length;r+=2)if(t[r]==i)return t[r+1]},wb=(i,r)=>(n==10&&(n=0),t[n++]=i,t[n++]=r)}var bt=class{constructor(t,e,n,i){this.width=t,this.height=e,this.map=n,this.problems=i}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const i=e%this.width,r=e/this.width|0;let s=i+1,o=r+1;for(let u=1;s<this.width&&this.map[e+u]==n;u++)s++;for(let u=1;o<this.height&&this.map[e+this.width*u]==n;u++)o++;return{left:i,top:r,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:i,right:r,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?i==0:r==this.width)?null:this.map[s*this.width+(n<0?i-1:r)]:(n<0?s==0:o==this.height)?null:this.map[i+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:i,top:r,bottom:s}=this.findCell(t),{left:o,right:u,top:c,bottom:h}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(r,c),right:Math.max(i,u),bottom:Math.max(s,h)}}cellsInRect(t){const e=[],n={};for(let i=t.top;i<t.bottom;i++)for(let r=t.left;r<t.right;r++){const s=i*this.width+r,o=this.map[s];n[o]||(n[o]=!0,!(r==t.left&&r&&this.map[s-1]==o||i==t.top&&i&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let i=0,r=0;;i++){const s=r+n.child(i).nodeSize;if(i==t){let o=e+t*this.width;const u=(t+1)*this.width;for(;o<u&&this.map[o]<r;)o++;return o==u?s-1:this.map[o]}r=s}}static get(t){return Cb(t)||wb(t,jP(t))}};function jP(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=$P(t),n=t.childCount,i=[];let r=0,s=null;const o=[];for(let h=0,m=e*n;h<m;h++)i[h]=0;for(let h=0,m=0;h<n;h++){const g=t.child(h);m++;for(let v=0;;v++){for(;r<i.length&&i[r]!=0;)r++;if(v==g.childCount)break;const E=g.child(v),{colspan:T,rowspan:M,colwidth:j}=E.attrs;for(let F=0;F<M;F++){if(F+h>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:m,n:M-F});break}const J=r+F*e;for(let V=0;V<T;V++){i[J+V]==0?i[J+V]=m:(s||(s=[])).push({type:"collision",row:h,pos:m,n:T-V});const C=j&&j[V];if(C){const L=(J+V)%e*2,q=o[L];q==null||q!=C&&o[L+1]==1?(o[L]=C,o[L+1]=1):q==C&&o[L+1]++}}}r+=T,m+=E.nodeSize}const y=(h+1)*e;let b=0;for(;r<y;)i[r++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:h,n:b}),m++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const u=new bt(e,n,i,s);let c=!1;for(let h=0;!c&&h<o.length;h+=2)o[h]!=null&&o[h+1]<n&&(c=!0);return c&&UP(u,o,t),u}function $P(t){let e=-1,n=!1;for(let i=0;i<t.childCount;i++){const r=t.child(i);let s=0;if(n)for(let o=0;o<i;o++){const u=t.child(o);for(let c=0;c<u.childCount;c++){const h=u.child(c);o+h.attrs.rowspan>i&&(s+=h.attrs.colspan)}}for(let o=0;o<r.childCount;o++){const u=r.child(o);s+=u.attrs.colspan,u.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function UP(t,e,n){t.problems||(t.problems=[]);const i={};for(let r=0;r<t.map.length;r++){const s=t.map[r];if(i[s])continue;i[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let u=null;const c=o.attrs;for(let h=0;h<c.colspan;h++){const m=e[(r+h)%t.width*2];m!=null&&(!c.colwidth||c.colwidth[h]!=m)&&((u||(u=JP(c)))[h]=m)}u&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:u})}}function JP(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function jN(t,e){if(typeof t=="string")return{};const n=t.getAttribute("data-colwidth"),i=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(o=>Number(o)):null,r=Number(t.getAttribute("colspan")||1),s={colspan:r,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:i&&i.length==r?i:null};for(const o in e){const u=e[o].getFromDOM,c=u&&u(t);c!=null&&(s[o]=c)}return s}function $N(t,e){const n={};t.attrs.colspan!=1&&(n.colspan=t.attrs.colspan),t.attrs.rowspan!=1&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(","));for(const i in e){const r=e[i].setDOMAttr;r&&r(t.attrs[i],n)}return n}function HP(t){if(t!==null){if(!Array.isArray(t))throw new TypeError("colwidth must be null or an array");for(const e of t)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function qP(t){const e=t.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:HP}};for(const i in e)n[i]={default:e[i].default,validate:e[i].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:i=>jN(i,e)}],toDOM(i){return["td",$N(i,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:i=>jN(i,e)}],toDOM(i){return["th",$N(i,e),0]}}}}function rr(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const i=t.nodes[n],r=i.spec.tableRole;r&&(e[r]=i)}}return e}const Oa=new fi("selectingCells");function _u(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function or(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function _g(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=_u(e.$head)||KP(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function KP(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Eb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function GP(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ak(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function BR(t,e,n){const i=t.node(-1),r=bt.get(i),s=t.start(-1),o=r.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function ul(t,e,n=1){const i={...t,colspan:t.colspan-n};return i.colwidth&&(i.colwidth=i.colwidth.slice(),i.colwidth.splice(e,n),i.colwidth.some(r=>r>0)||(i.colwidth=null)),i}function YP(t,e,n=1){const i={...t,colspan:t.colspan+n};if(i.colwidth){i.colwidth=i.colwidth.slice();for(let r=0;r<n;r++)i.colwidth.splice(e,0,0)}return i}function XP(t,e,n){const i=rr(e.type.schema).header_cell;for(let r=0;r<t.height;r++)if(e.nodeAt(t.map[n+r*t.width]).type!=i)return!1;return!0}var Rt=class ks extends Ve{constructor(e,n=e){const i=e.node(-1),r=bt.get(i),s=e.start(-1),o=r.rectBetween(e.pos-s,n.pos-s),u=e.node(0),c=r.cellsInRect(o).filter(m=>m!=n.pos-s);c.unshift(n.pos-s);const h=c.map(m=>{const g=i.nodeAt(m);if(!g)throw new RangeError(`No cell with offset ${m} found`);const y=s+m+1;return new DM(u.resolve(y),u.resolve(y+g.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const i=e.resolve(n.map(this.$anchorCell.pos)),r=e.resolve(n.map(this.$headCell.pos));if(Eb(i)&&Eb(r)&&Ak(i,r)){const s=this.$anchorCell.node(-1)!=i.node(-1);return s&&this.isRowSelection()?ks.rowSelection(i,r):s&&this.isColSelection()?ks.colSelection(i,r):new ks(i,r)}return Ee.between(i,r)}content(){const e=this.$anchorCell.node(-1),n=bt.get(e),i=this.$anchorCell.start(-1),r=n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i),s={},o=[];for(let c=r.top;c<r.bottom;c++){const h=[];for(let m=c*n.width+r.left,g=r.left;g<r.right;g++,m++){const y=n.map[m];if(s[y])continue;s[y]=!0;const b=n.findCell(y);let v=e.nodeAt(y);if(!v)throw new RangeError(`No cell with offset ${y} found`);const E=r.left-b.left,T=b.right-r.right;if(E>0||T>0){let M=v.attrs;if(E>0&&(M=ul(M,0,E)),T>0&&(M=ul(M,M.colspan-T,T)),b.left<r.left){if(v=v.type.createAndFill(M),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(M)}`)}else v=v.type.create(M,v.content)}if(b.top<r.top||b.bottom>r.bottom){const M={...v.attrs,rowspan:Math.min(b.bottom,r.bottom)-Math.max(b.top,r.top)};b.top<r.top?v=v.type.createAndFill(M):v=v.type.create(M,v.content)}h.push(v)}o.push(e.child(c).copy(G.from(h)))}const u=this.isColSelection()&&this.isRowSelection()?e:o;return new H(G.from(u),1,1)}replace(e,n=H.empty){const i=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:u,$to:c}=r[o],h=e.mapping.slice(i);e.replace(h.map(u.pos),h.map(c.pos),o?H.empty:n)}const s=Ve.findFrom(e.doc.resolve(e.mapping.slice(i).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new H(G.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),i=bt.get(n),r=this.$anchorCell.start(-1),s=i.cellsInRect(i.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),r+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const i=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(i,r)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const i=e.node(-1),r=bt.get(i),s=e.start(-1),o=r.findCell(e.pos-s),u=r.findCell(n.pos-s),c=e.node(0);return o.top<=u.top?(o.top>0&&(e=c.resolve(s+r.map[o.left])),u.bottom<r.height&&(n=c.resolve(s+r.map[r.width*(r.height-1)+u.right-1]))):(u.top>0&&(n=c.resolve(s+r.map[u.left])),o.bottom<r.height&&(e=c.resolve(s+r.map[r.width*(r.height-1)+o.right-1]))),new ks(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=bt.get(e),i=this.$anchorCell.start(-1),r=n.colCount(this.$anchorCell.pos-i),s=n.colCount(this.$headCell.pos-i);if(Math.min(r,s)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,u=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,u)==n.width}eq(e){return e instanceof ks&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const i=e.node(-1),r=bt.get(i),s=e.start(-1),o=r.findCell(e.pos-s),u=r.findCell(n.pos-s),c=e.node(0);return o.left<=u.left?(o.left>0&&(e=c.resolve(s+r.map[o.top*r.width])),u.right<r.width&&(n=c.resolve(s+r.map[r.width*(u.top+1)-1]))):(u.left>0&&(n=c.resolve(s+r.map[u.top*r.width])),o.right<r.width&&(e=c.resolve(s+r.map[r.width*(o.top+1)-1]))),new ks(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ks(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,i=n){return new ks(e.resolve(n),e.resolve(i))}getBookmark(){return new QP(this.$anchorCell.pos,this.$headCell.pos)}};Rt.prototype.visible=!1;Ve.jsonID("cell",Rt);var QP=class VR{constructor(e,n){this.anchor=e,this.head=n}map(e){return new VR(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),i=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&i.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&i.index()<i.parent.childCount&&Ak(n,i)?new Rt(n,i):Ve.near(i,1)}};function WP(t){if(!(t.selection instanceof Rt))return null;const e=[];return t.selection.forEachCell((n,i)=>{e.push(ll.node(i,i+n.nodeSize,{class:"selectedCell"}))}),ir.create(t.doc,e)}function ZP({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,i=e.pos,r=t.depth;for(;r>=0&&!(t.after(r+1)<t.end(r));r--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,i--);return n==i&&/row|table/.test(t.node(r).type.spec.tableRole)}function ej({$from:t,$to:e}){let n,i;for(let r=t.depth;r>0;r--){const s=t.node(r);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let r=e.depth;r>0;r--){const s=e.node(r);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){i=s;break}}return n!==i&&e.parentOffset===0}function tj(t,e,n){const i=(e||t).selection,r=(e||t).doc;let s,o;if(i instanceof ye&&(o=i.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Rt.create(r,i.from);else if(o=="row"){const u=r.resolve(i.from+1);s=Rt.rowSelection(u,u)}else if(!n){const u=bt.get(i.node),c=i.from+1,h=c+u.map[u.width*u.height-1];s=Rt.create(r,c+1,h)}}else i instanceof Ee&&ZP(i)?s=Ee.create(r,i.from):i instanceof Ee&&ej(i)&&(s=Ee.create(r,i.$from.start(),i.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const nj=new fi("fix-tables");function FR(t,e,n,i){const r=t.childCount,s=e.childCount;e:for(let o=0,u=0;o<s;o++){const c=e.child(o);for(let h=u,m=Math.min(r,o+3);h<m;h++)if(t.child(h)==c){u=h+1,n+=c.nodeSize;continue e}i(c,n),u<r&&t.child(u).sameMarkup(c)?FR(t.child(u),c,n+1,i):c.nodesBetween(0,c.content.size,i,n+1),n+=c.nodeSize}}function ij(t,e){let n;const i=(r,s)=>{r.type.spec.tableRole=="table"&&(n=rj(t,r,s,n))};return e?e.doc!=t.doc&&FR(e.doc,t.doc,0,i):t.doc.descendants(i),n}function rj(t,e,n,i){const r=bt.get(e);if(!r.problems)return i;i||(i=t.tr);const s=[];for(let c=0;c<r.height;c++)s.push(0);for(let c=0;c<r.problems.length;c++){const h=r.problems[c];if(h.type=="collision"){const m=e.nodeAt(h.pos);if(!m)continue;const g=m.attrs;for(let y=0;y<g.rowspan;y++)s[h.row+y]+=h.n;i.setNodeMarkup(i.mapping.map(n+1+h.pos),null,ul(g,g.colspan-h.n,h.n))}else if(h.type=="missing")s[h.row]+=h.n;else if(h.type=="overlong_rowspan"){const m=e.nodeAt(h.pos);if(!m)continue;i.setNodeMarkup(i.mapping.map(n+1+h.pos),null,{...m.attrs,rowspan:m.attrs.rowspan-h.n})}else if(h.type=="colwidth mismatch"){const m=e.nodeAt(h.pos);if(!m)continue;i.setNodeMarkup(i.mapping.map(n+1+h.pos),null,{...m.attrs,colwidth:h.colwidth})}else if(h.type=="zero_sized"){const m=i.mapping.map(n);i.delete(m,m+e.nodeSize)}}let o,u;for(let c=0;c<s.length;c++)s[c]&&(o==null&&(o=c),u=c);for(let c=0,h=n+1;c<r.height;c++){const m=e.child(c),g=h+m.nodeSize,y=s[c];if(y>0){let b="cell";m.firstChild&&(b=m.firstChild.type.spec.tableRole);const v=[];for(let T=0;T<y;T++){const M=rr(t.schema)[b].createAndFill();M&&v.push(M)}const E=(c==0||o==c-1)&&u==c?h+1:g-1;i.insert(i.mapping.map(E),v)}h=g}return i.setMeta(nj,{fixTables:!0})}function PR(t){const e=bt.get(t),n=[],i=e.height,r=e.width;for(let s=0;s<i;s++){const o=[];for(let u=0;u<r;u++){const c=s*r+u,h=e.map[c];if(s>0){const m=c-r;if(h===e.map[m]){o.push(null);continue}}if(u>0){const m=c-1;if(h===e.map[m]){o.push(null);continue}}o.push(t.nodeAt(h))}n.push(o)}return n}function jR(t,e){const n=[],i=bt.get(t),r=i.height,s=i.width;for(let o=0;o<r;o++){const u=t.child(o),c=[];for(let m=0;m<s;m++){const g=e[o][m];if(!g)continue;const y=i.map[o*i.width+m],b=t.nodeAt(y);if(!b)continue;const v=b.type.createChecked(g.attrs,g.content,g.marks);c.push(v)}const h=u.type.createChecked(u.attrs,c,u.marks);n.push(h)}return t.type.createChecked(t.attrs,n,t.marks)}function $R(t,e,n,i){const r=e[0]>n[0]?-1:1,s=t.splice(e[0],e.length),o=s.length%2===0?1:0;let u;return u=r===-1?n[0]:n[n.length-1]-o,t.splice(u,0,...s),t}function np(t){return sj(e=>e.type.spec.tableRole==="table",t)}function sj(t,e){for(let n=e.depth;n>=0;n-=1){const i=e.node(n);if(t(i))return{node:i,pos:n===0?0:e.before(n),start:e.start(n),depth:n}}return null}function yu(t,e){const n=np(e.$from);if(!n)return;const i=bt.get(n.node);if(!(t<0||t>i.width-1))return i.cellsInRect({left:t,right:t+1,top:0,bottom:i.height}).map(r=>{const s=n.node.nodeAt(r),o=r+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function xu(t,e){const n=np(e.$from);if(!n)return;const i=bt.get(n.node);if(!(t<0||t>i.height-1))return i.cellsInRect({left:0,right:i.width,top:t,bottom:t+1}).map(r=>{const s=n.node.nodeAt(r),o=r+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function UN(t,e,n=e){let i=e,r=n;for(let m=e;m>=0;m--){const g=yu(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.colspan+m-1;b>=i&&(i=m),b>r&&(r=b)})}for(let m=e;m<=r;m++){const g=yu(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.colspan+m-1;y.node.attrs.colspan>1&&b>r&&(r=b)})}const s=[];for(let m=i;m<=r;m++){const g=yu(m,t.selection);g&&g.length>0&&s.push(m)}i=s[0],r=s[s.length-1];const o=yu(i,t.selection),u=xu(0,t.selection);if(!o||!u)return;const c=t.doc.resolve(o[o.length-1].pos);let h;for(let m=r;m>=i;m--){const g=yu(m,t.selection);if(g&&g.length>0){for(let y=u.length-1;y>=0;y--)if(u[y].pos===g[0].pos){h=g[0];break}if(h)break}}if(h)return{$anchor:c,$head:t.doc.resolve(h.pos),indexes:s}}function JN(t,e,n=e){let i=e,r=n;for(let m=e;m>=0;m--){const g=xu(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.rowspan+m-1;b>=i&&(i=m),b>r&&(r=b)})}for(let m=e;m<=r;m++){const g=xu(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.rowspan+m-1;y.node.attrs.rowspan>1&&b>r&&(r=b)})}const s=[];for(let m=i;m<=r;m++){const g=xu(m,t.selection);g&&g.length>0&&s.push(m)}i=s[0],r=s[s.length-1];const o=xu(i,t.selection),u=yu(0,t.selection);if(!o||!u)return;const c=t.doc.resolve(o[o.length-1].pos);let h;for(let m=r;m>=i;m--){const g=xu(m,t.selection);if(g&&g.length>0){for(let y=u.length-1;y>=0;y--)if(u[y].pos===g[0].pos){h=g[0];break}if(h)break}}if(h)return{$anchor:c,$head:t.doc.resolve(h.pos),indexes:s}}function HN(t){return t[0].map((e,n)=>t.map(i=>i[n]))}function aj(t){var e,n;const{tr:i,originIndex:r,targetIndex:s,select:o,pos:u}=t,c=np(i.doc.resolve(u));if(!c)return!1;const h=(e=UN(i,r))===null||e===void 0?void 0:e.indexes,m=(n=UN(i,s))===null||n===void 0?void 0:n.indexes;if(!h||!m||h.includes(s))return!1;const g=oj(c.node,h,m);if(i.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=bt.get(g),b=c.start,v=s,E=y.positionAt(y.height-1,v,g),T=i.doc.resolve(b+E),M=y.positionAt(0,v,g),j=i.doc.resolve(b+M);return i.setSelection(Rt.colSelection(T,j)),!0}function oj(t,e,n,i){let r=HN(PR(t));return r=$R(r,e,n),r=HN(r),jR(t,r)}function lj(t){var e,n;const{tr:i,originIndex:r,targetIndex:s,select:o,pos:u}=t,c=np(i.doc.resolve(u));if(!c)return!1;const h=(e=JN(i,r))===null||e===void 0?void 0:e.indexes,m=(n=JN(i,s))===null||n===void 0?void 0:n.indexes;if(!h||!m||h.includes(s))return!1;const g=uj(c.node,h,m);if(i.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=bt.get(g),b=c.start,v=s,E=y.positionAt(v,y.width-1,g),T=i.doc.resolve(b+E),M=y.positionAt(v,0,g),j=i.doc.resolve(b+M);return i.setSelection(Rt.rowSelection(T,j)),!0}function uj(t,e,n,i){let r=PR(t);return r=$R(r,e,n),jR(t,r)}function Wa(t){const e=t.selection,n=_g(t),i=n.node(-1),r=n.start(-1),s=bt.get(i);return{...e instanceof Rt?s.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):s.findCell(n.pos-r),tableStart:r,map:s,table:i}}function UR(t,{map:e,tableStart:n,table:i},r){let s=r>0?-1:0;XP(e,i,r+s)&&(s=r==0||r==e.width?null:0);for(let o=0;o<e.height;o++){const u=o*e.width+r;if(r>0&&r<e.width&&e.map[u-1]==e.map[u]){const c=e.map[u],h=i.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,YP(h.attrs,r-e.colCount(c))),o+=h.attrs.rowspan-1}else{const c=s==null?rr(i.type.schema).cell:i.nodeAt(e.map[u+s]).type,h=e.positionAt(o,r,i);t.insert(t.mapping.map(n+h),c.createAndFill())}}return t}function cj(t,e){if(!or(t))return!1;if(e){const n=Wa(t);e(UR(t.tr,n,n.left))}return!0}function fj(t,e){if(!or(t))return!1;if(e){const n=Wa(t);e(UR(t.tr,n,n.right))}return!0}function hj(t,{map:e,table:n,tableStart:i},r){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const u=o*e.width+r,c=e.map[u],h=n.nodeAt(c),m=h.attrs;if(r>0&&e.map[u-1]==c||r<e.width-1&&e.map[u+1]==c)t.setNodeMarkup(t.mapping.slice(s).map(i+c),null,ul(m,r-e.colCount(c)));else{const g=t.mapping.slice(s).map(i+c);t.delete(g,g+h.nodeSize)}o+=m.rowspan}}function pj(t,e){if(!or(t))return!1;if(e){const n=Wa(t),i=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;hj(i,n,r),r!=n.left;r--){const s=n.tableStart?i.doc.nodeAt(n.tableStart-1):i.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=bt.get(s)}e(i)}return!0}function dj(t,{map:e,table:n,tableStart:i},r){let s=0;for(let h=0;h<r;h++)s+=n.child(h).nodeSize;const o=s+n.child(r).nodeSize,u=t.mapping.maps.length;t.delete(s+i,o+i);const c=new Set;for(let h=0,m=r*e.width;h<e.width;h++,m++){const g=e.map[m];if(!c.has(g)){if(c.add(g),r>0&&g==e.map[m-e.width]){const y=n.nodeAt(g).attrs;t.setNodeMarkup(t.mapping.slice(u).map(g+i),null,{...y,rowspan:y.rowspan-1}),h+=y.colspan-1}else if(r<e.height&&g==e.map[m+e.width]){const y=n.nodeAt(g),b=y.attrs,v=y.type.create({...b,rowspan:y.attrs.rowspan-1},y.content),E=e.positionAt(r+1,h,n);t.insert(t.mapping.slice(u).map(i+E),v),h+=b.colspan-1}}}}function mj(t,e){if(!or(t))return!1;if(e){const n=Wa(t),i=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;dj(i,n,r),r!=n.top;r--){const s=n.tableStart?i.doc.nodeAt(n.tableStart-1):i.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=bt.get(n.table)}e(i)}return!0}function gj(t,e){return function(n,i){if(!or(n))return!1;const r=_g(n);if(r.nodeAfter.attrs[t]===e)return!1;if(i){const s=n.tr;n.selection instanceof Rt?n.selection.forEachCell((o,u)=>{o.attrs[t]!==e&&s.setNodeMarkup(u,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[t]:e}),i(s)}return!0}}function yj(t){return function(e,n){if(!or(e))return!1;if(n){const i=rr(e.schema),r=Wa(e),s=e.tr,o=r.map.cellsInRect(t=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:t=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),u=o.map(c=>r.table.nodeAt(c));for(let c=0;c<o.length;c++)u[c].type==i.header_cell&&s.setNodeMarkup(r.tableStart+o[c],i.cell,u[c].attrs);if(s.steps.length===0)for(let c=0;c<o.length;c++)s.setNodeMarkup(r.tableStart+o[c],i.header_cell,u[c].attrs);n(s)}return!0}}function qN(t,e,n){const i=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let r=0;r<i.length;r++){const s=e.table.nodeAt(i[r]);if(s&&s.type!==n.header_cell)return!1}return!0}function Tk(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?yj(t):function(n,i){if(!or(n))return!1;if(i){const r=rr(n.schema),s=Wa(n),o=n.tr,u=qN("row",s,r),c=qN("column",s,r),h=(t==="column"?u:t==="row"&&c)?1:0,m=t=="column"?{left:0,top:h,right:1,bottom:s.map.height}:t=="row"?{left:h,top:0,right:s.map.width,bottom:1}:s,g=t=="column"?c?r.cell:r.header_cell:t=="row"?u?r.cell:r.header_cell:r.cell;s.map.cellsInRect(m).forEach(y=>{const b=y+s.tableStart,v=o.doc.nodeAt(b);v&&o.setNodeMarkup(b,g,v.attrs)}),i(o)}return!0}}Tk("row",{useDeprecatedLogic:!0});Tk("column",{useDeprecatedLogic:!0});Tk("cell",{useDeprecatedLogic:!0});function xj(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let i=t.index(-1)-1,r=t.before();i>=0;i--){const s=t.node(-1).child(i),o=s.lastChild;if(o)return r-1-o.nodeSize;r-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let i=t.indexAfter(-1),r=t.after();i<n.childCount;i++){const s=n.child(i);if(s.childCount)return r+1;r+=s.nodeSize}}return null}function JR(t){return function(e,n){if(!or(e))return!1;const i=xj(_g(e),t);if(i==null)return!1;if(n){const r=e.doc.resolve(i);n(e.tr.setSelection(Ee.between(r,GP(r))).scrollIntoView())}return!0}}function bj(t,e){const n=t.selection.$anchor;for(let i=n.depth;i>0;i--)if(n.node(i).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(i),n.after(i)).scrollIntoView()),!0;return!1}function Rd(t,e){const n=t.selection;if(!(n instanceof Rt))return!1;if(e){const i=t.tr,r=rr(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(r)||i.replace(i.mapping.map(o+1),i.mapping.map(o+s.nodeSize-1),new H(r,0,0))}),i.docChanged&&e(i)}return!0}function Sj(t){return(e,n)=>{const{from:i,to:r,select:s=!0,pos:o=e.selection.from}=t,u=e.tr;return lj({tr:u,originIndex:i,targetIndex:r,select:s,pos:o})?(n?.(u),!0):!1}}function kj(t){return(e,n)=>{const{from:i,to:r,select:s=!0,pos:o=e.selection.from}=t,u=e.tr;return aj({tr:u,originIndex:i,targetIndex:r,select:s,pos:o})?(n?.(u),!0):!1}}function vj(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:i}=t;for(;e.childCount==1&&(n>0&&i>0||e.child(0).type.spec.tableRole=="table");)n--,i--,e=e.child(0).content;const r=e.child(0),s=r.type.spec.tableRole,o=r.type.schema,u=[];if(s=="row")for(let c=0;c<e.childCount;c++){let h=e.child(c).content;const m=c?0:Math.max(0,n-1),g=c<e.childCount-1?0:Math.max(0,i-1);(m||g)&&(h=Nb(rr(o).row,new H(h,m,g)).content),u.push(h)}else if(s=="cell"||s=="header_cell")u.push(n||i?Nb(rr(o).row,new H(e,n,i)).content:e);else return null;return Cj(o,u)}function Cj(t,e){const n=[];for(let r=0;r<e.length;r++){const s=e[r];for(let o=s.childCount-1;o>=0;o--){const{rowspan:u,colspan:c}=s.child(o).attrs;for(let h=r;h<r+u;h++)n[h]=(n[h]||0)+c}}let i=0;for(let r=0;r<n.length;r++)i=Math.max(i,n[r]);for(let r=0;r<n.length;r++)if(r>=e.length&&e.push(G.empty),n[r]<i){const s=rr(t).cell.createAndFill(),o=[];for(let u=n[r];u<i;u++)o.push(s);e[r]=e[r].append(G.from(o))}return{height:e.length,width:i,rows:e}}function Nb(t,e){const n=t.createAndFill();return new QF(n).replace(0,n.content.size,e).doc}function wj({width:t,height:e,rows:n},i,r){if(t!=i){const s=[],o=[];for(let u=0;u<n.length;u++){const c=n[u],h=[];for(let m=s[u]||0,g=0;m<i;g++){let y=c.child(g%c.childCount);m+y.attrs.colspan>i&&(y=y.type.createChecked(ul(y.attrs,y.attrs.colspan,m+y.attrs.colspan-i),y.content)),h.push(y),m+=y.attrs.colspan;for(let b=1;b<y.attrs.rowspan;b++)s[u+b]=(s[u+b]||0)+y.attrs.colspan}o.push(G.from(h))}n=o,t=i}if(e!=r){const s=[];for(let o=0,u=0;o<r;o++,u++){const c=[],h=n[u%e];for(let m=0;m<h.childCount;m++){let g=h.child(m);o+g.attrs.rowspan>r&&(g=g.type.create({...g.attrs,rowspan:Math.max(1,r-g.attrs.rowspan)},g.content)),c.push(g)}s.push(G.from(c))}n=s,e=r}return{width:t,height:e,rows:n}}function Ej(t,e,n,i,r,s,o){const u=t.doc.type.schema,c=rr(u);let h,m;if(r>e.width)for(let g=0,y=0;g<e.height;g++){const b=n.child(g);y+=b.nodeSize;const v=[];let E;b.lastChild==null||b.lastChild.type==c.cell?E=h||(h=c.cell.createAndFill()):E=m||(m=c.header_cell.createAndFill());for(let T=e.width;T<r;T++)v.push(E);t.insert(t.mapping.slice(o).map(y-1+i),v)}if(s>e.height){const g=[];for(let v=0,E=(e.height-1)*e.width;v<Math.max(e.width,r);v++){const T=v>=e.width?!1:n.nodeAt(e.map[E+v]).type==c.header_cell;g.push(T?m||(m=c.header_cell.createAndFill()):h||(h=c.cell.createAndFill()))}const y=c.row.create(null,G.from(g)),b=[];for(let v=e.height;v<s;v++)b.push(y);t.insert(t.mapping.slice(o).map(i+n.nodeSize-2),b)}return!!(h||m)}function KN(t,e,n,i,r,s,o,u){if(o==0||o==e.height)return!1;let c=!1;for(let h=r;h<s;h++){const m=o*e.width+h,g=e.map[m];if(e.map[m-e.width]==g){c=!0;const y=n.nodeAt(g),{top:b,left:v}=e.findCell(g);t.setNodeMarkup(t.mapping.slice(u).map(g+i),null,{...y.attrs,rowspan:o-b}),t.insert(t.mapping.slice(u).map(e.positionAt(o,v,n)),y.type.createAndFill({...y.attrs,rowspan:b+y.attrs.rowspan-o})),h+=y.attrs.colspan-1}}return c}function GN(t,e,n,i,r,s,o,u){if(o==0||o==e.width)return!1;let c=!1;for(let h=r;h<s;h++){const m=h*e.width+o,g=e.map[m];if(e.map[m-1]==g){c=!0;const y=n.nodeAt(g),b=e.colCount(g),v=t.mapping.slice(u).map(g+i);t.setNodeMarkup(v,null,ul(y.attrs,o-b,y.attrs.colspan-(o-b))),t.insert(v+y.nodeSize,y.type.createAndFill(ul(y.attrs,0,o-b))),h+=y.attrs.rowspan-1}}return c}function YN(t,e,n,i,r){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=bt.get(s);const{top:u,left:c}=i,h=c+r.width,m=u+r.height,g=t.tr;let y=0;function b(){if(s=n?g.doc.nodeAt(n-1):g.doc,!s)throw new Error("No table found");o=bt.get(s),y=g.mapping.maps.length}Ej(g,o,s,n,h,m,y)&&b(),KN(g,o,s,n,c,h,u,y)&&b(),KN(g,o,s,n,c,h,m,y)&&b(),GN(g,o,s,n,u,m,c,y)&&b(),GN(g,o,s,n,u,m,h,y)&&b();for(let v=u;v<m;v++){const E=o.positionAt(v,c,s),T=o.positionAt(v,h,s);g.replace(g.mapping.slice(y).map(E+n),g.mapping.slice(y).map(T+n),new H(r.rows[v-u],0,0))}b(),g.setSelection(new Rt(g.doc.resolve(n+o.positionAt(u,c,s)),g.doc.resolve(n+o.positionAt(m-1,h-1,s)))),e(g)}const Nj=eO({ArrowLeft:Dd("horiz",-1),ArrowRight:Dd("horiz",1),ArrowUp:Dd("vert",-1),ArrowDown:Dd("vert",1),"Shift-ArrowLeft":Id("horiz",-1),"Shift-ArrowRight":Id("horiz",1),"Shift-ArrowUp":Id("vert",-1),"Shift-ArrowDown":Id("vert",1),Backspace:Rd,"Mod-Backspace":Rd,Delete:Rd,"Mod-Delete":Rd});function hm(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Dd(t,e){return(n,i,r)=>{if(!r)return!1;const s=n.selection;if(s instanceof Rt)return hm(n,i,Ve.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=HR(r,t,e);if(o==null)return!1;if(t=="horiz")return hm(n,i,Ve.near(n.doc.resolve(s.head+e),e));{const u=n.doc.resolve(o),c=BR(u,t,e);let h;return c?h=Ve.near(c,1):e<0?h=Ve.near(n.doc.resolve(u.before(-1)),-1):h=Ve.near(n.doc.resolve(u.after(-1)),1),hm(n,i,h)}}}function Id(t,e){return(n,i,r)=>{if(!r)return!1;const s=n.selection;let o;if(s instanceof Rt)o=s;else{const c=HR(r,t,e);if(c==null)return!1;o=new Rt(n.doc.resolve(c))}const u=BR(o.$headCell,t,e);return u?hm(n,i,new Rt(o.$anchorCell,u)):!1}}function Aj(t,e){const n=t.state.doc,i=_u(n.resolve(e));return i?(t.dispatch(t.state.tr.setSelection(new Rt(i))),!0):!1}function Tj(t,e,n){if(!or(t.state))return!1;let i=vj(n);const r=t.state.selection;if(r instanceof Rt){i||(i={width:1,height:1,rows:[G.from(Nb(rr(t.state.schema).cell,n))]});const s=r.$anchorCell.node(-1),o=r.$anchorCell.start(-1),u=bt.get(s).rectBetween(r.$anchorCell.pos-o,r.$headCell.pos-o);return i=wj(i,u.right-u.left,u.bottom-u.top),YN(t.state,t.dispatch,o,u,i),!0}else if(i){const s=_g(t.state),o=s.start(-1);return YN(t.state,t.dispatch,o,bt.get(s.node(-1)).findCell(s.pos-o),i),!0}else return!1}function Mj(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const i=XN(t,e.target);let r;if(e.shiftKey&&t.state.selection instanceof Rt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&i&&(r=_u(t.state.selection.$anchor))!=null&&((n=H1(t,e))===null||n===void 0?void 0:n.pos)!=r.pos)s(r,e),e.preventDefault();else if(!i)return;function s(c,h){let m=H1(t,h);const g=Oa.getState(t.state)==null;if(!m||!Ak(c,m))if(g)m=c;else return;const y=new Rt(c,m);if(g||!t.state.selection.eq(y)){const b=t.state.tr.setSelection(y);g&&b.setMeta(Oa,c.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",u),Oa.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Oa,-1))}function u(c){const h=c,m=Oa.getState(t.state);let g;if(m!=null)g=t.state.doc.resolve(m);else if(XN(t,h.target)!=i&&(g=H1(t,e),!g))return o();g&&s(g,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",u)}function HR(t,e,n){if(!(t.state.selection instanceof Ee))return null;const{$head:i}=t.state.selection;for(let r=i.depth-1;r>=0;r--){const s=i.node(r);if((n<0?i.index(r):i.indexAfter(r))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=i.before(r),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?o:null}}return null}function XN(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function H1(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:i,pos:r}=n;return i>=0&&_u(t.state.doc.resolve(i))||_u(t.state.doc.resolve(r))}var Oj=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ab(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Ab(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Ab(t,e,n,i,r,s){let o=0,u=!0,c=e.firstChild;const h=t.firstChild;if(h){for(let g=0,y=0;g<h.childCount;g++){const{colspan:b,colwidth:v}=h.child(g).attrs;for(let E=0;E<b;E++,y++){const T=r==y?s:v&&v[E],M=T?T+"px":"";if(o+=T||i,T||(u=!1),c)c.style.width!=M&&(c.style.width=M),c=c.nextSibling;else{const j=document.createElement("col");j.style.width=M,e.appendChild(j)}}}for(;c;){var m;const g=c.nextSibling;(m=c.parentNode)===null||m===void 0||m.removeChild(c),c=g}u?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const vi=new fi("tableColumnResizing");function Rj({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:i=Oj,lastColumnResizable:r=!0}={}){const s=new ci({key:vi,state:{init(o,u){var c;const h=(c=s.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,m=rr(u.schema).table.name;return i&&h&&(h[m]=(g,y)=>new i(g,n,y)),new Dj(-1,!1)},apply(o,u){return u.apply(o)}},props:{attributes:o=>{const u=vi.getState(o);return u&&u.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,u)=>{Ij(o,u,t,r)},mouseleave:o=>{_j(o)},mousedown:(o,u)=>{zj(o,u,e,n)}},decorations:o=>{const u=vi.getState(o);if(u&&u.activeHandle>-1)return Pj(o,u.activeHandle)},nodeViews:{}}});return s}var Dj=class pm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,i=e.getMeta(vi);if(i&&i.setHandle!=null)return new pm(i.setHandle,!1);if(i&&i.setDragging!==void 0)return new pm(n.activeHandle,i.setDragging);if(n.activeHandle>-1&&e.docChanged){let r=e.mapping.map(n.activeHandle,-1);return Eb(e.doc.resolve(r))||(r=-1),new pm(r,n.dragging)}return n}};function Ij(t,e,n,i){if(!t.editable)return;const r=vi.getState(t.state);if(r&&!r.dragging){const s=Bj(e.target);let o=-1;if(s){const{left:u,right:c}=s.getBoundingClientRect();e.clientX-u<=n?o=QN(t,e,"left",n):c-e.clientX<=n&&(o=QN(t,e,"right",n))}if(o!=r.activeHandle){if(!i&&o!==-1){const u=t.state.doc.resolve(o),c=u.node(-1),h=bt.get(c),m=u.start(-1);if(h.colCount(u.pos-m)+u.nodeAfter.attrs.colspan-1==h.width-1)return}qR(t,o)}}}function _j(t){if(!t.editable)return;const e=vi.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&qR(t,-1)}function zj(t,e,n,i){var r;if(!t.editable)return!1;const s=(r=t.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,o=vi.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const u=t.state.doc.nodeAt(o.activeHandle),c=Lj(t,o.activeHandle,u.attrs);t.dispatch(t.state.tr.setMeta(vi,{setDragging:{startX:e.clientX,startWidth:c}}));function h(g){s.removeEventListener("mouseup",h),s.removeEventListener("mousemove",m);const y=vi.getState(t.state);y?.dragging&&(Vj(t,y.activeHandle,WN(y.dragging,g,n)),t.dispatch(t.state.tr.setMeta(vi,{setDragging:null})))}function m(g){if(!g.which)return h(g);const y=vi.getState(t.state);if(y&&y.dragging){const b=WN(y.dragging,g,n);ZN(t,y.activeHandle,b,i)}}return ZN(t,o.activeHandle,c,i),s.addEventListener("mouseup",h),s.addEventListener("mousemove",m),e.preventDefault(),!0}function Lj(t,e,{colspan:n,colwidth:i}){const r=i&&i[i.length-1];if(r)return r;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,u=n;if(i)for(let c=0;c<n;c++)i[c]&&(o-=i[c],u--);return o/u}function Bj(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function QN(t,e,n,i){const r=n=="right"?-i:i,s=t.posAtCoords({left:e.clientX+r,top:e.clientY});if(!s)return-1;const{pos:o}=s,u=_u(t.state.doc.resolve(o));if(!u)return-1;if(n=="right")return u.pos;const c=bt.get(u.node(-1)),h=u.start(-1),m=c.map.indexOf(u.pos-h);return m%c.width==0?-1:h+c.map[m-1]}function WN(t,e,n){const i=e.clientX-t.startX;return Math.max(n,t.startWidth+i)}function qR(t,e){t.dispatch(t.state.tr.setMeta(vi,{setHandle:e}))}function Vj(t,e,n){const i=t.state.doc.resolve(e),r=i.node(-1),s=bt.get(r),o=i.start(-1),u=s.colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let h=0;h<s.height;h++){const m=h*s.width+u;if(h&&s.map[m]==s.map[m-s.width])continue;const g=s.map[m],y=r.nodeAt(g).attrs,b=y.colspan==1?0:u-s.colCount(g);if(y.colwidth&&y.colwidth[b]==n)continue;const v=y.colwidth?y.colwidth.slice():Fj(y.colspan);v[b]=n,c.setNodeMarkup(o+g,null,{...y,colwidth:v})}c.docChanged&&t.dispatch(c)}function ZN(t,e,n,i){const r=t.state.doc.resolve(e),s=r.node(-1),o=r.start(-1),u=bt.get(s).colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;let c=t.domAtPos(r.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&Ab(s,c.firstChild,c,i,u,n)}function Fj(t){return Array(t).fill(0)}function Pj(t,e){const n=[],i=t.doc.resolve(e),r=i.node(-1);if(!r)return ir.empty;const s=bt.get(r),o=i.start(-1),u=s.colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;for(let h=0;h<s.height;h++){const m=u+h*s.width;if((u==s.width-1||s.map[m]!=s.map[m+1])&&(h==0||s.map[m]!=s.map[m-s.width])){var c;const g=s.map[m],y=o+g+r.nodeAt(g).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((c=vi.getState(t))===null||c===void 0)&&c.dragging&&n.push(ll.node(o+g,o+g+r.nodeAt(g).nodeSize,{class:"column-resize-dragging"})),n.push(ll.widget(y,b))}}return ir.create(t.doc,n)}function jj({allowTableNodeSelection:t=!1}={}){return new ci({key:Oa,state:{init(){return null},apply(e,n){const i=e.getMeta(Oa);if(i!=null)return i==-1?null:i;if(n==null||!e.docChanged)return n;const{deleted:r,pos:s}=e.mapping.mapResult(n);return r?null:s}},props:{decorations:WP,handleDOMEvents:{mousedown:Mj},createSelectionBetween(e){return Oa.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Aj,handleKeyDown:Nj,handlePaste:Tj},appendTransaction(e,n,i){return tj(i,ij(i,n),t)}})}const KR=65535,GR=Math.pow(2,16);function $j(t,e){return t+e*GR}function eA(t){return t&KR}function Uj(t){return(t-(t&KR))/GR}const YR=1,XR=2,dm=4,QR=8;class tA{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&QR)>0}get deletedBefore(){return(this.delInfo&(YR|dm))>0}get deletedAfter(){return(this.delInfo&(XR|dm))>0}get deletedAcross(){return(this.delInfo&dm)>0}}class Ci{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ci.empty)return Ci.empty}recover(e){let n=0,i=eA(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+Uj(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+r+(y<0?0:m);if(i)return b;let v=e==(n<0?c:g)?null:$j(u/3,e-c),E=e==c?XR:e==g?YR:dm;return(n<0?e!=c:e!=g)&&(E|=QR),new tA(b,E,v)}r+=m-h}return i?e+r:new tA(e+r,0,null)}touches(e,n){let i=0,r=eA(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==r*3)return!0;i+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[r+n],m=this.ranges[r+i];e(u,u+h,c,c+m),s+=m-h}}invert(){return new Ci(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ci.empty:new Ci(e<0?[0,-e,0]:[0,0,e])}}Ci.empty=new Ci([]);const q1=Object.create(null);class Mn{getMap(){return Ci.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=q1[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in q1)throw new RangeError("Duplicate use of step JSON ID "+e);return q1[e]=n,n.prototype.jsonID=e,n}}class Qt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Qt(e,null)}static fail(e){return new Qt(null,e)}static fromReplace(e,n,i,r){try{return Qt.ok(e.replace(n,i,r))}catch(s){if(s instanceof wr)return Qt.fail(s.message);throw s}}}function Mk(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(Mk(s.content,e,s))),s.isInline&&(s=e(s,n,r)),i.push(s)}return G.fromArray(i)}class _o extends Mn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new H(Mk(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),n.openStart,n.openEnd);return Qt.fromReplace(e,this.from,this.to,s)}invert(){return new zo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new _o(n.pos,i.pos,this.mark)}merge(e){return e instanceof _o&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _o(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new _o(n.from,n.to,e.markFromJSON(n.mark))}}Mn.jsonID("addMark",_o);class zo extends Mn{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new H(Mk(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Qt.fromReplace(e,this.from,this.to,i)}invert(){return new _o(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new zo(n.pos,i.pos,this.mark)}merge(e){return e instanceof zo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zo(n.from,n.to,e.markFromJSON(n.mark))}}Mn.jsonID("removeMark",zo);class Lo extends Mn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qt.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Qt.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new Lo(this.pos,n.marks[r]);return new Lo(this.pos,this.mark)}}return new Nh(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Lo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Lo(n.pos,e.markFromJSON(n.mark))}}Mn.jsonID("addNodeMark",Lo);class Nh extends Mn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qt.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Qt.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Lo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Nh(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Nh(n.pos,e.markFromJSON(n.mark))}}Mn.jsonID("removeNodeMark",Nh);class Aa extends Mn{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Tb(e,this.from,this.to)?Qt.fail("Structure replace would overwrite content"):Qt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ci([this.from,this.to-this.from,this.slice.size])}invert(e){return new Aa(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Aa(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Aa)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Aa(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Aa(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Aa(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}}Mn.jsonID("replace",Aa);class eh extends Mn{constructor(e,n,i,r,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Tb(e,this.from,this.gapFrom)||Tb(e,this.gapTo,this.to)))return Qt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Qt.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?Qt.fromReplace(e,this.from,this.to,i):Qt.fail("Content does not fit in gap")}getMap(){return new Ci([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new eh(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||s>i.pos?null:new eh(n.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new eh(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}}Mn.jsonID("replaceAround",eh);function Tb(t,e,n){let i=t.resolve(e),r=n-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function Jj(t,e,n){let i=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let s=0;s<n.openStart;s++)r=r.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=i.depth;o>=0;o--){let u=o==i.depth?0:i.pos<=(i.start(o+1)+i.end(o+1))/2?-1:1,c=i.index(o)+(u>0?1:0),h=i.node(o),m=!1;if(s==1)m=h.canReplace(c,c,r);else{let g=h.contentMatchAt(c).findWrapping(r.firstChild.type);m=g&&h.canReplaceWith(c,c,g[0])}if(m)return u==0?i.pos:u<0?i.before(o+1):i.after(o+1)}return null}class th extends Mn{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qt.fail("No node at attribute step's position");let i=Object.create(null);for(let s in n.attrs)i[s]=n.attrs[s];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return Qt.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}getMap(){return Ci.empty}invert(e){return new th(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new th(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new th(n.pos,n.attr,n.value)}}Mn.jsonID("attr",th);class jm extends Mn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return Qt.ok(i)}getMap(){return Ci.empty}invert(e){return new jm(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new jm(n.attr,n.value)}}Mn.jsonID("docAttr",jm);let Ah=class extends Error{};Ah=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ah.prototype=Object.create(Error.prototype);Ah.prototype.constructor=Ah;Ah.prototype.name="TransformError";const dl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},WR=function(t,e,n,i){return n&&(nA(t,e,n,i,-1)||nA(t,e,n,i,1))},Hj=/^(img|br|input|textarea|hr)$/i;function nA(t,e,n,i,r){for(var s;;){if(t==n&&e==i)return!0;if(e==(r<0?0:$m(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ok(t)||Hj.test(t.nodeName)||t.contentEditable=="false")return!1;e=dl(t)+(r<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(r<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=r;else return!1;else t=o,e=r<0?$m(t):0}else return!1}}function $m(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qj(t,e,n){for(let i=e==0,r=e==$m(t);i||r;){if(t==n)return!0;let s=dl(t);if(t=t.parentNode,!t)return!1;i=i&&s==0,r=r&&s==$m(t)}}function Ok(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ZR=function(t){return t.focusNode&&WR(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function eD(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const $r=typeof navigator<"u"?navigator:null,iA=typeof document<"u"?document:null,Za=$r&&$r.userAgent||"",Mb=/Edge\/(\d+)/.exec(Za),tD=/MSIE \d/.exec(Za),Ob=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Za),ip=!!(tD||Ob||Mb),nD=tD?document.documentMode:Ob?+Ob[1]:Mb?+Mb[1]:0,zg=!ip&&/gecko\/(\d+)/i.test(Za);zg&&+(/Firefox\/(\d+)/.exec(Za)||[0,0])[1];const Rb=!ip&&/Chrome\/(\d+)/.exec(Za),Ps=!!Rb,iD=Rb?+Rb[1]:0,ml=!ip&&!!$r&&/Apple Computer/.test($r.vendor),Rk=ml&&(/Mobile\/\w+/.test(Za)||!!$r&&$r.maxTouchPoints>2),Xi=Rk||($r?/Mac/.test($r.platform):!1),rD=$r?/Win/.test($r.platform):!1,rp=/Android \d/.test(Za),Dk=!!iA&&"webkitFontSmoothing"in iA.documentElement.style,Kj=Dk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Gj(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),s=r&&r.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=i.resolve(o),c,h;if(ZR(n)){for(c=o;r&&!r.node;)r=r.parent;let g=r.node;if(r&&g.isAtom&&ye.isSelectable(g)&&r.parent&&!(g.isInline&&qj(n.focusNode,n.focusOffset,r.dom))){let y=r.posBefore;h=new ye(o==y?u:i.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=o,y=o;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=i.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let m=i.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=aD(t,m,u,g)}return h}function sD(t){return t.editable?t.hasFocus():Wj(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ik(t,e=!1){let n=t.state.selection;if(Qj(t,n),!!sD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ps){let i=t.domSelectionRange(),r=t.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&WR(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Xj(t);else{let{anchor:i,head:r}=n,s,o;rA&&!(n instanceof Ee)&&(n.$from.parent.inlineContent||(s=sA(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=sA(t,n.to))),t.docView.setSelection(i,r,t,e),rA&&(s&&aA(s),o&&aA(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Yj(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const rA=ml||Ps&&iD<63;function sA(t,e){let{node:n,offset:i}=t.docView.domFromPos(e,0),r=i<n.childNodes.length?n.childNodes[i]:null,s=i?n.childNodes[i-1]:null;if(ml&&r&&r.contentEditable=="false")return K1(r);if((!r||r.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(r)return K1(r);if(s)return K1(s)}}function K1(t){return t.contentEditable="true",ml&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function aA(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Yj(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),i=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=i||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!sD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Xj(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,i=n.nodeName=="IMG";i?e.collapse(n.parentNode,dl(n)+1):e.collapse(n,0),!i&&!t.state.selection.visible&&ip&&nD<=11&&(n.disabled=!0,n.disabled=!1)}function Qj(t,e){if(e instanceof ye){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(oA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else oA(t)}function oA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function aD(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Ee.between(e,n,i)}function Wj(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 Db(t,e){let{$anchor:n,$head:i}=t.selection,r=e>0?n.max(i):n.min(i),s=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return s&&Ve.findFrom(s,e)}function Ta(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function lA(t,e,n){let i=t.state.selection;if(i instanceof Ee)if(n.indexOf("s")>-1){let{$head:r}=i,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(r.pos+s.nodeSize*(e<0?-1:1));return Ta(t,new Ee(i.$anchor,o))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=Db(t.state,e);return r&&r instanceof ye?Ta(t,r):!1}else if(!(Xi&&n.indexOf("m")>-1)){let r=i.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?r.pos-s.nodeSize:r.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ye.isSelectable(s)?Ta(t,new ye(e<0?t.state.doc.resolve(r.pos-s.nodeSize):r)):Dk?Ta(t,new Ee(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(i instanceof ye&&i.node.isInline)return Ta(t,new Ee(e>0?i.$to:i.$from));{let r=Db(t.state,e);return r?Ta(t,r):!1}}}function Um(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function nh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ru(t,e){return e<0?Zj(t):e$(t)}function Zj(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,s,o=!1;for(zg&&n.nodeType==1&&i<Um(n)&&nh(n.childNodes[i],-1)&&(o=!0);;)if(i>0){if(n.nodeType!=1)break;{let u=n.childNodes[i-1];if(nh(u,-1))r=n,s=--i;else if(u.nodeType==3)n=u,i=n.nodeValue.length;else break}}else{if(oD(n))break;{let u=n.previousSibling;for(;u&&nh(u,-1);)r=n.parentNode,s=dl(u),u=u.previousSibling;if(u)n=u,i=Um(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}o?Ib(t,n,i):r&&Ib(t,r,s)}function e$(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r=Um(n),s,o;for(;;)if(i<r){if(n.nodeType!=1)break;let u=n.childNodes[i];if(nh(u,1))s=n,o=++i;else break}else{if(oD(n))break;{let u=n.nextSibling;for(;u&&nh(u,1);)s=u.parentNode,o=dl(u)+1,u=u.nextSibling;if(u)n=u,i=0,r=Um(n);else{if(n=n.parentNode,n==t.dom)break;i=r=0}}}s&&Ib(t,s,o)}function oD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function t$(t,e){for(;t&&e==t.childNodes.length&&!Ok(t);)e=dl(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function n$(t,e){for(;t&&!e&&!Ok(t);)e=dl(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Ib(t,e,n){if(e.nodeType!=3){let s,o;(o=t$(e,n))?(e=o,n=0):(s=n$(e,n))&&(e=s,n=s.nodeValue.length)}let i=t.domSelection();if(!i)return;if(ZR(i)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),i.removeAllRanges(),i.addRange(s)}else i.extend&&i.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&Ik(t)},50)}function uA(t,e){let n=t.state.doc.resolve(e);if(!(Ps||rD)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left<r.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function cA(t,e,n){let i=t.state.selection;if(i instanceof Ee&&!i.empty||n.indexOf("s")>-1||Xi&&n.indexOf("m")>-1)return!1;let{$from:r,$to:s}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Db(t.state,e);if(o&&o instanceof ye)return Ta(t,o)}if(!r.parent.inlineContent){let o=e<0?r:s,u=i instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Ta(t,u):!1}return!1}function fA(t,e){if(!(t.state.selection instanceof Ee))return!0;let{$head:n,$anchor:i,empty:r}=t.state.selection;if(!n.sameParent(i))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function hA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function i$(t){if(!ml||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;hA(t,i,"true"),setTimeout(()=>hA(t,i,"false"),20)}return!1}function r$(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function s$(t,e){let n=e.keyCode,i=r$(e);if(n==8||Xi&&n==72&&i=="c")return fA(t,-1)||ru(t,-1);if(n==46&&!e.shiftKey||Xi&&n==68&&i=="c")return fA(t,1)||ru(t,1);if(n==13||n==27)return!0;if(n==37||Xi&&n==66&&i=="c"){let r=n==37?uA(t,t.state.selection.from)=="ltr"?-1:1:-1;return lA(t,r,i)||ru(t,r)}else if(n==39||Xi&&n==70&&i=="c"){let r=n==39?uA(t,t.state.selection.from)=="ltr"?1:-1:1;return lA(t,r,i)||ru(t,r)}else{if(n==38||Xi&&n==80&&i=="c")return cA(t,-1,i)||ru(t,-1);if(n==40||Xi&&n==78&&i=="c")return i$(t)||cA(t,1,i)||ru(t,1);if(i==(Xi?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function lD(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:i,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&i.childCount==1&&i.firstChild.childCount==1;){r--,s--;let b=i.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),i=b.content}let o=t.someProp("clipboardSerializer")||qr.fromSchema(t.state.schema),u=dD(),c=u.createElement("div");c.appendChild(o.serializeFragment(i,{document:u}));let h=c.firstChild,m,g=0;for(;h&&h.nodeType==1&&(m=pD[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let v=u.createElement(m[b]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${r} ${s}${g?` -${g}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
51
-
52
- `);return{dom:c,text:y,slice:e}}function uD(t,e,n,i,r){let s=r.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(i||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||i,t)}),s)return u=new H(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
53
- `))),0,0),t.someProp("transformPasted",y=>{u=y(u,t,!0)}),u;let g=t.someProp("clipboardTextParser",y=>y(e,r,i,t));if(g)u=g;else{let y=r.marks(),{schema:b}=t.state,v=qr.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let T=o.appendChild(document.createElement("p"));E&&T.appendChild(v.serializeNode(b.text(E,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=u$(n),Dk&&c$(o);let h=o&&o.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let g=+m[3];g>0;g--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||Pa.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||m),context:r,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!a$.test(y.parentNode.nodeName)?{ignore:!0}:null}})),m)u=f$(pA(u,+m[1],+m[2]),m[4]);else if(u=H.maxOpen(o$(u.content,r),!0),u.openStart||u.openEnd){let g=0,y=0;for(let b=u.content.firstChild;g<u.openStart&&!b.type.spec.isolating;g++,b=b.firstChild);for(let b=u.content.lastChild;y<u.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);u=pA(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const a$=/^(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 o$(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=r.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&fD(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=hD(o[o.length-1],s.length));let m=cD(u,c);o.push(m),r=r.matchType(m.type),s=c}}),o)return G.from(o)}return t}function cD(t,e,n=0){for(let i=e.length-1;i>=n;i--)t=e[i].create(null,G.from(t));return t}function fD(t,e,n,i,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let s=fD(t,e,n,i.lastChild,r+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(r==t.length-1?n.type:t[r+1]))return i.copy(i.content.append(G.from(cD(n,t,r+1))))}}function hD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,hD(t.lastChild,e-1)),i=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(i))}function _b(t,e,n,i,r,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),r<i-1&&(u=_b(u,e,n,i,r+1,s)),r>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=r).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function pA(t,e,n){return e<t.openStart&&(t=new H(_b(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(_b(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const pD={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 dA=null;function dD(){return dA||(dA=document.implementation.createHTMLDocument("title"))}let G1=null;function l$(t){let e=window.trustedTypes;return e?(G1||(G1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),G1.createHTML(t)):t}function u$(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=dD().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t),r;if((r=i&&pD[i[1].toLowerCase()])&&(t=r.map(s=>"<"+s+">").join("")+t+r.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=l$(t),r)for(let s=0;s<r.length;s++)n=n.querySelector(r[s])||n;return n}function c$(t){let e=t.querySelectorAll(Ps?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let i=e[n];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),i)}}function f$(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return t}let{content:r,openStart:s,openEnd:o}=t;for(let u=i.length-2;u>=0;u-=2){let c=n.nodes[i[u]];if(!c||c.hasRequiredAttrs())break;r=G.from(c.create(i[u+1],r)),s++,o++}return new H(r,s,o)}const Ar={},Ni={};function _a(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Ni.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!gD(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(rp&&Ps&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Rk&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let i=Date.now();t.input.lastIOSEnter=i,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==i&&(t.someProp("handleKeyDown",r=>r(t,eD(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",i=>i(t,n))||s$(t,n)?n.preventDefault():_a(t,"key")};Ni.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ni.keypress=(t,e)=>{let n=e;if(gD(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Xi&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let i=t.state.selection;if(!(i instanceof Ee)||!i.$from.sameParent(i.$to)){let r=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",o=>o(t,i.$from.pos,i.$to.pos,r,s))&&t.dispatch(s()),n.preventDefault()}};function Lg(t){return{left:t.clientX,top:t.clientY}}function h$(t,e){let n=e.x-t.clientX,i=e.y-t.clientY;return n*n+i*i<100}function _k(t,e,n,i,r){if(i==-1)return!1;let s=t.state.doc.resolve(i);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,u=>o>s.depth?u(t,n,s.nodeAfter,s.before(o),r,!0):u(t,n,s.node(o),s.before(o),r,!1)))return!0;return!1}function Nu(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let i=t.state.tr.setSelection(e);i.setMeta("pointer",!0),t.dispatch(i)}function p$(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return i&&i.isAtom&&ye.isSelectable(i)?(Nu(t,new ye(n)),!0):!1}function d$(t,e){if(e==-1)return!1;let n=t.state.selection,i,r;n instanceof ye&&(i=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let u=o>s.depth?s.nodeAfter:s.node(o);if(ye.isSelectable(u)){i&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?r=s.before(n.$from.depth):r=s.before(o);break}}return r!=null?(Nu(t,ye.create(t.state.doc,r)),!0):!1}function m$(t,e,n,i,r){return _k(t,"handleClickOn",e,n,i)||t.someProp("handleClick",s=>s(t,e,i))||(r?d$(t,n):p$(t,n))}function g$(t,e,n,i){return _k(t,"handleDoubleClickOn",e,n,i)||t.someProp("handleDoubleClick",r=>r(t,e,i))}function y$(t,e,n,i){return _k(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",r=>r(t,e,i))||x$(t,n,i)}function x$(t,e,n){if(n.button!=0)return!1;let i=t.state.doc;if(e==-1)return i.inlineContent?(Nu(t,Ee.create(i,0,i.content.size)),!0):!1;let r=i.resolve(e);for(let s=r.depth+1;s>0;s--){let o=s>r.depth?r.nodeAfter:r.node(s),u=r.before(s);if(o.inlineContent)Nu(t,Ee.create(i,u+1,u+1+o.content.size));else if(ye.isSelectable(o))Nu(t,ye.create(i,u));else continue;return!0}}function zk(t){return Jm(t)}const mD=Xi?"metaKey":"ctrlKey";Ar.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let i=zk(t),r=Date.now(),s="singleClick";r-t.input.lastClick.time<500&&h$(n,t.input.lastClick)&&!n[mD]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Lg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new b$(t,o,n,!!i)):(s=="doubleClick"?g$:y$)(t,o.pos,o.inside,n)?n.preventDefault():_a(t,"pointer"))};class b${constructor(e,n,i,r){this.view=e,this.pos=n,this.event=i,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[mD],this.allowDefault=i.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let m=e.state.doc.resolve(n.pos);s=m.parent,o=m.depth?m.before():0}const u=r?null:i.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(i.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof ye&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&zg&&!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)),_a(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(()=>Ik(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Lg(e))),this.updateAllowDefault(e),this.allowDefault||!n?_a(this.view,"pointer"):m$(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ml&&this.mightDrag&&!this.mightDrag.node.isAtom||Ps&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Nu(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):_a(this.view,"pointer")}move(e){this.updateAllowDefault(e),_a(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)}}Ar.touchstart=t=>{t.input.lastTouch=Date.now(),zk(t),_a(t,"pointer")};Ar.touchmove=t=>{t.input.lastTouch=Date.now(),_a(t,"pointer")};Ar.contextmenu=t=>zk(t);function gD(t,e){return t.composing?!0:ml&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const S$=rp?5e3:-1;Ni.compositionstart=Ni.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ee&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||Ps&&rD&&k$(t)))t.markCursor=t.state.storedMarks||n.marks(),Jm(t,!0),t.markCursor=null;else if(Jm(t,!e.selection.empty),zg&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let i=t.domSelectionRange();for(let r=i.focusNode,s=i.focusOffset;r&&r.nodeType==1&&s!=0;){let o=s<0?r.lastChild:r.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else r=o,s=-1}}t.input.composing=!0}yD(t,S$)};function k$(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let i=e.childNodes[n];return i.nodeType==1&&i.contentEditable=="false"}Ni.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.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,yD(t,20))};function yD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jm(t),e))}function v$(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=C$());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function C$(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Jm(t,e=!1){if(!(rp&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),v$(t),e||t.docView&&t.docView.dirty){let n=Gj(t),i=t.state.selection;return n&&!n.eq(i)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function w$(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),i.removeAllRanges(),i.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Th=ip&&nD<15||Rk&&Kj<604;Ar.copy=Ni.cut=(t,e)=>{let n=e,i=t.state.selection,r=n.type=="cut";if(i.empty)return;let s=Th?null:n.clipboardData,o=i.content(),{dom:u,text:c}=lD(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):w$(t,u),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function E$(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function N$(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,i=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),i.parentNode&&i.parentNode.removeChild(i),n?zb(t,i.value,null,r,e):zb(t,i.textContent,i.innerHTML,r,e)},50)}function zb(t,e,n,i,r){let s=uD(t,e,n,i,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,s||H.empty)))return!0;if(!s)return!1;let o=E$(s),u=o?t.state.tr.replaceSelectionWith(o,i):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function xD(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ni.paste=(t,e)=>{let n=e;if(t.composing&&!rp)return;let i=Th?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;i&&zb(t,xD(i),i.getData("text/html"),r,n)?n.preventDefault():N$(t,n)};class A${constructor(e,n,i){this.slice=e,this.move=n,this.node=i}}const T$=Xi?"altKey":"ctrlKey";function bD(t,e){let n=t.someProp("dragCopies",i=>!i(e));return n??!e[T$]}Ar.dragstart=(t,e)=>{let n=e,i=t.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let r=t.state.selection,s=r.empty?null:t.posAtCoords(Lg(n)),o;if(!(s&&s.pos>=r.from&&s.pos<=(r instanceof ye?r.to-1:r.to))){if(i&&i.mightDrag)o=ye.create(t.state.doc,i.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=t.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=t.docView&&(o=ye.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:m}=lD(t,u);(!n.dataTransfer.files.length||!Ps||iD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Th?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Th||n.dataTransfer.setData("text/plain",h),t.dragging=new A$(m,bD(t,n),o)};Ar.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ni.dragover=Ni.dragenter=(t,e)=>e.preventDefault();Ni.drop=(t,e)=>{try{M$(t,e,t.dragging)}finally{t.dragging=null}};function M$(t,e,n){if(!e.dataTransfer)return;let i=t.posAtCoords(Lg(e));if(!i)return;let r=t.state.doc.resolve(i.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=uD(t,xD(e.dataTransfer),Th?null:e.dataTransfer.getData("text/html"),!1,r);let o=!!(n&&bD(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||H.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?Jj(t.state.doc,r.pos,s):r.pos;u==null&&(u=r.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),m=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(m?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(m&&ye.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new ye(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((v,E,T,M)=>b=M),c.setSelection(aD(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Ar.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())&&Ik(t)},20))};Ar.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ar.beforeinput=(t,e)=>{if(Ps&&rp&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:i}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=i||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,eD(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Ni)Ar[t]=Ni[t];function Mh(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Hm{constructor(e,n){this.toDOM=e,this.spec=n||Ko,this.side=this.spec.side||0}map(e,n,i,r){let{pos:s,deleted:o}=e.mapResult(n.from+r,this.side<0?-1:1);return o?null:new Br(s-i,s-i,this)}valid(){return!0}eq(e){return this==e||e instanceof Hm&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Mh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Va{constructor(e,n){this.attrs=e,this.spec=n||Ko}map(e,n,i,r){let s=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-i,o=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-i;return s>=o?null:new Br(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Va&&Mh(this.attrs,e.attrs)&&Mh(this.spec,e.spec)}static is(e){return e.type instanceof Va}destroy(){}}class Lk{constructor(e,n){this.attrs=e,this.spec=n||Ko}map(e,n,i,r){let s=e.mapResult(n.from+r,1);if(s.deleted)return null;let o=e.mapResult(n.to+r,-1);return o.deleted||o.pos<=s.pos?null:new Br(s.pos-i,o.pos-i,this)}valid(e,n){let{index:i,offset:r}=e.content.findIndex(n.from),s;return r==n.from&&!(s=e.child(i)).isText&&r+s.nodeSize==n.to}eq(e){return this==e||e instanceof Lk&&Mh(this.attrs,e.attrs)&&Mh(this.spec,e.spec)}destroy(){}}class Br{constructor(e,n,i){this.from=e,this.to=n,this.type=i}copy(e,n){return new Br(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,i){return this.type.map(e,this,n,i)}static widget(e,n,i){return new Br(e,e,new Hm(n,i))}static inline(e,n,i,r){return new Br(e,n,new Va(i,r))}static node(e,n,i,r){return new Br(e,n,new Lk(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Va}get widget(){return this.type instanceof Hm}}const bu=[],Ko={};class rn{constructor(e,n){this.local=e.length?e:bu,this.children=n.length?n:bu}static create(e,n){return n.length?qm(n,e,0,Ko):Ln}find(e,n,i){let r=[];return this.findInner(e??0,n??1e9,r,0,i),r}findInner(e,n,i,r,s){for(let o=0;o<this.local.length;o++){let u=this.local[o];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&i.push(u.copy(u.from+r,u.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let u=this.children[o]+1;this.children[o+2].findInner(e-u,n-u,i,r+u,s)}}map(e,n,i){return this==Ln||e.maps.length==0?this:this.mapInner(e,n,0,0,i||Ko)}mapInner(e,n,i,r,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,i,r);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?O$(this.children,o||[],e,n,i,r,s):o?new rn(o.sort(Go),bu):Ln}add(e,n){return n.length?this==Ln?rn.create(e,n):this.addInner(e,n,0):this}addInner(e,n,i){let r,s=0;e.forEach((u,c)=>{let h=c+i,m;if(m=kD(n,u,h)){for(r||(r=this.children.slice());s<r.length&&r[s]<c;)s+=3;r[s]==c?r[s+2]=r[s+2].addInner(u,m,h+1):r.splice(s,0,c,c+u.nodeSize,qm(m,u,h+1,Ko)),s+=3}});let o=SD(s?vD(n):n,-i);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new rn(o.length?this.local.concat(o).sort(Go):this.local,r||this.children)}remove(e){return e.length==0||this==Ln?this:this.removeInner(e,0)}removeInner(e,n){let i=this.children,r=this.local;for(let s=0;s<i.length;s+=3){let o,u=i[s]+n,c=i[s+1]+n;for(let m=0,g;m<e.length;m++)(g=e[m])&&g.from>u&&g.to<c&&(e[m]=null,(o||(o=[])).push(g));if(!o)continue;i==this.children&&(i=this.children.slice());let h=i[s+2].removeInner(o,u+1);h!=Ln?i[s+2]=h:(i.splice(s,3),s-=3)}if(r.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<r.length;u++)r[u].eq(o,n)&&(r==this.local&&(r=this.local.slice()),r.splice(u--,1))}return i==this.children&&r==this.local?this:r.length||i.length?new rn(r,i):Ln}forChild(e,n){if(this==Ln)return this;if(n.isLeaf)return rn.empty;let i,r;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(i=this.children[u+2]);break}let s=e+1,o=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<o&&c.to>s&&c.type instanceof Va){let h=Math.max(s,c.from)-s,m=Math.min(o,c.to)-s;h<m&&(r||(r=[])).push(c.copy(h,m))}}if(r){let u=new rn(r.sort(Go),bu);return i?new Oo([u,i]):u}return i||Ln}eq(e){if(this==e)return!0;if(!(e instanceof rn)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Bk(this.localsInner(e))}localsInner(e){if(this==Ln)return bu;if(e.inlineContent||!this.local.some(Va.is))return this.local;let n=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Va||n.push(this.local[i]);return n}forEachSet(e){e(this)}}rn.empty=new rn([],[]);rn.removeOverlap=Bk;const Ln=rn.empty;class Oo{constructor(e){this.members=e}map(e,n){const i=this.members.map(r=>r.map(e,n,Ko));return Oo.from(i)}forChild(e,n){if(n.isLeaf)return rn.empty;let i=[];for(let r=0;r<this.members.length;r++){let s=this.members[r].forChild(e,n);s!=Ln&&(s instanceof Oo?i=i.concat(s.members):i.push(s))}return Oo.from(i)}eq(e){if(!(e instanceof Oo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,i=!0;for(let r=0;r<this.members.length;r++){let s=this.members[r].localsInner(e);if(s.length)if(!n)n=s;else{i&&(n=n.slice(),i=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Bk(i?n:n.sort(Go)):bu}static from(e){switch(e.length){case 0:return Ln;case 1:return e[0];default:return new Oo(e.every(n=>n instanceof rn)?e:e.reduce((n,i)=>n.concat(i instanceof rn?i:i.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function O$(t,e,n,i,r,s,o){let u=t.slice();for(let h=0,m=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,v,E)=>{let T=E-v-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+m-g)continue;let F=u[M]+m-g;b>=F?u[M+1]=y<=F?-2:-1:y>=m&&T&&(u[M]+=T,u[M+1]+=T)}g+=T}),m=n.maps[h].map(m,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let m=n.map(t[h]+s),g=m-r;if(g<0||g>=i.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-r,{index:v,offset:E}=i.content.findIndex(g),T=i.maybeChild(v);if(T&&E==g&&E+T.nodeSize==b){let M=u[h+2].mapInner(n,T,m+1,t[h]+s+1,o);M!=Ln?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=R$(u,t,e,n,r,s,o),m=qm(h,i,0,o);e=m.local;for(let g=0;g<u.length;g+=3)u[g+1]<0&&(u.splice(g,3),g-=3);for(let g=0,y=0;g<m.children.length;g+=3){let b=m.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,m.children[g],m.children[g+1],m.children[g+2])}}return new rn(e.sort(Go),u)}function SD(t,e){if(!e||!t.length)return t;let n=[];for(let i=0;i<t.length;i++){let r=t[i];n.push(new Br(r.from+e,r.to+e,r.type))}return n}function R$(t,e,n,i,r,s,o){function u(c,h){for(let m=0;m<c.local.length;m++){let g=c.local[m].map(i,r,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[m].spec)}for(let m=0;m<c.children.length;m+=3)u(c.children[m+2],c.children[m]+h+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&u(t[c+2],e[c]+s+1);return n}function kD(t,e,n){if(e.isLeaf)return null;let i=n+e.nodeSize,r=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<i&&((r||(r=[])).push(o),t[s]=null);return r}function vD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function qm(t,e,n,i){let r=[],s=!1;e.forEach((u,c)=>{let h=kD(t,u,c+n);if(h){s=!0;let m=qm(h,u,n+c+1,i);m!=Ln&&r.push(c,c+u.nodeSize,m)}});let o=SD(s?vD(t):t,-n).sort(Go);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(i.onRemove&&i.onRemove(o[u].spec),o.splice(u--,1));return o.length||r.length?new rn(o,r):Ln}function Go(t,e){return t.from-e.from||t.to-e.to}function Bk(t){let e=t;for(let n=0;n<e.length-1;n++){let i=e[n];if(i.from!=i.to)for(let r=n+1;r<e.length;r++){let s=e[r];if(s.from==i.from){s.to!=i.to&&(e==t&&(e=t.slice()),e[r]=s.copy(s.from,i.to),mA(e,r+1,s.copy(i.to,s.to)));continue}else{s.from<i.to&&(e==t&&(e=t.slice()),e[n]=i.copy(i.from,s.from),mA(e,r,i.copy(s.from,i.to)));break}}}return e}function mA(t,e,n){for(;e<t.length&&Go(n,t[e])>0;)e++;t.splice(e,0,n)}var Km=typeof navigator<"u"?navigator:null,Vk=Km&&Km.userAgent||"",D$=/Edge\/(\d+)/.exec(Vk),I$=/MSIE \d/.exec(Vk),_$=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vk),z$=!!(I$||_$||D$),L$=!z$&&!!Km&&/Apple Computer/.test(Km.vendor),CD=new fi("safari-ime-span"),Lb=!1,B$={key:CD,props:{decorations:V$,handleDOMEvents:{compositionstart:()=>{Lb=!0},compositionend:()=>{Lb=!1}}}};function V$(t){const{$from:e,$to:n,to:i}=t.selection;if(Lb&&e.sameParent(n)){const r=Br.widget(i,F$,{ignoreSelection:!0,key:"safari-ime-span"});return rn.create(t.doc,[r])}}function F$(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var P$=new ci(L$?B$:{key:CD});function Gm(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let i=0,r=n.indexOf(e);for(;r!==-1;)i++,r=n.indexOf(e,r+e.length);return i}function j$(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function $$(t,e,n){const r=mg((n||{}).ignore||[]),s=U$(e);let o=-1;for(;++o<s.length;)Bu(t,"text",u);function u(h,m){let g=-1,y;for(;++g<m.length;){const b=m[g],v=y?y.children:void 0;if(r(b,v?v.indexOf(b):void 0,y))return;y=b}if(y)return c(h,m)}function c(h,m){const g=m[m.length-1],y=s[o][0],b=s[o][1];let v=0;const T=g.children.indexOf(h);let M=!1,j=[];y.lastIndex=0;let F=y.exec(h.value);for(;F;){const J=F.index,V={index:F.index,input:F.input,stack:[...m,h]};let C=b(...F,V);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?y.lastIndex=J+1:(v!==J&&j.push({type:"text",value:h.value.slice(v,J)}),Array.isArray(C)?j.push(...C):C&&j.push(C),v=J+F[0].length,M=!0),!y.global)break;F=y.exec(h.value)}return M?(v<h.value.length&&j.push({type:"text",value:h.value.slice(v)}),g.children.splice(T,1,...j)):j=[h],T+j.length}}function U$(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<n.length;){const r=n[i];e.push([J$(r[0]),H$(r[1])])}return e}function J$(t){return typeof t=="string"?new RegExp(j$(t),"g"):t}function H$(t){return typeof t=="function"?t:function(){return t}}const Y1="phrasing",X1=["autolink","link","image","label"];function q$(){return{transforms:[Z$],enter:{literalAutolink:G$,literalAutolinkEmail:Q1,literalAutolinkHttp:Q1,literalAutolinkWww:Q1},exit:{literalAutolink:W$,literalAutolinkEmail:Q$,literalAutolinkHttp:Y$,literalAutolinkWww:X$}}}function K$(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Y1,notInConstruct:X1},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Y1,notInConstruct:X1},{character:":",before:"[ps]",after:"\\/",inConstruct:Y1,notInConstruct:X1}]}}function G$(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Q1(t){this.config.enter.autolinkProtocol.call(this,t)}function Y$(t){this.config.exit.autolinkProtocol.call(this,t)}function X$(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function Q$(t){this.config.exit.autolinkEmail.call(this,t)}function W$(t){this.exit(t)}function Z$(t){$$(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,eU],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),tU]],{ignore:["link","linkReference"]})}function eU(t,e,n,i,r){let s="";if(!wD(r)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!nU(n)))return!1;const o=iU(n+i);if(!o[0])return!1;const u={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[u,{type:"text",value:o[1]}]:u}function tU(t,e,n,i){return!wD(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function nU(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function iU(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],i=n.indexOf(")");const r=Gm(t,"(");let s=Gm(t,")");for(;i!==-1&&r>s;)t+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),s++;return[t,n]}function wD(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Bn(n)||pg(n))&&(!e||n!==47)}ED.peek=hU;function rU(){this.buffer()}function sU(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function aU(){this.buffer()}function oU(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function lU(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Cr(this.sliceSerialize(t)).toLowerCase(),n.label=e}function uU(t){this.exit(t)}function cU(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Cr(this.sliceSerialize(t)).toLowerCase(),n.label=e}function fU(t){this.exit(t)}function hU(){return"["}function ED(t,e,n,i){const r=n.createTracker(i);let s=r.move("[^");const o=n.enter("footnoteReference"),u=n.enter("reference");return s+=r.move(n.safe(n.associationId(t),{after:"]",before:s})),u(),o(),s+=r.move("]"),s}function pU(){return{enter:{gfmFootnoteCallString:rU,gfmFootnoteCall:sU,gfmFootnoteDefinitionLabelString:aU,gfmFootnoteDefinition:oU},exit:{gfmFootnoteCallString:lU,gfmFootnoteCall:uU,gfmFootnoteDefinitionLabelString:cU,gfmFootnoteDefinition:fU}}}function dU(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:ED},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,r,s,o){const u=s.createTracker(o);let c=u.move("[^");const h=s.enter("footnoteDefinition"),m=s.enter("label");return c+=u.move(s.safe(s.associationId(i),{before:c,after:"]"})),m(),c+=u.move("]:"),i.children&&i.children.length>0&&(u.shift(4),c+=u.move((e?`
54
- `:" ")+s.indentLines(s.containerFlow(i,u.current()),e?ND:mU))),h(),c}}function mU(t,e,n){return e===0?t:ND(t,e,n)}function ND(t,e,n){return(n?"":" ")+t}const gU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];AD.peek=kU;function yU(){return{canContainEols:["delete"],enter:{strikethrough:bU},exit:{strikethrough:SU}}}function xU(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:gU}],handlers:{delete:AD}}}function bU(t){this.enter({type:"delete",children:[]},t)}function SU(t){this.exit(t)}function AD(t,e,n,i){const r=n.createTracker(i),s=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(t,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),s(),o}function kU(){return"~"}function vU(t){return t.length}function CU(t,e){const n=e||{},i=(n.align||[]).concat(),r=n.stringLength||vU,s=[],o=[],u=[],c=[];let h=0,m=-1;for(;++m<t.length;){const E=[],T=[];let M=-1;for(t[m].length>h&&(h=t[m].length);++M<t[m].length;){const j=wU(t[m][M]);if(n.alignDelimiters!==!1){const F=r(j);T[M]=F,(c[M]===void 0||F>c[M])&&(c[M]=F)}E.push(j)}o[m]=E,u[m]=T}let g=-1;if(typeof i=="object"&&"length"in i)for(;++g<h;)s[g]=gA(i[g]);else{const E=gA(i);for(;++g<h;)s[g]=E}g=-1;const y=[],b=[];for(;++g<h;){const E=s[g];let T="",M="";E===99?(T=":",M=":"):E===108?T=":":E===114&&(M=":");let j=n.alignDelimiters===!1?1:Math.max(1,c[g]-T.length-M.length);const F=T+"-".repeat(j)+M;n.alignDelimiters!==!1&&(j=T.length+j+M.length,j>c[g]&&(c[g]=j),b[g]=j),y[g]=F}o.splice(1,0,y),u.splice(1,0,b),m=-1;const v=[];for(;++m<o.length;){const E=o[m],T=u[m];g=-1;const M=[];for(;++g<h;){const j=E[g]||"";let F="",J="";if(n.alignDelimiters!==!1){const V=c[g]-(T[g]||0),C=s[g];C===114?F=" ".repeat(V):C===99?V%2?(F=" ".repeat(V/2+.5),J=" ".repeat(V/2-.5)):(F=" ".repeat(V/2),J=F):J=" ".repeat(V)}n.delimiterStart!==!1&&!g&&M.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||g)&&M.push(" "),n.alignDelimiters!==!1&&M.push(F),M.push(j),n.alignDelimiters!==!1&&M.push(J),n.padding!==!1&&M.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&M.push("|")}v.push(n.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return v.join(`
55
- `)}function wU(t){return t==null?"":String(t)}function gA(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function EU(){return{enter:{table:NU,tableData:yA,tableHeader:yA,tableRow:TU},exit:{codeText:MU,table:AU,tableData:W1,tableHeader:W1,tableRow:W1}}}function NU(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function AU(t){this.exit(t),this.data.inTable=void 0}function TU(t){this.enter({type:"tableRow",children:[]},t)}function W1(t){this.exit(t)}function yA(t){this.enter({type:"tableCell",children:[]},t)}function MU(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,OU));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function OU(t,e){return e==="|"?e:t}function RU(t){const e=t||{},n=e.tableCellPadding,i=e.tablePipeAlign,r=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
56
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:o,tableCell:c,tableRow:u}};function o(b,v,E,T){return h(m(b,E,T),b.align)}function u(b,v,E,T){const M=g(b,E,T),j=h([M]);return j.slice(0,j.indexOf(`
57
- `))}function c(b,v,E,T){const M=E.enter("tableCell"),j=E.enter("phrasing"),F=E.containerPhrasing(b,{...T,before:s,after:s});return j(),M(),F}function h(b,v){return CU(b,{align:v,alignDelimiters:i,padding:n,stringLength:r})}function m(b,v,E){const T=b.children;let M=-1;const j=[],F=v.enter("table");for(;++M<T.length;)j[M]=g(T[M],v,E);return F(),j}function g(b,v,E){const T=b.children;let M=-1;const j=[],F=v.enter("tableRow");for(;++M<T.length;)j[M]=c(T[M],b,v,E);return F(),j}function y(b,v,E){let T=Qb.inlineCode(b,v,E);return E.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function DU(){return{exit:{taskListCheckValueChecked:xA,taskListCheckValueUnchecked:xA,paragraph:_U}}}function IU(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:zU}}}function xA(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function _U(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const r=e.children;let s=-1,o;for(;++s<r.length;){const u=r[s];if(u.type==="paragraph"){o=u;break}}o===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function zU(t,e,n,i){const r=t.children[0],s=typeof t.checked=="boolean"&&r&&r.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",u=n.createTracker(i);s&&u.move(o);let c=Qb.listItem(t,e,n,{...i,...u.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(m){return m+o}}function LU(){return[q$(),pU(),yU(),EU(),DU()]}function BU(t){return{extensions:[K$(),dU(t),xU(),RU(t),IU()]}}const VU={tokenize:JU,partial:!0},TD={tokenize:HU,partial:!0},MD={tokenize:qU,partial:!0},OD={tokenize:KU,partial:!0},FU={tokenize:GU,partial:!0},RD={name:"wwwAutolink",tokenize:$U,previous:ID},DD={name:"protocolAutolink",tokenize:UU,previous:_D},js={name:"emailAutolink",tokenize:jU,previous:zD},Kr={};function PU(){return{text:Kr}}let vo=48;for(;vo<123;)Kr[vo]=js,vo++,vo===58?vo=65:vo===91&&(vo=97);Kr[43]=js;Kr[45]=js;Kr[46]=js;Kr[95]=js;Kr[72]=[js,DD];Kr[104]=[js,DD];Kr[87]=[js,RD];Kr[119]=[js,RD];function jU(t,e,n){const i=this;let r,s;return o;function o(g){return!Bb(g)||!zD.call(i,i.previous)||Fk(i.events)?n(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(g))}function u(g){return Bb(g)?(t.consume(g),u):g===64?(t.consume(g),c):n(g)}function c(g){return g===46?t.check(FU,m,h)(g):g===45||g===95||oi(g)?(s=!0,t.consume(g),c):m(g)}function h(g){return t.consume(g),r=!0,c}function m(g){return s&&r&&bn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(g)):n(g)}}function $U(t,e,n){const i=this;return r;function r(o){return o!==87&&o!==119||!ID.call(i,i.previous)||Fk(i.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(VU,t.attempt(TD,t.attempt(MD,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function UU(t,e,n){const i=this;let r="",s=!1;return o;function o(g){return(g===72||g===104)&&_D.call(i,i.previous)&&!Fk(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),r+=String.fromCodePoint(g),t.consume(g),u):n(g)}function u(g){if(bn(g)&&r.length<5)return r+=String.fromCodePoint(g),t.consume(g),u;if(g===58){const y=r.toLowerCase();if(y==="http"||y==="https")return t.consume(g),c}return n(g)}function c(g){return g===47?(t.consume(g),s?h:(s=!0,c)):n(g)}function h(g){return g===null||xm(g)||ct(g)||Bn(g)||pg(g)?n(g):t.attempt(TD,t.attempt(MD,m),n)(g)}function m(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(g)}}function JU(t,e,n){let i=0;return r;function r(o){return(o===87||o===119)&&i<3?(i++,t.consume(o),r):o===46&&i===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function HU(t,e,n){let i,r,s;return o;function o(h){return h===46||h===95?t.check(OD,c,u)(h):h===null||ct(h)||Bn(h)||h!==45&&pg(h)?c(h):(s=!0,t.consume(h),o)}function u(h){return h===95?i=!0:(r=i,i=void 0),t.consume(h),o}function c(h){return r||i||!s?n(h):e(h)}}function qU(t,e){let n=0,i=0;return r;function r(o){return o===40?(n++,t.consume(o),r):o===41&&i<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(OD,e,s)(o):o===null||ct(o)||Bn(o)?e(o):(t.consume(o),r)}function s(o){return o===41&&i++,t.consume(o),r}}function KU(t,e,n){return i;function i(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),i):u===38?(t.consume(u),s):u===93?(t.consume(u),r):u===60||u===null||ct(u)||Bn(u)?e(u):n(u)}function r(u){return u===null||u===40||u===91||ct(u)||Bn(u)?e(u):i(u)}function s(u){return bn(u)?o(u):n(u)}function o(u){return u===59?(t.consume(u),i):bn(u)?(t.consume(u),o):n(u)}}function GU(t,e,n){return i;function i(s){return t.consume(s),r}function r(s){return oi(s)?n(s):e(s)}}function ID(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ct(t)}function _D(t){return!bn(t)}function zD(t){return!(t===47||Bb(t))}function Bb(t){return t===43||t===45||t===46||t===95||oi(t)}function Fk(t){let e=t.length,n=!1;for(;e--;){const i=t[e][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const YU={tokenize:iJ,partial:!0};function XU(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:eJ,continuation:{tokenize:tJ},exit:nJ}},text:{91:{name:"gfmFootnoteCall",tokenize:ZU},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QU,resolveTo:WU}}}}function QU(t,e,n){const i=this;let r=i.events.length;const s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o;for(;r--;){const c=i.events[r][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!o||!o._balanced)return n(c);const h=Cr(i.sliceSerialize({start:o.end,end:i.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function WU(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[t[n+1],t[n+2],["enter",i,e],t[n+3],t[n+4],["enter",r,e],["exit",r,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",i,e]];return t.splice(n,t.length-n+1,...u),t}function ZU(t,e,n){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s=0,o;return u;function u(g){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),c}function c(g){return g!==94?n(g):(t.enter("gfmFootnoteCallMarker"),t.consume(g),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(g){if(s>999||g===93&&!o||g===null||g===91||ct(g))return n(g);if(g===93){t.exit("chunkString");const y=t.exit("gfmFootnoteCallString");return r.includes(Cr(i.sliceSerialize(y)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(g)}return ct(g)||(o=!0),s++,t.consume(g),g===92?m:h}function m(g){return g===91||g===92||g===93?(t.consume(g),s++,h):h(g)}}function eJ(t,e,n){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s,o=0,u;return c;function c(v){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(v){return v===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(v)}function m(v){if(o>999||v===93&&!u||v===null||v===91||ct(v))return n(v);if(v===93){t.exit("chunkString");const E=t.exit("gfmFootnoteDefinitionLabelString");return s=Cr(i.sliceSerialize(E)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),y}return ct(v)||(u=!0),o++,t.consume(v),v===92?g:m}function g(v){return v===91||v===92||v===93?(t.consume(v),o++,m):m(v)}function y(v){return v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),r.includes(s)||r.push(s),nt(t,b,"gfmFootnoteDefinitionWhitespace")):n(v)}function b(v){return e(v)}}function tJ(t,e,n){return t.check(Lu,e,t.attempt(YU,e,n))}function nJ(t){t.exit("gfmFootnoteDefinition")}function iJ(t,e,n){const i=this;return nt(t,r,"gfmFootnoteDefinitionIndent",5);function r(s){const o=i.events[i.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function rJ(t){let n=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:s,resolveAll:r};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function r(o,u){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let h=c;for(;h--;)if(o[h][0]==="exit"&&o[h][1].type==="strikethroughSequenceTemporary"&&o[h][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[h][1].end.offset-o[h][1].start.offset){o[c][1].type="strikethroughSequence",o[h][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},o[h][1].start),end:Object.assign({},o[c][1].end)},g={type:"strikethroughText",start:Object.assign({},o[h][1].end),end:Object.assign({},o[c][1].start)},y=[["enter",m,u],["enter",o[h][1],u],["exit",o[h][1],u],["enter",g,u]],b=u.parser.constructs.insideSpan.null;b&&wi(y,y.length,0,dg(b,o.slice(h+1,c),u)),wi(y,y.length,0,[["exit",g,u],["enter",o[c][1],u],["exit",o[c][1],u],["exit",m,u]]),wi(o,h-1,c-h+3,y),c=h+y.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function s(o,u,c){const h=this.previous,m=this.events;let g=0;return y;function y(v){return h===126&&m[m.length-1][1].type!=="characterEscape"?c(v):(o.enter("strikethroughSequenceTemporary"),b(v))}function b(v){const E=Tu(h);if(v===126)return g>1?c(v):(o.consume(v),g++,b);if(g<2&&!n)return c(v);const T=o.exit("strikethroughSequenceTemporary"),M=Tu(v);return T._open=!M||M===2&&!!E,T._close=!E||E===2&&!!M,u(v)}}}class sJ{constructor(){this.map=[]}add(e,n,i){aJ(this,e,n,i)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];i.push(e.slice()),e.length=0;let r=i.pop();for(;r;){for(const s of r)e.push(s);r=i.pop()}this.map.length=0}}function aJ(t,e,n,i){let r=0;if(!(n===0&&i.length===0)){for(;r<t.map.length;){if(t.map[r][0]===e){t.map[r][1]+=n,t.map[r][2].push(...i);return}r+=1}t.map.push([e,n,i])}}function oJ(t,e){let n=!1;const i=[];for(;e<t.length;){const r=t[e];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&i.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=i.length-1;i[s]=i[s]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return i}function lJ(){return{flow:{null:{name:"table",tokenize:uJ,resolveAll:cJ}}}}function uJ(t,e,n){const i=this;let r=0,s=0,o;return u;function u(K){let pe=i.events.length-1;for(;pe>-1;){const Ie=i.events[pe][1].type;if(Ie==="lineEnding"||Ie==="linePrefix")pe--;else break}const he=pe>-1?i.events[pe][1].type:null,ke=he==="tableHead"||he==="tableRow"?C:c;return ke===C&&i.parser.lazy[i.now().line]?n(K):ke(K)}function c(K){return t.enter("tableHead"),t.enter("tableRow"),h(K)}function h(K){return K===124||(o=!0,s+=1),m(K)}function m(K){return K===null?n(K):Te(K)?s>1?(s=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(K),t.exit("lineEnding"),b):n(K):Ge(K)?nt(t,m,"whitespace")(K):(s+=1,o&&(o=!1,r+=1),K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),o=!0,m):(t.enter("data"),g(K)))}function g(K){return K===null||K===124||ct(K)?(t.exit("data"),m(K)):(t.consume(K),K===92?y:g)}function y(K){return K===92||K===124?(t.consume(K),g):g(K)}function b(K){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(K):(t.enter("tableDelimiterRow"),o=!1,Ge(K)?nt(t,v,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):v(K))}function v(K){return K===45||K===58?T(K):K===124?(o=!0,t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),E):V(K)}function E(K){return Ge(K)?nt(t,T,"whitespace")(K):T(K)}function T(K){return K===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(K),t.exit("tableDelimiterMarker"),M):K===45?(s+=1,M(K)):K===null||Te(K)?J(K):V(K)}function M(K){return K===45?(t.enter("tableDelimiterFiller"),j(K)):V(K)}function j(K){return K===45?(t.consume(K),j):K===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(K),t.exit("tableDelimiterMarker"),F):(t.exit("tableDelimiterFiller"),F(K))}function F(K){return Ge(K)?nt(t,J,"whitespace")(K):J(K)}function J(K){return K===124?v(K):K===null||Te(K)?!o||r!==s?V(K):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(K)):V(K)}function V(K){return n(K)}function C(K){return t.enter("tableRow"),L(K)}function L(K){return K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),L):K===null||Te(K)?(t.exit("tableRow"),e(K)):Ge(K)?nt(t,L,"whitespace")(K):(t.enter("data"),q(K))}function q(K){return K===null||K===124||ct(K)?(t.exit("data"),L(K)):(t.consume(K),K===92?re:q)}function re(K){return K===92||K===124?(t.consume(K),q):q(K)}}function cJ(t,e){let n=-1,i=!0,r=0,s=[0,0,0,0],o=[0,0,0,0],u=!1,c=0,h,m,g;const y=new sJ;for(;++n<t.length;){const b=t[n],v=b[1];b[0]==="enter"?v.type==="tableHead"?(u=!1,c!==0&&(bA(y,e,c,h,m),m=void 0,c=0),h={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(n,0,[["enter",h,e]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(i=!0,g=void 0,s=[0,0,0,0],o=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(n,0,[["enter",m,e]])),r=v.type==="tableDelimiterRow"?2:m?3:1):r&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(i=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],g=_d(y,e,s,r,void 0,g),s=[0,0,0,0]),o[2]=n)):v.type==="tableCellDivider"&&(i?i=!1:(s[1]!==0&&(o[0]=o[1],g=_d(y,e,s,r,void 0,g)),s=o,o=[s[1],n,0,0])):v.type==="tableHead"?(u=!0,c=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(c=n,s[1]!==0?(o[0]=o[1],g=_d(y,e,s,r,n,g)):o[1]!==0&&(g=_d(y,e,o,r,n,g)),r=0):r&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&bA(y,e,c,h,m),y.consume(e.events),n=-1;++n<e.events.length;){const b=e.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=oJ(e.events,n))}return t}function _d(t,e,n,i,r,s){const o=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Su(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=Su(e.events,n[1]);if(s={type:o,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const h=Su(e.events,n[2]),m=Su(e.events,n[3]),g={type:u,start:Object.assign({},h),end:Object.assign({},m)};if(t.add(n[2],0,[["enter",g,e]]),i!==2){const y=e.events[n[2]],b=e.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,E=n[3]-n[2]-1;t.add(v,E,[])}}t.add(n[3]+1,0,[["exit",g,e]])}return r!==void 0&&(s.end=Object.assign({},Su(e.events,r)),t.add(r,0,[["exit",s,e]]),s=void 0),s}function bA(t,e,n,i,r){const s=[],o=Su(e.events,n);r&&(r.end=Object.assign({},o),s.push(["exit",r,e])),i.end=Object.assign({},o),s.push(["exit",i,e]),t.add(n+1,0,s)}function Su(t,e){const n=t[e],i=n[0]==="enter"?"start":"end";return n[1][i]}const fJ={name:"tasklistCheck",tokenize:pJ};function hJ(){return{text:{91:fJ}}}function pJ(t,e,n){const i=this;return r;function r(c){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),s)}function s(c){return ct(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(c)}function u(c){return Te(c)?e(c):Ge(c)?t.check({tokenize:dJ},e,n)(c):n(c)}}function dJ(t,e,n){return nt(t,i,"whitespace");function i(r){return r===null?n(r):e(r)}}function mJ(t){return Kb([PU(),XU(),rJ(t),lJ(),hJ()])}const gJ={};function yJ(t){const e=this,n=t||gJ,i=e.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(mJ(n)),s.push(LU()),o.push(BU(n))}function Fe(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var Pk=Gh("strike_through");Fe(Pk,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var sp=Fu("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(Pk.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,n,i)=>{e.openMark(i),e.next(n.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,n)=>{e.withMark(n,"delete")}}}));Fe(sp.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Fe(sp.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Bg=Je("ToggleStrikeThrough",t=>()=>bg(sp.type(t)));Fe(Bg,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var LD=hi(t=>Uh(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),sp.type(t)));Fe(LD,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var jk=Ti("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(xt);return()=>e.call(Bg.key)}}});Fe(jk.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Fe(jk.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var ap=qP({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),Os=en("table",()=>({...ap.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="table",runner:(t,e,n)=>{const i=e.align,r=e.children.map((s,o)=>({...s,align:i,isHeader:o===0}));t.openNode(n),t.next(r),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table",runner:(t,e)=>{const n=e.content.firstChild?.content;if(!n)return;const i=[];n.forEach(r=>{i.push(r.attrs.alignment)}),t.openNode("table",void 0,{align:i}),t.next(e.content),t.closeNode()}}}));Fe(Os.node,{displayName:"NodeSchema<table>",group:"Table"});Fe(Os.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var op=en("table_header_row",()=>({...ap.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:t=>t instanceof HTMLElement&&t.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:t=>!!(t.type==="tableRow"&&t.isHeader),runner:(t,e,n)=>{const i=e.align,r=e.children.map((s,o)=>({...s,align:i[o],isHeader:e.isHeader}));t.openNode(n),t.next(r),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow",void 0,{isHeader:!0}),t.next(e.content),t.closeNode())}}}));Fe(op.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Fe(op.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Hu=en("table_row",()=>({...ap.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:t=>t.type==="tableRow",runner:(t,e,n)=>{const i=e.align,r=e.children.map((s,o)=>({...s,align:i[o]}));t.openNode(n),t.next(r),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow"),t.next(e.content),t.closeNode())}}}));Fe(Hu.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Fe(Hu.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var lp=en("table_cell",()=>({...ap.table_cell,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!t.isHeader,runner:(t,e,n)=>{const i=e.align;t.openNode(n,{alignment:i}).openNode(t.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:t=>t.type.name==="table_cell",runner:(t,e)=>{t.openNode("tableCell").next(e.content).closeNode()}}}));Fe(lp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Fe(lp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var zu=en("table_header",()=>({...ap.table_header,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!!t.isHeader,runner:(t,e,n)=>{const i=e.align;t.openNode(n,{alignment:i}),t.openNode(t.schema.nodes.paragraph),t.next(e.children),t.closeNode(),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header",runner:(t,e)=>{t.openNode("tableCell"),t.next(e.content),t.closeNode()}}}));Fe(zu.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Fe(zu.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function BD(t,e=3,n=3){const i=Array(n).fill(0).map(()=>lp.type(t).createAndFill()),r=Array(n).fill(0).map(()=>zu.type(t).createAndFill()),s=Array(e).fill(0).map((o,u)=>u===0?op.type(t).create(null,r):Hu.type(t).create(null,i));return Os.type(t).create(null,s)}function VD(t){return(e,n)=>i=>{n=n??i.selection.from;const r=i.doc.resolve(n),s=dB(c=>c.type.name==="table")(r),o=s?{node:s.node,from:s.start}:void 0,u=t==="row";if(o){const c=bt.get(o.node);if(e>=0&&e<(u?c.height:c.width)){const h=c.positionAt(u?e:c.height-1,u?c.width-1:e,o.node),m=i.doc.resolve(o.from+h),g=u?Rt.rowSelection:Rt.colSelection,y=c.positionAt(u?e:0,u?0:e,o.node),b=i.doc.resolve(o.from+y);return ZM(i.setSelection(g(m,b)))}}return i}}var xJ=VD("row"),bJ=VD("col");function FD(t,e,{map:n,tableStart:i,table:r},s){const o=Array(s).fill(0).reduce((c,h,m)=>c+r.child(m).nodeSize,i),u=Array(n.width).fill(0).map((c,h)=>{const m=r.nodeAt(n.map[h]);return lp.type(t).createAndFill({alignment:m?.attrs.alignment})});return e.insert(o,Hu.type(t).create(null,u)),e}function SJ(t){const e=np(t.$from);if(!e)return;const n=bt.get(e.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(i=>{const r=e.node.nodeAt(i),s=i+e.start;return{pos:s,start:s+1,node:r}})}function kJ(t){const e=SJ(t.selection);if(e&&e[0]){const n=t.doc.resolve(e[0].pos),i=e[e.length-1];if(i){const r=t.doc.resolve(i.pos);return ZM(t.setSelection(new Rt(r,n)))}}return t}var $k=Je("GoToPrevTableCell",()=>()=>JR(-1));Fe($k,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var Uk=Je("GoToNextTableCell",()=>()=>JR(1));Fe(Uk,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var Jk=Je("ExitTable",t=>()=>(e,n)=>{if(!or(e))return!1;const{$head:i}=e.selection,r=pB(i,Os.type(t));if(!r)return!1;const{to:s}=r,o=e.tr.replaceWith(s,s,Pr.type(t).createAndFill());return o.setSelection(Ve.near(o.doc.resolve(s),1)).scrollIntoView(),n?.(o),!0});Fe(Jk,{displayName:"Command<breakTableCommand>",group:"Table"});var PD=Je("InsertTable",t=>({row:e,col:n}={})=>(i,r)=>{const{selection:s,tr:o}=i,{from:u}=s,c=BD(t,e,n),h=o.replaceSelectionWith(c),m=Ve.findFrom(h.doc.resolve(u),1,!0);return m&&h.setSelection(m),r?.(h),!0});Fe(PD,{displayName:"Command<insertTableCommand>",group:"Table"});var jD=Je("MoveRow",()=>({from:t,to:e,pos:n}={})=>Sj({from:t??0,to:e??0,pos:n}));Fe(jD,{displayName:"Command<moveRowCommand>",group:"Table"});var $D=Je("MoveCol",()=>({from:t,to:e,pos:n}={})=>kj({from:t??0,to:e??0,pos:n}));Fe($D,{displayName:"Command<moveColCommand>",group:"Table"});var UD=Je("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:i}=e;return!!n?.(xJ(t.index,t.pos)(i))});Fe(UD,{displayName:"Command<selectRowCommand>",group:"Table"});var JD=Je("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:i}=e;return!!n?.(bJ(t.index,t.pos)(i))});Fe(JD,{displayName:"Command<selectColCommand>",group:"Table"});var HD=Je("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!e?.(kJ(n))});Fe(HD,{displayName:"Command<selectTableCommand>",group:"Table"});var qD=Je("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof Rt))return!1;const i=n.isRowSelection(),r=n.isColSelection();return i&&r?bj(t,e):r?pj(t,e):mj(t,e)});Fe(qD,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var KD=Je("AddColBefore",()=>()=>cj);Fe(KD,{displayName:"Command<addColBeforeCommand>",group:"Table"});var GD=Je("AddColAfter",()=>()=>fj);Fe(GD,{displayName:"Command<addColAfterCommand>",group:"Table"});var YD=Je("AddRowBefore",t=>()=>(e,n)=>{if(!or(e))return!1;if(n){const i=Wa(e);n(FD(t,e.tr,i,i.top))}return!0});Fe(YD,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var XD=Je("AddRowAfter",t=>()=>(e,n)=>{if(!or(e))return!1;if(n){const i=Wa(e);n(FD(t,e.tr,i,i.bottom))}return!0});Fe(XD,{displayName:"Command<addRowAfterCommand>",group:"Table"});var QD=Je("SetAlign",()=>(t="left")=>gj("alignment",t));Fe(QD,{displayName:"Command<setAlignCommand>",group:"Table"});var WD=hi(t=>new Ai(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,n,i,r)=>{const s=e.doc.resolve(i);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),Os.type(t)))return null;const o=BD(t,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),u=e.tr.replaceRangeWith(i,r,o);return u.setSelection(Ee.create(u.doc,i+3)).scrollIntoView()}));Fe(WD,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var ZD=MV(t=>({run:(e,n,i)=>{if(i)return e;function r(h){const m=h.childCount,g=h.lastChild?.childCount??0;if(m===0||g===0)return Pr.type(t).create();const y=h.firstChild;if(!(g>0&&y&&y.childCount===0))return h;if(m>=3){const T=h.child(1),M=[];for(let J=0;J<T.childCount;J++){const V=T.child(J);M.push(zu.type(t).create(V.attrs,V.content,V.marks))}const j=y.type.create(y.attrs,M),F=[];for(let J=2;J<m;J++)F.push(h.child(J));return h.type.create(h.attrs,[j,...F])}const b=Array(g).fill(0).map(()=>zu.type(t).createAndFill()),v=new H(G.from(b),0,0),E=y.replace(0,0,v);return h.replace(0,y.nodeSize,new H(G.from(E),0,0))}function s(h){const m=Hu.type(t),g=[];let y=[],b=!1;function v(){if(y.length===0)return;const E=op.type(t).createAndFill(),T=Os.type(t).create(null,[E,...y]);g.push(r(T)),y=[]}return h.forEach(E=>{E.type===m?(b=!0,y.push(E)):(v(),g.push(E))}),v(),b?G.from(g):h}function o(h){let m=s(h),g=m!==h;const y=[];return m.forEach(b=>{if(b.type===Os.type(t)){const v=r(b);v!==b&&(g=!0),y.push(v)}else if(b.childCount>0){const v=o(b.content);v!==b.content?(g=!0,y.push(b.copy(v))):y.push(b)}else y.push(b)}),g?G.from(y):h}function u(h){const m=[],g=[];h.forEach(y=>g.push(y));for(let y=0;y<g.length;y++){const b=g[y],v=g[y+1];b.type===Pr.type(t)&&b.content.size===0&&v&&v.type===Os.type(t)||m.push(b)}return m.length<g.length?G.from(m):h}let c=o(e.content);return c=u(c),new H(G.from(c),e.openStart,e.openEnd)}}));Fe(ZD,{displayName:"PasteRule<table>",group:"Table"});var Hk=Ti("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(xt);return()=>e.call(Uk.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(xt);return()=>e.call($k.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(xt);return()=>e.call(Jk.key)}}});Fe(Hk.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Fe(Hk.shortcuts,{displayName:"Keymap<table>",group:"Table"});var Z1="footnote_definition",SA="footnoteDefinition",qk=en("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${Z1}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Jr(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":Z1},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===SA,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===Z1,runner:(t,e)=>{t.openNode(SA,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));Fe(qk.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Fe(qk.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var ex="footnote_reference",Kk=en("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${ex}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Jr(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":ex},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===ex,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));Fe(Kk.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Fe(Kk.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var Gk=Vs.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:i=>{if(!(i instanceof HTMLElement))throw Jr(i);return{label:i.dataset.label,listType:i.dataset.listType,spread:i.dataset.spread,checked:i.dataset.checked?i.dataset.checked==="true":null}}},...n?.parseDOM||[]],toDOM:i=>n.toDOM&&i.attrs.checked==null?n.toDOM(i):["li",{"data-item-type":"task","data-label":i.attrs.label,"data-list-type":i.attrs.listType,"data-spread":i.attrs.spread,"data-checked":i.attrs.checked},0],parseMarkdown:{match:({type:i})=>i==="listItem",runner:(i,r,s)=>{if(r.checked==null){n.parseMarkdown.runner(i,r,s);return}const o=r.label!=null?`${r.label}.`:"•",u=r.checked!=null?!!r.checked:null,c=r.label!=null?"ordered":"bullet",h=r.spread!=null?`${r.spread}`:"true";i.openNode(s,{label:o,listType:c,spread:h,checked:u}),i.next(r.children),i.closeNode()}},toMarkdown:{match:i=>i.type.name==="list_item",runner:(i,r)=>{if(r.attrs.checked==null){n.toMarkdown.runner(i,r);return}const s=r.attrs.label,o=r.attrs.listType,u=r.attrs.spread==="true",c=r.attrs.checked;i.openNode("listItem",void 0,{label:s,listType:o,spread:u,checked:c}),i.next(r.content),i.closeNode()}}}});Fe(Gk.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Fe(Gk.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var eI=hi(()=>new Ai(/^\[(?<checked>\s|x)\]\s$/,(t,e,n,i)=>{const r=t.doc.resolve(n);let s=0,o=r.node(s);for(;o&&o.type.name!=="list_item";)s--,o=r.node(s);if(!o||o.attrs.checked!=null)return null;const u=e.groups?.checked==="x",c=r.before(s),h=t.tr;return h.deleteRange(n,i).setNodeMarkup(c,void 0,{...o.attrs,checked:u}),h}));Fe(eI,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var vJ=[jk,Hk].flat(),CJ=[WD,eI],wJ=[LD],EJ=[ZD],tI=Bs(()=>P$);Fe(tI,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var NJ=Bs(()=>Rj({}));Fe(NJ,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var nI=Bs(()=>jj({allowTableNodeSelection:!0}));Fe(nI,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var Yk=Xa("remarkGFM",()=>yJ);Fe(Yk.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Fe(Yk.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var AJ=new fi("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function TJ(t,e){let n=0;return e.forEach((i,r,s)=>{i===t&&(n=s)}),n}var iI=Bs(()=>new ci({key:AJ,appendTransaction:(t,e,n)=>{let i;const r=(s,o)=>{if(i||(i=n.tr),s.type.name!=="table_cell")return;const u=n.doc.resolve(o),c=u.node(u.depth),h=u.node(u.depth-1).firstChild;if(!h)return;const m=TJ(s,c),g=h.maybeChild(m);if(!g)return;const y=g.attrs.alignment;y!==s.attrs.alignment&&i.setNodeMarkup(o,void 0,{...s.attrs,alignment:y})};return e.doc!==n.doc&&n.doc.descendants(r),i}}));Fe(iI,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var MJ=[iI,tI,Yk,nI].flat(),OJ=[Gk,Os,op,Hu,zu,lp,qk,Kk,Pk,sp].flat(),RJ=[Uk,$k,Jk,PD,jD,$D,UD,JD,HD,qD,YD,XD,KD,GD,QD,Bg],rI=[OJ,CJ,EJ,wJ,vJ,RJ,MJ].flat();const DJ={display:"flex",gap:6,alignItems:"center",padding:6,border:"1px solid #d4d4d8",borderRadius:6,background:"#fff",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",marginTop:6},IJ={flex:1,border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 8px",font:"inherit",outline:"none",minWidth:0},tx={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"};function _J({initialUrl:t,isEdit:e,onApply:n,onRemove:i,onClose:r}){const[s,o]=fe.useState(t),u=()=>{const c=s.trim();c!==""&&n(c)};return _.jsxs("div",{style:DJ,"data-mdx-action":"link",onMouseDown:c=>c.stopPropagation(),children:[_.jsx("input",{style:IJ,autoFocus:!0,placeholder:"https://…",value:s,onChange:c=>o(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u()),c.key==="Escape"&&r()}}),_.jsx("button",{type:"button",style:{...tx,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:c=>c.preventDefault(),onClick:u,children:e?"Update":"Add"}),e&&i?_.jsx("button",{type:"button",style:{...tx,color:"#dc2626"},onMouseDown:c=>c.preventDefault(),onClick:i,children:"Remove"}):null,_.jsx("button",{type:"button",style:tx,onMouseDown:c=>c.preventDefault(),onClick:r,children:"Cancel"})]})}function kA(t){return typeof t!="object"||t===null?!1:"status"in t&&t.status===501||"code"in t&&t.code==="unsupported"}const vA=new Set(["image/svg+xml","image/x-icon"]),zJ=[{value:"all",label:"All"},{value:"photo",label:"Photos"},{value:"graphic",label:"Graphics"},{value:"document",label:"Documents"}];function LJ(t,e){return e==="all"?!0:e==="photo"?t.startsWith("image/")&&!vA.has(t):e==="graphic"?vA.has(t):e==="document"?t==="application/pdf":!0}const BJ={position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100},VJ={width:"min(760px, 94vw)",maxHeight:"82vh",display:"flex",flexDirection:"column",background:"#fff",border:"1px solid #d4d4d8",borderRadius:12,boxShadow:"0 16px 48px rgba(0,0,0,0.28)",overflow:"hidden",fontSize:13,color:"#27272a"},FJ={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #ececed"},PJ={display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",borderBottom:"1px solid #ececed"},Kc={display:"flex",alignItems:"center",gap:8},CA={flex:1,border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},ku={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},wA={...ku,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},jJ={display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,padding:16,overflowY:"auto"},EA={position:"relative",aspectRatio:"1 / 1",border:"1px solid #e4e4e7",borderRadius:8,overflow:"hidden",cursor:"pointer",background:"#fafafa",padding:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6},$J={position:"absolute",left:0,right:0,bottom:0,padding:"4px 6px",fontSize:11,color:"#fff",background:"linear-gradient(to top, rgba(0,0,0,0.65), transparent)",textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function sI({media:t,context:e,field:n,accept:i="image/*,application/pdf",onSelect:r,onClose:s}){const[o,u]=fe.useState([]),[c,h]=fe.useState([]),[m,g]=fe.useState(""),[y,b]=fe.useState(""),[v,E]=fe.useState("all"),[T,M]=fe.useState(!1),[j,F]=fe.useState(!1),[J,V]=fe.useState(!1),[C,L]=fe.useState(null),[q,re]=fe.useState(!1),[K,pe]=fe.useState(""),he=fe.useRef(null),ke=fe.useMemo(()=>async D=>{M(!0),L(null);try{const P=await t.listMedia({folder:D||void 0});u(P.items),h(P.folders)}catch(P){kA(P)?F(!0):L(P instanceof Error?P.message:"Failed to load media")}finally{M(!1)}},[t]);fe.useEffect(()=>{ke(m)},[ke,m]);const Ie=D=>{b(""),g(D)},De=async D=>{V(!0),L(null);try{const P=await t.uploadMedia(D,{...e,field:n,folder:m||void 0});if(P.success&&P.url){if(P.url.startsWith("./")){r(P.url,P.annotation??"");return}const ne={id:P.id??P.url,url:P.url,filename:P.filename??D.name,annotation:P.annotation,contentType:D.type||"application/octet-stream",folder:m||void 0};u(B=>[ne,...B])}else L(P.error??"Upload failed")}catch(P){kA(P)?F(!0):L(P instanceof Error?P.message:"Upload failed")}finally{V(!1)}},W=async()=>{const D=K.trim();if(!D||!t.createFolder)return;if(/[/\\:*?"<>|]/.test(D)){L("Invalid folder name");return}const P=m?`${m}/${D}`:D;try{const ne=await t.createFolder(P);ne.success?h(B=>[...B,{name:D,path:P}].sort((be,Re)=>be.name.localeCompare(Re.name))):L(ne.error??"Failed to create folder")}catch(ne){L(ne instanceof Error?ne.message:"Failed to create folder")}pe(""),re(!1)},oe=fe.useMemo(()=>{const D=v==="all"?o:o.filter(ne=>LJ(ne.contentType,v)),P=y.trim().toLowerCase();return P===""?D:D.filter(ne=>ne.filename.toLowerCase().includes(P))},[o,v,y]),de=fe.useMemo(()=>{if(!m)return[];const D=m.split("/");return D.map((P,ne)=>({name:P,path:D.slice(0,ne+1).join("/")}))},[m]),ve=!y&&v==="all";return _.jsx("div",{style:BJ,onMouseDown:s,"data-cms-ui":"",children:_.jsxs("div",{style:VJ,onMouseDown:D=>D.stopPropagation(),onDrop:D=>{D.preventDefault();const P=D.dataTransfer.files[0];P&&De(P)},onDragOver:D=>D.preventDefault(),children:[_.jsxs("div",{style:FJ,children:[_.jsx("strong",{style:{fontSize:15},children:"Media Library"}),_.jsx("button",{type:"button",style:{...ku,border:"none",fontSize:18,lineHeight:1,padding:2},onClick:s,"aria-label":"Close",children:"×"})]}),_.jsxs("div",{style:PJ,children:[de.length>0?_.jsxs("div",{style:{...Kc,gap:4,fontSize:12,color:"#71717a"},children:[_.jsx("button",{type:"button",style:{...ku,border:"none",padding:"0 2px"},onClick:()=>Ie(""),children:"root"}),de.map((D,P)=>_.jsxs("span",{style:Kc,children:[_.jsx("span",{children:"/"}),P===de.length-1?_.jsx("span",{style:{color:"#27272a",fontWeight:600},children:D.name}):_.jsx("button",{type:"button",style:{...ku,border:"none",padding:"0 2px"},onClick:()=>Ie(D.path),children:D.name})]},D.path))]}):null,_.jsxs("div",{style:Kc,children:[_.jsx("input",{style:CA,placeholder:"Search files…",value:y,onChange:D=>b(D.target.value)}),t.createFolder?_.jsx("button",{type:"button",style:ku,onClick:()=>re(D=>!D),children:"New folder"}):null,_.jsx("button",{type:"button",style:wA,disabled:j||J,onClick:()=>he.current?.click(),children:J?"Uploading…":"Upload"}),_.jsx("input",{ref:he,type:"file",accept:i,style:{display:"none"},onChange:D=>{const P=D.target.files?.[0];P&&De(P),D.target.value=""}})]}),_.jsx("div",{style:{...Kc,gap:4},children:zJ.map(D=>_.jsx("button",{type:"button",style:{...ku,padding:"3px 10px",fontSize:12,...v===D.value?{background:"#2563eb",borderColor:"#2563eb",color:"#fff"}:{}},onClick:()=>E(D.value),children:D.label},D.value))}),q&&t.createFolder?_.jsxs("div",{style:Kc,children:[_.jsx("input",{style:CA,autoFocus:!0,placeholder:"Folder name…",value:K,onChange:D=>pe(D.target.value),onKeyDown:D=>{D.key==="Enter"&&W(),D.key==="Escape"&&(re(!1),pe(""))}}),_.jsx("button",{type:"button",style:wA,onClick:()=>{W()},children:"Create"})]}):null,j?_.jsx("div",{style:{fontSize:12,color:"#a16207"},children:"Media uploads are not configured for this project."}):null,C?_.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:C}):null]}),T?_.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:"Loading…"}):c.length===0&&oe.length===0?_.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:y||v!=="all"?"No matching files.":"No files yet. Upload one to get started."}):_.jsxs("div",{style:jJ,children:[ve?c.map(D=>_.jsxs("button",{type:"button",style:EA,onClick:()=>Ie(D.path),title:D.name,children:[_.jsx("span",{style:{fontSize:30},children:"📁"}),_.jsx("span",{style:{fontSize:12,color:"#52525b",maxWidth:"90%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.name})]},D.path)):null,oe.map(D=>_.jsxs("button",{type:"button",style:EA,title:D.filename,onClick:()=>r(D.url,D.annotation||D.filename||"Image"),children:[D.contentType.startsWith("image/")?_.jsx("img",{src:D.url,alt:D.annotation||D.filename,style:{width:"100%",height:"100%",objectFit:"cover"}}):_.jsx("span",{style:{fontSize:30},children:D.contentType==="application/pdf"?"📄":"📎"}),_.jsx("span",{style:$J,children:D.filename})]},D.id))]}),_.jsxs("div",{style:{padding:"10px 16px",borderTop:"1px solid #ececed",fontSize:12,color:"#a1a1aa",textAlign:"center"},children:["Drag and drop a file here to upload",m?` to ${m}`:"","."]})]})})}const Vb={bold:!1,italic:!1,strikethrough:!1,link:!1,linkHref:null,bulletList:!1,orderedList:!1,blockquote:!1,heading:null};function UJ(t){const{state:e}=t,{$from:n,from:i,to:r}=e.selection;let s=!1,o=!1,u=!1,c=!1,h=null;const m=e.storedMarks||n.marks();for(const E of m)E.type.name==="strong"&&(s=!0),E.type.name==="emphasis"&&(o=!0),E.type.name==="strike_through"&&(u=!0),E.type.name==="link"&&(c=!0,h=typeof E.attrs.href=="string"?E.attrs.href:null);i!==r&&e.doc.nodesBetween(i,r,E=>{for(const T of E.marks)T.type.name==="strong"&&(s=!0),T.type.name==="emphasis"&&(o=!0),T.type.name==="strike_through"&&(u=!0),T.type.name==="link"&&(c=!0,h=typeof T.attrs.href=="string"?T.attrs.href:null)});let g=!1,y=!1,b=!1,v=null;for(let E=n.depth;E>0;E--){const T=n.node(E);T.type.name==="bullet_list"&&(g=!0),T.type.name==="ordered_list"&&(y=!0),T.type.name==="blockquote"&&(b=!0)}if(n.parent.type.name==="heading"){const E=n.parent.attrs.level;v=typeof E=="number"?E:null}return{bold:s,italic:o,strikethrough:u,link:c,linkHref:h,bulletList:g,orderedList:y,blockquote:b,heading:v}}function JJ(t,e){const{$from:n}=t.state.selection;for(let i=n.depth;i>0;i--)if(n.node(i).type.name===e)return!0;return!1}function HJ(t,e){const{state:n}=t,i=n.schema.nodes.heading,r=n.schema.nodes.paragraph;if(!i||!r)return;const{$from:s}=n.selection,o=s.parent.type.name==="heading"&&s.parent.attrs.level===e,u=o?r:i,c=o?void 0:{level:e},h=s.before(s.depth),m=n.selection.$to.after(n.selection.$to.depth);t.dispatch(n.tr.setBlockType(h,m,u,c)),t.focus()}function qJ(t){const{state:e}=t,{from:n,to:i}=e.selection,r=e.schema.marks.link;if(!r)return;let s=n,o=i;e.doc.nodesBetween(n,n===i?i+1:i,(u,c)=>{if(r.isInSet(u.marks))return s=c,o=c+u.nodeSize,!1}),t.dispatch(e.tr.removeMark(s,o,r))}function KJ(t,e){return t.bold===e.bold&&t.italic===e.italic&&t.strikethrough===e.strikethrough&&t.link===e.link&&t.linkHref===e.linkHref&&t.bulletList===e.bulletList&&t.orderedList===e.orderedList&&t.blockquote===e.blockquote&&t.heading===e.heading}function GJ(t,e){let n=0,i=Vb;const r=()=>{const u=t.ctx.get(Sn),c=UJ(u);KJ(c,i)||(i=c,e(c))},s=t.ctx.get(Sn),o=s.dispatch.bind(s);return s.dispatch=u=>{o(u),(u.selectionSet||u.docChanged)&&(cancelAnimationFrame(n),n=requestAnimationFrame(r))},r(),()=>{cancelAnimationFrame(n)}}function YJ(t){const[e,n]=fe.useState(Vb);return fe.useEffect(()=>{if(!t){n(Vb);return}return GJ(t,n)},[t]),e}function nx(t,e){HJ(t.ctx.get(Sn),e)}function NA(t,e){const n=t.ctx.get(Sn);JJ(n,e==="bullet"?"bullet_list":"ordered_list")?t.action(Ma(Rg.key)):t.action(Ma(e==="bullet"?Mg.key:Og.key))}function XJ(t,e,n){t.action(i=>{const r=i.get(Sn),s=r.state.schema.nodes.image;s&&(r.focus(),r.dispatch(r.state.tr.replaceSelectionWith(s.create({src:e,alt:n})).scrollIntoView()))})}const QJ={display:"flex",flexWrap:"wrap",alignItems:"center",gap:3,padding:"4px 6px",borderBottom:"1px solid #ececed",background:"#fafafa"},ix={width:1,height:18,background:"#e4e4e7",margin:"0 3px"},aI={border:"1px solid transparent",background:"transparent",borderRadius:4,padding:"2px 7px",font:"inherit",fontSize:12,lineHeight:1.4,cursor:"pointer",color:"#52525b"},WJ={...aI,background:"#2563eb",borderColor:"#2563eb",color:"#fff"};function Hi({active:t,title:e,onClick:n,style:i,children:r}){return _.jsx("button",{type:"button",title:e,"data-mdx-action":"format",onMouseDown:s=>s.preventDefault(),onClick:n,style:{...t?WJ:aI,...i},children:r})}function oI({editor:t,media:e,mediaContext:n,field:i,onInsertComponent:r}){const s=YJ(t),[o,u]=fe.useState(!1),[c,h]=fe.useState(!1),m=t===null,g=b=>{if(u(!1),!t)return;t.ctx.get(Sn).focus(),t.action(Ma(s.link?BS.key:LS.key,{href:b}))},y=()=>{if(u(!1),!t)return;const b=t.ctx.get(Sn);b.focus(),qJ(b)};return _.jsxs("div",{children:[_.jsxs("div",{style:QJ,children:[_.jsx(Hi,{active:s.bold,title:"Bold",onClick:()=>t?.action(Ma(Eg.key)),style:{fontWeight:700},children:"B"}),_.jsx(Hi,{active:s.italic,title:"Italic",onClick:()=>t?.action(Ma(wg.key)),style:{fontStyle:"italic"},children:"I"}),_.jsx(Hi,{active:s.strikethrough,title:"Strikethrough",onClick:()=>t?.action(Ma(Bg.key)),style:{textDecoration:"line-through"},children:"S"}),_.jsx("span",{style:ix}),_.jsx(Hi,{active:s.heading===2,title:"Heading 2",onClick:()=>t&&nx(t,2),children:"H2"}),_.jsx(Hi,{active:s.heading===3,title:"Heading 3",onClick:()=>t&&nx(t,3),children:"H3"}),_.jsx(Hi,{active:s.heading===4,title:"Heading 4",onClick:()=>t&&nx(t,4),children:"H4"}),_.jsx("span",{style:ix}),_.jsx(Hi,{active:s.bulletList,title:"Bullet list",onClick:()=>t&&NA(t,"bullet"),children:"• List"}),_.jsx(Hi,{active:s.orderedList,title:"Numbered list",onClick:()=>t&&NA(t,"ordered"),children:"1. List"}),_.jsx(Hi,{active:s.blockquote,title:"Quote",onClick:()=>t?.action(Ma(Tg.key)),children:"❝"}),_.jsx("span",{style:ix}),_.jsx(Hi,{active:s.link||o,title:"Link",onClick:()=>!m&&u(b=>!b),children:"🔗 Link"}),e?_.jsx(Hi,{title:"Insert image",onClick:()=>!m&&h(!0),children:"🖼 Image"}):null,r?_.jsxs(_.Fragment,{children:[_.jsx("span",{style:{flex:1}}),_.jsx(Hi,{title:"Insert component block",onClick:()=>!m&&r(),style:{border:"1px solid #d4d4d8",color:"#3f3f46"},children:"+ Component"})]}):null]}),o?_.jsx("div",{style:{padding:"0 6px"},children:_.jsx(_J,{initialUrl:s.linkHref??"https://",isEdit:s.link,onApply:g,onRemove:s.link?y:void 0,onClose:()=>u(!1)})}):null,c&&e?_.jsx(sI,{media:e,context:n,field:i,accept:"image/*",onSelect:(b,v)=>{h(!1),t&&XJ(t,b,v??"")},onClose:()=>h(!1)}):null]})}function ZJ(){return{enter:{mdxFlowExpression:tH,mdxTextExpression:nH},exit:{mdxFlowExpression:AA,mdxFlowExpressionChunk:TA,mdxTextExpression:AA,mdxTextExpressionChunk:TA}}}function eH(){return{handlers:{mdxFlowExpression:MA,mdxTextExpression:MA},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function tH(t){this.enter({type:"mdxFlowExpression",value:""},t),this.buffer()}function nH(t){this.enter({type:"mdxTextExpression",value:""},t),this.buffer()}function AA(t){const e=this.resume(),n=t.estree,i=this.stack[this.stack.length-1];i.type==="mdxFlowExpression"||i.type,this.exit(t),i.value=e,n&&(i.data={estree:n})}function TA(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function MA(t,e,n){const i=t.value||"";return"{"+n.indentLines(i,function(s,o,u){return(o===0||u?"":" ")+s})+"}"}const iH=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],OA={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function lI(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function rH(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function sH(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function RA(t){return sH(t)||lI(t)}const aH=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function oH(t,e){const n=e||{},i=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,r=[];let s=0,o=-1,u="",c,h;n.position&&("start"in n.position||"indent"in n.position?(h=n.position.indent,c=n.position.start):c=n.position);let m=(c?c.line:0)||1,g=(c?c.column:0)||1,y=v(),b;for(s--;++s<=t.length;)if(b===10&&(g=(h?h[o]:0)||1),b=t.charCodeAt(s),b===38){const M=t.charCodeAt(s+1);if(M===9||M===10||M===12||M===32||M===38||M===60||Number.isNaN(M)||i&&M===i){u+=String.fromCharCode(b),g++;continue}const j=s+1;let F=j,J=j,V;if(M===35){J=++F;const ke=t.charCodeAt(J);ke===88||ke===120?(V="hexadecimal",J=++F):V="decimal"}else V="named";let C="",L="",q="";const re=V==="named"?RA:V==="decimal"?lI:rH;for(J--;++J<=t.length;){const ke=t.charCodeAt(J);if(!re(ke))break;q+=String.fromCharCode(ke),V==="named"&&iH.includes(q)&&(C=q,L=oh(q))}let K=t.charCodeAt(J)===59;if(K){J++;const ke=V==="named"?oh(q):!1;ke&&(C=q,L=ke)}let pe=1+J-j,he="";if(!(!K&&n.nonTerminated===!1))if(!q)V!=="named"&&E(4,pe);else if(V==="named"){if(K&&!L)E(5,1);else if(C!==q&&(J=F+C.length,pe=1+J-F,K=!1),!K){const ke=C?1:3;if(n.attribute){const Ie=t.charCodeAt(J);Ie===61?(E(ke,pe),L=""):RA(Ie)?L="":E(ke,pe)}else E(ke,pe)}he=L}else{K||E(2,pe);let ke=Number.parseInt(q,V==="hexadecimal"?16:10);if(lH(ke))E(7,pe),he="�";else if(ke in OA)E(6,pe),he=OA[ke];else{let Ie="";uH(ke)&&E(6,pe),ke>65535&&(ke-=65536,Ie+=String.fromCharCode(ke>>>10|55296),ke=56320|ke&1023),he=Ie+String.fromCharCode(ke)}}if(he){T(),y=v(),s=J-1,g+=J-j+1,r.push(he);const ke=v();ke.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,he,{start:y,end:ke},t.slice(j-1,J)),y=ke}else q=t.slice(j-1,J),u+=q,g+=q.length,s=J-1}else b===10&&(m++,o++,g=0),Number.isNaN(b)?T():(u+=String.fromCharCode(b),g++);return r.join("");function v(){return{line:m,column:g,offset:s+((c?c.offset:0)||0)}}function E(M,j){let F;n.warning&&(F=v(),F.column+=j,F.offset+=j,n.warning.call(n.warningContext||void 0,aH[M],F,M))}function T(){u&&(r.push(u),n.text&&n.text.call(n.textContext||void 0,u,{start:y,end:v()}),u="")}}function lH(t){return t>=55296&&t<=57343||t>1114111}function uH(t){return t>=1&&t<=8||t===11||t>=13&&t<=31||t>=127&&t<=159||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534}const cH=/["&'<>`]/g,fH=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,hH=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,pH=/[|\\{}()[\]^$+*?.]/g,DA=new WeakMap;function dH(t,e){if(t=t.replace(e.subset?mH(e.subset):cH,i),e.subset||e.escapeOnly)return t;return t.replace(fH,n).replace(hH,i);function n(r,s,o){return e.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function i(r,s,o){return e.format(r.charCodeAt(0),o.charCodeAt(s+1),e)}}function mH(t){let e=DA.get(t);return e||(e=gH(t),DA.set(t,e)),e}function gH(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(pH,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function yH(t){return"&#x"+t.toString(16).toUpperCase()+";"}function xH(t,e){return dH(t,Object.assign({format:yH},e))}const uI=" ";function bH(){return{canContainEols:["mdxJsxTextElement"],enter:{mdxJsxFlowTag:i,mdxJsxFlowTagClosingMarker:r,mdxJsxFlowTagAttribute:g,mdxJsxFlowTagExpressionAttribute:y,mdxJsxFlowTagAttributeValueLiteral:t,mdxJsxFlowTagAttributeValueExpression:t,mdxJsxFlowTagSelfClosingMarker:o,mdxJsxTextTag:i,mdxJsxTextTagClosingMarker:r,mdxJsxTextTagAttribute:g,mdxJsxTextTagExpressionAttribute:y,mdxJsxTextTagAttributeValueLiteral:t,mdxJsxTextTagAttributeValueExpression:t,mdxJsxTextTagSelfClosingMarker:o},exit:{mdxJsxFlowTagClosingMarker:u,mdxJsxFlowTagNamePrimary:c,mdxJsxFlowTagNameMember:h,mdxJsxFlowTagNameLocal:m,mdxJsxFlowTagExpressionAttribute:b,mdxJsxFlowTagExpressionAttributeValue:n,mdxJsxFlowTagAttributeNamePrimary:v,mdxJsxFlowTagAttributeNameLocal:E,mdxJsxFlowTagAttributeValueLiteral:T,mdxJsxFlowTagAttributeValueLiteralValue:n,mdxJsxFlowTagAttributeValueExpression:M,mdxJsxFlowTagAttributeValueExpressionValue:n,mdxJsxFlowTagSelfClosingMarker:j,mdxJsxFlowTag:F,mdxJsxTextTagClosingMarker:u,mdxJsxTextTagNamePrimary:c,mdxJsxTextTagNameMember:h,mdxJsxTextTagNameLocal:m,mdxJsxTextTagExpressionAttribute:b,mdxJsxTextTagExpressionAttributeValue:n,mdxJsxTextTagAttributeNamePrimary:v,mdxJsxTextTagAttributeNameLocal:E,mdxJsxTextTagAttributeValueLiteral:T,mdxJsxTextTagAttributeValueLiteralValue:n,mdxJsxTextTagAttributeValueExpression:M,mdxJsxTextTagAttributeValueExpressionValue:n,mdxJsxTextTagSelfClosingMarker:j,mdxJsxTextTag:F}};function t(){this.buffer()}function e(L){return{line:L.line,column:L.column,offset:L.offset}}function n(L){this.config.enter.data.call(this,L),this.config.exit.data.call(this,L)}function i(L){const q={name:void 0,attributes:[],close:!1,selfClosing:!1,start:L.start,end:L.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=q,this.buffer()}function r(L){if(this.data.mdxJsxTagStack.length===0)throw new mt("Unexpected closing slash `/` in tag, expected an open tag first",{start:L.start,end:L.end},"mdast-util-mdx-jsx:unexpected-closing-slash")}function s(L){if(this.data.mdxJsxTag.close)throw new mt("Unexpected attribute in closing tag, expected the end of the tag",{start:L.start,end:L.end},"mdast-util-mdx-jsx:unexpected-attribute")}function o(L){if(this.data.mdxJsxTag.close)throw new mt("Unexpected self-closing slash `/` in closing tag, expected the end of the tag",{start:L.start,end:L.end},"mdast-util-mdx-jsx:unexpected-self-closing-slash")}function u(){const L=this.data.mdxJsxTag;L.close=!0}function c(L){const q=this.data.mdxJsxTag;q.name=this.sliceSerialize(L)}function h(L){const q=this.data.mdxJsxTag;q.name+="."+this.sliceSerialize(L)}function m(L){const q=this.data.mdxJsxTag;q.name+=":"+this.sliceSerialize(L)}function g(L){const q=this.data.mdxJsxTag;s.call(this,L),q.attributes.push({type:"mdxJsxAttribute",name:"",value:null,position:{start:e(L.start),end:void 0}})}function y(L){const q=this.data.mdxJsxTag;s.call(this,L),q.attributes.push({type:"mdxJsxExpressionAttribute",value:"",position:{start:e(L.start),end:void 0}}),this.buffer()}function b(L){const q=this.data.mdxJsxTag,re=q.attributes[q.attributes.length-1];re.type;const K=L.estree;re.value=this.resume(),re.position,re.position.end=e(L.end),K&&(re.data={estree:K})}function v(L){const q=this.data.mdxJsxTag,re=q.attributes[q.attributes.length-1];re.type,re.name=this.sliceSerialize(L),re.position,re.position.end=e(L.end)}function E(L){const q=this.data.mdxJsxTag,re=q.attributes[q.attributes.length-1];re.type,re.name+=":"+this.sliceSerialize(L),re.position,re.position.end=e(L.end)}function T(L){const q=this.data.mdxJsxTag,re=q.attributes[q.attributes.length-1];re.value=oH(this.resume(),{nonTerminated:!1}),re.position,re.position.end=e(L.end)}function M(L){const q=this.data.mdxJsxTag,re=q.attributes[q.attributes.length-1];re.type;const K={type:"mdxJsxAttributeValueExpression",value:this.resume()},pe=L.estree;pe&&(K.data={estree:pe}),re.value=K,re.position,re.position.end=e(L.end)}function j(){const L=this.data.mdxJsxTag;L.selfClosing=!0}function F(L){const q=this.data.mdxJsxTag,re=this.data.mdxJsxTagStack,K=re[re.length-1];if(q.close&&K.name!==q.name)throw new mt("Unexpected closing tag `"+C(q)+"`, expected corresponding closing tag for `"+C(K)+"` ("+Es(K)+")",{start:L.start,end:L.end},"mdast-util-mdx-jsx:end-tag-mismatch");this.resume(),q.close?re.pop():this.enter({type:L.type==="mdxJsxTextTag"?"mdxJsxTextElement":"mdxJsxFlowElement",name:q.name||null,attributes:q.attributes,children:[]},L,J),q.selfClosing||q.close?this.exit(L,V):re.push(q)}function J(L,q){const re=this.data.mdxJsxTagStack,K=re[re.length-1],pe=L?" before the end of `"+L.type+"`":"",he=L?{start:L.start,end:L.end}:void 0;throw new mt("Expected a closing tag for `"+C(K)+"` ("+Es({start:q.start,end:q.end})+")"+pe,he,"mdast-util-mdx-jsx:end-tag-mismatch")}function V(L,q){const re=this.data.mdxJsxTag;throw new mt("Expected the closing tag `"+C(re)+"` either after the end of `"+q.type+"` ("+Es(q.end)+") or another opening tag after the start of `"+q.type+"` ("+Es(q.start)+")",{start:L.start,end:L.end},"mdast-util-mdx-jsx:end-tag-mismatch")}function C(L){return"<"+(L.close?"/":"")+(L.name||"")+">"}}function SH(t){const e=t||{},n=e.quote||'"',i=e.quoteSmart||!1,r=e.tightSelfClosing||!1,s=e.printWidth||Number.POSITIVE_INFINITY,o=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize attribute values with `"+n+"` for `options.quote`, expected `\"`, or `'`");return u.peek=vH,{handlers:{mdxJsxFlowElement:u,mdxJsxTextElement:u},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function u(c,h,m,g){const y=c.type==="mdxJsxFlowElement",b=c.name?!c.children||c.children.length===0:!1,v=cI(m),E=fI(v),T=m.createTracker(g),M=m.createTracker(g),j=[],F=(y?E:"")+"<"+(c.name||""),J=m.enter(c.type);if(T.move(F),M.move(F),c.attributes&&c.attributes.length>0){if(!c.name)throw new Error("Cannot serialize fragment w/ attributes");let re=-1;for(;++re<c.attributes.length;){const K=c.attributes[re];let pe;if(K.type==="mdxJsxExpressionAttribute")pe="{"+(K.value||"")+"}";else{if(!K.name)throw new Error("Cannot serialize attribute w/o name");const he=K.value,ke=K.name;let Ie="";if(he!=null)if(typeof he=="object")Ie="{"+(he.value||"")+"}";else{const De=i&&Gm(he,n)>Gm(he,o)?o:n;Ie=De+xH(he,{subset:[De]})+De}pe=ke+(Ie?"=":"")+Ie}j.push(pe)}}let V=!1;const C=j.join(" ");y&&(/\r?\n|\r/.test(C)||T.current().now.column+C.length+(b?r?2:3:1)>s)&&(V=!0);let L=T,q=F;if(V){L=M;let re=-1;for(;++re<j.length;)j[re]=E+uI+j[re];q+=L.move(`
58
- `+j.join(`
59
- `)+`
60
- `+E)}else C&&(q+=L.move(" "+C));return b&&(q+=L.move((r||V?"":" ")+"/")),q+=L.move(">"),c.children&&c.children.length>0&&(c.type==="mdxJsxTextElement"?q+=L.move(m.containerPhrasing(c,{...L.current(),before:">",after:"<"})):(L.shift(2),q+=L.move(`
61
- `),q+=L.move(kH(c,m,L.current())),q+=L.move(`
62
- `))),b||(q+=L.move((y?E:"")+"</"+(c.name||"")+">")),J(),q}}function kH(t,e,n){const i=e.indexStack,r=t.children,s=e.createTracker(n),o=fI(cI(e)),u=[];let c=-1;for(i.push(-1);++c<r.length;){const h=r[c];i[i.length-1]=c;const m={before:`
63
- `,after:`
64
- `,...s.current()},g=e.handle(h,t,e,m),y=h.type==="mdxJsxFlowElement"?g:e.indentLines(g,function(b,v,E){return(E?"":o)+b});u.push(s.move(y)),h.type!=="list"&&(e.bulletLastUsed=void 0),c<r.length-1&&u.push(s.move(`
65
-
66
- `))}return i.pop(),u.join("")}function cI(t){let e=0,n=t.stack.length;for(;--n>-1;){const i=t.stack[n];if(i==="blockquote"||i==="listItem")break;i==="mdxJsxFlowElement"&&e++}return e}function fI(t){return uI.repeat(t)}function vH(){return"<"}function CH(){return{enter:{mdxjsEsm:EH},exit:{mdxjsEsm:NH,mdxjsEsmData:AH}}}function wH(){return{handlers:{mdxjsEsm:TH}}}function EH(t){this.enter({type:"mdxjsEsm",value:""},t),this.buffer()}function NH(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(t);const i=t.estree;n.value=e,i&&(n.data={estree:i})}function AH(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function TH(t){return t.value||""}function MH(){return[ZJ(),bH(),CH()]}function OH(t){return{extensions:[eH(),SH(t),wH()]}}var RH=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],hI=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],DH="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",pI="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",rx={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},sx="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",IH={5:sx,"5module":sx+" export import",6:sx+" const class extends export import super"},_H=/^in(stanceof)?$/,zH=new RegExp("["+pI+"]"),LH=new RegExp("["+pI+DH+"]");function Fb(t,e){for(var n=65536,i=0;i<e.length;i+=2){if(n+=e[i],n>t)return!1;if(n+=e[i+1],n>=t)return!0}return!1}function Ur(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&zH.test(String.fromCharCode(t)):e===!1?!1:Fb(t,hI)}function Ha(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&LH.test(String.fromCharCode(t)):e===!1?!1:Fb(t,hI)||Fb(t,RH)}var ft=function(e,n){n===void 0&&(n={}),this.label=e,this.keyword=n.keyword,this.beforeExpr=!!n.beforeExpr,this.startsExpr=!!n.startsExpr,this.isLoop=!!n.isLoop,this.isAssign=!!n.isAssign,this.prefix=!!n.prefix,this.postfix=!!n.postfix,this.binop=n.binop||null,this.updateContext=null};function qi(t,e){return new ft(t,{beforeExpr:!0,binop:e})}var Ki={beforeExpr:!0},si={startsExpr:!0},Xk={};function lt(t,e){return e===void 0&&(e={}),e.keyword=t,Xk[t]=new ft(t,e)}var O={num:new ft("num",si),regexp:new ft("regexp",si),string:new ft("string",si),name:new ft("name",si),privateId:new ft("privateId",si),eof:new ft("eof"),bracketL:new ft("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new ft("]"),braceL:new ft("{",{beforeExpr:!0,startsExpr:!0}),braceR:new ft("}"),parenL:new ft("(",{beforeExpr:!0,startsExpr:!0}),parenR:new ft(")"),comma:new ft(",",Ki),semi:new ft(";",Ki),colon:new ft(":",Ki),dot:new ft("."),question:new ft("?",Ki),questionDot:new ft("?."),arrow:new ft("=>",Ki),template:new ft("template"),invalidTemplate:new ft("invalidTemplate"),ellipsis:new ft("...",Ki),backQuote:new ft("`",si),dollarBraceL:new ft("${",{beforeExpr:!0,startsExpr:!0}),eq:new ft("=",{beforeExpr:!0,isAssign:!0}),assign:new ft("_=",{beforeExpr:!0,isAssign:!0}),incDec:new ft("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new ft("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:qi("||",1),logicalAND:qi("&&",2),bitwiseOR:qi("|",3),bitwiseXOR:qi("^",4),bitwiseAND:qi("&",5),equality:qi("==/!=/===/!==",6),relational:qi("</>/<=/>=",7),bitShift:qi("<</>>/>>>",8),plusMin:new ft("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:qi("%",10),star:qi("*",10),slash:qi("/",10),starstar:new ft("**",{beforeExpr:!0}),coalesce:qi("??",1),_break:lt("break"),_case:lt("case",Ki),_catch:lt("catch"),_continue:lt("continue"),_debugger:lt("debugger"),_default:lt("default",Ki),_do:lt("do",{isLoop:!0,beforeExpr:!0}),_else:lt("else",Ki),_finally:lt("finally"),_for:lt("for",{isLoop:!0}),_function:lt("function",si),_if:lt("if"),_return:lt("return",Ki),_switch:lt("switch"),_throw:lt("throw",Ki),_try:lt("try"),_var:lt("var"),_const:lt("const"),_while:lt("while",{isLoop:!0}),_with:lt("with"),_new:lt("new",{beforeExpr:!0,startsExpr:!0}),_this:lt("this",si),_super:lt("super",si),_class:lt("class",si),_extends:lt("extends",Ki),_export:lt("export"),_import:lt("import",si),_null:lt("null",si),_true:lt("true",si),_false:lt("false",si),_in:lt("in",{beforeExpr:!0,binop:7}),_instanceof:lt("instanceof",{beforeExpr:!0,binop:7}),_typeof:lt("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:lt("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:lt("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},ui=/\r\n?|\n|\u2028|\u2029/,BH=new RegExp(ui.source,"g");function qu(t){return t===10||t===13||t===8232||t===8233}function dI(t,e,n){n===void 0&&(n=t.length);for(var i=e;i<n;i++){var r=t.charCodeAt(i);if(qu(r))return i<n-1&&r===13&&t.charCodeAt(i+1)===10?i+2:i+1}return-1}var mI=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,xn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,gI=Object.prototype,VH=gI.hasOwnProperty,FH=gI.toString,Ku=Object.hasOwn||(function(t,e){return VH.call(t,e)}),IA=Array.isArray||(function(t){return FH.call(t)==="[object Array]"}),_A=Object.create(null);function za(t){return _A[t]||(_A[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function Is(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var PH=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Oh=function(e,n){this.line=e,this.column=n};Oh.prototype.offset=function(e){return new Oh(this.line,this.column+e)};var Vg=function(e,n,i){this.start=n,this.end=i,e.sourceFile!==null&&(this.source=e.sourceFile)};function yI(t,e){for(var n=1,i=0;;){var r=dI(t,i,e);if(r<0)return new Oh(n,e-i);++n,i=r}}var Pb={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},zA=!1;function jH(t){var e={};for(var n in Pb)e[n]=t&&Ku(t,n)?t[n]:Pb[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!zA&&typeof console=="object"&&console.warn&&(zA=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
67
- Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),IA(e.onToken)){var i=e.onToken;e.onToken=function(r){return i.push(r)}}return IA(e.onComment)&&(e.onComment=$H(e,e.onComment)),e}function $H(t,e){return function(n,i,r,s,o,u){var c={type:n?"Block":"Line",value:i,start:r,end:s};t.locations&&(c.loc=new Vg(this,o,u)),t.ranges&&(c.range=[r,s]),e.push(c)}}var Rh=1,Gu=2,Qk=4,xI=8,Wk=16,bI=32,Fg=64,SI=128,gl=256,up=512,Pg=Rh|Gu|gl;function Zk(t,e){return Gu|(t?Qk:0)|(e?xI:0)}var Ym=0,ev=1,$s=2,kI=3,vI=4,CI=5,Zt=function(e,n,i){this.options=e=jH(e),this.sourceFile=e.sourceFile,this.keywords=za(IH[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var r="";e.allowReserved!==!0&&(r=rx[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(r+=" await")),this.reservedWords=za(r);var s=(r?r+" ":"")+rx.strict;this.reservedWordsStrict=za(s),this.reservedWordsStrictBind=za(s+" "+rx.strictBind),this.input=String(n),this.containsEsc=!1,i?(this.pos=i,this.lineStart=this.input.lastIndexOf(`
68
- `,i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(ui).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=O.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Rh),this.regexpState=null,this.privateNameStack=[]},Gr={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Zt.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};Gr.inFunction.get=function(){return(this.currentVarScope().flags&Gu)>0};Gr.inGenerator.get=function(){return(this.currentVarScope().flags&xI)>0};Gr.inAsync.get=function(){return(this.currentVarScope().flags&Qk)>0};Gr.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(gl|up))return!1;if(n&Gu)return(n&Qk)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Gr.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&Fg)>0||this.options.allowSuperOutsideMethod};Gr.allowDirectSuper.get=function(){return(this.currentThisScope().flags&SI)>0};Gr.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Gr.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(gl|up)||n&Gu&&!(n&Wk))return!0}return!1};Gr.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&gl)>0};Zt.extend=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var i=this,r=0;r<e.length;r++)i=e[r](i);return i};Zt.parse=function(e,n){return new this(n,e).parse()};Zt.parseExpressionAt=function(e,n,i){var r=new this(i,e,n);return r.nextToken(),r.parseExpression()};Zt.tokenizer=function(e,n){return new this(n,e)};Object.defineProperties(Zt.prototype,Gr);var Yn=Zt.prototype,UH=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Yn.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){xn.lastIndex=t,t+=xn.exec(this.input)[0].length;var e=UH.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){xn.lastIndex=t+e[0].length;var n=xn.exec(this.input),i=n.index+n[0].length,r=this.input.charAt(i);return r===";"||r==="}"||ui.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||r==="!"&&this.input.charAt(i+1)==="=")}t+=e[0].length,xn.lastIndex=t,t+=xn.exec(this.input)[0].length,this.input[t]===";"&&t++}};Yn.eat=function(t){return this.type===t?(this.next(),!0):!1};Yn.isContextual=function(t){return this.type===O.name&&this.value===t&&!this.containsEsc};Yn.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};Yn.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};Yn.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||ui.test(this.input.slice(this.lastTokEnd,this.start))};Yn.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};Yn.semicolon=function(){!this.eat(O.semi)&&!this.insertSemicolon()&&this.unexpected()};Yn.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};Yn.expect=function(t){this.eat(t)||this.unexpected()};Yn.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var jg=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Yn.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var n=e?t.parenthesizedAssign:t.parenthesizedBind;n>-1&&this.raiseRecoverable(n,e?"Assigning to rvalue":"Parenthesized pattern")}};Yn.checkExpressionErrors=function(t,e){if(!t)return!1;var n=t.shorthandAssign,i=t.doubleProto;if(!e)return n>=0||i>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")};Yn.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};Yn.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var Ae=Zt.prototype;Ae.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==O.eof;){var n=this.parseStatement(null,!0,e);t.body.push(n)}if(this.inModule)for(var i=0,r=Object.keys(this.undefinedExports);i<r.length;i+=1){var s=r[i];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var tv={kind:"loop"},JH={kind:"switch"};Ae.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;xn.lastIndex=this.pos;var e=xn.exec(this.input),n=this.pos+e[0].length,i=this.input.charCodeAt(n);if(i===91||i===92)return!0;if(t)return!1;if(i===123||i>55295&&i<56320)return!0;if(Ur(i,!0)){for(var r=n+1;Ha(i=this.input.charCodeAt(r),!0);)++r;if(i===92||i>55295&&i<56320)return!0;var s=this.input.slice(n,r);if(!_H.test(s))return!0}return!1};Ae.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;xn.lastIndex=this.pos;var t=xn.exec(this.input),e=this.pos+t[0].length,n;return!ui.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(Ha(n=this.input.charCodeAt(e+8))||n>55295&&n<56320))};Ae.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;xn.lastIndex=this.pos;var n=xn.exec(this.input),i=this.pos+n[0].length;if(ui.test(this.input.slice(this.pos,i)))return!1;if(t){var r=i+5,s;if(this.input.slice(i,r)!=="using"||r===this.input.length||Ha(s=this.input.charCodeAt(r))||s>55295&&s<56320)return!1;xn.lastIndex=r;var o=xn.exec(this.input);if(o&&ui.test(this.input.slice(r,r+o[0].length)))return!1}if(e){var u=i+2,c;if(this.input.slice(i,u)==="of"&&(u===this.input.length||!Ha(c=this.input.charCodeAt(u))&&!(c>55295&&c<56320)))return!1}var h=this.input.charCodeAt(i);return Ur(h,!0)||h===92};Ae.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};Ae.isUsing=function(t){return this.isUsingKeyword(!1,t)};Ae.parseStatement=function(t,e,n){var i=this.type,r=this.startNode(),s;switch(this.isLet(t)&&(i=O._var,s="let"),i){case O._break:case O._continue:return this.parseBreakContinueStatement(r,i.keyword);case O._debugger:return this.parseDebuggerStatement(r);case O._do:return this.parseDoStatement(r);case O._for:return this.parseForStatement(r);case O._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case O._class:return t&&this.unexpected(),this.parseClass(r,!0);case O._if:return this.parseIfStatement(r);case O._return:return this.parseReturnStatement(r);case O._switch:return this.parseSwitchStatement(r);case O._throw:return this.parseThrowStatement(r);case O._try:return this.parseTryStatement(r);case O._const:case O._var:return s=s||this.value,t&&s!=="var"&&this.unexpected(),this.parseVarStatement(r,s);case O._while:return this.parseWhileStatement(r);case O._with:return this.parseWithStatement(r);case O.braceL:return this.parseBlock(!0,r);case O.semi:return this.parseEmptyStatement(r);case O._export:case O._import:if(this.options.ecmaVersion>10&&i===O._import){xn.lastIndex=this.pos;var o=xn.exec(this.input),u=this.pos+o[0].length,c=this.input.charCodeAt(u);if(c===40||c===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===O._import?this.parseImport(r):this.parseExport(r,n);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var h=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(h)return e&&this.options.sourceType==="script"&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),h==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,h),this.semicolon(),this.finishNode(r,"VariableDeclaration");var m=this.value,g=this.parseExpression();return i===O.name&&g.type==="Identifier"&&this.eat(O.colon)?this.parseLabeledStatement(r,m,g,t):this.parseExpressionStatement(r,g)}};Ae.parseBreakContinueStatement=function(t,e){var n=e==="break";this.next(),this.eat(O.semi)||this.insertSemicolon()?t.label=null:this.type!==O.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var r=this.labels[i];if((t.label==null||r.name===t.label.name)&&(r.kind!=null&&(n||r.kind==="loop")||t.label&&n))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,n?"BreakStatement":"ContinueStatement")};Ae.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};Ae.parseDoStatement=function(t){return this.next(),this.labels.push(tv),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(O._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(O.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};Ae.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(tv),this.enterScope(0),this.expect(O.parenL),this.type===O.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===O._var||this.type===O._const||n){var i=this.startNode(),r=n?"let":this.value;return this.next(),this.parseVar(i,!0,r),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var s=this.isContextual("let"),o=!1,u=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(u){var c=this.startNode();return this.next(),u==="await using"&&this.next(),this.parseVar(c,!0,u),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var h=this.containsEsc,m=new jg,g=this.start,y=e>-1?this.parseExprSubscripts(m,"await"):this.parseExpression(!0,m);return this.type===O._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===O._in&&this.unexpected(e),t.await=!0):o&&this.options.ecmaVersion>=8&&(y.start===g&&!h&&y.type==="Identifier"&&y.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=!1)),s&&o&&this.raise(y.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(y,!1,m),this.checkLValPattern(y),this.parseForIn(t,y)):(this.checkExpressionErrors(m,!0),e>-1&&this.unexpected(e),this.parseFor(t,y))};Ae.parseForAfterInit=function(t,e,n){return(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===O._in?n>-1&&this.unexpected(n):t.await=n>-1),this.parseForIn(t,e)):(n>-1&&this.unexpected(n),this.parseFor(t,e))};Ae.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,ih|(n?0:jb),!1,e)};Ae.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(O._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};Ae.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(O.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};Ae.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(O.braceL),this.labels.push(JH),this.enterScope(0);for(var e,n=!1;this.type!==O.braceR;)if(this.type===O._case||this.type===O._default){var i=this.type===O._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,e.test=null),this.expect(O.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};Ae.parseThrowStatement=function(t){return this.next(),ui.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var HH=[];Ae.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?bI:0),this.checkLValPattern(t,e?vI:$s),this.expect(O.parenR),t};Ae.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===O._catch){var e=this.startNode();this.next(),this.eat(O.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(O._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};Ae.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")};Ae.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(tv),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};Ae.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};Ae.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};Ae.parseLabeledStatement=function(t,e,n,i){for(var r=0,s=this.labels;r<s.length;r+=1){var o=s[r];o.name===e&&this.raise(n.start,"Label '"+e+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===O._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var h=this.labels[c];if(h.statementStart===t.start)h.statementStart=this.start,h.kind=u;else break}return this.labels.push({name:e,kind:u,statementStart:this.start}),t.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")};Ae.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};Ae.parseBlock=function(t,e,n){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(O.braceL),t&&this.enterScope(0);this.type!==O.braceR;){var i=this.parseStatement(null);e.body.push(i)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};Ae.parseFor=function(t,e){return t.init=e,this.expect(O.semi),t.test=this.type===O.semi?null:this.parseExpression(),this.expect(O.semi),t.update=this.type===O.parenR?null:this.parseExpression(),this.expect(O.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};Ae.parseForIn=function(t,e){var n=this.type===O._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(O.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,n?"ForInStatement":"ForOfStatement")};Ae.parseVar=function(t,e,n,i){for(t.declarations=[],t.kind=n;;){var r=this.startNode();if(this.parseVarId(r,n),this.eat(O.eq)?r.init=this.parseMaybeAssign(e):!i&&n==="const"&&!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!i&&(n==="using"||n==="await using")&&this.options.ecmaVersion>=17&&this.type!==O._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):!i&&r.id.type!=="Identifier"&&!(e&&(this.type===O._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,t.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(O.comma))break}return t};Ae.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?ev:$s,!1)};var ih=1,jb=2,wI=4;Ae.parseFunction=function(t,e,n,i,r){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===O.star&&e&jb&&this.unexpected(),t.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&ih&&(t.id=e&wI&&this.type!==O.name?null:this.parseIdent(),t.id&&!(e&jb)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?ev:$s:kI));var s=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Zk(t.async,t.generator)),e&ih||(t.id=this.type===O.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n,!1,r),this.yieldPos=s,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(t,e&ih?"FunctionDeclaration":"FunctionExpression")};Ae.parseFunctionParams=function(t){this.expect(O.parenL),t.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Ae.parseClass=function(t,e){this.next();var n=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),r=this.startNode(),s=!1;for(r.body=[],this.expect(O.braceL);this.type!==O.braceR;){var o=this.parseClassElement(t.superClass!==null);o&&(r.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(s&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),s=!0):o.key&&o.key.type==="PrivateIdentifier"&&qH(i,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=n,this.next(),t.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};Ae.parseClassElement=function(t){if(this.eat(O.semi))return null;var e=this.options.ecmaVersion,n=this.startNode(),i="",r=!1,s=!1,o="method",u=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(O.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===O.star?u=!0:i="static"}if(n.static=u,!i&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===O.star)&&!this.canInsertSemicolon()?s=!0:i="async"),!i&&(e>=9||!s)&&this.eat(O.star)&&(r=!0),!i&&!s&&!r){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=c:i=c)}if(i?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=i,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),e<13||this.type===O.parenL||o!=="method"||r||s){var h=!n.static&&Xm(n,"constructor"),m=h&&t;h&&o!=="method"&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=h?"constructor":o,this.parseClassMethod(n,r,s,m)}else this.parseClassField(n);return n};Ae.isClassElementNameStart=function(){return this.type===O.name||this.type===O.privateId||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword};Ae.parseClassElementName=function(t){this.type===O.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};Ae.parseClassMethod=function(t,e,n,i){var r=t.key;t.kind==="constructor"?(e&&this.raise(r.start,"Constructor can't be a generator"),n&&this.raise(r.start,"Constructor can't be an async method")):t.static&&Xm(t,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var s=t.value=this.parseMethod(e,n,i);return t.kind==="get"&&s.params.length!==0&&this.raiseRecoverable(s.start,"getter should have no params"),t.kind==="set"&&s.params.length!==1&&this.raiseRecoverable(s.start,"setter should have exactly one param"),t.kind==="set"&&s.params[0].type==="RestElement"&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};Ae.parseClassField=function(t){return Xm(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Xm(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(O.eq)?(this.enterScope(up|Fg),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};Ae.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(gl|Fg);this.type!==O.braceR;){var n=this.parseStatement(null);t.body.push(n)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};Ae.parseClassId=function(t,e){this.type===O.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,$s,!1)):(e===!0&&this.unexpected(),t.id=null)};Ae.parseClassSuper=function(t){t.superClass=this.eat(O._extends)?this.parseExprSubscripts(null,!1):null};Ae.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};Ae.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,n=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,r=i===0?null:this.privateNameStack[i-1],s=0;s<n.length;++s){var o=n[s];Ku(e,o.name)||(r?r.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function qH(t,e){var n=e.key.name,i=t[n],r="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(r=(e.static?"s":"i")+e.kind),i==="iget"&&r==="iset"||i==="iset"&&r==="iget"||i==="sget"&&r==="sset"||i==="sset"&&r==="sget"?(t[n]="true",!1):i?!0:(t[n]=r,!1)}function Xm(t,e){var n=t.computed,i=t.key;return!n&&(i.type==="Identifier"&&i.name===e||i.type==="Literal"&&i.value===e)}Ae.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==O.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};Ae.parseExport=function(t,e){if(this.next(),this.eat(O.star))return this.parseExportAllDeclaration(t,e);if(this.eat(O._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==O.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var n=0,i=t.specifiers;n<i.length;n+=1){var r=i[n];this.checkUnreserved(r.local),this.checkLocalExport(r.local),r.local.type==="Literal"&&this.raise(r.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};Ae.parseExportDeclaration=function(t){return this.parseStatement(null)};Ae.parseExportDefaultDeclaration=function(){var t;if(this.type===O._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,ih|wI,!1,t)}else if(this.type===O._class){var n=this.startNode();return this.parseClass(n,"nullableID")}else{var i=this.parseMaybeAssign();return this.semicolon(),i}};Ae.checkExport=function(t,e,n){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Ku(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)};Ae.checkPatternExport=function(t,e){var n=e.type;if(n==="Identifier")this.checkExport(t,e,e.start);else if(n==="ObjectPattern")for(var i=0,r=e.properties;i<r.length;i+=1){var s=r[i];this.checkPatternExport(t,s)}else if(n==="ArrayPattern")for(var o=0,u=e.elements;o<u.length;o+=1){var c=u[o];c&&this.checkPatternExport(t,c)}else n==="Property"?this.checkPatternExport(t,e.value):n==="AssignmentPattern"?this.checkPatternExport(t,e.left):n==="RestElement"&&this.checkPatternExport(t,e.argument)};Ae.checkVariableExport=function(t,e){if(t)for(var n=0,i=e;n<i.length;n+=1){var r=i[n];this.checkPatternExport(t,r.id)}};Ae.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Ae.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};Ae.parseExportSpecifiers=function(t){var e=[],n=!0;for(this.expect(O.braceL);!this.eat(O.braceR);){if(n)n=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;e.push(this.parseExportSpecifier(t))}return e};Ae.parseImport=function(t){return this.next(),this.type===O.string?(t.specifiers=HH,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===O.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};Ae.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,$s),this.finishNode(t,"ImportSpecifier")};Ae.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,$s),this.finishNode(t,"ImportDefaultSpecifier")};Ae.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,$s),this.finishNode(t,"ImportNamespaceSpecifier")};Ae.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===O.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(O.comma)))return t;if(this.type===O.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(O.braceL);!this.eat(O.braceR);){if(e)e=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;t.push(this.parseImportSpecifier())}return t};Ae.parseWithClause=function(){var t=[];if(!this.eat(O._with))return t;this.expect(O.braceL);for(var e={},n=!0;!this.eat(O.braceR);){if(n)n=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;var i=this.parseImportAttribute(),r=i.key.type==="Identifier"?i.key.name:i.key.value;Ku(e,r)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+r+"'"),e[r]=!0,t.push(i)}return t};Ae.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===O.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(O.colon),this.type!==O.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};Ae.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===O.string){var t=this.parseLiteral(this.value);return PH.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};Ae.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};Ae.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var lr=Zt.prototype;lr.toAssignable=function(t,e,n){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var i=0,r=t.properties;i<r.length;i+=1){var s=r[i];this.toAssignable(s,e),s.type==="RestElement"&&(s.argument.type==="ArrayPattern"||s.argument.type==="ObjectPattern")&&this.raise(s.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,n);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return t};lr.toAssignableList=function(t,e){for(var n=t.length,i=0;i<n;i++){var r=t[i];r&&this.toAssignable(r,e)}if(n){var s=t[n-1];this.options.ecmaVersion===6&&e&&s&&s.type==="RestElement"&&s.argument.type!=="Identifier"&&this.unexpected(s.argument.start)}return t};lr.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};lr.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==O.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};lr.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case O.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(O.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case O.braceL:return this.parseObj(!0)}return this.parseIdent()};lr.parseBindingList=function(t,e,n,i){for(var r=[],s=!0;!this.eat(t);)if(s?s=!1:this.expect(O.comma),e&&this.type===O.comma)r.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===O.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),r.push(o),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else r.push(this.parseAssignableListItem(i))}return r};lr.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};lr.parseBindingListItem=function(t){return t};lr.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(O.eq))return n;var i=this.startNodeAt(t,e);return i.left=n,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};lr.checkLValSimple=function(t,e,n){e===void 0&&(e=Ym);var i=e!==Ym;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===$s&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(Ku(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==CI&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,n);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}};lr.checkLValPattern=function(t,e,n){switch(e===void 0&&(e=Ym),t.type){case"ObjectPattern":for(var i=0,r=t.properties;i<r.length;i+=1){var s=r[i];this.checkLValInnerPattern(s,e,n)}break;case"ArrayPattern":for(var o=0,u=t.elements;o<u.length;o+=1){var c=u[o];c&&this.checkLValInnerPattern(c,e,n)}break;default:this.checkLValSimple(t,e,n)}};lr.checkLValInnerPattern=function(t,e,n){switch(e===void 0&&(e=Ym),t.type){case"Property":this.checkLValInnerPattern(t.value,e,n);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,n);break;case"RestElement":this.checkLValPattern(t.argument,e,n);break;default:this.checkLValPattern(t,e,n)}};var kr=function(e,n,i,r,s){this.token=e,this.isExpr=!!n,this.preserveSpace=!!i,this.override=r,this.generator=!!s},It={b_stat:new kr("{",!1),b_expr:new kr("{",!0),b_tmpl:new kr("${",!1),p_stat:new kr("(",!1),p_expr:new kr("(",!0),q_tmpl:new kr("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new kr("function",!1),f_expr:new kr("function",!0),f_expr_gen:new kr("function",!0,!1,null,!0),f_gen:new kr("function",!1,!1,null,!0)},Yu=Zt.prototype;Yu.initialContext=function(){return[It.b_stat]};Yu.curContext=function(){return this.context[this.context.length-1]};Yu.braceIsBlock=function(t){var e=this.curContext();return e===It.f_expr||e===It.f_stat?!0:t===O.colon&&(e===It.b_stat||e===It.b_expr)?!e.isExpr:t===O._return||t===O.name&&this.exprAllowed?ui.test(this.input.slice(this.lastTokEnd,this.start)):t===O._else||t===O.semi||t===O.eof||t===O.parenR||t===O.arrow?!0:t===O.braceL?e===It.b_stat:t===O._var||t===O._const||t===O.name?!1:!this.exprAllowed};Yu.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};Yu.updateContext=function(t){var e,n=this.type;n.keyword&&t===O.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr};Yu.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};O.parenR.updateContext=O.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===It.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};O.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?It.b_stat:It.b_expr),this.exprAllowed=!0};O.dollarBraceL.updateContext=function(){this.context.push(It.b_tmpl),this.exprAllowed=!0};O.parenL.updateContext=function(t){var e=t===O._if||t===O._for||t===O._with||t===O._while;this.context.push(e?It.p_stat:It.p_expr),this.exprAllowed=!0};O.incDec.updateContext=function(){};O._function.updateContext=O._class.updateContext=function(t){t.beforeExpr&&t!==O._else&&!(t===O.semi&&this.curContext()!==It.p_stat)&&!(t===O._return&&ui.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===O.colon||t===O.braceL)&&this.curContext()===It.b_stat)?this.context.push(It.f_expr):this.context.push(It.f_stat),this.exprAllowed=!1};O.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};O.backQuote.updateContext=function(){this.curContext()===It.q_tmpl?this.context.pop():this.context.push(It.q_tmpl),this.exprAllowed=!1};O.star.updateContext=function(t){if(t===O._function){var e=this.context.length-1;this.context[e]===It.f_expr?this.context[e]=It.f_expr_gen:this.context[e]=It.f_gen}this.exprAllowed=!0};O.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==O.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Ue=Zt.prototype;Ue.checkPropClash=function(t,e,n){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i=t.key,r;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var s=t.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&s==="init"&&(e.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),e.proto=!0);return}r="$"+r;var o=e[r];if(o){var u;s==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[s],u&&this.raiseRecoverable(i.start,"Redefinition of property")}else o=e[r]={init:!1,get:!1,set:!1};o[s]=!0}};Ue.parseExpression=function(t,e){var n=this.start,i=this.startLoc,r=this.parseMaybeAssign(t,e);if(this.type===O.comma){var s=this.startNodeAt(n,i);for(s.expressions=[r];this.eat(O.comma);)s.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(s,"SequenceExpression")}return r};Ue.parseMaybeAssign=function(t,e,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,r=-1,s=-1,o=-1;e?(r=e.parenthesizedAssign,s=e.trailingComma,o=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new jg,i=!0);var u=this.start,c=this.startLoc;(this.type===O.parenL||this.type===O.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var h=this.parseMaybeConditional(t,e);if(n&&(h=n.call(this,h,u,c)),this.type.isAssign){var m=this.startNodeAt(u,c);return m.operator=this.value,this.type===O.eq&&(h=this.toAssignable(h,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===O.eq?this.checkLValPattern(h):this.checkLValSimple(h),m.left=h,this.next(),m.right=this.parseMaybeAssign(t),o>-1&&(e.doubleProto=o),this.finishNode(m,"AssignmentExpression")}else i&&this.checkExpressionErrors(e,!0);return r>-1&&(e.parenthesizedAssign=r),s>-1&&(e.trailingComma=s),h};Ue.parseMaybeConditional=function(t,e){var n=this.start,i=this.startLoc,r=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return r;if(this.eat(O.question)){var s=this.startNodeAt(n,i);return s.test=r,s.consequent=this.parseMaybeAssign(),this.expect(O.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return r};Ue.parseExprOps=function(t,e){var n=this.start,i=this.startLoc,r=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||r.start===n&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,n,i,-1,t)};Ue.parseExprOp=function(t,e,n,i,r){var s=this.type.binop;if(s!=null&&(!r||this.type!==O._in)&&s>i){var o=this.type===O.logicalOR||this.type===O.logicalAND,u=this.type===O.coalesce;u&&(s=O.logicalAND.binop);var c=this.value;this.next();var h=this.start,m=this.startLoc,g=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,r),h,m,s,r),y=this.buildBinary(e,n,t,g,c,o||u);return(o&&this.type===O.coalesce||u&&(this.type===O.logicalOR||this.type===O.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(y,e,n,i,r)}return t};Ue.buildBinary=function(t,e,n,i,r,s){i.type==="PrivateIdentifier"&&this.raise(i.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(t,e);return o.left=n,o.operator=r,o.right=i,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")};Ue.parseMaybeUnary=function(t,e,n,i){var r=this.start,s=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(i),e=!0;else if(this.type.prefix){var u=this.startNode(),c=this.type===O.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,c,i),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&EI(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&$b(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):e=!0,o=this.finishNode(u,c?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===O.privateId)(i||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==O._in&&this.unexpected();else{if(o=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(r,s);h.operator=this.value,h.prefix=!1,h.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(h,"UpdateExpression")}}if(!n&&this.eat(O.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(r,s,o,this.parseMaybeUnary(null,!1,!1,i),"**",!1);else return o};function EI(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&EI(t.expression)}function $b(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&$b(t.expression)||t.type==="ParenthesizedExpression"&&$b(t.expression)}Ue.parseExprSubscripts=function(t,e){var n=this.start,i=this.startLoc,r=this.parseExprAtom(t,e);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var s=this.parseSubscripts(r,n,i,!1,e);return t&&s.type==="MemberExpression"&&(t.parenthesizedAssign>=s.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=s.start&&(t.parenthesizedBind=-1),t.trailingComma>=s.start&&(t.trailingComma=-1)),s};Ue.parseSubscripts=function(t,e,n,i,r){for(var s=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,o=!1;;){var u=this.parseSubscript(t,e,n,i,s,o,r);if(u.optional&&(o=!0),u===t||u.type==="ArrowFunctionExpression"){if(o){var c=this.startNodeAt(e,n);c.expression=u,u=this.finishNode(c,"ChainExpression")}return u}t=u}};Ue.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(O.arrow)};Ue.parseSubscriptAsyncArrow=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,i)};Ue.parseSubscript=function(t,e,n,i,r,s,o){var u=this.options.ecmaVersion>=11,c=u&&this.eat(O.questionDot);i&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(O.bracketL);if(h||c&&this.type!==O.parenL&&this.type!==O.backQuote||this.eat(O.dot)){var m=this.startNodeAt(e,n);m.object=t,h?(m.property=this.parseExpression(),this.expect(O.bracketR)):this.type===O.privateId&&t.type!=="Super"?m.property=this.parsePrivateIdent():m.property=this.parseIdent(this.options.allowReserved!=="never"),m.computed=!!h,u&&(m.optional=c),t=this.finishNode(m,"MemberExpression")}else if(!i&&this.eat(O.parenL)){var g=new jg,y=this.yieldPos,b=this.awaitPos,v=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var E=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1,g);if(r&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(g,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=y,this.awaitPos=b,this.awaitIdentPos=v,this.parseSubscriptAsyncArrow(e,n,E,o);this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=b||this.awaitPos,this.awaitIdentPos=v||this.awaitIdentPos;var T=this.startNodeAt(e,n);T.callee=t,T.arguments=E,u&&(T.optional=c),t=this.finishNode(T,"CallExpression")}else if(this.type===O.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var M=this.startNodeAt(e,n);M.tag=t,M.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(M,"TaggedTemplateExpression")}return t};Ue.parseExprAtom=function(t,e,n){this.type===O.slash&&this.readRegexp();var i,r=this.potentialArrowAt===this.start;switch(this.type){case O._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===O.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==O.dot&&this.type!==O.bracketL&&this.type!==O.parenL&&this.unexpected(),this.finishNode(i,"Super");case O._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case O.name:var s=this.start,o=this.startLoc,u=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(O._function))return this.overrideContext(It.f_expr),this.parseFunction(this.startNodeAt(s,o),0,!1,!0,e);if(r&&!this.canInsertSemicolon()){if(this.eat(O.arrow))return this.parseArrowExpression(this.startNodeAt(s,o),[c],!1,e);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===O.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(O.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,o),[c],!0,e)}return c;case O.regexp:var h=this.value;return i=this.parseLiteral(h.value),i.regex={pattern:h.pattern,flags:h.flags},i;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return i=this.startNode(),i.value=this.type===O._null?null:this.type===O._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case O.parenL:var m=this.start,g=this.parseParenAndDistinguishExpression(r,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(g)&&(t.parenthesizedAssign=m),t.parenthesizedBind<0&&(t.parenthesizedBind=m)),g;case O.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(O.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case O.braceL:return this.overrideContext(It.b_expr),this.parseObj(!1,t);case O._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case O._class:return this.parseClass(this.startNode(),!1);case O._new:return this.parseNew();case O.backQuote:return this.parseTemplate();case O._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}};Ue.parseExprAtomDefault=function(){this.unexpected()};Ue.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===O.parenL&&!t)return this.parseDynamicImport(e);if(this.type===O.dot){var n=this.startNodeAt(e.start,e.loc&&e.loc.start);return n.name="import",e.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};Ue.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(O.parenR)?t.options=null:(this.expect(O.comma),this.afterTrailingComma(O.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(O.parenR)||(this.expect(O.comma),this.afterTrailingComma(O.parenR)||this.unexpected())));else if(!this.eat(O.parenR)){var e=this.start;this.eat(O.comma)&&this.eat(O.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};Ue.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};Ue.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};Ue.parseParenExpression=function(){this.expect(O.parenL);var t=this.parseExpression();return this.expect(O.parenR),t};Ue.shouldParseArrow=function(t){return!this.canInsertSemicolon()};Ue.parseParenAndDistinguishExpression=function(t,e){var n=this.start,i=this.startLoc,r,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,c=[],h=!0,m=!1,g=new jg,y=this.yieldPos,b=this.awaitPos,v;for(this.yieldPos=0,this.awaitPos=0;this.type!==O.parenR;)if(h?h=!1:this.expect(O.comma),s&&this.afterTrailingComma(O.parenR,!0)){m=!0;break}else if(this.type===O.ellipsis){v=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,g,this.parseParenItem));var E=this.lastTokEnd,T=this.lastTokEndLoc;if(this.expect(O.parenR),t&&this.shouldParseArrow(c)&&this.eat(O.arrow))return this.checkPatternErrors(g,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=y,this.awaitPos=b,this.parseParenArrowList(n,i,c,e);(!c.length||m)&&this.unexpected(this.lastTokStart),v&&this.unexpected(v),this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=b||this.awaitPos,c.length>1?(r=this.startNodeAt(o,u),r.expressions=c,this.finishNodeAt(r,"SequenceExpression",E,T)):r=c[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var M=this.startNodeAt(n,i);return M.expression=r,this.finishNode(M,"ParenthesizedExpression")}else return r};Ue.parseParenItem=function(t){return t};Ue.parseParenArrowList=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,i)};var KH=[];Ue.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===O.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var n=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,r=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,r,!0,!1),this.eat(O.parenL)?t.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):t.arguments=KH,this.finishNode(t,"NewExpression")};Ue.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===O.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,`
69
- `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
70
- `),cooked:this.value},this.next(),n.tail=this.type===O.backQuote,this.finishNode(n,"TemplateElement")};Ue.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var n=this.startNode();this.next(),n.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(n.quasis=[i];!i.tail;)this.type===O.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(O.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(O.braceR),n.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")};Ue.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===O.name||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===O.star)&&!ui.test(this.input.slice(this.lastTokEnd,this.start))};Ue.parseObj=function(t,e){var n=this.startNode(),i=!0,r={};for(n.properties=[],this.next();!this.eat(O.braceR);){if(i)i=!1;else if(this.expect(O.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(O.braceR))break;var s=this.parseProperty(t,e);t||this.checkPropClash(s,r,e),n.properties.push(s)}return this.finishNode(n,t?"ObjectPattern":"ObjectExpression")};Ue.parseProperty=function(t,e){var n=this.startNode(),i,r,s,o;if(this.options.ecmaVersion>=9&&this.eat(O.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(n,"RestElement")):(n.argument=this.parseMaybeAssign(!1,e),this.type===O.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(n,"SpreadElement"));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(t||e)&&(s=this.start,o=this.startLoc),t||(i=this.eat(O.star)));var u=this.containsEsc;return this.parsePropertyName(n),!t&&!u&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(n)?(r=!0,i=this.options.ecmaVersion>=9&&this.eat(O.star),this.parsePropertyName(n)):r=!1,this.parsePropertyValue(n,t,i,r,s,o,e,u),this.finishNode(n,"Property")};Ue.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var n=t.kind==="get"?0:1;if(t.value.params.length!==n){var i=t.value.start;t.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};Ue.parsePropertyValue=function(t,e,n,i,r,s,o,u){(n||i)&&this.type===O.colon&&this.unexpected(),this.eat(O.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),t.kind="init"):this.options.ecmaVersion>=6&&this.type===O.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(n,i),t.kind="init"):!e&&!u&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==O.comma&&this.type!==O.braceR&&this.type!==O.eq?((n||i)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((n||i)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),e?t.value=this.parseMaybeDefault(r,s,this.copyNode(t.key)):this.type===O.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),t.value=this.parseMaybeDefault(r,s,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected()};Ue.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(O.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(O.bracketR),t.key;t.computed=!1}return t.key=this.type===O.num||this.type===O.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Ue.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};Ue.parseMethod=function(t,e,n){var i=this.startNode(),r=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Zk(e,i.generator)|Fg|(n?SI:0)),this.expect(O.parenL),i.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=r,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(i,"FunctionExpression")};Ue.parseArrowExpression=function(t,e,n,i){var r=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Zk(n,!1)|Wk),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=r,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(t,"ArrowFunctionExpression")};Ue.parseFunctionBody=function(t,e,n,i){var r=e&&this.type!==O.braceL,s=this.strict,o=!1;if(r)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!s||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(t,!s&&!o&&!e&&!n&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,CI),t.body=this.parseBlock(!1,void 0,o&&!s),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()};Ue.isSimpleParamList=function(t){for(var e=0,n=t;e<n.length;e+=1){var i=n[e];if(i.type!=="Identifier")return!1}return!0};Ue.checkParams=function(t,e){for(var n=Object.create(null),i=0,r=t.params;i<r.length;i+=1){var s=r[i];this.checkLValInnerPattern(s,ev,e?null:n)}};Ue.parseExprList=function(t,e,n,i){for(var r=[],s=!0;!this.eat(t);){if(s)s=!1;else if(this.expect(O.comma),e&&this.afterTrailingComma(t))break;var o=void 0;n&&this.type===O.comma?o=null:this.type===O.ellipsis?(o=this.parseSpread(i),i&&this.type===O.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):o=this.parseMaybeAssign(!1,i),r.push(o)}return r};Ue.checkUnreserved=function(t){var e=t.start,n=t.end,i=t.name;if(this.inGenerator&&i==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Pg)&&i==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(i==="arguments"||i==="await")&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,n).indexOf("\\")!==-1)){var r=this.strict?this.reservedWordsStrict:this.reservedWords;r.test(i)&&(!this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))}};Ue.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};Ue.parseIdentNode=function(){var t=this.startNode();return this.type===O.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=O.name):this.unexpected(),t};Ue.parsePrivateIdent=function(){var t=this.startNode();return this.type===O.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};Ue.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===O.semi||this.canInsertSemicolon()||this.type!==O.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(O.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};Ue.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Qm=Zt.prototype;Qm.raise=function(t,e){var n=yI(this.input,t);e+=" ("+n.line+":"+n.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=n,i.raisedAt=this.pos,i};Qm.raiseRecoverable=Qm.raise;Qm.curPosition=function(){if(this.options.locations)return new Oh(this.curLine,this.pos-this.lineStart)};var eo=Zt.prototype,GH=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};eo.enterScope=function(t){this.scopeStack.push(new GH(t))};eo.exitScope=function(){this.scopeStack.pop()};eo.treatFunctionsAsVarInScope=function(t){return t.flags&Gu||!this.inModule&&t.flags&Rh};eo.declareName=function(t,e,n){var i=!1;if(e===$s){var r=this.currentScope();i=r.lexical.indexOf(t)>-1||r.functions.indexOf(t)>-1||r.var.indexOf(t)>-1,r.lexical.push(t),this.inModule&&r.flags&Rh&&delete this.undefinedExports[t]}else if(e===vI){var s=this.currentScope();s.lexical.push(t)}else if(e===kI){var o=this.currentScope();this.treatFunctionsAsVar?i=o.lexical.indexOf(t)>-1:i=o.lexical.indexOf(t)>-1||o.var.indexOf(t)>-1,o.functions.push(t)}else for(var u=this.scopeStack.length-1;u>=0;--u){var c=this.scopeStack[u];if(c.lexical.indexOf(t)>-1&&!(c.flags&bI&&c.lexical[0]===t)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(t)>-1){i=!0;break}if(c.var.push(t),this.inModule&&c.flags&Rh&&delete this.undefinedExports[t],c.flags&Pg)break}i&&this.raiseRecoverable(n,"Identifier '"+t+"' has already been declared")};eo.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};eo.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};eo.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Pg|up|gl))return e}};eo.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Pg|up|gl)&&!(e.flags&Wk))return e}};var $g=function(e,n,i){this.type="",this.start=n,this.end=0,e.options.locations&&(this.loc=new Vg(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[n,0])},cp=Zt.prototype;cp.startNode=function(){return new $g(this,this.start,this.startLoc)};cp.startNodeAt=function(t,e){return new $g(this,t,e)};function NI(t,e,n,i){return t.type=e,t.end=n,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=n),t}cp.finishNode=function(t,e){return NI.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};cp.finishNodeAt=function(t,e,n,i){return NI.call(this,t,e,n,i)};cp.copyNode=function(t){var e=new $g(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var YH="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",AI="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",TI=AI+" Extended_Pictographic",MI=TI,OI=MI+" EBase EComp EMod EPres ExtPict",RI=OI,XH=RI,QH={9:AI,10:TI,11:MI,12:OI,13:RI,14:XH},WH="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",ZH={9:"",10:"",11:"",12:"",13:"",14:WH},LA="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",DI="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",II=DI+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",_I=II+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",zI=_I+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",LI=zI+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",eq=LI+" "+YH,tq={9:DI,10:II,11:_I,12:zI,13:LI,14:eq},BI={};function nq(t){var e=BI[t]={binary:za(QH[t]+" "+LA),binaryOfStrings:za(ZH[t]),nonBinary:{General_Category:za(LA),Script:za(tq[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var ax=0,BA=[9,10,11,12,13,14];ax<BA.length;ax+=1){var iq=BA[ax];nq(iq)}var Ne=Zt.prototype,Wm=function(e,n){this.parent=e,this.base=n||this};Wm.prototype.separatedFrom=function(e){for(var n=this;n;n=n.parent)for(var i=e;i;i=i.parent)if(n.base===i.base&&n!==i)return!0;return!1};Wm.prototype.sibling=function(){return new Wm(this.parent,this.base)};var Yr=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=BI[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Yr.prototype.reset=function(e,n,i){var r=i.indexOf("v")!==-1,s=i.indexOf("u")!==-1;this.start=e|0,this.source=n+"",this.flags=i,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=s&&this.parser.options.ecmaVersion>=9)};Yr.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Yr.prototype.at=function(e,n){n===void 0&&(n=!1);var i=this.source,r=i.length;if(e>=r)return-1;var s=i.charCodeAt(e);if(!(n||this.switchU)||s<=55295||s>=57344||e+1>=r)return s;var o=i.charCodeAt(e+1);return o>=56320&&o<=57343?(s<<10)+o-56613888:s};Yr.prototype.nextIndex=function(e,n){n===void 0&&(n=!1);var i=this.source,r=i.length;if(e>=r)return r;var s=i.charCodeAt(e),o;return!(n||this.switchU)||s<=55295||s>=57344||e+1>=r||(o=i.charCodeAt(e+1))<56320||o>57343?e+1:e+2};Yr.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};Yr.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};Yr.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};Yr.prototype.eat=function(e,n){return n===void 0&&(n=!1),this.current(n)===e?(this.advance(n),!0):!1};Yr.prototype.eatChars=function(e,n){n===void 0&&(n=!1);for(var i=this.pos,r=0,s=e;r<s.length;r+=1){var o=s[r],u=this.at(i,n);if(u===-1||u!==o)return!1;i=this.nextIndex(i,n)}return this.pos=i,!0};Ne.validateRegExpFlags=function(t){for(var e=t.validFlags,n=t.flags,i=!1,r=!1,s=0;s<n.length;s++){var o=n.charAt(s);e.indexOf(o)===-1&&this.raise(t.start,"Invalid regular expression flag"),n.indexOf(o,s+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),o==="u"&&(i=!0),o==="v"&&(r=!0)}this.options.ecmaVersion>=15&&i&&r&&this.raise(t.start,"Invalid regular expression flag")};function rq(t){for(var e in t)return!0;return!1}Ne.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&rq(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};Ne.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,n=t.backReferenceNames;e<n.length;e+=1){var i=n[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}};Ne.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Wm(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};Ne.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};Ne.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};Ne.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!n,!0}return t.pos=e,!1};Ne.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};Ne.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};Ne.regexp_eatBracedQuantifier=function(t,e){var n=t.pos;if(t.eat(123)){var i=0,r=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue),t.eat(125)))return r!==-1&&r<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=n}return!1};Ne.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};Ne.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};Ne.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(t),i=t.eat(45);if(n||i){for(var r=0;r<n.length;r++){var s=n.charAt(r);n.indexOf(s,r+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var o=this.regexp_eatModifiers(t);!n&&!o&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var u=0;u<o.length;u++){var c=o.charAt(u);(o.indexOf(c,u+1)>-1||n.indexOf(c)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1};Ne.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};Ne.regexp_eatModifiers=function(t){for(var e="",n=0;(n=t.current())!==-1&&sq(n);)e+=Is(n),t.advance();return e};function sq(t){return t===105||t===109||t===115}Ne.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};Ne.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};Ne.regexp_eatSyntaxCharacter=function(t){var e=t.current();return VI(e)?(t.lastIntValue=e,t.advance(),!0):!1};function VI(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}Ne.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;(n=t.current())!==-1&&!VI(n);)t.advance();return t.pos!==e};Ne.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};Ne.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,n=t.groupNames[t.lastStringValue];if(n)if(e)for(var i=0,r=n;i<r.length;i+=1){var s=r[i];s.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(n||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}};Ne.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};Ne.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Is(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Is(t.lastIntValue);return!0}return!1};Ne.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),aq(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)};function aq(t){return Ur(t,!0)||t===36||t===95}Ne.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),oq(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)};function oq(t){return Ha(t,!0)||t===36||t===95||t===8204||t===8205}Ne.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};Ne.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var n=t.lastIntValue;if(t.switchU)return n>t.maxBackReference&&(t.maxBackReference=n),!0;if(n<=t.numCapturingParens)return!0;t.pos=e}return!1};Ne.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};Ne.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};Ne.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};Ne.regexp_eatZero=function(t){return t.current()===48&&!Ug(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};Ne.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};Ne.regexp_eatControlLetter=function(t){var e=t.current();return FI(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function FI(t){return t>=65&&t<=90||t>=97&&t<=122}Ne.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var n=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var r=t.lastIntValue;if(i&&r>=55296&&r<=56319){var s=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var o=t.lastIntValue;if(o>=56320&&o<=57343)return t.lastIntValue=(r-55296)*1024+(o-56320)+65536,!0}t.pos=s,t.lastIntValue=r}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&lq(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=n}return!1};function lq(t){return t>=0&&t<=1114111}Ne.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};Ne.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};var PI=0,_s=1,Zi=2;Ne.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(uq(e))return t.lastIntValue=-1,t.advance(),_s;var n=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((n=e===80)||e===112)){t.lastIntValue=-1,t.advance();var i;if(t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return n&&i===Zi&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return PI};function uq(t){return t===100||t===68||t===115||t===83||t===119||t===87}Ne.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var n=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,n,i),_s}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,r)}return PI};Ne.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){Ku(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(n)||t.raise("Invalid property value")};Ne.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return _s;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return Zi;t.raise("Invalid property name")};Ne.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";jI(e=t.current());)t.lastStringValue+=Is(e),t.advance();return t.lastStringValue!==""};function jI(t){return FI(t)||t===95}Ne.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";cq(e=t.current());)t.lastStringValue+=Is(e),t.advance();return t.lastStringValue!==""};function cq(t){return jI(t)||Ug(t)}Ne.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};Ne.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),n=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&n===Zi&&t.raise("Negated character class may contain strings"),!0}return!1};Ne.regexp_classContents=function(t){return t.current()===93?_s:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),_s)};Ne.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var n=t.lastIntValue;t.switchU&&(e===-1||n===-1)&&t.raise("Invalid character class"),e!==-1&&n!==-1&&e>n&&t.raise("Range out of order in character class")}}};Ne.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var n=t.current();(n===99||JI(n))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return i!==93?(t.lastIntValue=i,t.advance(),!0):!1};Ne.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};Ne.regexp_classSetExpression=function(t){var e=_s,n;if(!this.regexp_eatClassSetRange(t))if(n=this.regexp_eatClassSetOperand(t)){n===Zi&&(e=Zi);for(var i=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(n=this.regexp_eatClassSetOperand(t))){n!==Zi&&(e=_s);continue}t.raise("Invalid character in character class")}if(i!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(n=this.regexp_eatClassSetOperand(t),!n)return e;n===Zi&&(e=Zi)}};Ne.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var n=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return n!==-1&&i!==-1&&n>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1};Ne.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?_s:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};Ne.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var n=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return n&&i===Zi&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var r=this.regexp_eatCharacterClassEscape(t);if(r)return r;t.pos=e}return null};Ne.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var n=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return n}else t.raise("Invalid escape");t.pos=e}return null};Ne.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===Zi&&(e=Zi);return e};Ne.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?_s:Zi};Ne.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?!0:t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1);var n=t.current();return n<0||n===t.lookahead()&&fq(n)||hq(n)?!1:(t.advance(),t.lastIntValue=n,!0)};function fq(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function hq(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}Ne.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return pq(e)?(t.lastIntValue=e,t.advance(),!0):!1};function pq(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}Ne.regexp_eatClassControlLetter=function(t){var e=t.current();return Ug(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};Ne.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};Ne.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;Ug(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e};function Ug(t){return t>=48&&t<=57}Ne.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;$I(n=t.current());)t.lastIntValue=16*t.lastIntValue+UI(n),t.advance();return t.pos!==e};function $I(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function UI(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}Ne.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var n=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+n*8+t.lastIntValue:t.lastIntValue=e*8+n}else t.lastIntValue=e;return!0}return!1};Ne.regexp_eatOctalDigit=function(t){var e=t.current();return JI(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function JI(t){return t>=48&&t<=55}Ne.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var r=t.current();if(!$I(r))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+UI(r),t.advance()}return!0};var nv=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Vg(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},at=Zt.prototype;at.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new nv(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};at.getToken=function(){return this.next(),new nv(this)};typeof Symbol<"u"&&(at[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===O.eof,value:e}}}});at.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(O.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};at.readToken=function(t){return Ur(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};at.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888};at.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(n===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var i=void 0,r=e;(i=dI(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,n),e,this.pos,t,this.curPosition())};at.skipLineComment=function(t){for(var e=this.pos,n=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!qu(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,n,this.curPosition())};at.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&mI.test(String.fromCharCode(t)))++this.pos;else break e}}};at.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=t,this.value=e,this.updateContext(n)};at.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(O.ellipsis)):(++this.pos,this.finishToken(O.dot))};at.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(O.assign,2):this.finishOp(O.slash,1)};at.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,i=t===42?O.star:O.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++n,i=O.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(O.assign,n+1):this.finishOp(i,n)};at.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(O.assign,3)}return this.finishOp(t===124?O.logicalOR:O.logicalAND,2)}return e===61?this.finishOp(O.assign,2):this.finishOp(t===124?O.bitwiseOR:O.bitwiseAND,1)};at.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(O.assign,2):this.finishOp(O.bitwiseXOR,1)};at.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||ui.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(O.incDec,2):e===61?this.finishOp(O.assign,2):this.finishOp(O.plusMin,1)};at.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),n=1;return e===t?(n=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(O.assign,n+1):this.finishOp(O.bitShift,n)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(n=2),this.finishOp(O.relational,n))};at.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(O.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(O.arrow)):this.finishOp(t===61?O.eq:O.prefix,1)};at.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(O.questionDot,2)}if(e===63){if(t>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(O.assign,3)}return this.finishOp(O.coalesce,2)}}return this.finishOp(O.question,1)};at.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Ur(e,!0)||e===92))return this.finishToken(O.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Is(e)+"'")};at.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(O.parenL);case 41:return++this.pos,this.finishToken(O.parenR);case 59:return++this.pos,this.finishToken(O.semi);case 44:return++this.pos,this.finishToken(O.comma);case 91:return++this.pos,this.finishToken(O.bracketL);case 93:return++this.pos,this.finishToken(O.bracketR);case 123:return++this.pos,this.finishToken(O.braceL);case 125:return++this.pos,this.finishToken(O.braceR);case 58:return++this.pos,this.finishToken(O.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(O.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(O.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Is(t)+"'")};at.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)};at.readRegexp=function(){for(var t,e,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(ui.test(i)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if(i==="[")e=!0;else if(i==="]"&&e)e=!1;else if(i==="/"&&!e)break;t=i==="\\"}++this.pos}var r=this.input.slice(n,this.pos);++this.pos;var s=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(s);var u=this.regexpState||(this.regexpState=new Yr(this));u.reset(n,r,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var c=null;try{c=new RegExp(r,o)}catch{}return this.finishToken(O.regexp,{pattern:r,flags:o,value:c})};at.readInt=function(t,e,n){for(var i=this.options.ecmaVersion>=12&&e===void 0,r=n&&this.input.charCodeAt(this.pos)===48,s=this.pos,o=0,u=0,c=0,h=e??1/0;c<h;++c,++this.pos){var m=this.input.charCodeAt(this.pos),g=void 0;if(i&&m===95){r&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),u===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),c===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),u=m;continue}if(m>=97?g=m-97+10:m>=65?g=m-65+10:m>=48&&m<=57?g=m-48:g=1/0,g>=t)break;u=m,o=o*t+g}return i&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===s||e!=null&&this.pos-s!==e?null:o};function dq(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function HI(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}at.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var n=this.readInt(t);return n==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=HI(this.input.slice(e,this.pos)),++this.pos):Ur(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(O.num,n)};at.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var n=this.pos-e>=2&&this.input.charCodeAt(e)===48;n&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!n&&!t&&this.options.ecmaVersion>=11&&i===110){var r=HI(this.input.slice(e,this.pos));return++this.pos,Ur(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(O.num,r)}n&&/[89]/.test(this.input.slice(e,this.pos))&&(n=!1),i===46&&!n&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(i===69||i===101)&&!n&&(i=this.input.charCodeAt(++this.pos),(i===43||i===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),Ur(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=dq(this.input.slice(e,this.pos),n);return this.finishToken(O.num,s)};at.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(n,"Code point out of bounds")}else e=this.readHexChar(4);return e};at.readString=function(t){for(var e="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;i===92?(e+=this.input.slice(n,this.pos),e+=this.readEscapedChar(!1),n=this.pos):i===8232||i===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(qu(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(n,this.pos++),this.finishToken(O.string,e)};var qI={};at.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===qI)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};at.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw qI;this.raise(t,e)};at.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===O.template||this.type===O.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(O.dollarBraceL)):(++this.pos,this.finishToken(O.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(O.template,t));if(n===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(qu(n)){switch(t+=this.input.slice(e,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
71
- `;break;default:t+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};at.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(O.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
72
- `&&++this.pos;case`
73
- `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};at.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
74
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Is(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(i,8);return r>255&&(i=i.slice(0,-1),r=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),(i!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return qu(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};at.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n};at.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var r=this.fullCharCodeAtPos();if(Ha(r,i))this.pos+=r<=65535?1:2;else if(r===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var s=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var o=this.readCodePoint();(e?Ur:Ha)(o,i)||this.invalidStringToken(s,"Invalid Unicode escape"),t+=Is(o),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)};at.readWord=function(){var t=this.readWord1(),e=O.name;return this.keywords.test(t)&&(e=Xk[t]),this.finishToken(e,t)};var mq="8.15.0";Zt.acorn={Parser:Zt,version:mq,defaultOptions:Pb,Position:Oh,SourceLocation:Vg,getLineInfo:yI,Node:$g,TokenType:ft,tokTypes:O,keywordTypes:Xk,TokContext:kr,tokContexts:It,isIdentifierChar:Ha,isIdentifierStart:Ur,Token:nv,isNewLine:qu,lineBreak:ui,lineBreakG:BH,nonASCIIwhitespace:mI};var ox={exports:{}},lx,VA;function gq(){return VA||(VA=1,lx={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),lx}var Lf={exports:{}},yq=Lf.exports,FA;function PA(){return FA||(FA=1,(function(t,e){(function(n,i){i(e)})(yq,(function(n){var i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],r=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",o="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",u={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},c="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",h={5:c,"5module":c+" export import",6:c+" const class extends export import super"},m=/^in(stanceof)?$/,g=new RegExp("["+o+"]"),y=new RegExp("["+o+s+"]");function b(p,S){for(var w=65536,A=0;A<S.length;A+=2){if(w+=S[A],w>p)return!1;if(w+=S[A+1],w>=p)return!0}return!1}function v(p,S){return p<65?p===36:p<91?!0:p<97?p===95:p<123?!0:p<=65535?p>=170&&g.test(String.fromCharCode(p)):S===!1?!1:b(p,r)}function E(p,S){return p<48?p===36:p<58?!0:p<65?!1:p<91?!0:p<97?p===95:p<123?!0:p<=65535?p>=170&&y.test(String.fromCharCode(p)):S===!1?!1:b(p,r)||b(p,i)}var T=function(S,w){w===void 0&&(w={}),this.label=S,this.keyword=w.keyword,this.beforeExpr=!!w.beforeExpr,this.startsExpr=!!w.startsExpr,this.isLoop=!!w.isLoop,this.isAssign=!!w.isAssign,this.prefix=!!w.prefix,this.postfix=!!w.postfix,this.binop=w.binop||null,this.updateContext=null};function M(p,S){return new T(p,{beforeExpr:!0,binop:S})}var j={beforeExpr:!0},F={startsExpr:!0},J={};function V(p,S){return S===void 0&&(S={}),S.keyword=p,J[p]=new T(p,S)}var C={num:new T("num",F),regexp:new T("regexp",F),string:new T("string",F),name:new T("name",F),privateId:new T("privateId",F),eof:new T("eof"),bracketL:new T("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new T("]"),braceL:new T("{",{beforeExpr:!0,startsExpr:!0}),braceR:new T("}"),parenL:new T("(",{beforeExpr:!0,startsExpr:!0}),parenR:new T(")"),comma:new T(",",j),semi:new T(";",j),colon:new T(":",j),dot:new T("."),question:new T("?",j),questionDot:new T("?."),arrow:new T("=>",j),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",j),backQuote:new T("`",F),dollarBraceL:new T("${",{beforeExpr:!0,startsExpr:!0}),eq:new T("=",{beforeExpr:!0,isAssign:!0}),assign:new T("_=",{beforeExpr:!0,isAssign:!0}),incDec:new T("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new T("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:M("||",1),logicalAND:M("&&",2),bitwiseOR:M("|",3),bitwiseXOR:M("^",4),bitwiseAND:M("&",5),equality:M("==/!=/===/!==",6),relational:M("</>/<=/>=",7),bitShift:M("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:M("%",10),star:M("*",10),slash:M("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:M("??",1),_break:V("break"),_case:V("case",j),_catch:V("catch"),_continue:V("continue"),_debugger:V("debugger"),_default:V("default",j),_do:V("do",{isLoop:!0,beforeExpr:!0}),_else:V("else",j),_finally:V("finally"),_for:V("for",{isLoop:!0}),_function:V("function",F),_if:V("if"),_return:V("return",j),_switch:V("switch"),_throw:V("throw",j),_try:V("try"),_var:V("var"),_const:V("const"),_while:V("while",{isLoop:!0}),_with:V("with"),_new:V("new",{beforeExpr:!0,startsExpr:!0}),_this:V("this",F),_super:V("super",F),_class:V("class",F),_extends:V("extends",j),_export:V("export"),_import:V("import",F),_null:V("null",F),_true:V("true",F),_false:V("false",F),_in:V("in",{beforeExpr:!0,binop:7}),_instanceof:V("instanceof",{beforeExpr:!0,binop:7}),_typeof:V("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},L=/\r\n?|\n|\u2028|\u2029/,q=new RegExp(L.source,"g");function re(p){return p===10||p===13||p===8232||p===8233}function K(p,S,w){w===void 0&&(w=p.length);for(var A=S;A<w;A++){var z=p.charCodeAt(A);if(re(z))return A<w-1&&z===13&&p.charCodeAt(A+1)===10?A+2:A+1}return-1}var pe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,he=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ke=Object.prototype,Ie=ke.hasOwnProperty,De=ke.toString,W=Object.hasOwn||(function(p,S){return Ie.call(p,S)}),oe=Array.isArray||(function(p){return De.call(p)==="[object Array]"}),de=Object.create(null);function ve(p){return de[p]||(de[p]=new RegExp("^(?:"+p.replace(/ /g,"|")+")$"))}function D(p){return p<=65535?String.fromCharCode(p):(p-=65536,String.fromCharCode((p>>10)+55296,(p&1023)+56320))}var P=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ne=function(S,w){this.line=S,this.column=w};ne.prototype.offset=function(S){return new ne(this.line,this.column+S)};var B=function(S,w,A){this.start=w,this.end=A,S.sourceFile!==null&&(this.source=S.sourceFile)};function be(p,S){for(var w=1,A=0;;){var z=K(p,A,S);if(z<0)return new ne(w,S-A);++w,A=z}}var Re={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Me=!1;function Xe(p){var S={};for(var w in Re)S[w]=p&&W(p,w)?p[w]:Re[w];if(S.ecmaVersion==="latest"?S.ecmaVersion=1e8:S.ecmaVersion==null?(!Me&&typeof console=="object"&&console.warn&&(Me=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
75
- Defaulting to 2020, but this will stop working in the future.`)),S.ecmaVersion=11):S.ecmaVersion>=2015&&(S.ecmaVersion-=2009),S.allowReserved==null&&(S.allowReserved=S.ecmaVersion<5),(!p||p.allowHashBang==null)&&(S.allowHashBang=S.ecmaVersion>=14),oe(S.onToken)){var A=S.onToken;S.onToken=function(z){return A.push(z)}}if(oe(S.onComment)&&(S.onComment=Ct(S,S.onComment)),S.sourceType==="commonjs"&&S.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return S}function Ct(p,S){return function(w,A,z,X,Z,ge){var xe={type:w?"Block":"Line",value:A,start:z,end:X};p.locations&&(xe.loc=new B(this,Z,ge)),p.ranges&&(xe.range=[z,X]),S.push(xe)}}var Qe=1,zt=2,Lt=4,Tr=8,ur=16,Xn=32,pi=64,Mi=128,Qn=256,di=512,cr=1024,On=Qe|zt|Qn;function Oi(p,S){return zt|(p?Lt:0)|(S?Tr:0)}var Mr=0,Ri=1,$e=2,Xr=3,ae=4,me=5,I=function(S,w,A){this.options=S=Xe(S),this.sourceFile=S.sourceFile,this.keywords=ve(h[S.ecmaVersion>=6?6:S.sourceType==="module"?"5module":5]);var z="";S.allowReserved!==!0&&(z=u[S.ecmaVersion>=6?6:S.ecmaVersion===5?5:3],S.sourceType==="module"&&(z+=" await")),this.reservedWords=ve(z);var X=(z?z+" ":"")+u.strict;this.reservedWordsStrict=ve(X),this.reservedWordsStrictBind=ve(X+" "+u.strictBind),this.input=String(w),this.containsEsc=!1,A?(this.pos=A,this.lineStart=this.input.lastIndexOf(`
76
- `,A-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(L).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=C.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=S.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&S.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?zt:Qe),this.regexpState=null,this.privateNameStack=[]},_e={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};I.prototype.parse=function(){var S=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(S)},_e.inFunction.get=function(){return(this.currentVarScope().flags&zt)>0},_e.inGenerator.get=function(){return(this.currentVarScope().flags&Tr)>0},_e.inAsync.get=function(){return(this.currentVarScope().flags&Lt)>0},_e.canAwait.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],w=S.flags;if(w&(Qn|di))return!1;if(w&zt)return(w&Lt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},_e.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Qe)},_e.allowSuper.get=function(){var p=this.currentThisScope(),S=p.flags;return(S&pi)>0||this.options.allowSuperOutsideMethod},_e.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Mi)>0},_e.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},_e.allowNewDotTarget.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],w=S.flags;if(w&(Qn|di)||w&zt&&!(w&ur))return!0}return!1},_e.allowUsing.get=function(){var p=this.currentScope(),S=p.flags;return!(S&cr||!this.inModule&&S&Qe)},_e.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Qn)>0},I.extend=function(){for(var S=[],w=arguments.length;w--;)S[w]=arguments[w];for(var A=this,z=0;z<S.length;z++)A=S[z](A);return A},I.parse=function(S,w){return new this(w,S).parse()},I.parseExpressionAt=function(S,w,A){var z=new this(A,S,w);return z.nextToken(),z.parseExpression()},I.tokenizer=function(S,w){return new this(w,S)},Object.defineProperties(I.prototype,_e);var Pe=I.prototype,tn=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Pe.strictDirective=function(p){if(this.options.ecmaVersion<5)return!1;for(;;){he.lastIndex=p,p+=he.exec(this.input)[0].length;var S=tn.exec(this.input.slice(p));if(!S)return!1;if((S[1]||S[2])==="use strict"){he.lastIndex=p+S[0].length;var w=he.exec(this.input),A=w.index+w[0].length,z=this.input.charAt(A);return z===";"||z==="}"||L.test(w[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(z)||z==="!"&&this.input.charAt(A+1)==="=")}p+=S[0].length,he.lastIndex=p,p+=he.exec(this.input)[0].length,this.input[p]===";"&&p++}},Pe.eat=function(p){return this.type===p?(this.next(),!0):!1},Pe.isContextual=function(p){return this.type===C.name&&this.value===p&&!this.containsEsc},Pe.eatContextual=function(p){return this.isContextual(p)?(this.next(),!0):!1},Pe.expectContextual=function(p){this.eatContextual(p)||this.unexpected()},Pe.canInsertSemicolon=function(){return this.type===C.eof||this.type===C.braceR||L.test(this.input.slice(this.lastTokEnd,this.start))},Pe.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Pe.semicolon=function(){!this.eat(C.semi)&&!this.insertSemicolon()&&this.unexpected()},Pe.afterTrailingComma=function(p,S){if(this.type===p)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),S||this.next(),!0},Pe.expect=function(p){this.eat(p)||this.unexpected()},Pe.unexpected=function(p){this.raise(p??this.start,"Unexpected token")};var Wn=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Pe.checkPatternErrors=function(p,S){if(p){p.trailingComma>-1&&this.raiseRecoverable(p.trailingComma,"Comma is not permitted after the rest element");var w=S?p.parenthesizedAssign:p.parenthesizedBind;w>-1&&this.raiseRecoverable(w,S?"Assigning to rvalue":"Parenthesized pattern")}},Pe.checkExpressionErrors=function(p,S){if(!p)return!1;var w=p.shorthandAssign,A=p.doubleProto;if(!S)return w>=0||A>=0;w>=0&&this.raise(w,"Shorthand property assignments are valid only in destructuring patterns"),A>=0&&this.raiseRecoverable(A,"Redefinition of __proto__ property")},Pe.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Pe.isSimpleAssignTarget=function(p){return p.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(p.expression):p.type==="Identifier"||p.type==="MemberExpression"};var Se=I.prototype;Se.parseTopLevel=function(p){var S=Object.create(null);for(p.body||(p.body=[]);this.type!==C.eof;){var w=this.parseStatement(null,!0,S);p.body.push(w)}if(this.inModule)for(var A=0,z=Object.keys(this.undefinedExports);A<z.length;A+=1){var X=z[A];this.raiseRecoverable(this.undefinedExports[X].start,"Export '"+X+"' is not defined")}return this.adaptDirectivePrologue(p.body),this.next(),p.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(p,"Program")};var _t={kind:"loop"},mn={kind:"switch"};Se.isLet=function(p){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;he.lastIndex=this.pos;var S=he.exec(this.input),w=this.pos+S[0].length,A=this.fullCharCodeAt(w);if(A===91||A===92)return!0;if(p)return!1;if(A===123)return!0;if(v(A)){var z=w;do w+=A<=65535?1:2;while(E(A=this.fullCharCodeAt(w)));if(A===92)return!0;var X=this.input.slice(z,w);if(!m.test(X))return!0}return!1},Se.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;he.lastIndex=this.pos;var p=he.exec(this.input),S=this.pos+p[0].length,w;return!L.test(this.input.slice(this.pos,S))&&this.input.slice(S,S+8)==="function"&&(S+8===this.input.length||!(E(w=this.fullCharCodeAt(S+8))||w===92))},Se.isUsingKeyword=function(p,S){if(this.options.ecmaVersion<17||!this.isContextual(p?"await":"using"))return!1;he.lastIndex=this.pos;var w=he.exec(this.input),A=this.pos+w[0].length;if(L.test(this.input.slice(this.pos,A)))return!1;if(p){var z=A+5,X;if(this.input.slice(A,z)!=="using"||z===this.input.length||E(X=this.fullCharCodeAt(z))||X===92)return!1;he.lastIndex=z;var Z=he.exec(this.input);if(A=z+Z[0].length,Z&&L.test(this.input.slice(z,A)))return!1}var ge=this.fullCharCodeAt(A);if(!v(ge)&&ge!==92)return!1;var xe=A;do A+=ge<=65535?1:2;while(E(ge=this.fullCharCodeAt(A)));if(ge===92)return!0;var Le=this.input.slice(xe,A);return!(m.test(Le)||S&&Le==="of")},Se.isAwaitUsing=function(p){return this.isUsingKeyword(!0,p)},Se.isUsing=function(p){return this.isUsingKeyword(!1,p)},Se.parseStatement=function(p,S,w){var A=this.type,z=this.startNode(),X;switch(this.isLet(p)&&(A=C._var,X="let"),A){case C._break:case C._continue:return this.parseBreakContinueStatement(z,A.keyword);case C._debugger:return this.parseDebuggerStatement(z);case C._do:return this.parseDoStatement(z);case C._for:return this.parseForStatement(z);case C._function:return p&&(this.strict||p!=="if"&&p!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(z,!1,!p);case C._class:return p&&this.unexpected(),this.parseClass(z,!0);case C._if:return this.parseIfStatement(z);case C._return:return this.parseReturnStatement(z);case C._switch:return this.parseSwitchStatement(z);case C._throw:return this.parseThrowStatement(z);case C._try:return this.parseTryStatement(z);case C._const:case C._var:return X=X||this.value,p&&X!=="var"&&this.unexpected(),this.parseVarStatement(z,X);case C._while:return this.parseWhileStatement(z);case C._with:return this.parseWithStatement(z);case C.braceL:return this.parseBlock(!0,z);case C.semi:return this.parseEmptyStatement(z);case C._export:case C._import:if(this.options.ecmaVersion>10&&A===C._import){he.lastIndex=this.pos;var Z=he.exec(this.input),ge=this.pos+Z[0].length,xe=this.input.charCodeAt(ge);if(xe===40||xe===46)return this.parseExpressionStatement(z,this.parseExpression())}return this.options.allowImportExportEverywhere||(S||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),A===C._import?this.parseImport(z):this.parseExport(z,w);default:if(this.isAsyncFunction())return p&&this.unexpected(),this.next(),this.parseFunctionStatement(z,!0,!p);var Le=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Le)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),Le==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(z,!1,Le),this.semicolon(),this.finishNode(z,"VariableDeclaration");var qe=this.value,yt=this.parseExpression();return A===C.name&&yt.type==="Identifier"&&this.eat(C.colon)?this.parseLabeledStatement(z,qe,yt,p):this.parseExpressionStatement(z,yt)}},Se.parseBreakContinueStatement=function(p,S){var w=S==="break";this.next(),this.eat(C.semi)||this.insertSemicolon()?p.label=null:this.type!==C.name?this.unexpected():(p.label=this.parseIdent(),this.semicolon());for(var A=0;A<this.labels.length;++A){var z=this.labels[A];if((p.label==null||z.name===p.label.name)&&(z.kind!=null&&(w||z.kind==="loop")||p.label&&w))break}return A===this.labels.length&&this.raise(p.start,"Unsyntactic "+S),this.finishNode(p,w?"BreakStatement":"ContinueStatement")},Se.parseDebuggerStatement=function(p){return this.next(),this.semicolon(),this.finishNode(p,"DebuggerStatement")},Se.parseDoStatement=function(p){return this.next(),this.labels.push(_t),p.body=this.parseStatement("do"),this.labels.pop(),this.expect(C._while),p.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(C.semi):this.semicolon(),this.finishNode(p,"DoWhileStatement")},Se.parseForStatement=function(p){this.next();var S=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(_t),this.enterScope(0),this.expect(C.parenL),this.type===C.semi)return S>-1&&this.unexpected(S),this.parseFor(p,null);var w=this.isLet();if(this.type===C._var||this.type===C._const||w){var A=this.startNode(),z=w?"let":this.value;return this.next(),this.parseVar(A,!0,z),this.finishNode(A,"VariableDeclaration"),this.parseForAfterInit(p,A,S)}var X=this.isContextual("let"),Z=!1,ge=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(ge){var xe=this.startNode();return this.next(),ge==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(xe,!0,ge),this.finishNode(xe,"VariableDeclaration"),this.parseForAfterInit(p,xe,S)}var Le=this.containsEsc,qe=new Wn,yt=this.start,Ft=S>-1?this.parseExprSubscripts(qe,"await"):this.parseExpression(!0,qe);return this.type===C._in||(Z=this.options.ecmaVersion>=6&&this.isContextual("of"))?(S>-1?(this.type===C._in&&this.unexpected(S),p.await=!0):Z&&this.options.ecmaVersion>=8&&(Ft.start===yt&&!Le&&Ft.type==="Identifier"&&Ft.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(p.await=!1)),X&&Z&&this.raise(Ft.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Ft,!1,qe),this.checkLValPattern(Ft),this.parseForIn(p,Ft)):(this.checkExpressionErrors(qe,!0),S>-1&&this.unexpected(S),this.parseFor(p,Ft))},Se.parseForAfterInit=function(p,S,w){return(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&S.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===C._in?w>-1&&this.unexpected(w):p.await=w>-1),this.parseForIn(p,S)):(w>-1&&this.unexpected(w),this.parseFor(p,S))},Se.parseFunctionStatement=function(p,S,w){return this.next(),this.parseFunction(p,Zn|(w?0:Rn),!1,S)},Se.parseIfStatement=function(p){return this.next(),p.test=this.parseParenExpression(),p.consequent=this.parseStatement("if"),p.alternate=this.eat(C._else)?this.parseStatement("if"):null,this.finishNode(p,"IfStatement")},Se.parseReturnStatement=function(p){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(C.semi)||this.insertSemicolon()?p.argument=null:(p.argument=this.parseExpression(),this.semicolon()),this.finishNode(p,"ReturnStatement")},Se.parseSwitchStatement=function(p){this.next(),p.discriminant=this.parseParenExpression(),p.cases=[],this.expect(C.braceL),this.labels.push(mn),this.enterScope(cr);for(var S,w=!1;this.type!==C.braceR;)if(this.type===C._case||this.type===C._default){var A=this.type===C._case;S&&this.finishNode(S,"SwitchCase"),p.cases.push(S=this.startNode()),S.consequent=[],this.next(),A?S.test=this.parseExpression():(w&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),w=!0,S.test=null),this.expect(C.colon)}else S||this.unexpected(),S.consequent.push(this.parseStatement(null));return this.exitScope(),S&&this.finishNode(S,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(p,"SwitchStatement")},Se.parseThrowStatement=function(p){return this.next(),L.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),p.argument=this.parseExpression(),this.semicolon(),this.finishNode(p,"ThrowStatement")};var St=[];Se.parseCatchClauseParam=function(){var p=this.parseBindingAtom(),S=p.type==="Identifier";return this.enterScope(S?Xn:0),this.checkLValPattern(p,S?ae:$e),this.expect(C.parenR),p},Se.parseTryStatement=function(p){if(this.next(),p.block=this.parseBlock(),p.handler=null,this.type===C._catch){var S=this.startNode();this.next(),this.eat(C.parenL)?S.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),S.param=null,this.enterScope(0)),S.body=this.parseBlock(!1),this.exitScope(),p.handler=this.finishNode(S,"CatchClause")}return p.finalizer=this.eat(C._finally)?this.parseBlock():null,!p.handler&&!p.finalizer&&this.raise(p.start,"Missing catch or finally clause"),this.finishNode(p,"TryStatement")},Se.parseVarStatement=function(p,S,w){return this.next(),this.parseVar(p,!1,S,w),this.semicolon(),this.finishNode(p,"VariableDeclaration")},Se.parseWhileStatement=function(p){return this.next(),p.test=this.parseParenExpression(),this.labels.push(_t),p.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(p,"WhileStatement")},Se.parseWithStatement=function(p){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),p.object=this.parseParenExpression(),p.body=this.parseStatement("with"),this.finishNode(p,"WithStatement")},Se.parseEmptyStatement=function(p){return this.next(),this.finishNode(p,"EmptyStatement")},Se.parseLabeledStatement=function(p,S,w,A){for(var z=0,X=this.labels;z<X.length;z+=1){var Z=X[z];Z.name===S&&this.raise(w.start,"Label '"+S+"' is already declared")}for(var ge=this.type.isLoop?"loop":this.type===C._switch?"switch":null,xe=this.labels.length-1;xe>=0;xe--){var Le=this.labels[xe];if(Le.statementStart===p.start)Le.statementStart=this.start,Le.kind=ge;else break}return this.labels.push({name:S,kind:ge,statementStart:this.start}),p.body=this.parseStatement(A?A.indexOf("label")===-1?A+"label":A:"label"),this.labels.pop(),p.label=w,this.finishNode(p,"LabeledStatement")},Se.parseExpressionStatement=function(p,S){return p.expression=S,this.semicolon(),this.finishNode(p,"ExpressionStatement")},Se.parseBlock=function(p,S,w){for(p===void 0&&(p=!0),S===void 0&&(S=this.startNode()),S.body=[],this.expect(C.braceL),p&&this.enterScope(0);this.type!==C.braceR;){var A=this.parseStatement(null);S.body.push(A)}return w&&(this.strict=!1),this.next(),p&&this.exitScope(),this.finishNode(S,"BlockStatement")},Se.parseFor=function(p,S){return p.init=S,this.expect(C.semi),p.test=this.type===C.semi?null:this.parseExpression(),this.expect(C.semi),p.update=this.type===C.parenR?null:this.parseExpression(),this.expect(C.parenR),p.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(p,"ForStatement")},Se.parseForIn=function(p,S){var w=this.type===C._in;return this.next(),S.type==="VariableDeclaration"&&S.declarations[0].init!=null&&(!w||this.options.ecmaVersion<8||this.strict||S.kind!=="var"||S.declarations[0].id.type!=="Identifier")&&this.raise(S.start,(w?"for-in":"for-of")+" loop variable declaration may not have an initializer"),p.left=S,p.right=w?this.parseExpression():this.parseMaybeAssign(),this.expect(C.parenR),p.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(p,w?"ForInStatement":"ForOfStatement")},Se.parseVar=function(p,S,w,A){for(p.declarations=[],p.kind=w;;){var z=this.startNode();if(this.parseVarId(z,w),this.eat(C.eq)?z.init=this.parseMaybeAssign(S):!A&&w==="const"&&!(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!A&&(w==="using"||w==="await using")&&this.options.ecmaVersion>=17&&this.type!==C._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+w+" declaration"):!A&&z.id.type!=="Identifier"&&!(S&&(this.type===C._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):z.init=null,p.declarations.push(this.finishNode(z,"VariableDeclarator")),!this.eat(C.comma))break}return p},Se.parseVarId=function(p,S){p.id=S==="using"||S==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(p.id,S==="var"?Ri:$e,!1)};var Zn=1,Rn=2,fp=4;Se.parseFunction=function(p,S,w,A,z){this.initFunction(p),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!A)&&(this.type===C.star&&S&Rn&&this.unexpected(),p.generator=this.eat(C.star)),this.options.ecmaVersion>=8&&(p.async=!!A),S&Zn&&(p.id=S&fp&&this.type!==C.name?null:this.parseIdent(),p.id&&!(S&Rn)&&this.checkLValSimple(p.id,this.strict||p.generator||p.async?this.treatFunctionsAsVar?Ri:$e:Xr));var X=this.yieldPos,Z=this.awaitPos,ge=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Oi(p.async,p.generator)),S&Zn||(p.id=this.type===C.name?this.parseIdent():null),this.parseFunctionParams(p),this.parseFunctionBody(p,w,!1,z),this.yieldPos=X,this.awaitPos=Z,this.awaitIdentPos=ge,this.finishNode(p,S&Zn?"FunctionDeclaration":"FunctionExpression")},Se.parseFunctionParams=function(p){this.expect(C.parenL),p.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Se.parseClass=function(p,S){this.next();var w=this.strict;this.strict=!0,this.parseClassId(p,S),this.parseClassSuper(p);var A=this.enterClassBody(),z=this.startNode(),X=!1;for(z.body=[],this.expect(C.braceL);this.type!==C.braceR;){var Z=this.parseClassElement(p.superClass!==null);Z&&(z.body.push(Z),Z.type==="MethodDefinition"&&Z.kind==="constructor"?(X&&this.raiseRecoverable(Z.start,"Duplicate constructor in the same class"),X=!0):Z.key&&Z.key.type==="PrivateIdentifier"&&yl(A,Z)&&this.raiseRecoverable(Z.key.start,"Identifier '#"+Z.key.name+"' has already been declared"))}return this.strict=w,this.next(),p.body=this.finishNode(z,"ClassBody"),this.exitClassBody(),this.finishNode(p,S?"ClassDeclaration":"ClassExpression")},Se.parseClassElement=function(p){if(this.eat(C.semi))return null;var S=this.options.ecmaVersion,w=this.startNode(),A="",z=!1,X=!1,Z="method",ge=!1;if(this.eatContextual("static")){if(S>=13&&this.eat(C.braceL))return this.parseClassStaticBlock(w),w;this.isClassElementNameStart()||this.type===C.star?ge=!0:A="static"}if(w.static=ge,!A&&S>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===C.star)&&!this.canInsertSemicolon()?X=!0:A="async"),!A&&(S>=9||!X)&&this.eat(C.star)&&(z=!0),!A&&!X&&!z){var xe=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?Z=xe:A=xe)}if(A?(w.computed=!1,w.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),w.key.name=A,this.finishNode(w.key,"Identifier")):this.parseClassElementName(w),S<13||this.type===C.parenL||Z!=="method"||z||X){var Le=!w.static&&Qr(w,"constructor"),qe=Le&&p;Le&&Z!=="method"&&this.raise(w.key.start,"Constructor can't have get/set modifier"),w.kind=Le?"constructor":Z,this.parseClassMethod(w,z,X,qe)}else this.parseClassField(w);return w},Se.isClassElementNameStart=function(){return this.type===C.name||this.type===C.privateId||this.type===C.num||this.type===C.string||this.type===C.bracketL||this.type.keyword},Se.parseClassElementName=function(p){this.type===C.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),p.computed=!1,p.key=this.parsePrivateIdent()):this.parsePropertyName(p)},Se.parseClassMethod=function(p,S,w,A){var z=p.key;p.kind==="constructor"?(S&&this.raise(z.start,"Constructor can't be a generator"),w&&this.raise(z.start,"Constructor can't be an async method")):p.static&&Qr(p,"prototype")&&this.raise(z.start,"Classes may not have a static property named prototype");var X=p.value=this.parseMethod(S,w,A);return p.kind==="get"&&X.params.length!==0&&this.raiseRecoverable(X.start,"getter should have no params"),p.kind==="set"&&X.params.length!==1&&this.raiseRecoverable(X.start,"setter should have exactly one param"),p.kind==="set"&&X.params[0].type==="RestElement"&&this.raiseRecoverable(X.params[0].start,"Setter cannot use rest params"),this.finishNode(p,"MethodDefinition")},Se.parseClassField=function(p){return Qr(p,"constructor")?this.raise(p.key.start,"Classes can't have a field named 'constructor'"):p.static&&Qr(p,"prototype")&&this.raise(p.key.start,"Classes can't have a static field named 'prototype'"),this.eat(C.eq)?(this.enterScope(di|pi),p.value=this.parseMaybeAssign(),this.exitScope()):p.value=null,this.semicolon(),this.finishNode(p,"PropertyDefinition")},Se.parseClassStaticBlock=function(p){p.body=[];var S=this.labels;for(this.labels=[],this.enterScope(Qn|pi);this.type!==C.braceR;){var w=this.parseStatement(null);p.body.push(w)}return this.next(),this.exitScope(),this.labels=S,this.finishNode(p,"StaticBlock")},Se.parseClassId=function(p,S){this.type===C.name?(p.id=this.parseIdent(),S&&this.checkLValSimple(p.id,$e,!1)):(S===!0&&this.unexpected(),p.id=null)},Se.parseClassSuper=function(p){p.superClass=this.eat(C._extends)?this.parseExprSubscripts(null,!1):null},Se.enterClassBody=function(){var p={declared:Object.create(null),used:[]};return this.privateNameStack.push(p),p.declared},Se.exitClassBody=function(){var p=this.privateNameStack.pop(),S=p.declared,w=p.used;if(this.options.checkPrivateFields)for(var A=this.privateNameStack.length,z=A===0?null:this.privateNameStack[A-1],X=0;X<w.length;++X){var Z=w[X];W(S,Z.name)||(z?z.used.push(Z):this.raiseRecoverable(Z.start,"Private field '#"+Z.name+"' must be declared in an enclosing class"))}};function yl(p,S){var w=S.key.name,A=p[w],z="true";return S.type==="MethodDefinition"&&(S.kind==="get"||S.kind==="set")&&(z=(S.static?"s":"i")+S.kind),A==="iget"&&z==="iset"||A==="iset"&&z==="iget"||A==="sget"&&z==="sset"||A==="sset"&&z==="sget"?(p[w]="true",!1):A?!0:(p[w]=z,!1)}function Qr(p,S){var w=p.computed,A=p.key;return!w&&(A.type==="Identifier"&&A.name===S||A.type==="Literal"&&A.value===S)}Se.parseExportAllDeclaration=function(p,S){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(p.exported=this.parseModuleExportName(),this.checkExport(S,p.exported,this.lastTokStart)):p.exported=null),this.expectContextual("from"),this.type!==C.string&&this.unexpected(),p.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(p.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(p,"ExportAllDeclaration")},Se.parseExport=function(p,S){if(this.next(),this.eat(C.star))return this.parseExportAllDeclaration(p,S);if(this.eat(C._default))return this.checkExport(S,"default",this.lastTokStart),p.declaration=this.parseExportDefaultDeclaration(),this.finishNode(p,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())p.declaration=this.parseExportDeclaration(p),p.declaration.type==="VariableDeclaration"?this.checkVariableExport(S,p.declaration.declarations):this.checkExport(S,p.declaration.id,p.declaration.id.start),p.specifiers=[],p.source=null,this.options.ecmaVersion>=16&&(p.attributes=[]);else{if(p.declaration=null,p.specifiers=this.parseExportSpecifiers(S),this.eatContextual("from"))this.type!==C.string&&this.unexpected(),p.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(p.attributes=this.parseWithClause());else{for(var w=0,A=p.specifiers;w<A.length;w+=1){var z=A[w];this.checkUnreserved(z.local),this.checkLocalExport(z.local),z.local.type==="Literal"&&this.raise(z.local.start,"A string literal cannot be used as an exported binding without `from`.")}p.source=null,this.options.ecmaVersion>=16&&(p.attributes=[])}this.semicolon()}return this.finishNode(p,"ExportNamedDeclaration")},Se.parseExportDeclaration=function(p){return this.parseStatement(null)},Se.parseExportDefaultDeclaration=function(){var p;if(this.type===C._function||(p=this.isAsyncFunction())){var S=this.startNode();return this.next(),p&&this.next(),this.parseFunction(S,Zn|fp,!1,p)}else if(this.type===C._class){var w=this.startNode();return this.parseClass(w,"nullableID")}else{var A=this.parseMaybeAssign();return this.semicolon(),A}},Se.checkExport=function(p,S,w){p&&(typeof S!="string"&&(S=S.type==="Identifier"?S.name:S.value),W(p,S)&&this.raiseRecoverable(w,"Duplicate export '"+S+"'"),p[S]=!0)},Se.checkPatternExport=function(p,S){var w=S.type;if(w==="Identifier")this.checkExport(p,S,S.start);else if(w==="ObjectPattern")for(var A=0,z=S.properties;A<z.length;A+=1){var X=z[A];this.checkPatternExport(p,X)}else if(w==="ArrayPattern")for(var Z=0,ge=S.elements;Z<ge.length;Z+=1){var xe=ge[Z];xe&&this.checkPatternExport(p,xe)}else w==="Property"?this.checkPatternExport(p,S.value):w==="AssignmentPattern"?this.checkPatternExport(p,S.left):w==="RestElement"&&this.checkPatternExport(p,S.argument)},Se.checkVariableExport=function(p,S){if(p)for(var w=0,A=S;w<A.length;w+=1){var z=A[w];this.checkPatternExport(p,z.id)}},Se.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},Se.parseExportSpecifier=function(p){var S=this.startNode();return S.local=this.parseModuleExportName(),S.exported=this.eatContextual("as")?this.parseModuleExportName():S.local,this.checkExport(p,S.exported,S.exported.start),this.finishNode(S,"ExportSpecifier")},Se.parseExportSpecifiers=function(p){var S=[],w=!0;for(this.expect(C.braceL);!this.eat(C.braceR);){if(w)w=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;S.push(this.parseExportSpecifier(p))}return S},Se.parseImport=function(p){return this.next(),this.type===C.string?(p.specifiers=St,p.source=this.parseExprAtom()):(p.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),p.source=this.type===C.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(p.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(p,"ImportDeclaration")},Se.parseImportSpecifier=function(){var p=this.startNode();return p.imported=this.parseModuleExportName(),this.eatContextual("as")?p.local=this.parseIdent():(this.checkUnreserved(p.imported),p.local=p.imported),this.checkLValSimple(p.local,$e),this.finishNode(p,"ImportSpecifier")},Se.parseImportDefaultSpecifier=function(){var p=this.startNode();return p.local=this.parseIdent(),this.checkLValSimple(p.local,$e),this.finishNode(p,"ImportDefaultSpecifier")},Se.parseImportNamespaceSpecifier=function(){var p=this.startNode();return this.next(),this.expectContextual("as"),p.local=this.parseIdent(),this.checkLValSimple(p.local,$e),this.finishNode(p,"ImportNamespaceSpecifier")},Se.parseImportSpecifiers=function(){var p=[],S=!0;if(this.type===C.name&&(p.push(this.parseImportDefaultSpecifier()),!this.eat(C.comma)))return p;if(this.type===C.star)return p.push(this.parseImportNamespaceSpecifier()),p;for(this.expect(C.braceL);!this.eat(C.braceR);){if(S)S=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;p.push(this.parseImportSpecifier())}return p},Se.parseWithClause=function(){var p=[];if(!this.eat(C._with))return p;this.expect(C.braceL);for(var S={},w=!0;!this.eat(C.braceR);){if(w)w=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;var A=this.parseImportAttribute(),z=A.key.type==="Identifier"?A.key.name:A.key.value;W(S,z)&&this.raiseRecoverable(A.key.start,"Duplicate attribute key '"+z+"'"),S[z]=!0,p.push(A)}return p},Se.parseImportAttribute=function(){var p=this.startNode();return p.key=this.type===C.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(C.colon),this.type!==C.string&&this.unexpected(),p.value=this.parseExprAtom(),this.finishNode(p,"ImportAttribute")},Se.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===C.string){var p=this.parseLiteral(this.value);return P.test(p.value)&&this.raise(p.start,"An export name cannot include a lone surrogate."),p}return this.parseIdent(!0)},Se.adaptDirectivePrologue=function(p){for(var S=0;S<p.length&&this.isDirectiveCandidate(p[S]);++S)p[S].directive=p[S].expression.raw.slice(1,-1)},Se.isDirectiveCandidate=function(p){return this.options.ecmaVersion>=5&&p.type==="ExpressionStatement"&&p.expression.type==="Literal"&&typeof p.expression.value=="string"&&(this.input[p.start]==='"'||this.input[p.start]==="'")};var sn=I.prototype;sn.toAssignable=function(p,S,w){if(this.options.ecmaVersion>=6&&p)switch(p.type){case"Identifier":this.inAsync&&p.name==="await"&&this.raise(p.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":p.type="ObjectPattern",w&&this.checkPatternErrors(w,!0);for(var A=0,z=p.properties;A<z.length;A+=1){var X=z[A];this.toAssignable(X,S),X.type==="RestElement"&&(X.argument.type==="ArrayPattern"||X.argument.type==="ObjectPattern")&&this.raise(X.argument.start,"Unexpected token")}break;case"Property":p.kind!=="init"&&this.raise(p.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(p.value,S);break;case"ArrayExpression":p.type="ArrayPattern",w&&this.checkPatternErrors(w,!0),this.toAssignableList(p.elements,S);break;case"SpreadElement":p.type="RestElement",this.toAssignable(p.argument,S),p.argument.type==="AssignmentPattern"&&this.raise(p.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":p.operator!=="="&&this.raise(p.left.end,"Only '=' operator can be used for specifying default value."),p.type="AssignmentPattern",delete p.operator,this.toAssignable(p.left,S);break;case"ParenthesizedExpression":this.toAssignable(p.expression,S,w);break;case"ChainExpression":this.raiseRecoverable(p.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!S)break;default:this.raise(p.start,"Assigning to rvalue")}else w&&this.checkPatternErrors(w,!0);return p},sn.toAssignableList=function(p,S){for(var w=p.length,A=0;A<w;A++){var z=p[A];z&&this.toAssignable(z,S)}if(w){var X=p[w-1];this.options.ecmaVersion===6&&S&&X&&X.type==="RestElement"&&X.argument.type!=="Identifier"&&this.unexpected(X.argument.start)}return p},sn.parseSpread=function(p){var S=this.startNode();return this.next(),S.argument=this.parseMaybeAssign(!1,p),this.finishNode(S,"SpreadElement")},sn.parseRestBinding=function(){var p=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==C.name&&this.unexpected(),p.argument=this.parseBindingAtom(),this.finishNode(p,"RestElement")},sn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case C.bracketL:var p=this.startNode();return this.next(),p.elements=this.parseBindingList(C.bracketR,!0,!0),this.finishNode(p,"ArrayPattern");case C.braceL:return this.parseObj(!0)}return this.parseIdent()},sn.parseBindingList=function(p,S,w,A){for(var z=[],X=!0;!this.eat(p);)if(X?X=!1:this.expect(C.comma),S&&this.type===C.comma)z.push(null);else{if(w&&this.afterTrailingComma(p))break;if(this.type===C.ellipsis){var Z=this.parseRestBinding();this.parseBindingListItem(Z),z.push(Z),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(p);break}else z.push(this.parseAssignableListItem(A))}return z},sn.parseAssignableListItem=function(p){var S=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(S),S},sn.parseBindingListItem=function(p){return p},sn.parseMaybeDefault=function(p,S,w){if(w=w||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(C.eq))return w;var A=this.startNodeAt(p,S);return A.left=w,A.right=this.parseMaybeAssign(),this.finishNode(A,"AssignmentPattern")},sn.checkLValSimple=function(p,S,w){S===void 0&&(S=Mr);var A=S!==Mr;switch(p.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(p.name)&&this.raiseRecoverable(p.start,(A?"Binding ":"Assigning to ")+p.name+" in strict mode"),A&&(S===$e&&p.name==="let"&&this.raiseRecoverable(p.start,"let is disallowed as a lexically bound name"),w&&(W(w,p.name)&&this.raiseRecoverable(p.start,"Argument name clash"),w[p.name]=!0),S!==me&&this.declareName(p.name,S,p.start));break;case"ChainExpression":this.raiseRecoverable(p.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":A&&this.raiseRecoverable(p.start,"Binding member expression");break;case"ParenthesizedExpression":return A&&this.raiseRecoverable(p.start,"Binding parenthesized expression"),this.checkLValSimple(p.expression,S,w);default:this.raise(p.start,(A?"Binding":"Assigning to")+" rvalue")}},sn.checkLValPattern=function(p,S,w){switch(S===void 0&&(S=Mr),p.type){case"ObjectPattern":for(var A=0,z=p.properties;A<z.length;A+=1){var X=z[A];this.checkLValInnerPattern(X,S,w)}break;case"ArrayPattern":for(var Z=0,ge=p.elements;Z<ge.length;Z+=1){var xe=ge[Z];xe&&this.checkLValInnerPattern(xe,S,w)}break;default:this.checkLValSimple(p,S,w)}},sn.checkLValInnerPattern=function(p,S,w){switch(S===void 0&&(S=Mr),p.type){case"Property":this.checkLValInnerPattern(p.value,S,w);break;case"AssignmentPattern":this.checkLValPattern(p.left,S,w);break;case"RestElement":this.checkLValPattern(p.argument,S,w);break;default:this.checkLValPattern(p,S,w)}};var Jt=function(S,w,A,z,X){this.token=S,this.isExpr=!!w,this.preserveSpace=!!A,this.override=z,this.generator=!!X},gt={b_stat:new Jt("{",!1),b_expr:new Jt("{",!0),b_tmpl:new Jt("${",!1),p_stat:new Jt("(",!1),p_expr:new Jt("(",!0),q_tmpl:new Jt("`",!0,!0,function(p){return p.tryReadTemplateToken()}),f_stat:new Jt("function",!1),f_expr:new Jt("function",!0),f_expr_gen:new Jt("function",!0,!1,null,!0),f_gen:new Jt("function",!1,!1,null,!0)},Di=I.prototype;Di.initialContext=function(){return[gt.b_stat]},Di.curContext=function(){return this.context[this.context.length-1]},Di.braceIsBlock=function(p){var S=this.curContext();return S===gt.f_expr||S===gt.f_stat?!0:p===C.colon&&(S===gt.b_stat||S===gt.b_expr)?!S.isExpr:p===C._return||p===C.name&&this.exprAllowed?L.test(this.input.slice(this.lastTokEnd,this.start)):p===C._else||p===C.semi||p===C.eof||p===C.parenR||p===C.arrow?!0:p===C.braceL?S===gt.b_stat:p===C._var||p===C._const||p===C.name?!1:!this.exprAllowed},Di.inGeneratorContext=function(){for(var p=this.context.length-1;p>=1;p--){var S=this.context[p];if(S.token==="function")return S.generator}return!1},Di.updateContext=function(p){var S,w=this.type;w.keyword&&p===C.dot?this.exprAllowed=!1:(S=w.updateContext)?S.call(this,p):this.exprAllowed=w.beforeExpr},Di.overrideContext=function(p){this.curContext()!==p&&(this.context[this.context.length-1]=p)},C.parenR.updateContext=C.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var p=this.context.pop();p===gt.b_stat&&this.curContext().token==="function"&&(p=this.context.pop()),this.exprAllowed=!p.isExpr},C.braceL.updateContext=function(p){this.context.push(this.braceIsBlock(p)?gt.b_stat:gt.b_expr),this.exprAllowed=!0},C.dollarBraceL.updateContext=function(){this.context.push(gt.b_tmpl),this.exprAllowed=!0},C.parenL.updateContext=function(p){var S=p===C._if||p===C._for||p===C._with||p===C._while;this.context.push(S?gt.p_stat:gt.p_expr),this.exprAllowed=!0},C.incDec.updateContext=function(){},C._function.updateContext=C._class.updateContext=function(p){p.beforeExpr&&p!==C._else&&!(p===C.semi&&this.curContext()!==gt.p_stat)&&!(p===C._return&&L.test(this.input.slice(this.lastTokEnd,this.start)))&&!((p===C.colon||p===C.braceL)&&this.curContext()===gt.b_stat)?this.context.push(gt.f_expr):this.context.push(gt.f_stat),this.exprAllowed=!1},C.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},C.backQuote.updateContext=function(){this.curContext()===gt.q_tmpl?this.context.pop():this.context.push(gt.q_tmpl),this.exprAllowed=!1},C.star.updateContext=function(p){if(p===C._function){var S=this.context.length-1;this.context[S]===gt.f_expr?this.context[S]=gt.f_expr_gen:this.context[S]=gt.f_gen}this.exprAllowed=!0},C.name.updateContext=function(p){var S=!1;this.options.ecmaVersion>=6&&p!==C.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(S=!0),this.exprAllowed=S};var je=I.prototype;je.checkPropClash=function(p,S,w){if(!(this.options.ecmaVersion>=9&&p.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(p.computed||p.method||p.shorthand))){var A=p.key,z;switch(A.type){case"Identifier":z=A.name;break;case"Literal":z=String(A.value);break;default:return}var X=p.kind;if(this.options.ecmaVersion>=6){z==="__proto__"&&X==="init"&&(S.proto&&(w?w.doubleProto<0&&(w.doubleProto=A.start):this.raiseRecoverable(A.start,"Redefinition of __proto__ property")),S.proto=!0);return}z="$"+z;var Z=S[z];if(Z){var ge;X==="init"?ge=this.strict&&Z.init||Z.get||Z.set:ge=Z.init||Z[X],ge&&this.raiseRecoverable(A.start,"Redefinition of property")}else Z=S[z]={init:!1,get:!1,set:!1};Z[X]=!0}},je.parseExpression=function(p,S){var w=this.start,A=this.startLoc,z=this.parseMaybeAssign(p,S);if(this.type===C.comma){var X=this.startNodeAt(w,A);for(X.expressions=[z];this.eat(C.comma);)X.expressions.push(this.parseMaybeAssign(p,S));return this.finishNode(X,"SequenceExpression")}return z},je.parseMaybeAssign=function(p,S,w){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(p);this.exprAllowed=!1}var A=!1,z=-1,X=-1,Z=-1;S?(z=S.parenthesizedAssign,X=S.trailingComma,Z=S.doubleProto,S.parenthesizedAssign=S.trailingComma=-1):(S=new Wn,A=!0);var ge=this.start,xe=this.startLoc;(this.type===C.parenL||this.type===C.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=p==="await");var Le=this.parseMaybeConditional(p,S);if(w&&(Le=w.call(this,Le,ge,xe)),this.type.isAssign){var qe=this.startNodeAt(ge,xe);return qe.operator=this.value,this.type===C.eq&&(Le=this.toAssignable(Le,!1,S)),A||(S.parenthesizedAssign=S.trailingComma=S.doubleProto=-1),S.shorthandAssign>=Le.start&&(S.shorthandAssign=-1),this.type===C.eq?this.checkLValPattern(Le):this.checkLValSimple(Le),qe.left=Le,this.next(),qe.right=this.parseMaybeAssign(p),Z>-1&&(S.doubleProto=Z),this.finishNode(qe,"AssignmentExpression")}else A&&this.checkExpressionErrors(S,!0);return z>-1&&(S.parenthesizedAssign=z),X>-1&&(S.trailingComma=X),Le},je.parseMaybeConditional=function(p,S){var w=this.start,A=this.startLoc,z=this.parseExprOps(p,S);if(this.checkExpressionErrors(S))return z;if(this.eat(C.question)){var X=this.startNodeAt(w,A);return X.test=z,X.consequent=this.parseMaybeAssign(),this.expect(C.colon),X.alternate=this.parseMaybeAssign(p),this.finishNode(X,"ConditionalExpression")}return z},je.parseExprOps=function(p,S){var w=this.start,A=this.startLoc,z=this.parseMaybeUnary(S,!1,!1,p);return this.checkExpressionErrors(S)||z.start===w&&z.type==="ArrowFunctionExpression"?z:this.parseExprOp(z,w,A,-1,p)},je.parseExprOp=function(p,S,w,A,z){var X=this.type.binop;if(X!=null&&(!z||this.type!==C._in)&&X>A){var Z=this.type===C.logicalOR||this.type===C.logicalAND,ge=this.type===C.coalesce;ge&&(X=C.logicalAND.binop);var xe=this.value;this.next();var Le=this.start,qe=this.startLoc,yt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,z),Le,qe,X,z),Ft=this.buildBinary(S,w,p,yt,xe,Z||ge);return(Z&&this.type===C.coalesce||ge&&(this.type===C.logicalOR||this.type===C.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(Ft,S,w,A,z)}return p},je.buildBinary=function(p,S,w,A,z,X){A.type==="PrivateIdentifier"&&this.raise(A.start,"Private identifier can only be left side of binary expression");var Z=this.startNodeAt(p,S);return Z.left=w,Z.operator=z,Z.right=A,this.finishNode(Z,X?"LogicalExpression":"BinaryExpression")},je.parseMaybeUnary=function(p,S,w,A){var z=this.start,X=this.startLoc,Z;if(this.isContextual("await")&&this.canAwait)Z=this.parseAwait(A),S=!0;else if(this.type.prefix){var ge=this.startNode(),xe=this.type===C.incDec;ge.operator=this.value,ge.prefix=!0,this.next(),ge.argument=this.parseMaybeUnary(null,!0,xe,A),this.checkExpressionErrors(p,!0),xe?this.checkLValSimple(ge.argument):this.strict&&ge.operator==="delete"&&Xu(ge.argument)?this.raiseRecoverable(ge.start,"Deleting local variable in strict mode"):ge.operator==="delete"&&to(ge.argument)?this.raiseRecoverable(ge.start,"Private fields can not be deleted"):S=!0,Z=this.finishNode(ge,xe?"UpdateExpression":"UnaryExpression")}else if(!S&&this.type===C.privateId)(A||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),Z=this.parsePrivateIdent(),this.type!==C._in&&this.unexpected();else{if(Z=this.parseExprSubscripts(p,A),this.checkExpressionErrors(p))return Z;for(;this.type.postfix&&!this.canInsertSemicolon();){var Le=this.startNodeAt(z,X);Le.operator=this.value,Le.prefix=!1,Le.argument=Z,this.checkLValSimple(Z),this.next(),Z=this.finishNode(Le,"UpdateExpression")}}if(!w&&this.eat(C.starstar))if(S)this.unexpected(this.lastTokStart);else return this.buildBinary(z,X,Z,this.parseMaybeUnary(null,!1,!1,A),"**",!1);else return Z};function Xu(p){return p.type==="Identifier"||p.type==="ParenthesizedExpression"&&Xu(p.expression)}function to(p){return p.type==="MemberExpression"&&p.property.type==="PrivateIdentifier"||p.type==="ChainExpression"&&to(p.expression)||p.type==="ParenthesizedExpression"&&to(p.expression)}je.parseExprSubscripts=function(p,S){var w=this.start,A=this.startLoc,z=this.parseExprAtom(p,S);if(z.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return z;var X=this.parseSubscripts(z,w,A,!1,S);return p&&X.type==="MemberExpression"&&(p.parenthesizedAssign>=X.start&&(p.parenthesizedAssign=-1),p.parenthesizedBind>=X.start&&(p.parenthesizedBind=-1),p.trailingComma>=X.start&&(p.trailingComma=-1)),X},je.parseSubscripts=function(p,S,w,A,z){for(var X=this.options.ecmaVersion>=8&&p.type==="Identifier"&&p.name==="async"&&this.lastTokEnd===p.end&&!this.canInsertSemicolon()&&p.end-p.start===5&&this.potentialArrowAt===p.start,Z=!1;;){var ge=this.parseSubscript(p,S,w,A,X,Z,z);if(ge.optional&&(Z=!0),ge===p||ge.type==="ArrowFunctionExpression"){if(Z){var xe=this.startNodeAt(S,w);xe.expression=ge,ge=this.finishNode(xe,"ChainExpression")}return ge}p=ge}},je.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(C.arrow)},je.parseSubscriptAsyncArrow=function(p,S,w,A){return this.parseArrowExpression(this.startNodeAt(p,S),w,!0,A)},je.parseSubscript=function(p,S,w,A,z,X,Z){var ge=this.options.ecmaVersion>=11,xe=ge&&this.eat(C.questionDot);A&&xe&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Le=this.eat(C.bracketL);if(Le||xe&&this.type!==C.parenL&&this.type!==C.backQuote||this.eat(C.dot)){var qe=this.startNodeAt(S,w);qe.object=p,Le?(qe.property=this.parseExpression(),this.expect(C.bracketR)):this.type===C.privateId&&p.type!=="Super"?qe.property=this.parsePrivateIdent():qe.property=this.parseIdent(this.options.allowReserved!=="never"),qe.computed=!!Le,ge&&(qe.optional=xe),p=this.finishNode(qe,"MemberExpression")}else if(!A&&this.eat(C.parenL)){var yt=new Wn,Ft=this.yieldPos,Xs=this.awaitPos,Pt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var _i=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1,yt);if(z&&!xe&&this.shouldParseAsyncArrow())return this.checkPatternErrors(yt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=Ft,this.awaitPos=Xs,this.awaitIdentPos=Pt,this.parseSubscriptAsyncArrow(S,w,_i,Z);this.checkExpressionErrors(yt,!0),this.yieldPos=Ft||this.yieldPos,this.awaitPos=Xs||this.awaitPos,this.awaitIdentPos=Pt||this.awaitIdentPos;var gr=this.startNodeAt(S,w);gr.callee=p,gr.arguments=_i,ge&&(gr.optional=xe),p=this.finishNode(gr,"CallExpression")}else if(this.type===C.backQuote){(xe||X)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var zi=this.startNodeAt(S,w);zi.tag=p,zi.quasi=this.parseTemplate({isTagged:!0}),p=this.finishNode(zi,"TaggedTemplateExpression")}return p},je.parseExprAtom=function(p,S,w){this.type===C.slash&&this.readRegexp();var A,z=this.potentialArrowAt===this.start;switch(this.type){case C._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),A=this.startNode(),this.next(),this.type===C.parenL&&!this.allowDirectSuper&&this.raise(A.start,"super() call outside constructor of a subclass"),this.type!==C.dot&&this.type!==C.bracketL&&this.type!==C.parenL&&this.unexpected(),this.finishNode(A,"Super");case C._this:return A=this.startNode(),this.next(),this.finishNode(A,"ThisExpression");case C.name:var X=this.start,Z=this.startLoc,ge=this.containsEsc,xe=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!ge&&xe.name==="async"&&!this.canInsertSemicolon()&&this.eat(C._function))return this.overrideContext(gt.f_expr),this.parseFunction(this.startNodeAt(X,Z),0,!1,!0,S);if(z&&!this.canInsertSemicolon()){if(this.eat(C.arrow))return this.parseArrowExpression(this.startNodeAt(X,Z),[xe],!1,S);if(this.options.ecmaVersion>=8&&xe.name==="async"&&this.type===C.name&&!ge&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return xe=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(C.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(X,Z),[xe],!0,S)}return xe;case C.regexp:var Le=this.value;return A=this.parseLiteral(Le.value),A.regex={pattern:Le.pattern,flags:Le.flags},A;case C.num:case C.string:return this.parseLiteral(this.value);case C._null:case C._true:case C._false:return A=this.startNode(),A.value=this.type===C._null?null:this.type===C._true,A.raw=this.type.keyword,this.next(),this.finishNode(A,"Literal");case C.parenL:var qe=this.start,yt=this.parseParenAndDistinguishExpression(z,S);return p&&(p.parenthesizedAssign<0&&!this.isSimpleAssignTarget(yt)&&(p.parenthesizedAssign=qe),p.parenthesizedBind<0&&(p.parenthesizedBind=qe)),yt;case C.bracketL:return A=this.startNode(),this.next(),A.elements=this.parseExprList(C.bracketR,!0,!0,p),this.finishNode(A,"ArrayExpression");case C.braceL:return this.overrideContext(gt.b_expr),this.parseObj(!1,p);case C._function:return A=this.startNode(),this.next(),this.parseFunction(A,0);case C._class:return this.parseClass(this.startNode(),!1);case C._new:return this.parseNew();case C.backQuote:return this.parseTemplate();case C._import:return this.options.ecmaVersion>=11?this.parseExprImport(w):this.unexpected();default:return this.parseExprAtomDefault()}},je.parseExprAtomDefault=function(){this.unexpected()},je.parseExprImport=function(p){var S=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===C.parenL&&!p)return this.parseDynamicImport(S);if(this.type===C.dot){var w=this.startNodeAt(S.start,S.loc&&S.loc.start);return w.name="import",S.meta=this.finishNode(w,"Identifier"),this.parseImportMeta(S)}else this.unexpected()},je.parseDynamicImport=function(p){if(this.next(),p.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(C.parenR)?p.options=null:(this.expect(C.comma),this.afterTrailingComma(C.parenR)?p.options=null:(p.options=this.parseMaybeAssign(),this.eat(C.parenR)||(this.expect(C.comma),this.afterTrailingComma(C.parenR)||this.unexpected())));else if(!this.eat(C.parenR)){var S=this.start;this.eat(C.comma)&&this.eat(C.parenR)?this.raiseRecoverable(S,"Trailing comma is not allowed in import()"):this.unexpected(S)}return this.finishNode(p,"ImportExpression")},je.parseImportMeta=function(p){this.next();var S=this.containsEsc;return p.property=this.parseIdent(!0),p.property.name!=="meta"&&this.raiseRecoverable(p.property.start,"The only valid meta property for import is 'import.meta'"),S&&this.raiseRecoverable(p.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(p.start,"Cannot use 'import.meta' outside a module"),this.finishNode(p,"MetaProperty")},je.parseLiteral=function(p){var S=this.startNode();return S.value=p,S.raw=this.input.slice(this.start,this.end),S.raw.charCodeAt(S.raw.length-1)===110&&(S.bigint=S.value!=null?S.value.toString():S.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(S,"Literal")},je.parseParenExpression=function(){this.expect(C.parenL);var p=this.parseExpression();return this.expect(C.parenR),p},je.shouldParseArrow=function(p){return!this.canInsertSemicolon()},je.parseParenAndDistinguishExpression=function(p,S){var w=this.start,A=this.startLoc,z,X=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Z=this.start,ge=this.startLoc,xe=[],Le=!0,qe=!1,yt=new Wn,Ft=this.yieldPos,Xs=this.awaitPos,Pt;for(this.yieldPos=0,this.awaitPos=0;this.type!==C.parenR;)if(Le?Le=!1:this.expect(C.comma),X&&this.afterTrailingComma(C.parenR,!0)){qe=!0;break}else if(this.type===C.ellipsis){Pt=this.start,xe.push(this.parseParenItem(this.parseRestBinding())),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else xe.push(this.parseMaybeAssign(!1,yt,this.parseParenItem));var _i=this.lastTokEnd,gr=this.lastTokEndLoc;if(this.expect(C.parenR),p&&this.shouldParseArrow(xe)&&this.eat(C.arrow))return this.checkPatternErrors(yt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Ft,this.awaitPos=Xs,this.parseParenArrowList(w,A,xe,S);(!xe.length||qe)&&this.unexpected(this.lastTokStart),Pt&&this.unexpected(Pt),this.checkExpressionErrors(yt,!0),this.yieldPos=Ft||this.yieldPos,this.awaitPos=Xs||this.awaitPos,xe.length>1?(z=this.startNodeAt(Z,ge),z.expressions=xe,this.finishNodeAt(z,"SequenceExpression",_i,gr)):z=xe[0]}else z=this.parseParenExpression();if(this.options.preserveParens){var zi=this.startNodeAt(w,A);return zi.expression=z,this.finishNode(zi,"ParenthesizedExpression")}else return z},je.parseParenItem=function(p){return p},je.parseParenArrowList=function(p,S,w,A){return this.parseArrowExpression(this.startNodeAt(p,S),w,!1,A)};var no=[];je.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var p=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===C.dot){var S=this.startNodeAt(p.start,p.loc&&p.loc.start);S.name="new",p.meta=this.finishNode(S,"Identifier"),this.next();var w=this.containsEsc;return p.property=this.parseIdent(!0),p.property.name!=="target"&&this.raiseRecoverable(p.property.start,"The only valid meta property for new is 'new.target'"),w&&this.raiseRecoverable(p.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(p.start,"'new.target' can only be used in functions and class static block"),this.finishNode(p,"MetaProperty")}var A=this.start,z=this.startLoc;return p.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),A,z,!0,!1),this.eat(C.parenL)?p.arguments=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1):p.arguments=no,this.finishNode(p,"NewExpression")},je.parseTemplateElement=function(p){var S=p.isTagged,w=this.startNode();return this.type===C.invalidTemplate?(S||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),w.value={raw:this.value.replace(/\r\n?/g,`
77
- `),cooked:null}):w.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
78
- `),cooked:this.value},this.next(),w.tail=this.type===C.backQuote,this.finishNode(w,"TemplateElement")},je.parseTemplate=function(p){p===void 0&&(p={});var S=p.isTagged;S===void 0&&(S=!1);var w=this.startNode();this.next(),w.expressions=[];var A=this.parseTemplateElement({isTagged:S});for(w.quasis=[A];!A.tail;)this.type===C.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(C.dollarBraceL),w.expressions.push(this.parseExpression()),this.expect(C.braceR),w.quasis.push(A=this.parseTemplateElement({isTagged:S}));return this.next(),this.finishNode(w,"TemplateLiteral")},je.isAsyncProp=function(p){return!p.computed&&p.key.type==="Identifier"&&p.key.name==="async"&&(this.type===C.name||this.type===C.num||this.type===C.string||this.type===C.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===C.star)&&!L.test(this.input.slice(this.lastTokEnd,this.start))},je.parseObj=function(p,S){var w=this.startNode(),A=!0,z={};for(w.properties=[],this.next();!this.eat(C.braceR);){if(A)A=!1;else if(this.expect(C.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(C.braceR))break;var X=this.parseProperty(p,S);p||this.checkPropClash(X,z,S),w.properties.push(X)}return this.finishNode(w,p?"ObjectPattern":"ObjectExpression")},je.parseProperty=function(p,S){var w=this.startNode(),A,z,X,Z;if(this.options.ecmaVersion>=9&&this.eat(C.ellipsis))return p?(w.argument=this.parseIdent(!1),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(w,"RestElement")):(w.argument=this.parseMaybeAssign(!1,S),this.type===C.comma&&S&&S.trailingComma<0&&(S.trailingComma=this.start),this.finishNode(w,"SpreadElement"));this.options.ecmaVersion>=6&&(w.method=!1,w.shorthand=!1,(p||S)&&(X=this.start,Z=this.startLoc),p||(A=this.eat(C.star)));var ge=this.containsEsc;return this.parsePropertyName(w),!p&&!ge&&this.options.ecmaVersion>=8&&!A&&this.isAsyncProp(w)?(z=!0,A=this.options.ecmaVersion>=9&&this.eat(C.star),this.parsePropertyName(w)):z=!1,this.parsePropertyValue(w,p,A,z,X,Z,S,ge),this.finishNode(w,"Property")},je.parseGetterSetter=function(p){var S=p.key.name;this.parsePropertyName(p),p.value=this.parseMethod(!1),p.kind=S;var w=p.kind==="get"?0:1;if(p.value.params.length!==w){var A=p.value.start;p.kind==="get"?this.raiseRecoverable(A,"getter should have no params"):this.raiseRecoverable(A,"setter should have exactly one param")}else p.kind==="set"&&p.value.params[0].type==="RestElement"&&this.raiseRecoverable(p.value.params[0].start,"Setter cannot use rest params")},je.parsePropertyValue=function(p,S,w,A,z,X,Z,ge){(w||A)&&this.type===C.colon&&this.unexpected(),this.eat(C.colon)?(p.value=S?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Z),p.kind="init"):this.options.ecmaVersion>=6&&this.type===C.parenL?(S&&this.unexpected(),p.method=!0,p.value=this.parseMethod(w,A),p.kind="init"):!S&&!ge&&this.options.ecmaVersion>=5&&!p.computed&&p.key.type==="Identifier"&&(p.key.name==="get"||p.key.name==="set")&&this.type!==C.comma&&this.type!==C.braceR&&this.type!==C.eq?((w||A)&&this.unexpected(),this.parseGetterSetter(p)):this.options.ecmaVersion>=6&&!p.computed&&p.key.type==="Identifier"?((w||A)&&this.unexpected(),this.checkUnreserved(p.key),p.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=z),S?p.value=this.parseMaybeDefault(z,X,this.copyNode(p.key)):this.type===C.eq&&Z?(Z.shorthandAssign<0&&(Z.shorthandAssign=this.start),p.value=this.parseMaybeDefault(z,X,this.copyNode(p.key))):p.value=this.copyNode(p.key),p.kind="init",p.shorthand=!0):this.unexpected()},je.parsePropertyName=function(p){if(this.options.ecmaVersion>=6){if(this.eat(C.bracketL))return p.computed=!0,p.key=this.parseMaybeAssign(),this.expect(C.bracketR),p.key;p.computed=!1}return p.key=this.type===C.num||this.type===C.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},je.initFunction=function(p){p.id=null,this.options.ecmaVersion>=6&&(p.generator=p.expression=!1),this.options.ecmaVersion>=8&&(p.async=!1)},je.parseMethod=function(p,S,w){var A=this.startNode(),z=this.yieldPos,X=this.awaitPos,Z=this.awaitIdentPos;return this.initFunction(A),this.options.ecmaVersion>=6&&(A.generator=p),this.options.ecmaVersion>=8&&(A.async=!!S),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Oi(S,A.generator)|pi|(w?Mi:0)),this.expect(C.parenL),A.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(A,!1,!0,!1),this.yieldPos=z,this.awaitPos=X,this.awaitIdentPos=Z,this.finishNode(A,"FunctionExpression")},je.parseArrowExpression=function(p,S,w,A){var z=this.yieldPos,X=this.awaitPos,Z=this.awaitIdentPos;return this.enterScope(Oi(w,!1)|ur),this.initFunction(p),this.options.ecmaVersion>=8&&(p.async=!!w),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,p.params=this.toAssignableList(S,!0),this.parseFunctionBody(p,!0,!1,A),this.yieldPos=z,this.awaitPos=X,this.awaitIdentPos=Z,this.finishNode(p,"ArrowFunctionExpression")},je.parseFunctionBody=function(p,S,w,A){var z=S&&this.type!==C.braceL,X=this.strict,Z=!1;if(z)p.body=this.parseMaybeAssign(A),p.expression=!0,this.checkParams(p,!1);else{var ge=this.options.ecmaVersion>=7&&!this.isSimpleParamList(p.params);(!X||ge)&&(Z=this.strictDirective(this.end),Z&&ge&&this.raiseRecoverable(p.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var xe=this.labels;this.labels=[],Z&&(this.strict=!0),this.checkParams(p,!X&&!Z&&!S&&!w&&this.isSimpleParamList(p.params)),this.strict&&p.id&&this.checkLValSimple(p.id,me),p.body=this.parseBlock(!1,void 0,Z&&!X),p.expression=!1,this.adaptDirectivePrologue(p.body.body),this.labels=xe}this.exitScope()},je.isSimpleParamList=function(p){for(var S=0,w=p;S<w.length;S+=1){var A=w[S];if(A.type!=="Identifier")return!1}return!0},je.checkParams=function(p,S){for(var w=Object.create(null),A=0,z=p.params;A<z.length;A+=1){var X=z[A];this.checkLValInnerPattern(X,Ri,S?null:w)}},je.parseExprList=function(p,S,w,A){for(var z=[],X=!0;!this.eat(p);){if(X)X=!1;else if(this.expect(C.comma),S&&this.afterTrailingComma(p))break;var Z=void 0;w&&this.type===C.comma?Z=null:this.type===C.ellipsis?(Z=this.parseSpread(A),A&&this.type===C.comma&&A.trailingComma<0&&(A.trailingComma=this.start)):Z=this.parseMaybeAssign(!1,A),z.push(Z)}return z},je.checkUnreserved=function(p){var S=p.start,w=p.end,A=p.name;if(this.inGenerator&&A==="yield"&&this.raiseRecoverable(S,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&A==="await"&&this.raiseRecoverable(S,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&On)&&A==="arguments"&&this.raiseRecoverable(S,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(A==="arguments"||A==="await")&&this.raise(S,"Cannot use "+A+" in class static initialization block"),this.keywords.test(A)&&this.raise(S,"Unexpected keyword '"+A+"'"),!(this.options.ecmaVersion<6&&this.input.slice(S,w).indexOf("\\")!==-1)){var z=this.strict?this.reservedWordsStrict:this.reservedWords;z.test(A)&&(!this.inAsync&&A==="await"&&this.raiseRecoverable(S,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(S,"The keyword '"+A+"' is reserved"))}},je.parseIdent=function(p){var S=this.parseIdentNode();return this.next(!!p),this.finishNode(S,"Identifier"),p||(this.checkUnreserved(S),S.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=S.start)),S},je.parseIdentNode=function(){var p=this.startNode();return this.type===C.name?p.name=this.value:this.type.keyword?(p.name=this.type.keyword,(p.name==="class"||p.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=C.name):this.unexpected(),p},je.parsePrivateIdent=function(){var p=this.startNode();return this.type===C.privateId?p.name=this.value:this.unexpected(),this.next(),this.finishNode(p,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(p.start,"Private field '#"+p.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(p)),p},je.parseYield=function(p){this.yieldPos||(this.yieldPos=this.start);var S=this.startNode();return this.next(),this.type===C.semi||this.canInsertSemicolon()||this.type!==C.star&&!this.type.startsExpr?(S.delegate=!1,S.argument=null):(S.delegate=this.eat(C.star),S.argument=this.parseMaybeAssign(p)),this.finishNode(S,"YieldExpression")},je.parseAwait=function(p){this.awaitPos||(this.awaitPos=this.start);var S=this.startNode();return this.next(),S.argument=this.parseMaybeUnary(null,!0,!1,p),this.finishNode(S,"AwaitExpression")};var xl=I.prototype;xl.raise=function(p,S){var w=be(this.input,p);S+=" ("+w.line+":"+w.column+")",this.sourceFile&&(S+=" in "+this.sourceFile);var A=new SyntaxError(S);throw A.pos=p,A.loc=w,A.raisedAt=this.pos,A},xl.raiseRecoverable=xl.raise,xl.curPosition=function(){if(this.options.locations)return new ne(this.curLine,this.pos-this.lineStart)};var fr=I.prototype,hp=function(S){this.flags=S,this.var=[],this.lexical=[],this.functions=[]};fr.enterScope=function(p){this.scopeStack.push(new hp(p))},fr.exitScope=function(){this.scopeStack.pop()},fr.treatFunctionsAsVarInScope=function(p){return p.flags&zt||!this.inModule&&p.flags&Qe},fr.declareName=function(p,S,w){var A=!1;if(S===$e){var z=this.currentScope();A=z.lexical.indexOf(p)>-1||z.functions.indexOf(p)>-1||z.var.indexOf(p)>-1,z.lexical.push(p),this.inModule&&z.flags&Qe&&delete this.undefinedExports[p]}else if(S===ae){var X=this.currentScope();X.lexical.push(p)}else if(S===Xr){var Z=this.currentScope();this.treatFunctionsAsVar?A=Z.lexical.indexOf(p)>-1:A=Z.lexical.indexOf(p)>-1||Z.var.indexOf(p)>-1,Z.functions.push(p)}else for(var ge=this.scopeStack.length-1;ge>=0;--ge){var xe=this.scopeStack[ge];if(xe.lexical.indexOf(p)>-1&&!(xe.flags&Xn&&xe.lexical[0]===p)||!this.treatFunctionsAsVarInScope(xe)&&xe.functions.indexOf(p)>-1){A=!0;break}if(xe.var.push(p),this.inModule&&xe.flags&Qe&&delete this.undefinedExports[p],xe.flags&On)break}A&&this.raiseRecoverable(w,"Identifier '"+p+"' has already been declared")},fr.checkLocalExport=function(p){this.scopeStack[0].lexical.indexOf(p.name)===-1&&this.scopeStack[0].var.indexOf(p.name)===-1&&(this.undefinedExports[p.name]=p)},fr.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},fr.currentVarScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(On|di|Qn))return S}},fr.currentThisScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(On|di|Qn)&&!(S.flags&ur))return S}};var Us=function(S,w,A){this.type="",this.start=w,this.end=0,S.options.locations&&(this.loc=new B(S,A)),S.options.directSourceFile&&(this.sourceFile=S.options.directSourceFile),S.options.ranges&&(this.range=[w,0])},Wr=I.prototype;Wr.startNode=function(){return new Us(this,this.start,this.startLoc)},Wr.startNodeAt=function(p,S){return new Us(this,p,S)};function bl(p,S,w,A){return p.type=S,p.end=w,this.options.locations&&(p.loc.end=A),this.options.ranges&&(p.range[1]=w),p}Wr.finishNode=function(p,S){return bl.call(this,p,S,this.lastTokEnd,this.lastTokEndLoc)},Wr.finishNodeAt=function(p,S,w,A){return bl.call(this,p,S,w,A)},Wr.copyNode=function(p){var S=new Us(this,p.start,this.startLoc);for(var w in p)S[w]=p[w];return S};var pp="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",Qu="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",hr=Qu+" Extended_Pictographic",Ht=hr,an=Ht+" EBase EComp EMod EPres ExtPict",Zr=an,Wu=Zr,Hg={9:Qu,10:hr,11:Ht,12:an,13:Zr,14:Wu},qg="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",dp={9:"",10:"",11:"",12:"",13:"",14:qg},Js="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Sl="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",es=Sl+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ts=es+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Hs=ts+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ns=Hs+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",qt=ns+" "+pp,mp={9:Sl,10:es,11:ts,12:Hs,13:ns,14:qt},Zu={};function is(p){var S=Zu[p]={binary:ve(Hg[p]+" "+Js),binaryOfStrings:ve(dp[p]),nonBinary:{General_Category:ve(Js),Script:ve(mp[p])}};S.nonBinary.Script_Extensions=S.nonBinary.Script,S.nonBinary.gc=S.nonBinary.General_Category,S.nonBinary.sc=S.nonBinary.Script,S.nonBinary.scx=S.nonBinary.Script_Extensions}for(var Or=0,gp=[9,10,11,12,13,14];Or<gp.length;Or+=1){var yp=gp[Or];is(yp)}var Ce=I.prototype,kl=function(S,w){this.parent=S,this.base=w||this};kl.prototype.separatedFrom=function(S){for(var w=this;w;w=w.parent)for(var A=S;A;A=A.parent)if(w.base===A.base&&w!==A)return!0;return!1},kl.prototype.sibling=function(){return new kl(this.parent,this.base)};var Dn=function(S){this.parser=S,this.validFlags="gim"+(S.options.ecmaVersion>=6?"uy":"")+(S.options.ecmaVersion>=9?"s":"")+(S.options.ecmaVersion>=13?"d":"")+(S.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Zu[S.options.ecmaVersion>=14?14:S.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Dn.prototype.reset=function(S,w,A){var z=A.indexOf("v")!==-1,X=A.indexOf("u")!==-1;this.start=S|0,this.source=w+"",this.flags=A,z&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=X&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=X&&this.parser.options.ecmaVersion>=9)},Dn.prototype.raise=function(S){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+S)},Dn.prototype.at=function(S,w){w===void 0&&(w=!1);var A=this.source,z=A.length;if(S>=z)return-1;var X=A.charCodeAt(S);if(!(w||this.switchU)||X<=55295||X>=57344||S+1>=z)return X;var Z=A.charCodeAt(S+1);return Z>=56320&&Z<=57343?(X<<10)+Z-56613888:X},Dn.prototype.nextIndex=function(S,w){w===void 0&&(w=!1);var A=this.source,z=A.length;if(S>=z)return z;var X=A.charCodeAt(S),Z;return!(w||this.switchU)||X<=55295||X>=57344||S+1>=z||(Z=A.charCodeAt(S+1))<56320||Z>57343?S+1:S+2},Dn.prototype.current=function(S){return S===void 0&&(S=!1),this.at(this.pos,S)},Dn.prototype.lookahead=function(S){return S===void 0&&(S=!1),this.at(this.nextIndex(this.pos,S),S)},Dn.prototype.advance=function(S){S===void 0&&(S=!1),this.pos=this.nextIndex(this.pos,S)},Dn.prototype.eat=function(S,w){return w===void 0&&(w=!1),this.current(w)===S?(this.advance(w),!0):!1},Dn.prototype.eatChars=function(S,w){w===void 0&&(w=!1);for(var A=this.pos,z=0,X=S;z<X.length;z+=1){var Z=X[z],ge=this.at(A,w);if(ge===-1||ge!==Z)return!1;A=this.nextIndex(A,w)}return this.pos=A,!0},Ce.validateRegExpFlags=function(p){for(var S=p.validFlags,w=p.flags,A=!1,z=!1,X=0;X<w.length;X++){var Z=w.charAt(X);S.indexOf(Z)===-1&&this.raise(p.start,"Invalid regular expression flag"),w.indexOf(Z,X+1)>-1&&this.raise(p.start,"Duplicate regular expression flag"),Z==="u"&&(A=!0),Z==="v"&&(z=!0)}this.options.ecmaVersion>=15&&A&&z&&this.raise(p.start,"Invalid regular expression flag")};function vl(p){for(var S in p)return!0;return!1}Ce.validateRegExpPattern=function(p){this.regexp_pattern(p),!p.switchN&&this.options.ecmaVersion>=9&&vl(p.groupNames)&&(p.switchN=!0,this.regexp_pattern(p))},Ce.regexp_pattern=function(p){p.pos=0,p.lastIntValue=0,p.lastStringValue="",p.lastAssertionIsQuantifiable=!1,p.numCapturingParens=0,p.maxBackReference=0,p.groupNames=Object.create(null),p.backReferenceNames.length=0,p.branchID=null,this.regexp_disjunction(p),p.pos!==p.source.length&&(p.eat(41)&&p.raise("Unmatched ')'"),(p.eat(93)||p.eat(125))&&p.raise("Lone quantifier brackets")),p.maxBackReference>p.numCapturingParens&&p.raise("Invalid escape");for(var S=0,w=p.backReferenceNames;S<w.length;S+=1){var A=w[S];p.groupNames[A]||p.raise("Invalid named capture referenced")}},Ce.regexp_disjunction=function(p){var S=this.options.ecmaVersion>=16;for(S&&(p.branchID=new kl(p.branchID,null)),this.regexp_alternative(p);p.eat(124);)S&&(p.branchID=p.branchID.sibling()),this.regexp_alternative(p);S&&(p.branchID=p.branchID.parent),this.regexp_eatQuantifier(p,!0)&&p.raise("Nothing to repeat"),p.eat(123)&&p.raise("Lone quantifier brackets")},Ce.regexp_alternative=function(p){for(;p.pos<p.source.length&&this.regexp_eatTerm(p););},Ce.regexp_eatTerm=function(p){return this.regexp_eatAssertion(p)?(p.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(p)&&p.switchU&&p.raise("Invalid quantifier"),!0):(p.switchU?this.regexp_eatAtom(p):this.regexp_eatExtendedAtom(p))?(this.regexp_eatQuantifier(p),!0):!1},Ce.regexp_eatAssertion=function(p){var S=p.pos;if(p.lastAssertionIsQuantifiable=!1,p.eat(94)||p.eat(36))return!0;if(p.eat(92)){if(p.eat(66)||p.eat(98))return!0;p.pos=S}if(p.eat(40)&&p.eat(63)){var w=!1;if(this.options.ecmaVersion>=9&&(w=p.eat(60)),p.eat(61)||p.eat(33))return this.regexp_disjunction(p),p.eat(41)||p.raise("Unterminated group"),p.lastAssertionIsQuantifiable=!w,!0}return p.pos=S,!1},Ce.regexp_eatQuantifier=function(p,S){return S===void 0&&(S=!1),this.regexp_eatQuantifierPrefix(p,S)?(p.eat(63),!0):!1},Ce.regexp_eatQuantifierPrefix=function(p,S){return p.eat(42)||p.eat(43)||p.eat(63)||this.regexp_eatBracedQuantifier(p,S)},Ce.regexp_eatBracedQuantifier=function(p,S){var w=p.pos;if(p.eat(123)){var A=0,z=-1;if(this.regexp_eatDecimalDigits(p)&&(A=p.lastIntValue,p.eat(44)&&this.regexp_eatDecimalDigits(p)&&(z=p.lastIntValue),p.eat(125)))return z!==-1&&z<A&&!S&&p.raise("numbers out of order in {} quantifier"),!0;p.switchU&&!S&&p.raise("Incomplete quantifier"),p.pos=w}return!1},Ce.regexp_eatAtom=function(p){return this.regexp_eatPatternCharacters(p)||p.eat(46)||this.regexp_eatReverseSolidusAtomEscape(p)||this.regexp_eatCharacterClass(p)||this.regexp_eatUncapturingGroup(p)||this.regexp_eatCapturingGroup(p)},Ce.regexp_eatReverseSolidusAtomEscape=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatAtomEscape(p))return!0;p.pos=S}return!1},Ce.regexp_eatUncapturingGroup=function(p){var S=p.pos;if(p.eat(40)){if(p.eat(63)){if(this.options.ecmaVersion>=16){var w=this.regexp_eatModifiers(p),A=p.eat(45);if(w||A){for(var z=0;z<w.length;z++){var X=w.charAt(z);w.indexOf(X,z+1)>-1&&p.raise("Duplicate regular expression modifiers")}if(A){var Z=this.regexp_eatModifiers(p);!w&&!Z&&p.current()===58&&p.raise("Invalid regular expression modifiers");for(var ge=0;ge<Z.length;ge++){var xe=Z.charAt(ge);(Z.indexOf(xe,ge+1)>-1||w.indexOf(xe)>-1)&&p.raise("Duplicate regular expression modifiers")}}}}if(p.eat(58)){if(this.regexp_disjunction(p),p.eat(41))return!0;p.raise("Unterminated group")}}p.pos=S}return!1},Ce.regexp_eatCapturingGroup=function(p){if(p.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(p):p.current()===63&&p.raise("Invalid group"),this.regexp_disjunction(p),p.eat(41))return p.numCapturingParens+=1,!0;p.raise("Unterminated group")}return!1},Ce.regexp_eatModifiers=function(p){for(var S="",w=0;(w=p.current())!==-1&&pr(w);)S+=D(w),p.advance();return S};function pr(p){return p===105||p===109||p===115}Ce.regexp_eatExtendedAtom=function(p){return p.eat(46)||this.regexp_eatReverseSolidusAtomEscape(p)||this.regexp_eatCharacterClass(p)||this.regexp_eatUncapturingGroup(p)||this.regexp_eatCapturingGroup(p)||this.regexp_eatInvalidBracedQuantifier(p)||this.regexp_eatExtendedPatternCharacter(p)},Ce.regexp_eatInvalidBracedQuantifier=function(p){return this.regexp_eatBracedQuantifier(p,!0)&&p.raise("Nothing to repeat"),!1},Ce.regexp_eatSyntaxCharacter=function(p){var S=p.current();return In(S)?(p.lastIntValue=S,p.advance(),!0):!1};function In(p){return p===36||p>=40&&p<=43||p===46||p===63||p>=91&&p<=94||p>=123&&p<=125}Ce.regexp_eatPatternCharacters=function(p){for(var S=p.pos,w=0;(w=p.current())!==-1&&!In(w);)p.advance();return p.pos!==S},Ce.regexp_eatExtendedPatternCharacter=function(p){var S=p.current();return S!==-1&&S!==36&&!(S>=40&&S<=43)&&S!==46&&S!==63&&S!==91&&S!==94&&S!==124?(p.advance(),!0):!1},Ce.regexp_groupSpecifier=function(p){if(p.eat(63)){this.regexp_eatGroupName(p)||p.raise("Invalid group");var S=this.options.ecmaVersion>=16,w=p.groupNames[p.lastStringValue];if(w)if(S)for(var A=0,z=w;A<z.length;A+=1){var X=z[A];X.separatedFrom(p.branchID)||p.raise("Duplicate capture group name")}else p.raise("Duplicate capture group name");S?(w||(p.groupNames[p.lastStringValue]=[])).push(p.branchID):p.groupNames[p.lastStringValue]=!0}},Ce.regexp_eatGroupName=function(p){if(p.lastStringValue="",p.eat(60)){if(this.regexp_eatRegExpIdentifierName(p)&&p.eat(62))return!0;p.raise("Invalid capture group name")}return!1},Ce.regexp_eatRegExpIdentifierName=function(p){if(p.lastStringValue="",this.regexp_eatRegExpIdentifierStart(p)){for(p.lastStringValue+=D(p.lastIntValue);this.regexp_eatRegExpIdentifierPart(p);)p.lastStringValue+=D(p.lastIntValue);return!0}return!1},Ce.regexp_eatRegExpIdentifierStart=function(p){var S=p.pos,w=this.options.ecmaVersion>=11,A=p.current(w);return p.advance(w),A===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,w)&&(A=p.lastIntValue),xp(A)?(p.lastIntValue=A,!0):(p.pos=S,!1)};function xp(p){return v(p,!0)||p===36||p===95}Ce.regexp_eatRegExpIdentifierPart=function(p){var S=p.pos,w=this.options.ecmaVersion>=11,A=p.current(w);return p.advance(w),A===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,w)&&(A=p.lastIntValue),Kg(A)?(p.lastIntValue=A,!0):(p.pos=S,!1)};function Kg(p){return E(p,!0)||p===36||p===95||p===8204||p===8205}Ce.regexp_eatAtomEscape=function(p){return this.regexp_eatBackReference(p)||this.regexp_eatCharacterClassEscape(p)||this.regexp_eatCharacterEscape(p)||p.switchN&&this.regexp_eatKGroupName(p)?!0:(p.switchU&&(p.current()===99&&p.raise("Invalid unicode escape"),p.raise("Invalid escape")),!1)},Ce.regexp_eatBackReference=function(p){var S=p.pos;if(this.regexp_eatDecimalEscape(p)){var w=p.lastIntValue;if(p.switchU)return w>p.maxBackReference&&(p.maxBackReference=w),!0;if(w<=p.numCapturingParens)return!0;p.pos=S}return!1},Ce.regexp_eatKGroupName=function(p){if(p.eat(107)){if(this.regexp_eatGroupName(p))return p.backReferenceNames.push(p.lastStringValue),!0;p.raise("Invalid named reference")}return!1},Ce.regexp_eatCharacterEscape=function(p){return this.regexp_eatControlEscape(p)||this.regexp_eatCControlLetter(p)||this.regexp_eatZero(p)||this.regexp_eatHexEscapeSequence(p)||this.regexp_eatRegExpUnicodeEscapeSequence(p,!1)||!p.switchU&&this.regexp_eatLegacyOctalEscapeSequence(p)||this.regexp_eatIdentityEscape(p)},Ce.regexp_eatCControlLetter=function(p){var S=p.pos;if(p.eat(99)){if(this.regexp_eatControlLetter(p))return!0;p.pos=S}return!1},Ce.regexp_eatZero=function(p){return p.current()===48&&!mr(p.lookahead())?(p.lastIntValue=0,p.advance(),!0):!1},Ce.regexp_eatControlEscape=function(p){var S=p.current();return S===116?(p.lastIntValue=9,p.advance(),!0):S===110?(p.lastIntValue=10,p.advance(),!0):S===118?(p.lastIntValue=11,p.advance(),!0):S===102?(p.lastIntValue=12,p.advance(),!0):S===114?(p.lastIntValue=13,p.advance(),!0):!1},Ce.regexp_eatControlLetter=function(p){var S=p.current();return Cl(S)?(p.lastIntValue=S%32,p.advance(),!0):!1};function Cl(p){return p>=65&&p<=90||p>=97&&p<=122}Ce.regexp_eatRegExpUnicodeEscapeSequence=function(p,S){S===void 0&&(S=!1);var w=p.pos,A=S||p.switchU;if(p.eat(117)){if(this.regexp_eatFixedHexDigits(p,4)){var z=p.lastIntValue;if(A&&z>=55296&&z<=56319){var X=p.pos;if(p.eat(92)&&p.eat(117)&&this.regexp_eatFixedHexDigits(p,4)){var Z=p.lastIntValue;if(Z>=56320&&Z<=57343)return p.lastIntValue=(z-55296)*1024+(Z-56320)+65536,!0}p.pos=X,p.lastIntValue=z}return!0}if(A&&p.eat(123)&&this.regexp_eatHexDigits(p)&&p.eat(125)&&bp(p.lastIntValue))return!0;A&&p.raise("Invalid unicode escape"),p.pos=w}return!1};function bp(p){return p>=0&&p<=1114111}Ce.regexp_eatIdentityEscape=function(p){if(p.switchU)return this.regexp_eatSyntaxCharacter(p)?!0:p.eat(47)?(p.lastIntValue=47,!0):!1;var S=p.current();return S!==99&&(!p.switchN||S!==107)?(p.lastIntValue=S,p.advance(),!0):!1},Ce.regexp_eatDecimalEscape=function(p){p.lastIntValue=0;var S=p.current();if(S>=49&&S<=57){do p.lastIntValue=10*p.lastIntValue+(S-48),p.advance();while((S=p.current())>=48&&S<=57);return!0}return!1};var io=0,dr=1,Tt=2;Ce.regexp_eatCharacterClassEscape=function(p){var S=p.current();if(ec(S))return p.lastIntValue=-1,p.advance(),dr;var w=!1;if(p.switchU&&this.options.ecmaVersion>=9&&((w=S===80)||S===112)){p.lastIntValue=-1,p.advance();var A;if(p.eat(123)&&(A=this.regexp_eatUnicodePropertyValueExpression(p))&&p.eat(125))return w&&A===Tt&&p.raise("Invalid property name"),A;p.raise("Invalid property name")}return io};function ec(p){return p===100||p===68||p===115||p===83||p===119||p===87}Ce.regexp_eatUnicodePropertyValueExpression=function(p){var S=p.pos;if(this.regexp_eatUnicodePropertyName(p)&&p.eat(61)){var w=p.lastStringValue;if(this.regexp_eatUnicodePropertyValue(p)){var A=p.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(p,w,A),dr}}if(p.pos=S,this.regexp_eatLoneUnicodePropertyNameOrValue(p)){var z=p.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(p,z)}return io},Ce.regexp_validateUnicodePropertyNameAndValue=function(p,S,w){W(p.unicodeProperties.nonBinary,S)||p.raise("Invalid property name"),p.unicodeProperties.nonBinary[S].test(w)||p.raise("Invalid property value")},Ce.regexp_validateUnicodePropertyNameOrValue=function(p,S){if(p.unicodeProperties.binary.test(S))return dr;if(p.switchV&&p.unicodeProperties.binaryOfStrings.test(S))return Tt;p.raise("Invalid property name")},Ce.regexp_eatUnicodePropertyName=function(p){var S=0;for(p.lastStringValue="";tc(S=p.current());)p.lastStringValue+=D(S),p.advance();return p.lastStringValue!==""};function tc(p){return Cl(p)||p===95}Ce.regexp_eatUnicodePropertyValue=function(p){var S=0;for(p.lastStringValue="";nc(S=p.current());)p.lastStringValue+=D(S),p.advance();return p.lastStringValue!==""};function nc(p){return tc(p)||mr(p)}Ce.regexp_eatLoneUnicodePropertyNameOrValue=function(p){return this.regexp_eatUnicodePropertyValue(p)},Ce.regexp_eatCharacterClass=function(p){if(p.eat(91)){var S=p.eat(94),w=this.regexp_classContents(p);return p.eat(93)||p.raise("Unterminated character class"),S&&w===Tt&&p.raise("Negated character class may contain strings"),!0}return!1},Ce.regexp_classContents=function(p){return p.current()===93?dr:p.switchV?this.regexp_classSetExpression(p):(this.regexp_nonEmptyClassRanges(p),dr)},Ce.regexp_nonEmptyClassRanges=function(p){for(;this.regexp_eatClassAtom(p);){var S=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassAtom(p)){var w=p.lastIntValue;p.switchU&&(S===-1||w===-1)&&p.raise("Invalid character class"),S!==-1&&w!==-1&&S>w&&p.raise("Range out of order in character class")}}},Ce.regexp_eatClassAtom=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatClassEscape(p))return!0;if(p.switchU){var w=p.current();(w===99||rc(w))&&p.raise("Invalid class escape"),p.raise("Invalid escape")}p.pos=S}var A=p.current();return A!==93?(p.lastIntValue=A,p.advance(),!0):!1},Ce.regexp_eatClassEscape=function(p){var S=p.pos;if(p.eat(98))return p.lastIntValue=8,!0;if(p.switchU&&p.eat(45))return p.lastIntValue=45,!0;if(!p.switchU&&p.eat(99)){if(this.regexp_eatClassControlLetter(p))return!0;p.pos=S}return this.regexp_eatCharacterClassEscape(p)||this.regexp_eatCharacterEscape(p)},Ce.regexp_classSetExpression=function(p){var S=dr,w;if(!this.regexp_eatClassSetRange(p))if(w=this.regexp_eatClassSetOperand(p)){w===Tt&&(S=Tt);for(var A=p.pos;p.eatChars([38,38]);){if(p.current()!==38&&(w=this.regexp_eatClassSetOperand(p))){w!==Tt&&(S=dr);continue}p.raise("Invalid character in character class")}if(A!==p.pos)return S;for(;p.eatChars([45,45]);)this.regexp_eatClassSetOperand(p)||p.raise("Invalid character in character class");if(A!==p.pos)return S}else p.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(p)){if(w=this.regexp_eatClassSetOperand(p),!w)return S;w===Tt&&(S=Tt)}},Ce.regexp_eatClassSetRange=function(p){var S=p.pos;if(this.regexp_eatClassSetCharacter(p)){var w=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassSetCharacter(p)){var A=p.lastIntValue;return w!==-1&&A!==-1&&w>A&&p.raise("Range out of order in character class"),!0}p.pos=S}return!1},Ce.regexp_eatClassSetOperand=function(p){return this.regexp_eatClassSetCharacter(p)?dr:this.regexp_eatClassStringDisjunction(p)||this.regexp_eatNestedClass(p)},Ce.regexp_eatNestedClass=function(p){var S=p.pos;if(p.eat(91)){var w=p.eat(94),A=this.regexp_classContents(p);if(p.eat(93))return w&&A===Tt&&p.raise("Negated character class may contain strings"),A;p.pos=S}if(p.eat(92)){var z=this.regexp_eatCharacterClassEscape(p);if(z)return z;p.pos=S}return null},Ce.regexp_eatClassStringDisjunction=function(p){var S=p.pos;if(p.eatChars([92,113])){if(p.eat(123)){var w=this.regexp_classStringDisjunctionContents(p);if(p.eat(125))return w}else p.raise("Invalid escape");p.pos=S}return null},Ce.regexp_classStringDisjunctionContents=function(p){for(var S=this.regexp_classString(p);p.eat(124);)this.regexp_classString(p)===Tt&&(S=Tt);return S},Ce.regexp_classString=function(p){for(var S=0;this.regexp_eatClassSetCharacter(p);)S++;return S===1?dr:Tt},Ce.regexp_eatClassSetCharacter=function(p){var S=p.pos;if(p.eat(92))return this.regexp_eatCharacterEscape(p)||this.regexp_eatClassSetReservedPunctuator(p)?!0:p.eat(98)?(p.lastIntValue=8,!0):(p.pos=S,!1);var w=p.current();return w<0||w===p.lookahead()&&qs(w)||Sp(w)?!1:(p.advance(),p.lastIntValue=w,!0)};function qs(p){return p===33||p>=35&&p<=38||p>=42&&p<=44||p===46||p>=58&&p<=64||p===94||p===96||p===126}function Sp(p){return p===40||p===41||p===45||p===47||p>=91&&p<=93||p>=123&&p<=125}Ce.regexp_eatClassSetReservedPunctuator=function(p){var S=p.current();return kp(S)?(p.lastIntValue=S,p.advance(),!0):!1};function kp(p){return p===33||p===35||p===37||p===38||p===44||p===45||p>=58&&p<=62||p===64||p===96||p===126}Ce.regexp_eatClassControlLetter=function(p){var S=p.current();return mr(S)||S===95?(p.lastIntValue=S%32,p.advance(),!0):!1},Ce.regexp_eatHexEscapeSequence=function(p){var S=p.pos;if(p.eat(120)){if(this.regexp_eatFixedHexDigits(p,2))return!0;p.switchU&&p.raise("Invalid escape"),p.pos=S}return!1},Ce.regexp_eatDecimalDigits=function(p){var S=p.pos,w=0;for(p.lastIntValue=0;mr(w=p.current());)p.lastIntValue=10*p.lastIntValue+(w-48),p.advance();return p.pos!==S};function mr(p){return p>=48&&p<=57}Ce.regexp_eatHexDigits=function(p){var S=p.pos,w=0;for(p.lastIntValue=0;vp(w=p.current());)p.lastIntValue=16*p.lastIntValue+ic(w),p.advance();return p.pos!==S};function vp(p){return p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102}function ic(p){return p>=65&&p<=70?10+(p-65):p>=97&&p<=102?10+(p-97):p-48}Ce.regexp_eatLegacyOctalEscapeSequence=function(p){if(this.regexp_eatOctalDigit(p)){var S=p.lastIntValue;if(this.regexp_eatOctalDigit(p)){var w=p.lastIntValue;S<=3&&this.regexp_eatOctalDigit(p)?p.lastIntValue=S*64+w*8+p.lastIntValue:p.lastIntValue=S*8+w}else p.lastIntValue=S;return!0}return!1},Ce.regexp_eatOctalDigit=function(p){var S=p.current();return rc(S)?(p.lastIntValue=S-48,p.advance(),!0):(p.lastIntValue=0,!1)};function rc(p){return p>=48&&p<=55}Ce.regexp_eatFixedHexDigits=function(p,S){var w=p.pos;p.lastIntValue=0;for(var A=0;A<S;++A){var z=p.current();if(!vp(z))return p.pos=w,!1;p.lastIntValue=16*p.lastIntValue+ic(z),p.advance()}return!0};var Ks=function(S){this.type=S.type,this.value=S.value,this.start=S.start,this.end=S.end,S.options.locations&&(this.loc=new B(S,S.startLoc,S.endLoc)),S.options.ranges&&(this.range=[S.start,S.end])},We=I.prototype;We.next=function(p){!p&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ks(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},We.getToken=function(){return this.next(),new Ks(this)},typeof Symbol<"u"&&(We[Symbol.iterator]=function(){var p=this;return{next:function(){var S=p.getToken();return{done:S.type===C.eof,value:S}}}}),We.nextToken=function(){var p=this.curContext();if((!p||!p.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(C.eof);if(p.override)return p.override(this);this.readToken(this.fullCharCodeAtPos())},We.readToken=function(p){return v(p,this.options.ecmaVersion>=6)||p===92?this.readWord():this.getTokenFromCode(p)},We.fullCharCodeAt=function(p){var S=this.input.charCodeAt(p);if(S<=55295||S>=56320)return S;var w=this.input.charCodeAt(p+1);return w<=56319||w>=57344?S:(S<<10)+w-56613888},We.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},We.skipBlockComment=function(){var p=this.options.onComment&&this.curPosition(),S=this.pos,w=this.input.indexOf("*/",this.pos+=2);if(w===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=w+2,this.options.locations)for(var A=void 0,z=S;(A=K(this.input,z,this.pos))>-1;)++this.curLine,z=this.lineStart=A;this.options.onComment&&this.options.onComment(!0,this.input.slice(S+2,w),S,this.pos,p,this.curPosition())},We.skipLineComment=function(p){for(var S=this.pos,w=this.options.onComment&&this.curPosition(),A=this.input.charCodeAt(this.pos+=p);this.pos<this.input.length&&!re(A);)A=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(S+p,this.pos),S,this.pos,w,this.curPosition())},We.skipSpace=function(){e:for(;this.pos<this.input.length;){var p=this.input.charCodeAt(this.pos);switch(p){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(p>8&&p<14||p>=5760&&pe.test(String.fromCharCode(p)))++this.pos;else break e}}},We.finishToken=function(p,S){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var w=this.type;this.type=p,this.value=S,this.updateContext(w)},We.readToken_dot=function(){var p=this.input.charCodeAt(this.pos+1);if(p>=48&&p<=57)return this.readNumber(!0);var S=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&p===46&&S===46?(this.pos+=3,this.finishToken(C.ellipsis)):(++this.pos,this.finishToken(C.dot))},We.readToken_slash=function(){var p=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):p===61?this.finishOp(C.assign,2):this.finishOp(C.slash,1)},We.readToken_mult_modulo_exp=function(p){var S=this.input.charCodeAt(this.pos+1),w=1,A=p===42?C.star:C.modulo;return this.options.ecmaVersion>=7&&p===42&&S===42&&(++w,A=C.starstar,S=this.input.charCodeAt(this.pos+2)),S===61?this.finishOp(C.assign,w+1):this.finishOp(A,w)},We.readToken_pipe_amp=function(p){var S=this.input.charCodeAt(this.pos+1);if(S===p){if(this.options.ecmaVersion>=12){var w=this.input.charCodeAt(this.pos+2);if(w===61)return this.finishOp(C.assign,3)}return this.finishOp(p===124?C.logicalOR:C.logicalAND,2)}return S===61?this.finishOp(C.assign,2):this.finishOp(p===124?C.bitwiseOR:C.bitwiseAND,1)},We.readToken_caret=function(){var p=this.input.charCodeAt(this.pos+1);return p===61?this.finishOp(C.assign,2):this.finishOp(C.bitwiseXOR,1)},We.readToken_plus_min=function(p){var S=this.input.charCodeAt(this.pos+1);return S===p?S===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||L.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(C.incDec,2):S===61?this.finishOp(C.assign,2):this.finishOp(C.plusMin,1)},We.readToken_lt_gt=function(p){var S=this.input.charCodeAt(this.pos+1),w=1;return S===p?(w=p===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+w)===61?this.finishOp(C.assign,w+1):this.finishOp(C.bitShift,w)):S===33&&p===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(S===61&&(w=2),this.finishOp(C.relational,w))},We.readToken_eq_excl=function(p){var S=this.input.charCodeAt(this.pos+1);return S===61?this.finishOp(C.equality,this.input.charCodeAt(this.pos+2)===61?3:2):p===61&&S===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(C.arrow)):this.finishOp(p===61?C.eq:C.prefix,1)},We.readToken_question=function(){var p=this.options.ecmaVersion;if(p>=11){var S=this.input.charCodeAt(this.pos+1);if(S===46){var w=this.input.charCodeAt(this.pos+2);if(w<48||w>57)return this.finishOp(C.questionDot,2)}if(S===63){if(p>=12){var A=this.input.charCodeAt(this.pos+2);if(A===61)return this.finishOp(C.assign,3)}return this.finishOp(C.coalesce,2)}}return this.finishOp(C.question,1)},We.readToken_numberSign=function(){var p=this.options.ecmaVersion,S=35;if(p>=13&&(++this.pos,S=this.fullCharCodeAtPos(),v(S,!0)||S===92))return this.finishToken(C.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+D(S)+"'")},We.getTokenFromCode=function(p){switch(p){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(C.parenL);case 41:return++this.pos,this.finishToken(C.parenR);case 59:return++this.pos,this.finishToken(C.semi);case 44:return++this.pos,this.finishToken(C.comma);case 91:return++this.pos,this.finishToken(C.bracketL);case 93:return++this.pos,this.finishToken(C.bracketR);case 123:return++this.pos,this.finishToken(C.braceL);case 125:return++this.pos,this.finishToken(C.braceR);case 58:return++this.pos,this.finishToken(C.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(C.backQuote);case 48:var S=this.input.charCodeAt(this.pos+1);if(S===120||S===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(S===111||S===79)return this.readRadixNumber(8);if(S===98||S===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(p);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(p);case 124:case 38:return this.readToken_pipe_amp(p);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(p);case 60:case 62:return this.readToken_lt_gt(p);case 61:case 33:return this.readToken_eq_excl(p);case 63:return this.readToken_question();case 126:return this.finishOp(C.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+D(p)+"'")},We.finishOp=function(p,S){var w=this.input.slice(this.pos,this.pos+S);return this.pos+=S,this.finishToken(p,w)},We.readRegexp=function(){for(var p,S,w=this.pos;;){this.pos>=this.input.length&&this.raise(w,"Unterminated regular expression");var A=this.input.charAt(this.pos);if(L.test(A)&&this.raise(w,"Unterminated regular expression"),p)p=!1;else{if(A==="[")S=!0;else if(A==="]"&&S)S=!1;else if(A==="/"&&!S)break;p=A==="\\"}++this.pos}var z=this.input.slice(w,this.pos);++this.pos;var X=this.pos,Z=this.readWord1();this.containsEsc&&this.unexpected(X);var ge=this.regexpState||(this.regexpState=new Dn(this));ge.reset(w,z,Z),this.validateRegExpFlags(ge),this.validateRegExpPattern(ge);var xe=null;try{xe=new RegExp(z,Z)}catch{}return this.finishToken(C.regexp,{pattern:z,flags:Z,value:xe})},We.readInt=function(p,S,w){for(var A=this.options.ecmaVersion>=12&&S===void 0,z=w&&this.input.charCodeAt(this.pos)===48,X=this.pos,Z=0,ge=0,xe=0,Le=S??1/0;xe<Le;++xe,++this.pos){var qe=this.input.charCodeAt(this.pos),yt=void 0;if(A&&qe===95){z&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),ge===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),xe===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),ge=qe;continue}if(qe>=97?yt=qe-97+10:qe>=65?yt=qe-65+10:qe>=48&&qe<=57?yt=qe-48:yt=1/0,yt>=p)break;ge=qe,Z=Z*p+yt}return A&&ge===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===X||S!=null&&this.pos-X!==S?null:Z};function Gg(p,S){return S?parseInt(p,8):parseFloat(p.replace(/_/g,""))}function ro(p){return typeof BigInt!="function"?null:BigInt(p.replace(/_/g,""))}We.readRadixNumber=function(p){var S=this.pos;this.pos+=2;var w=this.readInt(p);return w==null&&this.raise(this.start+2,"Expected number in radix "+p),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(w=ro(this.input.slice(S,this.pos)),++this.pos):v(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,w)},We.readNumber=function(p){var S=this.pos;!p&&this.readInt(10,void 0,!0)===null&&this.raise(S,"Invalid number");var w=this.pos-S>=2&&this.input.charCodeAt(S)===48;w&&this.strict&&this.raise(S,"Invalid number");var A=this.input.charCodeAt(this.pos);if(!w&&!p&&this.options.ecmaVersion>=11&&A===110){var z=ro(this.input.slice(S,this.pos));return++this.pos,v(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,z)}w&&/[89]/.test(this.input.slice(S,this.pos))&&(w=!1),A===46&&!w&&(++this.pos,this.readInt(10),A=this.input.charCodeAt(this.pos)),(A===69||A===101)&&!w&&(A=this.input.charCodeAt(++this.pos),(A===43||A===45)&&++this.pos,this.readInt(10)===null&&this.raise(S,"Invalid number")),v(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var X=Gg(this.input.slice(S,this.pos),w);return this.finishToken(C.num,X)},We.readCodePoint=function(){var p=this.input.charCodeAt(this.pos),S;if(p===123){this.options.ecmaVersion<6&&this.unexpected();var w=++this.pos;S=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,S>1114111&&this.invalidStringToken(w,"Code point out of bounds")}else S=this.readHexChar(4);return S},We.readString=function(p){for(var S="",w=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var A=this.input.charCodeAt(this.pos);if(A===p)break;A===92?(S+=this.input.slice(w,this.pos),S+=this.readEscapedChar(!1),w=this.pos):A===8232||A===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(re(A)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return S+=this.input.slice(w,this.pos++),this.finishToken(C.string,S)};var Ii={};We.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(p){if(p===Ii)this.readInvalidTemplateToken();else throw p}this.inTemplateElement=!1},We.invalidStringToken=function(p,S){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ii;this.raise(p,S)},We.readTmplToken=function(){for(var p="",S=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var w=this.input.charCodeAt(this.pos);if(w===96||w===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===C.template||this.type===C.invalidTemplate)?w===36?(this.pos+=2,this.finishToken(C.dollarBraceL)):(++this.pos,this.finishToken(C.backQuote)):(p+=this.input.slice(S,this.pos),this.finishToken(C.template,p));if(w===92)p+=this.input.slice(S,this.pos),p+=this.readEscapedChar(!0),S=this.pos;else if(re(w)){switch(p+=this.input.slice(S,this.pos),++this.pos,w){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:p+=`
79
- `;break;default:p+=String.fromCharCode(w);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),S=this.pos}else++this.pos}},We.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(C.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
80
- `&&++this.pos;case`
81
- `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},We.readEscapedChar=function(p){var S=this.input.charCodeAt(++this.pos);switch(++this.pos,S){case 110:return`
82
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return D(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),p){var w=this.pos-1;this.invalidStringToken(w,"Invalid escape sequence in template string")}default:if(S>=48&&S<=55){var A=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],z=parseInt(A,8);return z>255&&(A=A.slice(0,-1),z=parseInt(A,8)),this.pos+=A.length-1,S=this.input.charCodeAt(this.pos),(A!=="0"||S===56||S===57)&&(this.strict||p)&&this.invalidStringToken(this.pos-1-A.length,p?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(z)}return re(S)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(S)}},We.readHexChar=function(p){var S=this.pos,w=this.readInt(16,p);return w===null&&this.invalidStringToken(S,"Bad character escape sequence"),w},We.readWord1=function(){this.containsEsc=!1;for(var p="",S=!0,w=this.pos,A=this.options.ecmaVersion>=6;this.pos<this.input.length;){var z=this.fullCharCodeAtPos();if(E(z,A))this.pos+=z<=65535?1:2;else if(z===92){this.containsEsc=!0,p+=this.input.slice(w,this.pos);var X=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var Z=this.readCodePoint();(S?v:E)(Z,A)||this.invalidStringToken(X,"Invalid Unicode escape"),p+=D(Z),w=this.pos}else break;S=!1}return p+this.input.slice(w,this.pos)},We.readWord=function(){var p=this.readWord1(),S=C.name;return this.keywords.test(p)&&(S=J[p]),this.finishToken(S,p)};var wl="8.16.0";I.acorn={Parser:I,version:wl,defaultOptions:Re,Position:ne,SourceLocation:B,getLineInfo:be,Node:Us,TokenType:T,tokTypes:C,keywordTypes:J,TokContext:Jt,tokContexts:gt,isIdentifierChar:E,isIdentifierStart:v,Token:Ks,isNewLine:re,lineBreak:L,lineBreakG:q,nonASCIIwhitespace:pe};function sc(p,S){return I.parse(p,S)}function Gs(p,S,w){return I.parseExpressionAt(p,S,w)}function Ys(p,S){return I.tokenizer(p,S)}n.Node=Us,n.Parser=I,n.Position=ne,n.SourceLocation=B,n.TokContext=Jt,n.Token=Ks,n.TokenType=T,n.defaultOptions=Re,n.getLineInfo=be,n.isIdentifierChar=E,n.isIdentifierStart=v,n.isNewLine=re,n.keywordTypes=J,n.lineBreak=L,n.lineBreakG=q,n.nonASCIIwhitespace=pe,n.parse=sc,n.parseExpressionAt=Gs,n.tokContexts=gt,n.tokTypes=C,n.tokenizer=Ys,n.version=wl}))})(Lf,Lf.exports)),Lf.exports}var jA;function xq(){return jA||(jA=1,(function(t){const e=gq(),n=/^[\da-fA-F]+$/,i=/^\d+$/,r=new WeakMap;function s(c){c=c.Parser.acorn||c;let h=r.get(c);if(!h){const m=c.tokTypes,g=c.TokContext,y=c.TokenType,b=new g("<tag",!1),v=new g("</tag",!1),E=new g("<tag>...</tag>",!0,!0),T={tc_oTag:b,tc_cTag:v,tc_expr:E},M={jsxName:new y("jsxName"),jsxText:new y("jsxText",{beforeExpr:!0}),jsxTagStart:new y("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new y("jsxTagEnd")};M.jsxTagStart.updateContext=function(){this.context.push(E),this.context.push(b),this.exprAllowed=!1},M.jsxTagEnd.updateContext=function(j){let F=this.context.pop();F===b&&j===m.slash||F===v?(this.context.pop(),this.exprAllowed=this.curContext()===E):this.exprAllowed=!0},h={tokContexts:T,tokTypes:M},r.set(c,h)}return h}function o(c){if(!c)return c;if(c.type==="JSXIdentifier")return c.name;if(c.type==="JSXNamespacedName")return c.namespace.name+":"+c.name.name;if(c.type==="JSXMemberExpression")return o(c.object)+"."+o(c.property)}t.exports=function(c){return c=c||{},function(h){return u({allowNamespaces:c.allowNamespaces!==!1,allowNamespacedObjects:!!c.allowNamespacedObjects},h)}},Object.defineProperty(t.exports,"tokTypes",{get:function(){return s(PA()).tokTypes},configurable:!0,enumerable:!0});function u(c,h){const m=h.acorn||PA(),g=s(m),y=m.tokTypes,b=g.tokTypes,v=m.tokContexts,E=g.tokContexts.tc_oTag,T=g.tokContexts.tc_cTag,M=g.tokContexts.tc_expr,j=m.isNewLine,F=m.isIdentifierStart,J=m.isIdentifierChar;return class extends h{static get acornJsx(){return g}jsx_readToken(){let V="",C=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let L=this.input.charCodeAt(this.pos);switch(L){case 60:case 123:return this.pos===this.start?L===60&&this.exprAllowed?(++this.pos,this.finishToken(b.jsxTagStart)):this.getTokenFromCode(L):(V+=this.input.slice(C,this.pos),this.finishToken(b.jsxText,V));case 38:V+=this.input.slice(C,this.pos),V+=this.jsx_readEntity(),C=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(L===62?"&gt;":"&rbrace;")+'` or `{"'+this.input[this.pos]+'"}`?');default:j(L)?(V+=this.input.slice(C,this.pos),V+=this.jsx_readNewLine(!0),C=this.pos):++this.pos}}}jsx_readNewLine(V){let C=this.input.charCodeAt(this.pos),L;return++this.pos,C===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,L=V?`
83
- `:`\r
84
- `):L=String.fromCharCode(C),this.options.locations&&(++this.curLine,this.lineStart=this.pos),L}jsx_readString(V){let C="",L=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let q=this.input.charCodeAt(this.pos);if(q===V)break;q===38?(C+=this.input.slice(L,this.pos),C+=this.jsx_readEntity(),L=this.pos):j(q)?(C+=this.input.slice(L,this.pos),C+=this.jsx_readNewLine(!1),L=this.pos):++this.pos}return C+=this.input.slice(L,this.pos++),this.finishToken(y.string,C)}jsx_readEntity(){let V="",C=0,L,q=this.input[this.pos];q!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let re=++this.pos;for(;this.pos<this.input.length&&C++<10;){if(q=this.input[this.pos++],q===";"){V[0]==="#"?V[1]==="x"?(V=V.substr(2),n.test(V)&&(L=String.fromCharCode(parseInt(V,16)))):(V=V.substr(1),i.test(V)&&(L=String.fromCharCode(parseInt(V,10)))):L=e[V];break}V+=q}return L||(this.pos=re,"&")}jsx_readWord(){let V,C=this.pos;do V=this.input.charCodeAt(++this.pos);while(J(V)||V===45);return this.finishToken(b.jsxName,this.input.slice(C,this.pos))}jsx_parseIdentifier(){let V=this.startNode();return this.type===b.jsxName?V.name=this.value:this.type.keyword?V.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(V,"JSXIdentifier")}jsx_parseNamespacedName(){let V=this.start,C=this.startLoc,L=this.jsx_parseIdentifier();if(!c.allowNamespaces||!this.eat(y.colon))return L;var q=this.startNodeAt(V,C);return q.namespace=L,q.name=this.jsx_parseIdentifier(),this.finishNode(q,"JSXNamespacedName")}jsx_parseElementName(){if(this.type===b.jsxTagEnd)return"";let V=this.start,C=this.startLoc,L=this.jsx_parseNamespacedName();for(this.type===y.dot&&L.type==="JSXNamespacedName"&&!c.allowNamespacedObjects&&this.unexpected();this.eat(y.dot);){let q=this.startNodeAt(V,C);q.object=L,q.property=this.jsx_parseIdentifier(),L=this.finishNode(q,"JSXMemberExpression")}return L}jsx_parseAttributeValue(){switch(this.type){case y.braceL:let V=this.jsx_parseExpressionContainer();return V.expression.type==="JSXEmptyExpression"&&this.raise(V.start,"JSX attributes must only be assigned a non-empty expression"),V;case b.jsxTagStart:case y.string:return this.parseExprAtom();default:this.raise(this.start,"JSX value should be either an expression or a quoted JSX text")}}jsx_parseEmptyExpression(){let V=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(V,"JSXEmptyExpression",this.start,this.startLoc)}jsx_parseExpressionContainer(){let V=this.startNode();return this.next(),V.expression=this.type===y.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(y.braceR),this.finishNode(V,"JSXExpressionContainer")}jsx_parseAttribute(){let V=this.startNode();return this.eat(y.braceL)?(this.expect(y.ellipsis),V.argument=this.parseMaybeAssign(),this.expect(y.braceR),this.finishNode(V,"JSXSpreadAttribute")):(V.name=this.jsx_parseNamespacedName(),V.value=this.eat(y.eq)?this.jsx_parseAttributeValue():null,this.finishNode(V,"JSXAttribute"))}jsx_parseOpeningElementAt(V,C){let L=this.startNodeAt(V,C);L.attributes=[];let q=this.jsx_parseElementName();for(q&&(L.name=q);this.type!==y.slash&&this.type!==b.jsxTagEnd;)L.attributes.push(this.jsx_parseAttribute());return L.selfClosing=this.eat(y.slash),this.expect(b.jsxTagEnd),this.finishNode(L,q?"JSXOpeningElement":"JSXOpeningFragment")}jsx_parseClosingElementAt(V,C){let L=this.startNodeAt(V,C),q=this.jsx_parseElementName();return q&&(L.name=q),this.expect(b.jsxTagEnd),this.finishNode(L,q?"JSXClosingElement":"JSXClosingFragment")}jsx_parseElementAt(V,C){let L=this.startNodeAt(V,C),q=[],re=this.jsx_parseOpeningElementAt(V,C),K=null;if(!re.selfClosing){e:for(;;)switch(this.type){case b.jsxTagStart:if(V=this.start,C=this.startLoc,this.next(),this.eat(y.slash)){K=this.jsx_parseClosingElementAt(V,C);break e}q.push(this.jsx_parseElementAt(V,C));break;case b.jsxText:q.push(this.parseExprAtom());break;case y.braceL:q.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}o(K.name)!==o(re.name)&&this.raise(K.start,"Expected corresponding JSX closing tag for <"+o(re.name)+">")}let pe=re.name?"Element":"Fragment";return L["opening"+pe]=re,L["closing"+pe]=K,L.children=q,this.type===y.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(L,"JSX"+pe)}jsx_parseText(){let V=this.parseLiteral(this.value);return V.type="JSXText",V}jsx_parseElement(){let V=this.start,C=this.startLoc;return this.next(),this.jsx_parseElementAt(V,C)}parseExprAtom(V){return this.type===b.jsxText?this.jsx_parseText():this.type===b.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(V)}readToken(V){let C=this.curContext();if(C===M)return this.jsx_readToken();if(C===E||C===T){if(F(V))return this.jsx_readWord();if(V==62)return++this.pos,this.finishToken(b.jsxTagEnd);if((V===34||V===39)&&C==E)return this.jsx_readString(V)}return V===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(b.jsxTagStart)):super.readToken(V)}updateContext(V){if(this.type==y.braceL){var C=this.curContext();C==E?this.context.push(v.b_expr):C==M?this.context.push(v.b_tmpl):super.updateContext(V),this.exprAllowed=!0}else if(this.type===y.slash&&V===b.jsxTagStart)this.context.length-=2,this.context.push(T),this.exprAllowed=!1;else return super.updateContext(V)}}}})(ox)),ox.exports}var bq=xq();const Sq=uT(bq);const kq={}.hasOwnProperty,vq=Symbol("continue"),ux=Symbol("exit"),Cq=Symbol("skip");function wq(t,e){let n,i;typeof e=="function"?n=e:e&&typeof e=="object"&&(e.enter&&(n=e.enter),e.leave&&(i=e.leave)),r(t,void 0,void 0,[])();function r(s,o,u,c){return cx(s)&&(h.displayName="node ("+s.type+")"),h;function h(){const m=n?$A(n(s,o,u,c)):[];if(m[0]===ux)return m;if(m[0]!==Cq){let g;for(g in s)if(kq.call(s,g)&&s[g]&&typeof s[g]=="object"&&g!=="data"&&g!=="position"){const y=c.concat(s),b=s[g];if(Array.isArray(b)){const v=b;let E=0;for(;E>-1&&E<v.length;){const T=v[E];if(cx(T)){const M=r(T,g,E,y)();if(M[0]===ux)return M;E=typeof M[1]=="number"?M[1]:E+1}else E++}}else if(cx(b)){const v=r(b,g,void 0,y)();if(v[0]===ux)return v}}}return i?$A(i(s,o,u,c)):m}}}function $A(t){return Array.isArray(t)?t:typeof t=="number"?[vq,t]:[t]}function cx(t){return!!(t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.length>0)}function KI(t,e){const n=e.prefix||"",i=e.suffix||"",r=Object.assign({},e.acornOptions),s=[],o=[],u=r.onComment,c=r.onToken;let h=!1,m,g;const y=Object.assign({},r,{onComment:s,preserveParens:!0});c&&(y.onToken=o);const b=Eq(t,e.tokenTypes),v=b.value,E=n+v+i,T=e.expression&&UA(v);if(T&&!e.allowEmpty)throw new mt("Unexpected empty expression",{place:j(0),ruleId:"unexpected-empty-expression",source:"micromark-extension-mdx-expression"});try{m=e.expression&&!T?e.acorn.parseExpressionAt(E,0,y):e.acorn.parse(E,y)}catch(F){const J=F,V=j(J.pos);J.message=String(J.message).replace(/ \(\d+:\d+\)$/,""),J.pos=V.offset,J.loc={line:V.line,column:V.column-1},g=J,h=J.raisedAt>=n.length+v.length||J.message==="Unterminated comment"}if(m&&e.expression&&!T)if(UA(E.slice(m.end,E.length-i.length)))m={type:"Program",start:0,end:n.length+v.length,body:[{type:"ExpressionStatement",expression:m,start:0,end:n.length+v.length}],sourceType:"module",comments:[]};else{const F=j(m.end),J=new Error("Unexpected content after expression");J.pos=F.offset,J.loc={line:F.line,column:F.column-1},g=J,m=void 0}if(m){if(m.comments=s,wq(m,function(F,J,V,C){let L=C[C.length-1],q=J;F.type==="ParenthesizedExpression"&&L&&q&&(typeof V=="number"&&(L=L[q],q=V),L[q]=F.expression),M(F)}),Array.isArray(u))u.push(...s);else if(typeof u=="function")for(const F of s)u(F.type==="Block",F.value,F.start,F.end,F.loc.start,F.loc.end);for(const F of o)F.end<=n.length||F.start-n.length>=v.length||(M(F),Array.isArray(c)?c.push(F):c(F))}return{estree:m,error:g,swallow:h};function M(F){const J=j(F.start),V=j(F.end);F.start=J.offset,F.end=V.offset,F.loc={start:{line:J.line,column:J.column-1,offset:J.offset},end:{line:V.line,column:V.column-1,offset:V.offset}},F.range=[F.start,F.end]}function j(F){let J=F-n.length;J<0?J=0:J>v.length&&(J=v.length);let V=Nq(b.stops,J);return V||(V={line:e.start.line,column:e.start.column,offset:e.start.offset}),V}}function UA(t){return/^\s*$/.test(t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,""))}function Eq(t,e){const n={value:"",stops:[]};let i=-1;for(;++i<t.length;){const r=t[i];if(r[0]==="enter"){const s=r[1].type;if(s==="lineEnding"||e.includes(s)){const o=r[2].sliceStream(r[1]);for(;o.length>0&&o[0]===-1;)o.shift();const u=Aq(o);n.stops.push([n.value.length,r[1].start]),n.value+=u,n.stops.push([n.value.length,r[1].end])}}}return n}function Nq(t,e){let n=0;for(;n<t.length&&t[n][0]<=e;)n+=1;if(n===0)return;const[i,r]=t[n-1],s=e-i;return{line:r.line,column:r.column+s,offset:r.offset+s}}function Aq(t){let e=-1;const n=[];let i;for(;++e<t.length;){const r=t[e];let s;if(typeof r=="string")s=r;else switch(r){case-5:{s="\r";break}case-4:{s=`
85
- `;break}case-3:{s=`\r
86
- `;break}case-2:{s=" ";break}case-1:{if(i)continue;s=" ";break}default:s=String.fromCharCode(r)}i=r===-2,n.push(s)}return n.join("")}function mm(t){const e=t||{},n=e.loc||{},i=e.range||[void 0,void 0],r=JA(n.start,i[0]||e.start),s=JA(n.end,i[1]||e.end);if(r&&s)return{start:r,end:s}}function JA(t,e){if(t&&typeof t=="object"){const n="line"in t?fx(t.line):void 0,i="column"in t?fx(t.column):void 0;if(n&&i!==void 0)return{line:n,column:i+1,offset:fx(e)}}}function fx(t){return typeof t=="number"&&t>-1?t:void 0}const Tq=2,vu="https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression",Mq="#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-",Oq="#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed",HA="#unexpected-type-in-code-expected-an-object-spread-spread",Rq="#unexpected-extra-content-in-spread-only-a-single-spread-is-supported",Dq="#could-not-parse-expression-with-acorn";function Zm(t,e,n,i,r,s,o,u,c,h,m){const g=this,y=this.events.length+3;let b=0,v,E;return T;function T(J){return t.enter(n),t.enter(i),t.consume(J),t.exit(i),v=g.now(),M}function M(J){if(J===null){if(E)throw E;const V=new mt("Unexpected end of file in expression, expected a corresponding closing brace for `{`",{place:g.now(),ruleId:"unexpected-eof",source:"micromark-extension-mdx-expression"});throw V.url=vu+Mq,V}if(Te(J))return t.enter("lineEnding"),t.consume(J),t.exit("lineEnding"),F;if(J===125&&b===0){const V=s?Iq.call(g,s,o,r,y,v,h||!1,c||!1):{type:"ok",estree:void 0};if(V.type==="ok"){t.enter(i),t.consume(J),t.exit(i);const C=t.exit(n);return u&&V.estree&&Object.assign(C,{estree:V.estree}),e}return E=V.message,t.enter(r),t.consume(J),j}return t.enter(r),j(J)}function j(J){return J===125&&b===0||J===null||Te(J)?(t.exit(r),M(J)):(J===123&&!s?b+=1:J===125&&(b-=1),t.consume(J),j)}function F(J){const V=g.now();if(V.line!==v.line&&!m&&g.parser.lazy[V.line]){const C=new mt("Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",{place:g.now(),ruleId:"unexpected-lazy",source:"micromark-extension-mdx-expression"});throw C.url=vu+Oq,C}return Ge(J)?nt(t,M,"linePrefix",Tq+1)(J):M(J)}}function Iq(t,e,n,i,r,s,o){const u=KI(this.events.slice(i),{acorn:t,tokenTypes:[n],acornOptions:e,start:r,expression:!0,allowEmpty:s,prefix:o?"({":"",suffix:o?"})":""}),c=u.estree;if(o&&c){const h=c.body[0];if(h.type!=="ExpressionStatement"||h.expression.type!=="ObjectExpression"){const m=mm(h),g=new mt("Unexpected `"+h.type+"` in code: expected an object spread (`{...spread}`)",{place:m.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=vu+HA,g}if(h.expression.properties[1]){const m=mm(h.expression.properties[1]),g=new mt("Unexpected extra content in spread: only a single spread is supported",{place:m.start,ruleId:"spread-extra",source:"micromark-extension-mdx-expression"});throw g.url=vu+Rq,g}if(h.expression.properties[0]&&h.expression.properties[0].type!=="SpreadElement"){const m=mm(h.expression.properties[0]),g=new mt("Unexpected `"+h.expression.properties[0].type+"` in code: only spread elements are supported",{place:m.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=vu+HA,g}}if(u.error){const h=new mt("Could not parse expression with acorn",{cause:u.error,place:{line:u.error.loc.line,column:u.error.loc.column+1,offset:u.error.pos},ruleId:"acorn",source:"micromark-extension-mdx-expression"});return h.url=vu+Dq,{type:"nok",message:h}}return{type:"ok",estree:c}}function _q(t){const e=t||{},n=e.addResult,i=e.acorn,r=e.spread;let s=e.allowEmpty,o;if(s==null&&(s=!0),i){if(!i.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");o=Object.assign({ecmaVersion:2024,sourceType:"module"},e.acornOptions)}else if(e.acornOptions||e.addResult)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");return{flow:{123:{name:"mdxFlowExpression",tokenize:u,concrete:!0}},text:{123:{name:"mdxTextExpression",tokenize:c}}};function u(h,m,g){const y=this;return b;function b(M){return v(M)}function v(M){return Zm.call(y,h,E,"mdxFlowExpression","mdxFlowExpressionMarker","mdxFlowExpressionChunk",i,o,n,r,s)(M)}function E(M){return Ge(M)?nt(h,T,"whitespace")(M):T(M)}function T(M){const j=y.parser.constructs.flow[60],J=(Array.isArray(j)?j:j?[j]:[]).find(function(V){return V.name==="mdxJsxFlowTag"});return M===60&&J?h.attempt(J,T,g)(M):M===null||Te(M)?m(M):g(M)}}function c(h,m){const g=this;return y;function y(b){return Zm.call(g,h,m,"mdxTextExpression","mdxTextExpressionMarker","mdxTextExpressionChunk",i,o,n,r,s,!0)(b)}}}const zq=/[$_\p{ID_Start}]/u,Lq=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,Bq=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,Vq={};function Sr(t){return t?zq.test(String.fromCodePoint(t)):!1}function Gc(t,e){const i=(e||Vq).jsx?Bq:Lq;return t?i.test(String.fromCodePoint(t)):!1}const qA="https://github.com/micromark/micromark-extension-mdx-jsx";function GI(t,e,n,i,r,s,o,u,c,h,m,g,y,b,v,E,T,M,j,F,J,V,C,L,q,re,K,pe,he,ke,Ie,De){const W=this;let oe,de;return ve;function ve(I){return t.enter(u),t.enter(c),t.consume(I),t.exit(c),D}function D(I){return ct(I)?n(I):(oe=P,$e(I))}function P(I){if(I===47)return t.enter(h),t.consume(I),t.exit(h),oe=ne,$e;if(I===62)return Ri(I);if(I!==null&&I>=0&&Sr(I))return t.enter(g),t.enter(y),t.consume(I),B;me(I,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(I===33?" (note: to create a comment in MDX, use `{/* text */}`)":""))}function ne(I){if(I===62)return Ri(I);if(I!==null&&I>=0&&Sr(I))return t.enter(g),t.enter(y),t.consume(I),B;me(I,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(I===42||I===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function B(I){if(I!==null&&I>=0&&Gc(I,{jsx:!0}))return t.consume(I),B;if(I===46||I===47||I===58||I===62||I===123||ct(I)||Bn(I))return t.exit(y),oe=be,$e(I);me(I,"in name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(I===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function be(I){if(I===46)return t.enter(b),t.consume(I),t.exit(b),oe=Re,$e;if(I===58)return t.enter(E),t.consume(I),t.exit(E),oe=Ct,$e;if(I===47||I===62||I===123||I!==null&&I>=0&&Sr(I))return t.exit(g),Lt(I);me(I,"after name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Re(I){if(I!==null&&I>=0&&Sr(I))return t.enter(v),t.consume(I),Me;me(I,"before member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Me(I){if(I!==null&&I>=0&&Gc(I,{jsx:!0}))return t.consume(I),Me;if(I===46||I===47||I===62||I===123||ct(I)||Bn(I))return t.exit(v),oe=Xe,$e(I);me(I,"in member name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(I===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function Xe(I){if(I===46)return t.enter(b),t.consume(I),t.exit(b),oe=Re,$e;if(I===47||I===62||I===123||I!==null&&I>=0&&Sr(I))return t.exit(g),Lt(I);me(I,"after member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Ct(I){if(I!==null&&I>=0&&Sr(I))return t.enter(T),t.consume(I),Qe;me(I,"before local name","a character that can start a name, such as a letter, `$`, or `_`"+(I===43||I!==null&&I>46&&I<58?" (note: to create a link in MDX, use `[text](url)`)":""))}function Qe(I){if(I!==null&&I>=0&&Gc(I,{jsx:!0}))return t.consume(I),Qe;if(I===47||I===62||I===123||ct(I)||Bn(I))return t.exit(T),oe=zt,$e(I);me(I,"in local name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function zt(I){if(I===47||I===62||I===123||I!==null&&I>=0&&Sr(I))return t.exit(g),Lt(I);me(I,"after local name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Lt(I){if(I===47)return t.enter(m),t.consume(I),t.exit(m),oe=Mr,$e;if(I===62)return Ri(I);if(I===123)return Zm.call(W,t,Tr,M,j,F,i,r,s,!0,!1,o)(I);if(I!==null&&I>=0&&Sr(I))return t.enter(J),t.enter(V),t.enter(C),t.consume(I),ur;me(I,"before attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Tr(I){return oe=Lt,$e(I)}function ur(I){if(I!==null&&I>=0&&Gc(I,{jsx:!0}))return t.consume(I),ur;if(I===47||I===58||I===61||I===62||I===123||ct(I)||Bn(I))return t.exit(C),oe=Xn,$e(I);me(I,"in attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Xn(I){if(I===58)return t.enter(L),t.consume(I),t.exit(L),oe=pi,$e;if(I===61)return t.exit(V),t.enter(re),t.consume(I),t.exit(re),oe=di,$e;if(I===47||I===62||I===123||ct(I)||Bn(I)||I!==null&&I>=0&&Sr(I))return t.exit(V),t.exit(J),oe=Lt,$e(I);me(I,"after attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function pi(I){if(I!==null&&I>=0&&Sr(I))return t.enter(q),t.consume(I),Mi;me(I,"before local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function Mi(I){if(I!==null&&I>=0&&Gc(I,{jsx:!0}))return t.consume(I),Mi;if(I===47||I===61||I===62||I===123||ct(I)||Bn(I))return t.exit(q),t.exit(V),oe=Qn,$e(I);me(I,"in local attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Qn(I){if(I===61)return t.enter(re),t.consume(I),t.exit(re),oe=di,$e;if(I===47||I===62||I===123||I!==null&&I>=0&&Sr(I))return t.exit(J),Lt(I);me(I,"after local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function di(I){if(I===34||I===39)return t.enter(K),t.enter(pe),t.consume(I),t.exit(pe),de=I,On;if(I===123)return Zm.call(W,t,cr,ke,Ie,De,i,r,s,!1,!1,o)(I);me(I,"before attribute value","a character that can start an attribute value, such as `\"`, `'`, or `{`"+(I===60?" (note: to use an element or fragment as a prop value in MDX, use `{<element />}`)":""))}function cr(I){return t.exit(J),oe=Lt,$e(I)}function On(I){return I===null&&me(I,"in attribute value","a corresponding closing quote `"+String.fromCodePoint(de)+"`"),I===de?(t.enter(pe),t.consume(I),t.exit(pe),t.exit(K),t.exit(J),de=void 0,oe=Lt,$e):Te(I)?(oe=On,$e(I)):(t.enter(he),Oi(I))}function Oi(I){return I===null||I===de||Te(I)?(t.exit(he),On(I)):(t.consume(I),Oi)}function Mr(I){if(I===62)return Ri(I);me(I,"after self-closing slash","`>` to end the tag"+(I===42||I===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function Ri(I){return t.enter(c),t.consume(I),t.exit(c),t.exit(u),e}function $e(I){return Te(I)?(t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),ae):Ge(I)||Bn(I)?(t.enter("esWhitespace"),Xr(I)):oe(I)}function Xr(I){return Te(I)?(t.exit("esWhitespace"),$e(I)):Ge(I)||Bn(I)?(t.consume(I),Xr):(t.exit("esWhitespace"),oe(I))}function ae(I){if(!o&&W.parser.lazy[W.now().line]){const _e=new mt("Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",W.now(),"micromark-extension-mdx-jsx:unexpected-lazy");throw _e.url=qA+"#unexpected-lazy-line-in-container-expected-line-to-be",_e}return $e(I)}function me(I,_e,Pe){const tn=new mt("Unexpected "+(I===null?"end of file":"character `"+(I===96?"` ` `":String.fromCodePoint(I))+"` ("+Fq(I)+")")+" "+_e+", expected "+Pe,W.now(),"micromark-extension-mdx-jsx:unexpected-"+(I===null?"eof":"character"));throw tn.url=qA+(I===null?"#unexpected-end-of-file-at-expected-expect":"#unexpected-character-at-expected-expect"),tn}}function Fq(t){return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function Pq(t,e){return{name:"mdxJsxTextTag",tokenize:n};function n(i,r,s){return GI.call(this,i,r,s,t,e.acornOptions,e.addResult,!0,"mdxJsxTextTag","mdxJsxTextTagMarker","mdxJsxTextTagClosingMarker","mdxJsxTextTagSelfClosingMarker","mdxJsxTextTagName","mdxJsxTextTagNamePrimary","mdxJsxTextTagNameMemberMarker","mdxJsxTextTagNameMember","mdxJsxTextTagNamePrefixMarker","mdxJsxTextTagNameLocal","mdxJsxTextTagExpressionAttribute","mdxJsxTextTagExpressionAttributeMarker","mdxJsxTextTagExpressionAttributeValue","mdxJsxTextTagAttribute","mdxJsxTextTagAttributeName","mdxJsxTextTagAttributeNamePrimary","mdxJsxTextTagAttributeNamePrefixMarker","mdxJsxTextTagAttributeNameLocal","mdxJsxTextTagAttributeInitializerMarker","mdxJsxTextTagAttributeValueLiteral","mdxJsxTextTagAttributeValueLiteralMarker","mdxJsxTextTagAttributeValueLiteralValue","mdxJsxTextTagAttributeValueExpression","mdxJsxTextTagAttributeValueExpressionMarker","mdxJsxTextTagAttributeValueExpressionValue")}}function jq(t,e){return{concrete:!0,name:"mdxJsxFlowTag",tokenize:n};function n(i,r,s){const o=this;return u;function u(g){return c(g)}function c(g){return GI.call(o,i,h,s,t,e.acornOptions,e.addResult,!1,"mdxJsxFlowTag","mdxJsxFlowTagMarker","mdxJsxFlowTagClosingMarker","mdxJsxFlowTagSelfClosingMarker","mdxJsxFlowTagName","mdxJsxFlowTagNamePrimary","mdxJsxFlowTagNameMemberMarker","mdxJsxFlowTagNameMember","mdxJsxFlowTagNamePrefixMarker","mdxJsxFlowTagNameLocal","mdxJsxFlowTagExpressionAttribute","mdxJsxFlowTagExpressionAttributeMarker","mdxJsxFlowTagExpressionAttributeValue","mdxJsxFlowTagAttribute","mdxJsxFlowTagAttributeName","mdxJsxFlowTagAttributeNamePrimary","mdxJsxFlowTagAttributeNamePrefixMarker","mdxJsxFlowTagAttributeNameLocal","mdxJsxFlowTagAttributeInitializerMarker","mdxJsxFlowTagAttributeValueLiteral","mdxJsxFlowTagAttributeValueLiteralMarker","mdxJsxFlowTagAttributeValueLiteralValue","mdxJsxFlowTagAttributeValueExpression","mdxJsxFlowTagAttributeValueExpressionMarker","mdxJsxFlowTagAttributeValueExpressionValue")(g)}function h(g){return Ge(g)?nt(i,m,"whitespace")(g):m(g)}function m(g){const y=o.parser.constructs.flow[123],b=Array.isArray(y)?y:y?[y]:[];let v;for(const E of b)if(E.name==="mdxFlowExpression"){v=E;break}return g===60?u(g):g===123&&v?i.attempt(v,m,s)(g):g===null||Te(g)?r(g):s(g)}}}function $q(t){const e=t||{},n=e.acorn;let i;if(n){if(!n.parse||!n.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");i=Object.assign({ecmaVersion:2024,sourceType:"module"},e.acornOptions,{locations:!0})}else if(e.acornOptions||e.addResult)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");return{flow:{60:jq(n||void 0,{acornOptions:i,addResult:e.addResult||void 0})},text:{60:Pq(n||void 0,{acornOptions:i,addResult:e.addResult||void 0})}}}function Uq(){return{disable:{null:["autolink","codeIndented","htmlFlow","htmlText"]}}}const Jq={tokenize:Kq,partial:!0},KA="https://github.com/micromark/micromark-extension-mdxjs-esm",Hq=new Set(["ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ImportDeclaration"]);function qq(t){const e={tokenize:r,concrete:!0};if(!t||!t.acorn||!t.acorn.parse)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");const n=t.acorn,i=Object.assign({ecmaVersion:2024,sourceType:"module"},t.acornOptions,{locations:!0});return{flow:{101:e,105:e}};function r(s,o,u){const c=this,h=c.parser.definedModuleSpecifiers||(c.parser.definedModuleSpecifiers=[]),m=this.events.length+1;let g="";return c.interrupt?u:y;function y(j){return c.now().column>1?u(j):(s.enter("mdxjsEsm"),s.enter("mdxjsEsmData"),s.consume(j),g+=String.fromCharCode(j),b)}function b(j){return bn(j)?(s.consume(j),g+=String.fromCharCode(j),b):(g==="import"||g==="export")&&j===32?(s.consume(j),v):u(j)}function v(j){return j===null||Te(j)?(s.exit("mdxjsEsmData"),E(j)):(s.consume(j),v)}function E(j){return j===null?M(j):Te(j)?s.check(Jq,M,T)(j):(s.enter("mdxjsEsmData"),v(j))}function T(j){return s.enter("lineEnding"),s.consume(j),s.exit("lineEnding"),E}function M(j){const F=KI(c.events.slice(m),{acorn:n,acornOptions:i,tokenTypes:["mdxjsEsmData"],prefix:h.length>0?"var "+h.join(",")+`
87
- `:""});if(F.error){if(j!==null&&F.swallow)return T(j);const V=new mt("Could not parse import/exports with acorn",{cause:F.error,place:{line:F.error.loc.line,column:F.error.loc.column+1,offset:F.error.pos},ruleId:"acorn",source:"micromark-extension-mdxjs-esm"});throw V.url=KA+"#could-not-parse-importexports-with-acorn",V}h.length>0&&F.estree.body.shift();let J=-1;for(;++J<F.estree.body.length;){const V=F.estree.body[J];if(!Hq.has(V.type)){const C=new mt("Unexpected `"+V.type+"` in code: only import/exports are supported",{place:mm(V),ruleId:"non-esm",source:"micromark-extension-mdxjs-esm"});throw C.url=KA+"#unexpected-type-in-code-only-importexports-are-supported",C}if(V.type==="ImportDeclaration"&&!c.interrupt){let C=-1;for(;++C<V.specifiers.length;){const L=V.specifiers[C];h.push(L.local.name)}}}return Object.assign(s.exit("mdxjsEsm"),t.addResult?{estree:F.estree}:void 0),o(j)}}}function Kq(t,e,n){return i;function i(r){return t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),t.attempt(Lu,e,n)}}function Gq(t){const e=Object.assign({acorn:Zt.extend(Sq()),acornOptions:{ecmaVersion:2024,sourceType:"module"},addResult:!0},t);return Kb([qq(e),_q(e),$q(e),Uq()])}const Yq={};function Xq(t){const e=this,n=t||Yq,i=e.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(Gq(n)),s.push(MH()),o.push(OH(n))}const Dh="__mdx_expr__:",Qq=new Set(["br","hr","img","input","meta","link","area","base","col","embed","source","track","wbr"]),Wq=km().use(bm),Zq=Xa("remarkMdx",()=>Xq);function eK(t){const e={};let n=!1;if(!Array.isArray(t))return{props:e,hasExpressions:n};for(const i of t)i.type==="mdxJsxAttribute"&&i.name&&(i.value===null||i.value===void 0?e[i.name]="true":typeof i.value=="string"?e[i.name]=i.value:i.value?.type==="mdxJsxAttributeValueExpression"&&(e[i.name]=`${Dh}${i.value.value}`,n=!0)),i.type==="mdxJsxExpressionAttribute"&&(n=!0);return{props:e,hasExpressions:n}}function tK(t){const e=[];for(const[n,i]of Object.entries(t))i.startsWith(Dh)?e.push({type:"mdxJsxAttribute",name:n,value:{type:"mdxJsxAttributeValueExpression",value:i.slice(Dh.length)}}):e.push({type:"mdxJsxAttribute",name:n,value:i});return e}function YI(t){if(!t||t.length===0)return"";const e=[];for(const n of t)if(n.type==="paragraph"){const i=gm(n.children??[]);e.push(i)}else if(n.type==="text")e.push(n.value??"");else if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement"){const i=n.name??"",r=(n.attributes??[]).map(o=>{if(o.type==="mdxJsxAttribute"&&o.name){if(typeof o.value=="string")return`${o.name}="${o.value}"`;if(o.value?.type==="mdxJsxAttributeValueExpression")return`${o.name}={${o.value.value}}`}return""}).filter(Boolean).join(" "),s=YI(n.children??[]);s?e.push(`<${i}${r?" "+r:""}>${s}</${i}>`):e.push(`<${i}${r?" "+r:""} />`)}else n.value&&e.push(n.value);return e.join(`
88
-
89
- `)}function gm(t){return t.map(e=>e.type==="text"?e.value??"":e.type==="strong"?`**${gm(e.children??[])}**`:e.type==="emphasis"?`*${gm(e.children??[])}*`:e.type==="inlineCode"?`\`${e.value??""}\``:e.type==="link"?`[${gm(e.children??[])}](${e.url??""})`:e.value??"").join("")}const XI=Kh("mdx_component",()=>({group:"block",atom:!0,isolating:!0,selectable:!0,draggable:!1,attrs:{componentName:{default:""},props:{default:"{}"},hasExpressions:{default:!1},children:{default:""}},toDOM:t=>{const e=document.createElement("div");return e.setAttribute("data-mdx-component",t.attrs.componentName),e.setAttribute("data-mdx-props",t.attrs.props),t.attrs.children&&e.setAttribute("data-mdx-children",t.attrs.children),t.attrs.hasExpressions&&e.setAttribute("data-mdx-expressions","true"),e.className="mdx-component-block",e.textContent=`<${t.attrs.componentName} />`,e},parseDOM:[{tag:"div[data-mdx-component]",getAttrs:t=>({componentName:t.getAttribute("data-mdx-component")||"",props:t.getAttribute("data-mdx-props")||"{}",children:t.getAttribute("data-mdx-children")||"",hasExpressions:t.getAttribute("data-mdx-expressions")==="true"})}],parseMarkdown:{match:t=>t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement",runner:(t,e,n)=>{const i=e.name;if(!i||Qq.has(i.toLowerCase()))return;const{props:r,hasExpressions:s}=eK(e.attributes),o=YI(e.children??[]);t.addNode(n,{componentName:i,props:JSON.stringify(r),hasExpressions:s,children:o})}},toMarkdown:{match:t=>t.type.name==="mdx_component",runner:(t,e)=>{const n=e.attrs.componentName,i=JSON.parse(e.attrs.props),r=e.attrs.children||"",s=tK(i);if(r.trim()){const o=Wq.parse(r);t.addNode("mdxJsxFlowElement",void 0,void 0,{name:n,attributes:s,children:o.children})}else t.addNode("mdxJsxFlowElement",void 0,void 0,{name:n,attributes:s,children:[]})}}})),GA=Je("insertMdxComponent",()=>t=>(e,n)=>{if(!t)return!1;const i=e.schema.nodes.mdx_component;if(!i)return!1;const r=i.create({componentName:t.componentName,props:JSON.stringify(t.props),hasExpressions:!1,children:t.children||""});if(n){const{from:s}=e.selection,o=e.tr.insert(s,r);n(o)}return!0}),nK=Kh("mdx_esm",()=>({group:"block",atom:!0,attrs:{value:{default:""}},toDOM:()=>{const t=document.createElement("span");return t.style.display="none",t},parseDOM:[],parseMarkdown:{match:t=>t.type==="mdxjsEsm",runner:(t,e,n)=>{t.addNode(n,{value:e.value??""})}},toMarkdown:{match:t=>t.type.name==="mdx_esm",runner:(t,e)=>{t.addNode("mdxjsEsm",void 0,void 0,{value:e.attrs.value})}}}));var iK=typeof global=="object"&&global&&global.Object===Object&&global,rK=typeof self=="object"&&self&&self.Object===Object&&self,QI=iK||rK||Function("return this")(),eg=QI.Symbol,WI=Object.prototype,sK=WI.hasOwnProperty,aK=WI.toString,Yc=eg?eg.toStringTag:void 0;function oK(t){var e=sK.call(t,Yc),n=t[Yc];try{t[Yc]=void 0;var i=!0}catch{}var r=aK.call(t);return i&&(e?t[Yc]=n:delete t[Yc]),r}var lK=Object.prototype,uK=lK.toString;function cK(t){return uK.call(t)}var fK="[object Null]",hK="[object Undefined]",YA=eg?eg.toStringTag:void 0;function pK(t){return t==null?t===void 0?hK:fK:YA&&YA in Object(t)?oK(t):cK(t)}function dK(t){return t!=null&&typeof t=="object"}var mK="[object Symbol]";function gK(t){return typeof t=="symbol"||dK(t)&&pK(t)==mK}var yK=/\s/;function xK(t){for(var e=t.length;e--&&yK.test(t.charAt(e)););return e}var bK=/^\s+/;function SK(t){return t&&t.slice(0,xK(t)+1).replace(bK,"")}function Ub(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var XA=NaN,kK=/^[-+]0x[0-9a-f]+$/i,vK=/^0b[01]+$/i,CK=/^0o[0-7]+$/i,wK=parseInt;function QA(t){if(typeof t=="number")return t;if(gK(t))return XA;if(Ub(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ub(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=SK(t);var n=vK.test(t);return n||CK.test(t)?wK(t.slice(2),n?2:8):kK.test(t)?XA:+t}var hx=function(){return QI.Date.now()},EK="Expected a function",NK=Math.max,AK=Math.min;function TK(t,e,n){var i,r,s,o,u,c,h=0,m=!1,g=!1,y=!0;if(typeof t!="function")throw new TypeError(EK);e=QA(e)||0,Ub(n)&&(m=!!n.leading,g="maxWait"in n,s=g?NK(QA(n.maxWait)||0,e):s,y="trailing"in n?!!n.trailing:y);function b(C){var L=i,q=r;return i=r=void 0,h=C,o=t.apply(q,L),o}function v(C){return h=C,u=setTimeout(M,e),m?b(C):o}function E(C){var L=C-c,q=C-h,re=e-L;return g?AK(re,s-q):re}function T(C){var L=C-c,q=C-h;return c===void 0||L>=e||L<0||g&&q>=s}function M(){var C=hx();if(T(C))return j(C);u=setTimeout(M,E(C))}function j(C){return u=void 0,y&&i?b(C):(i=r=void 0,o)}function F(){u!==void 0&&clearTimeout(u),h=0,i=c=r=u=void 0}function J(){return u===void 0?o:j(hx())}function V(){var C=hx(),L=T(C);if(i=arguments,r=this,c=C,L){if(u===void 0)return v(c);if(g)return clearTimeout(u),u=setTimeout(M,e),b(c)}return u===void 0&&(u=setTimeout(M,e)),o}return V.cancel=F,V.flush=J,V}var ZI=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=t=>(this.beforeMountedListeners.push(t),this),this.mounted=t=>(this.mountedListeners.push(t),this),this.updated=t=>(this.updatedListeners.push(t),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(t){return this.markdownUpdatedListeners.push(t),this}blur(t){return this.blurListeners.push(t),this}focus(t){return this.focusListeners.push(t),this}destroy(t){return this.destroyListeners.push(t),this}selectionUpdated(t){return this.selectionUpdatedListeners.push(t),this}},tg=st(new ZI,"listener"),MK=new fi("MILKDOWN_LISTENER"),iv=t=>(t.inject(tg,new ZI),async()=>{await t.wait(Uo);const{listeners:e}=t.get(tg);e.beforeMount.forEach(h=>h(t)),await t.wait(Yf);const n=t.get(Wd);let i=null,r=null,s=null,o=null;const u=TK(()=>{if(!o)return;const{doc:h}=o;if(e.updated.length>0&&i&&!i.eq(h)&&e.updated.forEach(m=>{m(t,h,i)}),e.markdownUpdated.length>0&&i&&!i.eq(h)){const m=n(h);e.markdownUpdated.forEach(g=>{g(t,m,r)}),r=m}i=h,o=null},200),c=new ci({key:MK,view:()=>({destroy:()=>{e.destroy.forEach(h=>h(t))}}),props:{handleDOMEvents:{focus:()=>(e.focus.forEach(h=>h(t)),!1),blur:()=>(e.blur.forEach(h=>h(t)),!1)}},state:{init:(h,m)=>{i=m.doc,r=n(m.doc)},apply:h=>{const m=h.selection;(!s&&m||s&&!m.eq(s))&&(e.selectionUpdated.forEach(g=>{g(t,m,s)}),s=m),!(!(h.docChanged||h.storedMarksSet)||h.getMeta("addToHistory")===!1)&&(o=h,u())}}});t.update(Ds,h=>h.concat(c)),await t.wait(nm),e.mounted.forEach(h=>h(t))});iv.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const OK={border:"1px solid #e4e4e7",borderRadius:6,background:"#fff"},RK={padding:"6px 10px",minHeight:60,fontSize:13,lineHeight:1.5,outline:"none"};function DK({value:t,onChange:e}){const n=fe.useRef(null),i=fe.useRef(null),[r,s]=fe.useState(null),o=fe.useRef(t),u=fe.useRef(!1),c=fe.useRef(e);return c.current=e,fe.useEffect(()=>{const h=n.current;if(!h)return;let m=!1;return(async()=>{const y=await u3.make().config(b=>{b.set(Qf,h),b.set(Xf,o.current),b.get(tg).markdownUpdated((v,E)=>{o.current=E})}).use(X3).use(rI).use(iv).create();if(m){y.destroy();return}i.current=y,s(y)})(),()=>{m=!0,i.current?.destroy(),i.current=null,s(null)}},[]),fe.useEffect(()=>{!i.current||u.current||t!==o.current&&(i.current.action(f3(t)),o.current=t)},[t]),_.jsxs("div",{style:OK,children:[_.jsx(oI,{editor:r}),_.jsx("div",{ref:n,style:RK,onFocusCapture:()=>{u.current=!0},onBlurCapture:()=>{u.current=!1,o.current!==t&&c.current(o.current)}})]})}const IK={number:"number",url:"url",date:"date",datetime:"datetime-local",time:"time",email:"email",tel:"tel"};function _K(t){return t!==""&&/^(https?:\/\/|\/|\.\/)/.test(t)}const zK={border:"1px solid #d4d4d8",borderRadius:8,background:"#fafafa",margin:"8px 0",fontSize:13},LK={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"6px 10px",borderBottom:"1px solid #ececed",background:"#f1f1f3",borderTopLeftRadius:8,borderTopRightRadius:8},BK={fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},VK={padding:"8px 10px",display:"flex",flexDirection:"column",gap:8},WA={fontSize:11,color:"#71717a",marginBottom:2},ym={width:"100%",boxSizing:"border-box",border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 6px",font:"inherit",background:"#fff"},rh={...ym,background:"#f4f4f5",color:"#71717a"},ZA={fontSize:10,color:"#a16207",background:"#fef9c3",borderRadius:3,padding:"0 4px",marginLeft:6},FK={border:"none",background:"transparent",color:"#a1a1aa",cursor:"pointer",fontSize:16,lineHeight:1,padding:2},PK={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"};function jK({name:t,value:e,propType:n,editable:i,hasMedia:r,onChange:s,onBrowse:o}){if(n==="boolean")return _.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[_.jsx("input",{type:"checkbox",checked:e==="true",disabled:!i,onChange:c=>s(c.target.checked?"true":"false")}),_.jsx("span",{style:{color:"#52525b"},children:e==="true"?"Yes":"No"})]});if(n==="image")return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[_K(e)?_.jsx("img",{src:e,alt:"",style:{maxHeight:96,maxWidth:"100%",objectFit:"contain",borderRadius:4,alignSelf:"flex-start"}}):null,_.jsxs("div",{style:{display:"flex",gap:6},children:[_.jsx("input",{style:i?ym:rh,value:e,readOnly:!i,placeholder:"Image URL or path",onChange:i?c=>s(c.target.value):void 0}),i&&r?_.jsx("button",{type:"button",style:PK,"data-mdx-action":"props",onClick:o,children:"Browse"}):null]})]});if(n==="color")return _.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[_.jsx("input",{type:"color",value:e||"#000000",disabled:!i,onChange:c=>s(c.target.value),style:{width:30,height:28,padding:0,border:"1px solid #d4d4d8",borderRadius:4,background:"transparent",cursor:i?"pointer":"default"}}),_.jsx("input",{style:i?ym:rh,value:e,readOnly:!i,placeholder:"#000000",onChange:i?c=>s(c.target.value):void 0})]});const u=IK[n]??"text";return _.jsx("input",{type:u,style:i?ym:rh,value:e,readOnly:!i,placeholder:`Enter ${t}…`,onChange:i?c=>s(c.target.value):void 0})}function $K({componentName:t,props:e,hasExpressions:n,slotContent:i,definition:r,media:s,mediaContext:o,onRemove:u,onSlotContentChange:c,onPropsChange:h}){const m=r?.slots?.includes("default")??!!c,g=Object.entries(e),[y,b]=fe.useState(null),v=fe.useMemo(()=>{const T=new Map;for(const M of r?.props??[])T.set(M.name,M);return T},[r]),E=(T,M)=>{h&&h({...e,[T]:M})};return _.jsxs("div",{style:zK,"data-cms-ui":"",contentEditable:!1,children:[_.jsxs("div",{style:LK,children:[_.jsxs("span",{style:BK,children:[`<${t} />`,n?_.jsx("span",{style:ZA,children:"expr · read-only"}):null]}),_.jsx("button",{type:"button",style:FK,title:"Remove block","data-mdx-action":"remove",onClick:u,children:"×"})]}),_.jsxs("div",{style:VK,children:[m?_.jsxs("div",{"data-mdx-action":"children",children:[_.jsx("div",{style:WA,children:"Content"}),c?_.jsx(DK,{value:i,onChange:c}):_.jsx("div",{style:{...rh,whiteSpace:"pre-wrap",minHeight:40},children:i})]}):null,g.length===0&&!m?_.jsx("div",{style:{color:"#a1a1aa",fontSize:12},children:"No props"}):null,g.map(([T,M])=>{const j=M.startsWith(Dh),F=!!h&&!j,J=v.get(T),V=(J?.type??"").toLowerCase();return _.jsxs("div",{style:{display:"block"},"data-mdx-action":"props",children:[_.jsxs("div",{style:WA,children:[T,J?.required?_.jsx("span",{style:{color:"#dc2626"},children:"*"}):null,j?_.jsx("span",{style:ZA,children:"expression"}):null]}),j?_.jsx("input",{style:rh,value:`{${M.slice(Dh.length)}}`,readOnly:!0}):_.jsx(jK,{name:T,value:M,propType:V,editable:F,hasMedia:!!s,onChange:C=>E(T,C),onBrowse:()=>b(T)})]},T)})]}),y!==null&&s?_.jsx(sI,{media:s,context:o,field:y,accept:"image/*",onSelect:T=>{E(y,T),b(null)},onClose:()=>b(null)}):null]})}var px={exports:{}},Xc={},dx={exports:{}},mx={};var eT;function UK(){return eT||(eT=1,(function(t){function e(W,oe){var de=W.length;W.push(oe);e:for(;0<de;){var ve=de-1>>>1,D=W[ve];if(0<r(D,oe))W[ve]=oe,W[de]=D,de=ve;else break e}}function n(W){return W.length===0?null:W[0]}function i(W){if(W.length===0)return null;var oe=W[0],de=W.pop();if(de!==oe){W[0]=de;e:for(var ve=0,D=W.length,P=D>>>1;ve<P;){var ne=2*(ve+1)-1,B=W[ne],be=ne+1,Re=W[be];if(0>r(B,de))be<D&&0>r(Re,B)?(W[ve]=Re,W[be]=de,ve=be):(W[ve]=B,W[ne]=de,ve=ne);else if(be<D&&0>r(Re,de))W[ve]=Re,W[be]=de,ve=be;else break e}}return oe}function r(W,oe){var de=W.sortIndex-oe.sortIndex;return de!==0?de:W.id-oe.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,u=o.now();t.unstable_now=function(){return o.now()-u}}var c=[],h=[],m=1,g=null,y=3,b=!1,v=!1,E=!1,T=!1,M=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function J(W){for(var oe=n(h);oe!==null;){if(oe.callback===null)i(h);else if(oe.startTime<=W)i(h),oe.sortIndex=oe.expirationTime,e(c,oe);else break;oe=n(h)}}function V(W){if(E=!1,J(W),!v)if(n(c)!==null)v=!0,C||(C=!0,he());else{var oe=n(h);oe!==null&&De(V,oe.startTime-W)}}var C=!1,L=-1,q=5,re=-1;function K(){return T?!0:!(t.unstable_now()-re<q)}function pe(){if(T=!1,C){var W=t.unstable_now();re=W;var oe=!0;try{e:{v=!1,E&&(E=!1,j(L),L=-1),b=!0;var de=y;try{t:{for(J(W),g=n(c);g!==null&&!(g.expirationTime>W&&K());){var ve=g.callback;if(typeof ve=="function"){g.callback=null,y=g.priorityLevel;var D=ve(g.expirationTime<=W);if(W=t.unstable_now(),typeof D=="function"){g.callback=D,J(W),oe=!0;break t}g===n(c)&&i(c),J(W)}else i(c);g=n(c)}if(g!==null)oe=!0;else{var P=n(h);P!==null&&De(V,P.startTime-W),oe=!1}}break e}finally{g=null,y=de,b=!1}oe=void 0}}finally{oe?he():C=!1}}}var he;if(typeof F=="function")he=function(){F(pe)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,Ie=ke.port2;ke.port1.onmessage=pe,he=function(){Ie.postMessage(null)}}else he=function(){M(pe,0)};function De(W,oe){L=M(function(){W(t.unstable_now())},oe)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(W){W.callback=null},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(W){switch(y){case 1:case 2:case 3:var oe=3;break;default:oe=y}var de=y;y=oe;try{return W()}finally{y=de}},t.unstable_requestPaint=function(){T=!0},t.unstable_runWithPriority=function(W,oe){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var de=y;y=W;try{return oe()}finally{y=de}},t.unstable_scheduleCallback=function(W,oe,de){var ve=t.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ve+de:ve):de=ve,W){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=de+D,W={id:m++,callback:oe,priorityLevel:W,startTime:de,expirationTime:D,sortIndex:-1},de>ve?(W.sortIndex=de,e(h,W),n(c)===null&&W===n(h)&&(E?(j(L),L=-1):E=!0,De(V,de-ve))):(W.sortIndex=D,e(c,W),v||b||(v=!0,C||(C=!0,he()))),W},t.unstable_shouldYield=K,t.unstable_wrapCallback=function(W){var oe=y;return function(){var de=y;y=oe;try{return W.apply(this,arguments)}finally{y=de}}}})(mx)),mx}var tT;function JK(){return tT||(tT=1,dx.exports=UK()),dx.exports}var gx={exports:{}},gn={};var nT;function HK(){if(nT)return gn;nT=1;var t=Hb();function e(c){var h="https://react.dev/errors/"+c;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)h+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+c+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function s(c,h,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:c,containerInfo:h,implementation:m}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(c,h){if(c==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,gn.createPortal=function(c,h){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return s(c,h,null,m)},gn.flushSync=function(c){var h=o.T,m=i.p;try{if(o.T=null,i.p=2,c)return c()}finally{o.T=h,i.p=m,i.d.f()}},gn.preconnect=function(c,h){typeof c=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(c,h))},gn.prefetchDNS=function(c){typeof c=="string"&&i.d.D(c)},gn.preinit=function(c,h){if(typeof c=="string"&&h&&typeof h.as=="string"){var m=h.as,g=u(m,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;m==="style"?i.d.S(c,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:b}):m==="script"&&i.d.X(c,{crossOrigin:g,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},gn.preinitModule=function(c,h){if(typeof c=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var m=u(h.as,h.crossOrigin);i.d.M(c,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(c)},gn.preload=function(c,h){if(typeof c=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var m=h.as,g=u(m,h.crossOrigin);i.d.L(c,m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},gn.preloadModule=function(c,h){if(typeof c=="string")if(h){var m=u(h.as,h.crossOrigin);i.d.m(c,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(c)},gn.requestFormReset=function(c){i.d.r(c)},gn.unstable_batchedUpdates=function(c,h){return c(h)},gn.useFormState=function(c,h,m){return o.H.useFormState(c,h,m)},gn.useFormStatus=function(){return o.H.useHostTransitionStatus()},gn.version="19.2.7",gn}var iT;function qK(){if(iT)return gx.exports;iT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),gx.exports=HK(),gx.exports}var rT;function KK(){if(rT)return Xc;rT=1;var t=JK(),e=Hb(),n=qK();function i(a){var l="https://react.dev/errors/"+a;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)l+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function s(a){var l=a,f=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(f=l.return),a=l.return;while(a)}return l.tag===3?f:null}function o(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function u(a){if(a.tag===31){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function c(a){if(s(a)!==a)throw Error(i(188))}function h(a){var l=a.alternate;if(!l){if(l=s(a),l===null)throw Error(i(188));return l!==a?null:a}for(var f=a,d=l;;){var x=f.return;if(x===null)break;var k=x.alternate;if(k===null){if(d=x.return,d!==null){f=d;continue}break}if(x.child===k.child){for(k=x.child;k;){if(k===f)return c(x),a;if(k===d)return c(x),l;k=k.sibling}throw Error(i(188))}if(f.return!==d.return)f=x,d=k;else{for(var N=!1,R=x.child;R;){if(R===f){N=!0,f=x,d=k;break}if(R===d){N=!0,d=x,f=k;break}R=R.sibling}if(!N){for(R=k.child;R;){if(R===f){N=!0,f=k,d=x;break}if(R===d){N=!0,d=k,f=x;break}R=R.sibling}if(!N)throw Error(i(189))}}if(f.alternate!==d)throw Error(i(190))}if(f.tag!==3)throw Error(i(188));return f.stateNode.current===f?a:l}function m(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a;for(a=a.child;a!==null;){if(l=m(a),l!==null)return l;a=a.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),F=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function he(a){return a===null||typeof a!="object"?null:(a=pe&&a[pe]||a["@@iterator"],typeof a=="function"?a:null)}var ke=Symbol.for("react.client.reference");function Ie(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===ke?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case E:return"Fragment";case M:return"Profiler";case T:return"StrictMode";case V:return"Suspense";case C:return"SuspenseList";case re:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case v:return"Portal";case F:return a.displayName||"Context";case j:return(a._context.displayName||"Context")+".Consumer";case J:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case L:return l=a.displayName||null,l!==null?l:Ie(a.type)||"Memo";case q:l=a._payload,a=a._init;try{return Ie(a(l))}catch{}}return null}var De=Array.isArray,W=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},ve=[],D=-1;function P(a){return{current:a}}function ne(a){0>D||(a.current=ve[D],ve[D]=null,D--)}function B(a,l){D++,ve[D]=a.current,a.current=l}var be=P(null),Re=P(null),Me=P(null),Xe=P(null);function Ct(a,l){switch(B(Me,l),B(Re,a),B(be,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?t2(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=t2(l),a=n2(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}ne(be),B(be,a)}function Qe(){ne(be),ne(Re),ne(Me)}function zt(a){a.memoizedState!==null&&B(Xe,a);var l=be.current,f=n2(l,a.type);l!==f&&(B(Re,a),B(be,f))}function Lt(a){Re.current===a&&(ne(be),ne(Re)),Xe.current===a&&(ne(Xe),Pc._currentValue=de)}var Tr,ur;function Xn(a){if(Tr===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);Tr=l&&l[1]||"",ur=-1<f.stack.indexOf(`
90
- at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
91
- `+Tr+a+ur}var pi=!1;function Mi(a,l){if(!a||pi)return"";pi=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(l){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(ie){var te=ie}Reflect.construct(a,[],ce)}else{try{ce.call()}catch(ie){te=ie}a.call(ce.prototype)}}else{try{throw Error()}catch(ie){te=ie}(ce=a())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(ie){if(ie&&te&&typeof ie.stack=="string")return[ie.stack,te.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=d.DetermineComponentFrameRoot(),N=k[0],R=k[1];if(N&&R){var $=N.split(`
92
- `),ee=R.split(`
93
- `);for(x=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;x<ee.length&&!ee[x].includes("DetermineComponentFrameRoot");)x++;if(d===$.length||x===ee.length)for(d=$.length-1,x=ee.length-1;1<=d&&0<=x&&$[d]!==ee[x];)x--;for(;1<=d&&0<=x;d--,x--)if($[d]!==ee[x]){if(d!==1||x!==1)do if(d--,x--,0>x||$[d]!==ee[x]){var se=`
94
- `+$[d].replace(" at new "," at ");return a.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",a.displayName)),se}while(1<=d&&0<=x);break}}}finally{pi=!1,Error.prepareStackTrace=f}return(f=a?a.displayName||a.name:"")?Xn(f):""}function Qn(a,l){switch(a.tag){case 26:case 27:case 5:return Xn(a.type);case 16:return Xn("Lazy");case 13:return a.child!==l&&l!==null?Xn("Suspense Fallback"):Xn("Suspense");case 19:return Xn("SuspenseList");case 0:case 15:return Mi(a.type,!1);case 11:return Mi(a.type.render,!1);case 1:return Mi(a.type,!0);case 31:return Xn("Activity");default:return""}}function di(a){try{var l="",f=null;do l+=Qn(a,f),f=a,a=a.return;while(a);return l}catch(d){return`
95
- Error generating stack: `+d.message+`
96
- `+d.stack}}var cr=Object.prototype.hasOwnProperty,On=t.unstable_scheduleCallback,Oi=t.unstable_cancelCallback,Mr=t.unstable_shouldYield,Ri=t.unstable_requestPaint,$e=t.unstable_now,Xr=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,me=t.unstable_UserBlockingPriority,I=t.unstable_NormalPriority,_e=t.unstable_LowPriority,Pe=t.unstable_IdlePriority,tn=t.log,Wn=t.unstable_setDisableYieldValue,Se=null,_t=null;function mn(a){if(typeof tn=="function"&&Wn(a),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(Se,a)}catch{}}var St=Math.clz32?Math.clz32:fp,Zn=Math.log,Rn=Math.LN2;function fp(a){return a>>>=0,a===0?32:31-(Zn(a)/Rn|0)|0}var yl=256,Qr=262144,sn=4194304;function Jt(a){var l=a&42;if(l!==0)return l;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function gt(a,l,f){var d=a.pendingLanes;if(d===0)return 0;var x=0,k=a.suspendedLanes,N=a.pingedLanes;a=a.warmLanes;var R=d&134217727;return R!==0?(d=R&~k,d!==0?x=Jt(d):(N&=R,N!==0?x=Jt(N):f||(f=R&~a,f!==0&&(x=Jt(f))))):(R=d&~k,R!==0?x=Jt(R):N!==0?x=Jt(N):f||(f=d&~a,f!==0&&(x=Jt(f)))),x===0?0:l!==0&&l!==x&&(l&k)===0&&(k=x&-x,f=l&-l,k>=f||k===32&&(f&4194048)!==0)?l:x}function Di(a,l){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&l)===0}function je(a,l){switch(a){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xu(){var a=sn;return sn<<=1,(sn&62914560)===0&&(sn=4194304),a}function to(a){for(var l=[],f=0;31>f;f++)l.push(a);return l}function no(a,l){a.pendingLanes|=l,l!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function xl(a,l,f,d,x,k){var N=a.pendingLanes;a.pendingLanes=f,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=f,a.entangledLanes&=f,a.errorRecoveryDisabledLanes&=f,a.shellSuspendCounter=0;var R=a.entanglements,$=a.expirationTimes,ee=a.hiddenUpdates;for(f=N&~f;0<f;){var se=31-St(f),ce=1<<se;R[se]=0,$[se]=-1;var te=ee[se];if(te!==null)for(ee[se]=null,se=0;se<te.length;se++){var ie=te[se];ie!==null&&(ie.lane&=-536870913)}f&=~ce}d!==0&&fr(a,d,0),k!==0&&x===0&&a.tag!==0&&(a.suspendedLanes|=k&~(N&~l))}function fr(a,l,f){a.pendingLanes|=l,a.suspendedLanes&=~l;var d=31-St(l);a.entangledLanes|=l,a.entanglements[d]=a.entanglements[d]|1073741824|f&261930}function hp(a,l){var f=a.entangledLanes|=l;for(a=a.entanglements;f;){var d=31-St(f),x=1<<d;x&l|a[d]&l&&(a[d]|=l),f&=~x}}function Us(a,l){var f=l&-l;return f=(f&42)!==0?1:Wr(f),(f&(a.suspendedLanes|l))!==0?0:f}function Wr(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function bl(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function pp(){var a=oe.p;return a!==0?a:(a=window.event,a===void 0?32:E2(a.type))}function Qu(a,l){var f=oe.p;try{return oe.p=a,l()}finally{oe.p=f}}var hr=Math.random().toString(36).slice(2),Ht="__reactFiber$"+hr,an="__reactProps$"+hr,Zr="__reactContainer$"+hr,Wu="__reactEvents$"+hr,Hg="__reactListeners$"+hr,qg="__reactHandles$"+hr,dp="__reactResources$"+hr,Js="__reactMarker$"+hr;function Sl(a){delete a[Ht],delete a[an],delete a[Wu],delete a[Hg],delete a[qg]}function es(a){var l=a[Ht];if(l)return l;for(var f=a.parentNode;f;){if(l=f[Zr]||f[Ht]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(a=u2(a);a!==null;){if(f=a[Ht])return f;a=u2(a)}return l}a=f,f=a.parentNode}return null}function ts(a){if(a=a[Ht]||a[Zr]){var l=a.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return a}return null}function Hs(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a.stateNode;throw Error(i(33))}function ns(a){var l=a[dp];return l||(l=a[dp]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function qt(a){a[Js]=!0}var mp=new Set,Zu={};function is(a,l){Or(a,l),Or(a+"Capture",l)}function Or(a,l){for(Zu[a]=l,a=0;a<l.length;a++)mp.add(l[a])}var gp=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),yp={},Ce={};function kl(a){return cr.call(Ce,a)?!0:cr.call(yp,a)?!1:gp.test(a)?Ce[a]=!0:(yp[a]=!0,!1)}function Dn(a,l,f){if(kl(l))if(f===null)a.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":a.removeAttribute(l);return;case"boolean":var d=l.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){a.removeAttribute(l);return}}a.setAttribute(l,""+f)}}function vl(a,l,f){if(f===null)a.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(l);return}a.setAttribute(l,""+f)}}function pr(a,l,f,d){if(d===null)a.removeAttribute(f);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(f);return}a.setAttributeNS(l,f,""+d)}}function In(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function xp(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Kg(a,l,f){var d=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);if(!a.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var x=d.get,k=d.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return x.call(this)},set:function(N){f=""+N,k.call(this,N)}}),Object.defineProperty(a,l,{enumerable:d.enumerable}),{getValue:function(){return f},setValue:function(N){f=""+N},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function Cl(a){if(!a._valueTracker){var l=xp(a)?"checked":"value";a._valueTracker=Kg(a,l,""+a[l])}}function bp(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var f=l.getValue(),d="";return a&&(d=xp(a)?a.checked?"true":"false":a.value),a=d,a!==f?(l.setValue(a),!0):!1}function io(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var dr=/[\n"\\]/g;function Tt(a){return a.replace(dr,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ec(a,l,f,d,x,k,N,R){a.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?a.type=N:a.removeAttribute("type"),l!=null?N==="number"?(l===0&&a.value===""||a.value!=l)&&(a.value=""+In(l)):a.value!==""+In(l)&&(a.value=""+In(l)):N!=="submit"&&N!=="reset"||a.removeAttribute("value"),l!=null?nc(a,N,In(l)):f!=null?nc(a,N,In(f)):d!=null&&a.removeAttribute("value"),x==null&&k!=null&&(a.defaultChecked=!!k),x!=null&&(a.checked=x&&typeof x!="function"&&typeof x!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?a.name=""+In(R):a.removeAttribute("name")}function tc(a,l,f,d,x,k,N,R){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(a.type=k),l!=null||f!=null){if(!(k!=="submit"&&k!=="reset"||l!=null)){Cl(a);return}f=f!=null?""+In(f):"",l=l!=null?""+In(l):f,R||l===a.value||(a.value=l),a.defaultValue=l}d=d??x,d=typeof d!="function"&&typeof d!="symbol"&&!!d,a.checked=R?a.checked:!!d,a.defaultChecked=!!d,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(a.name=N),Cl(a)}function nc(a,l,f){l==="number"&&io(a.ownerDocument)===a||a.defaultValue===""+f||(a.defaultValue=""+f)}function qs(a,l,f,d){if(a=a.options,l){l={};for(var x=0;x<f.length;x++)l["$"+f[x]]=!0;for(f=0;f<a.length;f++)x=l.hasOwnProperty("$"+a[f].value),a[f].selected!==x&&(a[f].selected=x),x&&d&&(a[f].defaultSelected=!0)}else{for(f=""+In(f),l=null,x=0;x<a.length;x++){if(a[x].value===f){a[x].selected=!0,d&&(a[x].defaultSelected=!0);return}l!==null||a[x].disabled||(l=a[x])}l!==null&&(l.selected=!0)}}function Sp(a,l,f){if(l!=null&&(l=""+In(l),l!==a.value&&(a.value=l),f==null)){a.defaultValue!==l&&(a.defaultValue=l);return}a.defaultValue=f!=null?""+In(f):""}function kp(a,l,f,d){if(l==null){if(d!=null){if(f!=null)throw Error(i(92));if(De(d)){if(1<d.length)throw Error(i(93));d=d[0]}f=d}f==null&&(f=""),l=f}f=In(l),a.defaultValue=f,d=a.textContent,d===f&&d!==""&&d!==null&&(a.value=d),Cl(a)}function mr(a,l){if(l){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=l;return}}a.textContent=l}var vp=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ic(a,l,f){var d=l.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?d?a.setProperty(l,""):l==="float"?a.cssFloat="":a[l]="":d?a.setProperty(l,f):typeof f!="number"||f===0||vp.has(l)?l==="float"?a.cssFloat=f:a[l]=(""+f).trim():a[l]=f+"px"}function rc(a,l,f){if(l!=null&&typeof l!="object")throw Error(i(62));if(a=a.style,f!=null){for(var d in f)!f.hasOwnProperty(d)||l!=null&&l.hasOwnProperty(d)||(d.indexOf("--")===0?a.setProperty(d,""):d==="float"?a.cssFloat="":a[d]="");for(var x in l)d=l[x],l.hasOwnProperty(x)&&f[x]!==d&&ic(a,x,d)}else for(var k in l)l.hasOwnProperty(k)&&ic(a,k,l[k])}function Ks(a){if(a.indexOf("-")===-1)return!1;switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var We=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Gg=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ro(a){return Gg.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function Ii(){}var wl=null;function sc(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Gs=null,Ys=null;function p(a){var l=ts(a);if(l&&(a=l.stateNode)){var f=a[an]||null;e:switch(a=l.stateNode,l.type){case"input":if(ec(a,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),l=f.name,f.type==="radio"&&l!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+Tt(""+l)+'"][type="radio"]'),l=0;l<f.length;l++){var d=f[l];if(d!==a&&d.form===a.form){var x=d[an]||null;if(!x)throw Error(i(90));ec(d,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(l=0;l<f.length;l++)d=f[l],d.form===a.form&&bp(d)}break e;case"textarea":Sp(a,f.value,f.defaultValue);break e;case"select":l=f.value,l!=null&&qs(a,!!f.multiple,l,!1)}}}var S=!1;function w(a,l,f){if(S)return a(l,f);S=!0;try{var d=a(l);return d}finally{if(S=!1,(Gs!==null||Ys!==null)&&(sd(),Gs&&(l=Gs,a=Ys,Ys=Gs=null,p(l),a)))for(l=0;l<a.length;l++)p(a[l])}}function A(a,l){var f=a.stateNode;if(f===null)return null;var d=f[an]||null;if(d===null)return null;f=d[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(a=a.type,d=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!d;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(i(231,l,typeof f));return f}var z=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),X=!1;if(z)try{var Z={};Object.defineProperty(Z,"passive",{get:function(){X=!0}}),window.addEventListener("test",Z,Z),window.removeEventListener("test",Z,Z)}catch{X=!1}var ge=null,xe=null,Le=null;function qe(){if(Le)return Le;var a,l=xe,f=l.length,d,x="value"in ge?ge.value:ge.textContent,k=x.length;for(a=0;a<f&&l[a]===x[a];a++);var N=f-a;for(d=1;d<=N&&l[f-d]===x[k-d];d++);return Le=x.slice(a,1<d?1-d:void 0)}function yt(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function Ft(){return!0}function Xs(){return!1}function Pt(a){function l(f,d,x,k,N){this._reactName=f,this._targetInst=x,this.type=d,this.nativeEvent=k,this.target=N,this.currentTarget=null;for(var R in a)a.hasOwnProperty(R)&&(f=a[R],this[R]=f?f(k):k[R]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Ft:Xs,this.isPropagationStopped=Xs,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=Ft)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=Ft)},persist:function(){},isPersistent:Ft}),l}var _i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gr=Pt(_i),zi=g({},_i,{view:0,detail:0}),s_=Pt(zi),Yg,Xg,ac,Cp=g({},zi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wg,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==ac&&(ac&&a.type==="mousemove"?(Yg=a.screenX-ac.screenX,Xg=a.screenY-ac.screenY):Xg=Yg=0,ac=a),Yg)},movementY:function(a){return"movementY"in a?a.movementY:Xg}}),rv=Pt(Cp),a_=g({},Cp,{dataTransfer:0}),o_=Pt(a_),l_=g({},zi,{relatedTarget:0}),Qg=Pt(l_),u_=g({},_i,{animationName:0,elapsedTime:0,pseudoElement:0}),c_=Pt(u_),f_=g({},_i,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),h_=Pt(f_),p_=g({},_i,{data:0}),sv=Pt(p_),d_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},m_={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},g_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function y_(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=g_[a])?!!l[a]:!1}function Wg(){return y_}var x_=g({},zi,{key:function(a){if(a.key){var l=d_[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=yt(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?m_[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wg,charCode:function(a){return a.type==="keypress"?yt(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?yt(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),b_=Pt(x_),S_=g({},Cp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),av=Pt(S_),k_=g({},zi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wg}),v_=Pt(k_),C_=g({},_i,{propertyName:0,elapsedTime:0,pseudoElement:0}),w_=Pt(C_),E_=g({},Cp,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),N_=Pt(E_),A_=g({},_i,{newState:0,oldState:0}),T_=Pt(A_),M_=[9,13,27,32],Zg=z&&"CompositionEvent"in window,oc=null;z&&"documentMode"in document&&(oc=document.documentMode);var O_=z&&"TextEvent"in window&&!oc,ov=z&&(!Zg||oc&&8<oc&&11>=oc),lv=" ",uv=!1;function cv(a,l){switch(a){case"keyup":return M_.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fv(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var El=!1;function R_(a,l){switch(a){case"compositionend":return fv(l);case"keypress":return l.which!==32?null:(uv=!0,lv);case"textInput":return a=l.data,a===lv&&uv?null:a;default:return null}}function D_(a,l){if(El)return a==="compositionend"||!Zg&&cv(a,l)?(a=qe(),Le=xe=ge=null,El=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return ov&&l.locale!=="ko"?null:l.data;default:return null}}var I_={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hv(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!I_[a.type]:l==="textarea"}function pv(a,l,f,d){Gs?Ys?Ys.push(d):Ys=[d]:Gs=d,l=hd(l,"onChange"),0<l.length&&(f=new gr("onChange","change",null,f,d),a.push({event:f,listeners:l}))}var lc=null,uc=null;function __(a){Yw(a,0)}function wp(a){var l=Hs(a);if(bp(l))return a}function dv(a,l){if(a==="change")return l}var mv=!1;if(z){var e0;if(z){var t0="oninput"in document;if(!t0){var gv=document.createElement("div");gv.setAttribute("oninput","return;"),t0=typeof gv.oninput=="function"}e0=t0}else e0=!1;mv=e0&&(!document.documentMode||9<document.documentMode)}function yv(){lc&&(lc.detachEvent("onpropertychange",xv),uc=lc=null)}function xv(a){if(a.propertyName==="value"&&wp(uc)){var l=[];pv(l,uc,a,sc(a)),w(__,l)}}function z_(a,l,f){a==="focusin"?(yv(),lc=l,uc=f,lc.attachEvent("onpropertychange",xv)):a==="focusout"&&yv()}function L_(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return wp(uc)}function B_(a,l){if(a==="click")return wp(l)}function V_(a,l){if(a==="input"||a==="change")return wp(l)}function F_(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var mi=typeof Object.is=="function"?Object.is:F_;function cc(a,l){if(mi(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var f=Object.keys(a),d=Object.keys(l);if(f.length!==d.length)return!1;for(d=0;d<f.length;d++){var x=f[d];if(!cr.call(l,x)||!mi(a[x],l[x]))return!1}return!0}function bv(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Sv(a,l){var f=bv(a);a=0;for(var d;f;){if(f.nodeType===3){if(d=a+f.textContent.length,a<=l&&d>=l)return{node:f,offset:l-a};a=d}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=bv(f)}}function kv(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?kv(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function vv(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var l=io(a.document);l instanceof a.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)a=l.contentWindow;else break;l=io(a.document)}return l}function n0(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}var P_=z&&"documentMode"in document&&11>=document.documentMode,Nl=null,i0=null,fc=null,r0=!1;function Cv(a,l,f){var d=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;r0||Nl==null||Nl!==io(d)||(d=Nl,"selectionStart"in d&&n0(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),fc&&cc(fc,d)||(fc=d,d=hd(i0,"onSelect"),0<d.length&&(l=new gr("onSelect","select",null,l,f),a.push({event:l,listeners:d}),l.target=Nl)))}function so(a,l){var f={};return f[a.toLowerCase()]=l.toLowerCase(),f["Webkit"+a]="webkit"+l,f["Moz"+a]="moz"+l,f}var Al={animationend:so("Animation","AnimationEnd"),animationiteration:so("Animation","AnimationIteration"),animationstart:so("Animation","AnimationStart"),transitionrun:so("Transition","TransitionRun"),transitionstart:so("Transition","TransitionStart"),transitioncancel:so("Transition","TransitionCancel"),transitionend:so("Transition","TransitionEnd")},s0={},wv={};z&&(wv=document.createElement("div").style,"AnimationEvent"in window||(delete Al.animationend.animation,delete Al.animationiteration.animation,delete Al.animationstart.animation),"TransitionEvent"in window||delete Al.transitionend.transition);function ao(a){if(s0[a])return s0[a];if(!Al[a])return a;var l=Al[a],f;for(f in l)if(l.hasOwnProperty(f)&&f in wv)return s0[a]=l[f];return a}var Ev=ao("animationend"),Nv=ao("animationiteration"),Av=ao("animationstart"),j_=ao("transitionrun"),$_=ao("transitionstart"),U_=ao("transitioncancel"),Tv=ao("transitionend"),Mv=new Map,a0="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");a0.push("scrollEnd");function yr(a,l){Mv.set(a,l),is(l,[a])}var Ep=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Li=[],Tl=0,o0=0;function Np(){for(var a=Tl,l=o0=Tl=0;l<a;){var f=Li[l];Li[l++]=null;var d=Li[l];Li[l++]=null;var x=Li[l];Li[l++]=null;var k=Li[l];if(Li[l++]=null,d!==null&&x!==null){var N=d.pending;N===null?x.next=x:(x.next=N.next,N.next=x),d.pending=x}k!==0&&Ov(f,x,k)}}function Ap(a,l,f,d){Li[Tl++]=a,Li[Tl++]=l,Li[Tl++]=f,Li[Tl++]=d,o0|=d,a.lanes|=d,a=a.alternate,a!==null&&(a.lanes|=d)}function l0(a,l,f,d){return Ap(a,l,f,d),Tp(a)}function oo(a,l){return Ap(a,null,null,l),Tp(a)}function Ov(a,l,f){a.lanes|=f;var d=a.alternate;d!==null&&(d.lanes|=f);for(var x=!1,k=a.return;k!==null;)k.childLanes|=f,d=k.alternate,d!==null&&(d.childLanes|=f),k.tag===22&&(a=k.stateNode,a===null||a._visibility&1||(x=!0)),a=k,k=k.return;return a.tag===3?(k=a.stateNode,x&&l!==null&&(x=31-St(f),a=k.hiddenUpdates,d=a[x],d===null?a[x]=[l]:d.push(l),l.lane=f|536870912),k):null}function Tp(a){if(50<Ic)throw Ic=0,yy=null,Error(i(185));for(var l=a.return;l!==null;)a=l,l=a.return;return a.tag===3?a.stateNode:null}var Ml={};function J_(a,l,f,d){this.tag=a,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gi(a,l,f,d){return new J_(a,l,f,d)}function u0(a){return a=a.prototype,!(!a||!a.isReactComponent)}function rs(a,l){var f=a.alternate;return f===null?(f=gi(a.tag,l,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=l,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&65011712,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,l=a.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f.refCleanup=a.refCleanup,f}function Rv(a,l){a.flags&=65011714;var f=a.alternate;return f===null?(a.childLanes=0,a.lanes=l,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=f.childLanes,a.lanes=f.lanes,a.child=f.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=f.memoizedProps,a.memoizedState=f.memoizedState,a.updateQueue=f.updateQueue,a.type=f.type,l=f.dependencies,a.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),a}function Mp(a,l,f,d,x,k){var N=0;if(d=a,typeof a=="function")u0(a)&&(N=1);else if(typeof a=="string")N=Y6(a,f,be.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case re:return a=gi(31,f,l,x),a.elementType=re,a.lanes=k,a;case E:return lo(f.children,x,k,l);case T:N=8,x|=24;break;case M:return a=gi(12,f,l,x|2),a.elementType=M,a.lanes=k,a;case V:return a=gi(13,f,l,x),a.elementType=V,a.lanes=k,a;case C:return a=gi(19,f,l,x),a.elementType=C,a.lanes=k,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case F:N=10;break e;case j:N=9;break e;case J:N=11;break e;case L:N=14;break e;case q:N=16,d=null;break e}N=29,f=Error(i(130,a===null?"null":typeof a,"")),d=null}return l=gi(N,f,l,x),l.elementType=a,l.type=d,l.lanes=k,l}function lo(a,l,f,d){return a=gi(7,a,d,l),a.lanes=f,a}function c0(a,l,f){return a=gi(6,a,null,l),a.lanes=f,a}function Dv(a){var l=gi(18,null,null,0);return l.stateNode=a,l}function f0(a,l,f){return l=gi(4,a.children!==null?a.children:[],a.key,l),l.lanes=f,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}var Iv=new WeakMap;function Bi(a,l){if(typeof a=="object"&&a!==null){var f=Iv.get(a);return f!==void 0?f:(l={value:a,source:l,stack:di(l)},Iv.set(a,l),l)}return{value:a,source:l,stack:di(l)}}var Ol=[],Rl=0,Op=null,hc=0,Vi=[],Fi=0,Qs=null,Rr=1,Dr="";function ss(a,l){Ol[Rl++]=hc,Ol[Rl++]=Op,Op=a,hc=l}function _v(a,l,f){Vi[Fi++]=Rr,Vi[Fi++]=Dr,Vi[Fi++]=Qs,Qs=a;var d=Rr;a=Dr;var x=32-St(d)-1;d&=~(1<<x),f+=1;var k=32-St(l)+x;if(30<k){var N=x-x%5;k=(d&(1<<N)-1).toString(32),d>>=N,x-=N,Rr=1<<32-St(l)+x|f<<x|d,Dr=k+a}else Rr=1<<k|f<<x|d,Dr=a}function h0(a){a.return!==null&&(ss(a,1),_v(a,1,0))}function p0(a){for(;a===Op;)Op=Ol[--Rl],Ol[Rl]=null,hc=Ol[--Rl],Ol[Rl]=null;for(;a===Qs;)Qs=Vi[--Fi],Vi[Fi]=null,Dr=Vi[--Fi],Vi[Fi]=null,Rr=Vi[--Fi],Vi[Fi]=null}function zv(a,l){Vi[Fi++]=Rr,Vi[Fi++]=Dr,Vi[Fi++]=Qs,Rr=l.id,Dr=l.overflow,Qs=a}var on=null,Mt=null,ot=!1,Ws=null,Pi=!1,d0=Error(i(519));function Zs(a){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pc(Bi(l,a)),d0}function Lv(a){var l=a.stateNode,f=a.type,d=a.memoizedProps;switch(l[Ht]=a,l[an]=d,f){case"dialog":tt("cancel",l),tt("close",l);break;case"iframe":case"object":case"embed":tt("load",l);break;case"video":case"audio":for(f=0;f<zc.length;f++)tt(zc[f],l);break;case"source":tt("error",l);break;case"img":case"image":case"link":tt("error",l),tt("load",l);break;case"details":tt("toggle",l);break;case"input":tt("invalid",l),tc(l,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":tt("invalid",l);break;case"textarea":tt("invalid",l),kp(l,d.value,d.defaultValue,d.children)}f=d.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||l.textContent===""+f||d.suppressHydrationWarning===!0||Zw(l.textContent,f)?(d.popover!=null&&(tt("beforetoggle",l),tt("toggle",l)),d.onScroll!=null&&tt("scroll",l),d.onScrollEnd!=null&&tt("scrollend",l),d.onClick!=null&&(l.onclick=Ii),l=!0):l=!1,l||Zs(a,!0)}function Bv(a){for(on=a.return;on;)switch(on.tag){case 5:case 31:case 13:Pi=!1;return;case 27:case 3:Pi=!0;return;default:on=on.return}}function Dl(a){if(a!==on)return!1;if(!ot)return Bv(a),ot=!0,!1;var l=a.tag,f;if((f=l!==3&&l!==27)&&((f=l===5)&&(f=a.type,f=!(f!=="form"&&f!=="button")||Dy(a.type,a.memoizedProps)),f=!f),f&&Mt&&Zs(a),Bv(a),l===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(i(317));Mt=l2(a)}else if(l===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(i(317));Mt=l2(a)}else l===27?(l=Mt,pa(a.type)?(a=By,By=null,Mt=a):Mt=l):Mt=on?$i(a.stateNode.nextSibling):null;return!0}function uo(){Mt=on=null,ot=!1}function m0(){var a=Ws;return a!==null&&(ii===null?ii=a:ii.push.apply(ii,a),Ws=null),a}function pc(a){Ws===null?Ws=[a]:Ws.push(a)}var g0=P(null),co=null,as=null;function ea(a,l,f){B(g0,l._currentValue),l._currentValue=f}function ls(a){a._currentValue=g0.current,ne(g0)}function y0(a,l,f){for(;a!==null;){var d=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,d!==null&&(d.childLanes|=l)):d!==null&&(d.childLanes&l)!==l&&(d.childLanes|=l),a===f)break;a=a.return}}function x0(a,l,f,d){var x=a.child;for(x!==null&&(x.return=a);x!==null;){var k=x.dependencies;if(k!==null){var N=x.child;k=k.firstContext;e:for(;k!==null;){var R=k;k=x;for(var $=0;$<l.length;$++)if(R.context===l[$]){k.lanes|=f,R=k.alternate,R!==null&&(R.lanes|=f),y0(k.return,f,a),d||(N=null);break e}k=R.next}}else if(x.tag===18){if(N=x.return,N===null)throw Error(i(341));N.lanes|=f,k=N.alternate,k!==null&&(k.lanes|=f),y0(N,f,a),N=null}else N=x.child;if(N!==null)N.return=x;else for(N=x;N!==null;){if(N===a){N=null;break}if(x=N.sibling,x!==null){x.return=N.return,N=x;break}N=N.return}x=N}}function Il(a,l,f,d){a=null;for(var x=l,k=!1;x!==null;){if(!k){if((x.flags&524288)!==0)k=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var N=x.alternate;if(N===null)throw Error(i(387));if(N=N.memoizedProps,N!==null){var R=x.type;mi(x.pendingProps.value,N.value)||(a!==null?a.push(R):a=[R])}}else if(x===Xe.current){if(N=x.alternate,N===null)throw Error(i(387));N.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(a!==null?a.push(Pc):a=[Pc])}x=x.return}a!==null&&x0(l,a,f,d),l.flags|=262144}function Rp(a){for(a=a.firstContext;a!==null;){if(!mi(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function fo(a){co=a,as=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function ln(a){return Vv(co,a)}function Dp(a,l){return co===null&&fo(a),Vv(a,l)}function Vv(a,l){var f=l._currentValue;if(l={context:l,memoizedValue:f,next:null},as===null){if(a===null)throw Error(i(308));as=l,a.dependencies={lanes:0,firstContext:l},a.flags|=524288}else as=as.next=l;return f}var H_=typeof AbortController<"u"?AbortController:function(){var a=[],l=this.signal={aborted:!1,addEventListener:function(f,d){a.push(d)}};this.abort=function(){l.aborted=!0,a.forEach(function(f){return f()})}},q_=t.unstable_scheduleCallback,K_=t.unstable_NormalPriority,Kt={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function b0(){return{controller:new H_,data:new Map,refCount:0}}function dc(a){a.refCount--,a.refCount===0&&q_(K_,function(){a.controller.abort()})}var mc=null,S0=0,_l=0,zl=null;function G_(a,l){if(mc===null){var f=mc=[];S0=0,_l=Cy(),zl={status:"pending",value:void 0,then:function(d){f.push(d)}}}return S0++,l.then(Fv,Fv),l}function Fv(){if(--S0===0&&mc!==null){zl!==null&&(zl.status="fulfilled");var a=mc;mc=null,_l=0,zl=null;for(var l=0;l<a.length;l++)(0,a[l])()}}function Y_(a,l){var f=[],d={status:"pending",value:null,reason:null,then:function(x){f.push(x)}};return a.then(function(){d.status="fulfilled",d.value=l;for(var x=0;x<f.length;x++)(0,f[x])(l)},function(x){for(d.status="rejected",d.reason=x,x=0;x<f.length;x++)(0,f[x])(void 0)}),d}var Pv=W.S;W.S=function(a,l){Cw=$e(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&G_(a,l),Pv!==null&&Pv(a,l)};var ho=P(null);function k0(){var a=ho.current;return a!==null?a:At.pooledCache}function Ip(a,l){l===null?B(ho,ho.current):B(ho,l.pool)}function jv(){var a=k0();return a===null?null:{parent:Kt._currentValue,pool:a}}var Ll=Error(i(460)),v0=Error(i(474)),_p=Error(i(542)),zp={then:function(){}};function $v(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Uv(a,l,f){switch(f=a[f],f===void 0?a.push(l):f!==l&&(l.then(Ii,Ii),l=f),l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Hv(a),a;default:if(typeof l.status=="string")l.then(Ii,Ii);else{if(a=At,a!==null&&100<a.shellSuspendCounter)throw Error(i(482));a=l,a.status="pending",a.then(function(d){if(l.status==="pending"){var x=l;x.status="fulfilled",x.value=d}},function(d){if(l.status==="pending"){var x=l;x.status="rejected",x.reason=d}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Hv(a),a}throw mo=l,Ll}}function po(a){try{var l=a._init;return l(a._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(mo=f,Ll):f}}var mo=null;function Jv(){if(mo===null)throw Error(i(459));var a=mo;return mo=null,a}function Hv(a){if(a===Ll||a===_p)throw Error(i(483))}var Bl=null,gc=0;function Lp(a){var l=gc;return gc+=1,Bl===null&&(Bl=[]),Uv(Bl,a,l)}function yc(a,l){l=l.props.ref,a.ref=l!==void 0?l:null}function Bp(a,l){throw l.$$typeof===y?Error(i(525)):(a=Object.prototype.toString.call(l),Error(i(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a)))}function qv(a){function l(Y,U){if(a){var Q=Y.deletions;Q===null?(Y.deletions=[U],Y.flags|=16):Q.push(U)}}function f(Y,U){if(!a)return null;for(;U!==null;)l(Y,U),U=U.sibling;return null}function d(Y){for(var U=new Map;Y!==null;)Y.key!==null?U.set(Y.key,Y):U.set(Y.index,Y),Y=Y.sibling;return U}function x(Y,U){return Y=rs(Y,U),Y.index=0,Y.sibling=null,Y}function k(Y,U,Q){return Y.index=Q,a?(Q=Y.alternate,Q!==null?(Q=Q.index,Q<U?(Y.flags|=67108866,U):Q):(Y.flags|=67108866,U)):(Y.flags|=1048576,U)}function N(Y){return a&&Y.alternate===null&&(Y.flags|=67108866),Y}function R(Y,U,Q,le){return U===null||U.tag!==6?(U=c0(Q,Y.mode,le),U.return=Y,U):(U=x(U,Q),U.return=Y,U)}function $(Y,U,Q,le){var ze=Q.type;return ze===E?se(Y,U,Q.props.children,le,Q.key):U!==null&&(U.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===q&&po(ze)===U.type)?(U=x(U,Q.props),yc(U,Q),U.return=Y,U):(U=Mp(Q.type,Q.key,Q.props,null,Y.mode,le),yc(U,Q),U.return=Y,U)}function ee(Y,U,Q,le){return U===null||U.tag!==4||U.stateNode.containerInfo!==Q.containerInfo||U.stateNode.implementation!==Q.implementation?(U=f0(Q,Y.mode,le),U.return=Y,U):(U=x(U,Q.children||[]),U.return=Y,U)}function se(Y,U,Q,le,ze){return U===null||U.tag!==7?(U=lo(Q,Y.mode,le,ze),U.return=Y,U):(U=x(U,Q),U.return=Y,U)}function ce(Y,U,Q){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=c0(""+U,Y.mode,Q),U.return=Y,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case b:return Q=Mp(U.type,U.key,U.props,null,Y.mode,Q),yc(Q,U),Q.return=Y,Q;case v:return U=f0(U,Y.mode,Q),U.return=Y,U;case q:return U=po(U),ce(Y,U,Q)}if(De(U)||he(U))return U=lo(U,Y.mode,Q,null),U.return=Y,U;if(typeof U.then=="function")return ce(Y,Lp(U),Q);if(U.$$typeof===F)return ce(Y,Dp(Y,U),Q);Bp(Y,U)}return null}function te(Y,U,Q,le){var ze=U!==null?U.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return ze!==null?null:R(Y,U,""+Q,le);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return Q.key===ze?$(Y,U,Q,le):null;case v:return Q.key===ze?ee(Y,U,Q,le):null;case q:return Q=po(Q),te(Y,U,Q,le)}if(De(Q)||he(Q))return ze!==null?null:se(Y,U,Q,le,null);if(typeof Q.then=="function")return te(Y,U,Lp(Q),le);if(Q.$$typeof===F)return te(Y,U,Dp(Y,Q),le);Bp(Y,Q)}return null}function ie(Y,U,Q,le,ze){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return Y=Y.get(Q)||null,R(U,Y,""+le,ze);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case b:return Y=Y.get(le.key===null?Q:le.key)||null,$(U,Y,le,ze);case v:return Y=Y.get(le.key===null?Q:le.key)||null,ee(U,Y,le,ze);case q:return le=po(le),ie(Y,U,Q,le,ze)}if(De(le)||he(le))return Y=Y.get(Q)||null,se(U,Y,le,ze,null);if(typeof le.then=="function")return ie(Y,U,Q,Lp(le),ze);if(le.$$typeof===F)return ie(Y,U,Q,Dp(U,le),ze);Bp(U,le)}return null}function we(Y,U,Q,le){for(var ze=null,ht=null,Oe=U,Ye=U=0,rt=null;Oe!==null&&Ye<Q.length;Ye++){Oe.index>Ye?(rt=Oe,Oe=null):rt=Oe.sibling;var pt=te(Y,Oe,Q[Ye],le);if(pt===null){Oe===null&&(Oe=rt);break}a&&Oe&&pt.alternate===null&&l(Y,Oe),U=k(pt,U,Ye),ht===null?ze=pt:ht.sibling=pt,ht=pt,Oe=rt}if(Ye===Q.length)return f(Y,Oe),ot&&ss(Y,Ye),ze;if(Oe===null){for(;Ye<Q.length;Ye++)Oe=ce(Y,Q[Ye],le),Oe!==null&&(U=k(Oe,U,Ye),ht===null?ze=Oe:ht.sibling=Oe,ht=Oe);return ot&&ss(Y,Ye),ze}for(Oe=d(Oe);Ye<Q.length;Ye++)rt=ie(Oe,Y,Ye,Q[Ye],le),rt!==null&&(a&&rt.alternate!==null&&Oe.delete(rt.key===null?Ye:rt.key),U=k(rt,U,Ye),ht===null?ze=rt:ht.sibling=rt,ht=rt);return a&&Oe.forEach(function(xa){return l(Y,xa)}),ot&&ss(Y,Ye),ze}function Be(Y,U,Q,le){if(Q==null)throw Error(i(151));for(var ze=null,ht=null,Oe=U,Ye=U=0,rt=null,pt=Q.next();Oe!==null&&!pt.done;Ye++,pt=Q.next()){Oe.index>Ye?(rt=Oe,Oe=null):rt=Oe.sibling;var xa=te(Y,Oe,pt.value,le);if(xa===null){Oe===null&&(Oe=rt);break}a&&Oe&&xa.alternate===null&&l(Y,Oe),U=k(xa,U,Ye),ht===null?ze=xa:ht.sibling=xa,ht=xa,Oe=rt}if(pt.done)return f(Y,Oe),ot&&ss(Y,Ye),ze;if(Oe===null){for(;!pt.done;Ye++,pt=Q.next())pt=ce(Y,pt.value,le),pt!==null&&(U=k(pt,U,Ye),ht===null?ze=pt:ht.sibling=pt,ht=pt);return ot&&ss(Y,Ye),ze}for(Oe=d(Oe);!pt.done;Ye++,pt=Q.next())pt=ie(Oe,Y,Ye,pt.value,le),pt!==null&&(a&&pt.alternate!==null&&Oe.delete(pt.key===null?Ye:pt.key),U=k(pt,U,Ye),ht===null?ze=pt:ht.sibling=pt,ht=pt);return a&&Oe.forEach(function(a4){return l(Y,a4)}),ot&&ss(Y,Ye),ze}function Nt(Y,U,Q,le){if(typeof Q=="object"&&Q!==null&&Q.type===E&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:e:{for(var ze=Q.key;U!==null;){if(U.key===ze){if(ze=Q.type,ze===E){if(U.tag===7){f(Y,U.sibling),le=x(U,Q.props.children),le.return=Y,Y=le;break e}}else if(U.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===q&&po(ze)===U.type){f(Y,U.sibling),le=x(U,Q.props),yc(le,Q),le.return=Y,Y=le;break e}f(Y,U);break}else l(Y,U);U=U.sibling}Q.type===E?(le=lo(Q.props.children,Y.mode,le,Q.key),le.return=Y,Y=le):(le=Mp(Q.type,Q.key,Q.props,null,Y.mode,le),yc(le,Q),le.return=Y,Y=le)}return N(Y);case v:e:{for(ze=Q.key;U!==null;){if(U.key===ze)if(U.tag===4&&U.stateNode.containerInfo===Q.containerInfo&&U.stateNode.implementation===Q.implementation){f(Y,U.sibling),le=x(U,Q.children||[]),le.return=Y,Y=le;break e}else{f(Y,U);break}else l(Y,U);U=U.sibling}le=f0(Q,Y.mode,le),le.return=Y,Y=le}return N(Y);case q:return Q=po(Q),Nt(Y,U,Q,le)}if(De(Q))return we(Y,U,Q,le);if(he(Q)){if(ze=he(Q),typeof ze!="function")throw Error(i(150));return Q=ze.call(Q),Be(Y,U,Q,le)}if(typeof Q.then=="function")return Nt(Y,U,Lp(Q),le);if(Q.$$typeof===F)return Nt(Y,U,Dp(Y,Q),le);Bp(Y,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,U!==null&&U.tag===6?(f(Y,U.sibling),le=x(U,Q),le.return=Y,Y=le):(f(Y,U),le=c0(Q,Y.mode,le),le.return=Y,Y=le),N(Y)):f(Y,U)}return function(Y,U,Q,le){try{gc=0;var ze=Nt(Y,U,Q,le);return Bl=null,ze}catch(Oe){if(Oe===Ll||Oe===_p)throw Oe;var ht=gi(29,Oe,null,Y.mode);return ht.lanes=le,ht.return=Y,ht}}}var go=qv(!0),Kv=qv(!1),ta=!1;function C0(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function w0(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function na(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function ia(a,l,f){var d=a.updateQueue;if(d===null)return null;if(d=d.shared,(dt&2)!==0){var x=d.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),d.pending=l,l=Tp(a),Ov(a,null,f),l}return Ap(a,d,l,f),Tp(a)}function xc(a,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194048)!==0)){var d=l.lanes;d&=a.pendingLanes,f|=d,l.lanes=f,hp(a,f)}}function E0(a,l){var f=a.updateQueue,d=a.alternate;if(d!==null&&(d=d.updateQueue,f===d)){var x=null,k=null;if(f=f.firstBaseUpdate,f!==null){do{var N={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};k===null?x=k=N:k=k.next=N,f=f.next}while(f!==null);k===null?x=k=l:k=k.next=l}else x=k=l;f={baseState:d.baseState,firstBaseUpdate:x,lastBaseUpdate:k,shared:d.shared,callbacks:d.callbacks},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=l}var N0=!1;function bc(){if(N0){var a=zl;if(a!==null)throw a}}function Sc(a,l,f,d){N0=!1;var x=a.updateQueue;ta=!1;var k=x.firstBaseUpdate,N=x.lastBaseUpdate,R=x.shared.pending;if(R!==null){x.shared.pending=null;var $=R,ee=$.next;$.next=null,N===null?k=ee:N.next=ee,N=$;var se=a.alternate;se!==null&&(se=se.updateQueue,R=se.lastBaseUpdate,R!==N&&(R===null?se.firstBaseUpdate=ee:R.next=ee,se.lastBaseUpdate=$))}if(k!==null){var ce=x.baseState;N=0,se=ee=$=null,R=k;do{var te=R.lane&-536870913,ie=te!==R.lane;if(ie?(it&te)===te:(d&te)===te){te!==0&&te===_l&&(N0=!0),se!==null&&(se=se.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var we=a,Be=R;te=l;var Nt=f;switch(Be.tag){case 1:if(we=Be.payload,typeof we=="function"){ce=we.call(Nt,ce,te);break e}ce=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Be.payload,te=typeof we=="function"?we.call(Nt,ce,te):we,te==null)break e;ce=g({},ce,te);break e;case 2:ta=!0}}te=R.callback,te!==null&&(a.flags|=64,ie&&(a.flags|=8192),ie=x.callbacks,ie===null?x.callbacks=[te]:ie.push(te))}else ie={lane:te,tag:R.tag,payload:R.payload,callback:R.callback,next:null},se===null?(ee=se=ie,$=ce):se=se.next=ie,N|=te;if(R=R.next,R===null){if(R=x.shared.pending,R===null)break;ie=R,R=ie.next,ie.next=null,x.lastBaseUpdate=ie,x.shared.pending=null}}while(!0);se===null&&($=ce),x.baseState=$,x.firstBaseUpdate=ee,x.lastBaseUpdate=se,k===null&&(x.shared.lanes=0),la|=N,a.lanes=N,a.memoizedState=ce}}function Gv(a,l){if(typeof a!="function")throw Error(i(191,a));a.call(l)}function Yv(a,l){var f=a.callbacks;if(f!==null)for(a.callbacks=null,a=0;a<f.length;a++)Gv(f[a],l)}var Vl=P(null),Vp=P(0);function Xv(a,l){a=ys,B(Vp,a),B(Vl,l),ys=a|l.baseLanes}function A0(){B(Vp,ys),B(Vl,Vl.current)}function T0(){ys=Vp.current,ne(Vl),ne(Vp)}var yi=P(null),ji=null;function ra(a){var l=a.alternate;B(jt,jt.current&1),B(yi,a),ji===null&&(l===null||Vl.current!==null||l.memoizedState!==null)&&(ji=a)}function M0(a){B(jt,jt.current),B(yi,a),ji===null&&(ji=a)}function Qv(a){a.tag===22?(B(jt,jt.current),B(yi,a),ji===null&&(ji=a)):sa()}function sa(){B(jt,jt.current),B(yi,yi.current)}function xi(a){ne(yi),ji===a&&(ji=null),ne(jt)}var jt=P(0);function Fp(a){for(var l=a;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||zy(f)||Ly(f)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var us=0,Ke=null,wt=null,Gt=null,Pp=!1,Fl=!1,yo=!1,jp=0,kc=0,Pl=null,X_=0;function Bt(){throw Error(i(321))}function O0(a,l){if(l===null)return!1;for(var f=0;f<l.length&&f<a.length;f++)if(!mi(a[f],l[f]))return!1;return!0}function R0(a,l,f,d,x,k){return us=k,Ke=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,W.H=a===null||a.memoizedState===null?_C:q0,yo=!1,k=f(d,x),yo=!1,Fl&&(k=Zv(l,f,d,x)),Wv(a),k}function Wv(a){W.H=wc;var l=wt!==null&&wt.next!==null;if(us=0,Gt=wt=Ke=null,Pp=!1,kc=0,Pl=null,l)throw Error(i(300));a===null||Yt||(a=a.dependencies,a!==null&&Rp(a)&&(Yt=!0))}function Zv(a,l,f,d){Ke=a;var x=0;do{if(Fl&&(Pl=null),kc=0,Fl=!1,25<=x)throw Error(i(301));if(x+=1,Gt=wt=null,a.updateQueue!=null){var k=a.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}W.H=zC,k=l(f,d)}while(Fl);return k}function Q_(){var a=W.H,l=a.useState()[0];return l=typeof l.then=="function"?vc(l):l,a=a.useState()[0],(wt!==null?wt.memoizedState:null)!==a&&(Ke.flags|=1024),l}function D0(){var a=jp!==0;return jp=0,a}function I0(a,l,f){l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~f}function _0(a){if(Pp){for(a=a.memoizedState;a!==null;){var l=a.queue;l!==null&&(l.pending=null),a=a.next}Pp=!1}us=0,Gt=wt=Ke=null,Fl=!1,kc=jp=0,Pl=null}function _n(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?Ke.memoizedState=Gt=a:Gt=Gt.next=a,Gt}function $t(){if(wt===null){var a=Ke.alternate;a=a!==null?a.memoizedState:null}else a=wt.next;var l=Gt===null?Ke.memoizedState:Gt.next;if(l!==null)Gt=l,wt=a;else{if(a===null)throw Ke.alternate===null?Error(i(467)):Error(i(310));wt=a,a={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Gt===null?Ke.memoizedState=Gt=a:Gt=Gt.next=a}return Gt}function $p(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vc(a){var l=kc;return kc+=1,Pl===null&&(Pl=[]),a=Uv(Pl,a,l),l=Ke,(Gt===null?l.memoizedState:Gt.next)===null&&(l=l.alternate,W.H=l===null||l.memoizedState===null?_C:q0),a}function Up(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return vc(a);if(a.$$typeof===F)return ln(a)}throw Error(i(438,String(a)))}function z0(a){var l=null,f=Ke.updateQueue;if(f!==null&&(l=f.memoCache),l==null){var d=Ke.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(l={data:d.data.map(function(x){return x.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),f===null&&(f=$p(),Ke.updateQueue=f),f.memoCache=l,f=l.data[l.index],f===void 0)for(f=l.data[l.index]=Array(a),d=0;d<a;d++)f[d]=K;return l.index++,f}function cs(a,l){return typeof l=="function"?l(a):l}function Jp(a){var l=$t();return L0(l,wt,a)}function L0(a,l,f){var d=a.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=f;var x=a.baseQueue,k=d.pending;if(k!==null){if(x!==null){var N=x.next;x.next=k.next,k.next=N}l.baseQueue=x=k,d.pending=null}if(k=a.baseState,x===null)a.memoizedState=k;else{l=x.next;var R=N=null,$=null,ee=l,se=!1;do{var ce=ee.lane&-536870913;if(ce!==ee.lane?(it&ce)===ce:(us&ce)===ce){var te=ee.revertLane;if(te===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ce===_l&&(se=!0);else if((us&te)===te){ee=ee.next,te===_l&&(se=!0);continue}else ce={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},$===null?(R=$=ce,N=k):$=$.next=ce,Ke.lanes|=te,la|=te;ce=ee.action,yo&&f(k,ce),k=ee.hasEagerState?ee.eagerState:f(k,ce)}else te={lane:ce,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},$===null?(R=$=te,N=k):$=$.next=te,Ke.lanes|=ce,la|=ce;ee=ee.next}while(ee!==null&&ee!==l);if($===null?N=k:$.next=R,!mi(k,a.memoizedState)&&(Yt=!0,se&&(f=zl,f!==null)))throw f;a.memoizedState=k,a.baseState=N,a.baseQueue=$,d.lastRenderedState=k}return x===null&&(d.lanes=0),[a.memoizedState,d.dispatch]}function B0(a){var l=$t(),f=l.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=a;var d=f.dispatch,x=f.pending,k=l.memoizedState;if(x!==null){f.pending=null;var N=x=x.next;do k=a(k,N.action),N=N.next;while(N!==x);mi(k,l.memoizedState)||(Yt=!0),l.memoizedState=k,l.baseQueue===null&&(l.baseState=k),f.lastRenderedState=k}return[k,d]}function eC(a,l,f){var d=Ke,x=$t(),k=ot;if(k){if(f===void 0)throw Error(i(407));f=f()}else f=l();var N=!mi((wt||x).memoizedState,f);if(N&&(x.memoizedState=f,Yt=!0),x=x.queue,P0(iC.bind(null,d,x,a),[a]),x.getSnapshot!==l||N||Gt!==null&&Gt.memoizedState.tag&1){if(d.flags|=2048,jl(9,{destroy:void 0},nC.bind(null,d,x,f,l),null),At===null)throw Error(i(349));k||(us&127)!==0||tC(d,l,f)}return f}function tC(a,l,f){a.flags|=16384,a={getSnapshot:l,value:f},l=Ke.updateQueue,l===null?(l=$p(),Ke.updateQueue=l,l.stores=[a]):(f=l.stores,f===null?l.stores=[a]:f.push(a))}function nC(a,l,f,d){l.value=f,l.getSnapshot=d,rC(l)&&sC(a)}function iC(a,l,f){return f(function(){rC(l)&&sC(a)})}function rC(a){var l=a.getSnapshot;a=a.value;try{var f=l();return!mi(a,f)}catch{return!0}}function sC(a){var l=oo(a,2);l!==null&&ri(l,a,2)}function V0(a){var l=_n();if(typeof a=="function"){var f=a;if(a=f(),yo){mn(!0);try{f()}finally{mn(!1)}}}return l.memoizedState=l.baseState=a,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:a},l}function aC(a,l,f,d){return a.baseState=f,L0(a,wt,typeof d=="function"?d:cs)}function W_(a,l,f,d,x){if(Kp(a))throw Error(i(485));if(a=l.action,a!==null){var k={payload:x,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){k.listeners.push(N)}};W.T!==null?f(!0):k.isTransition=!1,d(k),f=l.pending,f===null?(k.next=l.pending=k,oC(l,k)):(k.next=f.next,l.pending=f.next=k)}}function oC(a,l){var f=l.action,d=l.payload,x=a.state;if(l.isTransition){var k=W.T,N={};W.T=N;try{var R=f(x,d),$=W.S;$!==null&&$(N,R),lC(a,l,R)}catch(ee){F0(a,l,ee)}finally{k!==null&&N.types!==null&&(k.types=N.types),W.T=k}}else try{k=f(x,d),lC(a,l,k)}catch(ee){F0(a,l,ee)}}function lC(a,l,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(d){uC(a,l,d)},function(d){return F0(a,l,d)}):uC(a,l,f)}function uC(a,l,f){l.status="fulfilled",l.value=f,cC(l),a.state=f,l=a.pending,l!==null&&(f=l.next,f===l?a.pending=null:(f=f.next,l.next=f,oC(a,f)))}function F0(a,l,f){var d=a.pending;if(a.pending=null,d!==null){d=d.next;do l.status="rejected",l.reason=f,cC(l),l=l.next;while(l!==d)}a.action=null}function cC(a){a=a.listeners;for(var l=0;l<a.length;l++)(0,a[l])()}function fC(a,l){return l}function hC(a,l){if(ot){var f=At.formState;if(f!==null){e:{var d=Ke;if(ot){if(Mt){t:{for(var x=Mt,k=Pi;x.nodeType!==8;){if(!k){x=null;break t}if(x=$i(x.nextSibling),x===null){x=null;break t}}k=x.data,x=k==="F!"||k==="F"?x:null}if(x){Mt=$i(x.nextSibling),d=x.data==="F!";break e}}Zs(d)}d=!1}d&&(l=f[0])}}return f=_n(),f.memoizedState=f.baseState=l,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fC,lastRenderedState:l},f.queue=d,f=RC.bind(null,Ke,d),d.dispatch=f,d=V0(!1),k=H0.bind(null,Ke,!1,d.queue),d=_n(),x={state:l,dispatch:null,action:a,pending:null},d.queue=x,f=W_.bind(null,Ke,x,k,f),x.dispatch=f,d.memoizedState=a,[l,f,!1]}function pC(a){var l=$t();return dC(l,wt,a)}function dC(a,l,f){if(l=L0(a,l,fC)[0],a=Jp(cs)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var d=vc(l)}catch(N){throw N===Ll?_p:N}else d=l;l=$t();var x=l.queue,k=x.dispatch;return f!==l.memoizedState&&(Ke.flags|=2048,jl(9,{destroy:void 0},Z_.bind(null,x,f),null)),[d,k,a]}function Z_(a,l){a.action=l}function mC(a){var l=$t(),f=wt;if(f!==null)return dC(l,f,a);$t(),l=l.memoizedState,f=$t();var d=f.queue.dispatch;return f.memoizedState=a,[l,d,!1]}function jl(a,l,f,d){return a={tag:a,create:f,deps:d,inst:l,next:null},l=Ke.updateQueue,l===null&&(l=$p(),Ke.updateQueue=l),f=l.lastEffect,f===null?l.lastEffect=a.next=a:(d=f.next,f.next=a,a.next=d,l.lastEffect=a),a}function gC(){return $t().memoizedState}function Hp(a,l,f,d){var x=_n();Ke.flags|=a,x.memoizedState=jl(1|l,{destroy:void 0},f,d===void 0?null:d)}function qp(a,l,f,d){var x=$t();d=d===void 0?null:d;var k=x.memoizedState.inst;wt!==null&&d!==null&&O0(d,wt.memoizedState.deps)?x.memoizedState=jl(l,k,f,d):(Ke.flags|=a,x.memoizedState=jl(1|l,k,f,d))}function yC(a,l){Hp(8390656,8,a,l)}function P0(a,l){qp(2048,8,a,l)}function e6(a){Ke.flags|=4;var l=Ke.updateQueue;if(l===null)l=$p(),Ke.updateQueue=l,l.events=[a];else{var f=l.events;f===null?l.events=[a]:f.push(a)}}function xC(a){var l=$t().memoizedState;return e6({ref:l,nextImpl:a}),function(){if((dt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function bC(a,l){return qp(4,2,a,l)}function SC(a,l){return qp(4,4,a,l)}function kC(a,l){if(typeof l=="function"){a=a();var f=l(a);return function(){typeof f=="function"?f():l(null)}}if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function vC(a,l,f){f=f!=null?f.concat([a]):null,qp(4,4,kC.bind(null,l,a),f)}function j0(){}function CC(a,l){var f=$t();l=l===void 0?null:l;var d=f.memoizedState;return l!==null&&O0(l,d[1])?d[0]:(f.memoizedState=[a,l],a)}function wC(a,l){var f=$t();l=l===void 0?null:l;var d=f.memoizedState;if(l!==null&&O0(l,d[1]))return d[0];if(d=a(),yo){mn(!0);try{a()}finally{mn(!1)}}return f.memoizedState=[d,l],d}function $0(a,l,f){return f===void 0||(us&1073741824)!==0&&(it&261930)===0?a.memoizedState=l:(a.memoizedState=f,a=Ew(),Ke.lanes|=a,la|=a,f)}function EC(a,l,f,d){return mi(f,l)?f:Vl.current!==null?(a=$0(a,f,d),mi(a,l)||(Yt=!0),a):(us&42)===0||(us&1073741824)!==0&&(it&261930)===0?(Yt=!0,a.memoizedState=f):(a=Ew(),Ke.lanes|=a,la|=a,l)}function NC(a,l,f,d,x){var k=oe.p;oe.p=k!==0&&8>k?k:8;var N=W.T,R={};W.T=R,H0(a,!1,l,f);try{var $=x(),ee=W.S;if(ee!==null&&ee(R,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var se=Y_($,d);Cc(a,l,se,ki(a))}else Cc(a,l,d,ki(a))}catch(ce){Cc(a,l,{then:function(){},status:"rejected",reason:ce},ki())}finally{oe.p=k,N!==null&&R.types!==null&&(N.types=R.types),W.T=N}}function t6(){}function U0(a,l,f,d){if(a.tag!==5)throw Error(i(476));var x=AC(a).queue;NC(a,x,l,de,f===null?t6:function(){return TC(a),f(d)})}function AC(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:de},next:null};var f={};return l.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:f},next:null},a.memoizedState=l,a=a.alternate,a!==null&&(a.memoizedState=l),l}function TC(a){var l=AC(a);l.next===null&&(l=a.alternate.memoizedState),Cc(a,l.next.queue,{},ki())}function J0(){return ln(Pc)}function MC(){return $t().memoizedState}function OC(){return $t().memoizedState}function n6(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var f=ki();a=na(f);var d=ia(l,a,f);d!==null&&(ri(d,l,f),xc(d,l,f)),l={cache:b0()},a.payload=l;return}l=l.return}}function i6(a,l,f){var d=ki();f={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Kp(a)?DC(l,f):(f=l0(a,l,f,d),f!==null&&(ri(f,a,d),IC(f,l,d)))}function RC(a,l,f){var d=ki();Cc(a,l,f,d)}function Cc(a,l,f,d){var x={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(Kp(a))DC(l,x);else{var k=a.alternate;if(a.lanes===0&&(k===null||k.lanes===0)&&(k=l.lastRenderedReducer,k!==null))try{var N=l.lastRenderedState,R=k(N,f);if(x.hasEagerState=!0,x.eagerState=R,mi(R,N))return Ap(a,l,x,0),At===null&&Np(),!1}catch{}if(f=l0(a,l,x,d),f!==null)return ri(f,a,d),IC(f,l,d),!0}return!1}function H0(a,l,f,d){if(d={lane:2,revertLane:Cy(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Kp(a)){if(l)throw Error(i(479))}else l=l0(a,f,d,2),l!==null&&ri(l,a,2)}function Kp(a){var l=a.alternate;return a===Ke||l!==null&&l===Ke}function DC(a,l){Fl=Pp=!0;var f=a.pending;f===null?l.next=l:(l.next=f.next,f.next=l),a.pending=l}function IC(a,l,f){if((f&4194048)!==0){var d=l.lanes;d&=a.pendingLanes,f|=d,l.lanes=f,hp(a,f)}}var wc={readContext:ln,use:Up,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};wc.useEffectEvent=Bt;var _C={readContext:ln,use:Up,useCallback:function(a,l){return _n().memoizedState=[a,l===void 0?null:l],a},useContext:ln,useEffect:yC,useImperativeHandle:function(a,l,f){f=f!=null?f.concat([a]):null,Hp(4194308,4,kC.bind(null,l,a),f)},useLayoutEffect:function(a,l){return Hp(4194308,4,a,l)},useInsertionEffect:function(a,l){Hp(4,2,a,l)},useMemo:function(a,l){var f=_n();l=l===void 0?null:l;var d=a();if(yo){mn(!0);try{a()}finally{mn(!1)}}return f.memoizedState=[d,l],d},useReducer:function(a,l,f){var d=_n();if(f!==void 0){var x=f(l);if(yo){mn(!0);try{f(l)}finally{mn(!1)}}}else x=l;return d.memoizedState=d.baseState=x,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:x},d.queue=a,a=a.dispatch=i6.bind(null,Ke,a),[d.memoizedState,a]},useRef:function(a){var l=_n();return a={current:a},l.memoizedState=a},useState:function(a){a=V0(a);var l=a.queue,f=RC.bind(null,Ke,l);return l.dispatch=f,[a.memoizedState,f]},useDebugValue:j0,useDeferredValue:function(a,l){var f=_n();return $0(f,a,l)},useTransition:function(){var a=V0(!1);return a=NC.bind(null,Ke,a.queue,!0,!1),_n().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,f){var d=Ke,x=_n();if(ot){if(f===void 0)throw Error(i(407));f=f()}else{if(f=l(),At===null)throw Error(i(349));(it&127)!==0||tC(d,l,f)}x.memoizedState=f;var k={value:f,getSnapshot:l};return x.queue=k,yC(iC.bind(null,d,k,a),[a]),d.flags|=2048,jl(9,{destroy:void 0},nC.bind(null,d,k,f,l),null),f},useId:function(){var a=_n(),l=At.identifierPrefix;if(ot){var f=Dr,d=Rr;f=(d&~(1<<32-St(d)-1)).toString(32)+f,l="_"+l+"R_"+f,f=jp++,0<f&&(l+="H"+f.toString(32)),l+="_"}else f=X_++,l="_"+l+"r_"+f.toString(32)+"_";return a.memoizedState=l},useHostTransitionStatus:J0,useFormState:hC,useActionState:hC,useOptimistic:function(a){var l=_n();l.memoizedState=l.baseState=a;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=f,l=H0.bind(null,Ke,!0,f),f.dispatch=l,[a,l]},useMemoCache:z0,useCacheRefresh:function(){return _n().memoizedState=n6.bind(null,Ke)},useEffectEvent:function(a){var l=_n(),f={impl:a};return l.memoizedState=f,function(){if((dt&2)!==0)throw Error(i(440));return f.impl.apply(void 0,arguments)}}},q0={readContext:ln,use:Up,useCallback:CC,useContext:ln,useEffect:P0,useImperativeHandle:vC,useInsertionEffect:bC,useLayoutEffect:SC,useMemo:wC,useReducer:Jp,useRef:gC,useState:function(){return Jp(cs)},useDebugValue:j0,useDeferredValue:function(a,l){var f=$t();return EC(f,wt.memoizedState,a,l)},useTransition:function(){var a=Jp(cs)[0],l=$t().memoizedState;return[typeof a=="boolean"?a:vc(a),l]},useSyncExternalStore:eC,useId:MC,useHostTransitionStatus:J0,useFormState:pC,useActionState:pC,useOptimistic:function(a,l){var f=$t();return aC(f,wt,a,l)},useMemoCache:z0,useCacheRefresh:OC};q0.useEffectEvent=xC;var zC={readContext:ln,use:Up,useCallback:CC,useContext:ln,useEffect:P0,useImperativeHandle:vC,useInsertionEffect:bC,useLayoutEffect:SC,useMemo:wC,useReducer:B0,useRef:gC,useState:function(){return B0(cs)},useDebugValue:j0,useDeferredValue:function(a,l){var f=$t();return wt===null?$0(f,a,l):EC(f,wt.memoizedState,a,l)},useTransition:function(){var a=B0(cs)[0],l=$t().memoizedState;return[typeof a=="boolean"?a:vc(a),l]},useSyncExternalStore:eC,useId:MC,useHostTransitionStatus:J0,useFormState:mC,useActionState:mC,useOptimistic:function(a,l){var f=$t();return wt!==null?aC(f,wt,a,l):(f.baseState=a,[a,f.queue.dispatch])},useMemoCache:z0,useCacheRefresh:OC};zC.useEffectEvent=xC;function K0(a,l,f,d){l=a.memoizedState,f=f(d,l),f=f==null?l:g({},l,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var G0={enqueueSetState:function(a,l,f){a=a._reactInternals;var d=ki(),x=na(d);x.payload=l,f!=null&&(x.callback=f),l=ia(a,x,d),l!==null&&(ri(l,a,d),xc(l,a,d))},enqueueReplaceState:function(a,l,f){a=a._reactInternals;var d=ki(),x=na(d);x.tag=1,x.payload=l,f!=null&&(x.callback=f),l=ia(a,x,d),l!==null&&(ri(l,a,d),xc(l,a,d))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var f=ki(),d=na(f);d.tag=2,l!=null&&(d.callback=l),l=ia(a,d,f),l!==null&&(ri(l,a,f),xc(l,a,f))}};function LC(a,l,f,d,x,k,N){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(d,k,N):l.prototype&&l.prototype.isPureReactComponent?!cc(f,d)||!cc(x,k):!0}function BC(a,l,f,d){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,d),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,d),l.state!==a&&G0.enqueueReplaceState(l,l.state,null)}function xo(a,l){var f=l;if("ref"in l){f={};for(var d in l)d!=="ref"&&(f[d]=l[d])}if(a=a.defaultProps){f===l&&(f=g({},f));for(var x in a)f[x]===void 0&&(f[x]=a[x])}return f}function VC(a){Ep(a)}function FC(a){console.error(a)}function PC(a){Ep(a)}function Gp(a,l){try{var f=a.onUncaughtError;f(l.value,{componentStack:l.stack})}catch(d){setTimeout(function(){throw d})}}function jC(a,l,f){try{var d=a.onCaughtError;d(f.value,{componentStack:f.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Y0(a,l,f){return f=na(f),f.tag=3,f.payload={element:null},f.callback=function(){Gp(a,l)},f}function $C(a){return a=na(a),a.tag=3,a}function UC(a,l,f,d){var x=f.type.getDerivedStateFromError;if(typeof x=="function"){var k=d.value;a.payload=function(){return x(k)},a.callback=function(){jC(l,f,d)}}var N=f.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(a.callback=function(){jC(l,f,d),typeof x!="function"&&(ua===null?ua=new Set([this]):ua.add(this));var R=d.stack;this.componentDidCatch(d.value,{componentStack:R!==null?R:""})})}function r6(a,l,f,d,x){if(f.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(l=f.alternate,l!==null&&Il(l,f,x,!0),f=yi.current,f!==null){switch(f.tag){case 31:case 13:return ji===null?ad():f.alternate===null&&Vt===0&&(Vt=3),f.flags&=-257,f.flags|=65536,f.lanes=x,d===zp?f.flags|=16384:(l=f.updateQueue,l===null?f.updateQueue=new Set([d]):l.add(d),Sy(a,d,x)),!1;case 22:return f.flags|=65536,d===zp?f.flags|=16384:(l=f.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([d])},f.updateQueue=l):(f=l.retryQueue,f===null?l.retryQueue=new Set([d]):f.add(d)),Sy(a,d,x)),!1}throw Error(i(435,f.tag))}return Sy(a,d,x),ad(),!1}if(ot)return l=yi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=x,d!==d0&&(a=Error(i(422),{cause:d}),pc(Bi(a,f)))):(d!==d0&&(l=Error(i(423),{cause:d}),pc(Bi(l,f))),a=a.current.alternate,a.flags|=65536,x&=-x,a.lanes|=x,d=Bi(d,f),x=Y0(a.stateNode,d,x),E0(a,x),Vt!==4&&(Vt=2)),!1;var k=Error(i(520),{cause:d});if(k=Bi(k,f),Dc===null?Dc=[k]:Dc.push(k),Vt!==4&&(Vt=2),l===null)return!0;d=Bi(d,f),f=l;do{switch(f.tag){case 3:return f.flags|=65536,a=x&-x,f.lanes|=a,a=Y0(f.stateNode,d,a),E0(f,a),!1;case 1:if(l=f.type,k=f.stateNode,(f.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(ua===null||!ua.has(k))))return f.flags|=65536,x&=-x,f.lanes|=x,x=$C(x),UC(x,a,f,d),E0(f,x),!1}f=f.return}while(f!==null);return!1}var X0=Error(i(461)),Yt=!1;function un(a,l,f,d){l.child=a===null?Kv(l,null,f,d):go(l,a.child,f,d)}function JC(a,l,f,d,x){f=f.render;var k=l.ref;if("ref"in d){var N={};for(var R in d)R!=="ref"&&(N[R]=d[R])}else N=d;return fo(l),d=R0(a,l,f,N,k,x),R=D0(),a!==null&&!Yt?(I0(a,l,x),fs(a,l,x)):(ot&&R&&h0(l),l.flags|=1,un(a,l,d,x),l.child)}function HC(a,l,f,d,x){if(a===null){var k=f.type;return typeof k=="function"&&!u0(k)&&k.defaultProps===void 0&&f.compare===null?(l.tag=15,l.type=k,qC(a,l,k,d,x)):(a=Mp(f.type,null,d,l,l.mode,x),a.ref=l.ref,a.return=l,l.child=a)}if(k=a.child,!ry(a,x)){var N=k.memoizedProps;if(f=f.compare,f=f!==null?f:cc,f(N,d)&&a.ref===l.ref)return fs(a,l,x)}return l.flags|=1,a=rs(k,d),a.ref=l.ref,a.return=l,l.child=a}function qC(a,l,f,d,x){if(a!==null){var k=a.memoizedProps;if(cc(k,d)&&a.ref===l.ref)if(Yt=!1,l.pendingProps=d=k,ry(a,x))(a.flags&131072)!==0&&(Yt=!0);else return l.lanes=a.lanes,fs(a,l,x)}return Q0(a,l,f,d,x)}function KC(a,l,f,d){var x=d.children,k=a!==null?a.memoizedState:null;if(a===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((l.flags&128)!==0){if(k=k!==null?k.baseLanes|f:f,a!==null){for(d=l.child=a.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~k}else d=0,l.child=null;return GC(a,l,k,f,d)}if((f&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},a!==null&&Ip(l,k!==null?k.cachePool:null),k!==null?Xv(l,k):A0(),Qv(l);else return d=l.lanes=536870912,GC(a,l,k!==null?k.baseLanes|f:f,f,d)}else k!==null?(Ip(l,k.cachePool),Xv(l,k),sa(),l.memoizedState=null):(a!==null&&Ip(l,null),A0(),sa());return un(a,l,x,f),l.child}function Ec(a,l){return a!==null&&a.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function GC(a,l,f,d,x){var k=k0();return k=k===null?null:{parent:Kt._currentValue,pool:k},l.memoizedState={baseLanes:f,cachePool:k},a!==null&&Ip(l,null),A0(),Qv(l),a!==null&&Il(a,l,d,!0),l.childLanes=x,null}function Yp(a,l){return l=Qp({mode:l.mode,children:l.children},a.mode),l.ref=a.ref,a.child=l,l.return=a,l}function YC(a,l,f){return go(l,a.child,null,f),a=Yp(l,l.pendingProps),a.flags|=2,xi(l),l.memoizedState=null,a}function s6(a,l,f){var d=l.pendingProps,x=(l.flags&128)!==0;if(l.flags&=-129,a===null){if(ot){if(d.mode==="hidden")return a=Yp(l,d),l.lanes=536870912,Ec(null,a);if(M0(l),(a=Mt)?(a=o2(a,Pi),a=a!==null&&a.data==="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:Qs!==null?{id:Rr,overflow:Dr}:null,retryLane:536870912,hydrationErrors:null},f=Dv(a),f.return=l,l.child=f,on=l,Mt=null)):a=null,a===null)throw Zs(l);return l.lanes=536870912,null}return Yp(l,d)}var k=a.memoizedState;if(k!==null){var N=k.dehydrated;if(M0(l),x)if(l.flags&256)l.flags&=-257,l=YC(a,l,f);else if(l.memoizedState!==null)l.child=a.child,l.flags|=128,l=null;else throw Error(i(558));else if(Yt||Il(a,l,f,!1),x=(f&a.childLanes)!==0,Yt||x){if(d=At,d!==null&&(N=Us(d,f),N!==0&&N!==k.retryLane))throw k.retryLane=N,oo(a,N),ri(d,a,N),X0;ad(),l=YC(a,l,f)}else a=k.treeContext,Mt=$i(N.nextSibling),on=l,ot=!0,Ws=null,Pi=!1,a!==null&&zv(l,a),l=Yp(l,d),l.flags|=4096;return l}return a=rs(a.child,{mode:d.mode,children:d.children}),a.ref=l.ref,l.child=a,a.return=l,a}function Xp(a,l){var f=l.ref;if(f===null)a!==null&&a.ref!==null&&(l.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(i(284));(a===null||a.ref!==f)&&(l.flags|=4194816)}}function Q0(a,l,f,d,x){return fo(l),f=R0(a,l,f,d,void 0,x),d=D0(),a!==null&&!Yt?(I0(a,l,x),fs(a,l,x)):(ot&&d&&h0(l),l.flags|=1,un(a,l,f,x),l.child)}function XC(a,l,f,d,x,k){return fo(l),l.updateQueue=null,f=Zv(l,d,f,x),Wv(a),d=D0(),a!==null&&!Yt?(I0(a,l,k),fs(a,l,k)):(ot&&d&&h0(l),l.flags|=1,un(a,l,f,k),l.child)}function QC(a,l,f,d,x){if(fo(l),l.stateNode===null){var k=Ml,N=f.contextType;typeof N=="object"&&N!==null&&(k=ln(N)),k=new f(d,k),l.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=G0,l.stateNode=k,k._reactInternals=l,k=l.stateNode,k.props=d,k.state=l.memoizedState,k.refs={},C0(l),N=f.contextType,k.context=typeof N=="object"&&N!==null?ln(N):Ml,k.state=l.memoizedState,N=f.getDerivedStateFromProps,typeof N=="function"&&(K0(l,f,N,d),k.state=l.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(N=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),N!==k.state&&G0.enqueueReplaceState(k,k.state,null),Sc(l,d,k,x),bc(),k.state=l.memoizedState),typeof k.componentDidMount=="function"&&(l.flags|=4194308),d=!0}else if(a===null){k=l.stateNode;var R=l.memoizedProps,$=xo(f,R);k.props=$;var ee=k.context,se=f.contextType;N=Ml,typeof se=="object"&&se!==null&&(N=ln(se));var ce=f.getDerivedStateFromProps;se=typeof ce=="function"||typeof k.getSnapshotBeforeUpdate=="function",R=l.pendingProps!==R,se||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(R||ee!==N)&&BC(l,k,d,N),ta=!1;var te=l.memoizedState;k.state=te,Sc(l,d,k,x),bc(),ee=l.memoizedState,R||te!==ee||ta?(typeof ce=="function"&&(K0(l,f,ce,d),ee=l.memoizedState),($=ta||LC(l,f,$,d,te,ee,N))?(se||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(l.flags|=4194308)):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=d,l.memoizedState=ee),k.props=d,k.state=ee,k.context=N,d=$):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),d=!1)}else{k=l.stateNode,w0(a,l),N=l.memoizedProps,se=xo(f,N),k.props=se,ce=l.pendingProps,te=k.context,ee=f.contextType,$=Ml,typeof ee=="object"&&ee!==null&&($=ln(ee)),R=f.getDerivedStateFromProps,(ee=typeof R=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(N!==ce||te!==$)&&BC(l,k,d,$),ta=!1,te=l.memoizedState,k.state=te,Sc(l,d,k,x),bc();var ie=l.memoizedState;N!==ce||te!==ie||ta||a!==null&&a.dependencies!==null&&Rp(a.dependencies)?(typeof R=="function"&&(K0(l,f,R,d),ie=l.memoizedState),(se=ta||LC(l,f,se,d,te,ie,$)||a!==null&&a.dependencies!==null&&Rp(a.dependencies))?(ee||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(d,ie,$),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(d,ie,$)),typeof k.componentDidUpdate=="function"&&(l.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof k.componentDidUpdate!="function"||N===a.memoizedProps&&te===a.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||N===a.memoizedProps&&te===a.memoizedState||(l.flags|=1024),l.memoizedProps=d,l.memoizedState=ie),k.props=d,k.state=ie,k.context=$,d=se):(typeof k.componentDidUpdate!="function"||N===a.memoizedProps&&te===a.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||N===a.memoizedProps&&te===a.memoizedState||(l.flags|=1024),d=!1)}return k=d,Xp(a,l),d=(l.flags&128)!==0,k||d?(k=l.stateNode,f=d&&typeof f.getDerivedStateFromError!="function"?null:k.render(),l.flags|=1,a!==null&&d?(l.child=go(l,a.child,null,x),l.child=go(l,null,f,x)):un(a,l,f,x),l.memoizedState=k.state,a=l.child):a=fs(a,l,x),a}function WC(a,l,f,d){return uo(),l.flags|=256,un(a,l,f,d),l.child}var W0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Z0(a){return{baseLanes:a,cachePool:jv()}}function ey(a,l,f){return a=a!==null?a.childLanes&~f:0,l&&(a|=Si),a}function ZC(a,l,f){var d=l.pendingProps,x=!1,k=(l.flags&128)!==0,N;if((N=k)||(N=a!==null&&a.memoizedState===null?!1:(jt.current&2)!==0),N&&(x=!0,l.flags&=-129),N=(l.flags&32)!==0,l.flags&=-33,a===null){if(ot){if(x?ra(l):sa(),(a=Mt)?(a=o2(a,Pi),a=a!==null&&a.data!=="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:Qs!==null?{id:Rr,overflow:Dr}:null,retryLane:536870912,hydrationErrors:null},f=Dv(a),f.return=l,l.child=f,on=l,Mt=null)):a=null,a===null)throw Zs(l);return Ly(a)?l.lanes=32:l.lanes=536870912,null}var R=d.children;return d=d.fallback,x?(sa(),x=l.mode,R=Qp({mode:"hidden",children:R},x),d=lo(d,x,f,null),R.return=l,d.return=l,R.sibling=d,l.child=R,d=l.child,d.memoizedState=Z0(f),d.childLanes=ey(a,N,f),l.memoizedState=W0,Ec(null,d)):(ra(l),ty(l,R))}var $=a.memoizedState;if($!==null&&(R=$.dehydrated,R!==null)){if(k)l.flags&256?(ra(l),l.flags&=-257,l=ny(a,l,f)):l.memoizedState!==null?(sa(),l.child=a.child,l.flags|=128,l=null):(sa(),R=d.fallback,x=l.mode,d=Qp({mode:"visible",children:d.children},x),R=lo(R,x,f,null),R.flags|=2,d.return=l,R.return=l,d.sibling=R,l.child=d,go(l,a.child,null,f),d=l.child,d.memoizedState=Z0(f),d.childLanes=ey(a,N,f),l.memoizedState=W0,l=Ec(null,d));else if(ra(l),Ly(R)){if(N=R.nextSibling&&R.nextSibling.dataset,N)var ee=N.dgst;N=ee,d=Error(i(419)),d.stack="",d.digest=N,pc({value:d,source:null,stack:null}),l=ny(a,l,f)}else if(Yt||Il(a,l,f,!1),N=(f&a.childLanes)!==0,Yt||N){if(N=At,N!==null&&(d=Us(N,f),d!==0&&d!==$.retryLane))throw $.retryLane=d,oo(a,d),ri(N,a,d),X0;zy(R)||ad(),l=ny(a,l,f)}else zy(R)?(l.flags|=192,l.child=a.child,l=null):(a=$.treeContext,Mt=$i(R.nextSibling),on=l,ot=!0,Ws=null,Pi=!1,a!==null&&zv(l,a),l=ty(l,d.children),l.flags|=4096);return l}return x?(sa(),R=d.fallback,x=l.mode,$=a.child,ee=$.sibling,d=rs($,{mode:"hidden",children:d.children}),d.subtreeFlags=$.subtreeFlags&65011712,ee!==null?R=rs(ee,R):(R=lo(R,x,f,null),R.flags|=2),R.return=l,d.return=l,d.sibling=R,l.child=d,Ec(null,d),d=l.child,R=a.child.memoizedState,R===null?R=Z0(f):(x=R.cachePool,x!==null?($=Kt._currentValue,x=x.parent!==$?{parent:$,pool:$}:x):x=jv(),R={baseLanes:R.baseLanes|f,cachePool:x}),d.memoizedState=R,d.childLanes=ey(a,N,f),l.memoizedState=W0,Ec(a.child,d)):(ra(l),f=a.child,a=f.sibling,f=rs(f,{mode:"visible",children:d.children}),f.return=l,f.sibling=null,a!==null&&(N=l.deletions,N===null?(l.deletions=[a],l.flags|=16):N.push(a)),l.child=f,l.memoizedState=null,f)}function ty(a,l){return l=Qp({mode:"visible",children:l},a.mode),l.return=a,a.child=l}function Qp(a,l){return a=gi(22,a,null,l),a.lanes=0,a}function ny(a,l,f){return go(l,a.child,null,f),a=ty(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function ew(a,l,f){a.lanes|=l;var d=a.alternate;d!==null&&(d.lanes|=l),y0(a.return,l,f)}function iy(a,l,f,d,x,k){var N=a.memoizedState;N===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:d,tail:f,tailMode:x,treeForkCount:k}:(N.isBackwards=l,N.rendering=null,N.renderingStartTime=0,N.last=d,N.tail=f,N.tailMode=x,N.treeForkCount=k)}function tw(a,l,f){var d=l.pendingProps,x=d.revealOrder,k=d.tail;d=d.children;var N=jt.current,R=(N&2)!==0;if(R?(N=N&1|2,l.flags|=128):N&=1,B(jt,N),un(a,l,d,f),d=ot?hc:0,!R&&a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&ew(a,f,l);else if(a.tag===19)ew(a,f,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(x){case"forwards":for(f=l.child,x=null;f!==null;)a=f.alternate,a!==null&&Fp(a)===null&&(x=f),f=f.sibling;f=x,f===null?(x=l.child,l.child=null):(x=f.sibling,f.sibling=null),iy(l,!1,x,f,k,d);break;case"backwards":case"unstable_legacy-backwards":for(f=null,x=l.child,l.child=null;x!==null;){if(a=x.alternate,a!==null&&Fp(a)===null){l.child=x;break}a=x.sibling,x.sibling=f,f=x,x=a}iy(l,!0,f,null,k,d);break;case"together":iy(l,!1,null,null,void 0,d);break;default:l.memoizedState=null}return l.child}function fs(a,l,f){if(a!==null&&(l.dependencies=a.dependencies),la|=l.lanes,(f&l.childLanes)===0)if(a!==null){if(Il(a,l,f,!1),(f&l.childLanes)===0)return null}else return null;if(a!==null&&l.child!==a.child)throw Error(i(153));if(l.child!==null){for(a=l.child,f=rs(a,a.pendingProps),l.child=f,f.return=l;a.sibling!==null;)a=a.sibling,f=f.sibling=rs(a,a.pendingProps),f.return=l;f.sibling=null}return l.child}function ry(a,l){return(a.lanes&l)!==0?!0:(a=a.dependencies,!!(a!==null&&Rp(a)))}function a6(a,l,f){switch(l.tag){case 3:Ct(l,l.stateNode.containerInfo),ea(l,Kt,a.memoizedState.cache),uo();break;case 27:case 5:zt(l);break;case 4:Ct(l,l.stateNode.containerInfo);break;case 10:ea(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,M0(l),null;break;case 13:var d=l.memoizedState;if(d!==null)return d.dehydrated!==null?(ra(l),l.flags|=128,null):(f&l.child.childLanes)!==0?ZC(a,l,f):(ra(l),a=fs(a,l,f),a!==null?a.sibling:null);ra(l);break;case 19:var x=(a.flags&128)!==0;if(d=(f&l.childLanes)!==0,d||(Il(a,l,f,!1),d=(f&l.childLanes)!==0),x){if(d)return tw(a,l,f);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),B(jt,jt.current),d)break;return null;case 22:return l.lanes=0,KC(a,l,f,l.pendingProps);case 24:ea(l,Kt,a.memoizedState.cache)}return fs(a,l,f)}function nw(a,l,f){if(a!==null)if(a.memoizedProps!==l.pendingProps)Yt=!0;else{if(!ry(a,f)&&(l.flags&128)===0)return Yt=!1,a6(a,l,f);Yt=(a.flags&131072)!==0}else Yt=!1,ot&&(l.flags&1048576)!==0&&_v(l,hc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var d=l.pendingProps;if(a=po(l.elementType),l.type=a,typeof a=="function")u0(a)?(d=xo(a,d),l.tag=1,l=QC(null,l,a,d,f)):(l.tag=0,l=Q0(null,l,a,d,f));else{if(a!=null){var x=a.$$typeof;if(x===J){l.tag=11,l=JC(null,l,a,d,f);break e}else if(x===L){l.tag=14,l=HC(null,l,a,d,f);break e}}throw l=Ie(a)||a,Error(i(306,l,""))}}return l;case 0:return Q0(a,l,l.type,l.pendingProps,f);case 1:return d=l.type,x=xo(d,l.pendingProps),QC(a,l,d,x,f);case 3:e:{if(Ct(l,l.stateNode.containerInfo),a===null)throw Error(i(387));d=l.pendingProps;var k=l.memoizedState;x=k.element,w0(a,l),Sc(l,d,null,f);var N=l.memoizedState;if(d=N.cache,ea(l,Kt,d),d!==k.cache&&x0(l,[Kt],f,!0),bc(),d=N.element,k.isDehydrated)if(k={element:d,isDehydrated:!1,cache:N.cache},l.updateQueue.baseState=k,l.memoizedState=k,l.flags&256){l=WC(a,l,d,f);break e}else if(d!==x){x=Bi(Error(i(424)),l),pc(x),l=WC(a,l,d,f);break e}else for(a=l.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,Mt=$i(a.firstChild),on=l,ot=!0,Ws=null,Pi=!0,f=Kv(l,null,d,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(uo(),d===x){l=fs(a,l,f);break e}un(a,l,d,f)}l=l.child}return l;case 26:return Xp(a,l),a===null?(f=p2(l.type,null,l.pendingProps,null))?l.memoizedState=f:ot||(f=l.type,a=l.pendingProps,d=pd(Me.current).createElement(f),d[Ht]=l,d[an]=a,cn(d,f,a),qt(d),l.stateNode=d):l.memoizedState=p2(l.type,a.memoizedProps,l.pendingProps,a.memoizedState),null;case 27:return zt(l),a===null&&ot&&(d=l.stateNode=c2(l.type,l.pendingProps,Me.current),on=l,Pi=!0,x=Mt,pa(l.type)?(By=x,Mt=$i(d.firstChild)):Mt=x),un(a,l,l.pendingProps.children,f),Xp(a,l),a===null&&(l.flags|=4194304),l.child;case 5:return a===null&&ot&&((x=d=Mt)&&(d=L6(d,l.type,l.pendingProps,Pi),d!==null?(l.stateNode=d,on=l,Mt=$i(d.firstChild),Pi=!1,x=!0):x=!1),x||Zs(l)),zt(l),x=l.type,k=l.pendingProps,N=a!==null?a.memoizedProps:null,d=k.children,Dy(x,k)?d=null:N!==null&&Dy(x,N)&&(l.flags|=32),l.memoizedState!==null&&(x=R0(a,l,Q_,null,null,f),Pc._currentValue=x),Xp(a,l),un(a,l,d,f),l.child;case 6:return a===null&&ot&&((a=f=Mt)&&(f=B6(f,l.pendingProps,Pi),f!==null?(l.stateNode=f,on=l,Mt=null,a=!0):a=!1),a||Zs(l)),null;case 13:return ZC(a,l,f);case 4:return Ct(l,l.stateNode.containerInfo),d=l.pendingProps,a===null?l.child=go(l,null,d,f):un(a,l,d,f),l.child;case 11:return JC(a,l,l.type,l.pendingProps,f);case 7:return un(a,l,l.pendingProps,f),l.child;case 8:return un(a,l,l.pendingProps.children,f),l.child;case 12:return un(a,l,l.pendingProps.children,f),l.child;case 10:return d=l.pendingProps,ea(l,l.type,d.value),un(a,l,d.children,f),l.child;case 9:return x=l.type._context,d=l.pendingProps.children,fo(l),x=ln(x),d=d(x),l.flags|=1,un(a,l,d,f),l.child;case 14:return HC(a,l,l.type,l.pendingProps,f);case 15:return qC(a,l,l.type,l.pendingProps,f);case 19:return tw(a,l,f);case 31:return s6(a,l,f);case 22:return KC(a,l,f,l.pendingProps);case 24:return fo(l),d=ln(Kt),a===null?(x=k0(),x===null&&(x=At,k=b0(),x.pooledCache=k,k.refCount++,k!==null&&(x.pooledCacheLanes|=f),x=k),l.memoizedState={parent:d,cache:x},C0(l),ea(l,Kt,x)):((a.lanes&f)!==0&&(w0(a,l),Sc(l,null,null,f),bc()),x=a.memoizedState,k=l.memoizedState,x.parent!==d?(x={parent:d,cache:d},l.memoizedState=x,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=x),ea(l,Kt,d)):(d=k.cache,ea(l,Kt,d),d!==x.cache&&x0(l,[Kt],f,!0))),un(a,l,l.pendingProps.children,f),l.child;case 29:throw l.pendingProps}throw Error(i(156,l.tag))}function hs(a){a.flags|=4}function sy(a,l,f,d,x){if((l=(a.mode&32)!==0)&&(l=!1),l){if(a.flags|=16777216,(x&335544128)===x)if(a.stateNode.complete)a.flags|=8192;else if(Mw())a.flags|=8192;else throw mo=zp,v0}else a.flags&=-16777217}function iw(a,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!x2(l))if(Mw())a.flags|=8192;else throw mo=zp,v0}function Wp(a,l){l!==null&&(a.flags|=4),a.flags&16384&&(l=a.tag!==22?Xu():536870912,a.lanes|=l,Hl|=l)}function Nc(a,l){if(!ot)switch(a.tailMode){case"hidden":l=a.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var d=null;f!==null;)f.alternate!==null&&(d=f),f=f.sibling;d===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:d.sibling=null}}function Ot(a){var l=a.alternate!==null&&a.alternate.child===a.child,f=0,d=0;if(l)for(var x=a.child;x!==null;)f|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=a,x=x.sibling;else for(x=a.child;x!==null;)f|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=a,x=x.sibling;return a.subtreeFlags|=d,a.childLanes=f,l}function o6(a,l,f){var d=l.pendingProps;switch(p0(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(l),null;case 1:return Ot(l),null;case 3:return f=l.stateNode,d=null,a!==null&&(d=a.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),ls(Kt),Qe(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(a===null||a.child===null)&&(Dl(l)?hs(l):a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,m0())),Ot(l),null;case 26:var x=l.type,k=l.memoizedState;return a===null?(hs(l),k!==null?(Ot(l),iw(l,k)):(Ot(l),sy(l,x,null,d,f))):k?k!==a.memoizedState?(hs(l),Ot(l),iw(l,k)):(Ot(l),l.flags&=-16777217):(a=a.memoizedProps,a!==d&&hs(l),Ot(l),sy(l,x,a,d,f)),null;case 27:if(Lt(l),f=Me.current,x=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==d&&hs(l);else{if(!d){if(l.stateNode===null)throw Error(i(166));return Ot(l),null}a=be.current,Dl(l)?Lv(l):(a=c2(x,d,f),l.stateNode=a,hs(l))}return Ot(l),null;case 5:if(Lt(l),x=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==d&&hs(l);else{if(!d){if(l.stateNode===null)throw Error(i(166));return Ot(l),null}if(k=be.current,Dl(l))Lv(l);else{var N=pd(Me.current);switch(k){case 1:k=N.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:k=N.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":k=N.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":k=N.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":k=N.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof d.is=="string"?N.createElement("select",{is:d.is}):N.createElement("select"),d.multiple?k.multiple=!0:d.size&&(k.size=d.size);break;default:k=typeof d.is=="string"?N.createElement(x,{is:d.is}):N.createElement(x)}}k[Ht]=l,k[an]=d;e:for(N=l.child;N!==null;){if(N.tag===5||N.tag===6)k.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===l)break e;for(;N.sibling===null;){if(N.return===null||N.return===l)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}l.stateNode=k;e:switch(cn(k,x,d),x){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&hs(l)}}return Ot(l),sy(l,l.type,a===null?null:a.memoizedProps,l.pendingProps,f),null;case 6:if(a&&l.stateNode!=null)a.memoizedProps!==d&&hs(l);else{if(typeof d!="string"&&l.stateNode===null)throw Error(i(166));if(a=Me.current,Dl(l)){if(a=l.stateNode,f=l.memoizedProps,d=null,x=on,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}a[Ht]=l,a=!!(a.nodeValue===f||d!==null&&d.suppressHydrationWarning===!0||Zw(a.nodeValue,f)),a||Zs(l,!0)}else a=pd(a).createTextNode(d),a[Ht]=l,l.stateNode=a}return Ot(l),null;case 31:if(f=l.memoizedState,a===null||a.memoizedState!==null){if(d=Dl(l),f!==null){if(a===null){if(!d)throw Error(i(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(i(557));a[Ht]=l}else uo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),a=!1}else f=m0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=f),a=!0;if(!a)return l.flags&256?(xi(l),l):(xi(l),null);if((l.flags&128)!==0)throw Error(i(558))}return Ot(l),null;case 13:if(d=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(x=Dl(l),d!==null&&d.dehydrated!==null){if(a===null){if(!x)throw Error(i(318));if(x=l.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));x[Ht]=l}else uo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),x=!1}else x=m0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=x),x=!0;if(!x)return l.flags&256?(xi(l),l):(xi(l),null)}return xi(l),(l.flags&128)!==0?(l.lanes=f,l):(f=d!==null,a=a!==null&&a.memoizedState!==null,f&&(d=l.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),k=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(k=d.memoizedState.cachePool.pool),k!==x&&(d.flags|=2048)),f!==a&&f&&(l.child.flags|=8192),Wp(l,l.updateQueue),Ot(l),null);case 4:return Qe(),a===null&&Ay(l.stateNode.containerInfo),Ot(l),null;case 10:return ls(l.type),Ot(l),null;case 19:if(ne(jt),d=l.memoizedState,d===null)return Ot(l),null;if(x=(l.flags&128)!==0,k=d.rendering,k===null)if(x)Nc(d,!1);else{if(Vt!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(k=Fp(a),k!==null){for(l.flags|=128,Nc(d,!1),a=k.updateQueue,l.updateQueue=a,Wp(l,a),l.subtreeFlags=0,a=f,f=l.child;f!==null;)Rv(f,a),f=f.sibling;return B(jt,jt.current&1|2),ot&&ss(l,d.treeForkCount),l.child}a=a.sibling}d.tail!==null&&$e()>id&&(l.flags|=128,x=!0,Nc(d,!1),l.lanes=4194304)}else{if(!x)if(a=Fp(k),a!==null){if(l.flags|=128,x=!0,a=a.updateQueue,l.updateQueue=a,Wp(l,a),Nc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!k.alternate&&!ot)return Ot(l),null}else 2*$e()-d.renderingStartTime>id&&f!==536870912&&(l.flags|=128,x=!0,Nc(d,!1),l.lanes=4194304);d.isBackwards?(k.sibling=l.child,l.child=k):(a=d.last,a!==null?a.sibling=k:l.child=k,d.last=k)}return d.tail!==null?(a=d.tail,d.rendering=a,d.tail=a.sibling,d.renderingStartTime=$e(),a.sibling=null,f=jt.current,B(jt,x?f&1|2:f&1),ot&&ss(l,d.treeForkCount),a):(Ot(l),null);case 22:case 23:return xi(l),T0(),d=l.memoizedState!==null,a!==null?a.memoizedState!==null!==d&&(l.flags|=8192):d&&(l.flags|=8192),d?(f&536870912)!==0&&(l.flags&128)===0&&(Ot(l),l.subtreeFlags&6&&(l.flags|=8192)):Ot(l),f=l.updateQueue,f!==null&&Wp(l,f.retryQueue),f=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==f&&(l.flags|=2048),a!==null&&ne(ho),null;case 24:return f=null,a!==null&&(f=a.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),ls(Kt),Ot(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function l6(a,l){switch(p0(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return ls(Kt),Qe(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 26:case 27:case 5:return Lt(l),null;case 31:if(l.memoizedState!==null){if(xi(l),l.alternate===null)throw Error(i(340));uo()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 13:if(xi(l),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(i(340));uo()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return ne(jt),null;case 4:return Qe(),null;case 10:return ls(l.type),null;case 22:case 23:return xi(l),T0(),a!==null&&ne(ho),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return ls(Kt),null;case 25:return null;default:return null}}function rw(a,l){switch(p0(l),l.tag){case 3:ls(Kt),Qe();break;case 26:case 27:case 5:Lt(l);break;case 4:Qe();break;case 31:l.memoizedState!==null&&xi(l);break;case 13:xi(l);break;case 19:ne(jt);break;case 10:ls(l.type);break;case 22:case 23:xi(l),T0(),a!==null&&ne(ho);break;case 24:ls(Kt)}}function Ac(a,l){try{var f=l.updateQueue,d=f!==null?f.lastEffect:null;if(d!==null){var x=d.next;f=x;do{if((f.tag&a)===a){d=void 0;var k=f.create,N=f.inst;d=k(),N.destroy=d}f=f.next}while(f!==x)}}catch(R){vt(l,l.return,R)}}function aa(a,l,f){try{var d=l.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var k=x.next;d=k;do{if((d.tag&a)===a){var N=d.inst,R=N.destroy;if(R!==void 0){N.destroy=void 0,x=l;var $=f,ee=R;try{ee()}catch(se){vt(x,$,se)}}}d=d.next}while(d!==k)}}catch(se){vt(l,l.return,se)}}function sw(a){var l=a.updateQueue;if(l!==null){var f=a.stateNode;try{Yv(l,f)}catch(d){vt(a,a.return,d)}}}function aw(a,l,f){f.props=xo(a.type,a.memoizedProps),f.state=a.memoizedState;try{f.componentWillUnmount()}catch(d){vt(a,l,d)}}function Tc(a,l){try{var f=a.ref;if(f!==null){switch(a.tag){case 26:case 27:case 5:var d=a.stateNode;break;case 30:d=a.stateNode;break;default:d=a.stateNode}typeof f=="function"?a.refCleanup=f(d):f.current=d}}catch(x){vt(a,l,x)}}function Ir(a,l){var f=a.ref,d=a.refCleanup;if(f!==null)if(typeof d=="function")try{d()}catch(x){vt(a,l,x)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(x){vt(a,l,x)}else f.current=null}function ow(a){var l=a.type,f=a.memoizedProps,d=a.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":f.autoFocus&&d.focus();break e;case"img":f.src?d.src=f.src:f.srcSet&&(d.srcset=f.srcSet)}}catch(x){vt(a,a.return,x)}}function ay(a,l,f){try{var d=a.stateNode;O6(d,a.type,f,l),d[an]=l}catch(x){vt(a,a.return,x)}}function lw(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&pa(a.type)||a.tag===4}function oy(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||lw(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&pa(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function ly(a,l,f){var d=a.tag;if(d===5||d===6)a=a.stateNode,l?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(a,l):(l=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,l.appendChild(a),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=Ii));else if(d!==4&&(d===27&&pa(a.type)&&(f=a.stateNode,l=null),a=a.child,a!==null))for(ly(a,l,f),a=a.sibling;a!==null;)ly(a,l,f),a=a.sibling}function Zp(a,l,f){var d=a.tag;if(d===5||d===6)a=a.stateNode,l?f.insertBefore(a,l):f.appendChild(a);else if(d!==4&&(d===27&&pa(a.type)&&(f=a.stateNode),a=a.child,a!==null))for(Zp(a,l,f),a=a.sibling;a!==null;)Zp(a,l,f),a=a.sibling}function uw(a){var l=a.stateNode,f=a.memoizedProps;try{for(var d=a.type,x=l.attributes;x.length;)l.removeAttributeNode(x[0]);cn(l,d,f),l[Ht]=a,l[an]=f}catch(k){vt(a,a.return,k)}}var ps=!1,Xt=!1,uy=!1,cw=typeof WeakSet=="function"?WeakSet:Set,nn=null;function u6(a,l){if(a=a.containerInfo,Oy=Sd,a=vv(a),n0(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var d=f.getSelection&&f.getSelection();if(d&&d.rangeCount!==0){f=d.anchorNode;var x=d.anchorOffset,k=d.focusNode;d=d.focusOffset;try{f.nodeType,k.nodeType}catch{f=null;break e}var N=0,R=-1,$=-1,ee=0,se=0,ce=a,te=null;t:for(;;){for(var ie;ce!==f||x!==0&&ce.nodeType!==3||(R=N+x),ce!==k||d!==0&&ce.nodeType!==3||($=N+d),ce.nodeType===3&&(N+=ce.nodeValue.length),(ie=ce.firstChild)!==null;)te=ce,ce=ie;for(;;){if(ce===a)break t;if(te===f&&++ee===x&&(R=N),te===k&&++se===d&&($=N),(ie=ce.nextSibling)!==null)break;ce=te,te=ce.parentNode}ce=ie}f=R===-1||$===-1?null:{start:R,end:$}}else f=null}f=f||{start:0,end:0}}else f=null;for(Ry={focusedElem:a,selectionRange:f},Sd=!1,nn=l;nn!==null;)if(l=nn,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,nn=a;else for(;nn!==null;){switch(l=nn,k=l.alternate,a=l.flags,l.tag){case 0:if((a&4)!==0&&(a=l.updateQueue,a=a!==null?a.events:null,a!==null))for(f=0;f<a.length;f++)x=a[f],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&k!==null){a=void 0,f=l,x=k.memoizedProps,k=k.memoizedState,d=f.stateNode;try{var we=xo(f.type,x);a=d.getSnapshotBeforeUpdate(we,k),d.__reactInternalSnapshotBeforeUpdate=a}catch(Be){vt(f,f.return,Be)}}break;case 3:if((a&1024)!==0){if(a=l.stateNode.containerInfo,f=a.nodeType,f===9)_y(a);else if(f===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":_y(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(i(163))}if(a=l.sibling,a!==null){a.return=l.return,nn=a;break}nn=l.return}}function fw(a,l,f){var d=f.flags;switch(f.tag){case 0:case 11:case 15:ms(a,f),d&4&&Ac(5,f);break;case 1:if(ms(a,f),d&4)if(a=f.stateNode,l===null)try{a.componentDidMount()}catch(N){vt(f,f.return,N)}else{var x=xo(f.type,l.memoizedProps);l=l.memoizedState;try{a.componentDidUpdate(x,l,a.__reactInternalSnapshotBeforeUpdate)}catch(N){vt(f,f.return,N)}}d&64&&sw(f),d&512&&Tc(f,f.return);break;case 3:if(ms(a,f),d&64&&(a=f.updateQueue,a!==null)){if(l=null,f.child!==null)switch(f.child.tag){case 27:case 5:l=f.child.stateNode;break;case 1:l=f.child.stateNode}try{Yv(a,l)}catch(N){vt(f,f.return,N)}}break;case 27:l===null&&d&4&&uw(f);case 26:case 5:ms(a,f),l===null&&d&4&&ow(f),d&512&&Tc(f,f.return);break;case 12:ms(a,f);break;case 31:ms(a,f),d&4&&dw(a,f);break;case 13:ms(a,f),d&4&&mw(a,f),d&64&&(a=f.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(f=x6.bind(null,f),V6(a,f))));break;case 22:if(d=f.memoizedState!==null||ps,!d){l=l!==null&&l.memoizedState!==null||Xt,x=ps;var k=Xt;ps=d,(Xt=l)&&!k?gs(a,f,(f.subtreeFlags&8772)!==0):ms(a,f),ps=x,Xt=k}break;case 30:break;default:ms(a,f)}}function hw(a){var l=a.alternate;l!==null&&(a.alternate=null,hw(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&Sl(l)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var Dt=null,ei=!1;function ds(a,l,f){for(f=f.child;f!==null;)pw(a,l,f),f=f.sibling}function pw(a,l,f){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Se,f)}catch{}switch(f.tag){case 26:Xt||Ir(f,l),ds(a,l,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:Xt||Ir(f,l);var d=Dt,x=ei;pa(f.type)&&(Dt=f.stateNode,ei=!1),ds(a,l,f),Bc(f.stateNode),Dt=d,ei=x;break;case 5:Xt||Ir(f,l);case 6:if(d=Dt,x=ei,Dt=null,ds(a,l,f),Dt=d,ei=x,Dt!==null)if(ei)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(f.stateNode)}catch(k){vt(f,l,k)}else try{Dt.removeChild(f.stateNode)}catch(k){vt(f,l,k)}break;case 18:Dt!==null&&(ei?(a=Dt,s2(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,f.stateNode),Zl(a)):s2(Dt,f.stateNode));break;case 4:d=Dt,x=ei,Dt=f.stateNode.containerInfo,ei=!0,ds(a,l,f),Dt=d,ei=x;break;case 0:case 11:case 14:case 15:aa(2,f,l),Xt||aa(4,f,l),ds(a,l,f);break;case 1:Xt||(Ir(f,l),d=f.stateNode,typeof d.componentWillUnmount=="function"&&aw(f,l,d)),ds(a,l,f);break;case 21:ds(a,l,f);break;case 22:Xt=(d=Xt)||f.memoizedState!==null,ds(a,l,f),Xt=d;break;default:ds(a,l,f)}}function dw(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Zl(a)}catch(f){vt(l,l.return,f)}}}function mw(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Zl(a)}catch(f){vt(l,l.return,f)}}function c6(a){switch(a.tag){case 31:case 13:case 19:var l=a.stateNode;return l===null&&(l=a.stateNode=new cw),l;case 22:return a=a.stateNode,l=a._retryCache,l===null&&(l=a._retryCache=new cw),l;default:throw Error(i(435,a.tag))}}function ed(a,l){var f=c6(a);l.forEach(function(d){if(!f.has(d)){f.add(d);var x=b6.bind(null,a,d);d.then(x,x)}})}function ti(a,l){var f=l.deletions;if(f!==null)for(var d=0;d<f.length;d++){var x=f[d],k=a,N=l,R=N;e:for(;R!==null;){switch(R.tag){case 27:if(pa(R.type)){Dt=R.stateNode,ei=!1;break e}break;case 5:Dt=R.stateNode,ei=!1;break e;case 3:case 4:Dt=R.stateNode.containerInfo,ei=!0;break e}R=R.return}if(Dt===null)throw Error(i(160));pw(k,N,x),Dt=null,ei=!1,k=x.alternate,k!==null&&(k.return=null),x.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)gw(l,a),l=l.sibling}var xr=null;function gw(a,l){var f=a.alternate,d=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:ti(l,a),ni(a),d&4&&(aa(3,a,a.return),Ac(3,a),aa(5,a,a.return));break;case 1:ti(l,a),ni(a),d&512&&(Xt||f===null||Ir(f,f.return)),d&64&&ps&&(a=a.updateQueue,a!==null&&(d=a.callbacks,d!==null&&(f=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=f===null?d:f.concat(d))));break;case 26:var x=xr;if(ti(l,a),ni(a),d&512&&(Xt||f===null||Ir(f,f.return)),d&4){var k=f!==null?f.memoizedState:null;if(d=a.memoizedState,f===null)if(d===null)if(a.stateNode===null){e:{d=a.type,f=a.memoizedProps,x=x.ownerDocument||x;t:switch(d){case"title":k=x.getElementsByTagName("title")[0],(!k||k[Js]||k[Ht]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=x.createElement(d),x.head.insertBefore(k,x.querySelector("head > title"))),cn(k,d,f),k[Ht]=a,qt(k),d=k;break e;case"link":var N=g2("link","href",x).get(d+(f.href||""));if(N){for(var R=0;R<N.length;R++)if(k=N[R],k.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&k.getAttribute("rel")===(f.rel==null?null:f.rel)&&k.getAttribute("title")===(f.title==null?null:f.title)&&k.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){N.splice(R,1);break t}}k=x.createElement(d),cn(k,d,f),x.head.appendChild(k);break;case"meta":if(N=g2("meta","content",x).get(d+(f.content||""))){for(R=0;R<N.length;R++)if(k=N[R],k.getAttribute("content")===(f.content==null?null:""+f.content)&&k.getAttribute("name")===(f.name==null?null:f.name)&&k.getAttribute("property")===(f.property==null?null:f.property)&&k.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&k.getAttribute("charset")===(f.charSet==null?null:f.charSet)){N.splice(R,1);break t}}k=x.createElement(d),cn(k,d,f),x.head.appendChild(k);break;default:throw Error(i(468,d))}k[Ht]=a,qt(k),d=k}a.stateNode=d}else y2(x,a.type,a.stateNode);else a.stateNode=m2(x,d,a.memoizedProps);else k!==d?(k===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):k.count--,d===null?y2(x,a.type,a.stateNode):m2(x,d,a.memoizedProps)):d===null&&a.stateNode!==null&&ay(a,a.memoizedProps,f.memoizedProps)}break;case 27:ti(l,a),ni(a),d&512&&(Xt||f===null||Ir(f,f.return)),f!==null&&d&4&&ay(a,a.memoizedProps,f.memoizedProps);break;case 5:if(ti(l,a),ni(a),d&512&&(Xt||f===null||Ir(f,f.return)),a.flags&32){x=a.stateNode;try{mr(x,"")}catch(we){vt(a,a.return,we)}}d&4&&a.stateNode!=null&&(x=a.memoizedProps,ay(a,x,f!==null?f.memoizedProps:x)),d&1024&&(uy=!0);break;case 6:if(ti(l,a),ni(a),d&4){if(a.stateNode===null)throw Error(i(162));d=a.memoizedProps,f=a.stateNode;try{f.nodeValue=d}catch(we){vt(a,a.return,we)}}break;case 3:if(gd=null,x=xr,xr=dd(l.containerInfo),ti(l,a),xr=x,ni(a),d&4&&f!==null&&f.memoizedState.isDehydrated)try{Zl(l.containerInfo)}catch(we){vt(a,a.return,we)}uy&&(uy=!1,yw(a));break;case 4:d=xr,xr=dd(a.stateNode.containerInfo),ti(l,a),ni(a),xr=d;break;case 12:ti(l,a),ni(a);break;case 31:ti(l,a),ni(a),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,ed(a,d)));break;case 13:ti(l,a),ni(a),a.child.flags&8192&&a.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(nd=$e()),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,ed(a,d)));break;case 22:x=a.memoizedState!==null;var $=f!==null&&f.memoizedState!==null,ee=ps,se=Xt;if(ps=ee||x,Xt=se||$,ti(l,a),Xt=se,ps=ee,ni(a),d&8192)e:for(l=a.stateNode,l._visibility=x?l._visibility&-2:l._visibility|1,x&&(f===null||$||ps||Xt||bo(a)),f=null,l=a;;){if(l.tag===5||l.tag===26){if(f===null){$=f=l;try{if(k=$.stateNode,x)N=k.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{R=$.stateNode;var ce=$.memoizedProps.style,te=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;R.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(we){vt($,$.return,we)}}}else if(l.tag===6){if(f===null){$=l;try{$.stateNode.nodeValue=x?"":$.memoizedProps}catch(we){vt($,$.return,we)}}}else if(l.tag===18){if(f===null){$=l;try{var ie=$.stateNode;x?a2(ie,!0):a2($.stateNode,!1)}catch(we){vt($,$.return,we)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===a)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break e;for(;l.sibling===null;){if(l.return===null||l.return===a)break e;f===l&&(f=null),l=l.return}f===l&&(f=null),l.sibling.return=l.return,l=l.sibling}d&4&&(d=a.updateQueue,d!==null&&(f=d.retryQueue,f!==null&&(d.retryQueue=null,ed(a,f))));break;case 19:ti(l,a),ni(a),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,ed(a,d)));break;case 30:break;case 21:break;default:ti(l,a),ni(a)}}function ni(a){var l=a.flags;if(l&2){try{for(var f,d=a.return;d!==null;){if(lw(d)){f=d;break}d=d.return}if(f==null)throw Error(i(160));switch(f.tag){case 27:var x=f.stateNode,k=oy(a);Zp(a,k,x);break;case 5:var N=f.stateNode;f.flags&32&&(mr(N,""),f.flags&=-33);var R=oy(a);Zp(a,R,N);break;case 3:case 4:var $=f.stateNode.containerInfo,ee=oy(a);ly(a,ee,$);break;default:throw Error(i(161))}}catch(se){vt(a,a.return,se)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function yw(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var l=a;yw(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),a=a.sibling}}function ms(a,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)fw(a,l.alternate,l),l=l.sibling}function bo(a){for(a=a.child;a!==null;){var l=a;switch(l.tag){case 0:case 11:case 14:case 15:aa(4,l,l.return),bo(l);break;case 1:Ir(l,l.return);var f=l.stateNode;typeof f.componentWillUnmount=="function"&&aw(l,l.return,f),bo(l);break;case 27:Bc(l.stateNode);case 26:case 5:Ir(l,l.return),bo(l);break;case 22:l.memoizedState===null&&bo(l);break;case 30:bo(l);break;default:bo(l)}a=a.sibling}}function gs(a,l,f){for(f=f&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var d=l.alternate,x=a,k=l,N=k.flags;switch(k.tag){case 0:case 11:case 15:gs(x,k,f),Ac(4,k);break;case 1:if(gs(x,k,f),d=k,x=d.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ee){vt(d,d.return,ee)}if(d=k,x=d.updateQueue,x!==null){var R=d.stateNode;try{var $=x.shared.hiddenCallbacks;if($!==null)for(x.shared.hiddenCallbacks=null,x=0;x<$.length;x++)Gv($[x],R)}catch(ee){vt(d,d.return,ee)}}f&&N&64&&sw(k),Tc(k,k.return);break;case 27:uw(k);case 26:case 5:gs(x,k,f),f&&d===null&&N&4&&ow(k),Tc(k,k.return);break;case 12:gs(x,k,f);break;case 31:gs(x,k,f),f&&N&4&&dw(x,k);break;case 13:gs(x,k,f),f&&N&4&&mw(x,k);break;case 22:k.memoizedState===null&&gs(x,k,f),Tc(k,k.return);break;case 30:break;default:gs(x,k,f)}l=l.sibling}}function cy(a,l){var f=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==f&&(a!=null&&a.refCount++,f!=null&&dc(f))}function fy(a,l){a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&dc(a))}function br(a,l,f,d){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)xw(a,l,f,d),l=l.sibling}function xw(a,l,f,d){var x=l.flags;switch(l.tag){case 0:case 11:case 15:br(a,l,f,d),x&2048&&Ac(9,l);break;case 1:br(a,l,f,d);break;case 3:br(a,l,f,d),x&2048&&(a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&dc(a)));break;case 12:if(x&2048){br(a,l,f,d),a=l.stateNode;try{var k=l.memoizedProps,N=k.id,R=k.onPostCommit;typeof R=="function"&&R(N,l.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch($){vt(l,l.return,$)}}else br(a,l,f,d);break;case 31:br(a,l,f,d);break;case 13:br(a,l,f,d);break;case 23:break;case 22:k=l.stateNode,N=l.alternate,l.memoizedState!==null?k._visibility&2?br(a,l,f,d):Mc(a,l):k._visibility&2?br(a,l,f,d):(k._visibility|=2,$l(a,l,f,d,(l.subtreeFlags&10256)!==0||!1)),x&2048&&cy(N,l);break;case 24:br(a,l,f,d),x&2048&&fy(l.alternate,l);break;default:br(a,l,f,d)}}function $l(a,l,f,d,x){for(x=x&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var k=a,N=l,R=f,$=d,ee=N.flags;switch(N.tag){case 0:case 11:case 15:$l(k,N,R,$,x),Ac(8,N);break;case 23:break;case 22:var se=N.stateNode;N.memoizedState!==null?se._visibility&2?$l(k,N,R,$,x):Mc(k,N):(se._visibility|=2,$l(k,N,R,$,x)),x&&ee&2048&&cy(N.alternate,N);break;case 24:$l(k,N,R,$,x),x&&ee&2048&&fy(N.alternate,N);break;default:$l(k,N,R,$,x)}l=l.sibling}}function Mc(a,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var f=a,d=l,x=d.flags;switch(d.tag){case 22:Mc(f,d),x&2048&&cy(d.alternate,d);break;case 24:Mc(f,d),x&2048&&fy(d.alternate,d);break;default:Mc(f,d)}l=l.sibling}}var Oc=8192;function Ul(a,l,f){if(a.subtreeFlags&Oc)for(a=a.child;a!==null;)bw(a,l,f),a=a.sibling}function bw(a,l,f){switch(a.tag){case 26:Ul(a,l,f),a.flags&Oc&&a.memoizedState!==null&&X6(f,xr,a.memoizedState,a.memoizedProps);break;case 5:Ul(a,l,f);break;case 3:case 4:var d=xr;xr=dd(a.stateNode.containerInfo),Ul(a,l,f),xr=d;break;case 22:a.memoizedState===null&&(d=a.alternate,d!==null&&d.memoizedState!==null?(d=Oc,Oc=16777216,Ul(a,l,f),Oc=d):Ul(a,l,f));break;default:Ul(a,l,f)}}function Sw(a){var l=a.alternate;if(l!==null&&(a=l.child,a!==null)){l.child=null;do l=a.sibling,a.sibling=null,a=l;while(a!==null)}}function Rc(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var d=l[f];nn=d,vw(d,a)}Sw(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)kw(a),a=a.sibling}function kw(a){switch(a.tag){case 0:case 11:case 15:Rc(a),a.flags&2048&&aa(9,a,a.return);break;case 3:Rc(a);break;case 12:Rc(a);break;case 22:var l=a.stateNode;a.memoizedState!==null&&l._visibility&2&&(a.return===null||a.return.tag!==13)?(l._visibility&=-3,td(a)):Rc(a);break;default:Rc(a)}}function td(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var d=l[f];nn=d,vw(d,a)}Sw(a)}for(a=a.child;a!==null;){switch(l=a,l.tag){case 0:case 11:case 15:aa(8,l,l.return),td(l);break;case 22:f=l.stateNode,f._visibility&2&&(f._visibility&=-3,td(l));break;default:td(l)}a=a.sibling}}function vw(a,l){for(;nn!==null;){var f=nn;switch(f.tag){case 0:case 11:case 15:aa(8,f,l);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var d=f.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:dc(f.memoizedState.cache)}if(d=f.child,d!==null)d.return=f,nn=d;else e:for(f=a;nn!==null;){d=nn;var x=d.sibling,k=d.return;if(hw(d),d===f){nn=null;break e}if(x!==null){x.return=k,nn=x;break e}nn=k}}}var f6={getCacheForType:function(a){var l=ln(Kt),f=l.data.get(a);return f===void 0&&(f=a(),l.data.set(a,f)),f},cacheSignal:function(){return ln(Kt).controller.signal}},h6=typeof WeakMap=="function"?WeakMap:Map,dt=0,At=null,et=null,it=0,kt=0,bi=null,oa=!1,Jl=!1,hy=!1,ys=0,Vt=0,la=0,So=0,py=0,Si=0,Hl=0,Dc=null,ii=null,dy=!1,nd=0,Cw=0,id=1/0,rd=null,ua=null,Wt=0,ca=null,ql=null,xs=0,my=0,gy=null,ww=null,Ic=0,yy=null;function ki(){return(dt&2)!==0&&it!==0?it&-it:W.T!==null?Cy():pp()}function Ew(){if(Si===0)if((it&536870912)===0||ot){var a=Qr;Qr<<=1,(Qr&3932160)===0&&(Qr=262144),Si=a}else Si=536870912;return a=yi.current,a!==null&&(a.flags|=32),Si}function ri(a,l,f){(a===At&&(kt===2||kt===9)||a.cancelPendingCommit!==null)&&(Kl(a,0),fa(a,it,Si,!1)),no(a,f),((dt&2)===0||a!==At)&&(a===At&&((dt&2)===0&&(So|=f),Vt===4&&fa(a,it,Si,!1)),_r(a))}function Nw(a,l,f){if((dt&6)!==0)throw Error(i(327));var d=!f&&(l&127)===0&&(l&a.expiredLanes)===0||Di(a,l),x=d?m6(a,l):by(a,l,!0),k=d;do{if(x===0){Jl&&!d&&fa(a,l,0,!1);break}else{if(f=a.current.alternate,k&&!p6(f)){x=by(a,l,!1),k=!1;continue}if(x===2){if(k=l,a.errorRecoveryDisabledLanes&k)var N=0;else N=a.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){l=N;e:{var R=a;x=Dc;var $=R.current.memoizedState.isDehydrated;if($&&(Kl(R,N).flags|=256),N=by(R,N,!1),N!==2){if(hy&&!$){R.errorRecoveryDisabledLanes|=k,So|=k,x=4;break e}k=ii,ii=x,k!==null&&(ii===null?ii=k:ii.push.apply(ii,k))}x=N}if(k=!1,x!==2)continue}}if(x===1){Kl(a,0),fa(a,l,0,!0);break}e:{switch(d=a,k=x,k){case 0:case 1:throw Error(i(345));case 4:if((l&4194048)!==l)break;case 6:fa(d,l,Si,!oa);break e;case 2:ii=null;break;case 3:case 5:break;default:throw Error(i(329))}if((l&62914560)===l&&(x=nd+300-$e(),10<x)){if(fa(d,l,Si,!oa),gt(d,0,!0)!==0)break e;xs=l,d.timeoutHandle=i2(Aw.bind(null,d,f,ii,rd,dy,l,Si,So,Hl,oa,k,"Throttled",-0,0),x);break e}Aw(d,f,ii,rd,dy,l,Si,So,Hl,oa,k,null,-0,0)}}break}while(!0);_r(a)}function Aw(a,l,f,d,x,k,N,R,$,ee,se,ce,te,ie){if(a.timeoutHandle=-1,ce=l.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ii},bw(l,k,ce);var we=(k&62914560)===k?nd-$e():(k&4194048)===k?Cw-$e():0;if(we=Q6(ce,we),we!==null){xs=k,a.cancelPendingCommit=we(zw.bind(null,a,l,k,f,d,x,N,R,$,se,ce,null,te,ie)),fa(a,k,N,!ee);return}}zw(a,l,k,f,d,x,N,R,$)}function p6(a){for(var l=a;;){var f=l.tag;if((f===0||f===11||f===15)&&l.flags&16384&&(f=l.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var d=0;d<f.length;d++){var x=f[d],k=x.getSnapshot;x=x.value;try{if(!mi(k(),x))return!1}catch{return!1}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function fa(a,l,f,d){l&=~py,l&=~So,a.suspendedLanes|=l,a.pingedLanes&=~l,d&&(a.warmLanes|=l),d=a.expirationTimes;for(var x=l;0<x;){var k=31-St(x),N=1<<k;d[k]=-1,x&=~N}f!==0&&fr(a,f,l)}function sd(){return(dt&6)===0?(_c(0),!1):!0}function xy(){if(et!==null){if(kt===0)var a=et.return;else a=et,as=co=null,_0(a),Bl=null,gc=0,a=et;for(;a!==null;)rw(a.alternate,a),a=a.return;et=null}}function Kl(a,l){var f=a.timeoutHandle;f!==-1&&(a.timeoutHandle=-1,I6(f)),f=a.cancelPendingCommit,f!==null&&(a.cancelPendingCommit=null,f()),xs=0,xy(),At=a,et=f=rs(a.current,null),it=l,kt=0,bi=null,oa=!1,Jl=Di(a,l),hy=!1,Hl=Si=py=So=la=Vt=0,ii=Dc=null,dy=!1,(l&8)!==0&&(l|=l&32);var d=a.entangledLanes;if(d!==0)for(a=a.entanglements,d&=l;0<d;){var x=31-St(d),k=1<<x;l|=a[x],d&=~k}return ys=l,Np(),f}function Tw(a,l){Ke=null,W.H=wc,l===Ll||l===_p?(l=Jv(),kt=3):l===v0?(l=Jv(),kt=4):kt=l===X0?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,bi=l,et===null&&(Vt=1,Gp(a,Bi(l,a.current)))}function Mw(){var a=yi.current;return a===null?!0:(it&4194048)===it?ji===null:(it&62914560)===it||(it&536870912)!==0?a===ji:!1}function Ow(){var a=W.H;return W.H=wc,a===null?wc:a}function Rw(){var a=W.A;return W.A=f6,a}function ad(){Vt=4,oa||(it&4194048)!==it&&yi.current!==null||(Jl=!0),(la&134217727)===0&&(So&134217727)===0||At===null||fa(At,it,Si,!1)}function by(a,l,f){var d=dt;dt|=2;var x=Ow(),k=Rw();(At!==a||it!==l)&&(rd=null,Kl(a,l)),l=!1;var N=Vt;e:do try{if(kt!==0&&et!==null){var R=et,$=bi;switch(kt){case 8:xy(),N=6;break e;case 3:case 2:case 9:case 6:yi.current===null&&(l=!0);var ee=kt;if(kt=0,bi=null,Gl(a,R,$,ee),f&&Jl){N=0;break e}break;default:ee=kt,kt=0,bi=null,Gl(a,R,$,ee)}}d6(),N=Vt;break}catch(se){Tw(a,se)}while(!0);return l&&a.shellSuspendCounter++,as=co=null,dt=d,W.H=x,W.A=k,et===null&&(At=null,it=0,Np()),N}function d6(){for(;et!==null;)Dw(et)}function m6(a,l){var f=dt;dt|=2;var d=Ow(),x=Rw();At!==a||it!==l?(rd=null,id=$e()+500,Kl(a,l)):Jl=Di(a,l);e:do try{if(kt!==0&&et!==null){l=et;var k=bi;t:switch(kt){case 1:kt=0,bi=null,Gl(a,l,k,1);break;case 2:case 9:if($v(k)){kt=0,bi=null,Iw(l);break}l=function(){kt!==2&&kt!==9||At!==a||(kt=7),_r(a)},k.then(l,l);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:$v(k)?(kt=0,bi=null,Iw(l)):(kt=0,bi=null,Gl(a,l,k,7));break;case 5:var N=null;switch(et.tag){case 26:N=et.memoizedState;case 5:case 27:var R=et;if(N?x2(N):R.stateNode.complete){kt=0,bi=null;var $=R.sibling;if($!==null)et=$;else{var ee=R.return;ee!==null?(et=ee,od(ee)):et=null}break t}}kt=0,bi=null,Gl(a,l,k,5);break;case 6:kt=0,bi=null,Gl(a,l,k,6);break;case 8:xy(),Vt=6;break e;default:throw Error(i(462))}}g6();break}catch(se){Tw(a,se)}while(!0);return as=co=null,W.H=d,W.A=x,dt=f,et!==null?0:(At=null,it=0,Np(),Vt)}function g6(){for(;et!==null&&!Mr();)Dw(et)}function Dw(a){var l=nw(a.alternate,a,ys);a.memoizedProps=a.pendingProps,l===null?od(a):et=l}function Iw(a){var l=a,f=l.alternate;switch(l.tag){case 15:case 0:l=XC(f,l,l.pendingProps,l.type,void 0,it);break;case 11:l=XC(f,l,l.pendingProps,l.type.render,l.ref,it);break;case 5:_0(l);default:rw(f,l),l=et=Rv(l,ys),l=nw(f,l,ys)}a.memoizedProps=a.pendingProps,l===null?od(a):et=l}function Gl(a,l,f,d){as=co=null,_0(l),Bl=null,gc=0;var x=l.return;try{if(r6(a,x,l,f,it)){Vt=1,Gp(a,Bi(f,a.current)),et=null;return}}catch(k){if(x!==null)throw et=x,k;Vt=1,Gp(a,Bi(f,a.current)),et=null;return}l.flags&32768?(ot||d===1?a=!0:Jl||(it&536870912)!==0?a=!1:(oa=a=!0,(d===2||d===9||d===3||d===6)&&(d=yi.current,d!==null&&d.tag===13&&(d.flags|=16384))),_w(l,a)):od(l)}function od(a){var l=a;do{if((l.flags&32768)!==0){_w(l,oa);return}a=l.return;var f=o6(l.alternate,l,ys);if(f!==null){et=f;return}if(l=l.sibling,l!==null){et=l;return}et=l=a}while(l!==null);Vt===0&&(Vt=5)}function _w(a,l){do{var f=l6(a.alternate,a);if(f!==null){f.flags&=32767,et=f;return}if(f=a.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!l&&(a=a.sibling,a!==null)){et=a;return}et=a=f}while(a!==null);Vt=6,et=null}function zw(a,l,f,d,x,k,N,R,$){a.cancelPendingCommit=null;do ld();while(Wt!==0);if((dt&6)!==0)throw Error(i(327));if(l!==null){if(l===a.current)throw Error(i(177));if(k=l.lanes|l.childLanes,k|=o0,xl(a,f,k,N,R,$),a===At&&(et=At=null,it=0),ql=l,ca=a,xs=f,my=k,gy=x,ww=d,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,S6(I,function(){return Pw(),null})):(a.callbackNode=null,a.callbackPriority=0),d=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||d){d=W.T,W.T=null,x=oe.p,oe.p=2,N=dt,dt|=4;try{u6(a,l,f)}finally{dt=N,oe.p=x,W.T=d}}Wt=1,Lw(),Bw(),Vw()}}function Lw(){if(Wt===1){Wt=0;var a=ca,l=ql,f=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||f){f=W.T,W.T=null;var d=oe.p;oe.p=2;var x=dt;dt|=4;try{gw(l,a);var k=Ry,N=vv(a.containerInfo),R=k.focusedElem,$=k.selectionRange;if(N!==R&&R&&R.ownerDocument&&kv(R.ownerDocument.documentElement,R)){if($!==null&&n0(R)){var ee=$.start,se=$.end;if(se===void 0&&(se=ee),"selectionStart"in R)R.selectionStart=ee,R.selectionEnd=Math.min(se,R.value.length);else{var ce=R.ownerDocument||document,te=ce&&ce.defaultView||window;if(te.getSelection){var ie=te.getSelection(),we=R.textContent.length,Be=Math.min($.start,we),Nt=$.end===void 0?Be:Math.min($.end,we);!ie.extend&&Be>Nt&&(N=Nt,Nt=Be,Be=N);var Y=Sv(R,Be),U=Sv(R,Nt);if(Y&&U&&(ie.rangeCount!==1||ie.anchorNode!==Y.node||ie.anchorOffset!==Y.offset||ie.focusNode!==U.node||ie.focusOffset!==U.offset)){var Q=ce.createRange();Q.setStart(Y.node,Y.offset),ie.removeAllRanges(),Be>Nt?(ie.addRange(Q),ie.extend(U.node,U.offset)):(Q.setEnd(U.node,U.offset),ie.addRange(Q))}}}}for(ce=[],ie=R;ie=ie.parentNode;)ie.nodeType===1&&ce.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<ce.length;R++){var le=ce[R];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Sd=!!Oy,Ry=Oy=null}finally{dt=x,oe.p=d,W.T=f}}a.current=l,Wt=2}}function Bw(){if(Wt===2){Wt=0;var a=ca,l=ql,f=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||f){f=W.T,W.T=null;var d=oe.p;oe.p=2;var x=dt;dt|=4;try{fw(a,l.alternate,l)}finally{dt=x,oe.p=d,W.T=f}}Wt=3}}function Vw(){if(Wt===4||Wt===3){Wt=0,Ri();var a=ca,l=ql,f=xs,d=ww;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Wt=5:(Wt=0,ql=ca=null,Fw(a,a.pendingLanes));var x=a.pendingLanes;if(x===0&&(ua=null),bl(f),l=l.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(Se,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=W.T,x=oe.p,oe.p=2,W.T=null;try{for(var k=a.onRecoverableError,N=0;N<d.length;N++){var R=d[N];k(R.value,{componentStack:R.stack})}}finally{W.T=l,oe.p=x}}(xs&3)!==0&&ld(),_r(a),x=a.pendingLanes,(f&261930)!==0&&(x&42)!==0?a===yy?Ic++:(Ic=0,yy=a):Ic=0,_c(0)}}function Fw(a,l){(a.pooledCacheLanes&=l)===0&&(l=a.pooledCache,l!=null&&(a.pooledCache=null,dc(l)))}function ld(){return Lw(),Bw(),Vw(),Pw()}function Pw(){if(Wt!==5)return!1;var a=ca,l=my;my=0;var f=bl(xs),d=W.T,x=oe.p;try{oe.p=32>f?32:f,W.T=null,f=gy,gy=null;var k=ca,N=xs;if(Wt=0,ql=ca=null,xs=0,(dt&6)!==0)throw Error(i(331));var R=dt;if(dt|=4,kw(k.current),xw(k,k.current,N,f),dt=R,_c(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(Se,k)}catch{}return!0}finally{oe.p=x,W.T=d,Fw(a,l)}}function jw(a,l,f){l=Bi(f,l),l=Y0(a.stateNode,l,2),a=ia(a,l,2),a!==null&&(no(a,2),_r(a))}function vt(a,l,f){if(a.tag===3)jw(a,a,f);else for(;l!==null;){if(l.tag===3){jw(l,a,f);break}else if(l.tag===1){var d=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ua===null||!ua.has(d))){a=Bi(f,a),f=$C(2),d=ia(l,f,2),d!==null&&(UC(f,d,l,a),no(d,2),_r(d));break}}l=l.return}}function Sy(a,l,f){var d=a.pingCache;if(d===null){d=a.pingCache=new h6;var x=new Set;d.set(l,x)}else x=d.get(l),x===void 0&&(x=new Set,d.set(l,x));x.has(f)||(hy=!0,x.add(f),a=y6.bind(null,a,l,f),l.then(a,a))}function y6(a,l,f){var d=a.pingCache;d!==null&&d.delete(l),a.pingedLanes|=a.suspendedLanes&f,a.warmLanes&=~f,At===a&&(it&f)===f&&(Vt===4||Vt===3&&(it&62914560)===it&&300>$e()-nd?(dt&2)===0&&Kl(a,0):py|=f,Hl===it&&(Hl=0)),_r(a)}function $w(a,l){l===0&&(l=Xu()),a=oo(a,l),a!==null&&(no(a,l),_r(a))}function x6(a){var l=a.memoizedState,f=0;l!==null&&(f=l.retryLane),$w(a,f)}function b6(a,l){var f=0;switch(a.tag){case 31:case 13:var d=a.stateNode,x=a.memoizedState;x!==null&&(f=x.retryLane);break;case 19:d=a.stateNode;break;case 22:d=a.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(l),$w(a,f)}function S6(a,l){return On(a,l)}var ud=null,Yl=null,ky=!1,cd=!1,vy=!1,ha=0;function _r(a){a!==Yl&&a.next===null&&(Yl===null?ud=Yl=a:Yl=Yl.next=a),cd=!0,ky||(ky=!0,v6())}function _c(a,l){if(!vy&&cd){vy=!0;do for(var f=!1,d=ud;d!==null;){if(a!==0){var x=d.pendingLanes;if(x===0)var k=0;else{var N=d.suspendedLanes,R=d.pingedLanes;k=(1<<31-St(42|a)+1)-1,k&=x&~(N&~R),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(f=!0,qw(d,k))}else k=it,k=gt(d,d===At?k:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(k&3)===0||Di(d,k)||(f=!0,qw(d,k));d=d.next}while(f);vy=!1}}function k6(){Uw()}function Uw(){cd=ky=!1;var a=0;ha!==0&&D6()&&(a=ha);for(var l=$e(),f=null,d=ud;d!==null;){var x=d.next,k=Jw(d,l);k===0?(d.next=null,f===null?ud=x:f.next=x,x===null&&(Yl=f)):(f=d,(a!==0||(k&3)!==0)&&(cd=!0)),d=x}Wt!==0&&Wt!==5||_c(a),ha!==0&&(ha=0)}function Jw(a,l){for(var f=a.suspendedLanes,d=a.pingedLanes,x=a.expirationTimes,k=a.pendingLanes&-62914561;0<k;){var N=31-St(k),R=1<<N,$=x[N];$===-1?((R&f)===0||(R&d)!==0)&&(x[N]=je(R,l)):$<=l&&(a.expiredLanes|=R),k&=~R}if(l=At,f=it,f=gt(a,a===l?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),d=a.callbackNode,f===0||a===l&&(kt===2||kt===9)||a.cancelPendingCommit!==null)return d!==null&&d!==null&&Oi(d),a.callbackNode=null,a.callbackPriority=0;if((f&3)===0||Di(a,f)){if(l=f&-f,l===a.callbackPriority)return l;switch(d!==null&&Oi(d),bl(f)){case 2:case 8:f=me;break;case 32:f=I;break;case 268435456:f=Pe;break;default:f=I}return d=Hw.bind(null,a),f=On(f,d),a.callbackPriority=l,a.callbackNode=f,l}return d!==null&&d!==null&&Oi(d),a.callbackPriority=2,a.callbackNode=null,2}function Hw(a,l){if(Wt!==0&&Wt!==5)return a.callbackNode=null,a.callbackPriority=0,null;var f=a.callbackNode;if(ld()&&a.callbackNode!==f)return null;var d=it;return d=gt(a,a===At?d:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),d===0?null:(Nw(a,d,l),Jw(a,$e()),a.callbackNode!=null&&a.callbackNode===f?Hw.bind(null,a):null)}function qw(a,l){if(ld())return null;Nw(a,l,!0)}function v6(){_6(function(){(dt&6)!==0?On(ae,k6):Uw()})}function Cy(){if(ha===0){var a=_l;a===0&&(a=yl,yl<<=1,(yl&261888)===0&&(yl=256)),ha=a}return ha}function Kw(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:ro(""+a)}function Gw(a,l){var f=l.ownerDocument.createElement("input");return f.name=l.name,f.value=l.value,a.id&&f.setAttribute("form",a.id),l.parentNode.insertBefore(f,l),a=new FormData(a),f.parentNode.removeChild(f),a}function C6(a,l,f,d,x){if(l==="submit"&&f&&f.stateNode===x){var k=Kw((x[an]||null).action),N=d.submitter;N&&(l=(l=N[an]||null)?Kw(l.formAction):N.getAttribute("formAction"),l!==null&&(k=l,N=null));var R=new gr("action","action",null,d,x);a.push({event:R,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ha!==0){var $=N?Gw(x,N):new FormData(x);U0(f,{pending:!0,data:$,method:x.method,action:k},null,$)}}else typeof k=="function"&&(R.preventDefault(),$=N?Gw(x,N):new FormData(x),U0(f,{pending:!0,data:$,method:x.method,action:k},k,$))},currentTarget:x}]})}}for(var wy=0;wy<a0.length;wy++){var Ey=a0[wy],w6=Ey.toLowerCase(),E6=Ey[0].toUpperCase()+Ey.slice(1);yr(w6,"on"+E6)}yr(Ev,"onAnimationEnd"),yr(Nv,"onAnimationIteration"),yr(Av,"onAnimationStart"),yr("dblclick","onDoubleClick"),yr("focusin","onFocus"),yr("focusout","onBlur"),yr(j_,"onTransitionRun"),yr($_,"onTransitionStart"),yr(U_,"onTransitionCancel"),yr(Tv,"onTransitionEnd"),Or("onMouseEnter",["mouseout","mouseover"]),Or("onMouseLeave",["mouseout","mouseover"]),Or("onPointerEnter",["pointerout","pointerover"]),Or("onPointerLeave",["pointerout","pointerover"]),is("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),is("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),is("onBeforeInput",["compositionend","keypress","textInput","paste"]),is("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),is("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),is("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),N6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zc));function Yw(a,l){l=(l&4)!==0;for(var f=0;f<a.length;f++){var d=a[f],x=d.event;d=d.listeners;e:{var k=void 0;if(l)for(var N=d.length-1;0<=N;N--){var R=d[N],$=R.instance,ee=R.currentTarget;if(R=R.listener,$!==k&&x.isPropagationStopped())break e;k=R,x.currentTarget=ee;try{k(x)}catch(se){Ep(se)}x.currentTarget=null,k=$}else for(N=0;N<d.length;N++){if(R=d[N],$=R.instance,ee=R.currentTarget,R=R.listener,$!==k&&x.isPropagationStopped())break e;k=R,x.currentTarget=ee;try{k(x)}catch(se){Ep(se)}x.currentTarget=null,k=$}}}}function tt(a,l){var f=l[Wu];f===void 0&&(f=l[Wu]=new Set);var d=a+"__bubble";f.has(d)||(Xw(l,a,2,!1),f.add(d))}function Ny(a,l,f){var d=0;l&&(d|=4),Xw(f,a,d,l)}var fd="_reactListening"+Math.random().toString(36).slice(2);function Ay(a){if(!a[fd]){a[fd]=!0,mp.forEach(function(f){f!=="selectionchange"&&(N6.has(f)||Ny(f,!1,a),Ny(f,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[fd]||(l[fd]=!0,Ny("selectionchange",!1,l))}}function Xw(a,l,f,d){switch(E2(l)){case 2:var x=e4;break;case 8:x=t4;break;default:x=$y}f=x.bind(null,l,f,a),x=void 0,!X||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),d?x!==void 0?a.addEventListener(l,f,{capture:!0,passive:x}):a.addEventListener(l,f,!0):x!==void 0?a.addEventListener(l,f,{passive:x}):a.addEventListener(l,f,!1)}function Ty(a,l,f,d,x){var k=d;if((l&1)===0&&(l&2)===0&&d!==null)e:for(;;){if(d===null)return;var N=d.tag;if(N===3||N===4){var R=d.stateNode.containerInfo;if(R===x)break;if(N===4)for(N=d.return;N!==null;){var $=N.tag;if(($===3||$===4)&&N.stateNode.containerInfo===x)return;N=N.return}for(;R!==null;){if(N=es(R),N===null)return;if($=N.tag,$===5||$===6||$===26||$===27){d=k=N;continue e}R=R.parentNode}}d=d.return}w(function(){var ee=k,se=sc(f),ce=[];e:{var te=Mv.get(a);if(te!==void 0){var ie=gr,we=a;switch(a){case"keypress":if(yt(f)===0)break e;case"keydown":case"keyup":ie=b_;break;case"focusin":we="focus",ie=Qg;break;case"focusout":we="blur",ie=Qg;break;case"beforeblur":case"afterblur":ie=Qg;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=rv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=o_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=v_;break;case Ev:case Nv:case Av:ie=c_;break;case Tv:ie=w_;break;case"scroll":case"scrollend":ie=s_;break;case"wheel":ie=N_;break;case"copy":case"cut":case"paste":ie=h_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=av;break;case"toggle":case"beforetoggle":ie=T_}var Be=(l&4)!==0,Nt=!Be&&(a==="scroll"||a==="scrollend"),Y=Be?te!==null?te+"Capture":null:te;Be=[];for(var U=ee,Q;U!==null;){var le=U;if(Q=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||Q===null||Y===null||(le=A(U,Y),le!=null&&Be.push(Lc(U,le,Q))),Nt)break;U=U.return}0<Be.length&&(te=new ie(te,we,null,f,se),ce.push({event:te,listeners:Be}))}}if((l&7)===0){e:{if(te=a==="mouseover"||a==="pointerover",ie=a==="mouseout"||a==="pointerout",te&&f!==wl&&(we=f.relatedTarget||f.fromElement)&&(es(we)||we[Zr]))break e;if((ie||te)&&(te=se.window===se?se:(te=se.ownerDocument)?te.defaultView||te.parentWindow:window,ie?(we=f.relatedTarget||f.toElement,ie=ee,we=we?es(we):null,we!==null&&(Nt=s(we),Be=we.tag,we!==Nt||Be!==5&&Be!==27&&Be!==6)&&(we=null)):(ie=null,we=ee),ie!==we)){if(Be=rv,le="onMouseLeave",Y="onMouseEnter",U="mouse",(a==="pointerout"||a==="pointerover")&&(Be=av,le="onPointerLeave",Y="onPointerEnter",U="pointer"),Nt=ie==null?te:Hs(ie),Q=we==null?te:Hs(we),te=new Be(le,U+"leave",ie,f,se),te.target=Nt,te.relatedTarget=Q,le=null,es(se)===ee&&(Be=new Be(Y,U+"enter",we,f,se),Be.target=Q,Be.relatedTarget=Nt,le=Be),Nt=le,ie&&we)t:{for(Be=A6,Y=ie,U=we,Q=0,le=Y;le;le=Be(le))Q++;le=0;for(var ze=U;ze;ze=Be(ze))le++;for(;0<Q-le;)Y=Be(Y),Q--;for(;0<le-Q;)U=Be(U),le--;for(;Q--;){if(Y===U||U!==null&&Y===U.alternate){Be=Y;break t}Y=Be(Y),U=Be(U)}Be=null}else Be=null;ie!==null&&Qw(ce,te,ie,Be,!1),we!==null&&Nt!==null&&Qw(ce,Nt,we,Be,!0)}}e:{if(te=ee?Hs(ee):window,ie=te.nodeName&&te.nodeName.toLowerCase(),ie==="select"||ie==="input"&&te.type==="file")var ht=dv;else if(hv(te))if(mv)ht=V_;else{ht=L_;var Oe=z_}else ie=te.nodeName,!ie||ie.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Ks(ee.elementType)&&(ht=dv):ht=B_;if(ht&&(ht=ht(a,ee))){pv(ce,ht,f,se);break e}Oe&&Oe(a,te,ee),a==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&nc(te,"number",te.value)}switch(Oe=ee?Hs(ee):window,a){case"focusin":(hv(Oe)||Oe.contentEditable==="true")&&(Nl=Oe,i0=ee,fc=null);break;case"focusout":fc=i0=Nl=null;break;case"mousedown":r0=!0;break;case"contextmenu":case"mouseup":case"dragend":r0=!1,Cv(ce,f,se);break;case"selectionchange":if(P_)break;case"keydown":case"keyup":Cv(ce,f,se)}var Ye;if(Zg)e:{switch(a){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else El?cv(a,f)&&(rt="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(rt="onCompositionStart");rt&&(ov&&f.locale!=="ko"&&(El||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&El&&(Ye=qe()):(ge=se,xe="value"in ge?ge.value:ge.textContent,El=!0)),Oe=hd(ee,rt),0<Oe.length&&(rt=new sv(rt,a,null,f,se),ce.push({event:rt,listeners:Oe}),Ye?rt.data=Ye:(Ye=fv(f),Ye!==null&&(rt.data=Ye)))),(Ye=O_?R_(a,f):D_(a,f))&&(rt=hd(ee,"onBeforeInput"),0<rt.length&&(Oe=new sv("onBeforeInput","beforeinput",null,f,se),ce.push({event:Oe,listeners:rt}),Oe.data=Ye)),C6(ce,a,ee,f,se)}Yw(ce,l)})}function Lc(a,l,f){return{instance:a,listener:l,currentTarget:f}}function hd(a,l){for(var f=l+"Capture",d=[];a!==null;){var x=a,k=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||k===null||(x=A(a,f),x!=null&&d.unshift(Lc(a,x,k)),x=A(a,l),x!=null&&d.push(Lc(a,x,k))),a.tag===3)return d;a=a.return}return[]}function A6(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function Qw(a,l,f,d,x){for(var k=l._reactName,N=[];f!==null&&f!==d;){var R=f,$=R.alternate,ee=R.stateNode;if(R=R.tag,$!==null&&$===d)break;R!==5&&R!==26&&R!==27||ee===null||($=ee,x?(ee=A(f,k),ee!=null&&N.unshift(Lc(f,ee,$))):x||(ee=A(f,k),ee!=null&&N.push(Lc(f,ee,$)))),f=f.return}N.length!==0&&a.push({event:l,listeners:N})}var T6=/\r\n?/g,M6=/\u0000|\uFFFD/g;function Ww(a){return(typeof a=="string"?a:""+a).replace(T6,`
97
- `).replace(M6,"")}function Zw(a,l){return l=Ww(l),Ww(a)===l}function Et(a,l,f,d,x,k){switch(f){case"children":typeof d=="string"?l==="body"||l==="textarea"&&d===""||mr(a,d):(typeof d=="number"||typeof d=="bigint")&&l!=="body"&&mr(a,""+d);break;case"className":vl(a,"class",d);break;case"tabIndex":vl(a,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":vl(a,f,d);break;case"style":rc(a,d,k);break;case"data":if(l!=="object"){vl(a,"data",d);break}case"src":case"href":if(d===""&&(l!=="a"||f!=="href")){a.removeAttribute(f);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){a.removeAttribute(f);break}d=ro(""+d),a.setAttribute(f,d);break;case"action":case"formAction":if(typeof d=="function"){a.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(f==="formAction"?(l!=="input"&&Et(a,l,"name",x.name,x,null),Et(a,l,"formEncType",x.formEncType,x,null),Et(a,l,"formMethod",x.formMethod,x,null),Et(a,l,"formTarget",x.formTarget,x,null)):(Et(a,l,"encType",x.encType,x,null),Et(a,l,"method",x.method,x,null),Et(a,l,"target",x.target,x,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){a.removeAttribute(f);break}d=ro(""+d),a.setAttribute(f,d);break;case"onClick":d!=null&&(a.onclick=Ii);break;case"onScroll":d!=null&&tt("scroll",a);break;case"onScrollEnd":d!=null&&tt("scrollend",a);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(f=d.__html,f!=null){if(x.children!=null)throw Error(i(60));a.innerHTML=f}}break;case"multiple":a.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":a.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){a.removeAttribute("xlink:href");break}f=ro(""+d),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?a.setAttribute(f,""+d):a.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":d===!0?a.setAttribute(f,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?a.setAttribute(f,d):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?a.setAttribute(f,d):a.removeAttribute(f);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?a.removeAttribute(f):a.setAttribute(f,d);break;case"popover":tt("beforetoggle",a),tt("toggle",a),Dn(a,"popover",d);break;case"xlinkActuate":pr(a,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":pr(a,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":pr(a,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":pr(a,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":pr(a,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":pr(a,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":pr(a,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":pr(a,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":pr(a,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Dn(a,"is",d);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=We.get(f)||f,Dn(a,f,d))}}function My(a,l,f,d,x,k){switch(f){case"style":rc(a,d,k);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(f=d.__html,f!=null){if(x.children!=null)throw Error(i(60));a.innerHTML=f}}break;case"children":typeof d=="string"?mr(a,d):(typeof d=="number"||typeof d=="bigint")&&mr(a,""+d);break;case"onScroll":d!=null&&tt("scroll",a);break;case"onScrollEnd":d!=null&&tt("scrollend",a);break;case"onClick":d!=null&&(a.onclick=Ii);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zu.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(x=f.endsWith("Capture"),l=f.slice(2,x?f.length-7:void 0),k=a[an]||null,k=k!=null?k[f]:null,typeof k=="function"&&a.removeEventListener(l,k,x),typeof d=="function")){typeof k!="function"&&k!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(l,d,x);break e}f in a?a[f]=d:d===!0?a.setAttribute(f,""):Dn(a,f,d)}}}function cn(a,l,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",a),tt("load",a);var d=!1,x=!1,k;for(k in f)if(f.hasOwnProperty(k)){var N=f[k];if(N!=null)switch(k){case"src":d=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Et(a,l,k,N,f,null)}}x&&Et(a,l,"srcSet",f.srcSet,f,null),d&&Et(a,l,"src",f.src,f,null);return;case"input":tt("invalid",a);var R=k=N=x=null,$=null,ee=null;for(d in f)if(f.hasOwnProperty(d)){var se=f[d];if(se!=null)switch(d){case"name":x=se;break;case"type":N=se;break;case"checked":$=se;break;case"defaultChecked":ee=se;break;case"value":k=se;break;case"defaultValue":R=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,l));break;default:Et(a,l,d,se,f,null)}}tc(a,k,R,$,ee,N,x,!1);return;case"select":tt("invalid",a),d=N=k=null;for(x in f)if(f.hasOwnProperty(x)&&(R=f[x],R!=null))switch(x){case"value":k=R;break;case"defaultValue":N=R;break;case"multiple":d=R;default:Et(a,l,x,R,f,null)}l=k,f=N,a.multiple=!!d,l!=null?qs(a,!!d,l,!1):f!=null&&qs(a,!!d,f,!0);return;case"textarea":tt("invalid",a),k=x=d=null;for(N in f)if(f.hasOwnProperty(N)&&(R=f[N],R!=null))switch(N){case"value":d=R;break;case"defaultValue":x=R;break;case"children":k=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(i(91));break;default:Et(a,l,N,R,f,null)}kp(a,d,x,k);return;case"option":for($ in f)f.hasOwnProperty($)&&(d=f[$],d!=null)&&($==="selected"?a.selected=d&&typeof d!="function"&&typeof d!="symbol":Et(a,l,$,d,f,null));return;case"dialog":tt("beforetoggle",a),tt("toggle",a),tt("cancel",a),tt("close",a);break;case"iframe":case"object":tt("load",a);break;case"video":case"audio":for(d=0;d<zc.length;d++)tt(zc[d],a);break;case"image":tt("error",a),tt("load",a);break;case"details":tt("toggle",a);break;case"embed":case"source":case"link":tt("error",a),tt("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in f)if(f.hasOwnProperty(ee)&&(d=f[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Et(a,l,ee,d,f,null)}return;default:if(Ks(l)){for(se in f)f.hasOwnProperty(se)&&(d=f[se],d!==void 0&&My(a,l,se,d,f,void 0));return}}for(R in f)f.hasOwnProperty(R)&&(d=f[R],d!=null&&Et(a,l,R,d,f,null))}function O6(a,l,f,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,k=null,N=null,R=null,$=null,ee=null,se=null;for(ie in f){var ce=f[ie];if(f.hasOwnProperty(ie)&&ce!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":$=ce;default:d.hasOwnProperty(ie)||Et(a,l,ie,null,d,ce)}}for(var te in d){var ie=d[te];if(ce=f[te],d.hasOwnProperty(te)&&(ie!=null||ce!=null))switch(te){case"type":k=ie;break;case"name":x=ie;break;case"checked":ee=ie;break;case"defaultChecked":se=ie;break;case"value":N=ie;break;case"defaultValue":R=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,l));break;default:ie!==ce&&Et(a,l,te,ie,d,ce)}}ec(a,N,R,$,ee,se,k,x);return;case"select":ie=N=R=te=null;for(k in f)if($=f[k],f.hasOwnProperty(k)&&$!=null)switch(k){case"value":break;case"multiple":ie=$;default:d.hasOwnProperty(k)||Et(a,l,k,null,d,$)}for(x in d)if(k=d[x],$=f[x],d.hasOwnProperty(x)&&(k!=null||$!=null))switch(x){case"value":te=k;break;case"defaultValue":R=k;break;case"multiple":N=k;default:k!==$&&Et(a,l,x,k,d,$)}l=R,f=N,d=ie,te!=null?qs(a,!!f,te,!1):!!d!=!!f&&(l!=null?qs(a,!!f,l,!0):qs(a,!!f,f?[]:"",!1));return;case"textarea":ie=te=null;for(R in f)if(x=f[R],f.hasOwnProperty(R)&&x!=null&&!d.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:Et(a,l,R,null,d,x)}for(N in d)if(x=d[N],k=f[N],d.hasOwnProperty(N)&&(x!=null||k!=null))switch(N){case"value":te=x;break;case"defaultValue":ie=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(i(91));break;default:x!==k&&Et(a,l,N,x,d,k)}Sp(a,te,ie);return;case"option":for(var we in f)te=f[we],f.hasOwnProperty(we)&&te!=null&&!d.hasOwnProperty(we)&&(we==="selected"?a.selected=!1:Et(a,l,we,null,d,te));for($ in d)te=d[$],ie=f[$],d.hasOwnProperty($)&&te!==ie&&(te!=null||ie!=null)&&($==="selected"?a.selected=te&&typeof te!="function"&&typeof te!="symbol":Et(a,l,$,te,d,ie));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in f)te=f[Be],f.hasOwnProperty(Be)&&te!=null&&!d.hasOwnProperty(Be)&&Et(a,l,Be,null,d,te);for(ee in d)if(te=d[ee],ie=f[ee],d.hasOwnProperty(ee)&&te!==ie&&(te!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,l));break;default:Et(a,l,ee,te,d,ie)}return;default:if(Ks(l)){for(var Nt in f)te=f[Nt],f.hasOwnProperty(Nt)&&te!==void 0&&!d.hasOwnProperty(Nt)&&My(a,l,Nt,void 0,d,te);for(se in d)te=d[se],ie=f[se],!d.hasOwnProperty(se)||te===ie||te===void 0&&ie===void 0||My(a,l,se,te,d,ie);return}}for(var Y in f)te=f[Y],f.hasOwnProperty(Y)&&te!=null&&!d.hasOwnProperty(Y)&&Et(a,l,Y,null,d,te);for(ce in d)te=d[ce],ie=f[ce],!d.hasOwnProperty(ce)||te===ie||te==null&&ie==null||Et(a,l,ce,te,d,ie)}function e2(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function R6(){if(typeof performance.getEntriesByType=="function"){for(var a=0,l=0,f=performance.getEntriesByType("resource"),d=0;d<f.length;d++){var x=f[d],k=x.transferSize,N=x.initiatorType,R=x.duration;if(k&&R&&e2(N)){for(N=0,R=x.responseEnd,d+=1;d<f.length;d++){var $=f[d],ee=$.startTime;if(ee>R)break;var se=$.transferSize,ce=$.initiatorType;se&&e2(ce)&&($=$.responseEnd,N+=se*($<R?1:(R-ee)/($-ee)))}if(--d,l+=8*(k+N)/(x.duration/1e3),a++,10<a)break}}if(0<a)return l/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var Oy=null,Ry=null;function pd(a){return a.nodeType===9?a:a.ownerDocument}function t2(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function n2(a,l){if(a===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&l==="foreignObject"?0:a}function Dy(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Iy=null;function D6(){var a=window.event;return a&&a.type==="popstate"?a===Iy?!1:(Iy=a,!0):(Iy=null,!1)}var i2=typeof setTimeout=="function"?setTimeout:void 0,I6=typeof clearTimeout=="function"?clearTimeout:void 0,r2=typeof Promise=="function"?Promise:void 0,_6=typeof queueMicrotask=="function"?queueMicrotask:typeof r2<"u"?function(a){return r2.resolve(null).then(a).catch(z6)}:i2;function z6(a){setTimeout(function(){throw a})}function pa(a){return a==="head"}function s2(a,l){var f=l,d=0;do{var x=f.nextSibling;if(a.removeChild(f),x&&x.nodeType===8)if(f=x.data,f==="/$"||f==="/&"){if(d===0){a.removeChild(x),Zl(l);return}d--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")d++;else if(f==="html")Bc(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,Bc(f);for(var k=f.firstChild;k;){var N=k.nextSibling,R=k.nodeName;k[Js]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&k.rel.toLowerCase()==="stylesheet"||f.removeChild(k),k=N}}else f==="body"&&Bc(a.ownerDocument.body);f=x}while(f);Zl(l)}function a2(a,l){var f=a;a=0;do{var d=f.nextSibling;if(f.nodeType===1?l?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(l?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),d&&d.nodeType===8)if(f=d.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=d}while(f)}function _y(a){var l=a.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var f=l;switch(l=l.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":_y(f),Sl(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function L6(a,l,f,d){for(;a.nodeType===1;){var x=f;if(a.nodeName.toLowerCase()!==l.toLowerCase()){if(!d&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(d){if(!a[Js])switch(l){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(k=a.getAttribute("rel"),k==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(k!==x.rel||a.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||a.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||a.getAttribute("title")!==(x.title==null?null:x.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(k=a.getAttribute("src"),(k!==(x.src==null?null:x.src)||a.getAttribute("type")!==(x.type==null?null:x.type)||a.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&k&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(l==="input"&&a.type==="hidden"){var k=x.name==null?null:""+x.name;if(x.type==="hidden"&&a.getAttribute("name")===k)return a}else return a;if(a=$i(a.nextSibling),a===null)break}return null}function B6(a,l,f){if(l==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=$i(a.nextSibling),a===null))return null;return a}function o2(a,l){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=$i(a.nextSibling),a===null))return null;return a}function zy(a){return a.data==="$?"||a.data==="$~"}function Ly(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function V6(a,l){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=l;else if(a.data!=="$?"||f.readyState!=="loading")l();else{var d=function(){l(),f.removeEventListener("DOMContentLoaded",d)};f.addEventListener("DOMContentLoaded",d),a._reactRetry=d}}function $i(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return a}var By=null;function l2(a){a=a.nextSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(l===0)return $i(a.nextSibling);l--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||l++}a=a.nextSibling}return null}function u2(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(l===0)return a;l--}else f!=="/$"&&f!=="/&"||l++}a=a.previousSibling}return null}function c2(a,l,f){switch(l=pd(f),a){case"html":if(a=l.documentElement,!a)throw Error(i(452));return a;case"head":if(a=l.head,!a)throw Error(i(453));return a;case"body":if(a=l.body,!a)throw Error(i(454));return a;default:throw Error(i(451))}}function Bc(a){for(var l=a.attributes;l.length;)a.removeAttributeNode(l[0]);Sl(a)}var Ui=new Map,f2=new Set;function dd(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var bs=oe.d;oe.d={f:F6,r:P6,D:j6,C:$6,L:U6,m:J6,X:q6,S:H6,M:K6};function F6(){var a=bs.f(),l=sd();return a||l}function P6(a){var l=ts(a);l!==null&&l.tag===5&&l.type==="form"?TC(l):bs.r(a)}var Xl=typeof document>"u"?null:document;function h2(a,l,f){var d=Xl;if(d&&typeof l=="string"&&l){var x=Tt(l);x='link[rel="'+a+'"][href="'+x+'"]',typeof f=="string"&&(x+='[crossorigin="'+f+'"]'),f2.has(x)||(f2.add(x),a={rel:a,crossOrigin:f,href:l},d.querySelector(x)===null&&(l=d.createElement("link"),cn(l,"link",a),qt(l),d.head.appendChild(l)))}}function j6(a){bs.D(a),h2("dns-prefetch",a,null)}function $6(a,l){bs.C(a,l),h2("preconnect",a,l)}function U6(a,l,f){bs.L(a,l,f);var d=Xl;if(d&&a&&l){var x='link[rel="preload"][as="'+Tt(l)+'"]';l==="image"&&f&&f.imageSrcSet?(x+='[imagesrcset="'+Tt(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(x+='[imagesizes="'+Tt(f.imageSizes)+'"]')):x+='[href="'+Tt(a)+'"]';var k=x;switch(l){case"style":k=Ql(a);break;case"script":k=Wl(a)}Ui.has(k)||(a=g({rel:"preload",href:l==="image"&&f&&f.imageSrcSet?void 0:a,as:l},f),Ui.set(k,a),d.querySelector(x)!==null||l==="style"&&d.querySelector(Vc(k))||l==="script"&&d.querySelector(Fc(k))||(l=d.createElement("link"),cn(l,"link",a),qt(l),d.head.appendChild(l)))}}function J6(a,l){bs.m(a,l);var f=Xl;if(f&&a){var d=l&&typeof l.as=="string"?l.as:"script",x='link[rel="modulepreload"][as="'+Tt(d)+'"][href="'+Tt(a)+'"]',k=x;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Wl(a)}if(!Ui.has(k)&&(a=g({rel:"modulepreload",href:a},l),Ui.set(k,a),f.querySelector(x)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Fc(k)))return}d=f.createElement("link"),cn(d,"link",a),qt(d),f.head.appendChild(d)}}}function H6(a,l,f){bs.S(a,l,f);var d=Xl;if(d&&a){var x=ns(d).hoistableStyles,k=Ql(a);l=l||"default";var N=x.get(k);if(!N){var R={loading:0,preload:null};if(N=d.querySelector(Vc(k)))R.loading=5;else{a=g({rel:"stylesheet",href:a,"data-precedence":l},f),(f=Ui.get(k))&&Vy(a,f);var $=N=d.createElement("link");qt($),cn($,"link",a),$._p=new Promise(function(ee,se){$.onload=ee,$.onerror=se}),$.addEventListener("load",function(){R.loading|=1}),$.addEventListener("error",function(){R.loading|=2}),R.loading|=4,md(N,l,d)}N={type:"stylesheet",instance:N,count:1,state:R},x.set(k,N)}}}function q6(a,l){bs.X(a,l);var f=Xl;if(f&&a){var d=ns(f).hoistableScripts,x=Wl(a),k=d.get(x);k||(k=f.querySelector(Fc(x)),k||(a=g({src:a,async:!0},l),(l=Ui.get(x))&&Fy(a,l),k=f.createElement("script"),qt(k),cn(k,"link",a),f.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},d.set(x,k))}}function K6(a,l){bs.M(a,l);var f=Xl;if(f&&a){var d=ns(f).hoistableScripts,x=Wl(a),k=d.get(x);k||(k=f.querySelector(Fc(x)),k||(a=g({src:a,async:!0,type:"module"},l),(l=Ui.get(x))&&Fy(a,l),k=f.createElement("script"),qt(k),cn(k,"link",a),f.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},d.set(x,k))}}function p2(a,l,f,d){var x=(x=Me.current)?dd(x):null;if(!x)throw Error(i(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(l=Ql(f.href),f=ns(x).hoistableStyles,d=f.get(l),d||(d={type:"style",instance:null,count:0,state:null},f.set(l,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=Ql(f.href);var k=ns(x).hoistableStyles,N=k.get(a);if(N||(x=x.ownerDocument||x,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(a,N),(k=x.querySelector(Vc(a)))&&!k._p&&(N.instance=k,N.state.loading=5),Ui.has(a)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},Ui.set(a,f),k||G6(x,a,f,N.state))),l&&d===null)throw Error(i(528,""));return N}if(l&&d!==null)throw Error(i(529,""));return null;case"script":return l=f.async,f=f.src,typeof f=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Wl(f),f=ns(x).hoistableScripts,d=f.get(l),d||(d={type:"script",instance:null,count:0,state:null},f.set(l,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,a))}}function Ql(a){return'href="'+Tt(a)+'"'}function Vc(a){return'link[rel="stylesheet"]['+a+"]"}function d2(a){return g({},a,{"data-precedence":a.precedence,precedence:null})}function G6(a,l,f,d){a.querySelector('link[rel="preload"][as="style"]['+l+"]")?d.loading=1:(l=a.createElement("link"),d.preload=l,l.addEventListener("load",function(){return d.loading|=1}),l.addEventListener("error",function(){return d.loading|=2}),cn(l,"link",f),qt(l),a.head.appendChild(l))}function Wl(a){return'[src="'+Tt(a)+'"]'}function Fc(a){return"script[async]"+a}function m2(a,l,f){if(l.count++,l.instance===null)switch(l.type){case"style":var d=a.querySelector('style[data-href~="'+Tt(f.href)+'"]');if(d)return l.instance=d,qt(d),d;var x=g({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return d=(a.ownerDocument||a).createElement("style"),qt(d),cn(d,"style",x),md(d,f.precedence,a),l.instance=d;case"stylesheet":x=Ql(f.href);var k=a.querySelector(Vc(x));if(k)return l.state.loading|=4,l.instance=k,qt(k),k;d=d2(f),(x=Ui.get(x))&&Vy(d,x),k=(a.ownerDocument||a).createElement("link"),qt(k);var N=k;return N._p=new Promise(function(R,$){N.onload=R,N.onerror=$}),cn(k,"link",d),l.state.loading|=4,md(k,f.precedence,a),l.instance=k;case"script":return k=Wl(f.src),(x=a.querySelector(Fc(k)))?(l.instance=x,qt(x),x):(d=f,(x=Ui.get(k))&&(d=g({},f),Fy(d,x)),a=a.ownerDocument||a,x=a.createElement("script"),qt(x),cn(x,"link",d),a.head.appendChild(x),l.instance=x);case"void":return null;default:throw Error(i(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(d=l.instance,l.state.loading|=4,md(d,f.precedence,a));return l.instance}function md(a,l,f){for(var d=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=d.length?d[d.length-1]:null,k=x,N=0;N<d.length;N++){var R=d[N];if(R.dataset.precedence===l)k=R;else if(k!==x)break}k?k.parentNode.insertBefore(a,k.nextSibling):(l=f.nodeType===9?f.head:f,l.insertBefore(a,l.firstChild))}function Vy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.title==null&&(a.title=l.title)}function Fy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.integrity==null&&(a.integrity=l.integrity)}var gd=null;function g2(a,l,f){if(gd===null){var d=new Map,x=gd=new Map;x.set(f,d)}else x=gd,d=x.get(f),d||(d=new Map,x.set(f,d));if(d.has(a))return d;for(d.set(a,null),f=f.getElementsByTagName(a),x=0;x<f.length;x++){var k=f[x];if(!(k[Js]||k[Ht]||a==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var N=k.getAttribute(l)||"";N=a+N;var R=d.get(N);R?R.push(k):d.set(N,[k])}}return d}function y2(a,l,f){a=a.ownerDocument||a,a.head.insertBefore(f,l==="title"?a.querySelector("head > title"):null)}function Y6(a,l,f){if(f===1||l.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(a=l.disabled,typeof l.precedence=="string"&&a==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function x2(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function X6(a,l,f,d){if(f.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var x=Ql(d.href),k=l.querySelector(Vc(x));if(k){l=k._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=yd.bind(a),l.then(a,a)),f.state.loading|=4,f.instance=k,qt(k);return}k=l.ownerDocument||l,d=d2(d),(x=Ui.get(x))&&Vy(d,x),k=k.createElement("link"),qt(k);var N=k;N._p=new Promise(function(R,$){N.onload=R,N.onerror=$}),cn(k,"link",d),f.instance=k}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,l),(l=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=yd.bind(a),l.addEventListener("load",f),l.addEventListener("error",f))}}var Py=0;function Q6(a,l){return a.stylesheets&&a.count===0&&bd(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var d=setTimeout(function(){if(a.stylesheets&&bd(a,a.stylesheets),a.unsuspend){var k=a.unsuspend;a.unsuspend=null,k()}},6e4+l);0<a.imgBytes&&Py===0&&(Py=62500*R6());var x=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&bd(a,a.stylesheets),a.unsuspend)){var k=a.unsuspend;a.unsuspend=null,k()}},(a.imgBytes>Py?50:800)+l);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(d),clearTimeout(x)}}:null}function yd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bd(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var xd=null;function bd(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,xd=new Map,l.forEach(W6,a),xd=null,yd.call(a))}function W6(a,l){if(!(l.state.loading&4)){var f=xd.get(a);if(f)var d=f.get(null);else{f=new Map,xd.set(a,f);for(var x=a.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<x.length;k++){var N=x[k];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(f.set(N.dataset.precedence,N),d=N)}d&&f.set(null,d)}x=l.instance,N=x.getAttribute("data-precedence"),k=f.get(N)||d,k===d&&f.set(null,x),f.set(N,x),this.count++,d=yd.bind(this),x.addEventListener("load",d),x.addEventListener("error",d),k?k.parentNode.insertBefore(x,k.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(x,a.firstChild)),l.state.loading|=4}}var Pc={$$typeof:F,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function Z6(a,l,f,d,x,k,N,R,$){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=to(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=to(0),this.hiddenUpdates=to(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=k,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function b2(a,l,f,d,x,k,N,R,$,ee,se,ce){return a=new Z6(a,l,f,N,$,ee,se,ce,R),l=1,k===!0&&(l|=24),k=gi(3,null,null,l),a.current=k,k.stateNode=a,l=b0(),l.refCount++,a.pooledCache=l,l.refCount++,k.memoizedState={element:d,isDehydrated:f,cache:l},C0(k),a}function S2(a){return a?(a=Ml,a):Ml}function k2(a,l,f,d,x,k){x=S2(x),d.context===null?d.context=x:d.pendingContext=x,d=na(l),d.payload={element:f},k=k===void 0?null:k,k!==null&&(d.callback=k),f=ia(a,d,l),f!==null&&(ri(f,a,l),xc(f,a,l))}function v2(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<l?f:l}}function jy(a,l){v2(a,l),(a=a.alternate)&&v2(a,l)}function C2(a){if(a.tag===13||a.tag===31){var l=oo(a,67108864);l!==null&&ri(l,a,67108864),jy(a,67108864)}}function w2(a){if(a.tag===13||a.tag===31){var l=ki();l=Wr(l);var f=oo(a,l);f!==null&&ri(f,a,l),jy(a,l)}}var Sd=!0;function e4(a,l,f,d){var x=W.T;W.T=null;var k=oe.p;try{oe.p=2,$y(a,l,f,d)}finally{oe.p=k,W.T=x}}function t4(a,l,f,d){var x=W.T;W.T=null;var k=oe.p;try{oe.p=8,$y(a,l,f,d)}finally{oe.p=k,W.T=x}}function $y(a,l,f,d){if(Sd){var x=Uy(d);if(x===null)Ty(a,l,d,kd,f),N2(a,d);else if(i4(x,a,l,f,d))d.stopPropagation();else if(N2(a,d),l&4&&-1<n4.indexOf(a)){for(;x!==null;){var k=ts(x);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var N=Jt(k.pendingLanes);if(N!==0){var R=k;for(R.pendingLanes|=2,R.entangledLanes|=2;N;){var $=1<<31-St(N);R.entanglements[1]|=$,N&=~$}_r(k),(dt&6)===0&&(id=$e()+500,_c(0))}}break;case 31:case 13:R=oo(k,2),R!==null&&ri(R,k,2),sd(),jy(k,2)}if(k=Uy(d),k===null&&Ty(a,l,d,kd,f),k===x)break;x=k}x!==null&&d.stopPropagation()}else Ty(a,l,d,null,f)}}function Uy(a){return a=sc(a),Jy(a)}var kd=null;function Jy(a){if(kd=null,a=es(a),a!==null){var l=s(a);if(l===null)a=null;else{var f=l.tag;if(f===13){if(a=o(l),a!==null)return a;a=null}else if(f===31){if(a=u(l),a!==null)return a;a=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null)}}return kd=a,null}function E2(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Xr()){case ae:return 2;case me:return 8;case I:case _e:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var Hy=!1,da=null,ma=null,ga=null,jc=new Map,$c=new Map,ya=[],n4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function N2(a,l){switch(a){case"focusin":case"focusout":da=null;break;case"dragenter":case"dragleave":ma=null;break;case"mouseover":case"mouseout":ga=null;break;case"pointerover":case"pointerout":jc.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":$c.delete(l.pointerId)}}function Uc(a,l,f,d,x,k){return a===null||a.nativeEvent!==k?(a={blockedOn:l,domEventName:f,eventSystemFlags:d,nativeEvent:k,targetContainers:[x]},l!==null&&(l=ts(l),l!==null&&C2(l)),a):(a.eventSystemFlags|=d,l=a.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),a)}function i4(a,l,f,d,x){switch(l){case"focusin":return da=Uc(da,a,l,f,d,x),!0;case"dragenter":return ma=Uc(ma,a,l,f,d,x),!0;case"mouseover":return ga=Uc(ga,a,l,f,d,x),!0;case"pointerover":var k=x.pointerId;return jc.set(k,Uc(jc.get(k)||null,a,l,f,d,x)),!0;case"gotpointercapture":return k=x.pointerId,$c.set(k,Uc($c.get(k)||null,a,l,f,d,x)),!0}return!1}function A2(a){var l=es(a.target);if(l!==null){var f=s(l);if(f!==null){if(l=f.tag,l===13){if(l=o(f),l!==null){a.blockedOn=l,Qu(a.priority,function(){w2(f)});return}}else if(l===31){if(l=u(f),l!==null){a.blockedOn=l,Qu(a.priority,function(){w2(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function vd(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var f=Uy(a.nativeEvent);if(f===null){f=a.nativeEvent;var d=new f.constructor(f.type,f);wl=d,f.target.dispatchEvent(d),wl=null}else return l=ts(f),l!==null&&C2(l),a.blockedOn=f,!1;l.shift()}return!0}function T2(a,l,f){vd(a)&&f.delete(l)}function r4(){Hy=!1,da!==null&&vd(da)&&(da=null),ma!==null&&vd(ma)&&(ma=null),ga!==null&&vd(ga)&&(ga=null),jc.forEach(T2),$c.forEach(T2)}function Cd(a,l){a.blockedOn===l&&(a.blockedOn=null,Hy||(Hy=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,r4)))}var wd=null;function M2(a){wd!==a&&(wd=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){wd===a&&(wd=null);for(var l=0;l<a.length;l+=3){var f=a[l],d=a[l+1],x=a[l+2];if(typeof d!="function"){if(Jy(d||f)===null)continue;break}var k=ts(f);k!==null&&(a.splice(l,3),l-=3,U0(k,{pending:!0,data:x,method:f.method,action:d},d,x))}}))}function Zl(a){function l($){return Cd($,a)}da!==null&&Cd(da,a),ma!==null&&Cd(ma,a),ga!==null&&Cd(ga,a),jc.forEach(l),$c.forEach(l);for(var f=0;f<ya.length;f++){var d=ya[f];d.blockedOn===a&&(d.blockedOn=null)}for(;0<ya.length&&(f=ya[0],f.blockedOn===null);)A2(f),f.blockedOn===null&&ya.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(d=0;d<f.length;d+=3){var x=f[d],k=f[d+1],N=x[an]||null;if(typeof k=="function")N||M2(f);else if(N){var R=null;if(k&&k.hasAttribute("formAction")){if(x=k,N=k[an]||null)R=N.formAction;else if(Jy(x)!==null)continue}else R=N.action;typeof R=="function"?f[d+1]=R:(f.splice(d,3),d-=3),M2(f)}}}function O2(){function a(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(N){return x=N})},focusReset:"manual",scroll:"manual"})}function l(){x!==null&&(x(),x=null),d||setTimeout(f,20)}function f(){if(!d&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,x=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(f,100),function(){d=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),x!==null&&(x(),x=null)}}}function qy(a){this._internalRoot=a}Ed.prototype.render=qy.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(i(409));var f=l.current,d=ki();k2(f,d,a,l,null,null)},Ed.prototype.unmount=qy.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;k2(a.current,2,null,a,null,null),sd(),l[Zr]=null}};function Ed(a){this._internalRoot=a}Ed.prototype.unstable_scheduleHydration=function(a){if(a){var l=pp();a={blockedOn:null,target:a,priority:l};for(var f=0;f<ya.length&&l!==0&&l<ya[f].priority;f++);ya.splice(f,0,a),f===0&&A2(a)}};var R2=e.version;if(R2!=="19.2.7")throw Error(i(527,R2,"19.2.7"));oe.findDOMNode=function(a){var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(i(188)):(a=Object.keys(a).join(","),Error(i(268,a)));return a=h(l),a=a!==null?m(a):null,a=a===null?null:a.stateNode,a};var s4={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nd.isDisabled&&Nd.supportsFiber)try{Se=Nd.inject(s4),_t=Nd}catch{}}return Xc.createRoot=function(a,l){if(!r(a))throw Error(i(299));var f=!1,d="",x=VC,k=FC,N=PC;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(N=l.onRecoverableError)),l=b2(a,1,!1,null,null,f,d,null,x,k,N,O2),a[Zr]=l.current,Ay(a),new qy(l)},Xc.hydrateRoot=function(a,l,f){if(!r(a))throw Error(i(299));var d=!1,x="",k=VC,N=FC,R=PC,$=null;return f!=null&&(f.unstable_strictMode===!0&&(d=!0),f.identifierPrefix!==void 0&&(x=f.identifierPrefix),f.onUncaughtError!==void 0&&(k=f.onUncaughtError),f.onCaughtError!==void 0&&(N=f.onCaughtError),f.onRecoverableError!==void 0&&(R=f.onRecoverableError),f.formState!==void 0&&($=f.formState)),l=b2(a,1,!0,l,f??null,d,x,$,k,N,R,O2),l.context=S2(null),f=l.current,d=ki(),d=Wr(d),x=na(d),x.callback=null,ia(f,x,d),f=d,l.current.lanes=f,no(l,f),_r(l),a[Zr]=l.current,Ay(a),new Ed(l)},Xc.version="19.2.7",Xc}var sT;function GK(){if(sT)return px.exports;sT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),px.exports=KK(),px.exports}var e_=GK();function YK(t,e,n){return DV(XI,()=>(i,r,s)=>{const o=document.createElement("div");o.className="mdx-block-card-wrapper",o.setAttribute("data-cms-ui",""),o.contentEditable="false";const u=e_.createRoot(o);let c=null;const h=y=>{const b=typeof s=="function"?s():null;if(b==null)return;const v=r.state.doc.nodeAt(b);if(!v)return;const E=r.state.tr.setNodeMarkup(b,void 0,{...v.attrs,...y});r.dispatch(E)},m=()=>{const y=typeof s=="function"?s():null;if(y==null)return;const b=r.state.doc.nodeAt(y);b&&r.dispatch(r.state.tr.delete(y,y+b.nodeSize))},g=y=>{const b=y.attrs.componentName,v=y.attrs.props,E=y.attrs.hasExpressions,T=y.attrs.children||"";o.setAttribute("data-mdx-component",b),o.setAttribute("data-mdx-props",v),o.setAttribute("data-mdx-children",T);const M=JSON.parse(v),j=t(b),F=(j?.slots?.includes("default")??!1)||T.trim()!=="";c={componentName:b,props:v,hasExpressions:E,children:T},u.render(fe.createElement($K,{componentName:b,props:M,hasExpressions:E,slotContent:T,definition:j,media:e,mediaContext:n,onRemove:m,onSlotContentChange:F?J=>h({children:J}):void 0,onPropsChange:E?void 0:J=>h({props:JSON.stringify(J)})}))};return g(i),{dom:o,stopEvent:y=>{const b=y.target;return!!(b.tagName==="TEXTAREA"||b.tagName==="INPUT"||b.isContentEditable||b.closest("[contenteditable]")||b.closest("[data-mdx-action]")||(y.type==="mousedown"||y.type==="click")&&(b.closest("button")||b.closest("[data-mdx-action]")))},ignoreMutation:()=>!0,update:y=>{if(y.type.name!=="mdx_component")return!1;const b=y.attrs;return c&&b.componentName===c.componentName&&b.props===c.props&&b.hasExpressions===c.hasExpressions&&b.children===c.children||g(y),!0},destroy:()=>{queueMicrotask(()=>u.unmount())}}})}const XK={border:"1px solid #d4d4d8",borderRadius:6,background:"#fff"},QK={padding:"8px 12px",minHeight:240,outline:"none"},aT="nua-mdx-editor-styles",WK=`
98
- .nua-mdx-editor .ProseMirror { line-height: 1.6; color: #18181b; }
99
- .nua-mdx-editor .ProseMirror:focus { outline: none; }
100
- .nua-mdx-editor .ProseMirror h1 { font-size: 1.6em; font-weight: 700; line-height: 1.25; margin: 0.7em 0 0.35em; }
101
- .nua-mdx-editor .ProseMirror h2 { font-size: 1.35em; font-weight: 700; line-height: 1.3; margin: 0.7em 0 0.35em; }
102
- .nua-mdx-editor .ProseMirror h3 { font-size: 1.15em; font-weight: 600; line-height: 1.35; margin: 0.6em 0 0.3em; }
103
- .nua-mdx-editor .ProseMirror h4 { font-size: 1em; font-weight: 600; margin: 0.6em 0 0.3em; }
104
- .nua-mdx-editor .ProseMirror p { margin: 0.5em 0; }
105
- .nua-mdx-editor .ProseMirror ul { list-style: disc; padding-left: 1.5em; margin: 0.5em 0; }
106
- .nua-mdx-editor .ProseMirror ol { list-style: decimal; padding-left: 1.5em; margin: 0.5em 0; }
107
- .nua-mdx-editor .ProseMirror li { margin: 0.2em 0; }
108
- .nua-mdx-editor .ProseMirror li > p { margin: 0.1em 0; }
109
- .nua-mdx-editor .ProseMirror blockquote { border-left: 3px solid #d4d4d8; padding-left: 0.8em; margin: 0.6em 0; color: #52525b; }
110
- .nua-mdx-editor .ProseMirror strong { font-weight: 700; }
111
- .nua-mdx-editor .ProseMirror em { font-style: italic; }
112
- .nua-mdx-editor .ProseMirror a { color: #2563eb; text-decoration: underline; }
113
- .nua-mdx-editor .ProseMirror code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: #f4f4f5; padding: 0.1em 0.3em; border-radius: 3px; }
114
- .nua-mdx-editor .ProseMirror pre { background: #f4f4f5; padding: 0.7em 0.9em; border-radius: 6px; overflow-x: auto; }
115
- .nua-mdx-editor .ProseMirror pre code { background: none; padding: 0; }
116
- .nua-mdx-editor .ProseMirror img { max-width: 100%; height: auto; border-radius: 4px; }
117
- .nua-mdx-editor .ProseMirror hr { border: none; border-top: 1px solid #e4e4e7; margin: 1em 0; }
118
- `;function ZK(){fe.useEffect(()=>{if(typeof document>"u"||document.getElementById(aT))return;const t=document.createElement("style");t.id=aT,t.textContent=WK,document.head.appendChild(t)},[])}function t_({value:t,onChange:e,components:n,media:i,mediaContext:r,allowComponents:s=!0}){ZK();const o=fe.useRef(null),u=fe.useRef(null),c=fe.useRef(t),h=fe.useRef(!1),m=fe.useRef(!1),g=fe.useRef(e);g.current=e;const y=fe.useRef(new Map);fe.useEffect(()=>{y.current=new Map((n??[]).map(J=>[J.name,J]))},[n]);const b=fe.useRef(i);b.current=i;const v=fe.useRef(r);v.current=r;const[E,T]=fe.useState(!1),[M,j]=fe.useState(null);fe.useEffect(()=>{const J=o.current;if(!J)return;let V=!1;const C=q=>y.current.get(q);return(async()=>{const q=await u3.make().config(re=>{re.set(Qf,J),re.set(Xf,c.current),re.get(tg).markdownUpdated((K,pe)=>{c.current=pe,h.current&&!m.current&&g.current(pe)})}).use(X3).use(rI).use(iv).use(Zq).use(nK).use(XI).use(YK(C,b.current,v.current)).use(GA).create();if(V){q.destroy();return}u.current=q,j(q),queueMicrotask(()=>{h.current=!0})})(),()=>{V=!0,h.current=!1,u.current?.destroy(),u.current=null,j(null)}},[]),fe.useEffect(()=>{!u.current||!h.current||t!==c.current&&(m.current=!0,u.current.action(f3(t)),c.current=t,queueMicrotask(()=>{m.current=!1}))},[t]);const F=(J,V,C)=>{u.current?.action(Ma(GA.key,{componentName:J,props:V,children:C}))};return _.jsxs("div",{className:"nua-mdx-editor",style:XK,children:[_.jsx(oI,{editor:M,media:i,mediaContext:r,field:"body",onInsertComponent:s?()=>T(!0):void 0}),_.jsx("div",{ref:o,style:QK}),s?_.jsx(T4,{open:E,components:n??[],onInsert:F,onClose:()=>T(!1)}):null]})}function eG({client:t,value:e,collection:n,entry:i,field:r,accept:s,onChange:o}){const[u,c]=fe.useState({kind:"probing"}),h=fe.useRef(null);fe.useEffect(()=>{let E=!0;return t.listMedia({limit:1}).then(()=>{E&&c({kind:"ready"})},T=>{E&&c(B2(T)?{kind:"unavailable"}:{kind:"ready"})}),()=>{E=!1}},[t]);const m=async E=>{c({kind:"uploading"});try{const T=await t.uploadMedia(E,{collection:n,entry:i,field:r});T.success&&T.url?(o(T.url),c({kind:"ready"})):c({kind:"error",message:T.error??"Upload failed"})}catch(T){if(B2(T)){c({kind:"unavailable"});return}c({kind:"error",message:T instanceof Error?T.message:"Upload failed"})}},g=u.kind==="ready"||u.kind==="error",y=e!==""&&/^(https?:\/\/|data:|\/)/.test(e),b=e===""?"":y?e:i!==void 0?t.mediaFileUrl(n,i,e):"",v=b!==""&&(e.startsWith("data:image/")||/\.(png|jpe?g|gif|webp|avif|svg|ico|bmp)(\?|#|$)/i.test(e));return _.jsxs("div",{className:"nua-cadmin-media",children:[v?_.jsx("img",{className:"nua-cadmin-img",src:b,alt:""}):null,_.jsxs("div",{className:"nua-cadmin-media-row",children:[_.jsx("input",{type:"text",className:"nua-cadmin-input",value:e,placeholder:"Image URL or path",onChange:E=>o(E.target.value)}),e!==""?_.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Clear",onClick:()=>o(""),children:"×"}):null]}),u.kind==="uploading"?_.jsx("div",{className:"nua-cadmin-field-loading",children:"Uploading…"}):null,u.kind==="unavailable"?_.jsx("div",{className:"nua-cadmin-media-hint",children:"Media uploads unavailable — paste a URL or path instead."}):null,u.kind==="error"?_.jsx("div",{className:"nua-cadmin-media-error",children:u.message}):null,g||u.kind==="probing"?_.jsxs(_.Fragment,{children:[_.jsx("input",{ref:h,type:"file",accept:s,className:"nua-cadmin-file-input",disabled:!g,onChange:E=>{const T=E.target.files?.[0];T&&m(T),E.target.value=""}}),_.jsx("button",{type:"button",className:"nua-cadmin-add-btn",disabled:!g,onClick:()=>h.current?.click(),children:"Upload file"})]}):null]})}const tG=[],nG={url:"url",email:"email",tel:"tel"},iG={date:"date",datetime:"datetime-local",time:"time",month:"month"};function rG({field:t,value:e,onChange:n}){const i=t.hints;return _.jsx("input",{type:nG[t.type]??"text",className:"nua-cadmin-input",value:zs(e),placeholder:i?.placeholder,maxLength:i?.maxLength,minLength:i?.minLength,onChange:r=>n(Jb(t.type,r.target.value))})}function sG({value:t,rows:e,placeholder:n,maxLength:i,onChange:r}){const s=fe.useRef(null);return fe.useEffect(()=>{const o=s.current;o&&(o.style.height="auto",o.style.height=`${o.scrollHeight}px`)},[t]),_.jsx("textarea",{ref:s,className:"nua-cadmin-textarea nua-cadmin-textarea-autosize",value:t,rows:e,placeholder:n,maxLength:i,onChange:o=>r(o.target.value)})}function aG({field:t,value:e,onChange:n}){return _.jsx(sG,{value:zs(e),rows:t.hints?.rows??4,placeholder:t.hints?.placeholder,maxLength:t.hints?.maxLength,onChange:n})}function oG({value:t,onChange:e,ctx:n}){const i=fe.useMemo(()=>({collection:n.collection,entry:n.slug}),[n.collection,n.slug]);return _.jsx(t_,{value:zs(t),onChange:e,components:tG,media:n.client,mediaContext:i})}function lG({field:t,value:e,onChange:n}){return _.jsx("input",{type:"number",className:"nua-cadmin-input",value:zs(e),min:t.hints?.min,max:t.hints?.max,step:t.hints?.step,placeholder:t.hints?.placeholder,onChange:i=>n(Jb("number",i.target.value))})}function uG({value:t,onChange:e}){return _.jsx("input",{type:"number",className:"nua-cadmin-input",value:zs(t),min:1e3,max:9999,step:1,onChange:n=>e(Jb("year",n.target.value))})}function cG({field:t,value:e,onChange:n}){return _.jsx("input",{type:iG[t.type]??"date",className:"nua-cadmin-input",value:zs(e),onChange:i=>n(i.target.value)})}function fG({field:t,value:e,onChange:n}){const i=b4(e),r=t.role==="publish-toggle";return _.jsxs("button",{type:"button",className:`nua-cadmin-toggle${i?" nua-cadmin-toggle-on":""}${r?" nua-cadmin-toggle-publish":""}`,role:"switch","aria-checked":i,onClick:()=>n(!i),children:[_.jsx("span",{className:"nua-cadmin-toggle-knob"}),_.jsx("span",{className:"nua-cadmin-toggle-label",children:i?"On":"Off"})]})}function hG({field:t,value:e,onChange:n}){const i=t.options??[],r=zs(e);return _.jsxs("select",{className:"nua-cadmin-input",value:r,onChange:s=>n(s.target.value),children:[t.required?null:_.jsx("option",{value:"",children:"— none —"}),i.map(s=>_.jsx("option",{value:s,children:s},s)),r!==""&&!i.includes(r)?_.jsxs("option",{value:r,children:[r," (current)"]}):null]})}function pG({field:t,value:e,onChange:n,ctx:i}){const r=t.collection,[s,o]=fe.useState(null),[u,c]=fe.useState(!1),h=zs(e);return fe.useEffect(()=>{if(!r)return;let m=!0;return i.client.getEntries(r,{fields:"slug,title",draft:"all",limit:200}).then(g=>{m&&o(g.entries.map(y=>y.slug))},()=>{m&&c(!0)}),()=>{m=!1}},[i.client,r]),!r||u?_.jsx("input",{type:"text",className:"nua-cadmin-input",value:h,placeholder:"entry slug",onChange:m=>n(m.target.value)}):s===null?_.jsxs("div",{className:"nua-cadmin-field-loading",children:["Loading ",r,"…"]}):_.jsxs("select",{className:"nua-cadmin-input",value:h,onChange:m=>n(m.target.value),children:[_.jsx("option",{value:"",children:"— none —"}),s.map(m=>_.jsx("option",{value:m,children:m},m)),h!==""&&!s.includes(h)?_.jsxs("option",{value:h,children:[h," (current)"]}):null]})}function dG({field:t,value:e,onChange:n,ctx:i}){const r=S4(e),s=t.itemType??"text",o={name:t.name,type:s,required:!1,fields:t.fields,options:t.options,collection:t.collection},u=fe.useCallback((m,g)=>{const y=r.slice();y[m]=g,n(y)},[r,n]),c=fe.useCallback(m=>{n(r.filter((g,y)=>y!==m))},[r,n]),h=fe.useCallback(()=>{n([...r,fT(s)])},[r,s,n]);return _.jsxs("div",{className:"nua-cadmin-array",children:[r.length===0?_.jsx("div",{className:"nua-cadmin-field-empty",children:"No items."}):null,r.map((m,g)=>_.jsxs("div",{className:"nua-cadmin-array-item",children:[_.jsx("div",{className:"nua-cadmin-array-item-body",children:_.jsx(Jg,{field:o,value:m,onChange:y=>u(g,y),ctx:i})}),_.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Remove item",onClick:()=>c(g),children:"×"})]},g)),_.jsx("button",{type:"button",className:"nua-cadmin-add-btn",onClick:h,children:"+ Add item"})]})}function mG({field:t,value:e,onChange:n,ctx:i}){const r=k4(e),s=t.fields??[],o=fe.useCallback((u,c)=>{n({...r,[u]:c})},[r,n]);return s.length===0?_.jsx("div",{className:"nua-cadmin-field-empty",children:"No nested fields."}):_.jsx("div",{className:"nua-cadmin-object",children:s.map(u=>_.jsxs("div",{className:"nua-cadmin-object-field",children:[_.jsxs("div",{className:"nua-cadmin-field-label",children:[_.jsx("span",{children:u.name}),_.jsx("span",{className:"nua-cadmin-field-type",children:u.type})]}),_.jsx(Jg,{field:u,value:r[u.name],onChange:c=>o(u.name,c),ctx:i})]},u.name))})}function Jg({field:t,value:e,onChange:n,ctx:i}){switch(t.type){case"text":case"url":case"email":case"tel":case"color":return _.jsx(rG,{field:t,value:e,onChange:n});case"textarea":return _.jsx(aG,{field:t,value:e,onChange:n});case"markdown":return _.jsx(oG,{value:e,onChange:n,ctx:i});case"number":return _.jsx(lG,{field:t,value:e,onChange:n});case"year":return _.jsx(uG,{value:e,onChange:n});case"date":case"datetime":case"time":case"month":return _.jsx(cG,{field:t,value:e,onChange:n});case"boolean":return _.jsx(fG,{field:t,value:e,onChange:n});case"select":return _.jsx(hG,{field:t,value:e,onChange:n});case"image":case"file":return _.jsx(eG,{client:i.client,value:zs(e),collection:i.collection,entry:i.slug,field:t.name,accept:t.hints?.accept,onChange:r=>n(r)});case"reference":return _.jsx(pG,{field:t,value:e,onChange:n,ctx:i});case"array":return _.jsx(dG,{field:t,value:e,onChange:n,ctx:i});case"object":return _.jsx(mG,{field:t,value:e,onChange:n,ctx:i})}}function gG(t){return t.filter(e=>!e.hidden)}function yG({client:t,definition:e,collection:n,onCreated:i,onCancel:r}){const s=fe.useMemo(()=>e?.fields??[],[e]),[o,u]=fe.useState(""),[c,h]=fe.useState(()=>y4(s)),[m,g]=fe.useState(!1),[y,b]=fe.useState(null),v=fe.useMemo(()=>({client:t,collection:n}),[t,n]),E=fe.useCallback((j,F)=>{h(J=>hT(J,j,F))},[]),T=fe.useCallback(async()=>{const j=o.trim();if(j===""){b("A slug is required.");return}g(!0),b(null);try{const F=await t.createEntry(n,{slug:j,frontmatter:c.frontmatter,body:c.body,fileExtension:e?.fileExtension});F.success?i(j):b(F.error??"Could not create the entry.")}catch(F){b(F instanceof vr?F.message:"Could not create the entry.")}finally{g(!1)}},[t,n,e,c,o,i]),M=e?.type==="data";return _.jsxs("div",{className:"nua-cadmin-editor",children:[_.jsxs("div",{className:"nua-cadmin-field",children:[_.jsxs("div",{className:"nua-cadmin-field-label",children:[_.jsx("span",{children:"slug"}),_.jsx("span",{className:"nua-cadmin-field-type",children:"text · required"})]}),_.jsx("input",{type:"text",className:"nua-cadmin-input",value:o,placeholder:"my-new-entry",onChange:j=>u(j.target.value)})]}),gG(s).map(j=>_.jsxs("div",{className:`nua-cadmin-field${j.role?` nua-cadmin-field-${j.role}`:""}`,children:[_.jsxs("div",{className:"nua-cadmin-field-label",children:[_.jsx("span",{children:j.name}),_.jsxs("span",{className:"nua-cadmin-field-type",children:[j.type,j.required?" · required":""]})]}),_.jsx(Jg,{field:j,value:c.frontmatter[j.name],onChange:F=>E(j.name,F),ctx:v})]},j.name)),M?null:_.jsxs("div",{className:"nua-cadmin-field",children:[_.jsxs("div",{className:"nua-cadmin-field-label",children:[_.jsx("span",{children:"Body"}),_.jsx("span",{className:"nua-cadmin-field-type",children:"markdown"})]}),_.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:10,onChange:j=>h(F=>({...F,body:j.target.value}))})]}),y?_.jsx("div",{className:"nua-cadmin-media-error",children:y}):null,_.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[_.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",disabled:m,onClick:r,children:"Cancel"}),_.jsx("span",{className:"nua-cadmin-spacer"}),_.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",disabled:m,onClick:()=>{T()},children:m?"Creating…":"Create entry"})]})]})}const xG=700,bG=4,SG=t=>t.label??t.name,kG=t=>{const e=t.replace(/[_-]+/g," ").trim();return e.charAt(0).toUpperCase()+e.slice(1)},oT=t=>t.role==="publish-toggle"?0:t.role==="publish-date"?1:2;function vG(t){return t.map((e,n)=>[e,n]).sort((e,n)=>(e[0].order??0)-(n[0].order??0)||e[1]-n[1]).map(([e])=>e)}function CG(t){const e=[],n=new Map,i=[];for(const r of t)if(r.type==="object"||r.type==="array")i.push({title:r.label??kG(r.name),fields:[r],collapsed:!0});else{const s=r.group??"";let o=n.get(s);o||(o={title:r.group,fields:[]},n.set(s,o),e.push(o)),o.fields.push(r)}return[...e,...i]}function wG(t,e){const n=vG(e.filter(g=>!g.hidden)),i=n.filter(g=>g.position==="header"),r=new Map(n.map(g=>[g.name,g])),s=t?.layout,o=[],u=new Set;for(const g of s?.sidebar??[]){const y=r.get(g);y&&y.position!=="header"&&!u.has(g)&&(o.push(y),u.add(g))}for(const g of n)g.position==="header"||u.has(g.name)||(g.position==="sidebar"||g.role)&&(o.push(g),u.add(g.name));o.sort((g,y)=>oT(g)-oT(y));const c=n.filter(g=>g.position!=="header"&&!u.has(g.name));let h;if(s?.sections&&s.sections.length>0){const g=new Set;h=s.sections.map(b=>{const v=b.fields.map(E=>r.get(E)).filter(E=>E!==void 0&&c.includes(E));for(const E of v)g.add(E.name);return{title:b.title,fields:v,collapsed:b.collapsed}}).filter(b=>b.fields.length>0);const y=c.filter(b=>!g.has(b.name));y.length>0&&h.push({title:"Other",fields:y})}else h=CG(c);const m=s?.display??(h.length>bG?"tabs":"sections");return{header:i,sidebar:o,sections:h,display:m}}function EG({field:t,draft:e,onField:n,ctx:i}){return _.jsxs("div",{className:`nua-cadmin-field${t.width==="half"?" nua-cadmin-field-half":""}${t.role?` nua-cadmin-field-${t.role}`:""}`,children:[_.jsxs("div",{className:"nua-cadmin-field-label",children:[_.jsx("span",{children:SG(t)}),_.jsxs("span",{className:"nua-cadmin-field-type",children:[t.type,t.required?" · required":""]})]}),t.help?_.jsx("div",{className:"nua-cadmin-field-help",children:t.help}):null,_.jsx(Jg,{field:t,value:e.frontmatter[t.name],onChange:r=>n(t.name,r),ctx:i})]})}function sh({fields:t,draft:e,onField:n,ctx:i}){return _.jsx("div",{className:"nua-cadmin-field-grid",children:t.map(r=>_.jsx(EG,{field:r,draft:e,onField:n,ctx:i},r.name))})}function NG({sections:t,display:e,draft:n,onField:i,ctx:r}){const[s,o]=fe.useState(0);if(e==="tabs"){const u=t[Math.min(s,t.length-1)];return _.jsxs("div",{className:"nua-cadmin-tabs",children:[_.jsx("div",{className:"nua-cadmin-tabbar",role:"tablist",children:t.map((c,h)=>_.jsx("button",{type:"button",role:"tab","aria-selected":h===s,className:`nua-cadmin-tab${h===s?" is-active":""}`,onClick:()=>o(h),children:c.title??"General"},c.title??`section-${h}`))}),u?_.jsx(sh,{fields:u.fields,draft:n,onField:i,ctx:r}):null]})}return _.jsx(_.Fragment,{children:t.map((u,c)=>u.title===void 0?_.jsx(sh,{fields:u.fields,draft:n,onField:i,ctx:r},`section-${c}`):_.jsxs("details",{className:"nua-cadmin-section",open:!u.collapsed,children:[_.jsx("summary",{className:"nua-cadmin-section-summary",children:u.title}),_.jsx("div",{className:"nua-cadmin-section-body",children:_.jsx(sh,{fields:u.fields,draft:n,onField:i,ctx:r})})]},u.title))})}function AG({onUseServer:t,onUseOurs:e,onDismiss:n}){return _.jsx("div",{className:"nua-cadmin-dialog-backdrop",role:"dialog","aria-modal":"true","aria-label":"Edit conflict",children:_.jsxs("div",{className:"nua-cadmin-dialog",children:[_.jsx("div",{className:"nua-cadmin-dialog-title",children:"This entry changed elsewhere"}),_.jsx("div",{className:"nua-cadmin-dialog-body",children:"Someone (or the agent) edited this entry after you opened it. Choose which version to keep."}),_.jsxs("div",{className:"nua-cadmin-dialog-actions",children:[_.jsx("button",{type:"button",className:"nua-cadmin-btn",onClick:t,children:"Use server version"}),_.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:e,children:"Keep my changes"}),_.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:n,children:"Keep editing"})]})]})})}function TG({status:t}){switch(t.kind){case"saving":return _.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saving",children:"Saving…"});case"saved":return _.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saved",children:"Saved"});case"conflict":return _.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-conflict",children:"Conflict"});case"error":return _.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-error",children:t.message});default:return null}}function MG({client:t,definition:e,collection:n,slug:i,onDeleted:r,onRenamed:s}){const o=fe.useMemo(()=>e?.fields??[],[e]),u=e?.fileExtension==="mdx",[c,h]=fe.useState(null),[m,g]=fe.useState(null),[y,b]=fe.useState({kind:"idle"}),[v,E]=fe.useState([]),T=fe.useRef(void 0),M=fe.useRef(null);M.current=c;const j=fe.useRef(null),F=fe.useMemo(()=>({client:t,collection:n,slug:i}),[t,n,i]),J=fe.useMemo(()=>({collection:n,entry:i}),[n,i]);fe.useEffect(()=>{let de=!0;return T.current=void 0,h(null),g(null),b({kind:"idle"}),t.getEntry(n,i).then(ve=>{de&&h(g4(ve,o))},ve=>{de&&g(ve instanceof Error?ve:new Error(String(ve)))}),()=>{de=!1,j.current&&clearTimeout(j.current)}},[t,n,i,o]),fe.useEffect(()=>{if(!u)return;let de=!0;return t.getComponents().then(ve=>{de&&E(ve)},()=>{de&&E([])}),()=>{de=!1}},[t,u]);const V=fe.useCallback(async(de,ve)=>{b({kind:"saving"});try{const D=await t.updateEntry(n,i,{frontmatter:de.frontmatter,body:de.body,baseHash:ve});if(D.status==="conflict"){b({kind:"conflict",conflict:D.conflict});return}D.result.sourceHash!==void 0&&(T.current=D.result.sourceHash),b({kind:"saved"})}catch(D){b({kind:"error",message:D instanceof vr?D.message:"Save failed"})}},[t,n,i]),C=fe.useCallback(de=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{V(de,T.current)},xG)},[V]),L=fe.useCallback((de,ve)=>{h(D=>{if(!D)return D;const P=hT(D,de,ve);return C(P),P})},[C]),q=fe.useCallback(de=>{h(ve=>{if(!ve)return ve;const D={...ve,body:de};return C(D),D})},[C]),re=fe.useCallback(()=>{if(y.kind!=="conflict")return;const de=x4(y.conflict.serverFrontmatter,y.conflict.serverBody,o);T.current=y.conflict.serverHash,h(de),b({kind:"saved"})},[y,o]),K=fe.useCallback(()=>{if(y.kind!=="conflict")return;const de=M.current;de&&V(de,y.conflict.serverHash)},[y,V]),pe=fe.useCallback(()=>{y.kind==="conflict"&&b({kind:"idle"})},[y]),he=fe.useCallback(async()=>{if(!(typeof window<"u"&&!window.confirm(`Delete entry "${i}"? This cannot be undone.`)))try{await t.deleteEntry(n,i),r()}catch(de){b({kind:"error",message:de instanceof vr?de.message:"Delete failed"})}},[t,n,i,r]),ke=fe.useCallback(async()=>{if(typeof window>"u")return;const de=window.prompt("Rename entry to (new slug):",i);if(!(de===null||de.trim()===""||de===i))try{await t.renameEntry(n,i,de.trim()),s(de.trim())}catch(ve){b({kind:"error",message:ve instanceof vr?ve.message:"Rename failed"})}},[t,n,i,s]);if(m)return _.jsxs("div",{className:"nua-cadmin-error",children:[_.jsx("div",{className:"nua-cadmin-error-title",children:"Could not load entry"}),_.jsx("div",{children:m.message})]});if(!c)return _.jsxs("div",{className:"nua-cadmin-state",children:[_.jsx("div",{className:"nua-cadmin-spinner"}),_.jsx("div",{children:"Loading entry…"})]});const{header:Ie,sidebar:De,sections:W,display:oe}=wG(e,o);return _.jsxs("div",{className:"nua-cadmin-editor",children:[_.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[_.jsx(TG,{status:y}),_.jsx("span",{className:"nua-cadmin-spacer"}),_.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:()=>{ke()},children:"Rename"}),_.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-danger",onClick:()=>{he()},children:"Delete"})]}),Ie.length>0?_.jsx("div",{className:"nua-cadmin-editor-header-fields",children:_.jsx(sh,{fields:Ie,draft:c,onField:L,ctx:F})}):null,_.jsxs("div",{className:"nua-cadmin-editor-grid",children:[_.jsxs("div",{className:"nua-cadmin-editor-main",children:[_.jsx(NG,{sections:W,display:oe,draft:c,onField:L,ctx:F}),e?.type!=="data"?_.jsxs("div",{className:"nua-cadmin-field",children:[_.jsxs("div",{className:"nua-cadmin-field-label",children:[_.jsx("span",{children:"Body"}),_.jsx("span",{className:"nua-cadmin-field-type",children:u?"mdx":"markdown"})]}),u?_.jsx(t_,{value:c.body,onChange:q,components:v,media:t,mediaContext:J}):_.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:16,onChange:de=>q(de.target.value)})]}):null]}),De.length>0?_.jsx("div",{className:"nua-cadmin-editor-sidebar",children:_.jsx(sh,{fields:De,draft:c,onField:L,ctx:F})}):null]}),y.kind==="conflict"?_.jsx(AG,{onUseServer:re,onUseOurs:K,onDismiss:pe}):null]})}function lT(t){const e=t.replace(/^#\/?/,"").split("/").filter(Boolean);if(e[0]!=="c"||e[1]===void 0)return{view:"list"};const n=decodeURIComponent(e[1]);return e[2]==="new"?{view:"create",collection:n}:e[2]==="e"&&e[3]!==void 0?{view:"detail",collection:n,slug:decodeURIComponent(e[3])}:{view:"entries",collection:n}}function OG(t){switch(t.view){case"list":return"#/";case"entries":return`#/c/${encodeURIComponent(t.collection)}`;case"create":return`#/c/${encodeURIComponent(t.collection)}/new`;case"detail":return`#/c/${encodeURIComponent(t.collection)}/e/${encodeURIComponent(t.slug)}`}}function RG(t,e){const[n,i]=fe.useState({data:null,error:null,loading:!0}),[r,s]=fe.useState(0),o=fe.useRef(t);o.current=t;const u=[...e,r];fe.useEffect(()=>{let h=!0;return i({data:null,error:null,loading:!0}),o.current().then(m=>{h&&i({data:m,error:null,loading:!1})},m=>{h&&i({data:null,error:m instanceof Error?m:new Error(String(m)),loading:!1})}),()=>{h=!1}},u);const c=fe.useCallback(()=>s(h=>h+1),[]);return{...n,reload:c}}function DG({label:t}){return _.jsxs("div",{className:"nua-cadmin-state",children:[_.jsx("div",{className:"nua-cadmin-spinner"}),_.jsx("div",{children:t})]})}function n_({error:t,onRetry:e}){const n=t instanceof vr&&t.isUnauthorized?"Session expired":t instanceof vr&&t.isForbidden?"No access":"Something went wrong";return _.jsxs("div",{className:"nua-cadmin-error",children:[_.jsx("div",{className:"nua-cadmin-error-title",children:n}),_.jsx("div",{children:t.message}),e?_.jsx("button",{type:"button",className:"nua-cadmin-retry",onClick:e,children:"Try again"}):null]})}function i_({label:t}){return _.jsx("div",{className:"nua-cadmin-state",children:t})}function IG({collections:t,loading:e,error:n,activeCollection:i,onSelect:r,onReload:s,onClose:o}){const u=new Map;for(const m of t){if(!m.parentCollection)continue;const g=u.get(m.parentCollection)??[];g.push(m),u.set(m.parentCollection,g)}const c=t.filter(m=>!m.parentCollection),h=(m,g)=>_.jsxs("button",{type:"button",className:`nua-cadmin-nav-item${m.name===i?" is-active":""}`,style:g>0?{paddingLeft:12+g*14}:void 0,onClick:()=>r(m.name),title:m.name,children:[_.jsx("span",{className:"nua-cadmin-nav-label",children:m.label||m.name}),_.jsx("span",{className:"nua-cadmin-nav-count",children:m.entryCount})]},m.name);return _.jsxs("aside",{className:"nua-cadmin-sidebar",children:[_.jsxs("div",{className:"nua-cadmin-sidebar-head",children:[_.jsx("span",{className:"nua-cadmin-brand",children:"Collections"}),o?_.jsx("button",{type:"button",className:"nua-cadmin-close","aria-label":"Close",onClick:o,children:"×"}):null]}),_.jsxs("nav",{className:"nua-cadmin-nav",children:[e?_.jsx("div",{className:"nua-cadmin-nav-state",children:"Loading…"}):null,n?_.jsx("button",{type:"button",className:"nua-cadmin-nav-state nua-cadmin-nav-error",onClick:s,children:"Failed to load — retry"}):null,!e&&!n&&t.length===0?_.jsx("div",{className:"nua-cadmin-nav-state",children:"No content types"}):null,!e&&!n?c.flatMap(m=>[h(m,0),...(u.get(m.name)??[]).map(g=>h(g,1))]):null]})]})}const _G=50,zG="slug,title,draft,pathname";function LG({client:t,collection:e,onOpen:n,onCreate:i}){const[r,s]=fe.useState([]),[o,u]=fe.useState(void 0),[c,h]=fe.useState(!1),[m,g]=fe.useState(null),[y,b]=fe.useState(!0),[v,E]=fe.useState(!1),T=fe.useCallback(async(j,F)=>{F?E(!0):b(!0),g(null);try{const J=await t.getEntries(e,{fields:zG,draft:"all",limit:_G,cursor:j});s(V=>F?[...V,...J.entries]:J.entries),u(J.cursor),h(J.hasMore)}catch(J){g(J instanceof Error?J:new Error(String(J)))}finally{b(!1),E(!1)}},[t,e]);if(fe.useEffect(()=>{s([]),u(void 0),h(!1),T(void 0,!1)},[T]),y)return _.jsx(DG,{label:"Loading entries…"});if(m)return _.jsx(n_,{error:m,onRetry:()=>{T(void 0,!1)}});const M=_.jsx("div",{className:"nua-cadmin-entries-toolbar",children:_.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:i,children:"+ New entry"})});return r.length===0?_.jsxs("div",{children:[M,_.jsx(i_,{label:"This collection has no entries."})]}):_.jsxs("div",{children:[M,_.jsxs("table",{className:"nua-cadmin-table",children:[_.jsx("thead",{children:_.jsxs("tr",{children:[_.jsx("th",{children:"Slug"}),_.jsx("th",{children:"Title"}),_.jsx("th",{children:"Draft"}),_.jsx("th",{children:"Pathname"})]})}),_.jsx("tbody",{children:r.map(j=>_.jsxs("tr",{className:"nua-cadmin-row",onClick:()=>n(j.slug),children:[_.jsx("td",{className:"nua-cadmin-cell-mono",children:j.slug}),_.jsx("td",{children:j.title??_.jsx("span",{className:"nua-cadmin-field-empty",children:"—"})}),_.jsx("td",{children:j.draft?_.jsx("span",{className:"nua-cadmin-badge nua-cadmin-badge-draft",children:"draft"}):""}),_.jsx("td",{className:"nua-cadmin-cell-mono",children:j.pathname??"—"})]},j.slug))})]}),c?_.jsx("button",{type:"button",className:"nua-cadmin-load-more",disabled:v,onClick:()=>{T(o,!0)},children:v?"Loading…":"Load more"}):null]})}function BG({apiBase:t,onClose:e}){const n=fe.useMemo(()=>p4(t),[t]),[i,r]=fe.useState(()=>typeof window<"u"?lT(window.location.hash):{view:"list"});fe.useEffect(()=>{const v=()=>r(lT(window.location.hash));return window.addEventListener("hashchange",v),v(),()=>window.removeEventListener("hashchange",v)},[]);const s=fe.useCallback(v=>{const E=OG(v);typeof window<"u"&&window.location.hash!==E?window.location.hash=E:r(v)},[]),o=RG(()=>n.getCollections(),[n]),u=o.data??[],c=i.view!=="list"?i.collection:void 0,h=c?u.find(v=>v.name===c):void 0,m=h?h.label||h.name:c??"",g=fe.useCallback(v=>s({view:"entries",collection:v}),[s]),y=fe.useCallback((v,E)=>s({view:"detail",collection:v,slug:E}),[s]),b=fe.useCallback(v=>s({view:"create",collection:v}),[s]);return _.jsxs("div",{className:"nua-cadmin",children:[_.jsx(IG,{collections:u,loading:o.loading,error:o.error,activeCollection:c,onSelect:g,onReload:o.reload,onClose:e}),_.jsxs("main",{className:"nua-cadmin-main",children:[_.jsxs("div",{className:"nua-cadmin-header",children:[i.view==="detail"||i.view==="create"?_.jsxs("button",{type:"button",className:"nua-cadmin-back",onClick:()=>g(i.collection),children:["← ",m]}):null,_.jsxs("h2",{className:"nua-cadmin-title",children:[i.view==="list"?"Content":m,i.view==="detail"?_.jsxs("span",{className:"nua-cadmin-crumb",children:["/ ",i.slug]}):null,i.view==="create"?_.jsx("span",{className:"nua-cadmin-crumb",children:"/ new entry"}):null]}),_.jsx("span",{className:"nua-cadmin-spacer"})]}),_.jsxs("div",{className:"nua-cadmin-body",children:[i.view==="list"?o.error?_.jsx(n_,{error:o.error,onRetry:o.reload}):_.jsx(i_,{label:"Pick a content type from the left to browse its entries."}):null,i.view==="entries"?_.jsx(LG,{client:n,collection:i.collection,onOpen:v=>y(i.collection,v),onCreate:()=>b(i.collection)}):null,i.view==="detail"?_.jsx(MG,{client:n,definition:h,collection:i.collection,slug:i.slug,onDeleted:()=>g(i.collection),onRenamed:v=>y(i.collection,v)},`${i.collection}/${i.slug}`):null,i.view==="create"?_.jsx(yG,{client:n,definition:h,collection:i.collection,onCreated:v=>y(i.collection,v),onCancel:()=>g(i.collection)}):null]})]})]})}const r_=document.getElementById("nua-studio-root");if(!r_)throw new Error("[cms-studio] #nua-studio-root container is missing");e_.createRoot(r_).render(_.jsx(fe.StrictMode,{children:_.jsx(BG,{apiBase:"/cms/v1"})}));