@nuasite/cms-studio 0.44.3 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,130 @@
1
+ var iE=t=>{throw TypeError(t)};var sE=(t,e,n)=>e.has(t)||iE("Cannot "+n);var tt=(t,e,n)=>(sE(t,e,"read from private field"),n?n.call(t):e.get(t)),Ut=(t,e,n)=>e.has(t)?iE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),su=(t,e,n,r)=>(sE(t,e,"write to private field"),r?r.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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function VT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r1={exports:{}},Gc={};var aE;function U4(){if(aE)return Gc;aE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Gc.Fragment=e,Gc.jsx=n,Gc.jsxs=n,Gc}var oE;function J4(){return oE||(oE=1,r1.exports=U4()),r1.exports}var I=J4();const q4=409;class Ci extends Error{constructor(e,n,r){super(r),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 lE(t){return ch(t)&&typeof t.error=="string"&&typeof t.code=="string"}function ch(t){return typeof t=="object"&&t!==null}function H4(t){return ch(t)?t.code==="conflict"&&typeof t.serverHash=="string"&&ch(t.serverFrontmatter):!1}const K4=["not_found","conflict","validation","parse_error","io_error","unsupported","unauthorized"];function G4(t){return K4.includes(t)}function uE(t){return t instanceof Ci&&(t.status===501||t.code==="unsupported")}function Y4(t){const e=t.endsWith("/")?t.slice(0,-1):t;async function n(h){const d=await fetch(`${e}${h}`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!d.ok)throw await r(d);return await d.json()}async function r(h){const d=await h.json().catch(()=>null);return s(h.status,d)}function i(h,d){if(lE(h))return h.error;if(ch(h)){const g=h.error;if(ch(g)&&typeof g.message=="string")return g.message}return d}function s(h,d){return h===403?new Ci(403,"forbidden",i(d,"You do not have access to this project.")):lE(d)&&G4(d.code)?new Ci(h,d.code,d.error):h===401?new Ci(401,"unauthorized","Your session has expired. Please reload."):new Ci(h,"unknown",i(d,`Request failed (${h})`))}function o(h,d){const g={method:h,credentials:"include",headers:{accept:"application/json"}};return d!==void 0&&(g.body=JSON.stringify(d),g.headers={accept:"application/json","content-type":"application/json"}),g}async function u(h,d,g){const y=await fetch(`${e}${h}`,o(d,g));if(!y.ok)throw await r(y);return await y.json()}function c(h,d){return`/collections/${encodeURIComponent(h)}/entries/${encodeURIComponent(d)}`}return{getProject(){return n("/project")},getConfig(){return n("/config")},getCollections(){return n("/collections")},getComponents(){return n("/components")},getEntries(h,d={}){const g=new URLSearchParams;d.fields!==void 0&&g.set("fields",d.fields),d.draft!==void 0&&g.set("draft",d.draft),d.cursor!==void 0&&g.set("cursor",d.cursor),d.limit!==void 0&&g.set("limit",String(d.limit));const y=g.toString(),b=y===""?"":`?${y}`;return n(`/collections/${encodeURIComponent(h)}/entries${b}`)},getEntry(h,d){return n(c(h,d))},async updateEntry(h,d,g){const y=await fetch(`${e}${c(h,d)}`,o("PATCH",g));if(y.status===q4){const k=await y.json().catch(()=>null);if(H4(k))return{status:"conflict",conflict:k};throw s(y.status,k)}if(!y.ok)throw await r(y);return{status:"ok",result:await y.json()}},createEntry(h,d){return u(`/collections/${encodeURIComponent(h)}/entries`,"POST",d)},deleteEntry(h,d){return u(c(h,d),"DELETE")},renameEntry(h,d,g){return u(`${c(h,d)}/rename`,"POST",{to:g})},addArrayItem(h,d,g,y,b){const k=b===void 0?{field:g,value:y}:{field:g,value:y,index:b};return u(`${c(h,d)}/array`,"POST",k)},removeArrayItem(h,d,g,y){return u(`${c(h,d)}/array`,"DELETE",{field:g,index:y})},listMedia(h={}){const d=new URLSearchParams;h.folder!==void 0&&d.set("folder",h.folder),h.cursor!==void 0&&d.set("cursor",h.cursor),h.limit!==void 0&&d.set("limit",String(h.limit));const g=d.toString();return n(`/media${g===""?"":`?${g}`}`)},async uploadMedia(h,d={}){const g=new URLSearchParams;d.collection!==void 0&&g.set("collection",d.collection),d.entry!==void 0&&g.set("entry",d.entry),d.field!==void 0&&g.set("field",d.field),d.folder!==void 0&&g.set("folder",d.folder);const y=g.toString(),b=new FormData;b.append("file",h);const k=await fetch(`${e}/media${y===""?"":`?${y}`}`,{method:"POST",credentials:"include",headers:{accept:"application/json"},body:b});if(!k.ok)throw await r(k);return await k.json()},mediaFileUrl(h,d,g){return`${e}${c(h,d)}/asset?path=${encodeURIComponent(g)}`},deleteMedia(h){return u(`/media/${encodeURIComponent(h)}`,"DELETE")},createFolder(h){return u("/media","POST",{folder:h})}}}function Q4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function FT(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"date":case"datetime":case"time":return cE(e);case"array":case"object":return cE(e);default:return e}}function cE(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 W4(t,e){const n=new Map(e.map(i=>[i.name,i])),r={};for(const[i,s]of Object.entries(t.frontmatter)){const o=n.get(i);r[i]=o?FT(o.type,s.value):s.value}return{frontmatter:r,body:t.body}}function X4(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]=PT(n.type)}return{frontmatter:e,body:""}}function PT(t){switch(t){case"boolean":return!1;case"array":return[];case"object":return{};case"date":case"datetime":case"time":case"month":return;default:return""}}function Z4(t,e,n){const r=new Map(n.map(s=>[s.name,s])),i={};for(const[s,o]of Object.entries(t)){const u=r.get(s);i[s]=u&&typeof o=="string"?FT(u.type,o):o}return{frontmatter:i,body:e??""}}function fS(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}case"date":case"datetime":case"time":return e.trim()===""?void 0:e;default:return e}}function Ps(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function ez(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"||t==="1"||t.toLowerCase()==="yes":!!t}function tz(t){return Array.isArray(t)?t:[]}function nz(t){return Q4(t)?t:{}}function jT(t,e,n){return{...t,frontmatter:{...t.frontmatter,[e]:n}}}var i1={exports:{}},Ke={};var fE;function rz(){if(fE)return Ke;fE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=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"),d=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function b(F){return F===null||typeof F!="object"?null:(F=y&&F[y]||F["@@iterator"],typeof F=="function"?F:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,N={};function M(F,ee,V){this.props=F,this.context=ee,this.refs=N,this.updater=V||k}M.prototype.isReactComponent={},M.prototype.setState=function(F,ee){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,ee,"setState")},M.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function j(){}j.prototype=M.prototype;function P(F,ee,V){this.props=F,this.context=ee,this.refs=N,this.updater=V||k}var U=P.prototype=new j;U.constructor=P,E(U,M.prototype),U.isPureReactComponent=!0;var L=Array.isArray;function C(){}var z={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function J(F,ee,V){var be=V.ref;return{$$typeof:t,type:F,key:ee,ref:be!==void 0?be:null,props:V}}function K(F,ee){return J(F.type,ee,F.props)}function de(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function ce(F){var ee={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(V){return ee[V]})}var Se=/\/+/g;function Re(F,ee){return typeof F=="object"&&F!==null&&F.key!=null?ce(""+F.key):ee.toString(36)}function Y(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(C,C):(F.status="pending",F.then(function(ee){F.status==="pending"&&(F.status="fulfilled",F.value=ee)},function(ee){F.status==="pending"&&(F.status="rejected",F.reason=ee)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function W(F,ee,V,be,De){var Me=typeof F;(Me==="undefined"||Me==="boolean")&&(F=null);var Xe=!1;if(F===null)Xe=!0;else switch(Me){case"bigint":case"string":case"number":Xe=!0;break;case"object":switch(F.$$typeof){case t:case e:Xe=!0;break;case d:return Xe=F._init,W(Xe(F._payload),ee,V,be,De)}}if(Xe)return De=De(F),Xe=be===""?"."+Re(F,0):be,L(De)?(V="",Xe!=null&&(V=Xe.replace(Se,"$&/")+"/"),W(De,ee,V,"",function(zt){return zt})):De!=null&&(de(De)&&(De=K(De,V+(De.key==null||F&&F.key===De.key?"":(""+De.key).replace(Se,"$&/")+"/")+Xe)),ee.push(De)),1;Xe=0;var Ct=be===""?".":be+":";if(L(F))for(var Ze=0;Ze<F.length;Ze++)be=F[Ze],Me=Ct+Re(be,Ze),Xe+=W(be,ee,V,Me,De);else if(Ze=b(F),typeof Ze=="function")for(F=Ze.call(F),Ze=0;!(be=F.next()).done;)be=be.value,Me=Ct+Re(be,Ze++),Xe+=W(be,ee,V,Me,De);else if(Me==="object"){if(typeof F.then=="function")return W(Y(F),ee,V,be,De);throw ee=String(F),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Xe}function ue(F,ee,V){if(F==null)return F;var be=[],De=0;return W(F,be,"","",function(Me){return ee.call(V,Me,De++)}),be}function ke(F){if(F._status===-1){var ee=F._result;ee=ee(),ee.then(function(V){(F._status===0||F._status===-1)&&(F._status=1,F._result=V)},function(V){(F._status===0||F._status===-1)&&(F._status=2,F._result=V)}),F._status===-1&&(F._status=0,F._result=ee)}if(F._status===1)return F._result.default;throw F._result}var ze=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},D={map:ue,forEach:function(F,ee,V){ue(F,function(){ee.apply(this,arguments)},V)},count:function(F){var ee=0;return ue(F,function(){ee++}),ee},toArray:function(F){return ue(F,function(ee){return ee})||[]},only:function(F){if(!de(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return Ke.Activity=g,Ke.Children=D,Ke.Component=M,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=P,Ke.StrictMode=r,Ke.Suspense=c,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(F){return z.H.useMemoCache(F)}},Ke.cache=function(F){return function(){return F.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(F,ee,V){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var be=E({},F.props),De=F.key;if(ee!=null)for(Me in ee.key!==void 0&&(De=""+ee.key),ee)!G.call(ee,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&ee.ref===void 0||(be[Me]=ee[Me]);var Me=arguments.length-2;if(Me===1)be.children=V;else if(1<Me){for(var Xe=Array(Me),Ct=0;Ct<Me;Ct++)Xe[Ct]=arguments[Ct+2];be.children=Xe}return J(F.type,De,be)},Ke.createContext=function(F){return F={$$typeof:o,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:s,_context:F},F},Ke.createElement=function(F,ee,V){var be,De={},Me=null;if(ee!=null)for(be in ee.key!==void 0&&(Me=""+ee.key),ee)G.call(ee,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(De[be]=ee[be]);var Xe=arguments.length-2;if(Xe===1)De.children=V;else if(1<Xe){for(var Ct=Array(Xe),Ze=0;Ze<Xe;Ze++)Ct[Ze]=arguments[Ze+2];De.children=Ct}if(F&&F.defaultProps)for(be in Xe=F.defaultProps,Xe)De[be]===void 0&&(De[be]=Xe[be]);return J(F,Me,De)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(F){return{$$typeof:u,render:F}},Ke.isValidElement=de,Ke.lazy=function(F){return{$$typeof:d,_payload:{_status:-1,_result:F},_init:ke}},Ke.memo=function(F,ee){return{$$typeof:h,type:F,compare:ee===void 0?null:ee}},Ke.startTransition=function(F){var ee=z.T,V={};z.T=V;try{var be=F(),De=z.S;De!==null&&De(V,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(C,ze)}catch(Me){ze(Me)}finally{ee!==null&&V.types!==null&&(ee.types=V.types),z.T=ee}},Ke.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ke.use=function(F){return z.H.use(F)},Ke.useActionState=function(F,ee,V){return z.H.useActionState(F,ee,V)},Ke.useCallback=function(F,ee){return z.H.useCallback(F,ee)},Ke.useContext=function(F){return z.H.useContext(F)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(F,ee){return z.H.useDeferredValue(F,ee)},Ke.useEffect=function(F,ee){return z.H.useEffect(F,ee)},Ke.useEffectEvent=function(F){return z.H.useEffectEvent(F)},Ke.useId=function(){return z.H.useId()},Ke.useImperativeHandle=function(F,ee,V){return z.H.useImperativeHandle(F,ee,V)},Ke.useInsertionEffect=function(F,ee){return z.H.useInsertionEffect(F,ee)},Ke.useLayoutEffect=function(F,ee){return z.H.useLayoutEffect(F,ee)},Ke.useMemo=function(F,ee){return z.H.useMemo(F,ee)},Ke.useOptimistic=function(F,ee){return z.H.useOptimistic(F,ee)},Ke.useReducer=function(F,ee,V){return z.H.useReducer(F,ee,V)},Ke.useRef=function(F){return z.H.useRef(F)},Ke.useState=function(F){return z.H.useState(F)},Ke.useSyncExternalStore=function(F,ee,V){return z.H.useSyncExternalStore(F,ee,V)},Ke.useTransition=function(){return z.H.useTransition()},Ke.version="19.2.7",Ke}var hE;function hS(){return hE||(hE=1,i1.exports=rz()),i1.exports}var ae=hS();function iz(t){const e={};for(const n of t.props)e[n.name]=n.defaultValue??"";return e}const sz={position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:1e3},az={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},oz={border:"none",borderBottom:"1px solid #ececed",padding:"10px 12px",font:"inherit",outline:"none"},lz={textAlign:"left",border:"none",background:"transparent",padding:"8px 12px",cursor:"pointer",borderRadius:0};function uz({open:t,components:e,onInsert:n,onClose:r}){const[i,s]=ae.useState(""),o=ae.useMemo(()=>{const u=i.trim().toLowerCase();return e.filter(c=>u===""||c.name.toLowerCase().includes(u)||(c.description??"").toLowerCase().includes(u))},[e,i]);return t?I.jsx("div",{style:sz,onMouseDown:r,children:I.jsxs("div",{style:az,onMouseDown:u=>u.stopPropagation(),children:[I.jsx("input",{style:oz,placeholder:"Search components…",autoFocus:!0,value:i,onChange:u=>s(u.target.value)}),I.jsxs("div",{style:{overflowY:"auto"},children:[o.length===0?I.jsx("div",{style:{padding:12,color:"#a1a1aa"},children:"No components"}):null,o.map(u=>I.jsxs("button",{type:"button",style:lz,onClick:()=>{n(u.name,iz(u)),r()},children:[I.jsx("div",{style:{fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},children:u.name}),u.description?I.jsx("div",{style:{color:"#71717a",fontSize:12},children:u.description}):null]},u.name))]})]})}):null}var si=(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})({}),ai=class extends Error{constructor(t,e){super(e),this.name="MilkdownError",this.code=t}},cz=(t,e)=>typeof e=="function"?"[Function]":e,xg=t=>JSON.stringify(t,cz);function fz(t){return new ai(si.docTypeError,`Doc type error, unsupported type: ${xg(t)}`)}function hz(t){return new ai(si.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function pz(t){return new ai(si.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function bg(){return new ai(si.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function dz(t,e,n){const r=`Cannot create node for ${"name"in t?t.name:t}`,i=o=>{if(o==null)return"null";if(Array.isArray(o))return`[${o.map(i).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]",r],["[Attributes]",e],["[Content]",(n??[]).map(o=>o?typeof o=="object"&&"type"in o?`${o}`:i(o):"null")]].reduce((o,[u,c])=>{const h=`${u}: ${i(c)}.`;return o.concat(h)},[]);return new ai(si.createNodeInParserFail,s.join(`
2
+ `))}function $T(){return new ai(si.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function mz(t){return new ai(si.parserMatchError,`Cannot match target parser for node: ${xg(t)}.`)}function gz(t){return new ai(si.serializerMatchError,`Cannot match target serializer for node: ${xg(t)}.`)}function Ki(t){return new ai(si.expectDomTypeError,`Expect to be a dom, but get: ${xg(t)}.`)}function s1(){return new ai(si.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 yz(t){return new ai(si.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${t}" in schema.`)}function xz(t){return new ai(si.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${t}" in schema.`)}var UT=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 hz(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)}},bz=class{#t=[];#e;#r=()=>{this.#t.forEach(e=>e(this.#e))};constructor(e,n,r){this.set=i=>{this.#e=i,this.#r()},this.get=()=>this.#e,this.update=i=>{this.#e=i(this.#e),this.#r()},this.type=r,this.#e=n,e.set(r.id,this)}on(e){return this.#t.push(e),()=>{this.#t=this.#t.filter(n=>n!==e)}}once(e){const n=this.on(r=>{e(r),n()});return n}off(e){this.#t=this.#t.filter(n=>n!==e)}offAll(){this.#t=[]}},Sz=class{constructor(t,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=t,this._typeInfo=()=>{throw bg()}}create(t,e=this._defaultValue){return new bz(t,e,this)}},at=(t,e)=>new Sz(t,e),vz=class{#t;#e;#r;#n=new Set;#o=new Set;#s=new Map;#i=new Map;constructor(t,e,n){this.read=()=>({metadata:this.#t,injectedSlices:[...this.#n].map(r=>({name:typeof r=="string"?r:r.name,value:this.#a(r)})),consumedSlices:[...this.#o].map(r=>({name:typeof r=="string"?r:r.name,value:this.#a(r)})),recordedTimers:[...this.#s].map(([r,{duration:i}])=>({name:r.name,duration:i,status:this.#l(r)})),waitTimers:[...this.#i].map(([r,{duration:i}])=>({name:r.name,duration:i,status:this.#l(r)}))}),this.onRecord=r=>{this.#s.set(r,{start:Date.now(),duration:0})},this.onClear=r=>{this.#s.delete(r)},this.onDone=r=>{const i=this.#s.get(r);i&&(i.duration=Date.now()-i.start)},this.onWait=(r,i)=>{const s=Date.now();i.finally(()=>{this.#i.set(r,{duration:Date.now()-s})}).catch(console.error)},this.onInject=r=>{this.#n.add(r)},this.onRemove=r=>{this.#n.delete(r)},this.onUse=r=>{this.#o.add(r)},this.#e=t,this.#r=e,this.#t=n}#a=t=>this.#e.get(t).get();#l=t=>this.#r.get(t).status},kz=class JT{#t;#e;#r;#n;constructor(e,n,r){this.produce=i=>i&&Object.keys(i).length?new JT(this.#t,this.#e,{...i}):this,this.inject=(i,s)=>{const o=i.create(this.#t.sliceMap);return s!=null&&o.set(s),this.#n?.onInject(i),this},this.remove=i=>(this.#t.remove(i),this.#n?.onRemove(i),this),this.record=i=>(i.create(this.#e.store),this.#n?.onRecord(i),this),this.clearTimer=i=>(this.#e.remove(i),this.#n?.onClear(i),this),this.isInjected=i=>this.#t.has(i),this.isRecorded=i=>this.#e.has(i),this.use=i=>(this.#n?.onUse(i),this.#t.get(i)),this.get=i=>this.use(i).get(),this.set=(i,s)=>this.use(i).set(s),this.update=(i,s)=>this.use(i).update(s),this.timer=i=>this.#e.get(i),this.done=i=>{this.timer(i).done(),this.#n?.onDone(i)},this.wait=i=>{const s=this.timer(i).start();return this.#n?.onWait(i,s),s},this.waitTimers=async i=>{await Promise.all(this.get(i).map(s=>this.wait(s)))},this.#t=e,this.#e=n,this.#r=r,r&&(this.#n=new vz(e,n,r))}get meta(){return this.#r}get inspector(){return this.#n}},Cz=class{constructor(){this.store=new Map,this.get=t=>{const e=this.store.get(t.id);if(!e)throw pz(t.name);return e},this.remove=t=>{this.store.delete(t.id)},this.has=t=>this.store.has(t.id)}},wz=class{#t=null;#e=null;#r;#n="pending";constructor(t,e){this.start=()=>(this.#t??=new Promise((n,r)=>{this.#e=i=>{i instanceof CustomEvent&&i.detail.id===this.#r&&(this.#n="resolved",this.#o(),i.stopImmediatePropagation(),n())},this.#s(()=>{this.#n==="pending"&&(this.#n="rejected"),this.#o(),r(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.#r}});dispatchEvent(n)},this.#r=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)}},Ez=class{constructor(t,e=3e3){this.create=n=>new wz(n,this),this.id=Symbol(`Timer-${t}`),this.name=t,this.timeout=e}},Gi=(t,e=3e3)=>new Ez(t,e);const Az={};function pS(t,e){const n=Az,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return qT(t,r,i)}function qT(t,e,n){if(Nz(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 pE(t.children,e,n)}return Array.isArray(t)?pE(t,e,n):""}function pE(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=qT(t[i],e,n);return r.join("")}function Nz(t){return!!(t&&typeof t=="object")}const dE=document.createElement("i");function fh(t){const e="&"+t+";";dE.innerHTML=e;const n=dE.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Er(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Wr(t,e){return t.length>0?(Er(t,t.length,0,e),t):e}const mE={}.hasOwnProperty;function dS(t){const e={};let n=-1;for(;++n<t.length;)Tz(e,t[n]);return e}function Tz(t,e){let n;for(n in e){const i=(mE.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){mE.call(i,o)||(i[o]=[]);const u=s[o];Mz(i[o],Array.isArray(u)?u:u?[u]:[])}}}function Mz(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Er(t,0,0,r)}function HT(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 wi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Qa(/[A-Za-z]/),vn=Qa(/[\dA-Za-z]/),Oz=Qa(/[#-'*+\--9=?A-Z^-~]/);function Cm(t){return t!==null&&(t<32||t===127)}const Lx=Qa(/\d/),Rz=Qa(/[\dA-Fa-f]/),Dz=Qa(/[!-/:-@[-`{-~]/);function Ce(t){return t!==null&&t<-2}function We(t){return t!==null&&(t<0||t===32)}function qe(t){return t===-2||t===-1||t===32}const Sg=Qa(new RegExp("\\p{P}|\\p{S}","u")),Vn=Qa(/\s/);function Qa(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function He(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return qe(c)?(t.enter(n),u(c)):e(c)}function u(c){return qe(c)&&s++<i?(t.consume(c),u):(t.exit(n),e(c))}}const Iz={tokenize:_z};function _z(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),He(t,e,"linePrefix")}function i(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 Ce(u)?(t.consume(u),t.exit("chunkText"),s):(t.consume(u),o)}}const zz={tokenize:Lz},gE={tokenize:Bz};function Lz(t){const e=this,n=[];let r=0,i,s,o;return u;function u(P){if(r<n.length){const U=n[r];return e.containerState=U[1],t.attempt(U[0].continuation,c,h)(P)}return h(P)}function c(P){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&j();const U=e.events.length;let L=U,C;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){C=e.events[L][1].end;break}M(r);let z=U;for(;z<e.events.length;)e.events[z][1].end={...C},z++;return Er(e.events,L+1,0,e.events.slice(U)),e.events.length=z,h(P)}return u(P)}function h(P){if(r===n.length){if(!i)return y(P);if(i.currentConstruct&&i.currentConstruct.concrete)return k(P);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(gE,d,g)(P)}function d(P){return i&&j(),M(r),y(P)}function g(P){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,k(P)}function y(P){return e.containerState={},t.attempt(gE,b,k)(P)}function b(P){return r++,n.push([e.currentConstruct,e.containerState]),y(P)}function k(P){if(P===null){i&&j(),M(0),t.consume(P);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),E(P)}function E(P){if(P===null){N(t.exit("chunkFlow"),!0),M(0),t.consume(P);return}return Ce(P)?(t.consume(P),N(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(P),E)}function N(P,U){const L=e.sliceStream(P);if(U&&L.push(null),P.previous=s,s&&(s.next=P),s=P,i.defineSkip(P.start),i.write(L),e.parser.lazy[P.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const z=e.events.length;let G=z,J,K;for(;G--;)if(e.events[G][0]==="exit"&&e.events[G][1].type==="chunkFlow"){if(J){K=e.events[G][1].end;break}J=!0}for(M(r),C=z;C<e.events.length;)e.events[C][1].end={...K},C++;Er(e.events,G+1,0,e.events.slice(z)),e.events.length=C}}function M(P){let U=n.length;for(;U-- >P;){const L=n[U];e.containerState=L[1],L[0].exit.call(e,t)}n.length=P}function j(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Bz(t,e,n){return He(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Iu(t){if(t===null||We(t)||Vn(t))return 1;if(Sg(t))return 2}function vg(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Bx={name:"attention",resolveAll:Vz,tokenize:Fz};function Vz(t,e){let n=-1,r,i,s,o,u,c,h,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const g={...t[r][1].end},y={...t[n][1].start};yE(g,-c),yE(y,c),o={type:c>1?"strongSequence":"emphasisSequence",start:g,end:{...t[r][1].end}},u={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:y},s={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...u.end}},t[r][1].end={...o.start},t[n][1].start={...u.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=Wr(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Wr(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=Wr(h,vg(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Wr(h,[["exit",s,e],["enter",u,e],["exit",u,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,h=Wr(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,Er(t,r-1,n-r+3,h),n=r+h.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function Fz(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Iu(r);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"),d=Iu(c),g=!d||d===2&&i||n.includes(c),y=!i||i===2&&d||n.includes(r);return h._open=!!(s===42?g:g&&(i||!y)),h._close=!!(s===42?y:y&&(d||!g)),e(c)}}function yE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Pz={name:"autolink",tokenize:jz};function jz(t,e,n){let r=0;return i;function i(b){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(b){return sn(b)?(t.consume(b),o):b===64?n(b):h(b)}function o(b){return b===43||b===45||b===46||vn(b)?(r=1,u(b)):h(b)}function u(b){return b===58?(t.consume(b),r=0,c):(b===43||b===45||b===46||vn(b))&&r++<32?(t.consume(b),u):(r=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||Cm(b)?n(b):(t.consume(b),c)}function h(b){return b===64?(t.consume(b),d):Oz(b)?(t.consume(b),h):n(b)}function d(b){return vn(b)?g(b):n(b)}function g(b){return b===46?(t.consume(b),r=0,d):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||vn(b))&&r++<63){const k=b===45?y:g;return t.consume(b),k}return n(b)}}const ju={partial:!0,tokenize:$z};function $z(t,e,n){return r;function r(s){return qe(s)?He(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ce(s)?e(s):n(s)}}const KT={continuation:{tokenize:Jz},exit:qz,name:"blockQuote",tokenize:Uz};function Uz(t,e,n){const r=this;return i;function i(o){if(o===62){const u=r.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 qe(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function Jz(t,e,n){const r=this;return i;function i(o){return qe(o)?He(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(KT,e,n)(o)}}function qz(t){t.exit("blockQuote")}const GT={name:"characterEscape",tokenize:Hz};function Hz(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return Dz(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const YT={name:"characterReference",tokenize:Kz};function Kz(t,e,n){const r=this;let i=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=vn,d(g))}function h(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=Rz,d):(t.enter("characterReferenceValue"),s=7,o=Lx,d(g))}function d(g){if(g===59&&i){const y=t.exit("characterReferenceValue");return o===vn&&!fh(r.sliceSerialize(y))?n(g):(t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(g)&&i++<s?(t.consume(g),d):n(g)}}const xE={partial:!0,tokenize:Yz},bE={concrete:!0,name:"codeFenced",tokenize:Gz};function Gz(t,e,n){const r=this,i={partial:!0,tokenize:L};let s=0,o=0,u;return c;function c(C){return h(C)}function h(C){const z=r.events[r.events.length-1];return s=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,u=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===u?(o++,t.consume(C),d):o<3?n(C):(t.exit("codeFencedFenceSequence"),qe(C)?He(t,g,"whitespace")(C):g(C))}function g(C){return C===null||Ce(C)?(t.exit("codeFencedFence"),r.interrupt?e(C):t.check(xE,E,U)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||Ce(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(C)):qe(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),He(t,b,"whitespace")(C)):C===96&&C===u?n(C):(t.consume(C),y)}function b(C){return C===null||Ce(C)?g(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),k(C))}function k(C){return C===null||Ce(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(C)):C===96&&C===u?n(C):(t.consume(C),k)}function E(C){return t.attempt(i,U,N)(C)}function N(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),M}function M(C){return s>0&&qe(C)?He(t,j,"linePrefix",s+1)(C):j(C)}function j(C){return C===null||Ce(C)?t.check(xE,E,U)(C):(t.enter("codeFlowValue"),P(C))}function P(C){return C===null||Ce(C)?(t.exit("codeFlowValue"),j(C)):(t.consume(C),P)}function U(C){return t.exit("codeFenced"),e(C)}function L(C,z,G){let J=0;return K;function K(Y){return C.enter("lineEnding"),C.consume(Y),C.exit("lineEnding"),de}function de(Y){return C.enter("codeFencedFence"),qe(Y)?He(C,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):ce(Y)}function ce(Y){return Y===u?(C.enter("codeFencedFenceSequence"),Se(Y)):G(Y)}function Se(Y){return Y===u?(J++,C.consume(Y),Se):J>=o?(C.exit("codeFencedFenceSequence"),qe(Y)?He(C,Re,"whitespace")(Y):Re(Y)):G(Y)}function Re(Y){return Y===null||Ce(Y)?(C.exit("codeFencedFence"),z(Y)):G(Y)}}}function Yz(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const a1={name:"codeIndented",tokenize:Wz},Qz={partial:!0,tokenize:Xz};function Wz(t,e,n){const r=this;return i;function i(h){return t.enter("codeIndented"),He(t,s,"linePrefix",5)(h)}function s(h){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(h):n(h)}function o(h){return h===null?c(h):Ce(h)?t.attempt(Qz,o,c)(h):(t.enter("codeFlowValue"),u(h))}function u(h){return h===null||Ce(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),u)}function c(h){return t.exit("codeIndented"),e(h)}}function Xz(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ce(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):He(t,s,"linePrefix",5)(o)}function s(o){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(o):Ce(o)?i(o):n(o)}}const Zz={name:"codeText",previous:tL,resolve:eL,tokenize:nL};function eL(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function tL(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function nL(t,e,n){let r=0,i,s;return o;function o(g){return t.enter("codeText"),t.enter("codeTextSequence"),u(g)}function u(g){return g===96?(t.consume(g),r++,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"),i=0,d(g)):Ce(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||Ce(g)?(t.exit("codeTextData"),c(g)):(t.consume(g),h)}function d(g){return g===96?(t.consume(g),i++,d):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(g)):(s.type="codeTextData",h(g))}}class rL{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 r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Yc(this.left,r),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),Yc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Yc(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);Yc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Yc(this.left,n.reverse())}}}function Yc(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 QT(t){const e={};let n=-1,r,i,s,o,u,c,h;const d=new rL(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(e,iL(d,n)),n=e[n],h=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},u=d.slice(i,n),u.unshift(r),d.splice(i,n-i+1,u))}}return Er(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!h}function iL(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const u=o.events,c=[],h={};let d,g,y=-1,b=n,k=0,E=0;const N=[E];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(d=r.sliceStream(b),b.next||d.push(null),g&&o.defineSkip(b.start),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),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,N.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):N.pop(),y=N.length;y--;){const M=u.slice(N[y],N[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[k+c[y][0]]=k+c[y][1],k+=c[y][1]-c[y][0]-1;return h}const sL={resolve:oL,tokenize:lL},aL={partial:!0,tokenize:uL};function oL(t){return QT(t),t}function lL(t,e){let n;return r;function r(u){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?s(u):Ce(u)?t.check(aL,o,s)(u):(t.consume(u),i)}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,i}}function uL(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),He(t,s,"linePrefix")}function s(o){if(o===null||Ce(o))return n(o);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function WT(t,e,n,r,i,s,o,u,c){const h=c||Number.POSITIVE_INFINITY;let d=0;return g;function g(M){return M===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(M),t.exit(s),y):M===null||M===32||M===41||Cm(M)?n(M):(t.enter(r),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(i),t.exit(r),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||Ce(M)?n(M):(t.consume(M),M===92?k:b)}function k(M){return M===60||M===62||M===92?(t.consume(M),b):b(M)}function E(M){return!d&&(M===null||M===41||We(M))?(t.exit("chunkString"),t.exit(u),t.exit(o),t.exit(r),e(M)):d<h&&M===40?(t.consume(M),d++,E):M===41?(t.consume(M),d--,E):M===null||M===32||M===40||Cm(M)?n(M):(t.consume(M),M===92?N:E)}function N(M){return M===40||M===41||M===92?(t.consume(M),E):E(M)}}function XT(t,e,n,r,i,s){const o=this;let u=0,c;return h;function h(b){return t.enter(r),t.enter(i),t.consume(b),t.exit(i),t.enter(s),d}function d(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(i),t.consume(b),t.exit(i),t.exit(r),e):Ce(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||Ce(b)||u++>999?(t.exit("chunkString"),d(b)):(t.consume(b),c||(c=!qe(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(t.consume(b),u++,g):g(b)}}function ZT(t,e,n,r,i,s){let o;return u;function u(y){return y===34||y===39||y===40?(t.enter(r),t.enter(i),t.consume(y),t.exit(i),o=y===40?41:y,c):n(y)}function c(y){return y===o?(t.enter(i),t.consume(y),t.exit(i),t.exit(r),e):(t.enter(s),h(y))}function h(y){return y===o?(t.exit(s),c(o)):y===null?n(y):Ce(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),He(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===o||y===null||Ce(y)?(t.exit("chunkString"),h(y)):(t.consume(y),y===92?g:d)}function g(y){return y===o||y===92?(t.consume(y),d):d(y)}}function Ts(t,e){let n;return r;function r(i){return Ce(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):qe(i)?He(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const cL={name:"definition",tokenize:hL},fL={partial:!0,tokenize:pL};function hL(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),o(b)}function o(b){return XT.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return i=wi(r.sliceSerialize(r.events[r.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 We(b)?Ts(t,h)(b):h(b)}function h(b){return WT(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function d(b){return t.attempt(fL,g,g)(b)}function g(b){return qe(b)?He(t,y,"whitespace")(b):y(b)}function y(b){return b===null||Ce(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function pL(t,e,n){return r;function r(u){return We(u)?Ts(t,i)(u):n(u)}function i(u){return ZT(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return qe(u)?He(t,o,"whitespace")(u):o(u)}function o(u){return u===null||Ce(u)?e(u):n(u)}}const dL={name:"hardBreakEscape",tokenize:mL};function mL(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Ce(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const gL={name:"headingAtx",resolve:yL,tokenize:xL};function yL(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Er(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function xL(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(t.consume(d),o):d===null||We(d)?(t.exit("atxHeadingSequence"),u(d)):n(d)}function u(d){return d===35?(t.enter("atxHeadingSequence"),c(d)):d===null||Ce(d)?(t.exit("atxHeading"),e(d)):qe(d)?He(t,u,"whitespace")(d):(t.enter("atxHeadingText"),h(d))}function c(d){return d===35?(t.consume(d),c):(t.exit("atxHeadingSequence"),u(d))}function h(d){return d===null||d===35||We(d)?(t.exit("atxHeadingText"),u(d)):(t.consume(d),h)}}const bL=["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"],SE=["pre","script","style","textarea"],SL={concrete:!0,name:"htmlFlow",resolveTo:CL,tokenize:wL},vL={partial:!0,tokenize:AL},kL={partial:!0,tokenize:EL};function CL(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 wL(t,e,n){const r=this;let i,s,o,u,c;return h;function h(V){return d(V)}function d(V){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(V),g}function g(V){return V===33?(t.consume(V),y):V===47?(t.consume(V),s=!0,E):V===63?(t.consume(V),i=3,r.interrupt?e:D):sn(V)?(t.consume(V),o=String.fromCharCode(V),N):n(V)}function y(V){return V===45?(t.consume(V),i=2,b):V===91?(t.consume(V),i=5,u=0,k):sn(V)?(t.consume(V),i=4,r.interrupt?e:D):n(V)}function b(V){return V===45?(t.consume(V),r.interrupt?e:D):n(V)}function k(V){const be="CDATA[";return V===be.charCodeAt(u++)?(t.consume(V),u===be.length?r.interrupt?e:ce:k):n(V)}function E(V){return sn(V)?(t.consume(V),o=String.fromCharCode(V),N):n(V)}function N(V){if(V===null||V===47||V===62||We(V)){const be=V===47,De=o.toLowerCase();return!be&&!s&&SE.includes(De)?(i=1,r.interrupt?e(V):ce(V)):bL.includes(o.toLowerCase())?(i=6,be?(t.consume(V),M):r.interrupt?e(V):ce(V)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):s?j(V):P(V))}return V===45||vn(V)?(t.consume(V),o+=String.fromCharCode(V),N):n(V)}function M(V){return V===62?(t.consume(V),r.interrupt?e:ce):n(V)}function j(V){return qe(V)?(t.consume(V),j):K(V)}function P(V){return V===47?(t.consume(V),K):V===58||V===95||sn(V)?(t.consume(V),U):qe(V)?(t.consume(V),P):K(V)}function U(V){return V===45||V===46||V===58||V===95||vn(V)?(t.consume(V),U):L(V)}function L(V){return V===61?(t.consume(V),C):qe(V)?(t.consume(V),L):P(V)}function C(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(t.consume(V),c=V,z):qe(V)?(t.consume(V),C):G(V)}function z(V){return V===c?(t.consume(V),c=null,J):V===null||Ce(V)?n(V):(t.consume(V),z)}function G(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||We(V)?L(V):(t.consume(V),G)}function J(V){return V===47||V===62||qe(V)?P(V):n(V)}function K(V){return V===62?(t.consume(V),de):n(V)}function de(V){return V===null||Ce(V)?ce(V):qe(V)?(t.consume(V),de):n(V)}function ce(V){return V===45&&i===2?(t.consume(V),W):V===60&&i===1?(t.consume(V),ue):V===62&&i===4?(t.consume(V),F):V===63&&i===3?(t.consume(V),D):V===93&&i===5?(t.consume(V),ze):Ce(V)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(vL,ee,Se)(V)):V===null||Ce(V)?(t.exit("htmlFlowData"),Se(V)):(t.consume(V),ce)}function Se(V){return t.check(kL,Re,ee)(V)}function Re(V){return t.enter("lineEnding"),t.consume(V),t.exit("lineEnding"),Y}function Y(V){return V===null||Ce(V)?Se(V):(t.enter("htmlFlowData"),ce(V))}function W(V){return V===45?(t.consume(V),D):ce(V)}function ue(V){return V===47?(t.consume(V),o="",ke):ce(V)}function ke(V){if(V===62){const be=o.toLowerCase();return SE.includes(be)?(t.consume(V),F):ce(V)}return sn(V)&&o.length<8?(t.consume(V),o+=String.fromCharCode(V),ke):ce(V)}function ze(V){return V===93?(t.consume(V),D):ce(V)}function D(V){return V===62?(t.consume(V),F):V===45&&i===2?(t.consume(V),D):ce(V)}function F(V){return V===null||Ce(V)?(t.exit("htmlFlowData"),ee(V)):(t.consume(V),F)}function ee(V){return t.exit("htmlFlow"),e(V)}}function EL(t,e,n){const r=this;return i;function i(o){return Ce(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function AL(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(ju,e,n)}}const NL={name:"htmlText",tokenize:TL};function TL(t,e,n){const r=this;let i,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),L):D===63?(t.consume(D),P):sn(D)?(t.consume(D),G):n(D)}function h(D){return D===45?(t.consume(D),d):D===91?(t.consume(D),s=0,k):sn(D)?(t.consume(D),j):n(D)}function d(D){return D===45?(t.consume(D),b):n(D)}function g(D){return D===null?n(D):D===45?(t.consume(D),y):Ce(D)?(o=g,ue(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 k(D){const F="CDATA[";return D===F.charCodeAt(s++)?(t.consume(D),s===F.length?E:k):n(D)}function E(D){return D===null?n(D):D===93?(t.consume(D),N):Ce(D)?(o=E,ue(D)):(t.consume(D),E)}function N(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):Ce(D)?(o=j,ue(D)):(t.consume(D),j)}function P(D){return D===null?n(D):D===63?(t.consume(D),U):Ce(D)?(o=P,ue(D)):(t.consume(D),P)}function U(D){return D===62?W(D):P(D)}function L(D){return sn(D)?(t.consume(D),C):n(D)}function C(D){return D===45||vn(D)?(t.consume(D),C):z(D)}function z(D){return Ce(D)?(o=z,ue(D)):qe(D)?(t.consume(D),z):W(D)}function G(D){return D===45||vn(D)?(t.consume(D),G):D===47||D===62||We(D)?J(D):n(D)}function J(D){return D===47?(t.consume(D),W):D===58||D===95||sn(D)?(t.consume(D),K):Ce(D)?(o=J,ue(D)):qe(D)?(t.consume(D),J):W(D)}function K(D){return D===45||D===46||D===58||D===95||vn(D)?(t.consume(D),K):de(D)}function de(D){return D===61?(t.consume(D),ce):Ce(D)?(o=de,ue(D)):qe(D)?(t.consume(D),de):J(D)}function ce(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(t.consume(D),i=D,Se):Ce(D)?(o=ce,ue(D)):qe(D)?(t.consume(D),ce):(t.consume(D),Re)}function Se(D){return D===i?(t.consume(D),i=void 0,Y):D===null?n(D):Ce(D)?(o=Se,ue(D)):(t.consume(D),Se)}function Re(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||We(D)?J(D):(t.consume(D),Re)}function Y(D){return D===47||D===62||We(D)?J(D):n(D)}function W(D){return D===62?(t.consume(D),t.exit("htmlTextData"),t.exit("htmlText"),e):n(D)}function ue(D){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),ke}function ke(D){return qe(D)?He(t,ze,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ze(D)}function ze(D){return t.enter("htmlTextData"),o(D)}}const mS={name:"labelEnd",resolveAll:DL,resolveTo:IL,tokenize:_L},ML={tokenize:zL},OL={tokenize:LL},RL={tokenize:BL};function DL(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Er(t,0,t.length,n),t}function IL(t,e){let n=t.length,r=0,i,s,o,u;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.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}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return u=[["enter",c,e],["enter",h,e]],u=Wr(u,t.slice(s+1,s+r+3)),u=Wr(u,[["enter",d,e]]),u=Wr(u,vg(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),u=Wr(u,[["exit",d,e],t[o-2],t[o-1],["exit",h,e]]),u=Wr(u,t.slice(o+1)),u=Wr(u,[["exit",c,e]]),Er(t,s,t.length,u),t}function _L(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return u;function u(y){return s?s._inactive?g(y):(o=r.parser.defined.includes(wi(r.sliceSerialize({start:s.end,end:r.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(ML,d,o?d:g)(y):y===91?t.attempt(OL,d,o?h:g)(y):o?d(y):g(y)}function h(y){return t.attempt(RL,d,g)(y)}function d(y){return e(y)}function g(y){return s._balanced=!0,n(y)}}function zL(t,e,n){return r;function r(g){return t.enter("resource"),t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),i}function i(g){return We(g)?Ts(t,s)(g):s(g)}function s(g){return g===41?d(g):WT(t,o,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function o(g){return We(g)?Ts(t,c)(g):d(g)}function u(g){return n(g)}function c(g){return g===34||g===39||g===40?ZT(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):d(g)}function h(g){return We(g)?Ts(t,d)(g):d(g)}function d(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),e):n(g)}}function LL(t,e,n){const r=this;return i;function i(u){return XT.call(r,t,s,o,"reference","referenceMarker","referenceString")(u)}function s(u){return r.parser.defined.includes(wi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function o(u){return n(u)}}function BL(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const VL={name:"labelStartImage",resolveAll:mS.resolveAll,tokenize:FL};function FL(t,e,n){const r=this;return i;function i(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 r.parser.constructs?n(u):e(u)}}const PL={name:"labelStartLink",resolveAll:mS.resolveAll,tokenize:jL};function jL(t,e,n){const r=this;return i;function i(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 r.parser.constructs?n(o):e(o)}}const o1={name:"lineEnding",tokenize:$L};function $L(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),He(t,e,"linePrefix")}}const Pd={name:"thematicBreak",tokenize:UL};function UL(t,e,n){let r=0,i;return s;function s(h){return t.enter("thematicBreak"),o(h)}function o(h){return i=h,u(h)}function u(h){return h===i?(t.enter("thematicBreakSequence"),c(h)):r>=3&&(h===null||Ce(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===i?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),qe(h)?He(t,u,"whitespace")(h):u(h))}}const lr={continuation:{tokenize:KL},exit:YL,name:"list",tokenize:HL},JL={partial:!0,tokenize:QL},qL={partial:!0,tokenize:GL};function HL(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return u;function u(b){const k=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Lx(b)){if(r.containerState.type||(r.containerState.type=k,t.enter(k,{_container:!0})),k==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(Pd,n,h)(b):h(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(b)}return n(b)}function c(b){return Lx(b)&&++o<10?(t.consume(b),c):(!r.interrupt||o<2)&&(r.containerState.marker?b===r.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"),r.containerState.marker=r.containerState.marker||b,t.check(ju,r.interrupt?n:d,t.attempt(JL,y,g))}function d(b){return r.containerState.initialBlankLine=!0,s++,y(b)}function g(b){return qe(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(b)}}function KL(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(ju,i,s);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(t,e,"listItemIndent",r.containerState.size+1)(u)}function s(u){return r.containerState.furtherBlankLines||!qe(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(qL,e,o)(u))}function o(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(t,t.attempt(lr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function GL(t,e,n){const r=this;return He(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function YL(t){t.exit(this.containerState.type)}function QL(t,e,n){const r=this;return He(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!qe(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const vE={name:"setextUnderline",resolveTo:WL,tokenize:XL};function WL(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=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[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function XL(t,e,n){const r=this;let i;return s;function s(h){let d=r.events.length,g;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){g=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(t.enter("setextHeadingLine"),i=h,o(h)):n(h)}function o(h){return t.enter("setextHeadingLineSequence"),u(h)}function u(h){return h===i?(t.consume(h),u):(t.exit("setextHeadingLineSequence"),qe(h)?He(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||Ce(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const ZL={tokenize:e5};function e5(t){const e=this,n=t.attempt(ju,r,t.attempt(this.parser.constructs.flowInitial,i,He(t,t.attempt(this.parser.constructs.flow,i,t.attempt(sL,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const t5={resolveAll:tM()},n5=eM("string"),r5=eM("text");function eM(t){return{resolveAll:tM(t==="text"?i5:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,u);return o;function o(d){return h(d)?s(d):u(d)}function u(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return h(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function h(d){if(d===null)return!0;const g=i[d];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function tM(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function i5(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 r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,u=0,c;for(;s--;){const h=i[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:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(t.splice(n,0,["enter",h,e],["exit",h,e]),n+=2)}n++}return t}const s5={42:lr,43:lr,45:lr,48:lr,49:lr,50:lr,51:lr,52:lr,53:lr,54:lr,55:lr,56:lr,57:lr,62:KT},a5={91:cL},o5={[-2]:a1,[-1]:a1,32:a1},l5={35:gL,42:Pd,45:[vE,Pd],60:SL,61:vE,95:Pd,96:bE,126:bE},u5={38:YT,92:GT},c5={[-5]:o1,[-4]:o1,[-3]:o1,33:VL,38:YT,42:Bx,60:[Pz,NL],91:PL,92:[dL,GT],93:mS,95:Bx,96:Zz},f5={null:[Bx,t5]},h5={null:[42,95]},p5={null:[]},d5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:h5,contentInitial:a5,disable:p5,document:s5,flow:l5,flowInitial:o5,insideSpan:f5,string:u5,text:c5},Symbol.toStringTag,{value:"Module"}));function m5(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],u=[];const c={attempt:z(L),check:z(C),consume:j,enter:P,exit:U,interrupt:z(C,{interrupt:!0})},h={code:null,containerState:{},defineSkip:E,events:[],now:k,parser:t,previous:null,sliceSerialize:y,sliceStream:b,write:g};let d=e.tokenize.call(h,c);return e.resolveAll&&s.push(e),h;function g(de){return o=Wr(o,de),N(),o[o.length-1]!==null?[]:(G(e,0),h.events=vg(s,h.events,h),h.events)}function y(de,ce){return y5(b(de),ce)}function b(de){return g5(o,de)}function k(){const{_bufferIndex:de,_index:ce,line:Se,column:Re,offset:Y}=r;return{_bufferIndex:de,_index:ce,line:Se,column:Re,offset:Y}}function E(de){i[de.line]=de.column,K()}function N(){let de;for(;r._index<o.length;){const ce=o[r._index];if(typeof ce=="string")for(de=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===de&&r._bufferIndex<ce.length;)M(ce.charCodeAt(r._bufferIndex));else M(ce)}}function M(de){d=d(de)}function j(de){Ce(de)?(r.line++,r.column=1,r.offset+=de===-3?2:1,K()):de!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=de}function P(de,ce){const Se=ce||{};return Se.type=de,Se.start=k(),h.events.push(["enter",Se,h]),u.push(Se),Se}function U(de){const ce=u.pop();return ce.end=k(),h.events.push(["exit",ce,h]),ce}function L(de,ce){G(de,ce.from)}function C(de,ce){ce.restore()}function z(de,ce){return Se;function Se(Re,Y,W){let ue,ke,ze,D;return Array.isArray(Re)?ee(Re):"tokenize"in Re?ee([Re]):F(Re);function F(Me){return Xe;function Xe(Ct){const Ze=Ct!==null&&Me[Ct],zt=Ct!==null&&Me.null,Lt=[...Array.isArray(Ze)?Ze:Ze?[Ze]:[],...Array.isArray(zt)?zt:zt?[zt]:[]];return ee(Lt)(Ct)}}function ee(Me){return ue=Me,ke=0,Me.length===0?W:V(Me[ke])}function V(Me){return Xe;function Xe(Ct){return D=J(),ze=Me,Me.partial||(h.currentConstruct=Me),Me.name&&h.parser.constructs.disable.null.includes(Me.name)?De():Me.tokenize.call(ce?Object.assign(Object.create(h),ce):h,c,be,De)(Ct)}}function be(Me){return de(ze,D),Y}function De(Me){return D.restore(),++ke<ue.length?V(ue[ke]):W}}}function G(de,ce){de.resolveAll&&!s.includes(de)&&s.push(de),de.resolve&&Er(h.events,ce,h.events.length-ce,de.resolve(h.events.slice(ce),h)),de.resolveTo&&(h.events=de.resolveTo(h.events,h))}function J(){const de=k(),ce=h.previous,Se=h.currentConstruct,Re=h.events.length,Y=Array.from(u);return{from:Re,restore:W};function W(){r=de,h.previous=ce,h.currentConstruct=Se,h.events.length=Re,u=Y,K()}}function K(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function g5(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const u=o[0];typeof u=="string"?o[0]=u.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function y5(t,e){let n=-1;const r=[];let i;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&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function x5(t){const r={constructs:dS([d5,...(t||{}).extensions||[]]),content:i(Iz),defined:[],document:i(zz),flow:i(ZL),lazy:{},string:i(n5),text:i(r5)};return r;function i(s){return o;function o(u){return m5(r,s,u)}}}function b5(t){for(;!QT(t););return t}const kE=/[\0\t\n\r]/g;function S5(){let t=1,e="",n=!0,r;return i;function i(s,o,u){const c=[];let h,d,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(kE.lastIndex=g,h=kE.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&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),g<y&&(c.push(s.slice(g,y)),t+=y-g),b){case 0:{c.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,c.push(-2);t++<d;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}g=y+1}return u&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const v5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nM(t){return t.replace(v5,k5)}function k5(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return HT(n.slice(s?2:1),s?16:10)}return fh(n)||t}function Ms(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?CE(t.position):"start"in t||"end"in t?CE(t):"line"in t||"column"in t?Vx(t):""}function Vx(t){return wE(t&&t.line)+":"+wE(t&&t.column)}function CE(t){return Vx(t&&t.start)+"-"+Vx(t&&t.end)}function wE(t){return t&&typeof t=="number"?t:1}const rM={}.hasOwnProperty;function C5(t,e,n){return typeof e!="string"&&(n=e,e=void 0),w5(n)(b5(x5(n).document().write(S5()(t,e,!0))))}function w5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ci),autolinkProtocol:J,autolinkEmail:J,atxHeading:s(dr),blockQuote:s(zt),characterEscape:J,characterReference:J,codeFenced:s(Lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Lt,o),codeText:s(Oi,o),codeTextData:J,data:J,codeFlowValue:J,definition:s(ui),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Wn),hardBreakEscape:s(Or),hardBreakTrailing:s(Or),htmlFlow:s(Xn,o),htmlFlowData:J,htmlText:s(Xn,o),htmlTextData:J,image:s(mr),label:o,link:s(ci),listItem:s(Rr),listItemValue:y,listOrdered:s(Rn,g),listUnordered:s(Rn),paragraph:s(Ri),reference:V,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(dr),strong:s(Dr),thematicBreak:s(Zi)},exit:{atxHeading:c(),atxHeadingSequence:L,autolink:c(),autolinkEmail:Ze,autolinkProtocol:Ct,blockQuote:c(),characterEscapeValue:K,characterReferenceMarkerHexadecimal:De,characterReferenceMarkerNumeric:De,characterReferenceValue:Me,characterReference:Xe,codeFenced:c(N),codeFencedFence:E,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:K,codeIndented:c(M),codeText:c(Y),codeTextData:K,data:K,definition:c(),definitionDestinationString:U,definitionLabelString:j,definitionTitleString:P,emphasis:c(),hardBreakEscape:c(ce),hardBreakTrailing:c(ce),htmlFlow:c(Se),htmlFlowData:K,htmlText:c(Re),htmlTextData:K,image:c(ue),label:ze,labelText:ke,lineEnding:de,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:be,resourceDestinationString:D,resourceTitleString:F,resource:ee,setextHeading:c(G),setextHeadingLineSequence:z,setextHeadingText:C,strong:c(),thematicBreak:c()}};iM(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(le){let me={type:"root",children:[]};const _={stack:[me],tokenStack:[],config:e,enter:u,exit:h,buffer:o,resume:d,data:n},Ie=[];let Pe=-1;for(;++Pe<le.length;)if(le[Pe][1].type==="listOrdered"||le[Pe][1].type==="listUnordered")if(le[Pe][0]==="enter")Ie.push(Pe);else{const tn=Ie.pop();Pe=i(le,tn,Pe)}for(Pe=-1;++Pe<le.length;){const tn=e[le[Pe][0]];rM.call(tn,le[Pe][1].type)&&tn[le[Pe][1].type].call(Object.assign({sliceSerialize:le[Pe][2].sliceSerialize},_),le[Pe][1])}if(_.tokenStack.length>0){const tn=_.tokenStack[_.tokenStack.length-1];(tn[1]||EE).call(_,void 0,tn[0])}for(me.position={start:wa(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:wa(le.length>0?le[le.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 i(le,me,_){let Ie=me-1,Pe=-1,tn=!1,Zn,ve,_t,yn;for(;++Ie<=_;){const St=le[Ie];switch(St[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{St[0]==="enter"?Pe++:Pe--,yn=void 0;break}case"lineEndingBlank":{St[0]==="enter"&&(Zn&&!yn&&!Pe&&!_t&&(_t=Ie),yn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:yn=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(Zn){let er=Ie;for(ve=void 0;er--;){const Dn=le[er];if(Dn[1].type==="lineEnding"||Dn[1].type==="lineEndingBlank"){if(Dn[0]==="exit")continue;ve&&(le[ve][1].type="lineEndingBlank",tn=!0),Dn[1].type="lineEnding",ve=er}else if(!(Dn[1].type==="linePrefix"||Dn[1].type==="blockQuotePrefix"||Dn[1].type==="blockQuotePrefixWhitespace"||Dn[1].type==="blockQuoteMarker"||Dn[1].type==="listItemIndent"))break}_t&&(!ve||_t<ve)&&(Zn._spread=!0),Zn.end=Object.assign({},ve?le[ve][1].start:St[1].end),le.splice(ve||Ie,0,["exit",Zn,St[2]]),Ie++,_++}if(St[1].type==="listItemPrefix"){const er={type:"listItem",_spread:!1,start:Object.assign({},St[1].start),end:void 0};Zn=er,le.splice(Ie,0,["enter",er,St[2]]),Ie++,_++,_t=void 0,yn=!0}}}return le[me][1]._spread=tn,_}function s(le,me){return _;function _(Ie){u.call(this,le(Ie),Ie),me&&me.call(this,Ie)}}function o(){this.stack.push({type:"fragment",children:[]})}function u(le,me,_){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([me,_||void 0]),le.position={start:wa(me.start),end:void 0}}function c(le){return me;function me(_){le&&le.call(this,_),h.call(this,_)}}function h(le,me){const _=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==le.type&&(me?me.call(this,le,Ie[0]):(Ie[1]||EE).call(this,le,Ie[0]));else throw new Error("Cannot close `"+le.type+"` ("+Ms({start:le.start,end:le.end})+"): it’s not open");_.position.end=wa(le.end)}function d(){return pS(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),me=this.stack[this.stack.length-1];me.lang=le}function k(){const le=this.resume(),me=this.stack[this.stack.length-1];me.meta=le}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le.replace(/(\r?\n|\r)$/g,"")}function j(le){const me=this.resume(),_=this.stack[this.stack.length-1];_.label=me,_.identifier=wi(this.sliceSerialize(le)).toLowerCase()}function P(){const le=this.resume(),me=this.stack[this.stack.length-1];me.title=le}function U(){const le=this.resume(),me=this.stack[this.stack.length-1];me.url=le}function L(le){const me=this.stack[this.stack.length-1];if(!me.depth){const _=this.sliceSerialize(le).length;me.depth=_}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function z(le){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function J(le){const _=this.stack[this.stack.length-1].children;let Ie=_[_.length-1];(!Ie||Ie.type!=="text")&&(Ie=$e(),Ie.position={start:wa(le.start),end:void 0},_.push(Ie)),this.stack.push(Ie)}function K(le){const me=this.stack.pop();me.value+=this.sliceSerialize(le),me.position.end=wa(le.end)}function de(le){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _=me.children[me.children.length-1];_.position.end=wa(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(me.type)&&(J.call(this,le),K.call(this,le))}function ce(){this.data.atHardBreak=!0}function Se(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le}function Re(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le}function Y(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le}function W(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=me,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ue(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=me,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ke(le){const me=this.sliceSerialize(le),_=this.stack[this.stack.length-2];_.label=nM(me),_.identifier=wi(me).toLowerCase()}function ze(){const le=this.stack[this.stack.length-1],me=this.resume(),_=this.stack[this.stack.length-1];if(this.data.inReference=!0,_.type==="link"){const Ie=le.children;_.children=Ie}else _.alt=me}function D(){const le=this.resume(),me=this.stack[this.stack.length-1];me.url=le}function F(){const le=this.resume(),me=this.stack[this.stack.length-1];me.title=le}function ee(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function be(le){const me=this.resume(),_=this.stack[this.stack.length-1];_.label=me,_.identifier=wi(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function De(le){this.data.characterReferenceType=le.type}function Me(le){const me=this.sliceSerialize(le),_=this.data.characterReferenceType;let Ie;_?(Ie=HT(me,_==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=fh(me);const Pe=this.stack[this.stack.length-1];Pe.value+=Ie}function Xe(le){const me=this.stack.pop();me.position.end=wa(le.end)}function Ct(le){K.call(this,le);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(le)}function Ze(le){K.call(this,le);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(le)}function zt(){return{type:"blockquote",children:[]}}function Lt(){return{type:"code",lang:null,meta:null,value:""}}function Oi(){return{type:"inlineCode",value:""}}function ui(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Wn(){return{type:"emphasis",children:[]}}function dr(){return{type:"heading",depth:0,children:[]}}function Or(){return{type:"break"}}function Xn(){return{type:"html",value:""}}function mr(){return{type:"image",title:null,url:"",alt:null}}function ci(){return{type:"link",title:null,url:"",children:[]}}function Rn(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Rr(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Ri(){return{type:"paragraph",children:[]}}function Dr(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function Zi(){return{type:"thematicBreak"}}}function wa(t){return{line:t.line,column:t.column,offset:t.offset}}function iM(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?iM(t,r):E5(t,r)}}function E5(t,e){let n;for(n in e)if(rM.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function EE(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Ms({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Ms({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Ms({start:e.start,end:e.end})+") is still open")}function wm(t){const e=this;e.parser=n;function n(r){return C5(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const AE={}.hasOwnProperty;function A5(t,e){const n=e||{};function r(i,...s){let o=r.invalid;const u=r.handlers;if(i&&AE.call(i,t)){const c=String(i[t]);o=AE.call(u,c)?u[c]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const N5={}.hasOwnProperty;function sM(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)sM(t,e.extensions[n]);for(r in e)if(N5.call(e,r))switch(r){case"extensions":break;case"unsafe":{NE(t[r],e[r]);break}case"join":{NE(t[r],e[r]);break}case"handlers":{T5(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function NE(t,e){e&&t.push(...e)}function T5(t,e){e&&Object.assign(t,e)}function M5(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(t,s.current()),O5);return i(),o}function O5(t,e,n){return">"+(n?"":" ")+t}function aM(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 r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function ME(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
5
+ `&&aM(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
6
+ `}function R5(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function Fx(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 D5(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 I5(t,e,n,r){const i=D5(n),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Fx(t,n)){const g=n.enter("codeIndented"),y=n.indentLines(s,_5);return g(),y}const u=n.createTracker(r),c=i.repeat(Math.max(R5(s,i)+1,3)),h=n.enter("codeFenced");let d=u.move(c);if(t.lang){const g=n.enter(`codeFencedLang${o}`);d+=u.move(n.safe(t.lang,{before:d,after:" ",encode:["`"],...u.current()})),g()}if(t.lang&&t.meta){const g=n.enter(`codeFencedMeta${o}`);d+=u.move(" "),d+=u.move(n.safe(t.meta,{before:d,after:`
7
+ `,encode:["`"],...u.current()})),g()}return d+=u.move(`
8
+ `),s&&(d+=u.move(s+`
9
+ `)),d+=u.move(c),h(),d}function _5(t,e,n){return(n?"":" ")+t}function gS(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 z5(t,e,n,r){const i=gS(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let u=n.enter("label");const c=n.createTracker(r);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(" "+i),h+=c.move(n.safe(t.title,{before:h,after:i,...c.current()})),h+=c.move(i),u()),o(),h}function L5(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 Ua(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Em(t,e,n){const r=Iu(t),i=Iu(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}oM.peek=B5;function oM(t,e,n,r){const i=L5(n),s=n.enter("emphasis"),o=n.createTracker(r),u=o.move(i);let c=o.move(n.containerPhrasing(t,{after:i,before:u,...o.current()}));const h=c.charCodeAt(0),d=Em(r.before.charCodeAt(r.before.length-1),h,i);d.inside&&(c=Ua(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Em(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+Ua(g));const b=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:d.outside},u+c+b}function B5(t,e,n){return n.options.emphasis||"*"}const kg=(function(t){if(t==null)return j5;if(typeof t=="function")return Cg(t);if(typeof t=="object")return Array.isArray(t)?V5(t):F5(t);if(typeof t=="string")return P5(t);throw new Error("Expected function, string, or object as test")});function V5(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=kg(t[n]);return Cg(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function F5(t){const e=t;return Cg(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function P5(t){return Cg(e);function e(n){return n&&n.type===t}}function Cg(t){return e;function e(n,r,i){return!!($5(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function j5(){return!0}function $5(t){return t!==null&&typeof t=="object"&&"type"in t}const lM=[],U5=!0,Px=!1,jx="skip";function $u(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=kg(i),o=r?-1:1;u(t,void 0,[])();function u(c,h,d){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=lM,k,E,N;if((!e||s(c,h,d[d.length-1]||void 0))&&(b=J5(n(c,d)),b[0]===Px))return b;if("children"in c&&c.children){const M=c;if(M.children&&b[0]!==jx)for(E=(r?M.children.length:-1)+o,N=d.concat(M);E>-1&&E<M.children.length;){const j=M.children[E];if(k=u(j,E,N)(),k[0]===Px)return k;E=typeof k[1]=="number"?k[1]:E+o}}return b}}}function J5(t){return Array.isArray(t)?t:typeof t=="number"?[U5,t]:t==null?lM:[t]}function q5(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),$u(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return o(c,g,d)}}function uM(t,e){let n=!1;return q5(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Px}),!!((!t.depth||t.depth<3)&&pS(t)&&(e.options.setext||n))}function H5(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(uM(t,n)){const d=n.enter("headingSetext"),g=n.enter("phrasing"),y=n.containerPhrasing(t,{...s.current(),before:`
11
+ `,after:`
12
+ `});return g(),d(),y+`
13
+ `+(i===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
14
+ `))+1))}const o="#".repeat(i),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=Ua(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,n.options.closeAtx&&(h+=" "+o),c(),u(),h}cM.peek=K5;function cM(t){return t.value||""}function K5(){return"<"}fM.peek=G5;function fM(t,e,n,r){const i=gS(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);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(" "+i),h+=c.move(n.safe(t.title,{before:h,after:i,...c.current()})),h+=c.move(i),u()),h+=c.move(")"),o(),h}function G5(){return"!"}hM.peek=Y5;function hM(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const h=n.safe(t.alt,{before:c,after:"]",...u.current()});c+=u.move(h+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return o(),n.stack=d,s(),i==="full"||!h||h!==g?c+=u.move(g+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function Y5(){return"!"}pM.peek=Q5;function pM(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],u=n.compilePattern(o);let c;if(o.atBreak)for(;c=u.exec(r);){let h=c.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(c.index+1)}}return i+r+i}function Q5(){return"`"}function dM(t,e){const n=pS(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))}mM.peek=W5;function mM(t,e,n,r){const i=gS(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let u,c;if(dM(t,n)){const d=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=d,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(" "+i),h+=o.move(n.safe(t.title,{before:h,after:i,...o.current()})),h+=o.move(i),c()),h+=o.move(")"),u(),h}function W5(t,e,n){return dM(t,n)?"<":"["}gM.peek=X5;function gM(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...u.current()});c+=u.move(h+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return o(),n.stack=d,s(),i==="full"||!h||h!==g?c+=u.move(g+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function X5(){return"["}function yS(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 Z5(t){const e=yS(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 e9(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 yM(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 t9(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=t.ordered?e9(n):yS(n);const u=t.ordered?o==="."?")":".":Z5(n);let c=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const d=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.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),yM(n)===o&&d){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,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),h}function n9(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 r9(t,e,n,r){const i=n9(n);let s=n.bulletCurrent||yS(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;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const u=n.createTracker(r);u.move(s+" ".repeat(o-s.length)),u.shift(o);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,u.current()),d);return c(),h;function d(g,y,b){return y?(b?"":" ".repeat(o))+g:(b?s:s+" ".repeat(o-s.length))+g}}function i9(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,r);return s(),i(),o}const s9=kg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function a9(t,e,n,r){return(t.children.some(function(o){return s9(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function o9(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}xM.peek=l9;function xM(t,e,n,r){const i=o9(n),s=n.enter("strong"),o=n.createTracker(r),u=o.move(i+i);let c=o.move(n.containerPhrasing(t,{after:i,before:u,...o.current()}));const h=c.charCodeAt(0),d=Em(r.before.charCodeAt(r.before.length-1),h,i);d.inside&&(c=Ua(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Em(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+Ua(g));const b=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:d.outside},u+c+b}function l9(t,e,n){return n.options.strong||"*"}function u9(t,e,n,r){return n.safe(t.value,r)}function c9(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 f9(t,e,n){const r=(yM(n)+(n.options.ruleSpaces?" ":"")).repeat(c9(n));return n.options.ruleSpaces?r.slice(0,-1):r}const xS={blockquote:M5,break:ME,code:I5,definition:z5,emphasis:oM,hardBreak:ME,heading:H5,html:cM,image:fM,imageReference:hM,inlineCode:pM,link:mM,linkReference:gM,list:t9,listItem:r9,paragraph:i9,root:a9,strong:xM,text:u9,thematicBreak:f9},h9=[p9];function p9(t,e,n,r){if(e.type==="code"&&Fx(e,r)&&(t.type==="list"||t.type===e.type&&Fx(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&uM(e,r))?void 0:n.spread?1:0}const wo=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],d9=[{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:wo},{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:wo},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
18
+ *])`},{character:"*",inConstruct:"phrasing",notInConstruct:wo},{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:wo},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:wo},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:wo},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:wo},{atBreak:!0,character:"~"}];function m9(t){return t.label||!t.identifier?t.label||"":nM(t.identifier)}function g9(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 y9(t,e,n){const r=e.indexStack,i=t.children||[],s=[];let o=-1,u=n.before,c;r.push(-1);let h=e.createTracker(n);for(;++o<i.length;){const d=i[o];let g;if(r[r.length-1]=o,o+1<i.length){let k=e.handle.handlers[i[o+1].type];k&&k.peek&&(k=k.peek),g=k?k(i[o+1],t,e,{before:"",after:"",...h.current()}).charAt(0):""}else g=n.after;s.length>0&&(u==="\r"||u===`
22
+ `)&&d.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(d,t,e,{...h.current(),after:g,before:u});c&&c===y.slice(0,1)&&(y=Ua(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)+Ua(u.charCodeAt(0))),b.after&&(c=g)),h.move(y),s.push(y),u=y.slice(-1)}return r.pop(),s.join("")}function x9(t,e,n){const r=e.indexStack,i=t.children||[],s=e.createTracker(n),o=[];let u=-1;for(r.push(-1);++u<i.length;){const c=i[u];r[r.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<i.length-1&&o.push(s.move(b9(c,i[u+1],t,e)))}return r.pop(),o.join("")}function b9(t,e,n,r){let i=r.join.length;for(;i--;){const s=r.join[i](t,e,n,r);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 S9=/\r?\n|\r/g;function v9(t,e){const n=[];let r=0,i=0,s;for(;s=S9.exec(t);)o(t.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return o(t.slice(r)),n.join("");function o(u){n.push(e(u,i,!u))}}function k9(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),i=[],s=[],o={};let u=-1;for(;++u<t.unsafe.length;){const d=t.unsafe[u];if(!aM(t.stack,d))continue;const g=t.compilePattern(d);let y;for(;y=g.exec(r);){const b="before"in d||!!d.atBreak,k="after"in d,E=y.index+(b?y[1].length:0);i.includes(E)?(o[E].before&&!b&&(o[E].before=!1),o[E].after&&!k&&(o[E].after=!1)):(i.push(E),o[E]={before:b,after:k})}}i.sort(C9);let c=n.before?n.before.length:0;const h=r.length-(n.after?n.after.length:0);for(u=-1;++u<i.length;){const d=i[u];d<c||d>=h||d+1<h&&i[u+1]===d+1&&o[d].after&&!o[d+1].before&&!o[d+1].after||i[u-1]===d-1&&o[d].before&&!o[d-1].before&&!o[d-1].after||(c!==d&&s.push(OE(r.slice(c,d),"\\")),c=d,/[!-/:-@[-`{-~]/.test(r.charAt(d))&&(!n.encode||!n.encode.includes(r.charAt(d)))?s.push("\\"):(s.push(Ua(r.charCodeAt(d))),c++))}return s.push(OE(r.slice(c,h),n.after)),s.join("")}function C9(t,e){return t-e}function OE(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=t+e;let o=-1,u=0,c;for(;c=n.exec(s);)r.push(c.index);for(;++o<r.length;)u!==r[o]&&i.push(t.slice(u,r[o])),i.push("\\"),u=r[o];return i.push(t.slice(u)),i.join("")}function w9(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,i=n.line||1,s=n.column||1;return{move:c,current:o,shift:u};function o(){return{now:{line:i,column:s},lineShift:r}}function u(h){r+=h}function c(h){const d=h||"",g=d.split(/\r?\n|\r/g),y=g[g.length-1];return i+=g.length-1,s=g.length===1?s+y.length:1+y.length+r,d}}function E9(t,e){const n=e||{},r={associationId:m9,containerPhrasing:M9,containerFlow:O9,createTracker:w9,compilePattern:g9,enter:s,handlers:{...xS},handle:void 0,indentLines:v9,indexStack:[],join:[...h9],options:{},safe:R9,stack:[],unsafe:[...d9]};sM(r,n),r.options.tightDefinitions&&r.join.push(T9),r.handle=A5("type",{invalid:A9,unknown:N9,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
32
+ `,after:`
33
+ `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
34
+ `),i;function s(o){return r.stack.push(o),u;function u(){r.stack.pop()}}}function A9(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function N9(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function T9(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function M9(t,e){return y9(t,this,e)}function O9(t,e){return x9(t,this,e)}function R9(t,e){return k9(this,t,e)}function $x(t){const e=this;e.compiler=n;function n(r){return E9(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function RE(t){if(t)throw t}var l1,DE;function D9(){if(DE)return l1;DE=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=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 d=t.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!d&&!g)return!1;var y;for(y in h);return typeof y>"u"||t.call(h,y)},o=function(h,d){n&&d.name==="__proto__"?n(h,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):h[d.name]=d.newValue},u=function(h,d){if(d==="__proto__")if(t.call(h,d)){if(r)return r(h,d).value}else return;return h[d]};return l1=function c(){var h,d,g,y,b,k,E=arguments[0],N=1,M=arguments.length,j=!1;for(typeof E=="boolean"&&(j=E,E=arguments[1]||{},N=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});N<M;++N)if(h=arguments[N],h!=null)for(d in h)g=u(E,d),y=u(h,d),E!==y&&(j&&y&&(s(y)||(b=i(y)))?(b?(b=!1,k=g&&i(g)?g:[]):k=g&&s(g)?g:{},o(E,{name:d,newValue:c(j,k,y)})):typeof y<"u"&&o(E,{name:d,newValue:y}));return E},l1}var I9=D9();const u1=VT(I9);function Ux(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 _9(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);u(null,...i);function u(c,...h){const d=t[++s];let g=-1;if(c){o(c);return}for(;++g<i.length;)(h[g]===null||h[g]===void 0)&&(h[g]=i[g]);i=h,d?z9(d,u)(...h):o(null,...h)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function z9(t,e){let n;return r;function r(...o){const u=t.length>o.length;let c;u&&o.push(i);try{c=t.apply(this,o)}catch(h){const d=h;if(u&&n)throw d;return i(d)}u||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(o,...u){n||(n=!0,e(o,...u))}function s(o){i(null,o)}}class mt extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",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"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.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=i,this.line=u?u.line:void 0,this.name=Ms(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 Bi={basename:L9,dirname:B9,extname:V9,join:F9,sep:"/"};function L9(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');qh(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,u=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),u>-1&&(t.codePointAt(i)===e.codePointAt(u--)?u<0&&(r=i):(u=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function B9(t){if(qh(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function V9(t){qh(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const u=t.codePointAt(e);if(u===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),u===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function F9(...t){let e=-1,n;for(;++e<t.length;)qh(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":P9(n)}function P9(t){qh(t);const e=t.codePointAt(0)===47;let n=j9(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function j9(t,e){let n="",r=0,i=-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(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==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="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else u===46&&s>-1?s++:s=-1}return n}function qh(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const $9={cwd:U9};function U9(){return"/"}function Jx(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function J9(t){if(typeof t=="string")t=new URL(t);else if(!Jx(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 q9(t)}function q9(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const c1=["history","path","basename","stem","extname","dirname"];class H9{constructor(e){let n;e?Jx(e)?n={path:e}:typeof e=="string"||K9(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":$9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<c1.length;){const s=c1[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)c1.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Bi.basename(this.path):void 0}set basename(e){h1(e,"basename"),f1(e,"basename"),this.path=Bi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Bi.dirname(this.path):void 0}set dirname(e){IE(this.basename,"dirname"),this.path=Bi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Bi.extname(this.path):void 0}set extname(e){if(f1(e,"extname"),IE(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=Bi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Jx(e)&&(e=J9(e)),h1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Bi.basename(this.path,this.extname):void 0}set stem(e){h1(e,"stem"),f1(e,"stem"),this.path=Bi.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new mt(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function f1(t,e){if(t&&t.includes(Bi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Bi.sep+"`")}function h1(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function IE(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function K9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const G9=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),Y9={}.hasOwnProperty;class bS extends G9{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=_9()}copy(){const e=new bS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(u1(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(m1("data",this.frozen),this.namespace[e]=n,this):Y9.call(this.namespace,e)&&this.namespace[e]||void 0:e?(m1("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,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Rd(e),r=this.parser||this.Parser;return p1("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),p1("process",this.parser||this.Parser),d1("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const u=Rd(e),c=r.parse(u);r.run(c,u,function(d,g,y){if(d||!g||!y)return h(d);const b=g,k=r.stringify(b,y);W9(k)?y.value=k:y.result=k,h(d,y)});function h(d,g){d||!g?o(d):s?s(g):n(void 0,g)}}}processSync(e){let n=!1,r;return this.freeze(),p1("processSync",this.parser||this.Parser),d1("processSync",this.compiler||this.Compiler),this.process(e,i),zE("processSync","process",n),r;function i(s,o){n=!0,RE(s),r=o}}run(e,n,r){_E(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,u){const c=Rd(n);i.run(e,c,h);function h(d,g,y){const b=g||e;d?u(d):o?o(b):r(void 0,b,y)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),zE("runSync","run",r),i;function s(o,u){RE(o),i=u,r=!0}}stringify(e,n){this.freeze();const r=Rd(n),i=this.compiler||this.Compiler;return d1("stringify",i),_E(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(m1("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[d,...g]=h;c(d,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&&(i.settings=u1(!0,i.settings,h.settings))}function u(h){let d=-1;if(h!=null)if(Array.isArray(h))for(;++d<h.length;){const g=h[d];s(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function c(h,d){let g=-1,y=-1;for(;++g<r.length;)if(r[g][0]===h){y=g;break}if(y===-1)r.push([h,...d]);else if(d.length>0){let[b,...k]=d;const E=r[y][1];Ux(E)&&Ux(b)&&(b=u1(!0,E,b)),r[y]=[h,b,...k]}}}}const Am=new bS().freeze();function p1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function d1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function m1(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 _E(t){if(!Ux(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function zE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Rd(t){return Q9(t)?t:new H9(t)}function Q9(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function W9(t){return typeof t=="string"||X9(t)}function X9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function hn(t){this.content=t}hn.prototype={constructor:hn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new hn(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 hn(n)},addToStart:function(t,e){return new hn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new hn(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new hn(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=hn.from(t),t.size?new hn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=hn.from(t),t.size?new hn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=hn.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}};hn.from=function(t){if(t instanceof hn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new hn(e)};function bM(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=bM(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function SM(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),u=e.child(--s),c=o.nodeSize;if(o==u){n-=c,r-=c;continue}if(!o.sameMarkup(u))return{a:n,b:r};if(o.isText&&o.text!=u.text){let h=0,d=Math.min(o.text.length,u.text.length);for(;h<d&&o.text[o.text.length-h-1]==u.text[u.text.length-h-1];)h++,n--,r--;return{a:n,b:r}}if(o.content.size||u.content.size){let h=SM(o.content,u.content,n-1,r-1);if(h)return h}n-=c,r-=c}}class Q{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,u=0;u<n;o++){let c=this.content[o],h=u+c.nodeSize;if(h>e&&r(c,i+u,s||null,o)!==!1&&c.content.size){let d=u+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),r,i+d)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){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?i?typeof i=="function"?i(u):i:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&h||u.isTextblock)&&r&&(o?o=!1:s+=r),s+=h},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new Q(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let 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))),r.push(u),i+=u.nodeSize),o=c}return new Q(r,i)}cutByIndex(e,n){return e==n?Q.empty:e==0&&n==this.content.length?this:new Q(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new Q(i,s)}addToStart(e){return new Q([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Q(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return bM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return SM(this,e,n,r)}findIndex(e){if(e==0)return Dd(0,e);if(e==this.size)return Dd(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Dd(n+1,s):Dd(n,r);r=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 Q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Q(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Q.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Q(n||e,r)}static from(e){if(!e)return Q.empty;if(e instanceof Q)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Q([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Q.empty=new Q([],0);const g1={index:0,offset:0};function Dd(t,e){return g1.index=t,g1.offset=e,g1}function Nm(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Nm(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Nm(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class ct{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Nm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ct.none;if(e instanceof ct)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}}ct.none=[];class Ei extends Error{}class H{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=kM(this.content,e+this.openStart,n);return r&&new H(r,this.openStart,this.openEnd)}removeBetween(e,n){return new H(vM(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 r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(Q.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new H(e,r,i)}}H.empty=new H(Q.empty,0,0);function vM(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:u}=t.findIndex(n);if(i==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(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(vM(s.content,e-i-1,n-i-1)))}function kM(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=kM(o.content,e-s-1,n,o);return u&&t.replaceChild(i,o.copy(u))}function Z9(t,e,n){if(n.openStart>t.depth)throw new Ei("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ei("Inconsistent open depths");return CM(t,e,n,0)}function CM(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=CM(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,u=o.content;return $o(o,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:o,end:u}=e8(n,t);return $o(s,EM(t,o,u,e,r))}else return $o(s,Tm(t,e,r))}function wM(t,e){if(!e.type.compatibleContent(t.type))throw new Ei("Cannot join "+e.type.name+" onto "+t.type.name)}function qx(t,e,n){let r=t.node(n);return wM(r,e.node(n)),r}function jo(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 $f(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(jo(t.nodeAfter,r),s++));for(let u=s;u<o;u++)jo(i.child(u),r);e&&e.depth==n&&e.textOffset&&jo(e.nodeBefore,r)}function $o(t,e){return t.type.checkContent(e),t.copy(e)}function EM(t,e,n,r,i){let s=t.depth>i&&qx(t,e,i+1),o=r.depth>i&&qx(n,r,i+1),u=[];return $f(null,t,i,u),s&&o&&e.index(i)==n.index(i)?(wM(s,o),jo($o(s,EM(t,e,n,r,i+1)),u)):(s&&jo($o(s,Tm(t,e,i+1)),u),$f(e,n,i,u),o&&jo($o(o,Tm(n,r,i+1)),u)),$f(r,null,i,u),new Q(u)}function Tm(t,e,n){let r=[];if($f(null,t,n,r),t.depth>n){let i=qx(t,e,n+1);jo($o(i,Tm(t,e,n+1)),r)}return $f(e,null,n,r),new Q(r)}function e8(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(Q.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class hh{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ct.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let u=r;r=i,i=u}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new AM(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:u,offset:c}=o.content.findIndex(s),h=s-c;if(r.push(o,u,i+c),!h||(o=o.child(u),o.isText))break;s=h-1,i+=c+1}return new hh(n,r,s)}static resolveCached(e,n){let r=LE.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else LE.set(e,r=new t8);let i=r.elts[r.i]=hh.resolve(e,n);return r.i=(r.i+1)%n8,i}}class t8{constructor(){this.elts=[],this.i=0}}const n8=12,LE=new WeakMap;class AM{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const r8=Object.create(null);let Rs=class Hx{constructor(e,n,r,i=ct.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||Q.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Nm(this.attrs,n||e.defaultAttrs||r8)&&ct.sameSet(this.marks,r||ct.none)}copy(e=null){return e==this.content?this:new Hx(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Hx(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return H.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),u=i.start(o),h=i.node(o).content.cut(i.pos-u,s.pos-u);return new H(h,i.depth-o,s.depth-o)}replace(e,n,r){return Z9(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return hh.resolveCached(this,e)}resolveNoCache(e){return hh.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),NM(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Q.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),u=o&&o.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let c=i;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),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=ct.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ct.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=Q.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Rs.prototype.text=void 0;class Mm extends Rs{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):NM(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 Mm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Mm(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 NM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class tl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new i8(e,n);if(r.next==null)return tl.empty;let i=TM(r);r.next&&r.err("Unexpected trailing text");let s=f8(c8(i));return h8(s,r),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,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,u){let c=o.matchFragment(e,r);if(c&&(!n||c.validEnd))return Q.from(u.map(h=>h.createAndFill()));for(let h=0;h<o.next.length;h++){let{type:d,next:g}=o.next[h];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(g)==-1){i.push(g);let y=s(g,u.concat(d));if(y)return y}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let u=i;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)&&(!i.type||c.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),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(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
35
+ `)}}tl.empty=new tl(!0);class i8{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 TM(t){let e=[];do e.push(s8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function s8(t){let e=[];do e.push(a8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function a8(t){let e=u8(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=o8(t,e);else break;return e}function BE(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function o8(t,e){let n=BE(t),r=n;return t.eat(",")&&(t.next!="}"?r=BE(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function l8(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function u8(t){if(t.eat("(")){let e=TM(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=l8(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 c8(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,u,c){let h={term:c,to:u};return e[o].push(h),h}function i(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;i(h,u=n())}else if(o.type=="star"){let c=n();return r(u,c),i(s(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=n();return i(s(o.expr,u),c),i(s(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(u)].concat(s(o.expr,u));if(o.type=="range"){let c=u;for(let h=0;h<o.min;h++){let d=n();i(s(o.expr,c),d),c=d}if(o.max==-1)i(s(o.expr,c),c);else for(let h=o.min;h<o.max;h++){let d=n();r(c,d),i(s(o.expr,c),d),c=d}return[r(c)]}else{if(o.type=="name")return[r(u,void 0,o.value)];throw new Error("Unknown expr type")}}}}function MM(t,e){return e-t}function VE(t,e){let n=[];return r(e),n.sort(MM);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:u,to:c}=s[o];!u&&n.indexOf(c)==-1&&r(c)}}}function f8(t){let e=Object.create(null);return n(VE(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:u,to:c})=>{if(!u)return;let h;for(let d=0;d<i.length;d++)i[d][0]==u&&(h=i[d][1]);VE(t,c).forEach(d=>{h||i.push([u,h=[]]),h.indexOf(d)==-1&&h.push(d)})})});let s=e[r.join(",")]=new tl(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let u=i[o][1].sort(MM);s.next.push({type:i[o][0],next:e[u.join(",")]||n(u)})}return s}}function h8(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let u=0;u<i.next.length;u++){let{type:c,next:h}=i.next[u];o.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(h)==-1&&r.push(h)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function OM(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function RM(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function DM(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function IM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new d8(t,r,e[r]);return n}let Om=class _M{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=IM(e,r.attrs),this.defaultAttrs=OM(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==tl.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:RM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Rs(this,this.computeAttrs(e),Q.from(n),ct.setFrom(r))}createChecked(e=null,n,r){return n=Q.from(n),this.checkContent(n),new Rs(this,this.computeAttrs(e),n,ct.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Q.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(Q.empty,!0);return s?new Rs(this,e,n.append(s),ct.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){DM(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ct.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new _M(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function p8(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class d8{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?p8(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hh{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=IM(e,i.attrs),this.excluded=null;let s=OM(this.attrs);this.instance=s?new ct(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ct(this,RM(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Hh(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){DM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class m8{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=hn.from(e.nodes),n.marks=hn.from(e.marks||{}),this.nodes=Om.compile(this.spec.nodes,this),this.marks=Hh.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",u=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=tl.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?FE(this,u.split(" ")):u==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:FE(this,o.split(" "))}this.nodeFromJSON=i=>Rs.fromJSON(this,i),this.markFromJSON=i=>ct.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Om){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Mm(r,r.defaultAttrs,e,ct.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 FE(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let u in t.marks){let c=t.marks[u];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function g8(t){return t.tag!=null}function y8(t){return t.style!=null}class Ja{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(g8(i))this.tags.push(i);else if(y8(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new jE(this,n,!1);return r.addAll(e,ct.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new jE(this,n,!0);return r.addAll(e,ct.none,n.from,n.to),H.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(S8(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,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],u=o.style;if(!(u.indexOf(e)!=0||o.context&&!r.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 r(i){let s=i.priority==null?50:i.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,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=$E(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=$E(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ja(e,Ja.schemaRules(e)))}}const zM={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},x8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},LM={ol:!0,ul:!0},ph=1,Kx=2,Uf=4;function PE(t,e,n){return e!=null?(e?ph:0)|(e==="full"?Kx:0):t&&t.whitespace=="pre"?ph|Kx:n&~Uf}class Id{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ct.none,this.match=s||(o&Uf?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Q.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ph)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=Q.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Q.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&&!zM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class jE{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=PE(null,n.preserveWhitespace,0)|(r?Uf:0);i?s=new Id(i.type,i.attrs,ct.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Id(null,null,ct.none,!0,null,o):s=new Id(e.schema.topNodeType,null,ct.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 r=e.nodeValue,i=this.top,s=i.options&Kx?"full":this.localPreserveWS||(i.options&ph)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
36
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let u=r.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]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let u=i.content[i.content.length-1],c=e.previousSibling;(!u||c&&c.nodeName=="BR"||u.isText&&/[ \t\r\n\u000c]$/.test(u.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),u;LM.hasOwnProperty(o)&&this.parser.normalizeLists&&b8(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(c?c.ignore:x8.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,d=this.needsBlock;if(zM.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=d}else{let h=this.readStyles(e,n);h&&this.addElementByRule(e,c,h,c.consuming===!1?u:void 0)}this.localPreserveWS=i}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 r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.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,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(o,n.attrs||null,r,n.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let u=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!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,r),this.findAround(e,c,!1)}s&&this.sync(u)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];o!=u;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,u=0;o>=0;o--){let c=this.nodes[o],h=c.findWrapping(e);if(h&&(!i||i.length>h.length+u)&&(i=h,s=c,!h.length))break;if(c.solid){if(r)break;u+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=ct.none;for(let u of i.concat(e.marks))(s.type?s.type.allowsMarkType(u.type):UE(u.type,e.type))&&(o=u.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!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&Uf&&o.content.length==0&&(u|=Uf);let c=ct.none;return r=r.filter(h=>(o.type?o.type.allowsMarkType(h.type):UE(h.type,e))?(c=h.addToSet(c),!1):!0),this.nodes.push(new Id(e,n,c,i,null,u)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ph)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?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 d=c>0||c==0&&i?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!d||d.name!=h&&!d.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 r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function b8(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&LM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function S8(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function $E(t){let e={};for(let n in t)e[n]=t[n];return e}function UE(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=u=>{s.push(u);for(let c=0;c<u.edgeCount;c++){let{type:h,next:d}=u.edge(c);if(h==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class Yi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=y1(n).createDocumentFragment());let i=r,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;)i=s.pop()[1];for(;c<o.marks.length;){let h=o.marks[c++],d=this.serializeMark(h,o.isInline,n);d&&(s.push([h,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=jd(y1(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&jd(y1(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return jd(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Yi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=JE(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return JE(e.marks)}}function JE(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function y1(t){return t.document||window.document}const qE=new WeakMap;function v8(t){let e=qE.get(t);return e===void 0&&qE.set(t,e=k8(t)),e}function k8(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function jd(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=v8(r))&&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=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let u,c=n?t.createElementNS(n,i):t.createElement(i),h=e[1],d=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){d=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=d;g<e.length;g++){let y=e[g];if(y===0){if(g<e.length-1||g>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:b,contentDOM:k}=jd(t,y,n,r);if(c.appendChild(b),k){if(u)throw new RangeError("Multiple content holes");u=k}}}return{dom:c,contentDOM:u}}const BM=65535,VM=Math.pow(2,16);function C8(t,e){return t+e*VM}function HE(t){return t&BM}function w8(t){return(t-(t&BM))/VM}const FM=1,PM=2,$d=4,jM=8;let KE=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&jM)>0}get deletedBefore(){return(this.delInfo&(FM|$d))>0}get deletedAfter(){return(this.delInfo&(PM|$d))>0}get deletedAcross(){return(this.delInfo&$d)>0}},nl=class cu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&cu.empty)return cu.empty}recover(e){let n=0,r=HE(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+w8(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,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],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:C8(u/3,e-c),E=e==c?PM:e==g?FM:$d;return(n<0?e!=c:e!=g)&&(E|=jM),new KE(b,E,k)}i+=d-h}return r?e+i:new KE(e+i,0,null)}touches(e,n){let r=0,i=HE(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new cu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?cu.empty:new cu(e<0?[0,-e,0]:[0,0,e])}};nl.empty=new nl([]);const x1=Object.create(null);let Cn=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 r=x1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in x1)throw new RangeError("Duplicate use of step JSON ID "+e);return x1[e]=n,n.prototype.jsonID=e,n}},Fn=class nf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nf(e,null)}static fail(e){return new nf(null,e)}static fromReplace(e,n,r,i){try{return nf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return nf.fail(s.message);throw s}}};function SS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(SS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}let $M=class rf extends Cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(SS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Fn.fromReplace(e,this.from,this.to,s)}invert(){return new UM(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new rf(n.pos,r.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:"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 rf(n.from,n.to,e.markFromJSON(n.mark))}};Cn.jsonID("addMark",$M);let UM=class sf extends Cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(SS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Fn.fromReplace(e,this.from,this.to,r)}invert(){return new $M(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sf(n.pos,r.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:"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 sf(n.from,n.to,e.markFromJSON(n.mark))}};Cn.jsonID("removeMark",UM);let JM=class af 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 r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Fn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new af(this.pos,n.marks[i]);return new af(this.pos,this.mark)}}return new qM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new af(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 af(n.pos,e.markFromJSON(n.mark))}};Cn.jsonID("addNodeMark",JM);let qM=class Gx 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 r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Fn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new JM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Gx(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 Gx(n.pos,e.markFromJSON(n.mark))}};Cn.jsonID("removeNodeMark",qM);let wg=class Ao extends Cn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Yx(e,this.from,this.to)?Fn.fail("Structure replace would overwrite content"):Fn.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 Ao(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ao(n.pos,Math.max(n.pos,r.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)}};Cn.jsonID("replace",wg);let Rm=class Ud extends Cn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Yx(e,this.from,this.gapFrom)||Yx(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 r=this.slice.insertAt(this.insert,n.content);return r?Fn.fromReplace(e,this.from,this.to,r):Fn.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 Ud(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Ud(n.pos,r.pos,i,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 Ud(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Cn.jsonID("replaceAround",Rm);function Yx(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function E8(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function vS(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),u=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(u,c,n))return r;if(r==0||o.type.spec.isolating||!E8(o,u,c))break;u&&(i=1),c<o.childCount&&(s=1)}return null}function A8(t,e,n=null,r=t){let i=N8(t,e),s=i&&T8(r,e);return s?i.map(GE).concat({type:e,attrs:n}).concat(s.map(GE)):null}function GE(t){return{type:t,attrs:null}}function N8(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function T8(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}function Jd(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,d=n-2;h>s;h--,d--){let g=i.node(h),y=i.index(h);if(g.type.spec.isolating)return!1;let b=g.content.cutByIndex(y,g.childCount),k=r&&r[d+1];k&&(b=b.replaceChild(0,k.type.create(k.attrs)));let E=r&&r[d]||g;if(!g.canReplace(y+1,g.childCount)||!E.type.validContent(b))return!1}let u=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(u,u,c?c.type:i.node(s+1).type)}function HM(t,e){let n=t.resolve(e),r=n.index();return O8(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function M8(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function O8(t,e){return!!(t&&e&&!t.isLeaf&&M8(t,e))}function kS(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return R8(i,s,r)?new wg(e,n,r):new D8(i,s,r).fit()}function R8(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let D8=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Q.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Q.from(e.node(i).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,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,u=i.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new Rm(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new wg(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=b1(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],d,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(Q.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(d=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:d};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=b1(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=b1(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new H(of(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new H(of(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,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=r?r.content:o.content,c=o.openStart-e,h=0,d=[],{match:g,type:y}=this.frontier[n];if(i){for(let E=0;E<i.childCount;E++)d.push(i.child(E));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let E=u.child(h),N=g.matchType(E.type);if(!N)break;h++,(h>1||c==0||E.content.size)&&(g=N,d.push(KM(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?b:-1)))}let k=h==u.childCount;k||(b=-1),this.placed=lf(this.placed,n,Q.from(d)),this.frontier[n].match=g,k&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,N=u;E<b;E++){let M=N.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),N=M.content}this.unplaced=k?e==0?H.empty:new H(of(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(of(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||!S1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=S1(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=S1(e,u,h,c,!0);if(!d||d.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=lf(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=lf(this.placed,this.depth,Q.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Q.empty,!0);n.childCount&&(this.placed=lf(this.placed,this.frontier.length,n))}};function of(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(of(t.firstChild.content,e-1,n)))}function lf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(lf(t.lastChild.content,e-1,n)))}function b1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function KM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,KM(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Q.empty,!0)))),t.copy(r)}function S1(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,o);return u&&!I8(n,s.content,o)?u:null}function I8(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}let _8=class qd extends Cn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Fn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return nl.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)}};Cn.jsonID("attr",_8);let z8=class Qx extends Cn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Fn.ok(r)}getMap(){return nl.empty}invert(e){return new Qx(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 Qx(n.attr,n.value)}};Cn.jsonID("docAttr",z8);let dh=class extends Error{};dh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};dh.prototype=Object.create(Error.prototype);dh.prototype.constructor=dh;dh.prototype.name="TransformError";const GM=65535,YM=Math.pow(2,16);function L8(t,e){return t+e*YM}function YE(t){return t&GM}function B8(t){return(t-(t&GM))/YM}const QM=1,WM=2,Hd=4,XM=8;let Wx=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&XM)>0}get deletedBefore(){return(this.delInfo&(QM|Hd))>0}get deletedAfter(){return(this.delInfo&(WM|Hd))>0}get deletedAcross(){return(this.delInfo&Hd)>0}},rl=class fu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&fu.empty)return fu.empty}recover(e){let n=0,r=YE(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+B8(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,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],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:L8(u/3,e-c),E=e==c?WM:e==g?QM:Hd;return(n<0?e!=c:e!=g)&&(E|=XM),new Wx(b,E,k)}i+=d-h}return r?e+i:new Wx(e+i,0,null)}touches(e,n){let r=0,i=YE(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new fu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?fu.empty:new fu(e<0?[0,-e,0]:[0,0,e])}};rl.empty=new rl([]);let V8=class Xx{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Xx(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,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Xx;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let 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}}i|=u.delInfo,e=u.pos}return r?e:new Wx(e,i,null)}};const v1=Object.create(null);let wn=class{getMap(){return rl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=v1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in v1)throw new RangeError("Duplicate use of step JSON ID "+e);return v1[e]=n,n.prototype.jsonID=e,n}},Pn=class uf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new uf(e,null)}static fail(e){return new uf(null,e)}static fromReplace(e,n,r,i){try{return uf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return uf.fail(s.message);throw s}}};function CS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(CS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}let wS=class cf extends wn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(CS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,s)}invert(){return new Kh(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new cf(n.pos,r.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:"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 cf(n.from,n.to,e.markFromJSON(n.mark))}};wn.jsonID("addMark",wS);let Kh=class ff extends wn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(CS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,r)}invert(){return new wS(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ff(n.pos,r.pos,this.mark)}merge(e){return e instanceof ff&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ff(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 ff(n.from,n.to,e.markFromJSON(n.mark))}};wn.jsonID("removeMark",Kh);let ES=class hf 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 r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new hf(this.pos,n.marks[i]);return new hf(this.pos,this.mark)}}return new Dm(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hf(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 hf(n.pos,e.markFromJSON(n.mark))}};wn.jsonID("addNodeMark",ES);let Dm=class Zx 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 r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ES(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zx(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 Zx(n.pos,e.markFromJSON(n.mark))}};wn.jsonID("removeNodeMark",Dm);let Ls=class No extends wn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&eb(e,this.from,this.to)?Pn.fail("Structure replace would overwrite content"):Pn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rl([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),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new No(n.pos,Math.max(n.pos,r.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)}};wn.jsonID("replace",Ls);let pl=class Kd extends wn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(eb(e,this.from,this.gapFrom)||eb(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 r=this.slice.insertAt(this.insert,n.content);return r?Pn.fromReplace(e,this.from,this.to,r):Pn.fail("Content does not fit in gap")}getMap(){return new rl([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 Kd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Kd(n.pos,r.pos,i,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 Kd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};wn.jsonID("replaceAround",pl);function eb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function F8(t,e,n,r){let i=[],s=[],o,u;t.doc.nodesBetween(e,n,(c,h,d)=>{if(!c.isInline)return;let g=c.marks;if(!r.isInSet(g)&&d.type.allowsMarkType(r.type)){let y=Math.max(h,e),b=Math.min(h+c.nodeSize,n),k=r.addToSet(g);for(let E=0;E<g.length;E++)g[E].isInSet(k)||(o&&o.to==y&&o.mark.eq(g[E])?o.to=b:i.push(o=new Kh(y,b,g[E])));u&&u.to==y?u.to=b:s.push(u=new wS(y,b,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function P8(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,u)=>{if(!o.isInline)return;s++;let c=null;if(r instanceof Hh){let h=o.marks,d;for(;d=r.isInSet(h);)(c||(c=[])).push(d),h=d.removeFromSet(h)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let h=Math.min(u+o.nodeSize,n);for(let d=0;d<c.length;d++){let g=c[d],y;for(let b=0;b<i.length;b++){let k=i[b];k.step==s-1&&g.eq(i[b].style)&&(y=k)}y?(y.to=h,y.step=s):i.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(o=>t.step(new Kh(o.from,o.to,o.style)))}function AS(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),d=u+h.nodeSize,g=r.matchType(h.type);if(!g)o.push(new Ls(u,d,H.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new Kh(u,d,h.marks[y]));if(i&&h.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,k;for(;y=b.exec(h.text);)k||(k=new H(Q.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new Ls(u+y.index,u+y.index+y[0].length,k))}}u=d}if(!r.validEnd){let c=r.fillBefore(Q.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 j8(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),u=i.after(s+1),c=o,h=u,d=Q.empty,g=0;for(let k=s,E=!1;k>n;k--)E||r.index(k)>0?(E=!0,d=Q.from(r.node(k).copy(d)),g++):c--;let y=Q.empty,b=0;for(let k=s,E=!1;k>n;k--)E||i.after(k+1)<i.end(k)?(E=!0,y=Q.from(i.node(k).copy(y)),b++):h++;t.step(new pl(c,h,o,u,new H(d.append(y),g,b),d.size-g,!0))}function $8(t,e,n){let r=Q.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let u=n[o].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Q.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new pl(i,s,i,s,new H(r,0,0),n.length,!0))}function U8(t,e,n,r,i){if(!r.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 i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,c)&&J8(t.doc,t.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",k=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!k?h=!1:!b&&k&&(h=!0)}h===!1&&eO(t,o,u,s),AS(t,t.mapping.slice(s).map(u,1),r,void 0,h===null);let d=t.mapping.slice(s),g=d.map(u,1),y=d.map(u+o.nodeSize,1);return t.step(new pl(g,y,g+1,y-1,new H(Q.from(r.create(c,null,o.marks)),0,0),1,!0)),h===!0&&ZM(t,o,u,s),!1}})}function ZM(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,u=/\r?\n|\r/g;for(;o=u.exec(i.text);){let c=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function eO(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
38
+ `))}})}function J8(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function q8(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||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 pl(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new H(Q.from(o),0,0),1,!0))}function H8(t,e,n=1,r){let i=t.doc.resolve(e),s=Q.empty,o=Q.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=Q.from(i.node(u).copy(s));let d=r&&r[h];o=Q.from(d?d.type.create(d.attrs,o):i.node(u).copy(o))}t.step(new Ls(e,e,new H(s.append(o),n,n),!0))}function K8(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",g=!!o.contentMatch.matchType(i);d&&!g?r=!1:!d&&g&&(r=!0)}let u=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);eO(t,d.node(),d.before(),u)}o.inlineContent&&AS(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new Ls(h,c.map(e+n,-1),H.empty,!0)),r===!0){let d=t.doc.resolve(h);ZM(t,d.node(),d.before(),t.steps.length)}return t}function G8(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Y8(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return tO(i,s,r)?new Ls(e,n,r):new Q8(i,s,r).fit()}function tO(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let Q8=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Q.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Q.from(e.node(i).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,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,u=i.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new pl(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Ls(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=k1(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],d,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(Q.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(d=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:d};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=k1(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=k1(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new H(pf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new H(pf(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,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=r?r.content:o.content,c=o.openStart-e,h=0,d=[],{match:g,type:y}=this.frontier[n];if(i){for(let E=0;E<i.childCount;E++)d.push(i.child(E));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let E=u.child(h),N=g.matchType(E.type);if(!N)break;h++,(h>1||c==0||E.content.size)&&(g=N,d.push(nO(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?b:-1)))}let k=h==u.childCount;k||(b=-1),this.placed=df(this.placed,n,Q.from(d)),this.frontier[n].match=g,k&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,N=u;E<b;E++){let M=N.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),N=M.content}this.unplaced=k?e==0?H.empty:new H(pf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(pf(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:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=C1(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=C1(e,u,h,c,!0);if(!d||d.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=df(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=df(this.placed,this.depth,Q.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Q.empty,!0);n.childCount&&(this.placed=df(this.placed,this.frontier.length,n))}};function pf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(pf(t.firstChild.content,e-1,n)))}function df(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(df(t.lastChild.content,e-1,n)))}function k1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function nO(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,nO(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Q.empty,!0)))),t.copy(r)}function C1(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,o);return u&&!W8(n,s.content,o)?u:null}function W8(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function X8(t){return t.spec.defining||t.spec.definingForContent}function Z8(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(tO(i,s,r))return t.step(new Ls(e,n,r));let o=iO(i,s);o[o.length-1]==0&&o.pop();let u=-(i.depth+1);o.unshift(u);for(let y=i.depth,b=i.pos-1;y>0;y--,b--){let k=i.node(y).type.spec;if(k.defining||k.definingAsContext||k.isolating)break;o.indexOf(y)>-1?u=y:i.before(y)==b&&o.splice(1,0,-y)}let c=o.indexOf(u),h=[],d=r.openStart;for(let y=r.content,b=0;;b++){let k=y.firstChild;if(h.push(k),b==r.openStart)break;y=k.content}for(let y=d-1;y>=0;y--){let b=h[y],k=X8(b.type);if(k&&!b.sameMarkup(i.node(Math.abs(u)-1)))d=y;else if(k||!b.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let b=(y+d+1)%(r.openStart+1),k=h[b];if(k)for(let E=0;E<o.length;E++){let N=o[(E+c)%o.length],M=!0;N<0&&(M=!1,N=-N);let j=i.node(N-1),P=i.index(N-1);if(j.canReplaceWith(P,P,k.type,k.marks))return t.replace(i.before(N),M?s.after(N):n,new H(rO(r.content,0,r.openStart,b),b,r.openEnd))}}let g=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>g));y--){let b=o[y];b<0||(e=i.before(b),n=s.after(b))}}function rO(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(rO(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(Q.empty,!0))}return t}function eB(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=G8(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new H(Q.from(r),0,0))}function tB(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=iO(r,i);for(let o=0;o<s.length;o++){let u=s[o],c=o==s.length-1;if(c&&u==0||r.node(u).type.contentMatch.validEnd)return t.delete(r.start(u),i.end(u));if(u>0&&(c||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return t.delete(r.before(u),i.after(u))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function iO(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}let sO=class Gd extends wn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Pn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return rl.empty}invert(e){return new Gd(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 Gd(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 Gd(n.pos,n.attr,n.value)}};wn.jsonID("attr",sO);let aO=class tb extends wn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Pn.ok(r)}getMap(){return rl.empty}invert(e){return new tb(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 tb(n.attr,n.value)}};wn.jsonID("docAttr",aO);let _u=class extends Error{};_u=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};_u.prototype=Object.create(Error.prototype);_u.prototype.constructor=_u;_u.prototype.name="TransformError";let nB=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new V8}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new _u(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 r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.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,r=H.empty){let i=Y8(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new H(Q.from(r),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Z8(this,e,n,r),this}replaceRangeWith(e,n,r){return eB(this,e,n,r),this}deleteRange(e,n){return tB(this,e,n),this}lift(e,n){return j8(this,e,n),this}join(e,n=1){return K8(this,e,n),this}wrap(e,n){return $8(this,e,n),this}setBlockType(e,n=e,r,i=null){return U8(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return q8(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new sO(e,n,r)),this}setDocAttribute(e,n){return this.step(new aO(e,n)),this}addNodeMark(e,n){return this.step(new ES(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ct)n.isInSet(r.marks)&&this.step(new Dm(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Dm(e,s)),i=s.removeFromSet(i);for(let u=o.length-1;u>=0;u--)this.step(o[u])}return this}split(e,n=1,r){return H8(this,e,n,r),this}addMark(e,n,r){return F8(this,e,n,r),this}removeMark(e,n,r){return P8(this,e,n,r),this}clearIncompatible(e,n,r){return AS(this,e,n,r),this}};const w1=Object.create(null);class Ve{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new oO(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 r=n.content.lastChild,i=null;for(let u=0;u<n.openEnd;u++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let u=0;u<o.length;u++){let{$from:c,$to:h}=o[u],d=e.mapping.slice(s);e.replaceRange(d.map(c.pos),d.map(h.pos),u?H.empty:n),u==0&&XE(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:u}=i[s],c=e.mapping.slice(r),h=c.map(o.pos),d=c.map(u.pos);s?e.deleteRange(h,d):(e.replaceRangeWith(h,d,n),XE(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Ae(e):hu(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?hu(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):hu(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);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 hu(e,e,0,0,1)||new Hn(e)}static atEnd(e){return hu(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 r=w1[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in w1)throw new RangeError("Duplicate use of selection JSON ID "+e);return w1[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ae.between(this.$anchor,this.$head).getBookmark()}}Ve.prototype.visible=!0;class oO{constructor(e,n){this.$from=e,this.$to=n}}let QE=!1;function WE(t){!QE&&!t.parent.inlineContent&&(QE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ae 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 r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ve.near(r);let i=e.resolve(n.map(this.anchor));return new Ae(i.parent.inlineContent?i:r,r)}replace(e,n=H.empty){if(super.replace(e,n),n==H.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Eg(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 Ae(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Ve.findFrom(n,r,!0)||Ve.findFrom(n,-r,!0);if(s)n=s.$head;else return Ve.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ve.findFrom(e,-r,!0)||Ve.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Ae(e,n)}}Ve.jsonID("text",Ae);class Eg{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Eg(e.map(this.anchor),e.map(this.head))}resolve(e){return Ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class ye extends Ve{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Ve.near(s):new ye(s)}content(){return new H(Q.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 NS(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 NS{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Eg(r,r):new NS(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ye.isSelectable(r)?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 r=Ve.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}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 rB}}Ve.jsonID("all",Hn);const rB={map(){return this},resolve(t){return new Hn(t)}};function hu(t,e,n,r,i,s=!1){if(e.inlineContent)return Ae.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let u=e.child(o);if(u.isAtom){if(!s&&ye.isSelectable(u))return ye.create(t,n-(i<0?u.nodeSize:0))}else{let c=hu(t,u,n+i,i<0?u.childCount:0,i,s);if(c)return c}n+=u.nodeSize*i}return null}function XE(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Ls||i instanceof pl))return;let s=t.mapping.maps[r],o;s.forEach((u,c,h,d)=>{o==null&&(o=d)}),t.setSelection(Ve.near(t.doc.resolve(o),n))}const ZE=1,_d=2,eA=4;class iB extends nB{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|ZE)&~_d,this.storedMarks=null,this}get selectionSet(){return(this.updated&ZE)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_d,this}ensureMarks(e){return ct.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&_d)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~_d,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ct.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.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|=eA,this}get scrolledIntoView(){return(this.updated&eA)>0}}function tA(t,e){return!e||!t?t:t.bind(e)}class mf{constructor(e,n,r){this.name=e,this.init=tA(n.init,r),this.apply=tA(n.apply,r)}}const sB=[new mf("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new mf("selection",{init(t,e){return t.selection||Ve.atStart(e.doc)},apply(t){return t.selection}}),new mf("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new mf("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class E1{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=sB.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new mf(r.key,r.spec.state,r))})}}class _o{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let u=this.config.plugins[o];if(u.spec.appendTransaction){let c=i?i[o].n:0,h=i?i[o].state:this,d=c<n.length&&u.spec.appendTransaction.call(u,c?n.slice(c):n,h,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let g=0;g<this.config.plugins.length;g++)i.push(g<o?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new _o(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new iB(this)}static create(e){let n=new E1(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new _o(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new E1(this.schema,e.plugins),r=n.fields,i=new _o(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new E1(e.schema,e.plugins),s=new _o(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Rs.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(r)for(let u in r){let c=r[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 lO(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=lO(i,e,{})),n[r]=i}return n}class fr{constructor(e){this.spec=e,this.props={},e.props&&lO(e.props,this,this.props),this.key=e.key?e.key.key:uO("plugin")}getState(e){return e[this.key]}}const A1=Object.create(null);function uO(t){return t in A1?t+"$"+ ++A1[t]:(A1[t]=0,t+"$")}class hr{constructor(e="key"){this.key=uO(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const TS=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function cO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const fO=(t,e,n)=>{let r=cO(t,n);if(!r)return!1;let i=MS(r);if(!i){let o=r.blockRange(),u=o&&vS(o);return u==null?!1:(e&&e(t.tr.lift(o,u).scrollIntoView()),!0)}let s=i.nodeBefore;if(dO(t,i,e,-1))return!0;if(r.parent.content.size==0&&(zu(s,"end")||ye.isSelectable(s)))for(let o=r.depth;;o--){let u=kS(t.doc,r.before(o),r.after(o),H.empty);if(u&&u.slice.size<u.to-u.from){if(e){let c=t.tr.step(u);c.setSelection(zu(s,"end")?Ve.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):ye.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},aB=(t,e,n)=>{let r=cO(t,n);if(!r)return!1;let i=MS(r);return i?oB(t,i,e):!1};function oB(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,u=o,c=e.pos+1;for(;!u.isTextblock;c++){if(u.type.spec.isolating)return!1;let d=u.firstChild;if(!d)return!1;u=d}let h=kS(t.doc,s,c,H.empty);if(!h||h.from!=s||h instanceof wg&&h.slice.size>=c-s)return!1;if(n){let d=t.tr.step(h);d.setSelection(Ae.create(d.doc,s)),n(d.scrollIntoView())}return!0}function zu(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const hO=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=MS(r)}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 MS(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 lB(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const uB=(t,e,n)=>{let r=lB(t,n);if(!r)return!1;let i=pO(r);if(!i)return!1;let s=i.nodeAfter;if(dO(t,i,e,1))return!0;if(r.parent.content.size==0&&(zu(s,"start")||ye.isSelectable(s))){let o=kS(t.doc,r.before(),r.after(),H.empty);if(o&&o.slice.size<o.to-o.from){if(e){let u=t.tr.step(o);u.setSelection(zu(s,"start")?Ve.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):ye.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},cB=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=pO(r)}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 pO(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 fB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
39
+ `).scrollIntoView()),!0)};function OS(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 hB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=OS(i.contentMatchAt(s));if(!o||!i.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},pB=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Hn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=OS(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=t.tr.insert(o,s.createAndFill());u.setSelection(Ae.create(u.doc,o+1)),e(u.scrollIntoView())}return!0},dB=(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(Jd(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&vS(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function mB(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof ye&&e.selection.node.isBlock)return!r.parentOffset||!Jd(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,u,c=!1,h=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){c=r.end(b)==r.pos+(r.depth-b),h=r.start(b)==r.pos-(r.depth-b),u=OS(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(c&&u?{type:u}:null),o=b;break}else{if(b==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof Ae||e.selection instanceof Hn)&&d.deleteSelection();let g=d.mapping.map(r.pos),y=Jd(d.doc,g,s.length,s);if(y||(s[0]=u?{type:u}:null,y=Jd(d.doc,g,s.length,s)),!y)return!1;if(d.split(g,s.length,s),!c&&h&&r.node(o).type!=u){let b=d.mapping.map(r.before(o)),k=d.doc.resolve(b);u&&r.node(o-1).canReplaceWith(k.index(),k.index()+1,u)&&d.setNodeMarkup(d.mapping.map(r.before(o)),u)}return n&&n(d.scrollIntoView()),!0}}const gB=mB(),yB=(t,e)=>(e&&e(t.tr.setSelection(new Hn(t.doc))),!0);function xB(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||HM(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function dO(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,u,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&xB(t,e,n))return!0;let h=!c&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(u=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&u.matchType(o[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,k=Q.empty;for(let M=o.length-1;M>=0;M--)k=Q.from(o[M].create(null,k));k=Q.from(i.copy(k));let E=t.tr.step(new Rm(e.pos-1,b,e.pos,b,new H(k,1,0),o.length,!0)),N=E.doc.resolve(b+2*o.length);N.nodeAfter&&N.nodeAfter.type==i.type&&HM(E.doc,N.pos)&&E.join(N.pos),n(E.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&c?null:Ve.findFrom(e,1),g=d&&d.$from.blockRange(d.$to),y=g&&vS(g);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(g,y).scrollIntoView()),!0;if(h&&zu(s,"start",!0)&&zu(i,"end")){let b=i,k=[];for(;k.push(b),!b.isTextblock;)b=b.lastChild;let E=s,N=1;for(;!E.isTextblock;E=E.firstChild)N++;if(b.canReplace(b.childCount,b.childCount,E.content)){if(n){let M=Q.empty;for(let P=k.length-1;P>=0;P--)M=Q.from(k[P].copy(M));let j=t.tr.step(new Rm(e.pos-k.length,e.pos+s.nodeSize,e.pos+N,e.pos+s.nodeSize-N,new H(M,k.length,0),0,!0));n(j.scrollIntoView())}return!0}}return!1}function mO(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(Ae.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const bB=mO(-1),SB=mO(1);function RS(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),u=o&&A8(o,t,e);return u?(r&&r(n.tr.wrap(o,u).scrollIntoView()),!0):!1}}function mh(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:u}}=n.selection.ranges[s];n.doc.nodesBetween(o,u,(c,h)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let d=n.doc.resolve(h),g=d.index();i=d.parent.canReplaceWith(g,g+1,t)}})}if(!i)return!1;if(r){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)}r(s.scrollIntoView())}return!0}}function vB(t,e,n,r){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],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 Ag(t,e=null,n){return function(r,i){let{empty:s,$cursor:o,ranges:u}=r.selection;if(s&&!o||!vB(r.doc,u,t))return!1;if(i)if(o)t.isInSet(r.storedMarks||o.marks())?i(r.tr.removeStoredMark(t)):i(r.tr.addStoredMark(t.create(e)));else{let c,h=r.tr;c=!u.some(d=>r.doc.rangeHasMark(d.$from.pos,d.$to.pos,t));for(let d=0;d<u.length;d++){let{$from:g,$to:y}=u[d];if(!c)h.removeMark(g.pos,y.pos,t);else{let b=g.pos,k=y.pos,E=g.nodeAfter,N=y.nodeBefore,M=E&&E.isText?/^\s*/.exec(E.text)[0].length:0,j=N&&N.isText?/\s*$/.exec(N.text)[0].length:0;b+M<k&&(b+=M,k-=j),h.addMark(b,k,t.create(e))}}i(h.scrollIntoView())}return!0}}function Uu(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let N1=Uu(TS,fO,hO),nA=Uu(TS,uB,cB);const As={Enter:Uu(fB,pB,dB,gB),"Mod-Enter":hB,Backspace:N1,"Mod-Backspace":N1,"Shift-Backspace":N1,Delete:nA,"Mod-Delete":nA,"Mod-a":yB},gO={"Ctrl-h":As.Backspace,"Alt-Backspace":As["Mod-Backspace"],"Ctrl-d":As.Delete,"Ctrl-Alt-Backspace":As["Mod-Delete"],"Alt-Delete":As["Mod-Delete"],"Alt-d":As["Mod-Delete"],"Ctrl-a":bB,"Ctrl-e":SB};for(let t in As)gO[t]=As[t];const kB=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,CB=kB?gO:As,yO=65535,xO=Math.pow(2,16);function wB(t,e){return t+e*xO}function rA(t){return t&yO}function EB(t){return(t-(t&yO))/xO}const bO=1,SO=2,Yd=4,vO=8;let iA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&vO)>0}get deletedBefore(){return(this.delInfo&(bO|Yd))>0}get deletedAfter(){return(this.delInfo&(SO|Yd))>0}get deletedAcross(){return(this.delInfo&Yd)>0}},il=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,r=rA(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+EB(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,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],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:wB(u/3,e-c),E=e==c?SO:e==g?bO:Yd;return(n<0?e!=c:e!=g)&&(E|=vO),new iA(b,E,k)}i+=d-h}return r?e+i:new iA(e+i,0,null)}touches(e,n){let r=0,i=rA(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-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])}};il.empty=new il([]);const T1=Object.create(null);let En=class{getMap(){return il.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=T1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in T1)throw new RangeError("Duplicate use of step JSON ID "+e);return T1[e]=n,n.prototype.jsonID=e,n}},jn=class gf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new gf(e,null)}static fail(e){return new gf(null,e)}static fromReplace(e,n,r,i){try{return gf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return gf.fail(s.message);throw s}}};function DS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(DS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}let kO=class yf extends En{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(DS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),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),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new yf(n.pos,r.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:"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 yf(n.from,n.to,e.markFromJSON(n.mark))}};En.jsonID("addMark",kO);let CO=class xf extends En{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(DS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,r)}invert(){return new kO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new xf(n.pos,r.pos,this.mark)}merge(e){return e instanceof xf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xf(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 xf(n.from,n.to,e.markFromJSON(n.mark))}};En.jsonID("removeMark",CO);let wO=class bf 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 r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new bf(this.pos,n.marks[i]);return new bf(this.pos,this.mark)}}return new EO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new bf(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 bf(n.pos,e.markFromJSON(n.mark))}};En.jsonID("addNodeMark",wO);let EO=class nb 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 r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new wO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nb(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 nb(n.pos,e.markFromJSON(n.mark))}};En.jsonID("removeNodeMark",EO);let AB=class To extends En{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&rb(e,this.from,this.to)?jn.fail("Structure replace would overwrite content"):jn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new il([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),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new To(n.pos,Math.max(n.pos,r.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)}};En.jsonID("replace",AB);let NB=class Qd extends En{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(rb(e,this.from,this.gapFrom)||rb(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 r=this.slice.insertAt(this.insert,n.content);return r?jn.fromReplace(e,this.from,this.to,r):jn.fail("Content does not fit in gap")}getMap(){return new il([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 Qd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Qd(n.pos,r.pos,i,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 Qd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};En.jsonID("replaceAround",NB);function rb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function TB(t,e,n=null,r=t){let i=MB(t,e),s=i&&OB(r,e);return s?i.map(sA).concat({type:e,attrs:n}).concat(s.map(sA)):null}function sA(t){return{type:t,attrs:null}}function MB(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function OB(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}function RB(t,e){let n=t.resolve(e),r=n.index();return IB(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function DB(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function IB(t,e){return!!(t&&e&&!t.isLeaf&&DB(t,e))}let _B=class Wd extends En{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return jn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return il.empty}invert(e){return new Wd(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 Wd(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 Wd(n.pos,n.attr,n.value)}};En.jsonID("attr",_B);let zB=class ib extends En{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jn.ok(r)}getMap(){return il.empty}invert(e){return new ib(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 ib(n.attr,n.value)}};En.jsonID("docAttr",zB);let gh=class extends Error{};gh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};gh.prototype=Object.create(Error.prototype);gh.prototype.constructor=gh;gh.prototype.name="TransformError";class Tr{constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?LB(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function LB(t){return function(e,n,r,i){let s=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);s+=n[0].slice(o+n[1].length),r+=o;let u=r-i;u>0&&(s=n[0].slice(o-u,o)+s,r=i)}return e.tr.insertText(s,r,i)}}const BB=(t,e)=>{let n=t.plugins;for(let r=0;r<n.length;r++){let i=n[r],s;if(i.spec.isInputRules&&(s=i.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 Tr(/--$/,"—",{inCodeMark:!1});new Tr(/\.\.\.$/,"…",{inCodeMark:!1});new Tr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Tr(/"$/,"”",{inCodeMark:!1});new Tr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Tr(/'$/,"’",{inCodeMark:!1});function IS(t,e,n=null,r){return new Tr(t,(i,s,o,u)=>{let c=n instanceof Function?n(s):n,h=i.tr.delete(o,u),d=h.doc.resolve(o),g=d.blockRange(),y=g&&TB(g,e,c);if(!y)return null;h.wrap(g,y);let b=h.doc.resolve(o-1).nodeBefore;return b&&b.type==e&&RB(h.doc,o-1)&&(!r||r(s,b))&&h.join(o-1),h})}function AO(t,e,n=null){return new Tr(t,(r,i,s,o)=>{let u=r.doc.resolve(s),c=n instanceof Function?n(i):n;return u.node(-1).canReplaceWith(u.index(-1),u.indexAfter(-1),e)?r.tr.delete(s,o).setBlockType(s,s,e,c):null})}const qa=typeof navigator<"u"?navigator:null,aA=typeof document<"u"?document:null,Wa=qa&&qa.userAgent||"",sb=/Edge\/(\d+)/.exec(Wa),NO=/MSIE \d/.exec(Wa),ab=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wa),_S=!!(NO||ab||sb);NO?document.documentMode:ab?+ab[1]:sb&&+sb[1];const VB=!_S&&/gecko\/(\d+)/i.test(Wa);VB&&+(/Firefox\/(\d+)/.exec(Wa)||[0,0])[1];const ob=!_S&&/Chrome\/(\d+)/.exec(Wa),FB=!!ob;ob&&+ob[1];const PB=!_S&&!!qa&&/Apple Computer/.test(qa.vendor),jB=PB&&(/Mobile\/\w+/.test(Wa)||!!qa&&qa.maxTouchPoints>2);jB||qa&&/Mac/.test(qa.platform);const $B=/Android \d/.test(Wa),UB=!!aA&&"webkitFontSmoothing"in aA.documentElement.style;UB&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];function M1(t,e,n,r,i,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,"")+r;for(let h of i){const d=h,g=d.match.exec(c),y=g&&g[0]&&d.handler(o,g,e-(g[0].length-r.length),n);if(y)return d.undoable!==!1&&y.setMeta(s,{transform:y,from:e,to:n,text:r}),t.dispatch(y),!0}return!1}const JB=new hr("MILKDOWN_CUSTOM_INPUTRULES");function qB({rules:t}){const e=new fr({key:JB,isInputRules:!0,state:{init(){return null},apply(n,r){const i=n.getMeta(this);return i||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,i,s){return M1(n,r,i,s,t,e)},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&M1(n,r.pos,r.pos,"",t,e)}),!1),keydown:(n,r)=>!($B&&FB&&r.key==="Enter")||n.composing?!1:n.someProp("handleKeyDown",i=>i(n,r))?(r.preventDefault(),!0):!1},handleKeyDown(n,r){if(r.key!=="Enter")return!1;const{$cursor:i}=n.state.selection;return i?M1(n,i.pos,i.pos,`
40
+ `,t,e):!1}}});return e}function Gh(t,e,n={}){return new Tr(t,(r,i,s,o)=>{var u,c,h,d;const{tr:g}=r,y=i.length;let b=i[y-1],k=i[0],E=[],N;const M={group:b,fullMatch:k,start:s,end:o},j=(u=n.updateCaptured)==null?void 0:u.call(n,M);if(Object.assign(M,j),{group:b,fullMatch:k,start:s,end:o}=M,k===null||b?.trim()==="")return null;if(b){const P=k.search(/\S/),U=s+k.indexOf(b),L=U+b.length;E=(c=g.storedMarks)!=null?c:[],L<o&&g.delete(L,o),U>s&&g.delete(s+P,U),N=s+P+b.length;const C=(h=n.getAttr)==null?void 0:h.call(n,i);g.addMark(s,N,e.create(C)),g.setStoredMarks(E),(d=n.beforeDispatch)==null||d.call(n,{match:i,start:s,end:o,tr:g})}return g})}function TO(t){return Object.assign(Object.create(t),t).setTime(Date.now())}function HB(t,e){return Array.isArray(t)&&t.includes(e.type)||e.type===t}function KB(t){return e=>{for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r)){const i=e.before(n),s=e.after(n);return{from:i,to:s,node:r}}}}}function GB(t,e){return KB(n=>n.type===e)(t)}function YB(t){return e=>{for(let n=e.depth;n>0;n--){const r=e.node(n);if(t(r))return{pos:e.before(n),start:e.start(n),depth:n,node:r}}}}function QB(t,e){if(!(t instanceof ye))return;const{node:n,$from:r}=t;if(HB(e,n))return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}const WB=(t,e)=>{const{selection:n,doc:r}=t;if(n instanceof ye)return{hasNode:n.node.type===e,pos:n.from,target:n.node};const{from:i,to:s}=n;let o=!1,u=-1,c=null;return r.nodesBetween(i,s,(h,d)=>c?!1:h.type===e?(o=!0,u=d,c=h,!1):!0),{hasNode:o,pos:u,target:c}};var Ha={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:"'"},Im={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},XB=typeof navigator<"u"&&/Mac/.test(navigator.platform),ZB=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var pn=0;pn<10;pn++)Ha[48+pn]=Ha[96+pn]=String(pn);for(var pn=1;pn<=24;pn++)Ha[pn+111]="F"+pn;for(var pn=65;pn<=90;pn++)Ha[pn]=String.fromCharCode(pn+32),Im[pn]=String.fromCharCode(pn);for(var O1 in Ha)Im.hasOwnProperty(O1)||(Im[O1]=Ha[O1]);function e7(t){var e=XB&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ZB&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Im:Ha)[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 t7=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),n7=typeof navigator<"u"&&/Win/.test(navigator.platform);function r7(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,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))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))t7?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function i7(t){let e=Object.create(null);for(let n in t)e[r7(n)]=t[n];return e}function R1(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 s7(t){return new fr({props:{handleKeyDown:MO(t)}})}function MO(t){let e=i7(t);return function(n,r){let i=e7(r),s,o=e[R1(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[R1(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(n7&&r.ctrlKey&&r.altKey)&&(s=Ha[r.keyCode])&&s!=i){let u=e[R1(s,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}var OO=class{},RO=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 $T();return t}}},a7=class DO extends OO{constructor(e,n,r){super(),this.type=e,this.content=n,this.attrs=r}push(e,...n){this.content.push(e,...n)}pop(){return this.content.pop()}static create(e,n,r){return new DO(e,n,r)}},Vi,Vh,ug,cg,fg,Fh,Ph,Xo,o7=(Xo=class extends RO{constructor(n){super();Ut(this,Vi,ct.none);Ut(this,Vh,n=>n.isText);Ut(this,ug,(n,r)=>{if(tt(this,Vh).call(this,n)&&tt(this,Vh).call(this,r)&&ct.sameSet(n.marks,r.marks))return this.schema.text(n.text+r.text,n.marks)});Ut(this,cg,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.parseMarkdown.match(n));if(!r)throw mz(n);return r});Ut(this,fg,n=>{const r=tt(this,cg).call(this,n);r.spec.parseMarkdown.runner(this,n,r)});Ut(this,Fh,()=>{su(this,Vi,ct.none);const n=this.close();return tt(this,Ph).call(this,n.type,n.attrs,n.content)});Ut(this,Ph,(n,r,i)=>{const s=n.createAndFill(r,i,tt(this,Vi));if(!s)throw dz(n,r,i);return this.push(s),s});this.injectRoot=(r,i,s)=>(this.openNode(i,s),this.next(r.children),this),this.openNode=(r,i)=>(this.open(a7.create(r,[],i)),this),this.closeNode=()=>{try{tt(this,Fh).call(this)}catch(r){console.error(r)}return this},this.addNode=(r,i,s)=>{try{tt(this,Ph).call(this,r,i,s)}catch(o){console.error(o)}return this},this.openMark=(r,i)=>(su(this,Vi,r.create(i).addToSet(tt(this,Vi))),this),this.closeMark=r=>(su(this,Vi,r.removeFromSet(tt(this,Vi))),this),this.addText=r=>{try{const i=this.top();if(!i)throw $T();const s=i.pop(),o=this.schema.text(r,tt(this,Vi));if(!s)return i.push(o),this;const u=tt(this,ug).call(this,s,o);return u?(i.push(u),this):(i.push(s,o),this)}catch(i){return console.error(i),this}},this.build=()=>{let r;do r=tt(this,Fh).call(this);while(this.size());return r},this.next=(r=[])=>([r].flat().forEach(i=>tt(this,fg).call(this,i)),this),this.toDoc=()=>this.build(),this.run=(r,i)=>{const s=r.runSync(r.parse(i),i);return this.next(s),this},this.schema=n}},Vi=new WeakMap,Vh=new WeakMap,ug=new WeakMap,cg=new WeakMap,fg=new WeakMap,Fh=new WeakMap,Ph=new WeakMap,Xo.create=(n,r)=>{const i=new Xo(n);return s=>(i.run(r,s),i.toDoc())},Xo),Zo,oA=(Zo=class extends OO{constructor(e,n,r,i={}){super(),this.type=e,this.children=n,this.value=r,this.props=i,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>this.children?.pop()}},Zo.create=(e,n,r,i={})=>new Zo(e,n,r,i),Zo),l7=t=>Object.prototype.hasOwnProperty.call(t,"size"),Ns,jh,hg,pg,$h,dg,Uh,mg,gg,Du,Po,yg,Jh,el,u7=(el=class extends RO{constructor(n){super();Ut(this,Ns,ct.none);Ut(this,jh,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.toMarkdown.match(n));if(!r)throw gz(n.type);return r});Ut(this,hg,n=>tt(this,jh).call(this,n).spec.toMarkdown.runner(this,n));Ut(this,pg,(n,r)=>tt(this,jh).call(this,n).spec.toMarkdown.runner(this,n,r));Ut(this,$h,n=>{const{marks:r}=n,i=s=>s.type.spec.priority??50;[...r].sort((s,o)=>i(s)-i(o)).every(s=>!tt(this,pg).call(this,s,n))&&tt(this,hg).call(this,n),r.forEach(s=>tt(this,Jh).call(this,s))});Ut(this,dg,(n,r)=>{if(n.type===r||n.children?.length!==1)return n;const i=c=>{if(c.type===r)return c.value!=null?null:c;if(c.children?.length!==1)return null;const[h]=c.children;return h?i(h):null},s=i(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,Uh,n=>{const{children:r}=n;return r&&(n.children=r.reduce((i,s,o)=>{if(o===0)return[s];const u=i.at(-1);if(u&&u.isMark&&s.isMark){s=tt(this,dg).call(this,s,u.type);const{children:c,...h}=s,{children:d,...g}=u;if(s.type===u.type&&c&&d&&JSON.stringify(h)===JSON.stringify(g)){const y={...g,children:[...d,...c]};return i.slice(0,-1).concat(tt(this,Uh).call(this,y))}}return i.concat(s)},[])),n});Ut(this,mg,n=>{const r={...n.props,type:n.type};return n.children&&(r.children=n.children),n.value&&(r.value=n.value),r});Ut(this,gg,(n,r)=>{let i="",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,k=b.trimEnd();s=b.slice(k.length),g.value=k}if(y&&y.value.startsWith(" ")){const b=y.value,k=b.trimStart();i=b.slice(0,b.length-k.length),y.value=k}}i.length&&tt(this,Po).call(this,"text",void 0,i);const d=r();return s.length&&tt(this,Po).call(this,"text",void 0,s),d});Ut(this,Du,(n=!1)=>{const r=this.close(),i=()=>tt(this,Po).call(this,r.type,r.children,r.value,r.props);return n?tt(this,gg).call(this,r,i):i()});Ut(this,Po,(n,r,i,s)=>{const o=oA.create(n,r,i,s),u=tt(this,Uh).call(this,tt(this,mg).call(this,o));return this.push(u),u});Ut(this,yg,(n,r,i,s)=>n.isInSet(tt(this,Ns))?this:(su(this,Ns,n.addToSet(tt(this,Ns))),this.openNode(r,i,{...s,isMark:!0})));Ut(this,Jh,n=>{n.isInSet(tt(this,Ns))&&(su(this,Ns,n.type.removeFromSet(tt(this,Ns))),tt(this,Du).call(this,!0))});this.openNode=(r,i,s)=>(this.open(oA.create(r,void 0,i,s)),this),this.closeNode=()=>(tt(this,Du).call(this),this),this.addNode=(r,i,s,o)=>(tt(this,Po).call(this,r,i,s,o),this),this.withMark=(r,i,s,o)=>(tt(this,yg).call(this,r,i,s,o),this),this.closeMark=r=>(tt(this,Jh).call(this,r),this),this.build=()=>{let r=null;do r=tt(this,Du).call(this);while(this.size());return r},this.next=r=>l7(r)?(r.forEach(i=>{tt(this,$h).call(this,i)}),this):(tt(this,$h).call(this,r),this),this.toString=r=>r.stringify(this.build()),this.run=r=>(this.next(r),this),this.schema=n}},Ns=new WeakMap,jh=new WeakMap,hg=new WeakMap,pg=new WeakMap,$h=new WeakMap,dg=new WeakMap,Uh=new WeakMap,mg=new WeakMap,gg=new WeakMap,Du=new WeakMap,Po=new WeakMap,yg=new WeakMap,Jh=new WeakMap,el.create=(n,r)=>{const i=new el(n);return s=>(i.run(s),i.toString(r))},el);const IO=65535,_O=Math.pow(2,16);function c7(t,e){return t+e*_O}function lA(t){return t&IO}function f7(t){return(t-(t&IO))/_O}const zO=1,LO=2,Xd=4,BO=8;let uA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&BO)>0}get deletedBefore(){return(this.delInfo&(zO|Xd))>0}get deletedAfter(){return(this.delInfo&(LO|Xd))>0}get deletedAcross(){return(this.delInfo&Xd)>0}},sl=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,r=lA(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+f7(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,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],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:c7(u/3,e-c),E=e==c?LO:e==g?zO:Xd;return(n<0?e!=c:e!=g)&&(E|=BO),new uA(b,E,k)}i+=d-h}return r?e+i:new uA(e+i,0,null)}touches(e,n){let r=0,i=lA(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-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])}};sl.empty=new sl([]);const D1=Object.create(null);let An=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 r=D1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in D1)throw new RangeError("Duplicate use of step JSON ID "+e);return D1[e]=n,n.prototype.jsonID=e,n}},$n=class Sf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Sf(e,null)}static fail(e){return new Sf(null,e)}static fromReplace(e,n,r,i){try{return Sf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return Sf.fail(s.message);throw s}}};function zS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(zS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}let VO=class vf extends An{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(zS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return $n.fromReplace(e,this.from,this.to,s)}invert(){return new FO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new vf(n.pos,r.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))}};An.jsonID("addMark",VO);let FO=class kf extends An{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(zS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return $n.fromReplace(e,this.from,this.to,r)}invert(){return new VO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new kf(n.pos,r.pos,this.mark)}merge(e){return e instanceof kf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kf(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 kf(n.from,n.to,e.markFromJSON(n.mark))}};An.jsonID("removeMark",FO);let PO=class Cf extends An{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 r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return $n.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Cf(this.pos,n.marks[i]);return new Cf(this.pos,this.mark)}}return new jO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Cf(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 Cf(n.pos,e.markFromJSON(n.mark))}};An.jsonID("addNodeMark",PO);let jO=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 $n.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return $n.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new PO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new 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",jO);let h7=class Mo extends An{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&ub(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 Mo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Mo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Mo)||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 Mo(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 Mo(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 Mo(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};An.jsonID("replace",h7);let p7=class Zd extends An{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,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 $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 r=this.slice.insertAt(this.insert,n.content);return r?$n.fromReplace(e,this.from,this.to,r):$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 Zd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Zd(n.pos,r.pos,i,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 Zd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};An.jsonID("replaceAround",p7);function ub(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function d7(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let u=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(u>0?1:0),h=r.node(o),d=!1;if(s==1)d=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);d=g&&h.canReplaceWith(c,c,g[0])}if(d)return u==0?r.pos:u<0?r.before(o+1):r.after(o+1)}return null}let m7=class em extends An{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return $n.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return $n.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return sl.empty}invert(e){return new em(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 em(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 em(n.pos,n.attr,n.value)}};An.jsonID("attr",m7);let g7=class cb extends An{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return $n.ok(r)}getMap(){return sl.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",g7);let yh=class extends Error{};yh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};yh.prototype=Object.create(Error.prototype);yh.prototype.constructor=yh;yh.prototype.name="TransformError";const dn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Lu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let fb=null;const Es=function(t,e,n){let r=fb||(fb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},y7=function(){fb=null},al=function(t,e,n,r){return n&&(cA(t,e,n,r,-1)||cA(t,e,n,r,1))},x7=/^(img|br|input|textarea|hr)$/i;function cA(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Xr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Yh(t)||x7.test(t.nodeName)||t.contentEditable=="false")return!1;e=dn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Xr(t):0}else return!1}}function Xr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function b7(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=Xr(t)}else if(t.parentNode&&!Yh(t))e=dn(t),t=t.parentNode;else return null}}function S7(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&&!Yh(t))e=dn(t)+1,t=t.parentNode;else return null}}function v7(t,e,n){for(let r=e==0,i=e==Xr(t);r||i;){if(t==n)return!0;let s=dn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Xr(t)}}function Yh(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 Ng=function(t){return t.focusNode&&al(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Do(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function k7(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function C7(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Xr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Xr(r.startContainer),r.startOffset)}}}const ji=typeof navigator<"u"?navigator:null,fA=typeof document<"u"?document:null,Xa=ji&&ji.userAgent||"",hb=/Edge\/(\d+)/.exec(Xa),$O=/MSIE \d/.exec(Xa),pb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xa),ur=!!($O||pb||hb),Pa=$O?document.documentMode:pb?+pb[1]:hb?+hb[1]:0,ei=!ur&&/gecko\/(\d+)/i.test(Xa);ei&&+(/Firefox\/(\d+)/.exec(Xa)||[0,0])[1];const db=!ur&&/Chrome\/(\d+)/.exec(Xa),mn=!!db,UO=db?+db[1]:0,kn=!ur&&!!ji&&/Apple Computer/.test(ji.vendor),Bu=kn&&(/Mobile\/\w+/.test(Xa)||!!ji&&ji.maxTouchPoints>2),Gr=Bu||(ji?/Mac/.test(ji.platform):!1),JO=ji?/Win/.test(ji.platform):!1,Os=/Android \d/.test(Xa),Qh=!!fA&&"webkitFontSmoothing"in fA.documentElement.style,w7=Qh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function E7(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 Cs(t,e){return typeof t=="number"?t:t[e]}function A7(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function hA(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Lu(o);continue}let u=o,c=u==s.body,h=c?E7(s):A7(u),d=0,g=0;if(e.top<h.top+Cs(r,"top")?g=-(h.top-e.top+Cs(i,"top")):e.bottom>h.bottom-Cs(r,"bottom")&&(g=e.bottom-e.top>h.bottom-h.top?e.top+Cs(i,"top")-h.top:e.bottom-h.bottom+Cs(i,"bottom")),e.left<h.left+Cs(r,"left")?d=-(h.left-e.left+Cs(i,"left")):e.right>h.right-Cs(r,"right")&&(d=e.right-h.right+Cs(i,"right")),d||g)if(c)s.defaultView.scrollBy(d,g);else{let b=u.scrollLeft,k=u.scrollTop;g&&(u.scrollTop+=g),d&&(u.scrollLeft+=d);let E=u.scrollLeft-b,N=u.scrollTop-k;e={left:e.left-E,top:e.top-N,right:e.right-E,bottom:e.bottom-N}}let y=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(y))break;o=y=="absolute"?o.offsetParent:Lu(o)}}function N7(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;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){r=u,i=c.top;break}}return{refDOM:r,refTop:i,stack:qO(t.dom)}}function qO(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Lu(r));return e}function T7({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;HO(n,r==0?0:r-e)}function HO(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let au=null;function M7(t){if(t.setActive)return t.setActive();if(au)return t.focus(au);let e=qO(t);t.focus(au==null?{get preventScroll(){return au={preventScroll:!0},!0}}:void 0),au||(au=!1,HO(e,0))}function KO(t,e){let n,r=2e8,i,s=0,o=e.top,u=e.top,c,h;for(let d=t.firstChild,g=0;d;d=d.nextSibling,g++){let y;if(d.nodeType==1)y=d.getClientRects();else if(d.nodeType==3)y=Es(d).getClientRects();else continue;for(let b=0;b<y.length;b++){let k=y[b];if(k.top<=o&&k.bottom>=u){o=Math.max(k.bottom,o),u=Math.min(k.top,u);let E=k.left>e.left?k.left-e.left:k.right<e.left?e.left-k.right:0;if(E<r){n=d,r=E,i=E&&n.nodeType==3?{left:k.right<e.left?k.right:k.left,top:e.top}:e,d.nodeType==1&&E&&(s=g+(e.left>=(k.left+k.right)/2?1:0));continue}}else k.top>e.top&&!c&&k.left<=e.left&&k.right>=e.left&&(c=d,h={left:Math.max(k.left,Math.min(k.right,e.left)),top:k.top});!n&&(e.left>=k.right&&e.top>=k.top||e.left>=k.left&&e.top>=k.bottom)&&(s=g+1)}}return!n&&c&&(n=c,i=h,r=0),n&&n.nodeType==3?O7(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:KO(n,i)}function O7(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Ea(r,1);if(o.top!=o.bottom&&LS(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function LS(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function R7(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function D7(t,e,n){let{node:r,offset:i}=KO(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function I7(t,e,n,r){let i=-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>r.left||c.top>r.top?i=u.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(i=u.posAfter),o=!0),!u.contentDOM&&i<0&&!u.node.isText))return(u.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?u.posBefore:u.posAfter;s=u.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function GO(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){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(LS(e,h))return GO(o,e,h)}}if((s=(s+1)%r)==i)break}return t}function _7(t,e){let n=t.dom.ownerDocument,r,i=0,s=C7(n,e.left,e.top);s&&({node:r,offset:i}=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(!LS(e,h)||(o=GO(t.dom,e,h),!o))return null}if(kn)for(let h=o;r&&h;h=Lu(h))h.draggable&&(r=void 0);if(o=R7(o,e),r){if(ei&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],g;d.nodeName=="IMG"&&(g=d.getBoundingClientRect()).right<=e.left&&g.bottom>e.top&&i++}let h;Qh&&i&&r.nodeType==1&&(h=r.childNodes[i-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(u=I7(t,r,i,e))}u==null&&(u=D7(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:u,inside:c?c.posAtStart-c.border:-1}}function pA(t){return t.top<t.bottom||t.left<t.right}function Ea(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(pA(r))return r}return Array.prototype.find.call(n,pA)||t.getBoundingClientRect()}const z7=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function YO(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Qh||ei;if(r.nodeType==3)if(o&&(z7.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let c=Ea(Es(r,i,i),n);if(ei&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let h=Ea(Es(r,i-1,i-1),-1);if(h.top==c.top){let d=Ea(Es(r,i,i+1),-1);if(d.top!=c.top)return Qc(d,d.left<h.left)}}return c}else{let c=i,h=i,d=n<0?1:-1;return n<0&&!i?(h++,d=-1):n>=0&&i==r.nodeValue.length?(c--,d=1):n<0?c--:h++,Qc(Ea(Es(r,c,h),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Xr(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return I1(c.getBoundingClientRect(),!1)}if(s==null&&i<Xr(r)){let c=r.childNodes[i];if(c.nodeType==1)return I1(c.getBoundingClientRect(),!0)}return I1(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Xr(r))){let c=r.childNodes[i-1],h=c.nodeType==3?Es(c,Xr(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(h)return Qc(Ea(h,1),!1)}if(s==null&&i<Xr(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let h=c?c.nodeType==3?Es(c,0,o?0:1):c.nodeType==1?c:null:null;if(h)return Qc(Ea(h,-1),!0)}return Qc(Ea(r.nodeType==3?Es(r):r,-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 I1(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 QO(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function L7(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return QO(t,e,()=>{let{node:s}=t.docView.domFromPos(i.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=YO(t,i.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=Es(u,0,u.nodeValue.length).getClientRects();else continue;for(let h=0;h<c.length;h++){let d=c[h];if(d.bottom>d.top+1&&(n=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const B7=/[\u0590-\u08ac]/;function V7(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,u=t.domSelection();return u?!B7.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?s:o:QO(t,e,()=>{let{focusNode:c,focusOffset:h,anchorNode:d,anchorOffset:g}=t.domSelectionRange(),y=u.caretBidiLevel;u.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:k,focusOffset:E}=t.domSelectionRange(),N=k&&!b.contains(k.nodeType==1?k:k.parentNode)||c==k&&h==E;try{u.collapse(d,g),c&&(c!=d||h!=g)&&u.extend&&u.extend(c,h)}catch{}return y!=null&&(u.caretBidiLevel=y),N}):r.pos==r.start()||r.pos==r.end()}let dA=null,mA=null,gA=!1;function F7(t,e,n){return dA==e&&mA==n?gA:(dA=e,mA=n,gA=n=="up"||n=="down"?L7(t,e,n):V7(t,e,n))}const ti=0,yA=1,zo=2,$i=3;class Wh{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=ti,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let 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 i;if(e==this.dom&&this.contentDOM)i=n>dn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let u=i.children[o];if(u.size){i=u;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],u=s+o.size;if(u>e||o instanceof XO){i=e-s;break}s=u}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof WO&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?dn(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?dn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,u=0;;u++){let c=this.children[u],h=o+c.size;if(i==-1&&e<=h){let d=o+c.border;if(e>=d&&n<=h-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,d);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)){i=dn(y.dom)+1;break}e-=y.size}i==-1&&(i=0)}if(i>-1&&(h>n||u==this.children.length-1)){n=h;for(let d=u+1;d<this.children.length;d++){let g=this.children[d];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(-1)){s=dn(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:i,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:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let b=0,k=0;b<this.children.length;b++){let E=this.children[b],N=k+E.size;if(s>k&&o<N)return E.setSelection(e-k-E.border,n-k-E.border,r,i);k=N}let u=this.domFromPos(e,e?-1:1),c=n==e?u:this.domFromPos(n,n?-1:1),h=r.root.getSelection(),d=r.domSelectionRange(),g=!1;if((ei||kn)&&e==n){let{node:b,offset:k}=u;if(b.nodeType==3){if(g=!!(k&&b.nodeValue[k-1]==`
41
+ `),g&&k==b.nodeValue.length)for(let E=b,N;E;E=E.parentNode){if(N=E.nextSibling){N.nodeName=="BR"&&(u=c={node:N.parentNode,offset:dn(N)+1});break}let M=E.pmViewDesc;if(M&&M.node&&M.node.isBlock)break}}else{let E=b.childNodes[k-1];g=E&&(E.nodeName=="BR"||E.contentEditable=="false")}}if(ei&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let b=d.focusNode.childNodes[d.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||g&&kn)&&al(u.node,u.offset,d.anchorNode,d.anchorOffset)&&al(c.node,c.offset,d.focusNode,d.focusOffset))return;let y=!1;if((h.extend||e==n)&&!(g&&ei)){h.collapse(u.node,u.offset);try{e!=n&&h.extend(c.node,c.offset),y=!0}catch{}}if(!y){if(e>n){let k=u;u=c,c=k}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 r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let u=r+s.border,c=o-s.border;if(e>=u&&n<=c){this.dirty=e==r||n==o?zo:yA,e==u&&n==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=$i:s.markDirty(e-u,n-u);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?zo:$i}r=o}this.dirty=zo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?zo:yA;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class WO extends Wh{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;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==ti&&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 P7 extends Wh{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ol extends Wh{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Yi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ol(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&$i||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$i&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ti){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ti}}slice(e,n,r){let i=ol.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=gb(s,n,o,r)),e>0&&(s=gb(s,0,e,r));for(let u=0;u<s.length;u++)s[u].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ja extends Wh{constructor(e,n,r,i,s,o,u,c,h){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=u}static create(e,n,r,i,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)},r,i),d=h&&h.dom,g=h&&h.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:g}=Yi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!g&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let y=d;return d=t3(d,r,n),h?c=new j7(e,n,r,i,d,g||null,y,h,s,o+1):n.isText?new Tg(e,n,r,i,d,y,s):new ja(e,n,r,i,d,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 r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Q.empty)}return e}matchesNode(e,n,r){return this.dirty==ti&&e.eq(this.node)&&_m(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,u=s&&s.pos<0,c=new U7(this,o&&o.node,e);H7(this.node,this.innerDeco,(h,d,g)=>{h.spec.marks?c.syncToMarks(h.spec.marks,r,e,d):h.type.side>=0&&!g&&c.syncToMarks(d==this.node.childCount?ct.none:this.node.child(d).marks,r,e,d),c.placeWidget(h,e,i)},(h,d,g,y)=>{c.syncToMarks(h.marks,r,e,y);let b;c.findNodeMatch(h,d,g,y)||u&&e.state.selection.from>i&&e.state.selection.to<i+h.nodeSize&&(b=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(h,d,g,b,e)||c.updateNextNode(h,d,g,e,y,i)||c.addNode(h,d,g,e,i),i+=h.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==zo)&&(o&&this.protectLocalComposition(e,o),ZO(this.contentDOM,this.children,e),Bu&&K7(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Ae)||r<n||i>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=G7(this.node.content,o,r-n,i-n);return u<0?null:{node:s,pos:u,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){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 P7(this,s,n,i);e.input.compositionNodes.push(o),this.children=gb(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==$i||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ti}updateOuterDeco(e){if(_m(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=e3(this.dom,this.nodeDOM,mb(this.outerDeco,this.node,n),mb(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.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 xA(t,e,n,r,i){t3(r,e,t);let s=new ja(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Tg extends ja{constructor(e,n,r,i,s,o,u){super(e,n,r,i,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,r,i){return this.dirty==$i||this.dirty!=ti&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ti||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ti,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Tg(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=$i)}get domAtom(){return!1}isText(e){return this.node.text==e}}class XO extends Wh{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ti&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class j7 extends ja{constructor(e,n,r,i,s,o,u,c,h,d){super(e,n,r,i,s,o,u,h,d),this.spec=c}update(e,n,r,i){if(this.dirty==$i)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ZO(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],u=o.dom;if(u.parentNode==t){for(;u!=r;)r=bA(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(u,r);if(o instanceof ol){let c=r?r.previousSibling:t.lastChild;ZO(o.contentDOM,o.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=bA(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Jf=function(t){t&&(this.nodeName=t)};Jf.prototype=Object.create(null);const Lo=[new Jf];function mb(t,e,n){if(t.length==0)return Lo;let r=n?Lo[0]:new Jf,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Jf(o.nodeName));for(let u in o){let c=o[u];c!=null&&(n&&i.length==1&&i.push(r=new Jf(e.isInline?"span":"div")),u=="class"?r.class=(r.class?r.class+" ":"")+c:u=="style"?r.style=(r.style?r.style+";":"")+c:u!="nodeName"&&(r[u]=c))}}}return i}function e3(t,e,n,r){if(n==Lo&&r==Lo)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],u=n[s];if(s){let c;u&&u.nodeName==o.nodeName&&i!=t&&(c=i.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(i),u=Lo[0]),i=c}$7(i,u||Lo[0],o)}return i}function $7(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function t3(t,e,n){return e3(t,t,Lo,mb(e,n,t.nodeType!=1))}function _m(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 bA(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class U7{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=J7(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){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=ti,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;i<this.preMatch.index&&(h=Math.min(this.index+3,h));for(let d=this.index;d<h;d++){let g=this.top.children[d];if(g.matchesMark(e[o])&&!this.isLocked(g.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=ol.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))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,r)&&!this.preMatch.matched.has(h)){s=u;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==$i&&o.dom==o.contentDOM&&(o.dirty=zo),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let u=this.index;u<this.top.children.length;u++){let c=this.top.children[u];if(c instanceof ja){let h=this.preMatch.matched.get(c);if(h!=null&&h!=s)return!1;let d=c.dom,g,y=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=$i&&_m(n,c.outerDeco));if(!y&&c.update(e,n,r,i))return this.destroyBetween(this.index,u),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!y&&(g=this.recreateWrapper(c,e,n,r,i,o)))return this.destroyBetween(this.index,u),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=zo,g.updateChildren(i,o+1),g.dirty=ti),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!_m(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let u=ja.create(this.top,n,r,i,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,r,i,s){let o=ja.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new WO(this.top,e,n,r);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 ol;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Tg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((kn||mn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new XO(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function J7(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let u;for(;;)if(r){let h=n.children[r-1];if(h instanceof ol)n=h,r=h.children.length;else{u=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=u.node;if(c){if(c!=t.child(i-1))break;--i,s.set(u,i),o.push(u)}}return{index:i,matched:s,matches:o.reverse()}}function q7(t,e){return t.type.side-e.type.side}function H7(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let h=0;h<t.childCount;h++){let d=t.child(h);r(d,i,e.forChild(s,d),h),s+=d.nodeSize}return}let o=0,u=[],c=null;for(let h=0;;){let d,g;for(;o<i.length&&i[o].to==s;){let N=i[o++];N.widget&&(d?(g||(g=[d])).push(N):d=N)}if(d)if(g){g.sort(q7);for(let N=0;N<g.length;N++)n(g[N],h,!!c)}else n(d,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 N=0;N<u.length;N++)u[N].to<=s&&u.splice(N--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)u.push(i[o++]);let k=s+y.nodeSize;if(y.isText){let N=k;o<i.length&&i[o].from<N&&(N=i[o].from);for(let M=0;M<u.length;M++)u[M].to<N&&(N=u[M].to);N<k&&(c=y.cut(N-s),y=y.cut(0,N-s),k=N,b=-1)}else for(;o<i.length&&i[o].to<k;)o++;let E=y.isInline&&!y.isLeaf?u.filter(N=>!N.inline):u.slice();r(y,E,e.forChild(s,y),b),s=k}}function K7(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 G7(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),u=s;if(s+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<t.childCount;){let h=t.child(i++);if(s+=h.nodeSize,!h.isText)break;c+=h.text}if(s>=n){if(s>=r&&c.slice(r-e.length-u,r-u)==e)return r-e.length;let h=u<r?c.lastIndexOf(e,r-u-1):-1;if(h>=0&&h+e.length+u>=n)return u+h;if(n==r&&c.length>=r+e.length-u&&c.slice(r-u,r-u+e.length)==e)return r}}return-1}function gb(t,e,n,r,i){let s=[];for(let o=0,u=0;o<t.length;o++){let c=t[o],h=u,d=u+=c.size;h>=n||d<=e?s.push(c):(h<e&&s.push(c.slice(0,e-h,r)),i&&(s.push(i),i=void 0),d>n&&s.push(c.slice(n-h,c.size,r)))}return s}function BS(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=r.resolve(o),c,h;if(Ng(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&ye.isSelectable(g)&&i.parent&&!(g.isInline&&v7(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new ye(o==y?u:r.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 k=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(k.startContainer,k.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(k.endContainer,k.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=VS(t,d,u,g)}return h}function n3(t){return t.editable?t.hasFocus():i3(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ds(t,e=!1){let n=t.state.selection;if(r3(t,n),!!n3(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&mn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&al(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Q7(t);else{let{anchor:r,head:i}=n,s,o;SA&&!(n instanceof Ae)&&(n.$from.parent.inlineContent||(s=vA(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=vA(t,n.to))),t.docView.setSelection(r,i,t,e),SA&&(s&&kA(s),o&&kA(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Y7(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const SA=kn||mn&&UO<63;function vA(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(kn&&i&&i.contentEditable=="false")return _1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return _1(i);if(s)return _1(s)}}function _1(t){return t.contentEditable="true",kn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function kA(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Y7(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!n3(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Q7(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,dn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ur&&Pa<=11&&(n.disabled=!0,n.disabled=!1)}function r3(t,e){if(e instanceof ye){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(CA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else CA(t)}function CA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function VS(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Ae.between(e,n,r)}function wA(t){return t.editable&&!t.hasFocus()?!1:i3(t)}function i3(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 W7(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return al(e.node,e.offset,n.anchorNode,n.anchorOffset)}function yb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ve.findFrom(s,e)}function Ma(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function EA(t,e,n){let r=t.state.selection;if(r instanceof Ae)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ma(t,new Ae(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=yb(t.state,e);return i&&i instanceof ye?Ma(t,i):!1}else if(!(Gr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ye.isSelectable(s)?Ma(t,new ye(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Qh?Ma(t,new Ae(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ye&&r.node.isInline)return Ma(t,new Ae(e>0?r.$to:r.$from));{let i=yb(t.state,e);return i?Ma(t,i):!1}}}function zm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qf(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ou(t,e){return e<0?X7(t):Z7(t)}function X7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(ei&&n.nodeType==1&&r<zm(n)&&qf(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(qf(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(s3(n))break;{let u=n.previousSibling;for(;u&&qf(u,-1);)i=n.parentNode,s=dn(u),u=u.previousSibling;if(u)n=u,r=zm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?xb(t,n,r):i&&xb(t,i,s)}function Z7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=zm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(qf(u,1))s=n,o=++r;else break}else{if(s3(n))break;{let u=n.nextSibling;for(;u&&qf(u,1);)s=u.parentNode,o=dn(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=zm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&xb(t,s,o)}function s3(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function eV(t,e){for(;t&&e==t.childNodes.length&&!Yh(t);)e=dn(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 tV(t,e){for(;t&&!e&&!Yh(t);)e=dn(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 xb(t,e,n){if(e.nodeType!=3){let s,o;(o=eV(e,n))?(e=o,n=0):(s=tV(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ng(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Ds(t)},50)}function AA(t,e){let n=t.state.doc.resolve(e);if(!(mn||JO)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function NA(t,e,n){let r=t.state.selection;if(r instanceof Ae&&!r.empty||n.indexOf("s")>-1||Gr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=yb(t.state,e);if(o&&o instanceof ye)return Ma(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Ma(t,u):!1}return!1}function TA(t,e){if(!(t.state.selection instanceof Ae))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let 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 MA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function nV(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 r=e.firstChild;MA(t,r,"true"),setTimeout(()=>MA(t,r,"false"),20)}return!1}function rV(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function iV(t,e){let n=e.keyCode,r=rV(e);if(n==8||Gr&&n==72&&r=="c")return TA(t,-1)||ou(t,-1);if(n==46&&!e.shiftKey||Gr&&n==68&&r=="c")return TA(t,1)||ou(t,1);if(n==13||n==27)return!0;if(n==37||Gr&&n==66&&r=="c"){let i=n==37?AA(t,t.state.selection.from)=="ltr"?-1:1:-1;return EA(t,i,r)||ou(t,i)}else if(n==39||Gr&&n==70&&r=="c"){let i=n==39?AA(t,t.state.selection.from)=="ltr"?1:-1:1;return EA(t,i,r)||ou(t,i)}else{if(n==38||Gr&&n==80&&r=="c")return NA(t,-1,r)||ou(t,-1);if(n==40||Gr&&n==78&&r=="c")return nV(t)||NA(t,1,r)||ou(t,1);if(r==(Gr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function FS(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Yi.fromSchema(t.state.schema),u=f3(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=c3[h.nodeName.toLowerCase()]);){for(let b=d.length-1;b>=0;b--){let k=u.createElement(d[b]);for(;c.firstChild;)k.appendChild(c.firstChild);c.appendChild(k),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${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 a3(t,e,n,r,i){let s=i.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return u=new H(Q.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,i,r,t));if(g)u=g;else{let y=i.marks(),{schema:b}=t.state,k=Yi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let N=o.appendChild(document.createElement("p"));E&&N.appendChild(k.serializeNode(b.text(E,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=lV(n),Qh&&uV(o);let h=o&&o.querySelector("[data-pm-slice]"),d=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let g=+d[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")||Ja.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!sV.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=cV(OA(u,+d[1],+d[2]),d[4]);else if(u=H.maxOpen(aV(u.content,i),!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=OA(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const sV=/^(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 aV(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=i.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&l3(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=u3(o[o.length-1],s.length));let d=o3(u,c);o.push(d),i=i.matchType(d.type),s=c}}),o)return Q.from(o)}return t}function o3(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Q.from(t));return t}function l3(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=l3(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(Q.from(o3(n,t,i+1))))}}function u3(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,u3(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Q.empty,!0);return t.copy(n.append(r))}function bb(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),i<r-1&&(u=bb(u,e,n,r,i+1,s)),i>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(Q.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function OA(t,e,n){return e<t.openStart&&(t=new H(bb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(bb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const c3={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 RA=null;function f3(){return RA||(RA=document.implementation.createHTMLDocument("title"))}let z1=null;function oV(t){let e=window.trustedTypes;return e?(z1||(z1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),z1.createHTML(t)):t}function lV(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=f3().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&c3[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=oV(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function uV(t){let e=t.querySelectorAll(mn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function cV(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=Q.from(c.create(r[u+1],i)),s++,o++}return new H(i,s,o)}const Gn={},Yn={},fV={touchstart:!0,touchmove:!0};class hV{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 pV(t){for(let e in Gn){let n=Gn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{mV(t,r)&&!PS(t,r)&&(t.editable||!(r.type in Yn))&&n(t,r)},fV[e]?{passive:!0}:void 0)}kn&&t.dom.addEventListener("input",()=>null),Sb(t)}function za(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function dV(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 Sb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>PS(t,r))})}function PS(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function mV(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 gV(t,e){!PS(t,e)&&Gn[e.type]&&(t.editable||!(e.type in Yn))&&Gn[e.type](t,e)}Yn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!p3(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Os&&mn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Bu&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Do(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||iV(t,n)?n.preventDefault():za(t,"key")};Yn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Yn.keypress=(t,e)=>{let n=e;if(p3(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Mg(t){return{left:t.clientX,top:t.clientY}}function yV(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function jS(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);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),i,!0):u(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Tu(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function xV(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ye.isSelectable(r)?(Tu(t,new ye(n)),!0):!1}function bV(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ye&&(r=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)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Tu(t,ye.create(t.state.doc,i)),!0):!1}function SV(t,e,n,r,i){return jS(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?bV(t,n):xV(t,n))}function vV(t,e,n,r){return jS(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function kV(t,e,n,r){return jS(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||CV(t,n,r)}function CV(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Tu(t,Ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(o.inlineContent)Tu(t,Ae.create(r,u+1,u+1+o.content.size));else if(ye.isSelectable(o))Tu(t,ye.create(r,u));else continue;return!0}}function $S(t){return Lm(t)}const h3=Gr?"metaKey":"ctrlKey";Gn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=$S(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&yV(n,t.input.lastClick)&&!n[h3]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Mg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new wV(t,o,n,!!r)):(s=="doubleClick"?vV:kV)(t,o.pos,o.inside,n)?n.preventDefault():za(t,"pointer"))};let wV=class{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[h3],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,o=d.depth?d.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(r.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&&ei&&!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)),za(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(()=>Ds(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(Mg(e))),this.updateAllowDefault(e),this.allowDefault||!n?za(this.view,"pointer"):SV(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||kn&&this.mightDrag&&!this.mightDrag.node.isAtom||mn&&!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)?(Tu(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):za(this.view,"pointer")}move(e){this.updateAllowDefault(e),za(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)}};Gn.touchstart=t=>{t.input.lastTouch=Date.now(),$S(t),za(t,"pointer")};Gn.touchmove=t=>{t.input.lastTouch=Date.now(),za(t,"pointer")};Gn.contextmenu=t=>$S(t);function p3(t,e){return t.composing?!0:kn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const EV=Os?5e3:-1;Yn.compositionstart=Yn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||mn&&JO&&AV(t)))t.markCursor=t.state.storedMarks||n.marks(),Lm(t,!0),t.markCursor=null;else if(Lm(t,!e.selection.empty),ei&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}d3(t,EV)};function AV(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Yn.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++,d3(t,20))};function d3(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Lm(t),e))}function m3(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=TV());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function NV(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=b7(e.focusNode,e.focusOffset),r=S7(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function TV(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Lm(t,e=!1){if(!(Os&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),m3(t),e||t.docView&&t.docView.dirty){let n=BS(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function MV(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const xh=ur&&Pa<15||Bu&&w7<604;Gn.copy=Yn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=xh?null:n.clipboardData,o=r.content(),{dom:u,text:c}=FS(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):MV(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function OV(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function RV(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?bh(t,r.value,null,i,e):bh(t,r.textContent,r.innerHTML,i,e)},50)}function bh(t,e,n,r,i){let s=a3(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||H.empty)))return!0;if(!s)return!1;let o=OV(s),u=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function g3(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," "):""}Yn.paste=(t,e)=>{let n=e;if(t.composing&&!Os)return;let r=xh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&bh(t,g3(r),r.getData("text/html"),i,n)?n.preventDefault():RV(t,n)};let y3=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const DV=Gr?"altKey":"ctrlKey";function x3(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[DV]}Gn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Mg(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ye?i.to-1:i.to))){if(r&&r.mightDrag)o=ye.create(t.state.doc,r.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:d}=FS(t,u);(!n.dataTransfer.files.length||!mn||UO>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(xh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",xh||n.dataTransfer.setData("text/plain",h),t.dragging=new y3(d,x3(t,n),o)};Gn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Yn.dragover=Yn.dragenter=(t,e)=>e.preventDefault();Yn.drop=(t,e)=>{try{IV(t,e,t.dragging)}finally{t.dragging=null}};function IV(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Mg(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=a3(t,g3(e.dataTransfer),xh?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&x3(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?d7(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(d?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(d&&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((k,E,N,M)=>b=M),c.setSelection(VS(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Gn.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())&&Ds(t)},20))};Gn.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)};Gn.beforeinput=(t,e)=>{if(mn&&Os&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Do(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Yn)Gn[t]=Yn[t];function Sh(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 DA=class b3{constructor(e,n){this.toDOM=e,this.spec=n||Uo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Ka(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof b3&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Sh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Hf=class vb{constructor(e,n){this.attrs=e,this.spec=n||Uo}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ka(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof vb&&Sh(this.attrs,e.attrs)&&Sh(this.spec,e.spec)}static is(e){return e.type instanceof vb}destroy(){}},_V=class S3{constructor(e,n){this.attrs=e,this.spec=n||Uo}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Ka(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof S3&&Sh(this.attrs,e.attrs)&&Sh(this.spec,e.spec)}destroy(){}},Ka=class wf{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new wf(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new wf(e,e,new DA(n,r))}static inline(e,n,r,i){return new wf(e,n,new Hf(r,i))}static node(e,n,r,i){return new wf(e,n,new _V(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Hf}get widget(){return this.type instanceof DA}};const mu=[],Uo={};let ni=class Aa{constructor(e,n){this.local=e.length?e:mu,this.children=n.length?n:mu}static create(e,n){return n.length?Bm(n,e,0,Uo):bn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,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))&&r.push(u.copy(u.from+i,u.to+i))}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,r,i+u,s)}}map(e,n,r){return this==bn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Uo)}mapInner(e,n,r,i,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?zV(this.children,o||[],e,n,r,i,s):o?new Aa(o.sort(Jo),mu):bn}add(e,n){return n.length?this==bn?Aa.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,d;if(d=C3(n,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,d,h+1):i.splice(s,0,c,c+u.nodeSize,Bm(d,u,h+1,Uo)),s+=3}});let o=k3(s?w3(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new Aa(o.length?this.local.concat(o).sort(Jo):this.local,i||this.children)}remove(e){return e.length==0||this==bn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,u=r[s]+n,c=r[s+1]+n;for(let d=0,g;d<e.length;d++)(g=e[d])&&g.from>u&&g.to<c&&(e[d]=null,(o||(o=[])).push(g));if(!o)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(o,u+1);h!=bn?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<i.length;u++)i[u].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Aa(i,r):bn}forChild(e,n){if(this==bn)return this;if(n.isLeaf)return Aa.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=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 Hf){let h=Math.max(s,c.from)-s,d=Math.min(o,c.to)-s;h<d&&(i||(i=[])).push(c.copy(h,d))}}if(i){let u=new Aa(i.sort(Jo),mu);return r?new v3([u,r]):u}return r||bn}eq(e){if(this==e)return!0;if(!(e instanceof Aa)||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 US(this.localsInner(e))}localsInner(e){if(this==bn)return mu;if(e.inlineContent||!this.local.some(Hf.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Hf||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ni.empty=new ni([],[]);ni.removeOverlap=US;const bn=ni.empty;let v3=class gu{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Uo));return gu.from(r)}forChild(e,n){if(n.isLeaf)return ni.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=bn&&(s instanceof gu?r=r.concat(s.members):r.push(s))}return gu.from(r)}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,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?US(r?n:n.sort(Jo)):mu}static from(e){switch(e.length){case 0:return bn;case 1:return e[0];default:return new gu(e.every(n=>n instanceof ni)?e:e.reduce((n,r)=>n.concat(r instanceof ni?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function zV(t,e,n,r,i,s,o){let u=t.slice();for(let h=0,d=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,k,E)=>{let N=E-k-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+d-g)continue;let P=u[M]+d-g;b>=P?u[M+1]=y<=P?-2:-1:y>=d&&N&&(u[M]+=N,u[M+1]+=N)}g+=N}),d=n.maps[h].map(d,-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 d=n.map(t[h]+s),g=d-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-i,{index:k,offset:E}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&E==g&&E+N.nodeSize==b){let M=u[h+2].mapInner(n,N,d+1,t[h]+s+1,o);M!=bn?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=LV(u,t,e,n,i,s,o),d=Bm(h,r,0,o);e=d.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<d.children.length;g+=3){let b=d.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,d.children[g],d.children[g+1],d.children[g+2])}}return new ni(e.sort(Jo),u)}function k3(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Ka(i.from+e,i.to+e,i.type))}return n}function LV(t,e,n,r,i,s,o){function u(c,h){for(let d=0;d<c.local.length;d++){let g=c.local[d].map(r,i,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)u(c.children[d+2],c.children[d]+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 C3(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function w3(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Bm(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=C3(t,u,c+n);if(h){s=!0;let d=Bm(h,u,n+c+1,r);d!=bn&&i.push(c,c+u.nodeSize,d)}});let o=k3(s?w3(t):t,-n).sort(Jo);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(r.onRemove&&r.onRemove(o[u].spec),o.splice(u--,1));return o.length||i.length?new ni(o,i):bn}function Jo(t,e){return t.from-e.from||t.to-e.to}function US(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),IA(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),IA(e,i,r.copy(s.from,r.to)));break}}}return e}function IA(t,e,n){for(;e<t.length&&Jo(n,t[e])>0;)e++;t.splice(e,0,n)}function L1(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=bn&&e.push(r)}),t.cursorWrapper&&e.push(ni.create(t.state.doc,[t.cursorWrapper.deco])),v3.from(e)}const BV={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},VV=ur&&Pa<=11;class FV{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 PV{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new FV,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ur&&Pa<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():kn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),VV&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,BV)),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(wA(this.view)){if(this.suppressingSelectionUpdates)return Ds(this.view);if(ur&&Pa<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&al(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Lu(s))n.add(s);for(let s=e.anchorNode;s;s=Lu(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&wA(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,u=!1,c=[];if(e.editable)for(let d=0;d<n.length;d++){let g=this.registerMutation(n[d],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(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let g=d.nextSibling;for(;g&&g.nodeType==1;){if(g.contentEditable=="false"){d.parentNode.removeChild(d);break}g=g.firstChild}}}else if(ei&&c.length){let d=c.filter(g=>g.nodeName=="BR");if(d.length==2){let[g,y]=d;g.parentNode&&g.parentNode.parentNode==y.parentNode?y.remove():g.remove()}else{let{focusNode:g}=this.currentSelection;for(let y of d){let b=y.parentNode;b&&b.nodeName=="LI"&&(!g||UV(e,g)!=b)&&y.remove()}}}let h=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ng(r)&&(h=BS(e))&&h.eq(Ve.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ds(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),jV(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,JV(e,c)),this.handleDOMChange(s,o,u,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ds(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let g=e.addedNodes[d];n.push(g),g.nodeType==3&&(this.lastChangedTextNode=g)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ur&&Pa<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:g,nextSibling:y}=e.addedNodes[d];(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(i=g),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(s=y)}let o=i&&i.parentNode==e.target?dn(i)+1:0,u=r.localPosFromDOM(e.target,o,-1),c=s&&s.parentNode==e.target?dn(s):e.target.childNodes.length,h=r.localPosFromDOM(e.target,c,1);return{from:u,to:h}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let _A=new WeakMap,zA=!1;function jV(t){if(!_A.has(t)&&(_A.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ei,zA)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."),zA=!0}}function LA(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return al(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function $V(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return LA(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?LA(t,n):null}function UV(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function JV(t,e){var n;let{focusNode:r,focusOffset:i}=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),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function qV(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:u}=t.docView.parseRange(e,n),c=t.domSelectionRange(),h,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(h=[{node:d,offset:c.anchorOffset}],Ng(c)||h.push({node:c.focusNode,offset:c.focusOffset})),mn&&t.input.lastKeyCode===8)for(let N=s;N>i;N--){let M=r.childNodes[N-1],j=M.pmViewDesc;if(M.nodeName=="BR"&&!j){s=N;break}if(!j||j.size)break}let g=t.state.doc,y=t.someProp("domParser")||Ja.fromSchema(t.state.schema),b=g.resolve(o),k=null,E=y.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:s,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:HV,context:b});if(h&&h[0].pos!=null){let N=h[0].pos,M=h[1]&&h[1].pos;M==null&&(M=N),k={anchor:N+o,head:M+o}}return{doc:E,sel:k,from:o,to:u}}function HV(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 KV=/^(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 GV(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let z=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,G=BS(t,z);if(G&&!t.state.selection.eq(G)){if(mn&&Os&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",K=>K(t,Do(13,"Enter"))))return;let J=t.state.tr.setSelection(G);z=="pointer"?J.setMeta("pointer",!0):z=="key"&&J.scrollIntoView(),s&&J.setMeta("composition",s),t.dispatch(J)}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=qV(t,e,n),d=t.state.doc,g=d.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 k=WV(g.content,h.doc.content,h.from,y,b);if(k&&t.input.domChangeCount++,(Bu&&t.input.lastIOSEnter>Date.now()-225||Os)&&i.some(z=>z.nodeType==1&&!KV.test(z.nodeName))&&(!k||k.endA>=k.endB)&&t.someProp("handleKeyDown",z=>z(t,Do(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!k)if(r&&c instanceof Ae&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))k={start:c.from,endA:c.to,endB:c.to};else{if(h.sel){let z=BA(t,t.state.doc,h.sel);if(z&&!z.eq(t.state.selection)){let G=t.state.tr.setSelection(z);s&&G.setMeta("composition",s),t.dispatch(G)}}return}t.state.selection.from<t.state.selection.to&&k.start==k.endB&&t.state.selection instanceof Ae&&(k.start>t.state.selection.from&&k.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?k.start=t.state.selection.from:k.endA<t.state.selection.to&&k.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(k.endB+=t.state.selection.to-k.endA,k.endA=t.state.selection.to)),ur&&Pa<=11&&k.endB==k.start+1&&k.endA==k.start&&k.start>h.from&&h.doc.textBetween(k.start-h.from-1,k.start-h.from+1)=="  "&&(k.start--,k.endA--,k.endB--);let E=h.doc.resolveNoCache(k.start-h.from),N=h.doc.resolveNoCache(k.endB-h.from),M=d.resolve(k.start),j=E.sameParent(N)&&E.parent.inlineContent&&M.end()>=k.endA;if((Bu&&t.input.lastIOSEnter>Date.now()-225&&(!j||i.some(z=>z.nodeName=="DIV"||z.nodeName=="P"))||!j&&E.pos<h.doc.content.size&&(!E.sameParent(N)||!E.parent.inlineContent)&&E.pos<N.pos&&!/\S/.test(h.doc.textBetween(E.pos,N.pos,"","")))&&t.someProp("handleKeyDown",z=>z(t,Do(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>k.start&&QV(d,k.start,k.endA,E,N)&&t.someProp("handleKeyDown",z=>z(t,Do(8,"Backspace")))){Os&&mn&&t.domObserver.suppressSelectionUpdates();return}mn&&k.endB==k.start&&(t.input.lastChromeDelete=Date.now()),Os&&!j&&E.start()!=N.start()&&N.parentOffset==0&&E.depth==N.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==k.endA&&(k.endB-=2,N=h.doc.resolveNoCache(k.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(z){return z(t,Do(13,"Enter"))})},20));let P=k.start,U=k.endA,L=z=>{let G=z||t.state.tr.replace(P,U,h.doc.slice(k.start-h.from,k.endB-h.from));if(h.sel){let J=BA(t,G.doc,h.sel);J&&!(mn&&t.composing&&J.empty&&(k.start!=k.endB||t.input.lastChromeDelete<Date.now()-100)&&(J.head==P||J.head==G.mapping.map(U)-1)||ur&&J.empty&&J.head==P)&&G.setSelection(J)}return s&&G.setMeta("composition",s),G.scrollIntoView()},C;if(j)if(E.pos==N.pos){ur&&Pa<=11&&E.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ds(t),20));let z=L(t.state.tr.delete(P,U)),G=d.resolve(k.start).marksAcross(d.resolve(k.endA));G&&z.ensureMarks(G),t.dispatch(z)}else if(k.endA==k.endB&&(C=YV(E.parent.content.cut(E.parentOffset,N.parentOffset),M.parent.content.cut(M.parentOffset,k.endA-M.start())))){let z=L(t.state.tr);C.type=="add"?z.addMark(P,U,C.mark):z.removeMark(P,U,C.mark),t.dispatch(z)}else if(E.parent.child(E.index()).isText&&E.index()==N.index()-(N.textOffset?0:1)){let z=E.parent.textBetween(E.parentOffset,N.parentOffset),G=()=>L(t.state.tr.insertText(z,P,U));t.someProp("handleTextInput",J=>J(t,P,U,z,G))||t.dispatch(G())}else t.dispatch(L());else t.dispatch(L())}function BA(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:VS(t,e.resolve(n.anchor),e.resolve(n.head))}function YV(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,u,c;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);if(i.length==1&&s.length==0)u=i[0],o="add",c=d=>d.mark(u.addToSet(d.marks));else if(i.length==0&&s.length==1)u=s[0],o="remove",c=d=>d.mark(u.removeFromSet(d.marks));else return null;let h=[];for(let d=0;d<e.childCount;d++)h.push(c(e.child(d)));if(Q.from(h).eq(t))return{mark:u,type:o}}function QV(t,e,n,r,i){if(n-e<=i.pos-r.pos||B1(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.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(B1(s,!0,!0));return!o.parent.isTextblock||o.pos>n||B1(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function B1(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function WV(t,e,n,r,i){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(i=="end"){let c=Math.max(0,s-Math.min(o,u));r-=o+c-s}if(o<s&&t.size<e.size){let c=r<=s&&r>=o?s-r:0;s-=c,s&&s<e.size&&VA(e.textBetween(s-1,s+1))&&(s+=c?1:-1),u=s+(u-o),o=s}else if(u<s){let c=r<=s&&r>=u?s-r:0;s-=c,s&&s<t.size&&VA(t.textBetween(s-1,s+1))&&(s+=c?1:-1),o=s+(o-u),u=s}return{start:s,endA:o,endB:u}}function VA(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 E3{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 hV,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(UA),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=jA(this),PA(this),this.nodeViews=$A(this),this.docView=xA(this.state.doc,FA(this),L1(this),this.dom,this),this.domObserver=new PV(this,(r,i,s,o)=>GV(this,r,i,s,o)),this.domObserver.start(),pV(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&&Sb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(UA),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(m3(this),o=!0),this.state=e;let u=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(u||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=$A(this);ZV(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&Sb(this),this.editable=jA(this),PA(this);let c=L1(this),h=FA(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",g=s||!this.docView.matchesNode(e.doc,h,c);(g||!e.selection.eq(i.selection))&&(o=!0);let y=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&N7(this);if(o){this.domObserver.stop();let b=g&&(ur||mn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&XV(i.selection,e.selection);if(g){let k=mn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=NV(this)),(s||!this.docView.update(e.doc,h,c,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=xA(e.doc,h,c,this.dom,this)),k&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&W7(this))?Ds(this,b):(r3(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():y&&T7(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&&hA(this,n.getBoundingClientRect(),e)}else hA(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new y3(e.slice,e.move,i<0?void 0:ye.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let u=this.directPlugins[o].props[e];if(u!=null&&(i=n?n(u):u))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let u=s[o].props[e];if(u!=null&&(i=n?n(u):u))return i}}hasFocus(){if(ur){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&&M7(this.dom),Ds(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 _7(this,e)}coordsAtPos(e,n=1){return YO(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return F7(this,n||this.state,e)}pasteHTML(e,n){return bh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return bh(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return FS(this,e)}destroy(){this.docView&&(dV(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],L1(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,y7())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return gV(this,e)}domSelectionRange(){let e=this.domSelection();return e?kn&&this.root.nodeType===11&&k7(this.dom.ownerDocument)==this.dom&&$V(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}E3.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function FA(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ka.node(0,t.state.doc.content.size,e)]}function PA(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:Ka.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function jA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function XV(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 $A(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function ZV(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function UA(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 js(t,e){return t.meta={package:"@milkdown/core",group:"System",...e},t}var A3={text:(t,e,n,r)=>{const i=t.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(t,e,n,r)=>{const i=t.marker||n.options.strong||"*",s=n.enter("strong"),o=n.createTracker(r);let u=o.move(i+i);return u+=o.move(n.containerPhrasing(t,{before:u,after:i,...o.current()})),u+=o.move(i+i),s(),u},emphasis:(t,e,n,r)=>{const i=t.marker||n.options.emphasis||"*",s=n.enter("emphasis"),o=n.createTracker(r);let u=o.move(i);return u+=o.move(n.containerPhrasing(t,{before:u,after:i,...o.current()})),u+=o.move(i),s(),u}},gn=at({},"editorView"),Ef=at({},"editorState"),V1=at([],"initTimer"),JA=at({},"editor"),vh=at([],"inputRules"),Bs=at([],"prosePlugins"),kh=at([],"remarkPlugins"),Ch=at([],"nodeView"),wh=at([],"markView"),qo=at(Am().use(wm).use($x),"remark"),Kf=at({handlers:A3,encode:[]},"remarkStringifyOptions"),tm=Gi("ConfigReady");function eF(t){const e=n=>(n.record(tm),async()=>(await t(n),n.done(tm),()=>{n.clearTimer(tm)}));return js(e,{displayName:"Config"}),e}var Ho=Gi("InitReady");function tF(t){const e=n=>(n.inject(JA,t).inject(Bs,[]).inject(kh,[]).inject(vh,[]).inject(Ch,[]).inject(wh,[]).inject(Kf,{handlers:A3,encode:[]}).inject(qo,Am().use(wm).use($x)).inject(V1,[tm]).record(Ho),async()=>{await n.waitTimers(V1);const r=n.get(Kf);return n.set(qo,Am().use(wm).use($x,r)),n.done(Ho),()=>{n.remove(JA).remove(Bs).remove(kh).remove(vh).remove(Ch).remove(wh).remove(Kf).remove(qo).remove(V1).clearTimer(Ho)}});return js(e,{displayName:"Init"}),e}var Kn=Gi("SchemaReady"),F1=at([],"schemaTimer"),Is=at({},"schema"),Gf=at([],"nodes"),Yf=at([],"marks");function qA(t){return{...t,parseDOM:t.parseDOM?.map(e=>({priority:t.priority,...e}))}}var N3=t=>(t.inject(Is,{}).inject(Gf,[]).inject(Yf,[]).inject(F1,[Ho]).record(Kn),async()=>{await t.waitTimers(F1);const e=t.get(qo),n=t.get(kh).reduce((i,s)=>i.use(s.plugin,s.options),e);t.set(qo,n);const r=new m8({nodes:Object.fromEntries(t.get(Gf).map(([i,s])=>[i,qA(s)])),marks:Object.fromEntries(t.get(Yf).map(([i,s])=>[i,qA(s)]))});return t.set(Is,r),t.done(Kn),()=>{t.remove(Is).remove(Gf).remove(Yf).remove(F1).clearTimer(Kn)}});js(N3,{displayName:"Schema"});var T3=class{constructor(){this.setCtx=t=>{this.#e=t},this.chain=()=>{if(this.#e==null)throw s1();const t=this.#e,e=[],n=this.get.bind(this),r={run:()=>{const s=Uu(...e),o=t.get(gn);return s(o.state,o.dispatch,o)},inline:s=>(e.push(s),r),pipe:i.bind(this)};function i(s,o){const u=n(s);return e.push(u(o)),r}return r}}#t=new UT;#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 s1();const n=this.get(t)(e),r=this.#e.get(gn);return n(r.state,r.dispatch,r)}inline(t){if(this.#e==null)throw s1();const e=this.#e.get(gn);return t(e.state,e.dispatch,e)}};function nF(t="cmdKey"){return at((()=>()=>!1),t)}var xt=at(new T3,"commands"),P1=at([Kn],"commandsTimer"),Qf=Gi("CommandsReady"),M3=t=>{const e=new T3;return e.setCtx(t),t.inject(xt,e).inject(P1,[Kn]).record(Qf),async()=>(await t.waitTimers(P1),t.done(Qf),()=>{t.remove(xt).remove(P1).clearTimer(Qf)})};js(M3,{displayName:"Commands"});function rF(t){return t.Backspace=Uu(BB,TS,aB,hO),t}var O3=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,r])=>{if(typeof r=="function"){const i={key:n,onRun:()=>r};this.#e.push(i),e.push(()=>{this.#e=this.#e.filter(s=>s!==i)})}else this.#e.push(r),e.push(()=>{this.#e=this.#e.filter(i=>i!==r)})}),()=>{e.forEach(n=>n())}},this.addBaseKeymap=()=>{const t=rF(CB);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 r=n.sort((s,o)=>(o.priority??50)-(s.priority??50));return[e,(s,o,u)=>{const c=this.#t;if(c==null)throw bg();return Uu(...r.map(h=>h.onRun(c)))(s,o,u)}]}))}}#t=null;#e=[];get ctx(){return this.#t}},Vm=at(new O3,"keymap"),j1=at([Kn],"keymapTimer"),Wf=Gi("KeymapReady"),iF=t=>{const e=new O3;return e.setCtx(t),t.inject(Vm,e).inject(j1,[Kn]).record(Wf),async()=>(await t.waitTimers(j1),t.done(Wf),()=>{t.remove(Vm).remove(j1).clearTimer(Wf)})},nm=Gi("ParserReady"),R3=(()=>{throw bg()}),Xf=at(R3,"parser"),$1=at([],"parserTimer"),D3=t=>(t.inject(Xf,R3).inject($1,[Kn]).record(nm),async()=>{await t.waitTimers($1);const e=t.get(qo),n=t.get(Is);return t.set(Xf,o7.create(n,e)),t.done(nm),()=>{t.remove(Xf).remove($1).clearTimer(nm)}});js(D3,{displayName:"Parser"});var Zf=Gi("SerializerReady"),U1=at([],"serializerTimer"),I3=(()=>{throw bg()}),rm=at(I3,"serializer"),_3=t=>(t.inject(rm,I3).inject(U1,[Kn]).record(Zf),async()=>{await t.waitTimers(U1);const e=t.get(qo),n=t.get(Is);return t.set(rm,u7.create(n,e)),t.done(Zf),()=>{t.remove(rm).remove(U1).clearTimer(Zf)}});js(_3,{displayName:"Serializer"});var eh=at("","defaultValue"),im=at(t=>t,"stateOptions"),J1=at([],"editorStateTimer"),sm=Gi("EditorStateReady");function sF(t,e,n){if(typeof t=="string")return e(t);if(t.type==="html")return Ja.fromSchema(n).parse(t.dom);if(t.type==="json")return Rs.fromJSON(n,t.value);throw fz(t)}var aF=new hr("MILKDOWN_STATE_TRACKER"),z3=t=>(t.inject(eh,"").inject(Ef,{}).inject(im,e=>e).inject(J1,[nm,Zf,Qf,Wf]).record(sm),async()=>{await t.waitTimers(J1);const e=t.get(Is),n=t.get(Xf),r=t.get(vh),i=t.get(im),s=t.get(Bs),o=sF(t.get(eh),n,e),u=t.get(Vm),c=u.addBaseKeymap(),h=[...s,new fr({key:aF,state:{init:()=>{},apply:(y,b,k,E)=>{t.set(Ef,E)}}}),qB({rules:r}),s7(u.build())];t.set(Bs,h);const d=i({schema:e,doc:o,plugins:h}),g=_o.create(d);return t.set(Ef,g),t.done(sm),()=>{c(),t.remove(eh).remove(Ef).remove(im).remove(J1).clearTimer(sm)}});js(z3,{displayName:"EditorState"});var Eh=at([],"pasteRule"),q1=at([Kn],"pasteRuleTimer"),am=Gi("PasteRuleReady"),L3=t=>(t.inject(Eh,[]).inject(q1,[Kn]).record(am),async()=>(await t.waitTimers(q1),t.done(am),()=>{t.remove(Eh).remove(q1).clearTimer(am)}));js(L3,{displayName:"PasteRule"});var om=Gi("EditorViewReady"),H1=at([],"editorViewTimer"),K1=at({},"editorViewOptions"),th=at(null,"root"),kb=at(null,"rootDOM"),Cb=at({},"rootAttrs");function oF(t,e){const n=document.createElement("div");n.className="milkdown",t.appendChild(n),e.set(kb,n);const r=e.get(Cb);return Object.entries(r).forEach(([i,s])=>n.setAttribute(i,s)),n}function lF(t){t.classList.add("editor"),t.setAttribute("role","textbox")}var uF=new hr("MILKDOWN_VIEW_CLEAR"),B3=t=>(t.inject(th,document.body).inject(gn,{}).inject(K1,{}).inject(kb,null).inject(Cb,{}).inject(H1,[sm,am]).record(om),async()=>{await t.wait(Ho);const e=t.get(th)||document.body,n=typeof e=="string"?document.querySelector(e):e;t.update(Bs,o=>[new fr({key:uF,view:u=>{const c=n?oF(n,t):void 0;return(()=>{if(c&&n){const d=u.dom;n.replaceChild(c,d),c.appendChild(d)}})(),{destroy:()=>{c?.parentNode&&c?.parentNode.replaceChild(u.dom,c),c?.remove()}}}}),...o]),await t.waitTimers(H1);const r=t.get(Ef),i=t.get(K1),s=new E3(n,{state:r,nodeViews:Object.fromEntries(t.get(Ch)),markViews:Object.fromEntries(t.get(wh)),transformPasted:(o,u,c)=>(t.get(Eh).sort((h,d)=>(d.priority??50)-(h.priority??50)).map(h=>h.run).forEach(h=>{o=h(o,u,c)}),o),...i});return lF(s.dom),t.set(gn,s),t.done(om),()=>{s?.destroy(),t.remove(th).remove(gn).remove(K1).remove(kb).remove(Cb).remove(H1).clearTimer(om)}});js(B3,{displayName:"EditorView"});var qr=(function(t){return t.Idle="Idle",t.OnCreate="OnCreate",t.Created="Created",t.OnDestroy="OnDestroy",t.Destroyed="Destroyed",t})({}),V3=class F3{constructor(){this.enableInspector=(e=!0)=>(this.#t=e,this),this.onStatusChange=e=>(this.#n=e,this),this.config=e=>(this.#r.push(e),this),this.removeConfig=e=>(this.#r=this.#r.filter(n=>n!==e),this),this.use=e=>{const n=[e].flat();return n.flat().forEach(r=>{this.#i.set(r,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#e===qr.Created&&this.#c(n,this.#i),this},this.remove=async e=>this.#e===qr.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===qr.OnCreate?this:(this.#e===qr.Created&&await this.destroy(),this.#u(qr.OnCreate),this.#p(),this.#c([...this.#i.keys()],this.#i),await Promise.all([this.#h(this.#a),this.#h(this.#i)].flat()),this.#u(qr.Created),this),this.destroy=async(e=!1)=>this.#e===qr.Destroyed||this.#e===qr.OnDestroy?this:this.#e===qr.OnCreate?new Promise(n=>{setTimeout(()=>{n(this.destroy(e))},50)}):(e&&(this.#r=[]),this.#u(qr.OnDestroy),await this.#f([...this.#i.keys()],e),await this.#d(),this.#u(qr.Destroyed),this),this.action=e=>e(this.#l),this.inspect=()=>this.#t?[...this.#a.values(),...this.#i.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 F3}#t=!1;#e=qr.Idle;#r=[];#n=()=>{};#o=new UT;#s=new Cz;#i=new Map;#a=new Map;#l=new kz(this.#o,this.#s);#p=()=>{const e=eF(async r=>{await Promise.all(this.#r.map(i=>Promise.resolve(i(r))))}),n=[N3,D3,_3,M3,iF,L3,z3,B3,tF(this),e];this.#c(n,this.#a)};#c=(e,n)=>{e.forEach(r=>{const i=this.#l.produce(this.#t?r.meta:void 0),s=r(i);n.set(r,{ctx:i,handler:s,cleanup:void 0})})};#f=(e,n=!1)=>Promise.all([e].flat().map(async r=>{const i=this.#i.get(r)?.cleanup;return n?this.#i.delete(r):this.#i.set(r,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i}));#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,r])=>{const{ctx:i,handler:s}=r;if(!s)return;const o=await s();e.set(n,{ctx:i,handler:s,cleanup:o})});get ctx(){return this.#l}get status(){return this.#e}};function Ue(t,e){const n=nF(t),r=i=>async()=>{r.key=n,await i.wait(Qf);const s=e(i);return i.get(xt).create(n,s),r.run=o=>i.get(xt).call(t,o),()=>{i.get(xt).remove(n)}};return r}function pr(t){const e=n=>async()=>{await n.wait(Kn);const r=t(n);return n.update(vh,i=>[...i,r]),e.inputRule=r,()=>{n.update(vh,i=>i.filter(s=>s!==r))}};return e}function cF(t){const e=n=>async()=>{await n.wait(Kn);const r=t(n);return n.update(Eh,i=>[...i,r]),e.pasteRule=r,()=>{n.update(Eh,i=>i.filter(s=>s!==r))}};return e}function fF(t,e){const n=r=>async()=>{const i=e(r);return r.update(Yf,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(Yf,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Is).marks[t];if(!i)throw xz(t);return i},n}function Ju(t,e){const n=r=>async()=>{const i=e(r);return r.update(Gf,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(Gf,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Is).nodes[t];if(!i)throw yz(t);return i},n}function $s(t){let e;const n=r=>async()=>(await r.wait(Kn),e=t(r),r.update(Bs,i=>[...i,e]),()=>{r.update(Bs,i=>i.filter(s=>s!==e))});return n.plugin=()=>e,n.key=()=>e.spec.key,n}function hF(t){const e=n=>async()=>{await n.wait(Wf);const r=n.get(Vm),i=t(n),s=r.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function P3(t,e){const n=r=>async()=>{await r.wait(Kn);const i=e(r);return t.type(r)instanceof Om?r.update(Ch,s=>[...s,[t.id,i]]):r.update(wh,s=>[...s,[t.id,i]]),n.view=i,n.type=t,()=>{t.type(r)instanceof Om?r.update(Ch,s=>s.filter(o=>o[0]!==t.id)):r.update(wh,s=>s.filter(o=>o[0]!==t.id))}};return n}function Za(t,e){const n=at(t,e),r=i=>(i.inject(n),()=>()=>{i.remove(n)});return r.key=n,r}function en(t,e){const n=Za(e,t),r=Ju(t,s=>s.get(n.key)(s)),i=[n,r];return i.id=r.id,i.node=r,i.type=s=>r.type(s),i.ctx=n,i.key=n.key,i.extendSchema=s=>en(t,s(e)),i}function qu(t,e){const n=Za(e,t),r=fF(t,s=>s.get(n.key)(s)),i=[n,r];return i.id=r.id,i.mark=r,i.type=s=>r.type(s),i.ctx=n,i.key=n.key,i.extendSchema=s=>qu(t,s(e)),i}function Mr(t,e){const n=Za(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:o,priority:u}])=>[s,{shortcuts:o,priority:u}])),`${t}Keymap`),r=hF(s=>{const o=s.get(n.key),u=Object.entries(e).flatMap(([c,{command:h}])=>{const d=o[c],g=[d.shortcuts].flat(),y=d.priority;return g.map(b=>[b,{key:b,onRun:h,priority:y}])});return Object.fromEntries(u)}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}var Ai=(t,e=()=>({}))=>Za(e,`${t}Attr`),Xh=(t,e=()=>({}))=>Za(e,`${t}Attr`);function Ni(t,e,n){const r=Za({},t),i=o=>async()=>{await o.wait(Ho);const u={plugin:e(o),options:o.get(r.key)};return o.update(kh,c=>[...c,u]),()=>{o.update(kh,c=>c.filter(h=>h!==u))}},s=[r,i];return s.id=t,s.plugin=i,s.options=r,s}function ki(t,e){return n=>n.get(xt).call(t,e)}function j3(t,e=!1){return n=>{const r=n.get(gn),i=n.get(Xf)(t);if(!i)return;if(!e){const{state:c}=r;return r.dispatch(c.tr.replace(0,c.doc.content.size,new H(i.content,0,0)))}const s=n.get(Is),o=n.get(im)({schema:s,doc:i,plugins:n.get(Bs)}),u=_o.create(o);r.updateState(u)}}const $3=65535,U3=Math.pow(2,16);function pF(t,e){return t+e*U3}function HA(t){return t&$3}function dF(t){return(t-(t&$3))/U3}const J3=1,q3=2,lm=4,H3=8;let KA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&H3)>0}get deletedBefore(){return(this.delInfo&(J3|lm))>0}get deletedAfter(){return(this.delInfo&(q3|lm))>0}get deletedAcross(){return(this.delInfo&lm)>0}},ll=class yu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&yu.empty)return yu.empty}recover(e){let n=0,r=HA(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+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,r){let i=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?i:0);if(c>e)break;let h=this.ranges[u+s],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:pF(u/3,e-c),E=e==c?q3:e==g?J3:lm;return(n<0?e!=c:e!=g)&&(E|=H3),new KA(b,E,k)}i+=d-h}return r?e+i:new KA(e+i,0,null)}touches(e,n){let r=0,i=HA(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new yu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yu.empty:new yu(e<0?[0,-e,0]:[0,0,e])}};ll.empty=new ll([]);const G1=Object.create(null);let Nn=class{getMap(){return ll.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=G1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in G1)throw new RangeError("Duplicate use of step JSON ID "+e);return G1[e]=n,n.prototype.jsonID=e,n}},Un=class Af{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Af(e,null)}static fail(e){return new Af(null,e)}static fromReplace(e,n,r,i){try{return Af.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return Af.fail(s.message);throw s}}};function JS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(JS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}let K3=class Nf extends Nn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(JS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Un.fromReplace(e,this.from,this.to,s)}invert(){return new G3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Nf(n.pos,r.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))}};Nn.jsonID("addMark",K3);let G3=class Tf extends Nn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(JS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Un.fromReplace(e,this.from,this.to,r)}invert(){return new K3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Tf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Tf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Tf(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 Tf(n.from,n.to,e.markFromJSON(n.mark))}};Nn.jsonID("removeMark",G3);let Y3=class Mf extends Nn{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 r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Un.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Mf(this.pos,n.marks[i]);return new Mf(this.pos,this.mark)}}return new Q3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mf(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 Mf(n.pos,e.markFromJSON(n.mark))}};Nn.jsonID("addNodeMark",Y3);let Q3=class wb extends Nn{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 r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Un.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Y3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wb(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 wb(n.pos,e.markFromJSON(n.mark))}};Nn.jsonID("removeNodeMark",Q3);let mF=class Oo extends Nn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Eb(e,this.from,this.to)?Un.fail("Structure replace would overwrite content"):Un.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ll([this.from,this.to-this.from,this.slice.size])}invert(e){return new Oo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Oo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Oo)||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 Oo(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 Oo(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 Oo(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Nn.jsonID("replace",mF);let Og=class um extends Nn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Eb(e,this.from,this.gapFrom)||Eb(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 r=this.slice.insertAt(this.insert,n.content);return r?Un.fromReplace(e,this.from,this.to,r):Un.fail("Content does not fit in gap")}getMap(){return new ll([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 um(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new um(n.pos,r.pos,i,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 um(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Nn.jsonID("replaceAround",Og);function Eb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function gF(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function yF(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),u=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(u,c,n))return r;if(r==0||o.type.spec.isolating||!gF(o,u,c))break;u&&(i=1),c<o.childCount&&(s=1)}return null}function xF(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,d=n-2;h>s;h--,d--){let g=i.node(h),y=i.index(h);if(g.type.spec.isolating)return!1;let b=g.content.cutByIndex(y,g.childCount),k=r&&r[d+1];k&&(b=b.replaceChild(0,k.type.create(k.attrs)));let E=r&&r[d]||g;if(!g.canReplace(y+1,g.childCount)||!E.type.validContent(b))return!1}let u=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(u,u,c?c.type:i.node(s+1).type)}function bF(t,e){let n=t.resolve(e),r=n.index();return vF(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function SF(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function vF(t,e){return!!(t&&e&&!t.isLeaf&&SF(t,e))}let kF=class cm extends Nn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Un.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Un.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return ll.empty}invert(e){return new cm(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 cm(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 cm(n.pos,n.attr,n.value)}};Nn.jsonID("attr",kF);let CF=class Ab extends Nn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Un.ok(r)}getMap(){return ll.empty}invert(e){return new Ab(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 Ab(n.attr,n.value)}};Nn.jsonID("docAttr",CF);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";function wF(t,e){return function(n,r){let{$from:i,$to:s,node:o}=n.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(s))return!1;let u=i.node(-1);if(u.type!=t)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=t||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let g=Q.empty,y=i.index(-1)?1:i.index(-2)?2:3;for(let M=i.depth-y;M>=i.depth-3;M--)g=Q.from(i.node(M).copy(g));let b=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;g=g.append(Q.from(t.createAndFill()));let k=i.before(i.depth-(y-1)),E=n.tr.replace(k,i.after(-b),new H(g,4-y,0)),N=-1;E.doc.nodesBetween(k,E.doc.content.size,(M,j)=>{if(N>-1)return!1;M.isTextblock&&M.content.size==0&&(N=j+1)}),N>-1&&E.setSelection(Ve.near(E.doc.resolve(N))),r(E.scrollIntoView())}return!0}let c=s.pos==i.end()?u.contentMatchAt(0).defaultType:null,h=n.tr.delete(i.pos,s.pos),d=c?[null,{type:c}]:void 0;return xF(h.doc,i.pos,2,d)?(r&&r(h.split(i.pos,2,d).scrollIntoView()),!0):!1}}function EF(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?AF(e,n,t,s):NF(e,n,s):!0:!1}}function AF(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Og(s-1,o,s,o,new H(Q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new AM(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const u=yF(r);if(u==null)return!1;i.lift(r,u);let c=i.doc.resolve(i.mapping.map(s,-1)-1);return bF(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function NF(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,k=n.endIndex-1,E=n.startIndex;k>E;k--)b-=i.child(k).nodeSize,r.delete(b-1,b+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let u=n.startIndex==0,c=n.endIndex==i.childCount,h=s.node(-1),d=s.index(-1);if(!h.canReplace(d+(u?0:1),d+1,o.content.append(c?Q.empty:Q.from(i))))return!1;let g=s.pos,y=g+o.nodeSize;return r.step(new Og(g-(u?1:0),y+(c?1:0),g+1,y-1,new H((u?Q.empty:Q.from(i.copy(Q.empty))).append(c?Q.empty:Q.from(i.copy(Q.empty))),u?0:1,c?0:1),u?0:1)),e(r.scrollIntoView()),!0}function TF(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,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,d=Q.from(h?t.create():null),g=new H(Q.from(t.create(null,Q.from(u.type.create(null,d)))),h?3:1,0),y=s.start,b=s.end;n(e.tr.step(new Og(y-(h?3:1),b,y,b,g,1,!0)).scrollIntoView())}return!0}}const W3=65535,X3=Math.pow(2,16);function MF(t,e){return t+e*X3}function GA(t){return t&W3}function OF(t){return(t-(t&W3))/X3}const Z3=1,eR=2,fm=4,tR=8;let YA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tR)>0}get deletedBefore(){return(this.delInfo&(Z3|fm))>0}get deletedAfter(){return(this.delInfo&(eR|fm))>0}get deletedAcross(){return(this.delInfo&fm)>0}},ul=class xu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&xu.empty)return xu.empty}recover(e){let n=0,r=GA(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+OF(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,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],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:MF(u/3,e-c),E=e==c?eR:e==g?Z3:fm;return(n<0?e!=c:e!=g)&&(E|=tR),new YA(b,E,k)}i+=d-h}return r?e+i:new YA(e+i,0,null)}touches(e,n){let r=0,i=GA(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new xu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?xu.empty:new xu(e<0?[0,-e,0]:[0,0,e])}};ul.empty=new ul([]);const Y1=Object.create(null);let Tn=class{getMap(){return ul.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Y1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Y1)throw new RangeError("Duplicate use of step JSON ID "+e);return Y1[e]=n,n.prototype.jsonID=e,n}},Jn=class Of{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Of(e,null)}static fail(e){return new Of(null,e)}static fromReplace(e,n,r,i){try{return Of.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return Of.fail(s.message);throw s}}};function qS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(qS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}let HS=class Rf extends Tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(qS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Jn.fromReplace(e,this.from,this.to,s)}invert(){return new nR(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Rf(n.pos,r.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:"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 Rf(n.from,n.to,e.markFromJSON(n.mark))}};Tn.jsonID("addMark",HS);let nR=class Df extends Tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(qS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Jn.fromReplace(e,this.from,this.to,r)}invert(){return new HS(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Df(n.pos,r.pos,this.mark)}merge(e){return e instanceof Df&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Df(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 Df(n.from,n.to,e.markFromJSON(n.mark))}};Tn.jsonID("removeMark",nR);let rR=class If 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 r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Jn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new If(this.pos,n.marks[i]);return new If(this.pos,this.mark)}}return new iR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new If(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 If(n.pos,e.markFromJSON(n.mark))}};Tn.jsonID("addNodeMark",rR);let iR=class Nb 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 r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Jn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new rR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Nb(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 Nb(n.pos,e.markFromJSON(n.mark))}};Tn.jsonID("removeNodeMark",iR);let KS=class Na extends Tn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Tb(e,this.from,this.to)?Jn.fail("Structure replace would overwrite content"):Jn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ul([this.from,this.to-this.from,this.slice.size])}invert(e){return new Na(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Na.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Na(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Na)||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 Na(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 Na(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 Na(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};KS.MAP_BIAS=1;Tn.jsonID("replace",KS);let RF=class hm extends Tn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,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 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 r=this.slice.insertAt(this.insert,n.content);return r?Jn.fromReplace(e,this.from,this.to,r):Jn.fail("Content does not fit in gap")}getMap(){return new ul([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 hm(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new hm(n.pos,r.pos,i,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 hm(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Tn.jsonID("replaceAround",RF);function Tb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function DF(t,e,n=null,r=t){let i=IF(t,e),s=i&&_F(r,e);return s?i.map(QA).concat({type:e,attrs:n}).concat(s.map(QA)):null}function QA(t){return{type:t,attrs:null}}function IF(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function _F(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}let zF=class pm extends Tn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Jn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return ul.empty}invert(e){return new pm(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 pm(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 pm(n.pos,n.attr,n.value)}};Tn.jsonID("attr",zF);let LF=class Mb extends Tn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Jn.ok(r)}getMap(){return ul.empty}invert(e){return new Mb(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 Mb(n.attr,n.value)}};Tn.jsonID("docAttr",LF);let Nh=class extends Error{};Nh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Nh.prototype=Object.create(Error.prototype);Nh.prototype.constructor=Nh;Nh.prototype.name="TransformError";function GS(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),$u(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return o(c,g,d)}}function BF(t,e,n,r){let i,s,o;s=e,o=n,i=r,$u(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return o(c,g,d)}}function VF(t){const e=new Map;if(!t||!t.type)throw new Error("mdast-util-definitions expected node");return BF(t,"definition",function(r){const i=WA(r.identifier);i&&!e.get(i)&&e.set(i,r)}),n;function n(r){const i=WA(r);return e.get(i)}}function WA(t){return String(t||"").toUpperCase()}function FF(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),$u(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return o(c,g,d)}}function PF(){return function(t){const e=VF(t);FF(t,function(n,r,i){if(n.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[jx,r];if(n.type==="imageReference"||n.type==="linkReference"){const s=e(n.identifier);if(s&&i&&typeof r=="number")return i.children[r]=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},[jx,r]}})}}function sR(t,e){if(!(e.childCount>=1&&e.lastChild?.type.name==="hardbreak")){t.next(e.content);return}const n=[];e.content.forEach((r,i,s)=>{s!==e.childCount-1&&n.push(r)}),t.next(Q.fromArray(n))}function he(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-commonmark",...e}}),t}var YS=Xh("emphasis");he(YS,{displayName:"Attr<emphasis>",group:"Emphasis"});var Hu=qu("emphasis",t=>({attrs:{marker:{default:t.get(Kf).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",t.get(YS.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,n,r)=>{e.openMark(r,{marker:n.marker}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,n)=>{e.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));he(Hu.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});he(Hu.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var Rg=Ue("ToggleEmphasis",t=>()=>Ag(Hu.type(t)));he(Rg,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var aR=pr(t=>Gh(/(?:^|[^*])\*([^*]+)\*$/,Hu.type(t),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:n+1}}));he(aR,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var oR=pr(t=>Gh(/\b_(?![_\s])(.*?[^_\s])_\b/,Hu.type(t),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:n+1}}));he(oR,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var QS=Mr("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:t=>{const e=t.get(xt);return()=>e.call(Rg.key)}}});he(QS.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});he(QS.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var WS=Xh("strong");he(WS,{displayName:"Attr<strong>",group:"Strong"});var Zh=qu("strong",t=>({attrs:{marker:{default:t.get(Kf).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(WS.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,n,r)=>{e.openMark(r,{marker:n.marker}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,n)=>{e.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));he(Zh.mark,{displayName:"MarkSchema<strong>",group:"Strong"});he(Zh.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var Dg=Ue("ToggleStrong",t=>()=>Ag(Zh.type(t)));he(Dg,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var lR=pr(t=>Gh(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),Zh.type(t),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));he(lR,{displayName:"InputRule<strong>",group:"Strong"});var XS=Mr("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:t=>{const e=t.get(xt);return()=>e.call(Dg.key)}}});he(XS.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});he(XS.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var ZS=Xh("inlineCode");he(ZS,{displayName:"Attr<inlineCode>",group:"InlineCode"});var La=qu("inlineCode",t=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",t.get(ZS.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,n,r)=>{e.openMark(r),e.addText(n.value),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,n,r)=>(e.withMark(n,"inlineCode",r.text||""),!0)}}));he(La.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});he(La.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var ev=Ue("ToggleInlineCode",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(r.empty)return!1;const{from:s,to:o}=r;return e.doc.rangeHasMark(s,o,La.type(t))?(n?.(i.removeMark(s,o,La.type(t))),!0):(Object.keys(e.schema.marks).filter(u=>u!==La.type.name).map(u=>e.schema.marks[u]).forEach(u=>{i.removeMark(s,o,u)}),n?.(i.addMark(s,o,La.type(t).create())),!0)});he(ev,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var uR=pr(t=>Gh(/(?:`)([^`]+)(?:`)$/,La.type(t)));he(uR,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var tv=Mr("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:t=>{const e=t.get(xt);return()=>e.call(ev.key)}}});he(tv.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});he(tv.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var nv=Xh("link");he(nv,{displayName:"Attr<link>",group:"Link"});var Mu=qu("link",t=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Ki(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...t.get(nv.key)(e),...e.attrs}],parseMarkdown:{match:e=>e.type==="link",runner:(e,n,r)=>{const i=n.url,s=n.title;e.openMark(r,{href:i,title:s}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,n)=>{e.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));he(Mu.mark,{displayName:"MarkSchema<link>",group:"Link"});var rv=Ue("ToggleLink",t=>(e={})=>Ag(Mu.type(t),e));he(rv,{displayName:"Command<toggleLinkCommand>",group:"Link"});var iv=Ue("UpdateLink",t=>(e={})=>(n,r)=>{if(!r)return!1;let i,s=-1;const{selection:o}=n,{from:u,to:c}=o;if(n.doc.nodesBetween(u,u===c?c+1:c,(k,E)=>{if(Mu.type(t).isInSet(k.marks))return i=k,s=E,!1}),!i)return!1;const h=i.marks.find(({type:k})=>k===Mu.type(t));if(!h)return!1;const d=s,g=s+i.nodeSize,{tr:y}=n,b=Mu.type(t).create({...h.attrs,...e});return b?(r(y.removeMark(d,g,h).addMark(d,g,b).setSelection(new Ae(y.selection.$anchor)).scrollIntoView()),!0):!1});he(iv,{displayName:"Command<updateLinkCommand>",group:"Link"});var cR=Ju("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)}}}));he(cR,{displayName:"NodeSchema<doc>",group:"Doc"});function jF(t){return $u(t,e=>e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,n)=>{if(!n.length)return;const r=n[n.length-1];if(!r)return;const i=r.children.indexOf(e);i!==-1&&r.children.splice(i,1)},!0)}var Ig=Ni("remark-preserve-empty-line",()=>()=>jF);he(Ig.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});he(Ig.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var sv=Ai("paragraph");he(sv,{displayName:"Attr<paragraph>",group:"Paragraph"});var Ui=en("paragraph",t=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",t.get(sv.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,n,r)=>{e.openNode(r),n.children?e.next(n.children):e.addText(n.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,n)=>{const r=t.get(gn).state?.doc.lastChild;e.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==r&&$F(t)?e.addNode("html",void 0,"<br />"):sR(e,n),e.closeNode()}}}));function $F(t){let e=!1;try{t.get(Ig.id),e=!0}catch{e=!1}return e}he(Ui.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});he(Ui.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var av=Ue("TurnIntoText",t=>()=>mh(Ui.type(t)));he(av,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var ov=Mr("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:t=>{const e=t.get(xt);return()=>e.call(av.key)}}});he(ov.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});he(ov.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var UF=Array(6).fill(0).map((t,e)=>e+1);function JF(t){return t.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var _g=Za(JF,"headingIdGenerator");he(_g,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var lv=Ai("heading");he(lv,{displayName:"Attr<heading>",group:"Heading"});var dl=en("heading",t=>{const e=t.get(_g.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:r=>{if(!(r instanceof HTMLElement))throw Ki(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...t.get(lv.key)(n),id:n.attrs.id||e(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,r,i)=>{const s=r.depth;n.openNode(i,{level:s}),n.next(r.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,r)=>{n.openNode("heading",void 0,{depth:r.attrs.level}),sR(n,r),n.closeNode()}}}});he(dl.node,{displayName:"NodeSchema<heading>",group:"Heading"});he(dl.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var fR=pr(t=>AO(/^(?<hashes>#+)\s$/,dl.type(t),e=>{const n=e.groups?.hashes?.length||0,{$from:r}=t.get(gn).state.selection,i=r.node();if(i.type.name==="heading"){let s=Number(i.attrs.level)+Number(n);return s>6&&(s=6),{level:s}}return{level:n}}));he(fR,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var Oa=Ue("WrapInHeading",t=>e=>(e??=1,e<1?mh(Ui.type(t)):mh(dl.type(t),{level:e})));he(Oa,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var uv=Ue("DowngradeHeading",t=>()=>(e,n,r)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==dl.type(t)||!e.selection.empty||i.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):mh(Ui.type(t))(e,n,r)});he(uv,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var cv=Mr("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:t=>{const e=t.get(xt);return()=>e.call(Oa.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:t=>{const e=t.get(xt);return()=>e.call(Oa.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:t=>{const e=t.get(xt);return()=>e.call(Oa.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:t=>{const e=t.get(xt);return()=>e.call(Oa.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:t=>{const e=t.get(xt);return()=>e.call(Oa.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:t=>{const e=t.get(xt);return()=>e.call(Oa.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:t=>{const e=t.get(xt);return()=>e.call(uv.key)}}});he(cv.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});he(cv.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var fv=Ai("blockquote");he(fv,{displayName:"Attr<blockquote>",group:"Blockquote"});var ep=en("blockquote",t=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",t.get(fv.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,n,r)=>{e.openNode(r).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,n)=>{e.openNode("blockquote").next(n.content).closeNode()}}}));he(ep.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});he(ep.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var hR=pr(t=>IS(/^\s*>\s$/,ep.type(t)));he(hR,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var zg=Ue("WrapInBlockquote",t=>()=>RS(ep.type(t)));he(zg,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var hv=Mr("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:t=>{const e=t.get(xt);return()=>e.call(zg.key)}}});he(hv.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});he(hv.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var pv=Ai("codeBlock",()=>({pre:{},code:{}}));he(pv,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var tp=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 Ki(e);return{language:e.dataset.language}}}],toDOM:e=>{const n=t.get(pv.key)(e),r=e.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,n,r)=>{const i=n.lang??"",s=n.value;e.openNode(r,{language:i}),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})}}}));he(tp.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});he(tp.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var pR=pr(t=>AO(/^```(?<language>[a-z]*)?[\s\n]$/,tp.type(t),e=>({language:e.groups?.language??""})));he(pR,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var dv=Ue("CreateCodeBlock",t=>(e="")=>mh(tp.type(t),{language:e}));he(dv,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var qF=Ue("UpdateCodeBlockLanguage",()=>({pos:t,language:e}={pos:-1,language:""})=>(n,r)=>t>=0?(r?.(n.tr.setNodeAttribute(t,"language",e)),!0):!1);he(qF,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var mv=Mr("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:t=>{const e=t.get(xt);return()=>e.call(dv.key)}}});he(mv.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});he(mv.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var gv=Ai("image");he(gv,{displayName:"Attr<image>",group:"Image"});var Ku=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 Ki(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...t.get(gv.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,n,r)=>{const i=n.url,s=n.alt,o=n.title;e.addNode(r,{src:i,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})}}}));he(Ku.node,{displayName:"NodeSchema<image>",group:"Image"});he(Ku.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var dR=Ue("InsertImage",t=>(e={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:s="",title:o=""}=e,u=Ku.type(t).create({src:i,alt:s,title:o});return u&&r(n.tr.replaceSelectionWith(u).scrollIntoView()),!0});he(dR,{displayName:"Command<insertImageCommand>",group:"Image"});var mR=Ue("UpdateImage",t=>(e={})=>(n,r)=>{const i=QB(n.selection,Ku.type(t));if(!i)return!1;const{node:s,pos:o}=i,u={...s.attrs},{src:c,alt:h,title:d}=e;return c!==void 0&&(u.src=c),h!==void 0&&(u.alt=h),d!==void 0&&(u.title=d),r?.(n.tr.setNodeMarkup(o,void 0,u).scrollIntoView()),!0});he(mR,{displayName:"Command<updateImageCommand>",group:"Image"});var HF=pr(t=>new Tr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,n,r,i)=>{const[s,o,u="",c]=n;return s?e.tr.replaceWith(r,i,Ku.type(t).create({src:u,alt:o,title:c})):null}));he(HF,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var Fm=Ai("hardbreak",t=>({"data-type":"hardbreak","data-is-inline":t.attrs.isInline}));he(Fm,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var Ko=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(Fm.key)(e)," "]:["br",t.get(Fm.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,n,r)=>{e.addNode(r,{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")}}}));he(Ko.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});he(Ko.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var yv=Ue("InsertHardbreak",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(!(r instanceof Ae))return!1;if(r.empty){const s=r.$from.node();if(s.childCount>0&&s.lastChild?.type.name==="hardbreak")return n?.(i.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection(Ve.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(Ko.type(t).create()).scrollIntoView()),!0});he(yv,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var xv=Mr("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:t=>{const e=t.get(xt);return()=>e.call(yv.key)}}});he(xv.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});he(xv.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var bv=Ai("hr");he(bv,{displayName:"Attr<hr>",group:"Hr"});var np=en("hr",t=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",t.get(bv.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,n,r)=>{e.addNode(r)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));he(np.node,{displayName:"NodeSchema<hr>",group:"Hr"});he(np.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var gR=pr(t=>new Tr(/^(?:---|___\s|\*\*\*\s)$/,(e,n,r,i)=>{const{tr:s}=e;return n[0]&&s.replaceWith(r-1,i,np.type(t).create()),s}));he(gR,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var yR=Ue("InsertHr",t=>()=>(e,n)=>{if(!n)return!0;const r=Ui.node.type(t).create(),{tr:i,selection:s}=e,{from:o}=s,u=np.type(t).create();if(!u)return!0;const c=i.replaceSelectionWith(u).insert(o,r),h=Ve.findFrom(c.doc.resolve(o),1,!0);return h&&n(c.setSelection(h).scrollIntoView()),!0});he(yR,{displayName:"Command<insertHrCommand>",group:"Hr"});var Lg=Ai("bulletList");he(Lg,{displayName:"Attr<bulletList>",group:"BulletList"});var ml=en("bullet_list",t=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Ki(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...t.get(Lg.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:n})=>e==="list"&&!n,runner:(e,n,r)=>{const i=n.spread!=null?`${n.spread}`:"false";e.openNode(r,{spread:i}).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()}}}));he(ml.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});he(ml.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var xR=pr(t=>IS(/^\s*([-+*])\s$/,ml.type(t)));he(xR,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var Bg=Ue("WrapInBulletList",t=>()=>RS(ml.type(t)));he(Bg,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var Sv=Mr("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:t=>{const e=t.get(xt);return()=>e.call(Bg.key)}}});he(Sv.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});he(Sv.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var Vg=Ai("orderedList");he(Vg,{displayName:"Attr<orderedList>",group:"OrderedList"});var gl=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 Ki(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...t.get(Vg.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,r)=>{const i=n.spread!=null?`${n.spread}`:"true";e.openNode(r,{spread:i,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()}}}));he(gl.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});he(gl.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var bR=pr(t=>IS(/^\s*(\d+)\.\s$/,gl.type(t),e=>({order:Number(e[1])}),(e,n)=>n.childCount+n.attrs.order===Number(e[1])));he(bR,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var Fg=Ue("WrapInOrderedList",t=>()=>RS(gl.type(t)));he(Fg,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var vv=Mr("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:t=>{const e=t.get(xt);return()=>e.call(Fg.key)}}});he(vv.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});he(vv.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var kv=Ai("listItem");he(kv,{displayName:"Attr<listItem>",group:"ListItem"});var Us=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 Ki(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...t.get(kv.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,r)=>{const i=n.label!=null?`${n.label}.`:"•",s=n.label!=null?"ordered":"bullet",o=n.spread!=null?`${n.spread}`:"true";e.openNode(r,{label:i,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()}}}));he(Us.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});he(Us.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var Cv=Ue("SinkListItem",t=>()=>TF(Us.type(t)));he(Cv,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var Pg=Ue("LiftListItem",t=>()=>EF(Us.type(t)));he(Pg,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var wv=Ue("SplitListItem",t=>()=>wF(Us.type(t)));he(wv,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function KF(t){return(e,n,r)=>{const{selection:i}=e;if(!(i instanceof Ae))return!1;const{empty:s,$from:o}=i;return!s||o.parentOffset!==0||o.node(-1).type!==Us.type(t)?!1:fO(e,n,r)}}var Ev=Ue("LiftFirstListItem",t=>()=>KF(t));he(Ev,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var Av=Mr("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:t=>{const e=t.get(xt);return()=>e.call(wv.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:t=>{const e=t.get(xt);return()=>e.call(Cv.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:t=>{const e=t.get(xt);return()=>e.call(Pg.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:t=>{const e=t.get(xt);return()=>e.call(Ev.key)}}});he(Av.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});he(Av.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var SR=Ju("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)}}}));he(SR,{displayName:"NodeSchema<text>",group:"Text"});var Nv=Ai("html");he(Nv,{displayName:"Attr<html>",group:"Html"});var Tv=en("html",t=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const n=document.createElement("span"),r={...t.get(Nv.key)(e),"data-value":e.attrs.value,"data-type":"html"};return n.textContent=e.attrs.value,["span",r,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,n,r)=>{e.addNode(r,{value:n.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,n)=>{e.addNode("html",void 0,n.attrs.value)}}}));he(Tv.node,{displayName:"NodeSchema<html>",group:"Html"});he(Tv.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var GF=[cR,sv,Ui,_g,lv,dl,Fm,Ko,fv,ep,pv,tp,bv,np,gv,Ku,Lg,ml,Vg,gl,kv,Us,YS,Hu,WS,Zh,ZS,La,nv,Mu,Nv,Tv,SR].flat(),YF=[hR,xR,bR,pR,gR,fR].flat(),QF=[aR,oR,uR,lR],WF=Ue("IsMarkSelected",()=>t=>e=>{if(!t)return!1;const{doc:n,selection:r}=e;return n.rangeHasMark(r.from,r.to,t)}),XF=Ue("IsNoteSelected",()=>t=>e=>t?WB(e,t).hasNode:!1),ZF=Ue("ClearTextInCurrentBlock",()=>()=>(t,e)=>{let n=t.tr;const{$from:r,$to:i}=n.selection,{pos:s}=r,{pos:o}=i,u=s-r.node().content.size;return u<0?!1:(n=n.deleteRange(u,o),e?.(n),!0)}),eP=Ue("SetBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr,{from:o,to:u}=s.selection;try{s.setBlockType(o,u,r,i)}catch{return!1}return n?.(s),!0}),tP=Ue("WrapInBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;let s=e.tr;try{const{$from:o,$to:u}=s.selection,c=o.blockRange(u),h=c&&DF(c,r,i);if(!h)return!1;s=s.wrap(c,h)}catch{return!1}return n?.(s),!0}),nP=Ue("AddBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr;try{const o=r instanceof Rs?r:r.createAndFill(i);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return n?.(s),!0}),rP=Ue("SelectTextNearPos",()=>t=>(e,n)=>{const{pos:r}=t??{};if(r==null)return!1;const i=(o,u,c)=>Math.min(Math.max(o,u),c),s=e.tr;try{const o=e.doc.resolve(i(r,0,e.doc.content.size));s.setSelection(Ae.near(o))}catch{return!1}return n?.(s.scrollIntoView()),!0}),iP=[av,zg,Oa,uv,dv,yv,yR,dR,mR,Fg,Bg,Cv,wv,Pg,Ev,Rg,ev,Dg,rv,iv,WF,XF,ZF,eP,tP,nP,rP],sP=[hv,mv,xv,cv,Av,vv,Sv,ov,QS,tv,XS].flat(),Mv=Ni("remarkAddOrderInList",()=>()=>t=>{GS(t,"list",e=>{if(e.ordered){const n=e.start??1;e.children.forEach((r,i)=>{r.label=i+n})}})});he(Mv.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});he(Mv.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var Ov=Ni("remarkLineBreak",()=>()=>t=>{const e=/[\t ]*(?:\r?\n|\r)/g;GS(t,"text",(n,r,i)=>{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&&i&&typeof r=="number")return o<n.value.length&&s.push({type:"text",value:n.value.slice(o)}),i.children.splice(r,1,...s),r+s.length})});he(Ov.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});he(Ov.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var Rv=Ni("remarkInlineLink",()=>PF);he(Rv.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});he(Rv.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var aP=t=>!!t.children,oP=t=>t.type==="html";function lP(t,e){return n(t,0,null)[0];function n(r,i,s){if(aP(r)){const o=[];for(let u=0,c=r.children.length;u<c;u++){const h=r.children[u];if(h){const d=n(h,u,r);if(d)for(let g=0,y=d.length;g<y;g++){const b=d[g];b&&o.push(b)}}}r.children=o}return e(r,i,s)}}var uP=["root","blockquote","listItem"],Dv=Ni("remarkHTMLTransformer",()=>()=>t=>{lP(t,(e,n,r)=>oP(e)?(r&&uP.includes(r.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});he(Dv.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});he(Dv.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var Iv=Ni("remarkMarker",()=>()=>(t,e)=>{const n=r=>e.value.charAt(r.position.start.offset);GS(t,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});he(Iv.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});he(Iv.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var vR=$s(()=>{let t=!1;const e=new fr({key:new hr("MILKDOWN_INLINE_NODES_CURSOR"),state:{init(){return!1},apply(n){if(!n.selection.empty)return!1;const r=n.selection.$from,i=r.nodeBefore,s=r.nodeAfter;return!!(i&&s&&i.isInline&&!i.isText&&s.isInline&&!s.isText)}},props:{handleDOMEvents:{compositionend:(n,r)=>t?(t=!1,requestAnimationFrame(()=>{if(e.getState(n.state)){const i=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",i))}}),!0):!1,compositionstart:n=>(e.getState(n.state)&&(t=!0),!1),beforeinput:(n,r)=>{if(e.getState(n.state)&&r instanceof InputEvent&&r.data&&!t){const i=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",i)),!0}return!1}},decorations(n){if(e.getState(n)){const r=n.selection.$from.pos,i=document.createElement("span"),s=Ka.widget(r,i,{side:-1}),o=document.createElement("span"),u=Ka.widget(r,o);return setTimeout(()=>{i.contentEditable="true",o.contentEditable="true"}),ni.create(n.doc,[s,u])}return ni.empty}}});return e});he(vR,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var kR=$s(t=>new fr({key:new hr("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,n,r)=>{if(!e.length)return;const[i]=e;if(!i)return;const[s]=i.steps;if(i.getMeta("hardbreak")){if(!(s instanceof KS))return;const{from:o}=s;return r.tr.setNodeMarkup(o,Ko.type(t),void 0,[])}if(s instanceof HS){let o=r.tr;const{from:u,to:c}=s;return r.doc.nodesBetween(u,c,(h,d)=>{h.type===Ko.type(t)&&(o=o.setNodeMarkup(d,Ko.type(t),void 0,[]))}),o}}}));he(kR,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var _v=Za(["table","code_block"],"hardbreakFilterNodes");he(_v,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var CR=$s(t=>{const e=t.get(_v.key);return new fr({key:new hr("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,r)=>{const i=n.getMeta("hardbreak"),[s]=n.steps;if(i&&s){const{from:o}=s,u=r.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}})});he(CR,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var wR=$s(t=>{const e=new hr("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const i=t.get(_g.key),s=r.state.tr.setMeta("addToHistory",!1);let o=!1;const u={};r.state.doc.descendants((c,h)=>{if(c.type===dl.type(t)){if(c.textContent.trim().length===0)return;const d=c.attrs;let g=i(c);u[g]?(u[g]+=1,g+=`-#${u[g]}`):u[g]=1,d.id!==g&&(o=!0,s.setMeta(e,!0).setNodeMarkup(h,void 0,{...d,id:g}))}}),o&&r.dispatch(s)};return new fr({key:e,view:r=>(n(r),{update:(i,s)=>{i.state.doc.eq(s.doc)||n(i)}})})});he(wR,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var ER=$s(t=>{const e=(n,r,i)=>{if(!i.selection||n.some(g=>g.getMeta("addToHistory")===!1||!g.isGeneric))return null;const s=gl.type(t),o=ml.type(t),u=Us.type(t),c=(g,y,b=1)=>{let k=!1;const E=`${y+b}.`;return g.label!==E&&(g.label=E,k=!0),k};let h=i.tr,d=!1;return i.doc.descendants((g,y,b,k)=>{if(g.type===o){const E=g.maybeChild(0);E?.type===u&&E.attrs.listType==="ordered"&&(d=!0,h.setNodeMarkup(y,s,{spread:"true"}),g.descendants((N,M,j,P)=>{if(N.type===u){const U={...N.attrs};c(U,P)&&(h=h.setNodeMarkup(M,void 0,U))}return!1}))}else if(g.type===u&&b?.type===s){const E={...g.attrs};let N=!1;E.listType!=="ordered"&&(E.listType="ordered",N=!0),b?.maybeChild(0)&&(N=c(E,k,b?.attrs.order??1)),N&&(h=h.setNodeMarkup(y,void 0,E),d=!0)}}),d?h.setMeta("addToHistory",!1):null};return new fr({key:new hr("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});he(ER,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var cP=[kR,_v,CR,vR,Mv,Rv,Ov,Dv,Iv,Ig,wR,ER].flat(),AR=[GF,YF,QF,iP,sP,cP].flat();const NR=65535,TR=Math.pow(2,16);function fP(t,e){return t+e*TR}function XA(t){return t&NR}function hP(t){return(t-(t&NR))/TR}const MR=1,OR=2,dm=4,RR=8;let Ob=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&RR)>0}get deletedBefore(){return(this.delInfo&(MR|dm))>0}get deletedAfter(){return(this.delInfo&(OR|dm))>0}get deletedAcross(){return(this.delInfo&dm)>0}},cl=class bu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&bu.empty)return bu.empty}recover(e){let n=0,r=XA(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+hP(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,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],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:fP(u/3,e-c),E=e==c?OR:e==g?MR:dm;return(n<0?e!=c:e!=g)&&(E|=RR),new Ob(b,E,k)}i+=d-h}return r?e+i:new Ob(e+i,0,null)}touches(e,n){let r=0,i=XA(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new bu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?bu.empty:new bu(e<0?[0,-e,0]:[0,0,e])}};cl.empty=new cl([]);class Pm{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Pm(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,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Pm;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let 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}}i|=u.delInfo,e=u.pos}return r?e:new Ob(e,i,null)}}const Q1=Object.create(null);let Mn=class{getMap(){return cl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Q1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Q1)throw new RangeError("Duplicate use of step JSON ID "+e);return Q1[e]=n,n.prototype.jsonID=e,n}},qn=class _f{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new _f(e,null)}static fail(e){return new _f(null,e)}static fromReplace(e,n,r,i){try{return _f.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return _f.fail(s.message);throw s}}};function zv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(zv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}let Lv=class zf extends Mn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(zv(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return qn.fromReplace(e,this.from,this.to,s)}invert(){return new rp(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new zf(n.pos,r.pos,this.mark)}merge(e){return e instanceof zf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zf(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 zf(n.from,n.to,e.markFromJSON(n.mark))}};Mn.jsonID("addMark",Lv);let rp=class Lf extends Mn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(zv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return qn.fromReplace(e,this.from,this.to,r)}invert(){return new Lv(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Lf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Lf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lf(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 Lf(n.from,n.to,e.markFromJSON(n.mark))}};Mn.jsonID("removeMark",rp);let Bv=class Bf extends Mn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Bf(this.pos,n.marks[i]);return new Bf(this.pos,this.mark)}}return new jm(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bf(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 Bf(n.pos,e.markFromJSON(n.mark))}};Mn.jsonID("addNodeMark",Bv);let jm=class Rb extends Mn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return qn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Bv(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Rb(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 Rb(n.pos,e.markFromJSON(n.mark))}};Mn.jsonID("removeNodeMark",jm);let Ga=class Ro extends Mn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Db(e,this.from,this.to)?qn.fail("Structure replace would overwrite content"):qn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new cl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ro(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ro(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ro)||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 Ro(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 Ro(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 Ro(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Mn.jsonID("replace",Ga);let Gu=class mm extends Mn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Db(e,this.from,this.gapFrom)||Db(e,this.gapTo,this.to)))return qn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return qn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?qn.fromReplace(e,this.from,this.to,r):qn.fail("Content does not fit in gap")}getMap(){return new cl([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 mm(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new mm(n.pos,r.pos,i,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 mm(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Mn.jsonID("replaceAround",Gu);function Db(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function pP(t,e,n,r){let i=[],s=[],o,u;t.doc.nodesBetween(e,n,(c,h,d)=>{if(!c.isInline)return;let g=c.marks;if(!r.isInSet(g)&&d.type.allowsMarkType(r.type)){let y=Math.max(h,e),b=Math.min(h+c.nodeSize,n),k=r.addToSet(g);for(let E=0;E<g.length;E++)g[E].isInSet(k)||(o&&o.to==y&&o.mark.eq(g[E])?o.to=b:i.push(o=new rp(y,b,g[E])));u&&u.to==y?u.to=b:s.push(u=new Lv(y,b,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function dP(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,u)=>{if(!o.isInline)return;s++;let c=null;if(r instanceof Hh){let h=o.marks,d;for(;d=r.isInSet(h);)(c||(c=[])).push(d),h=d.removeFromSet(h)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let h=Math.min(u+o.nodeSize,n);for(let d=0;d<c.length;d++){let g=c[d],y;for(let b=0;b<i.length;b++){let k=i[b];k.step==s-1&&g.eq(i[b].style)&&(y=k)}y?(y.to=h,y.step=s):i.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(o=>t.step(new rp(o.from,o.to,o.style)))}function Vv(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),d=u+h.nodeSize,g=r.matchType(h.type);if(!g)o.push(new Ga(u,d,H.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new rp(u,d,h.marks[y]));if(i&&h.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,k;for(;y=b.exec(h.text);)k||(k=new H(Q.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new Ga(u+y.index,u+y.index+y[0].length,k))}}u=d}if(!r.validEnd){let c=r.fillBefore(Q.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 mP(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),u=i.after(s+1),c=o,h=u,d=Q.empty,g=0;for(let k=s,E=!1;k>n;k--)E||r.index(k)>0?(E=!0,d=Q.from(r.node(k).copy(d)),g++):c--;let y=Q.empty,b=0;for(let k=s,E=!1;k>n;k--)E||i.after(k+1)<i.end(k)?(E=!0,y=Q.from(i.node(k).copy(y)),b++):h++;t.step(new Gu(c,h,o,u,new H(d.append(y),g,b),d.size-g,!0))}function gP(t,e,n){let r=Q.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let u=n[o].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Q.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Gu(i,s,i,s,new H(r,0,0),n.length,!0))}function yP(t,e,n,r,i){if(!r.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 i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,c)&&xP(t.doc,t.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",k=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!k?h=!1:!b&&k&&(h=!0)}h===!1&&IR(t,o,u,s),Vv(t,t.mapping.slice(s).map(u,1),r,void 0,h===null);let d=t.mapping.slice(s),g=d.map(u,1),y=d.map(u+o.nodeSize,1);return t.step(new Gu(g,y,g+1,y-1,new H(Q.from(r.create(c,null,o.marks)),0,0),1,!0)),h===!0&&DR(t,o,u,s),!1}})}function DR(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,u=/\r?\n|\r/g;for(;o=u.exec(i.text);){let c=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function IR(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
47
+ `))}})}function xP(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function bP(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||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 Gu(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new H(Q.from(o),0,0),1,!0))}function SP(t,e,n=1,r){let i=t.doc.resolve(e),s=Q.empty,o=Q.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=Q.from(i.node(u).copy(s));let d=r&&r[h];o=Q.from(d?d.type.create(d.attrs,o):i.node(u).copy(o))}t.step(new Ga(e,e,new H(s.append(o),n,n),!0))}function vP(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",g=!!o.contentMatch.matchType(i);d&&!g?r=!1:!d&&g&&(r=!0)}let u=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);IR(t,d.node(),d.before(),u)}o.inlineContent&&Vv(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new Ga(h,c.map(e+n,-1),H.empty,!0)),r===!0){let d=t.doc.resolve(h);DR(t,d.node(),d.before(),t.steps.length)}return t}function kP(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function CP(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let u=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(u>0?1:0),h=r.node(o),d=!1;if(s==1)d=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);d=g&&h.canReplaceWith(c,c,g[0])}if(d)return u==0?r.pos:u<0?r.before(o+1):r.after(o+1)}return null}function wP(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return _R(i,s,r)?new Ga(e,n,r):new EP(i,s,r).fit()}function _R(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class EP{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Q.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Q.from(e.node(i).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,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,u=i.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new Gu(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Ga(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=W1(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],d,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(Q.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(d=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:d};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=W1(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=W1(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new H(Vf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new H(Vf(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,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=r?r.content:o.content,c=o.openStart-e,h=0,d=[],{match:g,type:y}=this.frontier[n];if(i){for(let E=0;E<i.childCount;E++)d.push(i.child(E));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let E=u.child(h),N=g.matchType(E.type);if(!N)break;h++,(h>1||c==0||E.content.size)&&(g=N,d.push(zR(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?b:-1)))}let k=h==u.childCount;k||(b=-1),this.placed=Ff(this.placed,n,Q.from(d)),this.frontier[n].match=g,k&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,N=u;E<b;E++){let M=N.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),N=M.content}this.unplaced=k?e==0?H.empty:new H(Vf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(Vf(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||!X1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=X1(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=X1(e,u,h,c,!0);if(!d||d.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=Ff(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ff(this.placed,this.depth,Q.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Q.empty,!0);n.childCount&&(this.placed=Ff(this.placed,this.frontier.length,n))}}function Vf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Vf(t.firstChild.content,e-1,n)))}function Ff(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ff(t.lastChild.content,e-1,n)))}function W1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function zR(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,zR(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Q.empty,!0)))),t.copy(r)}function X1(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,o);return u&&!AP(n,s.content,o)?u:null}function AP(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function NP(t){return t.spec.defining||t.spec.definingForContent}function TP(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(_R(i,s,r))return t.step(new Ga(e,n,r));let o=BR(i,s);o[o.length-1]==0&&o.pop();let u=-(i.depth+1);o.unshift(u);for(let y=i.depth,b=i.pos-1;y>0;y--,b--){let k=i.node(y).type.spec;if(k.defining||k.definingAsContext||k.isolating)break;o.indexOf(y)>-1?u=y:i.before(y)==b&&o.splice(1,0,-y)}let c=o.indexOf(u),h=[],d=r.openStart;for(let y=r.content,b=0;;b++){let k=y.firstChild;if(h.push(k),b==r.openStart)break;y=k.content}for(let y=d-1;y>=0;y--){let b=h[y],k=NP(b.type);if(k&&!b.sameMarkup(i.node(Math.abs(u)-1)))d=y;else if(k||!b.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let b=(y+d+1)%(r.openStart+1),k=h[b];if(k)for(let E=0;E<o.length;E++){let N=o[(E+c)%o.length],M=!0;N<0&&(M=!1,N=-N);let j=i.node(N-1),P=i.index(N-1);if(j.canReplaceWith(P,P,k.type,k.marks))return t.replace(i.before(N),M?s.after(N):n,new H(LR(r.content,0,r.openStart,b),b,r.openEnd))}}let g=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>g));y--){let b=o[y];b<0||(e=i.before(b),n=s.after(b))}}function LR(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(LR(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(Q.empty,!0))}return t}function MP(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=kP(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new H(Q.from(r),0,0))}function OP(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=BR(r,i);for(let o=0;o<s.length;o++){let u=s[o],c=o==s.length-1;if(c&&u==0||r.node(u).type.contentMatch.validEnd)return t.delete(r.start(u),i.end(u));if(u>0&&(c||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return t.delete(r.before(u),i.after(u))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function BR(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}let VR=class gm extends Mn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return qn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return qn.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return cl.empty}invert(e){return new gm(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 gm(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 gm(n.pos,n.attr,n.value)}};Mn.jsonID("attr",VR);let FR=class Ib extends Mn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return qn.ok(r)}getMap(){return cl.empty}invert(e){return new Ib(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 Ib(n.attr,n.value)}};Mn.jsonID("docAttr",FR);let Vu=class extends Error{};Vu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Vu.prototype=Object.create(Error.prototype);Vu.prototype.constructor=Vu;Vu.prototype.name="TransformError";class RP{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pm}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Vu(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 r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.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,r=H.empty){let i=wP(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new H(Q.from(r),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return TP(this,e,n,r),this}replaceRangeWith(e,n,r){return MP(this,e,n,r),this}deleteRange(e,n){return OP(this,e,n),this}lift(e,n){return mP(this,e,n),this}join(e,n=1){return vP(this,e,n),this}wrap(e,n){return gP(this,e,n),this}setBlockType(e,n=e,r,i=null){return yP(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return bP(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new VR(e,n,r)),this}setDocAttribute(e,n){return this.step(new FR(e,n)),this}addNodeMark(e,n){return this.step(new Bv(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ct)n.isInSet(r.marks)&&this.step(new jm(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new jm(e,s)),i=s.removeFromSet(i);for(let u=o.length-1;u>=0;u--)this.step(o[u])}return this}split(e,n=1,r){return SP(this,e,n,r),this}addMark(e,n,r){return pP(this,e,n,r),this}removeMark(e,n,r){return dP(this,e,n,r),this}clearIncompatible(e,n,r){return Vv(this,e,n,r),this}}const yl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},PR=function(t,e,n,r){return n&&(ZA(t,e,n,r,-1)||ZA(t,e,n,r,1))},DP=/^(img|br|input|textarea|hr)$/i;function ZA(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:$m(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Fv(t)||DP.test(t.nodeName)||t.contentEditable=="false")return!1;e=yl(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?$m(t):0}else return!1}}function $m(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function IP(t,e,n){for(let r=e==0,i=e==$m(t);r||i;){if(t==n)return!0;let s=yl(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==$m(t)}}function Fv(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 jR=function(t){return t.focusNode&&PR(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function $R(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Ji=typeof navigator<"u"?navigator:null,eN=typeof document<"u"?document:null,eo=Ji&&Ji.userAgent||"",_b=/Edge\/(\d+)/.exec(eo),UR=/MSIE \d/.exec(eo),zb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(eo),ip=!!(UR||zb||_b),JR=UR?document.documentMode:zb?+zb[1]:_b?+_b[1]:0,jg=!ip&&/gecko\/(\d+)/i.test(eo);jg&&+(/Firefox\/(\d+)/.exec(eo)||[0,0])[1];const Lb=!ip&&/Chrome\/(\d+)/.exec(eo),Js=!!Lb,qR=Lb?+Lb[1]:0,xl=!ip&&!!Ji&&/Apple Computer/.test(Ji.vendor),Pv=xl&&(/Mobile\/\w+/.test(eo)||!!Ji&&Ji.maxTouchPoints>2),Yr=Pv||(Ji?/Mac/.test(Ji.platform):!1),HR=Ji?/Win/.test(Ji.platform):!1,sp=/Android \d/.test(eo),jv=!!eN&&"webkitFontSmoothing"in eN.documentElement.style,_P=jv?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function zP(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=r.resolve(o),c,h;if(jR(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&ye.isSelectable(g)&&i.parent&&!(g.isInline&&IP(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new ye(o==y?u:r.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 k=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(k.startContainer,k.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(k.endContainer,k.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=GR(t,d,u,g)}return h}function KR(t){return t.editable?t.hasFocus():FP(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function $v(t,e=!1){let n=t.state.selection;if(VP(t,n),!!KR(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Js){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&PR(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)BP(t);else{let{anchor:r,head:i}=n,s,o;tN&&!(n instanceof Ae)&&(n.$from.parent.inlineContent||(s=nN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=nN(t,n.to))),t.docView.setSelection(r,i,t,e),tN&&(s&&rN(s),o&&rN(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&LP(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const tN=xl||Js&&qR<63;function nN(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(xl&&i&&i.contentEditable=="false")return Z1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Z1(i);if(s)return Z1(s)}}function Z1(t){return t.contentEditable="true",xl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function rN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function LP(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!KR(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function BP(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,yl(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ip&&JR<=11&&(n.disabled=!0,n.disabled=!1)}function VP(t,e){if(e instanceof ye){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(iN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else iN(t)}function iN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function GR(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Ae.between(e,n,r)}function FP(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 Bb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ve.findFrom(s,e)}function Ra(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function sN(t,e,n){let r=t.state.selection;if(r instanceof Ae)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ra(t,new Ae(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Bb(t.state,e);return i&&i instanceof ye?Ra(t,i):!1}else if(!(Yr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ye.isSelectable(s)?Ra(t,new ye(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):jv?Ra(t,new Ae(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ye&&r.node.isInline)return Ra(t,new Ae(e>0?r.$to:r.$from));{let i=Bb(t.state,e);return i?Ra(t,i):!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 lu(t,e){return e<0?PP(t):jP(t)}function PP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(jg&&n.nodeType==1&&r<Um(n)&&nh(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(nh(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(YR(n))break;{let u=n.previousSibling;for(;u&&nh(u,-1);)i=n.parentNode,s=yl(u),u=u.previousSibling;if(u)n=u,r=Um(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Vb(t,n,r):i&&Vb(t,i,s)}function jP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Um(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(nh(u,1))s=n,o=++r;else break}else{if(YR(n))break;{let u=n.nextSibling;for(;u&&nh(u,1);)s=u.parentNode,o=yl(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=Um(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Vb(t,s,o)}function YR(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function $P(t,e){for(;t&&e==t.childNodes.length&&!Fv(t);)e=yl(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&&!Fv(t);)e=yl(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 Vb(t,e,n){if(e.nodeType!=3){let s,o;(o=$P(e,n))?(e=o,n=0):(s=UP(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(jR(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&$v(t)},50)}function aN(t,e){let n=t.state.doc.resolve(e);if(!(Js||HR)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function oN(t,e,n){let r=t.state.selection;if(r instanceof Ae&&!r.empty||n.indexOf("s")>-1||Yr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Bb(t.state,e);if(o&&o instanceof ye)return Ra(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Ra(t,u):!1}return!1}function lN(t,e){if(!(t.state.selection instanceof Ae))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let 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 uN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function JP(t){if(!xl||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;uN(t,r,"true"),setTimeout(()=>uN(t,r,"false"),20)}return!1}function qP(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,r=qP(e);if(n==8||Yr&&n==72&&r=="c")return lN(t,-1)||lu(t,-1);if(n==46&&!e.shiftKey||Yr&&n==68&&r=="c")return lN(t,1)||lu(t,1);if(n==13||n==27)return!0;if(n==37||Yr&&n==66&&r=="c"){let i=n==37?aN(t,t.state.selection.from)=="ltr"?-1:1:-1;return sN(t,i,r)||lu(t,i)}else if(n==39||Yr&&n==70&&r=="c"){let i=n==39?aN(t,t.state.selection.from)=="ltr"?1:-1:1;return sN(t,i,r)||lu(t,i)}else{if(n==38||Yr&&n==80&&r=="c")return oN(t,-1,r)||lu(t,-1);if(n==40||Yr&&n==78&&r=="c")return JP(t)||oN(t,1,r)||lu(t,1);if(r==(Yr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function QR(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Yi.fromSchema(t.state.schema),u=nD(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=tD[h.nodeName.toLowerCase()]);){for(let b=d.length-1;b>=0;b--){let k=u.createElement(d[b]);for(;c.firstChild;)k.appendChild(c.firstChild);c.appendChild(k),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${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 WR(t,e,n,r,i){let s=i.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return u=new H(Q.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,i,r,t));if(g)u=g;else{let y=i.marks(),{schema:b}=t.state,k=Yi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let N=o.appendChild(document.createElement("p"));E&&N.appendChild(k.serializeNode(b.text(E,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=QP(n),jv&&WP(o);let h=o&&o.querySelector("[data-pm-slice]"),d=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let g=+d[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")||Ja.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!KP.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=XP(cN(u,+d[1],+d[2]),d[4]);else if(u=H.maxOpen(GP(u.content,i),!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=cN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const KP=/^(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 GP(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=i.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&ZR(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=eD(o[o.length-1],s.length));let d=XR(u,c);o.push(d),i=i.matchType(d.type),s=c}}),o)return Q.from(o)}return t}function XR(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Q.from(t));return t}function ZR(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=ZR(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(Q.from(XR(n,t,i+1))))}}function eD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,eD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Q.empty,!0);return t.copy(n.append(r))}function Fb(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),i<r-1&&(u=Fb(u,e,n,r,i+1,s)),i>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(Q.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function cN(t,e,n){return e<t.openStart&&(t=new H(Fb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(Fb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const tD={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 fN=null;function nD(){return fN||(fN=document.implementation.createHTMLDocument("title"))}let ex=null;function YP(t){let e=window.trustedTypes;return e?(ex||(ex=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),ex.createHTML(t)):t}function QP(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=nD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&tD[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=YP(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function WP(t){let e=t.querySelectorAll(Js?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function XP(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=Q.from(c.create(r[u+1],i)),s++,o++}return new H(i,s,o)}const Ti={},Ar={};function Ba(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Ar.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!iD(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(sp&&Js&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Pv&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,$R(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||HP(t,n)?n.preventDefault():Ba(t,"key")};Ar.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ar.keypress=(t,e)=>{let n=e;if(iD(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Yr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function $g(t){return{left:t.clientX,top:t.clientY}}function ZP(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Uv(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);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),i,!0):u(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Ou(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function ej(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ye.isSelectable(r)?(Ou(t,new ye(n)),!0):!1}function tj(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ye&&(r=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)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Ou(t,ye.create(t.state.doc,i)),!0):!1}function nj(t,e,n,r,i){return Uv(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?tj(t,n):ej(t,n))}function rj(t,e,n,r){return Uv(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function ij(t,e,n,r){return Uv(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||sj(t,n,r)}function sj(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ou(t,Ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(o.inlineContent)Ou(t,Ae.create(r,u+1,u+1+o.content.size));else if(ye.isSelectable(o))Ou(t,ye.create(r,u));else continue;return!0}}function Jv(t){return Jm(t)}const rD=Yr?"metaKey":"ctrlKey";Ti.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Jv(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&ZP(n,t.input.lastClick)&&!n[rD]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords($g(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new aj(t,o,n,!!r)):(s=="doubleClick"?rj:ij)(t,o.pos,o.inside,n)?n.preventDefault():Ba(t,"pointer"))};let aj=class{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[rD],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,o=d.depth?d.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(r.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&&jg&&!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)),Ba(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(()=>$v(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($g(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ba(this.view,"pointer"):nj(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||xl&&this.mightDrag&&!this.mightDrag.node.isAtom||Js&&!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)?(Ou(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ba(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ba(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)}};Ti.touchstart=t=>{t.input.lastTouch=Date.now(),Jv(t),Ba(t,"pointer")};Ti.touchmove=t=>{t.input.lastTouch=Date.now(),Ba(t,"pointer")};Ti.contextmenu=t=>Jv(t);function iD(t,e){return t.composing?!0:xl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const oj=sp?5e3:-1;Ar.compositionstart=Ar.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Js&&HR&&lj(t)))t.markCursor=t.state.storedMarks||n.marks(),Jm(t,!0),t.markCursor=null;else if(Jm(t,!e.selection.empty),jg&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}sD(t,oj)};function lj(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ar.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++,sD(t,20))};function sD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jm(t),e))}function uj(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=cj());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function cj(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Jm(t,e=!1){if(!(sp&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),uj(t),e||t.docView&&t.docView.dirty){let n=zP(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function fj(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Th=ip&&JR<15||Pv&&_P<604;Ti.copy=Ar.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Th?null:n.clipboardData,o=r.content(),{dom:u,text:c}=QR(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):fj(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hj(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function pj(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Pb(t,r.value,null,i,e):Pb(t,r.textContent,r.innerHTML,i,e)},50)}function Pb(t,e,n,r,i){let s=WR(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||H.empty)))return!0;if(!s)return!1;let o=hj(s),u=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function aD(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," "):""}Ar.paste=(t,e)=>{let n=e;if(t.composing&&!sp)return;let r=Th?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Pb(t,aD(r),r.getData("text/html"),i,n)?n.preventDefault():pj(t,n)};let dj=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const mj=Yr?"altKey":"ctrlKey";function oD(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[mj]}Ti.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords($g(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ye?i.to-1:i.to))){if(r&&r.mightDrag)o=ye.create(t.state.doc,r.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:d}=QR(t,u);(!n.dataTransfer.files.length||!Js||qR>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 dj(d,oD(t,n),o)};Ti.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ar.dragover=Ar.dragenter=(t,e)=>e.preventDefault();Ar.drop=(t,e)=>{try{gj(t,e,t.dragging)}finally{t.dragging=null}};function gj(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords($g(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=WR(t,aD(e.dataTransfer),Th?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&oD(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?CP(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(d?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(d&&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((k,E,N,M)=>b=M),c.setSelection(GR(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Ti.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())&&$v(t)},20))};Ti.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)};Ti.beforeinput=(t,e)=>{if(Js&&sp&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,$R(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Ar)Ti[t]=Ar[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}let hN=class lD{constructor(e,n){this.toDOM=e,this.spec=n||Go,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new fl(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof lD&&(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)}},rh=class jb{constructor(e,n){this.attrs=e,this.spec=n||Go}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new fl(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof jb&&Mh(this.attrs,e.attrs)&&Mh(this.spec,e.spec)}static is(e){return e.type instanceof jb}destroy(){}},yj=class uD{constructor(e,n){this.attrs=e,this.spec=n||Go}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new fl(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof uD&&Mh(this.attrs,e.attrs)&&Mh(this.spec,e.spec)}destroy(){}},fl=class Pf{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Pf(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Pf(e,e,new hN(n,r))}static inline(e,n,r,i){return new Pf(e,n,new rh(r,i))}static node(e,n,r,i){return new Pf(e,n,new yj(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof rh}get widget(){return this.type instanceof hN}};const Su=[],Go={};let ri=class Ta{constructor(e,n){this.local=e.length?e:Su,this.children=n.length?n:Su}static create(e,n){return n.length?qm(n,e,0,Go):Ln}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,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))&&r.push(u.copy(u.from+i,u.to+i))}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,r,i+u,s)}}map(e,n,r){return this==Ln||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Go)}mapInner(e,n,r,i,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?bj(this.children,o||[],e,n,r,i,s):o?new Ta(o.sort(Yo),Su):Ln}add(e,n){return n.length?this==Ln?Ta.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,d;if(d=fD(n,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,d,h+1):i.splice(s,0,c,c+u.nodeSize,qm(d,u,h+1,Go)),s+=3}});let o=cD(s?hD(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new Ta(o.length?this.local.concat(o).sort(Yo):this.local,i||this.children)}remove(e){return e.length==0||this==Ln?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,u=r[s]+n,c=r[s+1]+n;for(let d=0,g;d<e.length;d++)(g=e[d])&&g.from>u&&g.to<c&&(e[d]=null,(o||(o=[])).push(g));if(!o)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(o,u+1);h!=Ln?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<i.length;u++)i[u].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Ta(i,r):Ln}forChild(e,n){if(this==Ln)return this;if(n.isLeaf)return Ta.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=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 rh){let h=Math.max(s,c.from)-s,d=Math.min(o,c.to)-s;h<d&&(i||(i=[])).push(c.copy(h,d))}}if(i){let u=new Ta(i.sort(Yo),Su);return r?new xj([u,r]):u}return r||Ln}eq(e){if(this==e)return!0;if(!(e instanceof Ta)||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 qv(this.localsInner(e))}localsInner(e){if(this==Ln)return Su;if(e.inlineContent||!this.local.some(rh.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof rh||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ri.empty=new ri([],[]);ri.removeOverlap=qv;const Ln=ri.empty;let xj=class vu{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Go));return vu.from(r)}forChild(e,n){if(n.isLeaf)return ri.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Ln&&(s instanceof vu?r=r.concat(s.members):r.push(s))}return vu.from(r)}eq(e){if(!(e instanceof vu)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?qv(r?n:n.sort(Yo)):Su}static from(e){switch(e.length){case 0:return Ln;case 1:return e[0];default:return new vu(e.every(n=>n instanceof ri)?e:e.reduce((n,r)=>n.concat(r instanceof ri?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function bj(t,e,n,r,i,s,o){let u=t.slice();for(let h=0,d=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,k,E)=>{let N=E-k-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+d-g)continue;let P=u[M]+d-g;b>=P?u[M+1]=y<=P?-2:-1:y>=d&&N&&(u[M]+=N,u[M+1]+=N)}g+=N}),d=n.maps[h].map(d,-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 d=n.map(t[h]+s),g=d-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-i,{index:k,offset:E}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&E==g&&E+N.nodeSize==b){let M=u[h+2].mapInner(n,N,d+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=Sj(u,t,e,n,i,s,o),d=qm(h,r,0,o);e=d.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<d.children.length;g+=3){let b=d.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,d.children[g],d.children[g+1],d.children[g+2])}}return new ri(e.sort(Yo),u)}function cD(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new fl(i.from+e,i.to+e,i.type))}return n}function Sj(t,e,n,r,i,s,o){function u(c,h){for(let d=0;d<c.local.length;d++){let g=c.local[d].map(r,i,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)u(c.children[d+2],c.children[d]+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 fD(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function hD(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,r){let i=[],s=!1;e.forEach((u,c)=>{let h=fD(t,u,c+n);if(h){s=!0;let d=qm(h,u,n+c+1,r);d!=Ln&&i.push(c,c+u.nodeSize,d)}});let o=cD(s?hD(t):t,-n).sort(Yo);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(r.onRemove&&r.onRemove(o[u].spec),o.splice(u--,1));return o.length||i.length?new ri(o,i):Ln}function Yo(t,e){return t.from-e.from||t.to-e.to}function qv(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),pN(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),pN(e,i,r.copy(s.from,r.to)));break}}}return e}function pN(t,e,n){for(;e<t.length&&Yo(n,t[e])>0;)e++;t.splice(e,0,n)}let $b,Ub;if(typeof WeakMap<"u"){let t=new WeakMap;$b=e=>t.get(e),Ub=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;$b=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Ub=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var bt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+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:r,top:i,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:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,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(i,c),right:Math.max(r,u),bottom:Math.max(s,h)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const u=(t+1)*this.width;for(;o<u&&this.map[o]<i;)o++;return o==u?s-1:this.map[o]}i=s}}static get(t){return $b(t)||Ub(t,vj(t))}};function vj(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=kj(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let h=0,d=e*n;h<d;h++)r[h]=0;for(let h=0,d=0;h<n;h++){const g=t.child(h);d++;for(let k=0;;k++){for(;i<r.length&&r[i]!=0;)i++;if(k==g.childCount)break;const E=g.child(k),{colspan:N,rowspan:M,colwidth:j}=E.attrs;for(let P=0;P<M;P++){if(P+h>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:M-P});break}const U=i+P*e;for(let L=0;L<N;L++){r[U+L]==0?r[U+L]=d:(s||(s=[])).push({type:"collision",row:h,pos:d,n:N-L});const C=j&&j[L];if(C){const z=(U+L)%e*2,G=o[z];G==null||G!=C&&o[z+1]==1?(o[z]=C,o[z+1]=1):G==C&&o[z+1]++}}}i+=N,d+=E.nodeSize}const y=(h+1)*e;let b=0;for(;i<y;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:h,n:b}),d++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const u=new bt(e,n,r,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&&Cj(u,o,t),u}function kj(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const u=t.child(o);for(let c=0;c<u.childCount;c++){const h=u.child(c);o+h.attrs.rowspan>r&&(s+=h.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const u=i.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 Cj(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[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 d=e[(i+h)%t.width*2];d!=null&&(!c.colwidth||c.colwidth[h]!=d)&&((u||(u=wj(c)))[h]=d)}u&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:u})}}function wj(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function dN(t,e){if(typeof t=="string")return{};const n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(o=>Number(o)):null,i=Number(t.getAttribute("colspan")||1),s={colspan:i,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const o in e){const u=e[o].getFromDOM,c=u&&u(t);c!=null&&(s[o]=c)}return s}function mN(t,e){const n={};t.attrs.colspan!=1&&(n.colspan=t.attrs.colspan),t.attrs.rowspan!=1&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(","));for(const r in e){const i=e[r].setDOMAttr;i&&i(t.attrs[r],n)}return n}function Ej(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 Aj(t){const e=t.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:Ej}};for(const r in e)n[r]={default:e[r].default,validate:e[r].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:r=>dN(r,e)}],toDOM(r){return["td",mN(r,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>dN(r,e)}],toDOM(r){return["th",mN(r,e),0]}}}}function ii(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const _a=new hr("selectingCells");function Fu(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 oi(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 Ug(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=Fu(e.$head)||Nj(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Nj(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Jb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Tj(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Hv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function pD(t,e,n){const r=t.node(-1),i=bt.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function hl(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Mj(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function Oj(t,e,n){const r=ii(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Rt=class ws extends Ve{constructor(e,n=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),u=e.node(0),c=i.cellsInRect(o).filter(d=>d!=n.pos-s);c.unshift(n.pos-s);const h=c.map(d=>{const g=r.nodeAt(d);if(!g)throw new RangeError(`No cell with offset ${d} found`);const y=s+d+1;return new oO(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 r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Jb(r)&&Jb(i)&&Hv(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?ws.rowSelection(r,i):s&&this.isColSelection()?ws.colSelection(r,i):new ws(r,i)}return Ae.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=bt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let c=i.top;c<i.bottom;c++){const h=[];for(let d=c*n.width+i.left,g=i.left;g<i.right;g++,d++){const y=n.map[d];if(s[y])continue;s[y]=!0;const b=n.findCell(y);let k=e.nodeAt(y);if(!k)throw new RangeError(`No cell with offset ${y} found`);const E=i.left-b.left,N=b.right-i.right;if(E>0||N>0){let M=k.attrs;if(E>0&&(M=hl(M,0,E)),N>0&&(M=hl(M,M.colspan-N,N)),b.left<i.left){if(k=k.type.createAndFill(M),!k)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(M)}`)}else k=k.type.create(M,k.content)}if(b.top<i.top||b.bottom>i.bottom){const M={...k.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?k=k.type.createAndFill(M):k=k.type.create(M,k.content)}h.push(k)}o.push(e.child(c).copy(Q.from(h)))}const u=this.isColSelection()&&this.isRowSelection()?e:o;return new H(Q.from(u),1,1)}replace(e,n=H.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:u,$to:c}=i[o],h=e.mapping.slice(r);e.replace(h.map(u.pos),h.map(c.pos),o?H.empty:n)}const s=Ve.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new H(Q.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=bt.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),u=i.findCell(n.pos-s),c=e.node(0);return o.top<=u.top?(o.top>0&&(e=c.resolve(s+i.map[o.left])),u.bottom<i.height&&(n=c.resolve(s+i.map[i.width*(i.height-1)+u.right-1]))):(u.top>0&&(n=c.resolve(s+i.map[u.left])),o.bottom<i.height&&(e=c.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new ws(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=bt.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,u=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,u)==n.width}eq(e){return e instanceof ws&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),u=i.findCell(n.pos-s),c=e.node(0);return o.left<=u.left?(o.left>0&&(e=c.resolve(s+i.map[o.top*i.width])),u.right<i.width&&(n=c.resolve(s+i.map[i.width*(u.top+1)-1]))):(u.left>0&&(n=c.resolve(s+i.map[u.top*i.width])),o.right<i.width&&(e=c.resolve(s+i.map[i.width*(o.top+1)-1]))),new ws(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ws(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ws(e.resolve(n),e.resolve(r))}getBookmark(){return new Rj(this.$anchorCell.pos,this.$headCell.pos)}};Rt.prototype.visible=!1;Ve.jsonID("cell",Rt);var Rj=class dD{constructor(e,n){this.anchor=e,this.head=n}map(e){return new dD(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Hv(n,r)?new Rt(n,r):Ve.near(r,1)}};function Dj(t){if(!(t.selection instanceof Rt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(fl.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ri.create(t.doc,e)}function Ij({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function _j({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function zj(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof ye&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Rt.create(i,r.from);else if(o=="row"){const u=i.resolve(r.from+1);s=Rt.rowSelection(u,u)}else if(!n){const u=bt.get(r.node),c=r.from+1,h=c+u.map[u.width*u.height-1];s=Rt.create(i,c+1,h)}}else r instanceof Ae&&Ij(r)?s=Ae.create(i,r.from):r instanceof Ae&&_j(r)&&(s=Ae.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const Lj=new hr("fix-tables");function mD(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,u=0;o<s;o++){const c=e.child(o);for(let h=u,d=Math.min(i,o+3);h<d;h++)if(t.child(h)==c){u=h+1,n+=c.nodeSize;continue e}r(c,n),u<i&&t.child(u).sameMarkup(c)?mD(t.child(u),c,n+1,r):c.nodesBetween(0,c.content.size,r,n+1),n+=c.nodeSize}}function Bj(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=Vj(t,i,s,n))};return e?e.doc!=t.doc&&mD(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Vj(t,e,n,r){const i=bt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let c=0;c<i.height;c++)s.push(0);for(let c=0;c<i.problems.length;c++){const h=i.problems[c];if(h.type=="collision"){const d=e.nodeAt(h.pos);if(!d)continue;const g=d.attrs;for(let y=0;y<g.rowspan;y++)s[h.row+y]+=h.n;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,hl(g,g.colspan-h.n,h.n))}else if(h.type=="missing")s[h.row]+=h.n;else if(h.type=="overlong_rowspan"){const d=e.nodeAt(h.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-h.n})}else if(h.type=="colwidth mismatch"){const d=e.nodeAt(h.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,{...d.attrs,colwidth:h.colwidth})}else if(h.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+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<i.height;c++){const d=e.child(c),g=h+d.nodeSize,y=s[c];if(y>0){let b="cell";d.firstChild&&(b=d.firstChild.type.spec.tableRole);const k=[];for(let N=0;N<y;N++){const M=ii(t.schema)[b].createAndFill();M&&k.push(M)}const E=(c==0||o==c-1)&&u==c?h+1:g-1;r.insert(r.mapping.map(E),k)}h=g}return r.setMeta(Lj,{fixTables:!0})}function gD(t){const e=bt.get(t),n=[],r=e.height,i=e.width;for(let s=0;s<r;s++){const o=[];for(let u=0;u<i;u++){const c=s*i+u,h=e.map[c];if(s>0){const d=c-i;if(h===e.map[d]){o.push(null);continue}}if(u>0){const d=c-1;if(h===e.map[d]){o.push(null);continue}}o.push(t.nodeAt(h))}n.push(o)}return n}function yD(t,e){const n=[],r=bt.get(t),i=r.height,s=r.width;for(let o=0;o<i;o++){const u=t.child(o),c=[];for(let d=0;d<s;d++){const g=e[o][d];if(!g)continue;const y=r.map[o*r.width+d],b=t.nodeAt(y);if(!b)continue;const k=b.type.createChecked(g.attrs,g.content,g.marks);c.push(k)}const h=u.type.createChecked(u.attrs,c,u.marks);n.push(h)}return t.type.createChecked(t.attrs,n,t.marks)}function xD(t,e,n,r){const i=e[0]>n[0]?-1:1,s=t.splice(e[0],e.length),o=s.length%2===0?1:0;let u;return u=i===-1?n[0]:n[n.length-1]-o,t.splice(u,0,...s),t}function ap(t){return Fj(e=>e.type.spec.tableRole==="table",t)}function Fj(t,e){for(let n=e.depth;n>=0;n-=1){const r=e.node(n);if(t(r))return{node:r,pos:n===0?0:e.before(n),start:e.start(n),depth:n}}return null}function ku(t,e){const n=ap(e.$from);if(!n)return;const r=bt.get(n.node);if(!(t<0||t>r.width-1))return r.cellsInRect({left:t,right:t+1,top:0,bottom:r.height}).map(i=>{const s=n.node.nodeAt(i),o=i+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function Cu(t,e){const n=ap(e.$from);if(!n)return;const r=bt.get(n.node);if(!(t<0||t>r.height-1))return r.cellsInRect({left:0,right:r.width,top:t,bottom:t+1}).map(i=>{const s=n.node.nodeAt(i),o=i+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function gN(t,e,n=e){let r=e,i=n;for(let d=e;d>=0;d--){const g=ku(d,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.colspan+d-1;b>=r&&(r=d),b>i&&(i=b)})}for(let d=e;d<=i;d++){const g=ku(d,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.colspan+d-1;y.node.attrs.colspan>1&&b>i&&(i=b)})}const s=[];for(let d=r;d<=i;d++){const g=ku(d,t.selection);g&&g.length>0&&s.push(d)}r=s[0],i=s[s.length-1];const o=ku(r,t.selection),u=Cu(0,t.selection);if(!o||!u)return;const c=t.doc.resolve(o[o.length-1].pos);let h;for(let d=i;d>=r;d--){const g=ku(d,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 yN(t,e,n=e){let r=e,i=n;for(let d=e;d>=0;d--){const g=Cu(d,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.rowspan+d-1;b>=r&&(r=d),b>i&&(i=b)})}for(let d=e;d<=i;d++){const g=Cu(d,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.rowspan+d-1;y.node.attrs.rowspan>1&&b>i&&(i=b)})}const s=[];for(let d=r;d<=i;d++){const g=Cu(d,t.selection);g&&g.length>0&&s.push(d)}r=s[0],i=s[s.length-1];const o=Cu(r,t.selection),u=ku(0,t.selection);if(!o||!u)return;const c=t.doc.resolve(o[o.length-1].pos);let h;for(let d=i;d>=r;d--){const g=Cu(d,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 xN(t){return t[0].map((e,n)=>t.map(r=>r[n]))}function Pj(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:u}=t,c=ap(r.doc.resolve(u));if(!c)return!1;const h=(e=gN(r,i))===null||e===void 0?void 0:e.indexes,d=(n=gN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!d||h.includes(s))return!1;const g=jj(c.node,h,d);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=bt.get(g),b=c.start,k=s,E=y.positionAt(y.height-1,k,g),N=r.doc.resolve(b+E),M=y.positionAt(0,k,g),j=r.doc.resolve(b+M);return r.setSelection(Rt.colSelection(N,j)),!0}function jj(t,e,n,r){let i=xN(gD(t));return i=xD(i,e,n),i=xN(i),yD(t,i)}function $j(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:u}=t,c=ap(r.doc.resolve(u));if(!c)return!1;const h=(e=yN(r,i))===null||e===void 0?void 0:e.indexes,d=(n=yN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!d||h.includes(s))return!1;const g=Uj(c.node,h,d);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=bt.get(g),b=c.start,k=s,E=y.positionAt(k,y.width-1,g),N=r.doc.resolve(b+E),M=y.positionAt(k,0,g),j=r.doc.resolve(b+M);return r.setSelection(Rt.rowSelection(N,j)),!0}function Uj(t,e,n,r){let i=gD(t);return i=xD(i,e,n),yD(t,i)}function to(t){const e=t.selection,n=Ug(t),r=n.node(-1),i=n.start(-1),s=bt.get(r);return{...e instanceof Rt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function bD(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;Oj(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const u=o*e.width+i;if(i>0&&i<e.width&&e.map[u-1]==e.map[u]){const c=e.map[u],h=r.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,Mj(h.attrs,i-e.colCount(c))),o+=h.attrs.rowspan-1}else{const c=s==null?ii(r.type.schema).cell:r.nodeAt(e.map[u+s]).type,h=e.positionAt(o,i,r);t.insert(t.mapping.map(n+h),c.createAndFill())}}return t}function Jj(t,e){if(!oi(t))return!1;if(e){const n=to(t);e(bD(t.tr,n,n.left))}return!0}function qj(t,e){if(!oi(t))return!1;if(e){const n=to(t);e(bD(t.tr,n,n.right))}return!0}function Hj(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const u=o*e.width+i,c=e.map[u],h=n.nodeAt(c),d=h.attrs;if(i>0&&e.map[u-1]==c||i<e.width-1&&e.map[u+1]==c)t.setNodeMarkup(t.mapping.slice(s).map(r+c),null,hl(d,i-e.colCount(c)));else{const g=t.mapping.slice(s).map(r+c);t.delete(g,g+h.nodeSize)}o+=d.rowspan}}function Kj(t,e){if(!oi(t))return!1;if(e){const n=to(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;Hj(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=bt.get(s)}e(r)}return!0}function Gj(t,{map:e,table:n,tableStart:r},i){let s=0;for(let h=0;h<i;h++)s+=n.child(h).nodeSize;const o=s+n.child(i).nodeSize,u=t.mapping.maps.length;t.delete(s+r,o+r);const c=new Set;for(let h=0,d=i*e.width;h<e.width;h++,d++){const g=e.map[d];if(!c.has(g)){if(c.add(g),i>0&&g==e.map[d-e.width]){const y=n.nodeAt(g).attrs;t.setNodeMarkup(t.mapping.slice(u).map(g+r),null,{...y,rowspan:y.rowspan-1}),h+=y.colspan-1}else if(i<e.height&&g==e.map[d+e.width]){const y=n.nodeAt(g),b=y.attrs,k=y.type.create({...b,rowspan:y.attrs.rowspan-1},y.content),E=e.positionAt(i+1,h,n);t.insert(t.mapping.slice(u).map(r+E),k),h+=b.colspan-1}}}}function Yj(t,e){if(!oi(t))return!1;if(e){const n=to(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;Gj(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=bt.get(n.table)}e(r)}return!0}function Qj(t,e){return function(n,r){if(!oi(n))return!1;const i=Ug(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){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(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function Wj(t){return function(e,n){if(!oi(e))return!1;if(n){const r=ii(e.schema),i=to(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),u=o.map(c=>i.table.nodeAt(c));for(let c=0;c<o.length;c++)u[c].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[c],r.cell,u[c].attrs);if(s.steps.length===0)for(let c=0;c<o.length;c++)s.setNodeMarkup(i.tableStart+o[c],r.header_cell,u[c].attrs);n(s)}return!0}}function bN(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function Kv(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Wj(t):function(n,r){if(!oi(n))return!1;if(r){const i=ii(n.schema),s=to(n),o=n.tr,u=bN("row",s,i),c=bN("column",s,i),h=(t==="column"?u:t==="row"&&c)?1:0,d=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?i.cell:i.header_cell:t=="row"?u?i.cell:i.header_cell:i.cell;s.map.cellsInRect(d).forEach(y=>{const b=y+s.tableStart,k=o.doc.nodeAt(b);k&&o.setNodeMarkup(b,g,k.attrs)}),r(o)}return!0}}Kv("row",{useDeprecatedLogic:!0});Kv("column",{useDeprecatedLogic:!0});Kv("cell",{useDeprecatedLogic:!0});function Xj(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function SD(t){return function(e,n){if(!oi(e))return!1;const r=Xj(Ug(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Ae.between(i,Tj(i))).scrollIntoView())}return!0}}function Zj(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function zd(t,e){const n=t.selection;if(!(n instanceof Rt))return!1;if(e){const r=t.tr,i=ii(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new H(i,0,0))}),r.docChanged&&e(r)}return!0}function e$(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=t,u=e.tr;return $j({tr:u,originIndex:r,targetIndex:i,select:s,pos:o})?(n?.(u),!0):!1}}function t$(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=t,u=e.tr;return Pj({tr:u,originIndex:r,targetIndex:i,select:s,pos:o})?(n?.(u),!0):!1}}function n$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,u=[];if(s=="row")for(let c=0;c<e.childCount;c++){let h=e.child(c).content;const d=c?0:Math.max(0,n-1),g=c<e.childCount-1?0:Math.max(0,r-1);(d||g)&&(h=qb(ii(o).row,new H(h,d,g)).content),u.push(h)}else if(s=="cell"||s=="header_cell")u.push(n||r?qb(ii(o).row,new H(e,n,r)).content:e);else return null;return r$(o,u)}function r$(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:u,colspan:c}=s.child(o).attrs;for(let h=i;h<i+u;h++)n[h]=(n[h]||0)+c}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(Q.empty),n[i]<r){const s=ii(t).cell.createAndFill(),o=[];for(let u=n[i];u<r;u++)o.push(s);e[i]=e[i].append(Q.from(o))}return{height:e.length,width:r,rows:e}}function qb(t,e){const n=t.createAndFill();return new RP(n).replace(0,n.content.size,e).doc}function i$({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let u=0;u<n.length;u++){const c=n[u],h=[];for(let d=s[u]||0,g=0;d<r;g++){let y=c.child(g%c.childCount);d+y.attrs.colspan>r&&(y=y.type.createChecked(hl(y.attrs,y.attrs.colspan,d+y.attrs.colspan-r),y.content)),h.push(y),d+=y.attrs.colspan;for(let b=1;b<y.attrs.rowspan;b++)s[u+b]=(s[u+b]||0)+y.attrs.colspan}o.push(Q.from(h))}n=o,t=r}if(e!=i){const s=[];for(let o=0,u=0;o<i;o++,u++){const c=[],h=n[u%e];for(let d=0;d<h.childCount;d++){let g=h.child(d);o+g.attrs.rowspan>i&&(g=g.type.create({...g.attrs,rowspan:Math.max(1,i-g.attrs.rowspan)},g.content)),c.push(g)}s.push(Q.from(c))}n=s,e=i}return{width:t,height:e,rows:n}}function s$(t,e,n,r,i,s,o){const u=t.doc.type.schema,c=ii(u);let h,d;if(i>e.width)for(let g=0,y=0;g<e.height;g++){const b=n.child(g);y+=b.nodeSize;const k=[];let E;b.lastChild==null||b.lastChild.type==c.cell?E=h||(h=c.cell.createAndFill()):E=d||(d=c.header_cell.createAndFill());for(let N=e.width;N<i;N++)k.push(E);t.insert(t.mapping.slice(o).map(y-1+r),k)}if(s>e.height){const g=[];for(let k=0,E=(e.height-1)*e.width;k<Math.max(e.width,i);k++){const N=k>=e.width?!1:n.nodeAt(e.map[E+k]).type==c.header_cell;g.push(N?d||(d=c.header_cell.createAndFill()):h||(h=c.cell.createAndFill()))}const y=c.row.create(null,Q.from(g)),b=[];for(let k=e.height;k<s;k++)b.push(y);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),b)}return!!(h||d)}function SN(t,e,n,r,i,s,o,u){if(o==0||o==e.height)return!1;let c=!1;for(let h=i;h<s;h++){const d=o*e.width+h,g=e.map[d];if(e.map[d-e.width]==g){c=!0;const y=n.nodeAt(g),{top:b,left:k}=e.findCell(g);t.setNodeMarkup(t.mapping.slice(u).map(g+r),null,{...y.attrs,rowspan:o-b}),t.insert(t.mapping.slice(u).map(e.positionAt(o,k,n)),y.type.createAndFill({...y.attrs,rowspan:b+y.attrs.rowspan-o})),h+=y.attrs.colspan-1}}return c}function vN(t,e,n,r,i,s,o,u){if(o==0||o==e.width)return!1;let c=!1;for(let h=i;h<s;h++){const d=h*e.width+o,g=e.map[d];if(e.map[d-1]==g){c=!0;const y=n.nodeAt(g),b=e.colCount(g),k=t.mapping.slice(u).map(g+r);t.setNodeMarkup(k,null,hl(y.attrs,o-b,y.attrs.colspan-(o-b))),t.insert(k+y.nodeSize,y.type.createAndFill(hl(y.attrs,0,o-b))),h+=y.attrs.rowspan-1}}return c}function kN(t,e,n,r,i){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}=r,h=c+i.width,d=u+i.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}s$(g,o,s,n,h,d,y)&&b(),SN(g,o,s,n,c,h,u,y)&&b(),SN(g,o,s,n,c,h,d,y)&&b(),vN(g,o,s,n,u,d,c,y)&&b(),vN(g,o,s,n,u,d,h,y)&&b();for(let k=u;k<d;k++){const E=o.positionAt(k,c,s),N=o.positionAt(k,h,s);g.replace(g.mapping.slice(y).map(E+n),g.mapping.slice(y).map(N+n),new H(i.rows[k-u],0,0))}b(),g.setSelection(new Rt(g.doc.resolve(n+o.positionAt(u,c,s)),g.doc.resolve(n+o.positionAt(d-1,h-1,s)))),e(g)}const a$=MO({ArrowLeft:Ld("horiz",-1),ArrowRight:Ld("horiz",1),ArrowUp:Ld("vert",-1),ArrowDown:Ld("vert",1),"Shift-ArrowLeft":Bd("horiz",-1),"Shift-ArrowRight":Bd("horiz",1),"Shift-ArrowUp":Bd("vert",-1),"Shift-ArrowDown":Bd("vert",1),Backspace:zd,"Mod-Backspace":zd,Delete:zd,"Mod-Delete":zd});function ym(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ld(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Rt)return ym(n,r,Ve.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=vD(i,t,e);if(o==null)return!1;if(t=="horiz")return ym(n,r,Ve.near(n.doc.resolve(s.head+e),e));{const u=n.doc.resolve(o),c=pD(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),ym(n,r,h)}}}function Bd(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Rt)o=s;else{const c=vD(i,t,e);if(c==null)return!1;o=new Rt(n.doc.resolve(c))}const u=pD(o.$headCell,t,e);return u?ym(n,r,new Rt(o.$anchorCell,u)):!1}}function o$(t,e){const n=t.state.doc,r=Fu(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Rt(r))),!0):!1}function l$(t,e,n){if(!oi(t.state))return!1;let r=n$(n);const i=t.state.selection;if(i instanceof Rt){r||(r={width:1,height:1,rows:[Q.from(qb(ii(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),u=bt.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=i$(r,u.right-u.left,u.bottom-u.top),kN(t.state,t.dispatch,o,u,r),!0}else if(r){const s=Ug(t.state),o=s.start(-1);return kN(t.state,t.dispatch,o,bt.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function u$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=CN(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Rt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Fu(t.state.selection.$anchor))!=null&&((n=tx(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(c,h){let d=tx(t,h);const g=_a.getState(t.state)==null;if(!d||!Hv(c,d))if(g)d=c;else return;const y=new Rt(c,d);if(g||!t.state.selection.eq(y)){const b=t.state.tr.setSelection(y);g&&b.setMeta(_a,c.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",u),_a.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_a,-1))}function u(c){const h=c,d=_a.getState(t.state);let g;if(d!=null)g=t.state.doc.resolve(d);else if(CN(t,h.target)!=r&&(g=tx(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 vD(t,e,n){if(!(t.state.selection instanceof Ae))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?o:null}}return null}function CN(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function tx(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Fu(t.state.doc.resolve(r))||Fu(t.state.doc.resolve(i))}var c$=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")),Hb(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,Hb(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Hb(t,e,n,r,i,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:k}=h.child(g).attrs;for(let E=0;E<b;E++,y++){const N=i==y?s:k&&k[E],M=N?N+"px":"";if(o+=N||r,N||(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 d;const g=c.nextSibling;(d=c.parentNode)===null||d===void 0||d.removeChild(c),c=g}u?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const Cr=new hr("tableColumnResizing");function f$({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=c$,lastColumnResizable:i=!0}={}){const s=new fr({key:Cr,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,d=ii(u.schema).table.name;return r&&h&&(h[d]=(g,y)=>new r(g,n,y)),new h$(-1,!1)},apply(o,u){return u.apply(o)}},props:{attributes:o=>{const u=Cr.getState(o);return u&&u.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,u)=>{p$(o,u,t,i)},mouseleave:o=>{d$(o)},mousedown:(o,u)=>{m$(o,u,e,n)}},decorations:o=>{const u=Cr.getState(o);if(u&&u.activeHandle>-1)return S$(o,u.activeHandle)},nodeViews:{}}});return s}var h$=class xm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Cr);if(r&&r.setHandle!=null)return new xm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new xm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Jb(e.doc.resolve(i))||(i=-1),new xm(i,n.dragging)}return n}};function p$(t,e,n,r){if(!t.editable)return;const i=Cr.getState(t.state);if(i&&!i.dragging){const s=y$(e.target);let o=-1;if(s){const{left:u,right:c}=s.getBoundingClientRect();e.clientX-u<=n?o=wN(t,e,"left",n):c-e.clientX<=n&&(o=wN(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const u=t.state.doc.resolve(o),c=u.node(-1),h=bt.get(c),d=u.start(-1);if(h.colCount(u.pos-d)+u.nodeAfter.attrs.colspan-1==h.width-1)return}kD(t,o)}}}function d$(t){if(!t.editable)return;const e=Cr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&kD(t,-1)}function m$(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=Cr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const u=t.state.doc.nodeAt(o.activeHandle),c=g$(t,o.activeHandle,u.attrs);t.dispatch(t.state.tr.setMeta(Cr,{setDragging:{startX:e.clientX,startWidth:c}}));function h(g){s.removeEventListener("mouseup",h),s.removeEventListener("mousemove",d);const y=Cr.getState(t.state);y?.dragging&&(x$(t,y.activeHandle,EN(y.dragging,g,n)),t.dispatch(t.state.tr.setMeta(Cr,{setDragging:null})))}function d(g){if(!g.which)return h(g);const y=Cr.getState(t.state);if(y&&y.dragging){const b=EN(y.dragging,g,n);AN(t,y.activeHandle,b,r)}}return AN(t,o.activeHandle,c,r),s.addEventListener("mouseup",h),s.addEventListener("mousemove",d),e.preventDefault(),!0}function g$(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(o-=r[c],u--);return o/u}function y$(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function wN(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,u=Fu(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),d=c.map.indexOf(u.pos-h);return d%c.width==0?-1:h+c.map[d-1]}function EN(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function kD(t,e){t.dispatch(t.state.tr.setMeta(Cr,{setHandle:e}))}function x$(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=bt.get(i),o=r.start(-1),u=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let h=0;h<s.height;h++){const d=h*s.width+u;if(h&&s.map[d]==s.map[d-s.width])continue;const g=s.map[d],y=i.nodeAt(g).attrs,b=y.colspan==1?0:u-s.colCount(g);if(y.colwidth&&y.colwidth[b]==n)continue;const k=y.colwidth?y.colwidth.slice():b$(y.colspan);k[b]=n,c.setNodeMarkup(o+g,null,{...y,colwidth:k})}c.docChanged&&t.dispatch(c)}function AN(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),u=bt.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let c=t.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&Hb(s,c.firstChild,c,r,u,n)}function b$(t){return Array(t).fill(0)}function S$(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ri.empty;const s=bt.get(i),o=r.start(-1),u=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let h=0;h<s.height;h++){const d=u+h*s.width;if((u==s.width-1||s.map[d]!=s.map[d+1])&&(h==0||s.map[d]!=s.map[d-s.width])){var c;const g=s.map[d],y=o+g+i.nodeAt(g).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((c=Cr.getState(t))===null||c===void 0)&&c.dragging&&n.push(fl.node(o+g,o+g+i.nodeAt(g).nodeSize,{class:"column-resize-dragging"})),n.push(fl.widget(y,b))}}return ri.create(t.doc,n)}function v$({allowTableNodeSelection:t=!1}={}){return new fr({key:_a,state:{init(){return null},apply(e,n){const r=e.getMeta(_a);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:Dj,handleDOMEvents:{mousedown:u$},createSelectionBetween(e){return _a.getState(e.state)!=null?e.state.selection:null},handleTripleClick:o$,handleKeyDown:a$,handlePaste:l$},appendTransaction(e,n,r){return zj(r,Bj(r,n),t)}})}const CD=65535,wD=Math.pow(2,16);function k$(t,e){return t+e*wD}function NN(t){return t&CD}function C$(t){return(t-(t&CD))/wD}const ED=1,AD=2,bm=4,ND=8;class TN{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ND)>0}get deletedBefore(){return(this.delInfo&(ED|bm))>0}get deletedAfter(){return(this.delInfo&(AD|bm))>0}get deletedAcross(){return(this.delInfo&bm)>0}}class wr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&wr.empty)return wr.empty}recover(e){let n=0,r=NN(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+C$(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,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],d=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:d);if(r)return b;let k=e==(n<0?c:g)?null:k$(u/3,e-c),E=e==c?AD:e==g?ED:bm;return(n<0?e!=c:e!=g)&&(E|=ND),new TN(b,E,k)}i+=d-h}return r?e+i:new TN(e+i,0,null)}touches(e,n){let r=0,i=NN(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?r:0);if(c>e)break;let h=this.ranges[u+s],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new wr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wr.empty:new wr(e<0?[0,-e,0]:[0,0,e])}}wr.empty=new wr([]);const nx=Object.create(null);class On{getMap(){return wr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=nx[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in nx)throw new RangeError("Duplicate use of step JSON ID "+e);return nx[e]=n,n.prototype.jsonID=e,n}}class Wt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Wt(e,null)}static fail(e){return new Wt(null,e)}static fromReplace(e,n,r,i){try{return Wt.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ei)return Wt.fail(s.message);throw s}}}function Gv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Gv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}class Bo extends On{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(Gv(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Wt.fromReplace(e,this.from,this.to,s)}invert(){return new Vo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Bo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Bo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bo(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 Bo(n.from,n.to,e.markFromJSON(n.mark))}}On.jsonID("addMark",Bo);class Vo extends On{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(Gv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Wt.fromReplace(e,this.from,this.to,r)}invert(){return new Bo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Vo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Vo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vo(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 Vo(n.from,n.to,e.markFromJSON(n.mark))}}On.jsonID("removeMark",Vo);class Fo extends On{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Wt.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Fo(this.pos,n.marks[i]);return new Fo(this.pos,this.mark)}}return new Oh(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Fo(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 Fo(n.pos,e.markFromJSON(n.mark))}}On.jsonID("addNodeMark",Fo);class Oh extends On{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Wt.fromReplace(e,this.pos,this.pos+1,new H(Q.from(r),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 Oh(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 Oh(n.pos,e.markFromJSON(n.mark))}}On.jsonID("removeNodeMark",Oh);class Da extends On{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Kb(e,this.from,this.to)?Wt.fail("Structure replace would overwrite content"):Wt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Da(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Da(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Da)||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 Da(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 Da(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 Da(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}}On.jsonID("replace",Da);class ih extends On{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Kb(e,this.from,this.gapFrom)||Kb(e,this.gapTo,this.to)))return Wt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Wt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Wt.fromReplace(e,this.from,this.to,r):Wt.fail("Content does not fit in gap")}getMap(){return new wr([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 ih(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new ih(n.pos,r.pos,i,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 ih(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}}On.jsonID("replaceAround",ih);function Kb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function w$(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let u=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(u>0?1:0),h=r.node(o),d=!1;if(s==1)d=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);d=g&&h.canReplaceWith(c,c,g[0])}if(d)return u==0?r.pos:u<0?r.before(o+1):r.after(o+1)}return null}class sh extends On{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Wt.fromReplace(e,this.pos,this.pos+1,new H(Q.from(i),0,n.isLeaf?0:1))}getMap(){return wr.empty}invert(e){return new sh(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 sh(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 sh(n.pos,n.attr,n.value)}}On.jsonID("attr",sh);class Hm extends On{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Wt.ok(r)}getMap(){return wr.empty}invert(e){return new Hm(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 Hm(n.attr,n.value)}}On.jsonID("docAttr",Hm);let Rh=class extends Error{};Rh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Rh.prototype=Object.create(Error.prototype);Rh.prototype.constructor=Rh;Rh.prototype.name="TransformError";const bl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},TD=function(t,e,n,r){return n&&(MN(t,e,n,r,-1)||MN(t,e,n,r,1))},E$=/^(img|br|input|textarea|hr)$/i;function MN(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Km(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Yv(t)||E$.test(t.nodeName)||t.contentEditable=="false")return!1;e=bl(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Km(t):0}else return!1}}function Km(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function A$(t,e,n){for(let r=e==0,i=e==Km(t);r||i;){if(t==n)return!0;let s=bl(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Km(t)}}function Yv(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 MD=function(t){return t.focusNode&&TD(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function OD(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const qi=typeof navigator<"u"?navigator:null,ON=typeof document<"u"?document:null,no=qi&&qi.userAgent||"",Gb=/Edge\/(\d+)/.exec(no),RD=/MSIE \d/.exec(no),Yb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(no),op=!!(RD||Yb||Gb),DD=RD?document.documentMode:Yb?+Yb[1]:Gb?+Gb[1]:0,Jg=!op&&/gecko\/(\d+)/i.test(no);Jg&&+(/Firefox\/(\d+)/.exec(no)||[0,0])[1];const Qb=!op&&/Chrome\/(\d+)/.exec(no),qs=!!Qb,ID=Qb?+Qb[1]:0,Sl=!op&&!!qi&&/Apple Computer/.test(qi.vendor),Qv=Sl&&(/Mobile\/\w+/.test(no)||!!qi&&qi.maxTouchPoints>2),Qr=Qv||(qi?/Mac/.test(qi.platform):!1),_D=qi?/Win/.test(qi.platform):!1,lp=/Android \d/.test(no),Wv=!!ON&&"webkitFontSmoothing"in ON.documentElement.style,N$=Wv?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function T$(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=r.resolve(o),c,h;if(MD(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&ye.isSelectable(g)&&i.parent&&!(g.isInline&&A$(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new ye(o==y?u:r.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 k=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(k.startContainer,k.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(k.endContainer,k.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=LD(t,d,u,g)}return h}function zD(t){return t.editable?t.hasFocus():D$(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Xv(t,e=!1){let n=t.state.selection;if(R$(t,n),!!zD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&qs){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&TD(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)O$(t);else{let{anchor:r,head:i}=n,s,o;RN&&!(n instanceof Ae)&&(n.$from.parent.inlineContent||(s=DN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=DN(t,n.to))),t.docView.setSelection(r,i,t,e),RN&&(s&&IN(s),o&&IN(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&M$(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const RN=Sl||qs&&ID<63;function DN(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Sl&&i&&i.contentEditable=="false")return rx(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return rx(i);if(s)return rx(s)}}function rx(t){return t.contentEditable="true",Sl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function IN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function M$(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!zD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function O$(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,bl(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&op&&DD<=11&&(n.disabled=!0,n.disabled=!1)}function R$(t,e){if(e instanceof ye){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(_N(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else _N(t)}function _N(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function LD(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Ae.between(e,n,r)}function D$(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 Wb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ve.findFrom(s,e)}function Ia(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function zN(t,e,n){let r=t.state.selection;if(r instanceof Ae)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ia(t,new Ae(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Wb(t.state,e);return i&&i instanceof ye?Ia(t,i):!1}else if(!(Qr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ye.isSelectable(s)?Ia(t,new ye(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Wv?Ia(t,new Ae(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ye&&r.node.isInline)return Ia(t,new Ae(e>0?r.$to:r.$from));{let i=Wb(t.state,e);return i?Ia(t,i):!1}}}function Gm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ah(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function uu(t,e){return e<0?I$(t):_$(t)}function I$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Jg&&n.nodeType==1&&r<Gm(n)&&ah(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(ah(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(BD(n))break;{let u=n.previousSibling;for(;u&&ah(u,-1);)i=n.parentNode,s=bl(u),u=u.previousSibling;if(u)n=u,r=Gm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Xb(t,n,r):i&&Xb(t,i,s)}function _$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Gm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(ah(u,1))s=n,o=++r;else break}else{if(BD(n))break;{let u=n.nextSibling;for(;u&&ah(u,1);)s=u.parentNode,o=bl(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=Gm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Xb(t,s,o)}function BD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function z$(t,e){for(;t&&e==t.childNodes.length&&!Yv(t);)e=bl(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 L$(t,e){for(;t&&!e&&!Yv(t);)e=bl(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 Xb(t,e,n){if(e.nodeType!=3){let s,o;(o=z$(e,n))?(e=o,n=0):(s=L$(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(MD(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Xv(t)},50)}function LN(t,e){let n=t.state.doc.resolve(e);if(!(qs||_D)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function BN(t,e,n){let r=t.state.selection;if(r instanceof Ae&&!r.empty||n.indexOf("s")>-1||Qr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Wb(t.state,e);if(o&&o instanceof ye)return Ia(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Ia(t,u):!1}return!1}function VN(t,e){if(!(t.state.selection instanceof Ae))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let 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 FN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function B$(t){if(!Sl||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;FN(t,r,"true"),setTimeout(()=>FN(t,r,"false"),20)}return!1}function V$(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function F$(t,e){let n=e.keyCode,r=V$(e);if(n==8||Qr&&n==72&&r=="c")return VN(t,-1)||uu(t,-1);if(n==46&&!e.shiftKey||Qr&&n==68&&r=="c")return VN(t,1)||uu(t,1);if(n==13||n==27)return!0;if(n==37||Qr&&n==66&&r=="c"){let i=n==37?LN(t,t.state.selection.from)=="ltr"?-1:1:-1;return zN(t,i,r)||uu(t,i)}else if(n==39||Qr&&n==70&&r=="c"){let i=n==39?LN(t,t.state.selection.from)=="ltr"?1:-1:1;return zN(t,i,r)||uu(t,i)}else{if(n==38||Qr&&n==80&&r=="c")return BN(t,-1,r)||uu(t,-1);if(n==40||Qr&&n==78&&r=="c")return B$(t)||BN(t,1,r)||uu(t,1);if(r==(Qr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function VD(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Yi.fromSchema(t.state.schema),u=JD(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=UD[h.nodeName.toLowerCase()]);){for(let b=d.length-1;b>=0;b--){let k=u.createElement(d[b]);for(;c.firstChild;)k.appendChild(c.firstChild);c.appendChild(k),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${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 FD(t,e,n,r,i){let s=i.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return u=new H(Q.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,i,r,t));if(g)u=g;else{let y=i.marks(),{schema:b}=t.state,k=Yi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let N=o.appendChild(document.createElement("p"));E&&N.appendChild(k.serializeNode(b.text(E,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=U$(n),Wv&&J$(o);let h=o&&o.querySelector("[data-pm-slice]"),d=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let g=+d[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")||Ja.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!P$.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=q$(PN(u,+d[1],+d[2]),d[4]);else if(u=H.maxOpen(j$(u.content,i),!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=PN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const P$=/^(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 j$(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=i.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&jD(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=$D(o[o.length-1],s.length));let d=PD(u,c);o.push(d),i=i.matchType(d.type),s=c}}),o)return Q.from(o)}return t}function PD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Q.from(t));return t}function jD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=jD(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(Q.from(PD(n,t,i+1))))}}function $D(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,$D(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Q.empty,!0);return t.copy(n.append(r))}function Zb(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),i<r-1&&(u=Zb(u,e,n,r,i+1,s)),i>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(Q.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function PN(t,e,n){return e<t.openStart&&(t=new H(Zb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(Zb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const UD={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 jN=null;function JD(){return jN||(jN=document.implementation.createHTMLDocument("title"))}let ix=null;function $$(t){let e=window.trustedTypes;return e?(ix||(ix=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),ix.createHTML(t)):t}function U$(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=JD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&UD[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=$$(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function J$(t){let e=t.querySelectorAll(qs?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function q$(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=Q.from(c.create(r[u+1],i)),s++,o++}return new H(i,s,o)}const Mi={},Nr={};function Va(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Nr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!HD(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(lp&&qs&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Qv&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,OD(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||F$(t,n)?n.preventDefault():Va(t,"key")};Nr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Nr.keypress=(t,e)=>{let n=e;if(HD(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Qr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function qg(t){return{left:t.clientX,top:t.clientY}}function H$(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Zv(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);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),i,!0):u(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Ru(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function K$(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ye.isSelectable(r)?(Ru(t,new ye(n)),!0):!1}function G$(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ye&&(r=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)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Ru(t,ye.create(t.state.doc,i)),!0):!1}function Y$(t,e,n,r,i){return Zv(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?G$(t,n):K$(t,n))}function Q$(t,e,n,r){return Zv(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function W$(t,e,n,r){return Zv(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||X$(t,n,r)}function X$(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ru(t,Ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(o.inlineContent)Ru(t,Ae.create(r,u+1,u+1+o.content.size));else if(ye.isSelectable(o))Ru(t,ye.create(r,u));else continue;return!0}}function ek(t){return Ym(t)}const qD=Qr?"metaKey":"ctrlKey";Mi.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ek(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&H$(n,t.input.lastClick)&&!n[qD]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(qg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Z$(t,o,n,!!r)):(s=="doubleClick"?Q$:W$)(t,o.pos,o.inside,n)?n.preventDefault():Va(t,"pointer"))};class Z${constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[qD],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,o=d.depth?d.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(r.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&&Jg&&!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)),Va(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(()=>Xv(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(qg(e))),this.updateAllowDefault(e),this.allowDefault||!n?Va(this.view,"pointer"):Y$(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Sl&&this.mightDrag&&!this.mightDrag.node.isAtom||qs&&!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)?(Ru(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Va(this.view,"pointer")}move(e){this.updateAllowDefault(e),Va(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)}}Mi.touchstart=t=>{t.input.lastTouch=Date.now(),ek(t),Va(t,"pointer")};Mi.touchmove=t=>{t.input.lastTouch=Date.now(),Va(t,"pointer")};Mi.contextmenu=t=>ek(t);function HD(t,e){return t.composing?!0:Sl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const eU=lp?5e3:-1;Nr.compositionstart=Nr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||qs&&_D&&tU(t)))t.markCursor=t.state.storedMarks||n.marks(),Ym(t,!0),t.markCursor=null;else if(Ym(t,!e.selection.empty),Jg&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}KD(t,eU)};function tU(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Nr.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++,KD(t,20))};function KD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ym(t),e))}function nU(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=rU());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function rU(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ym(t,e=!1){if(!(lp&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),nU(t),e||t.docView&&t.docView.dirty){let n=T$(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function iU(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Dh=op&&DD<15||Qv&&N$<604;Mi.copy=Nr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Dh?null:n.clipboardData,o=r.content(),{dom:u,text:c}=VD(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):iU(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function sU(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function aU(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?eS(t,r.value,null,i,e):eS(t,r.textContent,r.innerHTML,i,e)},50)}function eS(t,e,n,r,i){let s=FD(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||H.empty)))return!0;if(!s)return!1;let o=sU(s),u=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function GD(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," "):""}Nr.paste=(t,e)=>{let n=e;if(t.composing&&!lp)return;let r=Dh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&eS(t,GD(r),r.getData("text/html"),i,n)?n.preventDefault():aU(t,n)};class oU{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const lU=Qr?"altKey":"ctrlKey";function YD(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[lU]}Mi.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(qg(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ye?i.to-1:i.to))){if(r&&r.mightDrag)o=ye.create(t.state.doc,r.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:d}=VD(t,u);(!n.dataTransfer.files.length||!qs||ID>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 oU(d,YD(t,n),o)};Mi.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Nr.dragover=Nr.dragenter=(t,e)=>e.preventDefault();Nr.drop=(t,e)=>{try{uU(t,e,t.dragging)}finally{t.dragging=null}};function uU(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(qg(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=FD(t,GD(e.dataTransfer),Dh?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&YD(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?w$(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(d?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(d&&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((k,E,N,M)=>b=M),c.setSelection(LD(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Mi.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())&&Xv(t)},20))};Mi.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)};Mi.beforeinput=(t,e)=>{if(qs&&lp&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,OD(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Nr)Mi[t]=Nr[t];function Ih(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 Qm{constructor(e,n){this.toDOM=e,this.spec=n||Qo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Fi(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Qm&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ih(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $a{constructor(e,n){this.attrs=e,this.spec=n||Qo}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Fi(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof $a&&Ih(this.attrs,e.attrs)&&Ih(this.spec,e.spec)}static is(e){return e.type instanceof $a}destroy(){}}class tk{constructor(e,n){this.attrs=e,this.spec=n||Qo}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Fi(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof tk&&Ih(this.attrs,e.attrs)&&Ih(this.spec,e.spec)}destroy(){}}class Fi{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Fi(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Fi(e,e,new Qm(n,r))}static inline(e,n,r,i){return new Fi(e,n,new $a(r,i))}static node(e,n,r,i){return new Fi(e,n,new tk(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof $a}get widget(){return this.type instanceof Qm}}const wu=[],Qo={};class rn{constructor(e,n){this.local=e.length?e:wu,this.children=n.length?n:wu}static create(e,n){return n.length?Wm(n,e,0,Qo):Bn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,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))&&r.push(u.copy(u.from+i,u.to+i))}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,r,i+u,s)}}map(e,n,r){return this==Bn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Qo)}mapInner(e,n,r,i,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?cU(this.children,o||[],e,n,r,i,s):o?new rn(o.sort(Wo),wu):Bn}add(e,n){return n.length?this==Bn?rn.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,d;if(d=WD(n,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,d,h+1):i.splice(s,0,c,c+u.nodeSize,Wm(d,u,h+1,Qo)),s+=3}});let o=QD(s?XD(n):n,-r);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(Wo):this.local,i||this.children)}remove(e){return e.length==0||this==Bn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,u=r[s]+n,c=r[s+1]+n;for(let d=0,g;d<e.length;d++)(g=e[d])&&g.from>u&&g.to<c&&(e[d]=null,(o||(o=[])).push(g));if(!o)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(o,u+1);h!=Bn?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<i.length;u++)i[u].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new rn(i,r):Bn}forChild(e,n){if(this==Bn)return this;if(n.isLeaf)return rn.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=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 $a){let h=Math.max(s,c.from)-s,d=Math.min(o,c.to)-s;h<d&&(i||(i=[])).push(c.copy(h,d))}}if(i){let u=new rn(i.sort(Wo),wu);return r?new Io([u,r]):u}return r||Bn}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 nk(this.localsInner(e))}localsInner(e){if(this==Bn)return wu;if(e.inlineContent||!this.local.some($a.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof $a||n.push(this.local[r]);return n}forEachSet(e){e(this)}}rn.empty=new rn([],[]);rn.removeOverlap=nk;const Bn=rn.empty;class Io{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Qo));return Io.from(r)}forChild(e,n){if(n.isLeaf)return rn.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Bn&&(s instanceof Io?r=r.concat(s.members):r.push(s))}return Io.from(r)}eq(e){if(!(e instanceof Io)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?nk(r?n:n.sort(Wo)):wu}static from(e){switch(e.length){case 0:return Bn;case 1:return e[0];default:return new Io(e.every(n=>n instanceof rn)?e:e.reduce((n,r)=>n.concat(r instanceof rn?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function cU(t,e,n,r,i,s,o){let u=t.slice();for(let h=0,d=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,k,E)=>{let N=E-k-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+d-g)continue;let P=u[M]+d-g;b>=P?u[M+1]=y<=P?-2:-1:y>=d&&N&&(u[M]+=N,u[M+1]+=N)}g+=N}),d=n.maps[h].map(d,-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 d=n.map(t[h]+s),g=d-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-i,{index:k,offset:E}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&E==g&&E+N.nodeSize==b){let M=u[h+2].mapInner(n,N,d+1,t[h]+s+1,o);M!=Bn?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=fU(u,t,e,n,i,s,o),d=Wm(h,r,0,o);e=d.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<d.children.length;g+=3){let b=d.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,d.children[g],d.children[g+1],d.children[g+2])}}return new rn(e.sort(Wo),u)}function QD(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Fi(i.from+e,i.to+e,i.type))}return n}function fU(t,e,n,r,i,s,o){function u(c,h){for(let d=0;d<c.local.length;d++){let g=c.local[d].map(r,i,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)u(c.children[d+2],c.children[d]+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 WD(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function XD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Wm(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=WD(t,u,c+n);if(h){s=!0;let d=Wm(h,u,n+c+1,r);d!=Bn&&i.push(c,c+u.nodeSize,d)}});let o=QD(s?XD(t):t,-n).sort(Wo);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(r.onRemove&&r.onRemove(o[u].spec),o.splice(u--,1));return o.length||i.length?new rn(o,i):Bn}function Wo(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 r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),$N(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),$N(e,i,r.copy(s.from,r.to)));break}}}return e}function $N(t,e,n){for(;e<t.length&&Wo(n,t[e])>0;)e++;t.splice(e,0,n)}var Xm=typeof navigator<"u"?navigator:null,rk=Xm&&Xm.userAgent||"",hU=/Edge\/(\d+)/.exec(rk),pU=/MSIE \d/.exec(rk),dU=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(rk),mU=!!(pU||dU||hU),gU=!mU&&!!Xm&&/Apple Computer/.test(Xm.vendor),ZD=new hr("safari-ime-span"),tS=!1,yU={key:ZD,props:{decorations:xU,handleDOMEvents:{compositionstart:()=>{tS=!0},compositionend:()=>{tS=!1}}}};function xU(t){const{$from:e,$to:n,to:r}=t.selection;if(tS&&e.sameParent(n)){const i=Fi.widget(r,bU,{ignoreSelection:!0,key:"safari-ime-span"});return rn.create(t.doc,[i])}}function bU(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var SU=new fr(gU?yU:{key:ZD});function Zm(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function vU(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function kU(t,e,n){const i=kg((n||{}).ignore||[]),s=CU(e);let o=-1;for(;++o<s.length;)$u(t,"text",u);function u(h,d){let g=-1,y;for(;++g<d.length;){const b=d[g],k=y?y.children:void 0;if(i(b,k?k.indexOf(b):void 0,y))return;y=b}if(y)return c(h,d)}function c(h,d){const g=d[d.length-1],y=s[o][0],b=s[o][1];let k=0;const N=g.children.indexOf(h);let M=!1,j=[];y.lastIndex=0;let P=y.exec(h.value);for(;P;){const U=P.index,L={index:P.index,input:P.input,stack:[...d,h]};let C=b(...P,L);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?y.lastIndex=U+1:(k!==U&&j.push({type:"text",value:h.value.slice(k,U)}),Array.isArray(C)?j.push(...C):C&&j.push(C),k=U+P[0].length,M=!0),!y.global)break;P=y.exec(h.value)}return M?(k<h.value.length&&j.push({type:"text",value:h.value.slice(k)}),g.children.splice(N,1,...j)):j=[h],N+j.length}}function CU(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 r=-1;for(;++r<n.length;){const i=n[r];e.push([wU(i[0]),EU(i[1])])}return e}function wU(t){return typeof t=="string"?new RegExp(vU(t),"g"):t}function EU(t){return typeof t=="function"?t:function(){return t}}const sx="phrasing",ax=["autolink","link","image","label"];function AU(){return{transforms:[IU],enter:{literalAutolink:TU,literalAutolinkEmail:ox,literalAutolinkHttp:ox,literalAutolinkWww:ox},exit:{literalAutolink:DU,literalAutolinkEmail:RU,literalAutolinkHttp:MU,literalAutolinkWww:OU}}}function NU(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sx,notInConstruct:ax},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sx,notInConstruct:ax},{character:":",before:"[ps]",after:"\\/",inConstruct:sx,notInConstruct:ax}]}}function TU(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function ox(t){this.config.enter.autolinkProtocol.call(this,t)}function MU(t){this.config.exit.autolinkProtocol.call(this,t)}function OU(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 RU(t){this.config.exit.autolinkEmail.call(this,t)}function DU(t){this.exit(t)}function IU(t){kU(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,_U],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),zU]],{ignore:["link","linkReference"]})}function _U(t,e,n,r,i){let s="";if(!eI(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!LU(n)))return!1;const o=BU(n+r);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 zU(t,e,n,r){return!eI(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function LU(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 BU(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=Zm(t,"(");let s=Zm(t,")");for(;r!==-1&&i>s;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[t,n]}function eI(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Vn(n)||Sg(n))&&(!e||n!==47)}tI.peek=HU;function VU(){this.buffer()}function FU(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function PU(){this.buffer()}function jU(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function $U(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function UU(t){this.exit(t)}function JU(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function qU(t){this.exit(t)}function HU(){return"["}function tI(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),u=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),u(),o(),s+=i.move("]"),s}function KU(){return{enter:{gfmFootnoteCallString:VU,gfmFootnoteCall:FU,gfmFootnoteDefinitionLabelString:PU,gfmFootnoteDefinition:jU},exit:{gfmFootnoteCallString:$U,gfmFootnoteCall:UU,gfmFootnoteDefinitionLabelString:JU,gfmFootnoteDefinition:qU}}}function GU(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:tI},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const u=s.createTracker(o);let c=u.move("[^");const h=s.enter("footnoteDefinition"),d=s.enter("label");return c+=u.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),c+=u.move((e?`
54
+ `:" ")+s.indentLines(s.containerFlow(r,u.current()),e?nI:YU))),h(),c}}function YU(t,e,n){return e===0?t:nI(t,e,n)}function nI(t,e,n){return(n?"":" ")+t}const QU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];rI.peek=tJ;function WU(){return{canContainEols:["delete"],enter:{strikethrough:ZU},exit:{strikethrough:eJ}}}function XU(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:QU}],handlers:{delete:rI}}}function ZU(t){this.enter({type:"delete",children:[]},t)}function eJ(t){this.exit(t)}function rI(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function tJ(){return"~"}function nJ(t){return t.length}function rJ(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||nJ,s=[],o=[],u=[],c=[];let h=0,d=-1;for(;++d<t.length;){const E=[],N=[];let M=-1;for(t[d].length>h&&(h=t[d].length);++M<t[d].length;){const j=iJ(t[d][M]);if(n.alignDelimiters!==!1){const P=i(j);N[M]=P,(c[M]===void 0||P>c[M])&&(c[M]=P)}E.push(j)}o[d]=E,u[d]=N}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<h;)s[g]=UN(r[g]);else{const E=UN(r);for(;++g<h;)s[g]=E}g=-1;const y=[],b=[];for(;++g<h;){const E=s[g];let N="",M="";E===99?(N=":",M=":"):E===108?N=":":E===114&&(M=":");let j=n.alignDelimiters===!1?1:Math.max(1,c[g]-N.length-M.length);const P=N+"-".repeat(j)+M;n.alignDelimiters!==!1&&(j=N.length+j+M.length,j>c[g]&&(c[g]=j),b[g]=j),y[g]=P}o.splice(1,0,y),u.splice(1,0,b),d=-1;const k=[];for(;++d<o.length;){const E=o[d],N=u[d];g=-1;const M=[];for(;++g<h;){const j=E[g]||"";let P="",U="";if(n.alignDelimiters!==!1){const L=c[g]-(N[g]||0),C=s[g];C===114?P=" ".repeat(L):C===99?L%2?(P=" ".repeat(L/2+.5),U=" ".repeat(L/2-.5)):(P=" ".repeat(L/2),U=P):U=" ".repeat(L)}n.delimiterStart!==!1&&!g&&M.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||g)&&M.push(" "),n.alignDelimiters!==!1&&M.push(P),M.push(j),n.alignDelimiters!==!1&&M.push(U),n.padding!==!1&&M.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&M.push("|")}k.push(n.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return k.join(`
55
+ `)}function iJ(t){return t==null?"":String(t)}function UN(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 sJ(){return{enter:{table:aJ,tableData:JN,tableHeader:JN,tableRow:lJ},exit:{codeText:uJ,table:oJ,tableData:lx,tableHeader:lx,tableRow:lx}}}function aJ(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 oJ(t){this.exit(t),this.data.inTable=void 0}function lJ(t){this.enter({type:"tableRow",children:[]},t)}function lx(t){this.exit(t)}function JN(t){this.enter({type:"tableCell",children:[]},t)}function uJ(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,cJ));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function cJ(t,e){return e==="|"?e:t}function fJ(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=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,k,E,N){return h(d(b,E,N),b.align)}function u(b,k,E,N){const M=g(b,E,N),j=h([M]);return j.slice(0,j.indexOf(`
57
+ `))}function c(b,k,E,N){const M=E.enter("tableCell"),j=E.enter("phrasing"),P=E.containerPhrasing(b,{...N,before:s,after:s});return j(),M(),P}function h(b,k){return rJ(b,{align:k,alignDelimiters:r,padding:n,stringLength:i})}function d(b,k,E){const N=b.children;let M=-1;const j=[],P=k.enter("table");for(;++M<N.length;)j[M]=g(N[M],k,E);return P(),j}function g(b,k,E){const N=b.children;let M=-1;const j=[],P=k.enter("tableRow");for(;++M<N.length;)j[M]=c(N[M],b,k,E);return P(),j}function y(b,k,E){let N=xS.inlineCode(b,k,E);return E.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function hJ(){return{exit:{taskListCheckValueChecked:qN,taskListCheckValueUnchecked:qN,paragraph:dJ}}}function pJ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:mJ}}}function qN(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function dJ(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 r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const u=i[s];if(u.type==="paragraph"){o=u;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function mJ(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(o);let c=xS.listItem(t,e,n,{...r,...u.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(d){return d+o}}function gJ(){return[AU(),KU(),WU(),sJ(),hJ()]}function yJ(t){return{extensions:[NU(),GU(t),XU(),fJ(t),pJ()]}}const xJ={tokenize:wJ,partial:!0},iI={tokenize:EJ,partial:!0},sI={tokenize:AJ,partial:!0},aI={tokenize:NJ,partial:!0},bJ={tokenize:TJ,partial:!0},oI={name:"wwwAutolink",tokenize:kJ,previous:uI},lI={name:"protocolAutolink",tokenize:CJ,previous:cI},Hs={name:"emailAutolink",tokenize:vJ,previous:fI},Qi={};function SJ(){return{text:Qi}}let Eo=48;for(;Eo<123;)Qi[Eo]=Hs,Eo++,Eo===58?Eo=65:Eo===91&&(Eo=97);Qi[43]=Hs;Qi[45]=Hs;Qi[46]=Hs;Qi[95]=Hs;Qi[72]=[Hs,lI];Qi[104]=[Hs,lI];Qi[87]=[Hs,oI];Qi[119]=[Hs,oI];function vJ(t,e,n){const r=this;let i,s;return o;function o(g){return!nS(g)||!fI.call(r,r.previous)||ik(r.events)?n(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(g))}function u(g){return nS(g)?(t.consume(g),u):g===64?(t.consume(g),c):n(g)}function c(g){return g===46?t.check(bJ,d,h)(g):g===45||g===95||vn(g)?(s=!0,t.consume(g),c):d(g)}function h(g){return t.consume(g),i=!0,c}function d(g){return s&&i&&sn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(g)):n(g)}}function kJ(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!uI.call(r,r.previous)||ik(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(xJ,t.attempt(iI,t.attempt(sI,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function CJ(t,e,n){const r=this;let i="",s=!1;return o;function o(g){return(g===72||g===104)&&cI.call(r,r.previous)&&!ik(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),t.consume(g),u):n(g)}function u(g){if(sn(g)&&i.length<5)return i+=String.fromCodePoint(g),t.consume(g),u;if(g===58){const y=i.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||Cm(g)||We(g)||Vn(g)||Sg(g)?n(g):t.attempt(iI,t.attempt(sI,d),n)(g)}function d(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(g)}}function wJ(t,e,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),i):o===46&&r===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function EJ(t,e,n){let r,i,s;return o;function o(h){return h===46||h===95?t.check(aI,c,u)(h):h===null||We(h)||Vn(h)||h!==45&&Sg(h)?c(h):(s=!0,t.consume(h),o)}function u(h){return h===95?r=!0:(i=r,r=void 0),t.consume(h),o}function c(h){return i||r||!s?n(h):e(h)}}function AJ(t,e){let n=0,r=0;return i;function i(o){return o===40?(n++,t.consume(o),i):o===41&&r<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(aI,e,s)(o):o===null||We(o)||Vn(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function NJ(t,e,n){return r;function r(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),r):u===38?(t.consume(u),s):u===93?(t.consume(u),i):u===60||u===null||We(u)||Vn(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||We(u)||Vn(u)?e(u):r(u)}function s(u){return sn(u)?o(u):n(u)}function o(u){return u===59?(t.consume(u),r):sn(u)?(t.consume(u),o):n(u)}}function TJ(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return vn(s)?n(s):e(s)}}function uI(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||We(t)}function cI(t){return!sn(t)}function fI(t){return!(t===47||nS(t))}function nS(t){return t===43||t===45||t===46||t===95||vn(t)}function ik(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const MJ={tokenize:BJ,partial:!0};function OJ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:_J,continuation:{tokenize:zJ},exit:LJ}},text:{91:{name:"gfmFootnoteCall",tokenize:IJ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:RJ,resolveTo:DJ}}}}function RJ(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const c=r.events[i][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=wi(r.sliceSerialize({start:o.end,end:r.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 DJ(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 r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.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",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function IJ(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.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||We(g))return n(g);if(g===93){t.exit("chunkString");const y=t.exit("gfmFootnoteCallString");return i.includes(wi(r.sliceSerialize(y)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(g)}return We(g)||(o=!0),s++,t.consume(g),g===92?d:h}function d(g){return g===91||g===92||g===93?(t.consume(g),s++,h):h(g)}}function _J(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,u;return c;function c(k){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",d):n(k)}function d(k){if(o>999||k===93&&!u||k===null||k===91||We(k))return n(k);if(k===93){t.exit("chunkString");const E=t.exit("gfmFootnoteDefinitionLabelString");return s=wi(r.sliceSerialize(E)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),y}return We(k)||(u=!0),o++,t.consume(k),k===92?g:d}function g(k){return k===91||k===92||k===93?(t.consume(k),o++,d):d(k)}function y(k){return k===58?(t.enter("definitionMarker"),t.consume(k),t.exit("definitionMarker"),i.includes(s)||i.push(s),He(t,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return e(k)}}function zJ(t,e,n){return t.check(ju,e,t.attempt(MJ,e,n))}function LJ(t){t.exit("gfmFootnoteDefinition")}function BJ(t,e,n){const r=this;return He(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function VJ(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(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 d={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",d,u],["enter",o[h][1],u],["exit",o[h][1],u],["enter",g,u]],b=u.parser.constructs.insideSpan.null;b&&Er(y,y.length,0,vg(b,o.slice(h+1,c),u)),Er(y,y.length,0,[["exit",g,u],["enter",o[c][1],u],["exit",o[c][1],u],["exit",d,u]]),Er(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,d=this.events;let g=0;return y;function y(k){return h===126&&d[d.length-1][1].type!=="characterEscape"?c(k):(o.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const E=Iu(h);if(k===126)return g>1?c(k):(o.consume(k),g++,b);if(g<2&&!n)return c(k);const N=o.exit("strikethroughSequenceTemporary"),M=Iu(k);return N._open=!M||M===2&&!!E,N._close=!E||E===2&&!!M,u(k)}}}class FJ{constructor(){this.map=[]}add(e,n,r){PJ(this,e,n,r)}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 r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function PJ(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function jJ(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function $J(){return{flow:{null:{name:"table",tokenize:UJ,resolveAll:JJ}}}}function UJ(t,e,n){const r=this;let i=0,s=0,o;return u;function u(K){let de=r.events.length-1;for(;de>-1;){const Re=r.events[de][1].type;if(Re==="lineEnding"||Re==="linePrefix")de--;else break}const ce=de>-1?r.events[de][1].type:null,Se=ce==="tableHead"||ce==="tableRow"?C:c;return Se===C&&r.parser.lazy[r.now().line]?n(K):Se(K)}function c(K){return t.enter("tableHead"),t.enter("tableRow"),h(K)}function h(K){return K===124||(o=!0,s+=1),d(K)}function d(K){return K===null?n(K):Ce(K)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(K),t.exit("lineEnding"),b):n(K):qe(K)?He(t,d,"whitespace")(K):(s+=1,o&&(o=!1,i+=1),K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),o=!0,d):(t.enter("data"),g(K)))}function g(K){return K===null||K===124||We(K)?(t.exit("data"),d(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 r.interrupt=!1,r.parser.lazy[r.now().line]?n(K):(t.enter("tableDelimiterRow"),o=!1,qe(K)?He(t,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):k(K))}function k(K){return K===45||K===58?N(K):K===124?(o=!0,t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),E):L(K)}function E(K){return qe(K)?He(t,N,"whitespace")(K):N(K)}function N(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||Ce(K)?U(K):L(K)}function M(K){return K===45?(t.enter("tableDelimiterFiller"),j(K)):L(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"),P):(t.exit("tableDelimiterFiller"),P(K))}function P(K){return qe(K)?He(t,U,"whitespace")(K):U(K)}function U(K){return K===124?k(K):K===null||Ce(K)?!o||i!==s?L(K):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(K)):L(K)}function L(K){return n(K)}function C(K){return t.enter("tableRow"),z(K)}function z(K){return K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),z):K===null||Ce(K)?(t.exit("tableRow"),e(K)):qe(K)?He(t,z,"whitespace")(K):(t.enter("data"),G(K))}function G(K){return K===null||K===124||We(K)?(t.exit("data"),z(K)):(t.consume(K),K===92?J:G)}function J(K){return K===92||K===124?(t.consume(K),G):G(K)}}function JJ(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],u=!1,c=0,h,d,g;const y=new FJ;for(;++n<t.length;){const b=t[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(u=!1,c!==0&&(HN(y,e,c,h,d),d=void 0,c=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",h,e]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],o=[0,n+1,0,0],u&&(u=!1,d={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",d,e]])),i=k.type==="tableDelimiterRow"?2:d?3:1):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],g=Vd(y,e,s,i,void 0,g),s=[0,0,0,0]),o[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],g=Vd(y,e,s,i,void 0,g)),s=o,o=[s[1],n,0,0])):k.type==="tableHead"?(u=!0,c=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(c=n,s[1]!==0?(o[0]=o[1],g=Vd(y,e,s,i,n,g)):o[1]!==0&&(g=Vd(y,e,o,i,n,g)),i=0):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&HN(y,e,c,h,d),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=jJ(e.events,n))}return t}function Vd(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Eu(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=Eu(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=Eu(e.events,n[2]),d=Eu(e.events,n[3]),g={type:u,start:Object.assign({},h),end:Object.assign({},d)};if(t.add(n[2],0,[["enter",g,e]]),r!==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 k=n[2]+1,E=n[3]-n[2]-1;t.add(k,E,[])}}t.add(n[3]+1,0,[["exit",g,e]])}return i!==void 0&&(s.end=Object.assign({},Eu(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function HN(t,e,n,r,i){const s=[],o=Eu(e.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),r.end=Object.assign({},o),s.push(["exit",r,e]),t.add(n+1,0,s)}function Eu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const qJ={name:"tasklistCheck",tokenize:KJ};function HJ(){return{text:{91:qJ}}}function KJ(t,e,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),s)}function s(c){return We(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 Ce(c)?e(c):qe(c)?t.check({tokenize:GJ},e,n)(c):n(c)}}function GJ(t,e,n){return He(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function YJ(t){return dS([SJ(),OJ(),VJ(t),$J(),HJ()])}const QJ={};function WJ(t){const e=this,n=t||QJ,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(YJ(n)),s.push(gJ()),o.push(yJ(n))}function Fe(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var sk=Xh("strike_through");Fe(sk,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var up=qu("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(sk.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,n,r)=>{e.openMark(r),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,n)=>{e.withMark(n,"delete")}}}));Fe(up.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Fe(up.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Hg=Ue("ToggleStrikeThrough",t=>()=>Ag(up.type(t)));Fe(Hg,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var hI=pr(t=>Gh(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),up.type(t)));Fe(hI,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var ak=Mr("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(xt);return()=>e.call(Hg.key)}}});Fe(ak.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Fe(ak.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var cp=Aj({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),_s=en("table",()=>({...cp.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="table",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r,isHeader:o===0}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table",runner:(t,e)=>{const n=e.content.firstChild?.content;if(!n)return;const r=[];n.forEach(i=>{r.push(i.attrs.alignment)}),t.openNode("table",void 0,{align:r}),t.next(e.content),t.closeNode()}}}));Fe(_s.node,{displayName:"NodeSchema<table>",group:"Table"});Fe(_s.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var fp=en("table_header_row",()=>({...cp.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 r=e.align,i=e.children.map((s,o)=>({...s,align:r[o],isHeader:e.isHeader}));t.openNode(n),t.next(i),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(fp.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Fe(fp.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Yu=en("table_row",()=>({...cp.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:t=>t.type==="tableRow",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o]}));t.openNode(n),t.next(i),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(Yu.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Fe(Yu.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var hp=en("table_cell",()=>({...cp.table_cell,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}).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(hp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Fe(hp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Pu=en("table_header",()=>({...cp.table_header,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}),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(Pu.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Fe(Pu.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function pI(t,e=3,n=3){const r=Array(n).fill(0).map(()=>hp.type(t).createAndFill()),i=Array(n).fill(0).map(()=>Pu.type(t).createAndFill()),s=Array(e).fill(0).map((o,u)=>u===0?fp.type(t).create(null,i):Yu.type(t).create(null,r));return _s.type(t).create(null,s)}function dI(t){return(e,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),s=YB(c=>c.type.name==="table")(i),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),d=r.doc.resolve(o.from+h),g=u?Rt.rowSelection:Rt.colSelection,y=c.positionAt(u?e:0,u?0:e,o.node),b=r.doc.resolve(o.from+y);return TO(r.setSelection(g(d,b)))}}return r}}var XJ=dI("row"),ZJ=dI("col");function mI(t,e,{map:n,tableStart:r,table:i},s){const o=Array(s).fill(0).reduce((c,h,d)=>c+i.child(d).nodeSize,r),u=Array(n.width).fill(0).map((c,h)=>{const d=i.nodeAt(n.map[h]);return hp.type(t).createAndFill({alignment:d?.attrs.alignment})});return e.insert(o,Yu.type(t).create(null,u)),e}function eq(t){const e=ap(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(r=>{const i=e.node.nodeAt(r),s=r+e.start;return{pos:s,start:s+1,node:i}})}function tq(t){const e=eq(t.selection);if(e&&e[0]){const n=t.doc.resolve(e[0].pos),r=e[e.length-1];if(r){const i=t.doc.resolve(r.pos);return TO(t.setSelection(new Rt(i,n)))}}return t}var ok=Ue("GoToPrevTableCell",()=>()=>SD(-1));Fe(ok,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var lk=Ue("GoToNextTableCell",()=>()=>SD(1));Fe(lk,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var uk=Ue("ExitTable",t=>()=>(e,n)=>{if(!oi(e))return!1;const{$head:r}=e.selection,i=GB(r,_s.type(t));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,Ui.type(t).createAndFill());return o.setSelection(Ve.near(o.doc.resolve(s),1)).scrollIntoView(),n?.(o),!0});Fe(uk,{displayName:"Command<breakTableCommand>",group:"Table"});var ck=Ue("InsertTable",t=>({row:e,col:n}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:u}=s,c=pI(t,e,n),h=o.replaceSelectionWith(c),d=Ve.findFrom(h.doc.resolve(u),1,!0);return d&&h.setSelection(d),i?.(h),!0});Fe(ck,{displayName:"Command<insertTableCommand>",group:"Table"});var gI=Ue("MoveRow",()=>({from:t,to:e,pos:n}={})=>e$({from:t??0,to:e??0,pos:n}));Fe(gI,{displayName:"Command<moveRowCommand>",group:"Table"});var yI=Ue("MoveCol",()=>({from:t,to:e,pos:n}={})=>t$({from:t??0,to:e??0,pos:n}));Fe(yI,{displayName:"Command<moveColCommand>",group:"Table"});var xI=Ue("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(XJ(t.index,t.pos)(r))});Fe(xI,{displayName:"Command<selectRowCommand>",group:"Table"});var bI=Ue("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(ZJ(t.index,t.pos)(r))});Fe(bI,{displayName:"Command<selectColCommand>",group:"Table"});var SI=Ue("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!e?.(tq(n))});Fe(SI,{displayName:"Command<selectTableCommand>",group:"Table"});var vI=Ue("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof Rt))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?Zj(t,e):i?Kj(t,e):Yj(t,e)});Fe(vI,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var kI=Ue("AddColBefore",()=>()=>Jj);Fe(kI,{displayName:"Command<addColBeforeCommand>",group:"Table"});var CI=Ue("AddColAfter",()=>()=>qj);Fe(CI,{displayName:"Command<addColAfterCommand>",group:"Table"});var wI=Ue("AddRowBefore",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=to(e);n(mI(t,e.tr,r,r.top))}return!0});Fe(wI,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var EI=Ue("AddRowAfter",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=to(e);n(mI(t,e.tr,r,r.bottom))}return!0});Fe(EI,{displayName:"Command<addRowAfterCommand>",group:"Table"});var AI=Ue("SetAlign",()=>(t="left")=>Qj("alignment",t));Fe(AI,{displayName:"Command<setAlignCommand>",group:"Table"});var NI=pr(t=>new Tr(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,n,r,i)=>{const s=e.doc.resolve(r);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),_s.type(t)))return null;const o=pI(t,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),u=e.tr.replaceRangeWith(r,i,o);return u.setSelection(Ae.create(u.doc,r+3)).scrollIntoView()}));Fe(NI,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var TI=cF(t=>({run:(e,n,r)=>{if(r)return e;function i(h){const d=h.childCount,g=h.lastChild?.childCount??0;if(d===0||g===0)return Ui.type(t).create();const y=h.firstChild;if(!(g>0&&y&&y.childCount===0))return h;if(d>=3){const N=h.child(1),M=[];for(let U=0;U<N.childCount;U++){const L=N.child(U);M.push(Pu.type(t).create(L.attrs,L.content,L.marks))}const j=y.type.create(y.attrs,M),P=[];for(let U=2;U<d;U++)P.push(h.child(U));return h.type.create(h.attrs,[j,...P])}const b=Array(g).fill(0).map(()=>Pu.type(t).createAndFill()),k=new H(Q.from(b),0,0),E=y.replace(0,0,k);return h.replace(0,y.nodeSize,new H(Q.from(E),0,0))}function s(h){const d=Yu.type(t),g=[];let y=[],b=!1;function k(){if(y.length===0)return;const E=fp.type(t).createAndFill(),N=_s.type(t).create(null,[E,...y]);g.push(i(N)),y=[]}return h.forEach(E=>{E.type===d?(b=!0,y.push(E)):(k(),g.push(E))}),k(),b?Q.from(g):h}function o(h){let d=s(h),g=d!==h;const y=[];return d.forEach(b=>{if(b.type===_s.type(t)){const k=i(b);k!==b&&(g=!0),y.push(k)}else if(b.childCount>0){const k=o(b.content);k!==b.content?(g=!0,y.push(b.copy(k))):y.push(b)}else y.push(b)}),g?Q.from(y):h}function u(h){const d=[],g=[];h.forEach(y=>g.push(y));for(let y=0;y<g.length;y++){const b=g[y],k=g[y+1];b.type===Ui.type(t)&&b.content.size===0&&k&&k.type===_s.type(t)||d.push(b)}return d.length<g.length?Q.from(d):h}let c=o(e.content);return c=u(c),new H(Q.from(c),e.openStart,e.openEnd)}}));Fe(TI,{displayName:"PasteRule<table>",group:"Table"});var fk=Mr("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(xt);return()=>e.call(lk.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(xt);return()=>e.call(ok.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(xt);return()=>e.call(uk.key)}}});Fe(fk.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Fe(fk.shortcuts,{displayName:"Keymap<table>",group:"Table"});var ux="footnote_definition",KN="footnoteDefinition",hk=en("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${ux}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Ki(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":ux},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===KN,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===ux,runner:(t,e)=>{t.openNode(KN,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));Fe(hk.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Fe(hk.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var cx="footnote_reference",pk=en("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${cx}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Ki(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":cx},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===cx,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));Fe(pk.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Fe(pk.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var dk=Us.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:r=>{if(!(r instanceof HTMLElement))throw Ki(r);return{label:r.dataset.label,listType:r.dataset.listType,spread:r.dataset.spread,checked:r.dataset.checked?r.dataset.checked==="true":null}}},...n?.parseDOM||[]],toDOM:r=>n.toDOM&&r.attrs.checked==null?n.toDOM(r):["li",{"data-item-type":"task","data-label":r.attrs.label,"data-list-type":r.attrs.listType,"data-spread":r.attrs.spread,"data-checked":r.attrs.checked},0],parseMarkdown:{match:({type:r})=>r==="listItem",runner:(r,i,s)=>{if(i.checked==null){n.parseMarkdown.runner(r,i,s);return}const o=i.label!=null?`${i.label}.`:"•",u=i.checked!=null?!!i.checked:null,c=i.label!=null?"ordered":"bullet",h=i.spread!=null?`${i.spread}`:"true";r.openNode(s,{label:o,listType:c,spread:h,checked:u}),r.next(i.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="list_item",runner:(r,i)=>{if(i.attrs.checked==null){n.toMarkdown.runner(r,i);return}const s=i.attrs.label,o=i.attrs.listType,u=i.attrs.spread==="true",c=i.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:o,spread:u,checked:c}),r.next(i.content),r.closeNode()}}}});Fe(dk.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Fe(dk.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var MI=pr(()=>new Tr(/^\[(?<checked>\s|x)\]\s$/,(t,e,n,r)=>{const i=t.doc.resolve(n);let s=0,o=i.node(s);for(;o&&o.type.name!=="list_item";)s--,o=i.node(s);if(!o||o.attrs.checked!=null)return null;const u=e.groups?.checked==="x",c=i.before(s),h=t.tr;return h.deleteRange(n,r).setNodeMarkup(c,void 0,{...o.attrs,checked:u}),h}));Fe(MI,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var nq=[ak,fk].flat(),rq=[NI,MI],iq=[hI],sq=[TI],OI=$s(()=>SU);Fe(OI,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var aq=$s(()=>f$({}));Fe(aq,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var RI=$s(()=>v$({allowTableNodeSelection:!0}));Fe(RI,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var mk=Ni("remarkGFM",()=>WJ);Fe(mk.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Fe(mk.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var oq=new hr("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function lq(t,e){let n=0;return e.forEach((r,i,s)=>{r===t&&(n=s)}),n}var DI=$s(()=>new fr({key:oq,appendTransaction:(t,e,n)=>{let r;const i=(s,o)=>{if(r||(r=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 d=lq(s,c),g=h.maybeChild(d);if(!g)return;const y=g.attrs.alignment;y!==s.attrs.alignment&&r.setNodeMarkup(o,void 0,{...s.attrs,alignment:y})};return e.doc!==n.doc&&n.doc.descendants(i),r}}));Fe(DI,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var uq=[DI,OI,mk,RI].flat(),cq=[dk,_s,fp,Yu,Pu,hp,hk,pk,sk,up].flat(),fq=[lk,ok,uk,ck,gI,yI,xI,bI,SI,vI,wI,EI,kI,CI,AI,Hg],II=[cq,rq,sq,iq,nq,fq,uq].flat();const gk={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},eg={flex:1,border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 8px",font:"inherit",outline:"none",minWidth:0},_h={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},hq=gk,pq=eg,fx=_h;function dq({initialUrl:t,isEdit:e,onApply:n,onRemove:r,onClose:i}){const[s,o]=ae.useState(t),u=()=>{const c=s.trim();c!==""&&n(c)};return I.jsxs("div",{style:hq,"data-mdx-action":"link",onMouseDown:c=>c.stopPropagation(),children:[I.jsx("input",{style:pq,autoFocus:!0,placeholder:"https://…",value:s,onChange:c=>o(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u()),c.key==="Escape"&&i()}}),I.jsx("button",{type:"button",style:{...fx,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:c=>c.preventDefault(),onClick:u,children:e?"Update":"Add"}),e&&r?I.jsx("button",{type:"button",style:{...fx,color:"#dc2626"},onMouseDown:c=>c.preventDefault(),onClick:r,children:"Remove"}):null,I.jsx("button",{type:"button",style:fx,onMouseDown:c=>c.preventDefault(),onClick:i,children:"Cancel"})]})}const mq={...gk,flexWrap:"wrap"},GN={fontSize:11,color:"#71717a",whiteSpace:"nowrap"};function gq({initialAlt:t,onApply:e,onClose:n}){const[r,i]=ae.useState(t),[s,o]=ae.useState(""),u=()=>e(r.trim(),s.trim()),c=h=>{h.key==="Enter"&&(h.preventDefault(),u()),h.key==="Escape"&&n()};return I.jsxs("div",{style:mq,"data-mdx-action":"image",onMouseDown:h=>h.stopPropagation(),children:[I.jsx("span",{style:GN,children:"Alt"}),I.jsx("input",{style:eg,autoFocus:!0,placeholder:"Alt text for screen readers",value:r,onChange:h=>i(h.currentTarget.value),onKeyDown:c}),I.jsx("span",{style:GN,children:"Caption"}),I.jsx("input",{style:eg,placeholder:"Caption / source (optional)",value:s,onChange:h=>o(h.currentTarget.value),onKeyDown:c}),I.jsx("button",{type:"button",style:{..._h,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:h=>h.preventDefault(),onClick:u,children:"Insert"}),I.jsx("button",{type:"button",style:_h,onMouseDown:h=>h.preventDefault(),onClick:n,children:"Cancel"})]})}function YN(t){return typeof t!="object"||t===null?!1:"status"in t&&t.status===501||"code"in t&&t.code==="unsupported"}const QN=new Set(["image/svg+xml","image/x-icon"]),yq=[{value:"all",label:"All"},{value:"photo",label:"Photos"},{value:"graphic",label:"Graphics"},{value:"document",label:"Documents"}];function xq(t,e){return e==="all"?!0:e==="photo"?t.startsWith("image/")&&!QN.has(t):e==="graphic"?QN.has(t):e==="document"?t==="application/pdf":!0}const bq={position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100},Sq={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"},vq={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #ececed"},kq={display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",borderBottom:"1px solid #ececed"},Wc={display:"flex",alignItems:"center",gap:8},WN={flex:1,border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},Au={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},XN={...Au,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},Cq={display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,padding:16,overflowY:"auto"},ZN={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},wq={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 _I({media:t,context:e,field:n,accept:r="image/*,application/pdf",onSelect:i,onClose:s}){const[o,u]=ae.useState([]),[c,h]=ae.useState([]),[d,g]=ae.useState(""),[y,b]=ae.useState(""),[k,E]=ae.useState("all"),[N,M]=ae.useState(!1),[j,P]=ae.useState(!1),[U,L]=ae.useState(!1),[C,z]=ae.useState(null),[G,J]=ae.useState(!1),[K,de]=ae.useState(""),ce=ae.useRef(null),Se=ae.useMemo(()=>async D=>{M(!0),z(null);try{const F=await t.listMedia({folder:D||void 0});u(F.items),h(F.folders)}catch(F){YN(F)?P(!0):z(F instanceof Error?F.message:"Failed to load media")}finally{M(!1)}},[t]);ae.useEffect(()=>{Se(d)},[Se,d]);const Re=D=>{b(""),g(D)},Y=async D=>{L(!0),z(null);try{const F=await t.uploadMedia(D,{...e,field:n,folder:d||void 0});if(F.success&&F.url){if(F.url.startsWith("./")){i(F.url,F.annotation??"");return}const ee={id:F.id??F.url,url:F.url,filename:F.filename??D.name,annotation:F.annotation,contentType:D.type||"application/octet-stream",folder:d||void 0};u(V=>[ee,...V])}else z(F.error??"Upload failed")}catch(F){YN(F)?P(!0):z(F instanceof Error?F.message:"Upload failed")}finally{L(!1)}},W=async()=>{const D=K.trim();if(!D||!t.createFolder)return;if(/[/\\:*?"<>|]/.test(D)){z("Invalid folder name");return}const F=d?`${d}/${D}`:D;try{const ee=await t.createFolder(F);ee.success?h(V=>[...V,{name:D,path:F}].sort((be,De)=>be.name.localeCompare(De.name))):z(ee.error??"Failed to create folder")}catch(ee){z(ee instanceof Error?ee.message:"Failed to create folder")}de(""),J(!1)},ue=ae.useMemo(()=>{const D=k==="all"?o:o.filter(ee=>xq(ee.contentType,k)),F=y.trim().toLowerCase();return F===""?D:D.filter(ee=>ee.filename.toLowerCase().includes(F))},[o,k,y]),ke=ae.useMemo(()=>{if(!d)return[];const D=d.split("/");return D.map((F,ee)=>({name:F,path:D.slice(0,ee+1).join("/")}))},[d]),ze=!y&&k==="all";return I.jsx("div",{style:bq,onMouseDown:s,"data-cms-ui":"",children:I.jsxs("div",{style:Sq,onMouseDown:D=>D.stopPropagation(),onDrop:D=>{D.preventDefault();const F=D.dataTransfer.files[0];F&&Y(F)},onDragOver:D=>D.preventDefault(),children:[I.jsxs("div",{style:vq,children:[I.jsx("strong",{style:{fontSize:15},children:"Media Library"}),I.jsx("button",{type:"button",style:{...Au,border:"none",fontSize:18,lineHeight:1,padding:2},onClick:s,"aria-label":"Close",children:"×"})]}),I.jsxs("div",{style:kq,children:[ke.length>0?I.jsxs("div",{style:{...Wc,gap:4,fontSize:12,color:"#71717a"},children:[I.jsx("button",{type:"button",style:{...Au,border:"none",padding:"0 2px"},onClick:()=>Re(""),children:"root"}),ke.map((D,F)=>I.jsxs("span",{style:Wc,children:[I.jsx("span",{children:"/"}),F===ke.length-1?I.jsx("span",{style:{color:"#27272a",fontWeight:600},children:D.name}):I.jsx("button",{type:"button",style:{...Au,border:"none",padding:"0 2px"},onClick:()=>Re(D.path),children:D.name})]},D.path))]}):null,I.jsxs("div",{style:Wc,children:[I.jsx("input",{style:WN,placeholder:"Search files…",value:y,onChange:D=>b(D.target.value)}),t.createFolder?I.jsx("button",{type:"button",style:Au,onClick:()=>J(D=>!D),children:"New folder"}):null,I.jsx("button",{type:"button",style:XN,disabled:j||U,onClick:()=>ce.current?.click(),children:U?"Uploading…":"Upload"}),I.jsx("input",{ref:ce,type:"file",accept:r,style:{display:"none"},onChange:D=>{const F=D.target.files?.[0];F&&Y(F),D.target.value=""}})]}),I.jsx("div",{style:{...Wc,gap:4},children:yq.map(D=>I.jsx("button",{type:"button",style:{...Au,padding:"3px 10px",fontSize:12,...k===D.value?{background:"#2563eb",borderColor:"#2563eb",color:"#fff"}:{}},onClick:()=>E(D.value),children:D.label},D.value))}),G&&t.createFolder?I.jsxs("div",{style:Wc,children:[I.jsx("input",{style:WN,autoFocus:!0,placeholder:"Folder name…",value:K,onChange:D=>de(D.target.value),onKeyDown:D=>{D.key==="Enter"&&W(),D.key==="Escape"&&(J(!1),de(""))}}),I.jsx("button",{type:"button",style:XN,onClick:()=>{W()},children:"Create"})]}):null,j?I.jsx("div",{style:{fontSize:12,color:"#a16207"},children:"Media uploads are not configured for this project."}):null,C?I.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:C}):null]}),N?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:"Loading…"}):c.length===0&&ue.length===0?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:y||k!=="all"?"No matching files.":"No files yet. Upload one to get started."}):I.jsxs("div",{style:Cq,children:[ze?c.map(D=>I.jsxs("button",{type:"button",style:ZN,onClick:()=>Re(D.path),title:D.name,children:[I.jsx("span",{style:{fontSize:30},children:"📁"}),I.jsx("span",{style:{fontSize:12,color:"#52525b",maxWidth:"90%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.name})]},D.path)):null,ue.map(D=>I.jsxs("button",{type:"button",style:ZN,title:D.filename,onClick:()=>i(D.url,D.annotation||D.filename||"Image"),children:[D.contentType.startsWith("image/")?I.jsx("img",{src:D.url,alt:D.annotation||D.filename,style:{width:"100%",height:"100%",objectFit:"cover"}}):I.jsx("span",{style:{fontSize:30},children:D.contentType==="application/pdf"?"📄":"📎"}),I.jsx("span",{style:wq,children:D.filename})]},D.id))]}),I.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",d?` to ${d}`:"","."]})]})})}const rS={bold:!1,italic:!1,strikethrough:!1,link:!1,linkHref:null,bulletList:!1,orderedList:!1,listStyle:null,blockquote:!1,heading:null};function Eq(t){const{state:e}=t,{$from:n,from:r,to:i}=e.selection;let s=!1,o=!1,u=!1,c=!1,h=null;const d=e.storedMarks||n.marks();for(const N of d)N.type.name==="strong"&&(s=!0),N.type.name==="emphasis"&&(o=!0),N.type.name==="strike_through"&&(u=!0),N.type.name==="link"&&(c=!0,h=typeof N.attrs.href=="string"?N.attrs.href:null);r!==i&&e.doc.nodesBetween(r,i,N=>{for(const M of N.marks)M.type.name==="strong"&&(s=!0),M.type.name==="emphasis"&&(o=!0),M.type.name==="strike_through"&&(u=!0),M.type.name==="link"&&(c=!0,h=typeof M.attrs.href=="string"?M.attrs.href:null)});let g=!1,y=!1,b=null,k=!1,E=null;for(let N=n.depth;N>0;N--){const M=n.node(N);(M.type.name==="bullet_list"||M.type.name==="ordered_list")&&(M.type.name==="bullet_list"&&(g=!0),M.type.name==="ordered_list"&&(y=!0),b===null&&(b=typeof M.attrs.listStyle=="string"?M.attrs.listStyle:null)),M.type.name==="blockquote"&&(k=!0)}if(n.parent.type.name==="heading"){const N=n.parent.attrs.level;E=typeof N=="number"?N:null}return{bold:s,italic:o,strikethrough:u,link:c,linkHref:h,bulletList:g,orderedList:y,listStyle:b,blockquote:k,heading:E}}function Aq(t,e){const{$from:n}=t.state.selection;for(let r=n.depth;r>0;r--)if(n.node(r).type.name===e)return!0;return!1}function Nq(t,e){const{state:n}=t,r=n.schema.nodes.heading,i=n.schema.nodes.paragraph;if(!r||!i)return;const{$from:s}=n.selection,o=s.parent.type.name==="heading"&&s.parent.attrs.level===e,u=o?i:r,c=o?void 0:{level:e},h=s.before(s.depth),d=n.selection.$to.after(n.selection.$to.depth);t.dispatch(n.tr.setBlockType(h,d,u,c)),t.focus()}function Tq(t){const{state:e}=t,{from:n,to:r}=e.selection,i=e.schema.marks.link;if(!i)return;let s=n,o=r;e.doc.nodesBetween(n,n===r?r+1:r,(u,c)=>{if(i.isInSet(u.marks))return s=c,o=c+u.nodeSize,!1}),t.dispatch(e.tr.removeMark(s,o,i))}function Mq(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.listStyle===e.listStyle&&t.blockquote===e.blockquote&&t.heading===e.heading}function Oq(t,e){let n=0,r=rS;const i=()=>{const u=t.ctx.get(gn),c=Eq(u);Mq(c,r)||(r=c,e(c))},s=t.ctx.get(gn),o=s.dispatch.bind(s);return s.dispatch=u=>{o(u),(u.selectionSet||u.docChanged)&&(cancelAnimationFrame(n),n=requestAnimationFrame(i))},i(),()=>{cancelAnimationFrame(n)}}const Rq=["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"],eT={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 zI(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function Dq(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function Iq(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function tT(t){return Iq(t)||zI(t)}const _q=["","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 Kg(t,e){const n=e||{},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,i=[];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 d=(c?c.line:0)||1,g=(c?c.column:0)||1,y=k(),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)||r&&M===r){u+=String.fromCharCode(b),g++;continue}const j=s+1;let P=j,U=j,L;if(M===35){U=++P;const Se=t.charCodeAt(U);Se===88||Se===120?(L="hexadecimal",U=++P):L="decimal"}else L="named";let C="",z="",G="";const J=L==="named"?tT:L==="decimal"?zI:Dq;for(U--;++U<=t.length;){const Se=t.charCodeAt(U);if(!J(Se))break;G+=String.fromCharCode(Se),L==="named"&&Rq.includes(G)&&(C=G,z=fh(G))}let K=t.charCodeAt(U)===59;if(K){U++;const Se=L==="named"?fh(G):!1;Se&&(C=G,z=Se)}let de=1+U-j,ce="";if(!(!K&&n.nonTerminated===!1))if(!G)L!=="named"&&E(4,de);else if(L==="named"){if(K&&!z)E(5,1);else if(C!==G&&(U=P+C.length,de=1+U-P,K=!1),!K){const Se=C?1:3;if(n.attribute){const Re=t.charCodeAt(U);Re===61?(E(Se,de),z=""):tT(Re)?z="":E(Se,de)}else E(Se,de)}ce=z}else{K||E(2,de);let Se=Number.parseInt(G,L==="hexadecimal"?16:10);if(zq(Se))E(7,de),ce="�";else if(Se in eT)E(6,de),ce=eT[Se];else{let Re="";Lq(Se)&&E(6,de),Se>65535&&(Se-=65536,Re+=String.fromCharCode(Se>>>10|55296),Se=56320|Se&1023),ce=Re+String.fromCharCode(Se)}}if(ce){N(),y=k(),s=U-1,g+=U-j+1,i.push(ce);const Se=k();Se.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,ce,{start:y,end:Se},t.slice(j-1,U)),y=Se}else G=t.slice(j-1,U),u+=G,g+=G.length,s=U-1}else b===10&&(d++,o++,g=0),Number.isNaN(b)?N():(u+=String.fromCharCode(b),g++);return i.join("");function k(){return{line:d,column:g,offset:s+((c?c.offset:0)||0)}}function E(M,j){let P;n.warning&&(P=k(),P.column+=j,P.offset+=j,n.warning.call(n.warningContext||void 0,_q[M],P,M))}function N(){u&&(i.push(u),n.text&&n.text.call(n.textContext||void 0,u,{start:y,end:k()}),u="")}}function zq(t){return t>=55296&&t<=57343||t>1114111}function Lq(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 Bq=/["&'<>`]/g,Vq=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Fq=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Pq=/[|\\{}()[\]^$+*?.]/g,nT=new WeakMap;function jq(t,e){if(t=t.replace(e.subset?$q(e.subset):Bq,r),e.subset||e.escapeOnly)return t;return t.replace(Vq,n).replace(Fq,r);function n(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function r(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function $q(t){let e=nT.get(t);return e||(e=Uq(t),nT.set(t,e)),e}function Uq(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Pq,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function Jq(t){return"&#x"+t.toString(16).toUpperCase()+";"}function qq(t,e){return jq(t,Object.assign({format:Jq},e))}function Hq(){return{canContainEols:["textDirective"],enter:{directiveContainer:Kq,directiveContainerAttributes:px,directiveContainerLabel:Qq,directiveLeaf:Gq,directiveLeafAttributes:px,directiveText:Yq,directiveTextAttributes:px},exit:{directiveContainer:bx,directiveContainerAttributeClassValue:mx,directiveContainerAttributeIdValue:dx,directiveContainerAttributeName:yx,directiveContainerAttributeValue:gx,directiveContainerAttributes:xx,directiveContainerLabel:Wq,directiveContainerName:hx,directiveLeaf:bx,directiveLeafAttributeClassValue:mx,directiveLeafAttributeIdValue:dx,directiveLeafAttributeName:yx,directiveLeafAttributeValue:gx,directiveLeafAttributes:xx,directiveLeafName:hx,directiveText:bx,directiveTextAttributeClassValue:mx,directiveTextAttributeIdValue:dx,directiveTextAttributeName:yx,directiveTextAttributeValue:gx,directiveTextAttributes:xx,directiveTextName:hx}}}function Kq(t){yk.call(this,"containerDirective",t)}function Gq(t){yk.call(this,"leafDirective",t)}function Yq(t){yk.call(this,"textDirective",t)}function yk(t,e){this.enter({type:t,name:"",attributes:{},children:[]},e)}function hx(t){const e=this.stack[this.stack.length-1];e.type==="containerDirective"||e.type==="leafDirective"||e.type,e.name=this.sliceSerialize(t)}function Qq(t){this.enter({type:"paragraph",data:{directiveLabel:!0},children:[]},t)}function Wq(t){this.exit(t)}function px(){this.data.directiveAttributes=[],this.buffer()}function dx(t){this.data.directiveAttributes.push(["id",Kg(this.sliceSerialize(t),{attribute:!0})])}function mx(t){this.data.directiveAttributes.push(["class",Kg(this.sliceSerialize(t),{attribute:!0})])}function gx(t){const e=this.data.directiveAttributes;e[e.length-1][1]=Kg(this.sliceSerialize(t),{attribute:!0})}function yx(t){this.data.directiveAttributes.push([this.sliceSerialize(t),""])}function xx(){const t=this.data.directiveAttributes,e={};let n=-1;for(;++n<t.length;){const i=t[n];i[0]==="class"&&e.class?e.class+=" "+i[1]:e[i[0]]=i[1]}this.data.directiveAttributes=void 0,this.resume();const r=this.stack[this.stack.length-1];r.type==="containerDirective"||r.type==="leafDirective"||r.type,r.attributes=e}function bx(t){this.exit(t)}function xk(t,e,n,r,i,s,o,u,c,h,d,g,y,b,k){let E,N;return M;function M(Y){return t.enter(r),t.enter(i),t.consume(Y),t.exit(i),j}function j(Y){return Y===35?(E=o,P(Y)):Y===46?(E=u,P(Y)):Y===58||Y===95||sn(Y)?(t.enter(s),t.enter(c),t.consume(Y),C):k&&qe(Y)?He(t,j,"whitespace")(Y):!k&&We(Y)?Ts(t,j)(Y):Re(Y)}function P(Y){const W=E+"Marker";return t.enter(s),t.enter(E),t.enter(W),t.consume(Y),t.exit(W),U}function U(Y){if(Y===null||Y===34||Y===35||Y===39||Y===46||Y===60||Y===61||Y===62||Y===96||Y===125||We(Y))return n(Y);const W=E+"Value";return t.enter(W),t.consume(Y),L}function L(Y){if(Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96)return n(Y);if(Y===35||Y===46||Y===125||We(Y)){const W=E+"Value";return t.exit(W),t.exit(E),t.exit(s),j(Y)}return t.consume(Y),L}function C(Y){return Y===45||Y===46||Y===58||Y===95||vn(Y)?(t.consume(Y),C):(t.exit(c),k&&qe(Y)?He(t,z,"whitespace")(Y):!k&&We(Y)?Ts(t,z)(Y):z(Y))}function z(Y){return Y===61?(t.enter(h),t.consume(Y),t.exit(h),G):(t.exit(s),j(Y))}function G(Y){return Y===null||Y===60||Y===61||Y===62||Y===96||Y===125||k&&Ce(Y)?n(Y):Y===34||Y===39?(t.enter(d),t.enter(y),t.consume(Y),t.exit(y),N=Y,K):k&&qe(Y)?He(t,G,"whitespace")(Y):!k&&We(Y)?Ts(t,G)(Y):(t.enter(g),t.enter(b),t.consume(Y),N=void 0,J)}function J(Y){return Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96?n(Y):Y===125||We(Y)?(t.exit(b),t.exit(g),t.exit(s),j(Y)):(t.consume(Y),J)}function K(Y){return Y===N?(t.enter(y),t.consume(Y),t.exit(y),t.exit(d),t.exit(s),Se):(t.enter(g),de(Y))}function de(Y){return Y===N?(t.exit(g),K(Y)):Y===null?n(Y):Ce(Y)?k?n(Y):Ts(t,de)(Y):(t.enter(b),t.consume(Y),ce)}function ce(Y){return Y===N||Y===null||Ce(Y)?(t.exit(b),de(Y)):(t.consume(Y),ce)}function Se(Y){return Y===125||We(Y)?j(Y):Re(Y)}function Re(Y){return Y===125?(t.enter(i),t.consume(Y),t.exit(i),t.exit(r),e):n(Y)}}function bk(t,e,n,r,i,s,o){let u=0,c=0,h;return d;function d(N){return t.enter(r),t.enter(i),t.consume(N),t.exit(i),g}function g(N){return N===93?(t.enter(i),t.consume(N),t.exit(i),t.exit(r),e):(t.enter(s),y(N))}function y(N){if(N===93&&!c)return E(N);const M=t.enter("chunkText",{contentType:"text",previous:h});return h&&(h.next=M),h=M,b(N)}function b(N){return N===null||u>999||N===91&&++c>32?n(N):N===93&&!c--?(t.exit("chunkText"),E(N)):Ce(N)?o?n(N):(t.consume(N),t.exit("chunkText"),y):(t.consume(N),N===92?k:b)}function k(N){return N===91||N===92||N===93?(t.consume(N),u++,b):b(N)}function E(N){return t.exit(s),t.enter(i),t.consume(N),t.exit(i),t.exit(r),e}}function Sk(t,e,n,r){const i=this;return s;function s(u){return sn(u)?(t.enter(r),t.consume(u),o):n(u)}function o(u){return u===45||u===95||vn(u)?(t.consume(u),o):(t.exit(r),i.previous===45||i.previous===95?n(u):e(u))}}const Xq={tokenize:tH,concrete:!0},Zq={tokenize:nH,partial:!0},eH={tokenize:rH,partial:!0},Fd={tokenize:iH,partial:!0};function tH(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let o=0,u;return c;function c(J){return t.enter("directiveContainer"),t.enter("directiveContainerFence"),t.enter("directiveContainerSequence"),h(J)}function h(J){return J===58?(t.consume(J),o++,h):o<3?n(J):(t.exit("directiveContainerSequence"),Sk.call(r,t,d,n,"directiveContainerName")(J))}function d(J){return J===91?t.attempt(Zq,g,g)(J):g(J)}function g(J){return J===123?t.attempt(eH,y,y)(J):y(J)}function y(J){return He(t,b,"whitespace")(J)}function b(J){return t.exit("directiveContainerFence"),J===null?z(J):Ce(J)?r.interrupt?e(J):t.attempt(Fd,k,z)(J):n(J)}function k(J){return J===null?z(J):Ce(J)?t.check(Fd,P,z)(J):(t.enter("directiveContainerContent"),E(J))}function E(J){return t.attempt({tokenize:G,partial:!0},C,s?He(t,N,"linePrefix",s+1):N)(J)}function N(J){return J===null?C(J):Ce(J)?t.check(Fd,j,C)(J):j(J)}function M(J){if(J===null){const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,C(J)}return Ce(J)?t.check(Fd,U,L)(J):(t.consume(J),M)}function j(J){const K=t.enter("chunkDocument",{contentType:"document",previous:u});return u&&(u.next=K),u=K,M(J)}function P(J){return t.enter("directiveContainerContent"),E(J)}function U(J){t.consume(J);const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,E}function L(J){const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,C(J)}function C(J){return t.exit("directiveContainerContent"),z(J)}function z(J){return t.exit("directiveContainer"),e(J)}function G(J,K,de){let ce=0;return He(J,Se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function Se(W){return J.enter("directiveContainerFence"),J.enter("directiveContainerSequence"),Re(W)}function Re(W){return W===58?(J.consume(W),ce++,Re):ce<o?de(W):(J.exit("directiveContainerSequence"),He(J,Y,"whitespace")(W))}function Y(W){return W===null||Ce(W)?(J.exit("directiveContainerFence"),K(W)):de(W)}}}function nH(t,e,n){return bk(t,e,n,"directiveContainerLabel","directiveContainerLabelMarker","directiveContainerLabelString",!0)}function rH(t,e,n){return xk(t,e,n,"directiveContainerAttributes","directiveContainerAttributesMarker","directiveContainerAttribute","directiveContainerAttributeId","directiveContainerAttributeClass","directiveContainerAttributeName","directiveContainerAttributeInitializerMarker","directiveContainerAttributeValueLiteral","directiveContainerAttributeValue","directiveContainerAttributeValueMarker","directiveContainerAttributeValueData",!0)}function iH(t,e,n){const r=this;return i;function i(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const sH={tokenize:lH},aH={tokenize:uH,partial:!0},oH={tokenize:cH,partial:!0};function lH(t,e,n){const r=this;return i;function i(d){return t.enter("directiveLeaf"),t.enter("directiveLeafSequence"),t.consume(d),s}function s(d){return d===58?(t.consume(d),t.exit("directiveLeafSequence"),Sk.call(r,t,o,n,"directiveLeafName")):n(d)}function o(d){return d===91?t.attempt(aH,u,u)(d):u(d)}function u(d){return d===123?t.attempt(oH,c,c)(d):c(d)}function c(d){return He(t,h,"whitespace")(d)}function h(d){return d===null||Ce(d)?(t.exit("directiveLeaf"),e(d)):n(d)}}function uH(t,e,n){return bk(t,e,n,"directiveLeafLabel","directiveLeafLabelMarker","directiveLeafLabelString",!0)}function cH(t,e,n){return xk(t,e,n,"directiveLeafAttributes","directiveLeafAttributesMarker","directiveLeafAttribute","directiveLeafAttributeId","directiveLeafAttributeClass","directiveLeafAttributeName","directiveLeafAttributeInitializerMarker","directiveLeafAttributeValueLiteral","directiveLeafAttributeValue","directiveLeafAttributeValueMarker","directiveLeafAttributeValueData",!0)}const fH={tokenize:mH,previous:dH},hH={tokenize:gH,partial:!0},pH={tokenize:yH,partial:!0};function dH(t){return t!==58||this.events[this.events.length-1][1].type==="characterEscape"}function mH(t,e,n){const r=this;return i;function i(c){return t.enter("directiveText"),t.enter("directiveTextMarker"),t.consume(c),t.exit("directiveTextMarker"),Sk.call(r,t,s,n,"directiveTextName")}function s(c){return c===58?n(c):c===91?t.attempt(hH,o,o)(c):o(c)}function o(c){return c===123?t.attempt(pH,u,u)(c):u(c)}function u(c){return t.exit("directiveText"),e(c)}}function gH(t,e,n){return bk(t,e,n,"directiveTextLabel","directiveTextLabelMarker","directiveTextLabelString")}function yH(t,e,n){return xk(t,e,n,"directiveTextAttributes","directiveTextAttributesMarker","directiveTextAttribute","directiveTextAttributeId","directiveTextAttributeClass","directiveTextAttributeName","directiveTextAttributeInitializerMarker","directiveTextAttributeValueLiteral","directiveTextAttributeValue","directiveTextAttributeValueMarker","directiveTextAttributeValueData")}function xH(){return{text:{58:fH},flow:{58:[Xq,sH]}}}const tg="youtube";function bH(t){if(!t||typeof t!="object")return"";const e=Object.entries(t),n=t.id;if(typeof n=="string"&&n)return n;for(const[r,i]of e)if(i===""||i==null)return r;return""}const LI=Ju("youtube",()=>({group:"block",atom:!0,isolating:!0,selectable:!0,draggable:!1,attrs:{videoId:{default:""}},toDOM:t=>{const e=document.createElement("div");return e.setAttribute("data-youtube",t.attrs.videoId),e.className="youtube-block",e},parseDOM:[{tag:"div[data-youtube]",getAttrs:t=>({videoId:t.getAttribute("data-youtube")||""})}],parseMarkdown:{match:t=>(t.type==="leafDirective"||t.type==="containerDirective"||t.type==="textDirective")&&t.name===tg,runner:(t,e,n)=>{const r=bH(e.attributes);t.addNode(n,{videoId:r})}},toMarkdown:{match:t=>t.type.name==="youtube",runner:(t,e)=>{t.addNode("leafDirective",void 0,void 0,{name:tg,attributes:{id:e.attrs.videoId}})}}}));function SH(t){const e=t.attributes,n=e&&typeof e=="object"?String(e.id??""):"";return`::${tg}{#${n}}`}const vH=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{leafDirective:SH}};t.push(e),this.data("toMarkdownExtensions",t)},kH=Ni("remarkYoutubeDirective",()=>vH),BI=Ue("insertYoutube",()=>t=>(e,n)=>{if(!t)return!1;const r=e.schema.nodes.youtube;if(!r)return!1;const i=r.create({videoId:t});return n&&n(e.tr.replaceSelectionWith(i).scrollIntoView()),!0}),iS="list",CH=/^[A-Za-z0-9_-]+$/,wH=new Set(["textDirective","leafDirective","containerDirective"]);function Pi(t){if(typeof t!="string")return null;const[e]=t.trim().split(/\s+/);return!e||!CH.test(e)?null:e}function zs(t){return Array.isArray(t?.children)?t.children:null}function Sx(t){const e=zs(t);return e&&e.length>0?e[e.length-1]:void 0}function VI(t){return!t.attributes||typeof t.attributes!="object"||Array.isArray(t.attributes)?null:t.attributes}function EH(t){return Pi(VI(t)?.class)}function FI(t,e){const n=zs(t);if(t?.type!=="paragraph"||n?.length!==1)return!1;const r=n[0];return r?.type!=="text"||typeof r.value!="string"?!1:e===void 0?!0:r.value===e}function AH(t){if(!FI(t))return null;const e=zs(t)?.[0];return typeof e?.value!="string"?null:/^:::list\{\.([A-Za-z0-9_-]+)\}$/.exec(e.value)?.[1]??null}function rT(t){return t?.type==="list"}function NH(t,e,n){if(FI(e[n],":::"))return e.splice(n,1),!0;const r=Sx(t),i=Sx(r);if(!i||i.type!=="paragraph")return!1;const s=zs(i),o=Sx(i);if(!s||o?.type!=="text"||typeof o.value!="string")return!1;if(o.value===":::")s.pop();else if(o.value.endsWith(`
58
+ :::`))o.value=o.value.slice(0,-4);else return!1;return s.length===0&&zs(r)?.pop(),!0}function TH(t){return t==="containerDirective"?":::":t==="leafDirective"?"::":":"}function MH(t){if(!t||typeof t!="object"||Array.isArray(t))return"";const e=[];for(const[n,r]of Object.entries(t))if(n==="class"&&typeof r=="string")for(const i of r.split(/\s+/).filter(Boolean))e.push(`.${i}`);else n==="id"&&typeof r=="string"?e.push(`#${r}`):r===""||r==null?e.push(n):e.push(`${n}="${String(r)}"`);return e.length>0?`{${e.join(" ")}}`:""}function Xc(t){return{type:"text",value:t}}function OH(t){const e=TH(t.type),n=typeof t.name=="string"?t.name:"",r=zs(t)??[],i=MH(t.attributes);if(t.type==="textDirective"){const o=[Xc(`${e}${n}`)];return r.length>0&&o.push(Xc("["),...r,Xc("]")),i&&o.push(Xc(i)),o}return[{type:"paragraph",children:[Xc(`${e}${n}${i}`)]},...r]}function PI(t){const e=zs(t);if(e)for(let n=0;n<e.length;n++){const r=e[n];if(!r)continue;if(r.type==="containerDirective"){const o=r,u=o.name===iS?EH(o):null,c=zs(o),h=c?.length===1?c[0]:void 0;if(u&&rT(h)){e[n]={...h,listStyle:u};continue}}const i=AH(r),s=e[n+1];if(i&&rT(s)&&NH(s,e,n+2)){e.splice(n,1),e[n]={...s,listStyle:i};continue}if(PI(r),wH.has(r.type)){if(r.name===tg)continue;const o=r.type==="containerDirective"&&r.name===iS?zs(r)??[]:OH(r);e.splice(n,1,...o),n+=o.length-1}}}function RH(t){return!!(t&&typeof t=="object"&&"containerFlow"in t&&typeof t.containerFlow=="function")}const DH=(t,e,n,r)=>{if(!RH(n))return"";const i=Pi(VI(t)?.class),s=n.containerFlow(t,r);return`:::list${i?`{.${i}}`:""}
59
+ ${s}
60
+ :::`},IH=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{containerDirective:DH}};return t.push(e),this.data("toMarkdownExtensions",t),n=>{PI(n)}},_H=Ni("remarkListDirective",()=>IH),zH=function(){const t=this.data("micromarkExtensions")??[];t.push(xH()),this.data("micromarkExtensions",t);const e=this.data("fromMarkdownExtensions")??[];e.push(Hq()),this.data("fromMarkdownExtensions",e)},LH=Ni("remarkDirective",()=>zH);function jI(t){return t&&typeof t=="object"?t:{}}function BH(t){if(t)return{name:iS,attributes:{class:t}}}function $I(t,e,n){const r=Pi(e.attrs.listStyle),i=BH(r);i&&t.openNode("containerDirective",void 0,i),t.openNode("list",void 0,n).next(e.content).closeNode(),i&&t.closeNode()}const VH=ml.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,listStyle:{default:null,validate:"string|null"}},parseDOM:[{tag:"ul",getAttrs:r=>{const i=jI(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Pi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Pi(r.attrs.listStyle);return["ul",{...e.get(Lg.key)(r),...i?{class:i}:{},"data-spread":r.attrs.spread},0]},parseMarkdown:{match:({type:r,ordered:i})=>r==="list"&&!i,runner:(r,i,s)=>{r.openNode(s,{spread:i.spread===!0,listStyle:Pi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="bullet_list",runner:(r,i)=>{$I(r,i,{ordered:!1,spread:i.attrs.spread===!0})}}}}),FH=gl.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,listStyle:{default:null,validate:"string|null"}},parseDOM:[{tag:"ol",getAttrs:r=>{const i=jI(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Pi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Pi(r.attrs.listStyle);return["ol",{...e.get(Vg.key)(r),...r.attrs.order===1?{}:{start:r.attrs.order},...i?{class:i}:{},"data-spread":r.attrs.spread},0]},parseMarkdown:{match:({type:r,ordered:i})=>r==="list"&&!!i,runner:(r,i,s)=>{r.openNode(s,{order:typeof i.start=="number"?i.start:1,spread:i.spread===!0,listStyle:Pi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="ordered_list",runner:(r,i)=>{$I(r,i,{ordered:!0,start:typeof i.attrs.order=="number"?i.attrs.order:1,spread:i.attrs.spread===!0})}}}}),UI=Ue("SetListStyle",()=>t=>(e,n)=>{const r=new Set([e.schema.nodes.bullet_list,e.schema.nodes.ordered_list].filter(Boolean));if(r.size===0)return!1;const i=Pi(t),s=new Map,{from:o,to:u,$from:c}=e.selection;for(let h=c.depth;h>0;h--){const d=c.node(h);if(r.has(d.type)){s.set(c.before(h),d);break}}if(e.doc.nodesBetween(o,u,(h,d)=>{r.has(h.type)&&s.set(d,h)}),s.size===0)return!1;if(n){let h=e.tr;for(const[d,g]of s)h=h.setNodeMarkup(d,void 0,{...g.attrs,listStyle:i});n(h.scrollIntoView())}return!0}),PH=[LH,_H,VH,FH,UI].flat(),jH=/^[A-Za-z0-9_-]{11}$/,$H=/(?:youtu\.be\/|\/(?:embed|shorts|v)\/)([A-Za-z0-9_-]{11})/;function UH(t){const e=t.trim();if(!e)return null;if(jH.test(e))return e;const n=/[?&]v=([A-Za-z0-9_-]{11})/.exec(e);if(n)return n[1]??null;const r=$H.exec(e);return r?r[1]??null:null}const JH={fontSize:11,color:"#dc2626",whiteSpace:"nowrap"};function qH({onApply:t,onClose:e}){const[n,r]=ae.useState(""),[i,s]=ae.useState(!1),o=()=>{const u=UH(n);if(!u){s(!0);return}t(u)};return I.jsxs("div",{style:gk,"data-mdx-action":"youtube",onMouseDown:u=>u.stopPropagation(),children:[I.jsx("input",{style:eg,autoFocus:!0,placeholder:"YouTube URL or ID",value:n,onChange:u=>{r(u.currentTarget.value),i&&s(!1)},onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),o()),u.key==="Escape"&&e()}}),i?I.jsx("span",{style:JH,children:"No video id found"}):null,I.jsx("button",{type:"button",style:{..._h,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:u=>u.preventDefault(),onClick:o,children:"Insert"}),I.jsx("button",{type:"button",style:_h,onMouseDown:u=>u.preventDefault(),onClick:e,children:"Cancel"})]})}function HH(t){const[e,n]=ae.useState(rS);return ae.useEffect(()=>{if(!t){n(rS);return}return Oq(t,n)},[t]),e}function vx(t,e){Nq(t.ctx.get(gn),e)}function iT(t,e){const n=t.ctx.get(gn);Aq(n,e==="bullet"?"bullet_list":"ordered_list")?t.action(ki(Pg.key)):t.action(ki(e==="bullet"?Bg.key:Fg.key))}function KH(t,e){t.ctx.get(gn).focus(),t.action(ki(UI.key,e))}function GH(t,e,n,r){t.action(i=>{const s=i.get(gn),o=s.state.schema.nodes.image;o&&(s.focus(),s.dispatch(s.state.tr.replaceSelectionWith(o.create({src:e,alt:n,title:r})).scrollIntoView()))})}function YH(t,e){t.action(ki(BI.key,e))}const QH={display:"flex",flexWrap:"wrap",alignItems:"center",gap:3,padding:"4px 6px",borderBottom:"1px solid #ececed",background:"#fafafa"},kx={width:1,height:18,background:"#e4e4e7",margin:"0 3px"},JI={border:"1px solid transparent",background:"transparent",borderRadius:4,padding:"2px 7px",font:"inherit",fontSize:12,lineHeight:1.4,cursor:"pointer",color:"#52525b"},WH={...JI,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},XH={border:"1px solid #d4d4d8",borderRadius:4,background:"#fff",color:"#3f3f46",font:"inherit",fontSize:12,lineHeight:1.4,padding:"2px 6px",maxWidth:150};function ar({active:t,title:e,onClick:n,style:r,children:i}){return I.jsx("button",{type:"button",title:e,"data-mdx-action":"format",onMouseDown:s=>s.preventDefault(),onClick:n,style:{...t?WH:JI,...r},children:i})}function qI({editor:t,listStyles:e,media:n,mediaContext:r,field:i,onInsertComponent:s}){const o=HH(t),[u,c]=ae.useState(!1),[h,d]=ae.useState(!1),[g,y]=ae.useState(!1),[b,k]=ae.useState(null),E=t===null,N=(e?.length??0)>0,M=o.bulletList||o.orderedList,j=o.listStyle&&e?.some(L=>L.class===o.listStyle)?o.listStyle:"",P=L=>{if(c(!1),!t)return;t.ctx.get(gn).focus(),t.action(ki(o.link?iv.key:rv.key,{href:L}))},U=()=>{if(c(!1),!t)return;const L=t.ctx.get(gn);L.focus(),Tq(L)};return I.jsxs("div",{children:[I.jsxs("div",{style:QH,children:[I.jsx(ar,{active:o.bold,title:"Bold",onClick:()=>t?.action(ki(Dg.key)),style:{fontWeight:700},children:"B"}),I.jsx(ar,{active:o.italic,title:"Italic",onClick:()=>t?.action(ki(Rg.key)),style:{fontStyle:"italic"},children:"I"}),I.jsx(ar,{active:o.strikethrough,title:"Strikethrough",onClick:()=>t?.action(ki(Hg.key)),style:{textDecoration:"line-through"},children:"S"}),I.jsx("span",{style:kx}),I.jsx(ar,{active:o.heading===2,title:"Heading 2",onClick:()=>t&&vx(t,2),children:"H2"}),I.jsx(ar,{active:o.heading===3,title:"Heading 3",onClick:()=>t&&vx(t,3),children:"H3"}),I.jsx(ar,{active:o.heading===4,title:"Heading 4",onClick:()=>t&&vx(t,4),children:"H4"}),I.jsx("span",{style:kx}),I.jsx(ar,{active:o.bulletList,title:"Bullet list",onClick:()=>t&&iT(t,"bullet"),children:"• List"}),I.jsx(ar,{active:o.orderedList,title:"Numbered list",onClick:()=>t&&iT(t,"ordered"),children:"1. List"}),N?I.jsxs("select",{title:"List style","aria-label":"List style",disabled:E||!M,value:j,onChange:L=>{t&&KH(t,L.currentTarget.value||null)},style:{...XH,opacity:E||!M?.55:1,cursor:E||!M?"not-allowed":"default"},children:[I.jsx("option",{value:"",children:"Default"}),e?.map(L=>I.jsx("option",{value:L.class,children:L.label},L.class))]}):null,I.jsx(ar,{active:o.blockquote,title:"Quote",onClick:()=>t?.action(ki(zg.key)),children:"❝"}),I.jsx(ar,{title:"Insert table",onClick:()=>t?.action(ki(ck.key,{row:3,col:3})),children:"▦ Table"}),I.jsx(ar,{active:g,title:"Insert YouTube",onClick:()=>!E&&y(L=>!L),children:"YouTube"}),I.jsx("span",{style:kx}),I.jsx(ar,{active:o.link||u,title:"Link",onClick:()=>!E&&c(L=>!L),children:"🔗 Link"}),n?I.jsx(ar,{title:"Insert image",onClick:()=>!E&&d(!0),children:"🖼 Image"}):null,s?I.jsxs(I.Fragment,{children:[I.jsx("span",{style:{flex:1}}),I.jsx(ar,{title:"Insert component block",onClick:()=>!E&&s(),style:{border:"1px solid #d4d4d8",color:"#3f3f46"},children:"+ Component"})]}):null]}),u?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(dq,{initialUrl:o.linkHref??"https://",isEdit:o.link,onApply:P,onRemove:o.link?U:void 0,onClose:()=>c(!1)})}):null,g?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(qH,{onApply:L=>{y(!1),t&&YH(t,L)},onClose:()=>y(!1)})}):null,b?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(gq,{initialAlt:b.alt,onApply:(L,C)=>{const{url:z}=b;k(null),t&&GH(t,z,L,C)},onClose:()=>k(null)})}):null,h&&n?I.jsx(_I,{media:n,context:r,field:i,accept:"image/*",onSelect:(L,C)=>{d(!1),t&&k({url:L,alt:C??""})},onClose:()=>d(!1)}):null]})}function ZH(){return{enter:{mdxFlowExpression:tK,mdxTextExpression:nK},exit:{mdxFlowExpression:sT,mdxFlowExpressionChunk:aT,mdxTextExpression:sT,mdxTextExpressionChunk:aT}}}function eK(){return{handlers:{mdxFlowExpression:oT,mdxTextExpression:oT},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function tK(t){this.enter({type:"mdxFlowExpression",value:""},t),this.buffer()}function nK(t){this.enter({type:"mdxTextExpression",value:""},t),this.buffer()}function sT(t){const e=this.resume(),n=t.estree,r=this.stack[this.stack.length-1];r.type==="mdxFlowExpression"||r.type,this.exit(t),r.value=e,n&&(r.data={estree:n})}function aT(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function oT(t,e,n){const r=t.value||"";return"{"+n.indentLines(r,function(s,o,u){return(o===0||u?"":" ")+s})+"}"}const HI=" ";function rK(){return{canContainEols:["mdxJsxTextElement"],enter:{mdxJsxFlowTag:r,mdxJsxFlowTagClosingMarker:i,mdxJsxFlowTagAttribute:g,mdxJsxFlowTagExpressionAttribute:y,mdxJsxFlowTagAttributeValueLiteral:t,mdxJsxFlowTagAttributeValueExpression:t,mdxJsxFlowTagSelfClosingMarker:o,mdxJsxTextTag:r,mdxJsxTextTagClosingMarker:i,mdxJsxTextTagAttribute:g,mdxJsxTextTagExpressionAttribute:y,mdxJsxTextTagAttributeValueLiteral:t,mdxJsxTextTagAttributeValueExpression:t,mdxJsxTextTagSelfClosingMarker:o},exit:{mdxJsxFlowTagClosingMarker:u,mdxJsxFlowTagNamePrimary:c,mdxJsxFlowTagNameMember:h,mdxJsxFlowTagNameLocal:d,mdxJsxFlowTagExpressionAttribute:b,mdxJsxFlowTagExpressionAttributeValue:n,mdxJsxFlowTagAttributeNamePrimary:k,mdxJsxFlowTagAttributeNameLocal:E,mdxJsxFlowTagAttributeValueLiteral:N,mdxJsxFlowTagAttributeValueLiteralValue:n,mdxJsxFlowTagAttributeValueExpression:M,mdxJsxFlowTagAttributeValueExpressionValue:n,mdxJsxFlowTagSelfClosingMarker:j,mdxJsxFlowTag:P,mdxJsxTextTagClosingMarker:u,mdxJsxTextTagNamePrimary:c,mdxJsxTextTagNameMember:h,mdxJsxTextTagNameLocal:d,mdxJsxTextTagExpressionAttribute:b,mdxJsxTextTagExpressionAttributeValue:n,mdxJsxTextTagAttributeNamePrimary:k,mdxJsxTextTagAttributeNameLocal:E,mdxJsxTextTagAttributeValueLiteral:N,mdxJsxTextTagAttributeValueLiteralValue:n,mdxJsxTextTagAttributeValueExpression:M,mdxJsxTextTagAttributeValueExpressionValue:n,mdxJsxTextTagSelfClosingMarker:j,mdxJsxTextTag:P}};function t(){this.buffer()}function e(z){return{line:z.line,column:z.column,offset:z.offset}}function n(z){this.config.enter.data.call(this,z),this.config.exit.data.call(this,z)}function r(z){const G={name:void 0,attributes:[],close:!1,selfClosing:!1,start:z.start,end:z.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=G,this.buffer()}function i(z){if(this.data.mdxJsxTagStack.length===0)throw new mt("Unexpected closing slash `/` in tag, expected an open tag first",{start:z.start,end:z.end},"mdast-util-mdx-jsx:unexpected-closing-slash")}function s(z){if(this.data.mdxJsxTag.close)throw new mt("Unexpected attribute in closing tag, expected the end of the tag",{start:z.start,end:z.end},"mdast-util-mdx-jsx:unexpected-attribute")}function o(z){if(this.data.mdxJsxTag.close)throw new mt("Unexpected self-closing slash `/` in closing tag, expected the end of the tag",{start:z.start,end:z.end},"mdast-util-mdx-jsx:unexpected-self-closing-slash")}function u(){const z=this.data.mdxJsxTag;z.close=!0}function c(z){const G=this.data.mdxJsxTag;G.name=this.sliceSerialize(z)}function h(z){const G=this.data.mdxJsxTag;G.name+="."+this.sliceSerialize(z)}function d(z){const G=this.data.mdxJsxTag;G.name+=":"+this.sliceSerialize(z)}function g(z){const G=this.data.mdxJsxTag;s.call(this,z),G.attributes.push({type:"mdxJsxAttribute",name:"",value:null,position:{start:e(z.start),end:void 0}})}function y(z){const G=this.data.mdxJsxTag;s.call(this,z),G.attributes.push({type:"mdxJsxExpressionAttribute",value:"",position:{start:e(z.start),end:void 0}}),this.buffer()}function b(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type;const K=z.estree;J.value=this.resume(),J.position,J.position.end=e(z.end),K&&(J.data={estree:K})}function k(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type,J.name=this.sliceSerialize(z),J.position,J.position.end=e(z.end)}function E(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type,J.name+=":"+this.sliceSerialize(z),J.position,J.position.end=e(z.end)}function N(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.value=Kg(this.resume(),{nonTerminated:!1}),J.position,J.position.end=e(z.end)}function M(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type;const K={type:"mdxJsxAttributeValueExpression",value:this.resume()},de=z.estree;de&&(K.data={estree:de}),J.value=K,J.position,J.position.end=e(z.end)}function j(){const z=this.data.mdxJsxTag;z.selfClosing=!0}function P(z){const G=this.data.mdxJsxTag,J=this.data.mdxJsxTagStack,K=J[J.length-1];if(G.close&&K.name!==G.name)throw new mt("Unexpected closing tag `"+C(G)+"`, expected corresponding closing tag for `"+C(K)+"` ("+Ms(K)+")",{start:z.start,end:z.end},"mdast-util-mdx-jsx:end-tag-mismatch");this.resume(),G.close?J.pop():this.enter({type:z.type==="mdxJsxTextTag"?"mdxJsxTextElement":"mdxJsxFlowElement",name:G.name||null,attributes:G.attributes,children:[]},z,U),G.selfClosing||G.close?this.exit(z,L):J.push(G)}function U(z,G){const J=this.data.mdxJsxTagStack,K=J[J.length-1],de=z?" before the end of `"+z.type+"`":"",ce=z?{start:z.start,end:z.end}:void 0;throw new mt("Expected a closing tag for `"+C(K)+"` ("+Ms({start:G.start,end:G.end})+")"+de,ce,"mdast-util-mdx-jsx:end-tag-mismatch")}function L(z,G){const J=this.data.mdxJsxTag;throw new mt("Expected the closing tag `"+C(J)+"` either after the end of `"+G.type+"` ("+Ms(G.end)+") or another opening tag after the start of `"+G.type+"` ("+Ms(G.start)+")",{start:z.start,end:z.end},"mdast-util-mdx-jsx:end-tag-mismatch")}function C(z){return"<"+(z.close?"/":"")+(z.name||"")+">"}}function iK(t){const e=t||{},n=e.quote||'"',r=e.quoteSmart||!1,i=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=aK,{handlers:{mdxJsxFlowElement:u,mdxJsxTextElement:u},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function u(c,h,d,g){const y=c.type==="mdxJsxFlowElement",b=c.name?!c.children||c.children.length===0:!1,k=KI(d),E=GI(k),N=d.createTracker(g),M=d.createTracker(g),j=[],P=(y?E:"")+"<"+(c.name||""),U=d.enter(c.type);if(N.move(P),M.move(P),c.attributes&&c.attributes.length>0){if(!c.name)throw new Error("Cannot serialize fragment w/ attributes");let J=-1;for(;++J<c.attributes.length;){const K=c.attributes[J];let de;if(K.type==="mdxJsxExpressionAttribute")de="{"+(K.value||"")+"}";else{if(!K.name)throw new Error("Cannot serialize attribute w/o name");const ce=K.value,Se=K.name;let Re="";if(ce!=null)if(typeof ce=="object")Re="{"+(ce.value||"")+"}";else{const Y=r&&Zm(ce,n)>Zm(ce,o)?o:n;Re=Y+qq(ce,{subset:[Y]})+Y}de=Se+(Re?"=":"")+Re}j.push(de)}}let L=!1;const C=j.join(" ");y&&(/\r?\n|\r/.test(C)||N.current().now.column+C.length+(b?i?2:3:1)>s)&&(L=!0);let z=N,G=P;if(L){z=M;let J=-1;for(;++J<j.length;)j[J]=E+HI+j[J];G+=z.move(`
61
+ `+j.join(`
62
+ `)+`
63
+ `+E)}else C&&(G+=z.move(" "+C));return b&&(G+=z.move((i||L?"":" ")+"/")),G+=z.move(">"),c.children&&c.children.length>0&&(c.type==="mdxJsxTextElement"?G+=z.move(d.containerPhrasing(c,{...z.current(),before:">",after:"<"})):(z.shift(2),G+=z.move(`
64
+ `),G+=z.move(sK(c,d,z.current())),G+=z.move(`
65
+ `))),b||(G+=z.move((y?E:"")+"</"+(c.name||"")+">")),U(),G}}function sK(t,e,n){const r=e.indexStack,i=t.children,s=e.createTracker(n),o=GI(KI(e)),u=[];let c=-1;for(r.push(-1);++c<i.length;){const h=i[c];r[r.length-1]=c;const d={before:`
66
+ `,after:`
67
+ `,...s.current()},g=e.handle(h,t,e,d),y=h.type==="mdxJsxFlowElement"?g:e.indentLines(g,function(b,k,E){return(E?"":o)+b});u.push(s.move(y)),h.type!=="list"&&(e.bulletLastUsed=void 0),c<i.length-1&&u.push(s.move(`
68
+
69
+ `))}return r.pop(),u.join("")}function KI(t){let e=0,n=t.stack.length;for(;--n>-1;){const r=t.stack[n];if(r==="blockquote"||r==="listItem")break;r==="mdxJsxFlowElement"&&e++}return e}function GI(t){return HI.repeat(t)}function aK(){return"<"}function oK(){return{enter:{mdxjsEsm:uK},exit:{mdxjsEsm:cK,mdxjsEsmData:fK}}}function lK(){return{handlers:{mdxjsEsm:hK}}}function uK(t){this.enter({type:"mdxjsEsm",value:""},t),this.buffer()}function cK(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(t);const r=t.estree;n.value=e,r&&(n.data={estree:r})}function fK(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function hK(t){return t.value||""}function pK(){return[ZH(),rK(),oK()]}function dK(t){return{extensions:[eK(),iK(t),lK()]}}var mK=[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],YI=[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],gK="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",QI="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Cx={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"},wx="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",yK={5:wx,"5module":wx+" export import",6:wx+" const class extends export import super"},xK=/^in(stanceof)?$/,bK=new RegExp("["+QI+"]"),SK=new RegExp("["+QI+gK+"]");function sS(t,e){for(var n=65536,r=0;r<e.length;r+=2){if(n+=e[r],n>t)return!1;if(n+=e[r+1],n>=t)return!0}return!1}function Hi(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&bK.test(String.fromCharCode(t)):e===!1?!1:sS(t,YI)}function Ya(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&&SK.test(String.fromCharCode(t)):e===!1?!1:sS(t,YI)||sS(t,mK)}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 Hr(t,e){return new ft(t,{beforeExpr:!0,binop:e})}var Kr={beforeExpr:!0},or={startsExpr:!0},vk={};function ut(t,e){return e===void 0&&(e={}),e.keyword=t,vk[t]=new ft(t,e)}var O={num:new ft("num",or),regexp:new ft("regexp",or),string:new ft("string",or),name:new ft("name",or),privateId:new ft("privateId",or),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(",",Kr),semi:new ft(";",Kr),colon:new ft(":",Kr),dot:new ft("."),question:new ft("?",Kr),questionDot:new ft("?."),arrow:new ft("=>",Kr),template:new ft("template"),invalidTemplate:new ft("invalidTemplate"),ellipsis:new ft("...",Kr),backQuote:new ft("`",or),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:Hr("||",1),logicalAND:Hr("&&",2),bitwiseOR:Hr("|",3),bitwiseXOR:Hr("^",4),bitwiseAND:Hr("&",5),equality:Hr("==/!=/===/!==",6),relational:Hr("</>/<=/>=",7),bitShift:Hr("<</>>/>>>",8),plusMin:new ft("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Hr("%",10),star:Hr("*",10),slash:Hr("/",10),starstar:new ft("**",{beforeExpr:!0}),coalesce:Hr("??",1),_break:ut("break"),_case:ut("case",Kr),_catch:ut("catch"),_continue:ut("continue"),_debugger:ut("debugger"),_default:ut("default",Kr),_do:ut("do",{isLoop:!0,beforeExpr:!0}),_else:ut("else",Kr),_finally:ut("finally"),_for:ut("for",{isLoop:!0}),_function:ut("function",or),_if:ut("if"),_return:ut("return",Kr),_switch:ut("switch"),_throw:ut("throw",Kr),_try:ut("try"),_var:ut("var"),_const:ut("const"),_while:ut("while",{isLoop:!0}),_with:ut("with"),_new:ut("new",{beforeExpr:!0,startsExpr:!0}),_this:ut("this",or),_super:ut("super",or),_class:ut("class",or),_extends:ut("extends",Kr),_export:ut("export"),_import:ut("import",or),_null:ut("null",or),_true:ut("true",or),_false:ut("false",or),_in:ut("in",{beforeExpr:!0,binop:7}),_instanceof:ut("instanceof",{beforeExpr:!0,binop:7}),_typeof:ut("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:ut("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:ut("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},cr=/\r\n?|\n|\u2028|\u2029/,vK=new RegExp(cr.source,"g");function Qu(t){return t===10||t===13||t===8232||t===8233}function WI(t,e,n){n===void 0&&(n=t.length);for(var r=e;r<n;r++){var i=t.charCodeAt(r);if(Qu(i))return r<n-1&&i===13&&t.charCodeAt(r+1)===10?r+2:r+1}return-1}var XI=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Sn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ZI=Object.prototype,kK=ZI.hasOwnProperty,CK=ZI.toString,Wu=Object.hasOwn||(function(t,e){return kK.call(t,e)}),lT=Array.isArray||(function(t){return CK.call(t)==="[object Array]"}),uT=Object.create(null);function Fa(t){return uT[t]||(uT[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function Vs(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var wK=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,zh=function(e,n){this.line=e,this.column=n};zh.prototype.offset=function(e){return new zh(this.line,this.column+e)};var Gg=function(e,n,r){this.start=n,this.end=r,e.sourceFile!==null&&(this.source=e.sourceFile)};function e_(t,e){for(var n=1,r=0;;){var i=WI(t,r,e);if(i<0)return new zh(n,e-r);++n,r=i}}var aS={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},cT=!1;function EK(t){var e={};for(var n in aS)e[n]=t&&Wu(t,n)?t[n]:aS[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!cT&&typeof console=="object"&&console.warn&&(cT=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
70
+ 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),lT(e.onToken)){var r=e.onToken;e.onToken=function(i){return r.push(i)}}return lT(e.onComment)&&(e.onComment=AK(e,e.onComment)),e}function AK(t,e){return function(n,r,i,s,o,u){var c={type:n?"Block":"Line",value:r,start:i,end:s};t.locations&&(c.loc=new Gg(this,o,u)),t.ranges&&(c.range=[i,s]),e.push(c)}}var Lh=1,Xu=2,kk=4,t_=8,Ck=16,n_=32,Yg=64,r_=128,vl=256,pp=512,Qg=Lh|Xu|vl;function wk(t,e){return Xu|(t?kk:0)|(e?t_:0)}var ng=0,Ek=1,Ks=2,i_=3,s_=4,a_=5,Zt=function(e,n,r){this.options=e=EK(e),this.sourceFile=e.sourceFile,this.keywords=Fa(yK[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var i="";e.allowReserved!==!0&&(i=Cx[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(i+=" await")),this.reservedWords=Fa(i);var s=(i?i+" ":"")+Cx.strict;this.reservedWordsStrict=Fa(s),this.reservedWordsStrictBind=Fa(s+" "+Cx.strictBind),this.input=String(n),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf(`
71
+ `,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(cr).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(Lh),this.regexpState=null,this.privateNameStack=[]},Wi={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)};Wi.inFunction.get=function(){return(this.currentVarScope().flags&Xu)>0};Wi.inGenerator.get=function(){return(this.currentVarScope().flags&t_)>0};Wi.inAsync.get=function(){return(this.currentVarScope().flags&kk)>0};Wi.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(vl|pp))return!1;if(n&Xu)return(n&kk)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Wi.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&Yg)>0||this.options.allowSuperOutsideMethod};Wi.allowDirectSuper.get=function(){return(this.currentThisScope().flags&r_)>0};Wi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Wi.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(vl|pp)||n&Xu&&!(n&Ck))return!0}return!1};Wi.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&vl)>0};Zt.extend=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var r=this,i=0;i<e.length;i++)r=e[i](r);return r};Zt.parse=function(e,n){return new this(n,e).parse()};Zt.parseExpressionAt=function(e,n,r){var i=new this(r,e,n);return i.nextToken(),i.parseExpression()};Zt.tokenizer=function(e,n){return new this(n,e)};Object.defineProperties(Zt.prototype,Wi);var Qn=Zt.prototype,NK=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Qn.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){Sn.lastIndex=t,t+=Sn.exec(this.input)[0].length;var e=NK.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){Sn.lastIndex=t+e[0].length;var n=Sn.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===";"||i==="}"||cr.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i==="!"&&this.input.charAt(r+1)==="=")}t+=e[0].length,Sn.lastIndex=t,t+=Sn.exec(this.input)[0].length,this.input[t]===";"&&t++}};Qn.eat=function(t){return this.type===t?(this.next(),!0):!1};Qn.isContextual=function(t){return this.type===O.name&&this.value===t&&!this.containsEsc};Qn.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};Qn.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};Qn.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||cr.test(this.input.slice(this.lastTokEnd,this.start))};Qn.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};Qn.semicolon=function(){!this.eat(O.semi)&&!this.insertSemicolon()&&this.unexpected()};Qn.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};Qn.expect=function(t){this.eat(t)||this.unexpected()};Qn.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Wg=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Qn.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")}};Qn.checkExpressionErrors=function(t,e){if(!t)return!1;var n=t.shorthandAssign,r=t.doubleProto;if(!e)return n>=0||r>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")};Qn.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")};Qn.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var Te=Zt.prototype;Te.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 r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var s=i[r];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 Ak={kind:"loop"},TK={kind:"switch"};Te.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Sn.lastIndex=this.pos;var e=Sn.exec(this.input),n=this.pos+e[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(t)return!1;if(r===123||r>55295&&r<56320)return!0;if(Hi(r,!0)){for(var i=n+1;Ya(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var s=this.input.slice(n,i);if(!xK.test(s))return!0}return!1};Te.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Sn.lastIndex=this.pos;var t=Sn.exec(this.input),e=this.pos+t[0].length,n;return!cr.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(Ya(n=this.input.charCodeAt(e+8))||n>55295&&n<56320))};Te.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;Sn.lastIndex=this.pos;var n=Sn.exec(this.input),r=this.pos+n[0].length;if(cr.test(this.input.slice(this.pos,r)))return!1;if(t){var i=r+5,s;if(this.input.slice(r,i)!=="using"||i===this.input.length||Ya(s=this.input.charCodeAt(i))||s>55295&&s<56320)return!1;Sn.lastIndex=i;var o=Sn.exec(this.input);if(o&&cr.test(this.input.slice(i,i+o[0].length)))return!1}if(e){var u=r+2,c;if(this.input.slice(r,u)==="of"&&(u===this.input.length||!Ya(c=this.input.charCodeAt(u))&&!(c>55295&&c<56320)))return!1}var h=this.input.charCodeAt(r);return Hi(h,!0)||h===92};Te.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};Te.isUsing=function(t){return this.isUsingKeyword(!1,t)};Te.parseStatement=function(t,e,n){var r=this.type,i=this.startNode(),s;switch(this.isLet(t)&&(r=O._var,s="let"),r){case O._break:case O._continue:return this.parseBreakContinueStatement(i,r.keyword);case O._debugger:return this.parseDebuggerStatement(i);case O._do:return this.parseDoStatement(i);case O._for:return this.parseForStatement(i);case O._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!t);case O._class:return t&&this.unexpected(),this.parseClass(i,!0);case O._if:return this.parseIfStatement(i);case O._return:return this.parseReturnStatement(i);case O._switch:return this.parseSwitchStatement(i);case O._throw:return this.parseThrowStatement(i);case O._try:return this.parseTryStatement(i);case O._const:case O._var:return s=s||this.value,t&&s!=="var"&&this.unexpected(),this.parseVarStatement(i,s);case O._while:return this.parseWhileStatement(i);case O._with:return this.parseWithStatement(i);case O.braceL:return this.parseBlock(!0,i);case O.semi:return this.parseEmptyStatement(i);case O._export:case O._import:if(this.options.ecmaVersion>10&&r===O._import){Sn.lastIndex=this.pos;var o=Sn.exec(this.input),u=this.pos+o[0].length,c=this.input.charCodeAt(u);if(c===40||c===46)return this.parseExpressionStatement(i,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'")),r===O._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!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(i,!1,h),this.semicolon(),this.finishNode(i,"VariableDeclaration");var d=this.value,g=this.parseExpression();return r===O.name&&g.type==="Identifier"&&this.eat(O.colon)?this.parseLabeledStatement(i,d,g,t):this.parseExpressionStatement(i,g)}};Te.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 r=0;r<this.labels.length;++r){var i=this.labels[r];if((t.label==null||i.name===t.label.name)&&(i.kind!=null&&(n||i.kind==="loop")||t.label&&n))break}return r===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,n?"BreakStatement":"ContinueStatement")};Te.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};Te.parseDoStatement=function(t){return this.next(),this.labels.push(Ak),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")};Te.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ak),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 r=this.startNode(),i=n?"let":this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,"VariableDeclaration"),this.parseForAfterInit(t,r,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,d=new Wg,g=this.start,y=e>-1?this.parseExprSubscripts(d,"await"):this.parseExpression(!0,d);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,d),this.checkLValPattern(y),this.parseForIn(t,y)):(this.checkExpressionErrors(d,!0),e>-1&&this.unexpected(e),this.parseFor(t,y))};Te.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))};Te.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,oh|(n?0:oS),!1,e)};Te.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")};Te.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")};Te.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(O.braceL),this.labels.push(TK),this.enterScope(0);for(var e,n=!1;this.type!==O.braceR;)if(this.type===O._case||this.type===O._default){var r=this.type===O._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),r?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")};Te.parseThrowStatement=function(t){return this.next(),cr.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 MK=[];Te.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?n_:0),this.checkLValPattern(t,e?s_:Ks),this.expect(O.parenR),t};Te.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")};Te.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")};Te.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(Ak),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};Te.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")};Te.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};Te.parseLabeledStatement=function(t,e,n,r){for(var i=0,s=this.labels;i<s.length;i+=1){var o=s[i];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(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")};Te.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};Te.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 r=this.parseStatement(null);e.body.push(r)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};Te.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")};Te.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")};Te.parseVar=function(t,e,n,r){for(t.declarations=[],t.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(O.eq)?i.init=this.parseMaybeAssign(e):!r&&n==="const"&&!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(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"):!r&&i.id.type!=="Identifier"&&!(e&&(this.type===O._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):i.init=null,t.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(O.comma))break}return t};Te.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?Ek:Ks,!1)};var oh=1,oS=2,o_=4;Te.parseFunction=function(t,e,n,r,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===O.star&&e&oS&&this.unexpected(),t.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(t.async=!!r),e&oh&&(t.id=e&o_&&this.type!==O.name?null:this.parseIdent(),t.id&&!(e&oS)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?Ek:Ks:i_));var s=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(wk(t.async,t.generator)),e&oh||(t.id=this.type===O.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n,!1,i),this.yieldPos=s,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(t,e&oh?"FunctionDeclaration":"FunctionExpression")};Te.parseFunctionParams=function(t){this.expect(O.parenL),t.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Te.parseClass=function(t,e){this.next();var n=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var r=this.enterClassBody(),i=this.startNode(),s=!1;for(i.body=[],this.expect(O.braceL);this.type!==O.braceR;){var o=this.parseClassElement(t.superClass!==null);o&&(i.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"&&OK(r,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=n,this.next(),t.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};Te.parseClassElement=function(t){if(this.eat(O.semi))return null;var e=this.options.ecmaVersion,n=this.startNode(),r="",i=!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:r="static"}if(n.static=u,!r&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===O.star)&&!this.canInsertSemicolon()?s=!0:r="async"),!r&&(e>=9||!s)&&this.eat(O.star)&&(i=!0),!r&&!s&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),e<13||this.type===O.parenL||o!=="method"||i||s){var h=!n.static&&rg(n,"constructor"),d=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,i,s,d)}else this.parseClassField(n);return n};Te.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};Te.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)};Te.parseClassMethod=function(t,e,n,r){var i=t.key;t.kind==="constructor"?(e&&this.raise(i.start,"Constructor can't be a generator"),n&&this.raise(i.start,"Constructor can't be an async method")):t.static&&rg(t,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var s=t.value=this.parseMethod(e,n,r);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")};Te.parseClassField=function(t){return rg(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&rg(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(O.eq)?(this.enterScope(pp|Yg),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};Te.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(vl|Yg);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")};Te.parseClassId=function(t,e){this.type===O.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Ks,!1)):(e===!0&&this.unexpected(),t.id=null)};Te.parseClassSuper=function(t){t.superClass=this.eat(O._extends)?this.parseExprSubscripts(null,!1):null};Te.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};Te.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,n=t.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],s=0;s<n.length;++s){var o=n[s];Wu(e,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function OK(t,e){var n=e.key.name,r=t[n],i="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(i=(e.static?"s":"i")+e.kind),r==="iget"&&i==="iset"||r==="iset"&&i==="iget"||r==="sget"&&i==="sset"||r==="sset"&&i==="sget"?(t[n]="true",!1):r?!0:(t[n]=i,!1)}function rg(t,e){var n=t.computed,r=t.key;return!n&&(r.type==="Identifier"&&r.name===e||r.type==="Literal"&&r.value===e)}Te.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")};Te.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,r=t.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type==="Literal"&&this.raise(i.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")};Te.parseExportDeclaration=function(t){return this.parseStatement(null)};Te.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,oh|o_,!1,t)}else if(this.type===O._class){var n=this.startNode();return this.parseClass(n,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};Te.checkExport=function(t,e,n){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Wu(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)};Te.checkPatternExport=function(t,e){var n=e.type;if(n==="Identifier")this.checkExport(t,e,e.start);else if(n==="ObjectPattern")for(var r=0,i=e.properties;r<i.length;r+=1){var s=i[r];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)};Te.checkVariableExport=function(t,e){if(t)for(var n=0,r=e;n<r.length;n+=1){var i=r[n];this.checkPatternExport(t,i.id)}};Te.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Te.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")};Te.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};Te.parseImport=function(t){return this.next(),this.type===O.string?(t.specifiers=MK,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")};Te.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,Ks),this.finishNode(t,"ImportSpecifier")};Te.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Ks),this.finishNode(t,"ImportDefaultSpecifier")};Te.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Ks),this.finishNode(t,"ImportNamespaceSpecifier")};Te.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};Te.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 r=this.parseImportAttribute(),i=r.key.type==="Identifier"?r.key.name:r.key.value;Wu(e,i)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+i+"'"),e[i]=!0,t.push(r)}return t};Te.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")};Te.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===O.string){var t=this.parseLiteral(this.value);return wK.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};Te.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)};Te.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 li=Zt.prototype;li.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 r=0,i=t.properties;r<i.length;r+=1){var s=i[r];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};li.toAssignableList=function(t,e){for(var n=t.length,r=0;r<n;r++){var i=t[r];i&&this.toAssignable(i,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};li.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};li.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")};li.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()};li.parseBindingList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);)if(s?s=!1:this.expect(O.comma),e&&this.type===O.comma)i.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===O.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else i.push(this.parseAssignableListItem(r))}return i};li.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};li.parseBindingListItem=function(t){return t};li.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(O.eq))return n;var r=this.startNodeAt(t,e);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};li.checkLValSimple=function(t,e,n){e===void 0&&(e=ng);var r=e!==ng;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(r?"Binding ":"Assigning to ")+t.name+" in strict mode"),r&&(e===Ks&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(Wu(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==a_&&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":r&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,n);default:this.raise(t.start,(r?"Binding":"Assigning to")+" rvalue")}};li.checkLValPattern=function(t,e,n){switch(e===void 0&&(e=ng),t.type){case"ObjectPattern":for(var r=0,i=t.properties;r<i.length;r+=1){var s=i[r];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)}};li.checkLValInnerPattern=function(t,e,n){switch(e===void 0&&(e=ng),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 vi=function(e,n,r,i,s){this.token=e,this.isExpr=!!n,this.preserveSpace=!!r,this.override=i,this.generator=!!s},It={b_stat:new vi("{",!1),b_expr:new vi("{",!0),b_tmpl:new vi("${",!1),p_stat:new vi("(",!1),p_expr:new vi("(",!0),q_tmpl:new vi("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new vi("function",!1),f_expr:new vi("function",!0),f_expr_gen:new vi("function",!0,!1,null,!0),f_gen:new vi("function",!1,!1,null,!0)},Zu=Zt.prototype;Zu.initialContext=function(){return[It.b_stat]};Zu.curContext=function(){return this.context[this.context.length-1]};Zu.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?cr.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};Zu.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};Zu.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};Zu.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&&cr.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 Je=Zt.prototype;Je.checkPropClash=function(t,e,n){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var r=t.key,i;switch(r.type){case"Identifier":i=r.name;break;case"Literal":i=String(r.value);break;default:return}var s=t.kind;if(this.options.ecmaVersion>=6){i==="__proto__"&&s==="init"&&(e.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),e.proto=!0);return}i="$"+i;var o=e[i];if(o){var u;s==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[s],u&&this.raiseRecoverable(r.start,"Redefinition of property")}else o=e[i]={init:!1,get:!1,set:!1};o[s]=!0}};Je.parseExpression=function(t,e){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(t,e);if(this.type===O.comma){var s=this.startNodeAt(n,r);for(s.expressions=[i];this.eat(O.comma);)s.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(s,"SequenceExpression")}return i};Je.parseMaybeAssign=function(t,e,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var r=!1,i=-1,s=-1,o=-1;e?(i=e.parenthesizedAssign,s=e.trailingComma,o=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Wg,r=!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 d=this.startNodeAt(u,c);return d.operator=this.value,this.type===O.eq&&(h=this.toAssignable(h,!1,e)),r||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===O.eq?this.checkLValPattern(h):this.checkLValSimple(h),d.left=h,this.next(),d.right=this.parseMaybeAssign(t),o>-1&&(e.doubleProto=o),this.finishNode(d,"AssignmentExpression")}else r&&this.checkExpressionErrors(e,!0);return i>-1&&(e.parenthesizedAssign=i),s>-1&&(e.trailingComma=s),h};Je.parseMaybeConditional=function(t,e){var n=this.start,r=this.startLoc,i=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return i;if(this.eat(O.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(O.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return i};Je.parseExprOps=function(t,e){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||i.start===n&&i.type==="ArrowFunctionExpression"?i:this.parseExprOp(i,n,r,-1,t)};Je.parseExprOp=function(t,e,n,r,i){var s=this.type.binop;if(s!=null&&(!i||this.type!==O._in)&&s>r){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,d=this.startLoc,g=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),h,d,s,i),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,r,i)}return t};Je.buildBinary=function(t,e,n,r,i,s){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(t,e);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")};Je.parseMaybeUnary=function(t,e,n,r){var i=this.start,s=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(r),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,r),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&l_(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&lS(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)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==O._in&&this.unexpected();else{if(o=this.parseExprSubscripts(t,r),this.checkExpressionErrors(t))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(i,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(i,s,o,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return o};function l_(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&l_(t.expression)}function lS(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&lS(t.expression)||t.type==="ParenthesizedExpression"&&lS(t.expression)}Je.parseExprSubscripts=function(t,e){var n=this.start,r=this.startLoc,i=this.parseExprAtom(t,e);if(i.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return i;var s=this.parseSubscripts(i,n,r,!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};Je.parseSubscripts=function(t,e,n,r,i){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,r,s,o,i);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}};Je.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(O.arrow)};Je.parseSubscriptAsyncArrow=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,r)};Je.parseSubscript=function(t,e,n,r,i,s,o){var u=this.options.ecmaVersion>=11,c=u&&this.eat(O.questionDot);r&&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 d=this.startNodeAt(e,n);d.object=t,h?(d.property=this.parseExpression(),this.expect(O.bracketR)):this.type===O.privateId&&t.type!=="Super"?d.property=this.parsePrivateIdent():d.property=this.parseIdent(this.options.allowReserved!=="never"),d.computed=!!h,u&&(d.optional=c),t=this.finishNode(d,"MemberExpression")}else if(!r&&this.eat(O.parenL)){var g=new Wg,y=this.yieldPos,b=this.awaitPos,k=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var E=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1,g);if(i&&!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=k,this.parseSubscriptAsyncArrow(e,n,E,o);this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=b||this.awaitPos,this.awaitIdentPos=k||this.awaitIdentPos;var N=this.startNodeAt(e,n);N.callee=t,N.arguments=E,u&&(N.optional=c),t=this.finishNode(N,"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};Je.parseExprAtom=function(t,e,n){this.type===O.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case O._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===O.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==O.dot&&this.type!==O.bracketL&&this.type!==O.parenL&&this.unexpected(),this.finishNode(r,"Super");case O._this:return r=this.startNode(),this.next(),this.finishNode(r,"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(i&&!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 r=this.parseLiteral(h.value),r.regex={pattern:h.pattern,flags:h.flags},r;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return r=this.startNode(),r.value=this.type===O._null?null:this.type===O._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case O.parenL:var d=this.start,g=this.parseParenAndDistinguishExpression(i,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(g)&&(t.parenthesizedAssign=d),t.parenthesizedBind<0&&(t.parenthesizedBind=d)),g;case O.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(O.bracketR,!0,!0,t),this.finishNode(r,"ArrayExpression");case O.braceL:return this.overrideContext(It.b_expr),this.parseObj(!1,t);case O._function:return r=this.startNode(),this.next(),this.parseFunction(r,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()}};Je.parseExprAtomDefault=function(){this.unexpected()};Je.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()};Je.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")};Je.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")};Je.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")};Je.parseParenExpression=function(){this.expect(O.parenL);var t=this.parseExpression();return this.expect(O.parenR),t};Je.shouldParseArrow=function(t){return!this.canInsertSemicolon()};Je.parseParenAndDistinguishExpression=function(t,e){var n=this.start,r=this.startLoc,i,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,c=[],h=!0,d=!1,g=new Wg,y=this.yieldPos,b=this.awaitPos,k;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)){d=!0;break}else if(this.type===O.ellipsis){k=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,N=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,r,c,e);(!c.length||d)&&this.unexpected(this.lastTokStart),k&&this.unexpected(k),this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=b||this.awaitPos,c.length>1?(i=this.startNodeAt(o,u),i.expressions=c,this.finishNodeAt(i,"SequenceExpression",E,N)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var M=this.startNodeAt(n,r);return M.expression=i,this.finishNode(M,"ParenthesizedExpression")}else return i};Je.parseParenItem=function(t){return t};Je.parseParenArrowList=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,r)};var RK=[];Je.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 r=this.start,i=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(O.parenL)?t.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):t.arguments=RK,this.finishNode(t,"NewExpression")};Je.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,`
72
+ `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
73
+ `),cooked:this.value},this.next(),n.tail=this.type===O.backQuote,this.finishNode(n,"TemplateElement")};Je.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 r=this.parseTemplateElement({isTagged:e});for(n.quasis=[r];!r.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(r=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")};Je.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)&&!cr.test(this.input.slice(this.lastTokEnd,this.start))};Je.parseObj=function(t,e){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(O.braceR);){if(r)r=!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,i,e),n.properties.push(s)}return this.finishNode(n,t?"ObjectPattern":"ObjectExpression")};Je.parseProperty=function(t,e){var n=this.startNode(),r,i,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||(r=this.eat(O.star)));var u=this.containsEsc;return this.parsePropertyName(n),!t&&!u&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(O.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,t,r,i,s,o,e,u),this.finishNode(n,"Property")};Je.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 r=t.value.start;t.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"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")};Je.parsePropertyValue=function(t,e,n,r,i,s,o,u){(n||r)&&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,r),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||r)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((n||r)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=i),e?t.value=this.parseMaybeDefault(i,s,this.copyNode(t.key)):this.type===O.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),t.value=this.parseMaybeDefault(i,s,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected()};Je.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")};Je.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};Je.parseMethod=function(t,e,n){var r=this.startNode(),i=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=t),this.options.ecmaVersion>=8&&(r.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(wk(e,r.generator)|Yg|(n?r_:0)),this.expect(O.parenL),r.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(r,"FunctionExpression")};Je.parseArrowExpression=function(t,e,n,r){var i=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(wk(n,!1)|Ck),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,r),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(t,"ArrowFunctionExpression")};Je.parseFunctionBody=function(t,e,n,r){var i=e&&this.type!==O.braceL,s=this.strict,o=!1;if(i)t.body=this.parseMaybeAssign(r),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,a_),t.body=this.parseBlock(!1,void 0,o&&!s),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()};Je.isSimpleParamList=function(t){for(var e=0,n=t;e<n.length;e+=1){var r=n[e];if(r.type!=="Identifier")return!1}return!0};Je.checkParams=function(t,e){for(var n=Object.create(null),r=0,i=t.params;r<i.length;r+=1){var s=i[r];this.checkLValInnerPattern(s,Ek,e?null:n)}};Je.parseExprList=function(t,e,n,r){for(var i=[],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(r),r&&this.type===O.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i};Je.checkUnreserved=function(t){var e=t.start,n=t.end,r=t.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Qg)&&r==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(e,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(e,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,n).indexOf("\\")!==-1)){var i=this.strict?this.reservedWordsStrict:this.reservedWords;i.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+r+"' is reserved"))}};Je.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};Je.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};Je.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};Je.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")};Je.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 ig=Zt.prototype;ig.raise=function(t,e){var n=e_(this.input,t);e+=" ("+n.line+":"+n.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var r=new SyntaxError(e);throw r.pos=t,r.loc=n,r.raisedAt=this.pos,r};ig.raiseRecoverable=ig.raise;ig.curPosition=function(){if(this.options.locations)return new zh(this.curLine,this.pos-this.lineStart)};var ro=Zt.prototype,DK=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ro.enterScope=function(t){this.scopeStack.push(new DK(t))};ro.exitScope=function(){this.scopeStack.pop()};ro.treatFunctionsAsVarInScope=function(t){return t.flags&Xu||!this.inModule&&t.flags&Lh};ro.declareName=function(t,e,n){var r=!1;if(e===Ks){var i=this.currentScope();r=i.lexical.indexOf(t)>-1||i.functions.indexOf(t)>-1||i.var.indexOf(t)>-1,i.lexical.push(t),this.inModule&&i.flags&Lh&&delete this.undefinedExports[t]}else if(e===s_){var s=this.currentScope();s.lexical.push(t)}else if(e===i_){var o=this.currentScope();this.treatFunctionsAsVar?r=o.lexical.indexOf(t)>-1:r=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&n_&&c.lexical[0]===t)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(t)>-1){r=!0;break}if(c.var.push(t),this.inModule&&c.flags&Lh&&delete this.undefinedExports[t],c.flags&Qg)break}r&&this.raiseRecoverable(n,"Identifier '"+t+"' has already been declared")};ro.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};ro.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};ro.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Qg|pp|vl))return e}};ro.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Qg|pp|vl)&&!(e.flags&Ck))return e}};var Xg=function(e,n,r){this.type="",this.start=n,this.end=0,e.options.locations&&(this.loc=new Gg(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[n,0])},dp=Zt.prototype;dp.startNode=function(){return new Xg(this,this.start,this.startLoc)};dp.startNodeAt=function(t,e){return new Xg(this,t,e)};function u_(t,e,n,r){return t.type=e,t.end=n,this.options.locations&&(t.loc.end=r),this.options.ranges&&(t.range[1]=n),t}dp.finishNode=function(t,e){return u_.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};dp.finishNodeAt=function(t,e,n,r){return u_.call(this,t,e,n,r)};dp.copyNode=function(t){var e=new Xg(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var IK="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",c_="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",f_=c_+" Extended_Pictographic",h_=f_,p_=h_+" EBase EComp EMod EPres ExtPict",d_=p_,_K=d_,zK={9:c_,10:f_,11:h_,12:p_,13:d_,14:_K},LK="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",BK={9:"",10:"",11:"",12:"",13:"",14:LK},fT="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",m_="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",g_=m_+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",y_=g_+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",x_=y_+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",b_=x_+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",VK=b_+" "+IK,FK={9:m_,10:g_,11:y_,12:x_,13:b_,14:VK},S_={};function PK(t){var e=S_[t]={binary:Fa(zK[t]+" "+fT),binaryOfStrings:Fa(BK[t]),nonBinary:{General_Category:Fa(fT),Script:Fa(FK[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 Ex=0,hT=[9,10,11,12,13,14];Ex<hT.length;Ex+=1){var jK=hT[Ex];PK(jK)}var Ne=Zt.prototype,sg=function(e,n){this.parent=e,this.base=n||this};sg.prototype.separatedFrom=function(e){for(var n=this;n;n=n.parent)for(var r=e;r;r=r.parent)if(n.base===r.base&&n!==r)return!0;return!1};sg.prototype.sibling=function(){return new sg(this.parent,this.base)};var Xi=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=S_[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};Xi.prototype.reset=function(e,n,r){var i=r.indexOf("v")!==-1,s=r.indexOf("u")!==-1;this.start=e|0,this.source=n+"",this.flags=r,i&&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)};Xi.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Xi.prototype.at=function(e,n){n===void 0&&(n=!1);var r=this.source,i=r.length;if(e>=i)return-1;var s=r.charCodeAt(e);if(!(n||this.switchU)||s<=55295||s>=57344||e+1>=i)return s;var o=r.charCodeAt(e+1);return o>=56320&&o<=57343?(s<<10)+o-56613888:s};Xi.prototype.nextIndex=function(e,n){n===void 0&&(n=!1);var r=this.source,i=r.length;if(e>=i)return i;var s=r.charCodeAt(e),o;return!(n||this.switchU)||s<=55295||s>=57344||e+1>=i||(o=r.charCodeAt(e+1))<56320||o>57343?e+1:e+2};Xi.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};Xi.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};Xi.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};Xi.prototype.eat=function(e,n){return n===void 0&&(n=!1),this.current(n)===e?(this.advance(n),!0):!1};Xi.prototype.eatChars=function(e,n){n===void 0&&(n=!1);for(var r=this.pos,i=0,s=e;i<s.length;i+=1){var o=s[i],u=this.at(r,n);if(u===-1||u!==o)return!1;r=this.nextIndex(r,n)}return this.pos=r,!0};Ne.validateRegExpFlags=function(t){for(var e=t.validFlags,n=t.flags,r=!1,i=!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"&&(r=!0),o==="v"&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(t.start,"Invalid regular expression flag")};function $K(t){for(var e in t)return!0;return!1}Ne.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&$K(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 r=n[e];t.groupNames[r]||t.raise("Invalid named capture referenced")}};Ne.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new sg(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 r=0,i=-1;if(this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue),t.eat(125)))return i!==-1&&i<r&&!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),r=t.eat(45);if(n||r){for(var i=0;i<n.length;i++){var s=n.charAt(i);n.indexOf(s,i+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(r){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&&UK(n);)e+=Vs(n),t.advance();return e};function UK(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 v_(e)?(t.lastIntValue=e,t.advance(),!0):!1};function v_(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&&!v_(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 r=0,i=n;r<i.length;r+=1){var s=i[r];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+=Vs(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Vs(t.lastIntValue);return!0}return!1};Ne.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,r=t.current(n);return t.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(r=t.lastIntValue),JK(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function JK(t){return Hi(t,!0)||t===36||t===95}Ne.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,r=t.current(n);return t.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(r=t.lastIntValue),qK(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function qK(t){return Ya(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&&!Zg(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 k_(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function k_(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,r=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var i=t.lastIntValue;if(r&&i>=55296&&i<=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=(i-55296)*1024+(o-56320)+65536,!0}t.pos=s,t.lastIntValue=i}return!0}if(r&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&HK(t.lastIntValue))return!0;r&&t.raise("Invalid unicode escape"),t.pos=n}return!1};function HK(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 C_=0,Fs=1,Zr=2;Ne.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(KK(e))return t.lastIntValue=-1,t.advance(),Fs;var n=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((n=e===80)||e===112)){t.lastIntValue=-1,t.advance();var r;if(t.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return n&&r===Zr&&t.raise("Invalid property name"),r;t.raise("Invalid property name")}return C_};function KK(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 r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,n,r),Fs}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,i)}return C_};Ne.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){Wu(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 Fs;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return Zr;t.raise("Invalid property name")};Ne.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";w_(e=t.current());)t.lastStringValue+=Vs(e),t.advance();return t.lastStringValue!==""};function w_(t){return k_(t)||t===95}Ne.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";GK(e=t.current());)t.lastStringValue+=Vs(e),t.advance();return t.lastStringValue!==""};function GK(t){return w_(t)||Zg(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===Zr&&t.raise("Negated character class may contain strings"),!0}return!1};Ne.regexp_classContents=function(t){return t.current()===93?Fs:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),Fs)};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||N_(n))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var r=t.current();return r!==93?(t.lastIntValue=r,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=Fs,n;if(!this.regexp_eatClassSetRange(t))if(n=this.regexp_eatClassSetOperand(t)){n===Zr&&(e=Zr);for(var r=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(n=this.regexp_eatClassSetOperand(t))){n!==Zr&&(e=Fs);continue}t.raise("Invalid character in character class")}if(r!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(r!==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===Zr&&(e=Zr)}};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 r=t.lastIntValue;return n!==-1&&r!==-1&&n>r&&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)?Fs: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),r=this.regexp_classContents(t);if(t.eat(93))return n&&r===Zr&&t.raise("Negated character class may contain strings"),r;t.pos=e}if(t.eat(92)){var i=this.regexp_eatCharacterClassEscape(t);if(i)return i;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)===Zr&&(e=Zr);return e};Ne.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?Fs:Zr};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()&&YK(n)||QK(n)?!1:(t.advance(),t.lastIntValue=n,!0)};function YK(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 QK(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 WK(e)?(t.lastIntValue=e,t.advance(),!0):!1};function WK(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 Zg(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;Zg(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e};function Zg(t){return t>=48&&t<=57}Ne.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;E_(n=t.current());)t.lastIntValue=16*t.lastIntValue+A_(n),t.advance();return t.pos!==e};function E_(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function A_(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 N_(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function N_(t){return t>=48&&t<=55}Ne.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var r=0;r<e;++r){var i=t.current();if(!E_(i))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+A_(i),t.advance()}return!0};var Nk=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Gg(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},ot=Zt.prototype;ot.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 Nk(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};ot.getToken=function(){return this.next(),new Nk(this)};typeof Symbol<"u"&&(ot[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===O.eof,value:e}}}});ot.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())};ot.readToken=function(t){return Hi(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};ot.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};ot.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 r=void 0,i=e;(r=WI(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,n),e,this.pos,t,this.curPosition())};ot.skipLineComment=function(t){for(var e=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!Qu(r);)r=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())};ot.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&&XI.test(String.fromCharCode(t)))++this.pos;else break e}}};ot.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)};ot.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))};ot.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)};ot.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,r=t===42?O.star:O.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++n,r=O.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(O.assign,n+1):this.finishOp(r,n)};ot.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)};ot.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(O.assign,2):this.finishOp(O.bitwiseXOR,1)};ot.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||cr.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)};ot.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))};ot.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)};ot.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 r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(O.assign,3)}return this.finishOp(O.coalesce,2)}}return this.finishOp(O.question,1)};ot.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Hi(e,!0)||e===92))return this.finishToken(O.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Vs(e)+"'")};ot.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 '"+Vs(t)+"'")};ot.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)};ot.readRegexp=function(){for(var t,e,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(cr.test(r)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if(r==="[")e=!0;else if(r==="]"&&e)e=!1;else if(r==="/"&&!e)break;t=r==="\\"}++this.pos}var i=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 Xi(this));u.reset(n,i,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(O.regexp,{pattern:i,flags:o,value:c})};ot.readInt=function(t,e,n){for(var r=this.options.ecmaVersion>=12&&e===void 0,i=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 d=this.input.charCodeAt(this.pos),g=void 0;if(r&&d===95){i&&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=d;continue}if(d>=97?g=d-97+10:d>=65?g=d-65+10:d>=48&&d<=57?g=d-48:g=1/0,g>=t)break;u=d,o=o*t+g}return r&&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 XK(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function T_(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}ot.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=T_(this.input.slice(e,this.pos)),++this.pos):Hi(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(O.num,n)};ot.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 r=this.input.charCodeAt(this.pos);if(!n&&!t&&this.options.ecmaVersion>=11&&r===110){var i=T_(this.input.slice(e,this.pos));return++this.pos,Hi(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(O.num,i)}n&&/[89]/.test(this.input.slice(e,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),Hi(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=XK(this.input.slice(e,this.pos),n);return this.finishToken(O.num,s)};ot.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};ot.readString=function(t){for(var e="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===t)break;r===92?(e+=this.input.slice(n,this.pos),e+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Qu(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(n,this.pos++),this.finishToken(O.string,e)};var M_={};ot.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===M_)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};ot.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw M_;this.raise(t,e)};ot.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+=`
74
+ `;break;default:t+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};ot.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]===`
75
+ `&&++this.pos;case`
76
+ `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};ot.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
77
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Vs(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 r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,e=this.input.charCodeAt(this.pos),(r!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-r.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return Qu(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};ot.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n};ot.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(Ya(i,r))this.pos+=i<=65535?1:2;else if(i===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?Hi:Ya)(o,r)||this.invalidStringToken(s,"Invalid Unicode escape"),t+=Vs(o),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)};ot.readWord=function(){var t=this.readWord1(),e=O.name;return this.keywords.test(t)&&(e=vk[t]),this.finishToken(e,t)};var ZK="8.15.0";Zt.acorn={Parser:Zt,version:ZK,defaultOptions:aS,Position:zh,SourceLocation:Gg,getLineInfo:e_,Node:Xg,TokenType:ft,tokTypes:O,keywordTypes:vk,TokContext:vi,tokContexts:It,isIdentifierChar:Ya,isIdentifierStart:Hi,Token:Nk,isNewLine:Qu,lineBreak:cr,lineBreakG:vK,nonASCIIwhitespace:XI};var Ax={exports:{}},Nx,pT;function eG(){return pT||(pT=1,Nx={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:"♦"}),Nx}var jf={exports:{}},tG=jf.exports,dT;function mT(){return dT||(dT=1,(function(t,e){(function(n,r){r(e)})(tG,(function(n){var r=[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],i=[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"},d=/^in(stanceof)?$/,g=new RegExp("["+o+"]"),y=new RegExp("["+o+s+"]");function b(p,S){for(var w=65536,T=0;T<S.length;T+=2){if(w+=S[T],w>p)return!1;if(w+=S[T+1],w>=p)return!0}return!1}function k(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,i)}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,i)||b(p,r)}var N=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 N(p,{beforeExpr:!0,binop:S})}var j={beforeExpr:!0},P={startsExpr:!0},U={};function L(p,S){return S===void 0&&(S={}),S.keyword=p,U[p]=new N(p,S)}var C={num:new N("num",P),regexp:new N("regexp",P),string:new N("string",P),name:new N("name",P),privateId:new N("privateId",P),eof:new N("eof"),bracketL:new N("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new N("]"),braceL:new N("{",{beforeExpr:!0,startsExpr:!0}),braceR:new N("}"),parenL:new N("(",{beforeExpr:!0,startsExpr:!0}),parenR:new N(")"),comma:new N(",",j),semi:new N(";",j),colon:new N(":",j),dot:new N("."),question:new N("?",j),questionDot:new N("?."),arrow:new N("=>",j),template:new N("template"),invalidTemplate:new N("invalidTemplate"),ellipsis:new N("...",j),backQuote:new N("`",P),dollarBraceL:new N("${",{beforeExpr:!0,startsExpr:!0}),eq:new N("=",{beforeExpr:!0,isAssign:!0}),assign:new N("_=",{beforeExpr:!0,isAssign:!0}),incDec:new N("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new N("!/~",{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 N("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:M("%",10),star:M("*",10),slash:M("/",10),starstar:new N("**",{beforeExpr:!0}),coalesce:M("??",1),_break:L("break"),_case:L("case",j),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",j),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",j),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",P),_if:L("if"),_return:L("return",j),_switch:L("switch"),_throw:L("throw",j),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",P),_super:L("super",P),_class:L("class",P),_extends:L("extends",j),_export:L("export"),_import:L("import",P),_null:L("null",P),_true:L("true",P),_false:L("false",P),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},z=/\r\n?|\n|\u2028|\u2029/,G=new RegExp(z.source,"g");function J(p){return p===10||p===13||p===8232||p===8233}function K(p,S,w){w===void 0&&(w=p.length);for(var T=S;T<w;T++){var B=p.charCodeAt(T);if(J(B))return T<w-1&&B===13&&p.charCodeAt(T+1)===10?T+2:T+1}return-1}var de=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ce=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Se=Object.prototype,Re=Se.hasOwnProperty,Y=Se.toString,W=Object.hasOwn||(function(p,S){return Re.call(p,S)}),ue=Array.isArray||(function(p){return Y.call(p)==="[object Array]"}),ke=Object.create(null);function ze(p){return ke[p]||(ke[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 F=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ee=function(S,w){this.line=S,this.column=w};ee.prototype.offset=function(S){return new ee(this.line,this.column+S)};var V=function(S,w,T){this.start=w,this.end=T,S.sourceFile!==null&&(this.source=S.sourceFile)};function be(p,S){for(var w=1,T=0;;){var B=K(p,T,S);if(B<0)return new ee(w,S-T);++w,T=B}}var De={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 De)S[w]=p&&W(p,w)?p[w]:De[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.
78
+ 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),ue(S.onToken)){var T=S.onToken;S.onToken=function(B){return T.push(B)}}if(ue(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,T,B,Z,ne,ge){var xe={type:w?"Block":"Line",value:T,start:B,end:Z};p.locations&&(xe.loc=new V(this,ne,ge)),p.ranges&&(xe.range=[B,Z]),S.push(xe)}}var Ze=1,zt=2,Lt=4,Oi=8,ui=16,Wn=32,dr=64,Or=128,Xn=256,mr=512,ci=1024,Rn=Ze|zt|Xn;function Rr(p,S){return zt|(p?Lt:0)|(S?Oi:0)}var Ri=0,Dr=1,$e=2,Zi=3,le=4,me=5,_=function(S,w,T){this.options=S=Xe(S),this.sourceFile=S.sourceFile,this.keywords=ze(h[S.ecmaVersion>=6?6:S.sourceType==="module"?"5module":5]);var B="";S.allowReserved!==!0&&(B=u[S.ecmaVersion>=6?6:S.ecmaVersion===5?5:3],S.sourceType==="module"&&(B+=" await")),this.reservedWords=ze(B);var Z=(B?B+" ":"")+u.strict;this.reservedWordsStrict=ze(Z),this.reservedWordsStrictBind=ze(Z+" "+u.strictBind),this.input=String(w),this.containsEsc=!1,T?(this.pos=T,this.lineStart=this.input.lastIndexOf(`
79
+ `,T-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(z).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:Ze),this.regexpState=null,this.privateNameStack=[]},Ie={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}};_.prototype.parse=function(){var S=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(S)},Ie.inFunction.get=function(){return(this.currentVarScope().flags&zt)>0},Ie.inGenerator.get=function(){return(this.currentVarScope().flags&Oi)>0},Ie.inAsync.get=function(){return(this.currentVarScope().flags&Lt)>0},Ie.canAwait.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],w=S.flags;if(w&(Xn|mr))return!1;if(w&zt)return(w&Lt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Ie.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Ze)},Ie.allowSuper.get=function(){var p=this.currentThisScope(),S=p.flags;return(S&dr)>0||this.options.allowSuperOutsideMethod},Ie.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Or)>0},Ie.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Ie.allowNewDotTarget.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],w=S.flags;if(w&(Xn|mr)||w&zt&&!(w&ui))return!0}return!1},Ie.allowUsing.get=function(){var p=this.currentScope(),S=p.flags;return!(S&ci||!this.inModule&&S&Ze)},Ie.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Xn)>0},_.extend=function(){for(var S=[],w=arguments.length;w--;)S[w]=arguments[w];for(var T=this,B=0;B<S.length;B++)T=S[B](T);return T},_.parse=function(S,w){return new this(w,S).parse()},_.parseExpressionAt=function(S,w,T){var B=new this(T,S,w);return B.nextToken(),B.parseExpression()},_.tokenizer=function(S,w){return new this(w,S)},Object.defineProperties(_.prototype,Ie);var Pe=_.prototype,tn=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Pe.strictDirective=function(p){if(this.options.ecmaVersion<5)return!1;for(;;){ce.lastIndex=p,p+=ce.exec(this.input)[0].length;var S=tn.exec(this.input.slice(p));if(!S)return!1;if((S[1]||S[2])==="use strict"){ce.lastIndex=p+S[0].length;var w=ce.exec(this.input),T=w.index+w[0].length,B=this.input.charAt(T);return B===";"||B==="}"||z.test(w[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(B)||B==="!"&&this.input.charAt(T+1)==="=")}p+=S[0].length,ce.lastIndex=p,p+=ce.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||z.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 Zn=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,T=p.doubleProto;if(!S)return w>=0||T>=0;w>=0&&this.raise(w,"Shorthand property assignments are valid only in destructuring patterns"),T>=0&&this.raiseRecoverable(T,"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 ve=_.prototype;ve.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 T=0,B=Object.keys(this.undefinedExports);T<B.length;T+=1){var Z=B[T];this.raiseRecoverable(this.undefinedExports[Z].start,"Export '"+Z+"' 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"},yn={kind:"switch"};ve.isLet=function(p){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ce.lastIndex=this.pos;var S=ce.exec(this.input),w=this.pos+S[0].length,T=this.fullCharCodeAt(w);if(T===91||T===92)return!0;if(p)return!1;if(T===123)return!0;if(k(T)){var B=w;do w+=T<=65535?1:2;while(E(T=this.fullCharCodeAt(w)));if(T===92)return!0;var Z=this.input.slice(B,w);if(!d.test(Z))return!0}return!1},ve.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ce.lastIndex=this.pos;var p=ce.exec(this.input),S=this.pos+p[0].length,w;return!z.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))},ve.isUsingKeyword=function(p,S){if(this.options.ecmaVersion<17||!this.isContextual(p?"await":"using"))return!1;ce.lastIndex=this.pos;var w=ce.exec(this.input),T=this.pos+w[0].length;if(z.test(this.input.slice(this.pos,T)))return!1;if(p){var B=T+5,Z;if(this.input.slice(T,B)!=="using"||B===this.input.length||E(Z=this.fullCharCodeAt(B))||Z===92)return!1;ce.lastIndex=B;var ne=ce.exec(this.input);if(T=B+ne[0].length,ne&&z.test(this.input.slice(B,T)))return!1}var ge=this.fullCharCodeAt(T);if(!k(ge)&&ge!==92)return!1;var xe=T;do T+=ge<=65535?1:2;while(E(ge=this.fullCharCodeAt(T)));if(ge===92)return!0;var Le=this.input.slice(xe,T);return!(d.test(Le)||S&&Le==="of")},ve.isAwaitUsing=function(p){return this.isUsingKeyword(!0,p)},ve.isUsing=function(p){return this.isUsingKeyword(!1,p)},ve.parseStatement=function(p,S,w){var T=this.type,B=this.startNode(),Z;switch(this.isLet(p)&&(T=C._var,Z="let"),T){case C._break:case C._continue:return this.parseBreakContinueStatement(B,T.keyword);case C._debugger:return this.parseDebuggerStatement(B);case C._do:return this.parseDoStatement(B);case C._for:return this.parseForStatement(B);case C._function:return p&&(this.strict||p!=="if"&&p!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(B,!1,!p);case C._class:return p&&this.unexpected(),this.parseClass(B,!0);case C._if:return this.parseIfStatement(B);case C._return:return this.parseReturnStatement(B);case C._switch:return this.parseSwitchStatement(B);case C._throw:return this.parseThrowStatement(B);case C._try:return this.parseTryStatement(B);case C._const:case C._var:return Z=Z||this.value,p&&Z!=="var"&&this.unexpected(),this.parseVarStatement(B,Z);case C._while:return this.parseWhileStatement(B);case C._with:return this.parseWithStatement(B);case C.braceL:return this.parseBlock(!0,B);case C.semi:return this.parseEmptyStatement(B);case C._export:case C._import:if(this.options.ecmaVersion>10&&T===C._import){ce.lastIndex=this.pos;var ne=ce.exec(this.input),ge=this.pos+ne[0].length,xe=this.input.charCodeAt(ge);if(xe===40||xe===46)return this.parseExpressionStatement(B,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'")),T===C._import?this.parseImport(B):this.parseExport(B,w);default:if(this.isAsyncFunction())return p&&this.unexpected(),this.next(),this.parseFunctionStatement(B,!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(B,!1,Le),this.semicolon(),this.finishNode(B,"VariableDeclaration");var Ge=this.value,yt=this.parseExpression();return T===C.name&&yt.type==="Identifier"&&this.eat(C.colon)?this.parseLabeledStatement(B,Ge,yt,p):this.parseExpressionStatement(B,yt)}},ve.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 T=0;T<this.labels.length;++T){var B=this.labels[T];if((p.label==null||B.name===p.label.name)&&(B.kind!=null&&(w||B.kind==="loop")||p.label&&w))break}return T===this.labels.length&&this.raise(p.start,"Unsyntactic "+S),this.finishNode(p,w?"BreakStatement":"ContinueStatement")},ve.parseDebuggerStatement=function(p){return this.next(),this.semicolon(),this.finishNode(p,"DebuggerStatement")},ve.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")},ve.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 T=this.startNode(),B=w?"let":this.value;return this.next(),this.parseVar(T,!0,B),this.finishNode(T,"VariableDeclaration"),this.parseForAfterInit(p,T,S)}var Z=this.isContextual("let"),ne=!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,Ge=new Zn,yt=this.start,Ft=S>-1?this.parseExprSubscripts(Ge,"await"):this.parseExpression(!0,Ge);return this.type===C._in||(ne=this.options.ecmaVersion>=6&&this.isContextual("of"))?(S>-1?(this.type===C._in&&this.unexpected(S),p.await=!0):ne&&this.options.ecmaVersion>=8&&(Ft.start===yt&&!Le&&Ft.type==="Identifier"&&Ft.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(p.await=!1)),Z&&ne&&this.raise(Ft.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Ft,!1,Ge),this.checkLValPattern(Ft),this.parseForIn(p,Ft)):(this.checkExpressionErrors(Ge,!0),S>-1&&this.unexpected(S),this.parseFor(p,Ft))},ve.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))},ve.parseFunctionStatement=function(p,S,w){return this.next(),this.parseFunction(p,er|(w?0:Dn),!1,S)},ve.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")},ve.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")},ve.parseSwitchStatement=function(p){this.next(),p.discriminant=this.parseParenExpression(),p.cases=[],this.expect(C.braceL),this.labels.push(yn),this.enterScope(ci);for(var S,w=!1;this.type!==C.braceR;)if(this.type===C._case||this.type===C._default){var T=this.type===C._case;S&&this.finishNode(S,"SwitchCase"),p.cases.push(S=this.startNode()),S.consequent=[],this.next(),T?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")},ve.parseThrowStatement=function(p){return this.next(),z.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=[];ve.parseCatchClauseParam=function(){var p=this.parseBindingAtom(),S=p.type==="Identifier";return this.enterScope(S?Wn:0),this.checkLValPattern(p,S?le:$e),this.expect(C.parenR),p},ve.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")},ve.parseVarStatement=function(p,S,w){return this.next(),this.parseVar(p,!1,S,w),this.semicolon(),this.finishNode(p,"VariableDeclaration")},ve.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")},ve.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")},ve.parseEmptyStatement=function(p){return this.next(),this.finishNode(p,"EmptyStatement")},ve.parseLabeledStatement=function(p,S,w,T){for(var B=0,Z=this.labels;B<Z.length;B+=1){var ne=Z[B];ne.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(T?T.indexOf("label")===-1?T+"label":T:"label"),this.labels.pop(),p.label=w,this.finishNode(p,"LabeledStatement")},ve.parseExpressionStatement=function(p,S){return p.expression=S,this.semicolon(),this.finishNode(p,"ExpressionStatement")},ve.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 T=this.parseStatement(null);S.body.push(T)}return w&&(this.strict=!1),this.next(),p&&this.exitScope(),this.finishNode(S,"BlockStatement")},ve.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")},ve.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")},ve.parseVar=function(p,S,w,T){for(p.declarations=[],p.kind=w;;){var B=this.startNode();if(this.parseVarId(B,w),this.eat(C.eq)?B.init=this.parseMaybeAssign(S):!T&&w==="const"&&!(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!T&&(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"):!T&&B.id.type!=="Identifier"&&!(S&&(this.type===C._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):B.init=null,p.declarations.push(this.finishNode(B,"VariableDeclarator")),!this.eat(C.comma))break}return p},ve.parseVarId=function(p,S){p.id=S==="using"||S==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(p.id,S==="var"?Dr:$e,!1)};var er=1,Dn=2,mp=4;ve.parseFunction=function(p,S,w,T,B){this.initFunction(p),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!T)&&(this.type===C.star&&S&Dn&&this.unexpected(),p.generator=this.eat(C.star)),this.options.ecmaVersion>=8&&(p.async=!!T),S&er&&(p.id=S&mp&&this.type!==C.name?null:this.parseIdent(),p.id&&!(S&Dn)&&this.checkLValSimple(p.id,this.strict||p.generator||p.async?this.treatFunctionsAsVar?Dr:$e:Zi));var Z=this.yieldPos,ne=this.awaitPos,ge=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Rr(p.async,p.generator)),S&er||(p.id=this.type===C.name?this.parseIdent():null),this.parseFunctionParams(p),this.parseFunctionBody(p,w,!1,B),this.yieldPos=Z,this.awaitPos=ne,this.awaitIdentPos=ge,this.finishNode(p,S&er?"FunctionDeclaration":"FunctionExpression")},ve.parseFunctionParams=function(p){this.expect(C.parenL),p.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},ve.parseClass=function(p,S){this.next();var w=this.strict;this.strict=!0,this.parseClassId(p,S),this.parseClassSuper(p);var T=this.enterClassBody(),B=this.startNode(),Z=!1;for(B.body=[],this.expect(C.braceL);this.type!==C.braceR;){var ne=this.parseClassElement(p.superClass!==null);ne&&(B.body.push(ne),ne.type==="MethodDefinition"&&ne.kind==="constructor"?(Z&&this.raiseRecoverable(ne.start,"Duplicate constructor in the same class"),Z=!0):ne.key&&ne.key.type==="PrivateIdentifier"&&kl(T,ne)&&this.raiseRecoverable(ne.key.start,"Identifier '#"+ne.key.name+"' has already been declared"))}return this.strict=w,this.next(),p.body=this.finishNode(B,"ClassBody"),this.exitClassBody(),this.finishNode(p,S?"ClassDeclaration":"ClassExpression")},ve.parseClassElement=function(p){if(this.eat(C.semi))return null;var S=this.options.ecmaVersion,w=this.startNode(),T="",B=!1,Z=!1,ne="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:T="static"}if(w.static=ge,!T&&S>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===C.star)&&!this.canInsertSemicolon()?Z=!0:T="async"),!T&&(S>=9||!Z)&&this.eat(C.star)&&(B=!0),!T&&!Z&&!B){var xe=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ne=xe:T=xe)}if(T?(w.computed=!1,w.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),w.key.name=T,this.finishNode(w.key,"Identifier")):this.parseClassElementName(w),S<13||this.type===C.parenL||ne!=="method"||B||Z){var Le=!w.static&&es(w,"constructor"),Ge=Le&&p;Le&&ne!=="method"&&this.raise(w.key.start,"Constructor can't have get/set modifier"),w.kind=Le?"constructor":ne,this.parseClassMethod(w,B,Z,Ge)}else this.parseClassField(w);return w},ve.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},ve.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)},ve.parseClassMethod=function(p,S,w,T){var B=p.key;p.kind==="constructor"?(S&&this.raise(B.start,"Constructor can't be a generator"),w&&this.raise(B.start,"Constructor can't be an async method")):p.static&&es(p,"prototype")&&this.raise(B.start,"Classes may not have a static property named prototype");var Z=p.value=this.parseMethod(S,w,T);return p.kind==="get"&&Z.params.length!==0&&this.raiseRecoverable(Z.start,"getter should have no params"),p.kind==="set"&&Z.params.length!==1&&this.raiseRecoverable(Z.start,"setter should have exactly one param"),p.kind==="set"&&Z.params[0].type==="RestElement"&&this.raiseRecoverable(Z.params[0].start,"Setter cannot use rest params"),this.finishNode(p,"MethodDefinition")},ve.parseClassField=function(p){return es(p,"constructor")?this.raise(p.key.start,"Classes can't have a field named 'constructor'"):p.static&&es(p,"prototype")&&this.raise(p.key.start,"Classes can't have a static field named 'prototype'"),this.eat(C.eq)?(this.enterScope(mr|dr),p.value=this.parseMaybeAssign(),this.exitScope()):p.value=null,this.semicolon(),this.finishNode(p,"PropertyDefinition")},ve.parseClassStaticBlock=function(p){p.body=[];var S=this.labels;for(this.labels=[],this.enterScope(Xn|dr);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")},ve.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)},ve.parseClassSuper=function(p){p.superClass=this.eat(C._extends)?this.parseExprSubscripts(null,!1):null},ve.enterClassBody=function(){var p={declared:Object.create(null),used:[]};return this.privateNameStack.push(p),p.declared},ve.exitClassBody=function(){var p=this.privateNameStack.pop(),S=p.declared,w=p.used;if(this.options.checkPrivateFields)for(var T=this.privateNameStack.length,B=T===0?null:this.privateNameStack[T-1],Z=0;Z<w.length;++Z){var ne=w[Z];W(S,ne.name)||(B?B.used.push(ne):this.raiseRecoverable(ne.start,"Private field '#"+ne.name+"' must be declared in an enclosing class"))}};function kl(p,S){var w=S.key.name,T=p[w],B="true";return S.type==="MethodDefinition"&&(S.kind==="get"||S.kind==="set")&&(B=(S.static?"s":"i")+S.kind),T==="iget"&&B==="iset"||T==="iset"&&B==="iget"||T==="sget"&&B==="sset"||T==="sset"&&B==="sget"?(p[w]="true",!1):T?!0:(p[w]=B,!1)}function es(p,S){var w=p.computed,T=p.key;return!w&&(T.type==="Identifier"&&T.name===S||T.type==="Literal"&&T.value===S)}ve.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")},ve.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,T=p.specifiers;w<T.length;w+=1){var B=T[w];this.checkUnreserved(B.local),this.checkLocalExport(B.local),B.local.type==="Literal"&&this.raise(B.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")},ve.parseExportDeclaration=function(p){return this.parseStatement(null)},ve.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,er|mp,!1,p)}else if(this.type===C._class){var w=this.startNode();return this.parseClass(w,"nullableID")}else{var T=this.parseMaybeAssign();return this.semicolon(),T}},ve.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)},ve.checkPatternExport=function(p,S){var w=S.type;if(w==="Identifier")this.checkExport(p,S,S.start);else if(w==="ObjectPattern")for(var T=0,B=S.properties;T<B.length;T+=1){var Z=B[T];this.checkPatternExport(p,Z)}else if(w==="ArrayPattern")for(var ne=0,ge=S.elements;ne<ge.length;ne+=1){var xe=ge[ne];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)},ve.checkVariableExport=function(p,S){if(p)for(var w=0,T=S;w<T.length;w+=1){var B=T[w];this.checkPatternExport(p,B.id)}},ve.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},ve.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")},ve.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},ve.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")},ve.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")},ve.parseImportDefaultSpecifier=function(){var p=this.startNode();return p.local=this.parseIdent(),this.checkLValSimple(p.local,$e),this.finishNode(p,"ImportDefaultSpecifier")},ve.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")},ve.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},ve.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 T=this.parseImportAttribute(),B=T.key.type==="Identifier"?T.key.name:T.key.value;W(S,B)&&this.raiseRecoverable(T.key.start,"Duplicate attribute key '"+B+"'"),S[B]=!0,p.push(T)}return p},ve.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")},ve.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===C.string){var p=this.parseLiteral(this.value);return F.test(p.value)&&this.raise(p.start,"An export name cannot include a lone surrogate."),p}return this.parseIdent(!0)},ve.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)},ve.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 an=_.prototype;an.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 T=0,B=p.properties;T<B.length;T+=1){var Z=B[T];this.toAssignable(Z,S),Z.type==="RestElement"&&(Z.argument.type==="ArrayPattern"||Z.argument.type==="ObjectPattern")&&this.raise(Z.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},an.toAssignableList=function(p,S){for(var w=p.length,T=0;T<w;T++){var B=p[T];B&&this.toAssignable(B,S)}if(w){var Z=p[w-1];this.options.ecmaVersion===6&&S&&Z&&Z.type==="RestElement"&&Z.argument.type!=="Identifier"&&this.unexpected(Z.argument.start)}return p},an.parseSpread=function(p){var S=this.startNode();return this.next(),S.argument=this.parseMaybeAssign(!1,p),this.finishNode(S,"SpreadElement")},an.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")},an.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()},an.parseBindingList=function(p,S,w,T){for(var B=[],Z=!0;!this.eat(p);)if(Z?Z=!1:this.expect(C.comma),S&&this.type===C.comma)B.push(null);else{if(w&&this.afterTrailingComma(p))break;if(this.type===C.ellipsis){var ne=this.parseRestBinding();this.parseBindingListItem(ne),B.push(ne),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(p);break}else B.push(this.parseAssignableListItem(T))}return B},an.parseAssignableListItem=function(p){var S=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(S),S},an.parseBindingListItem=function(p){return p},an.parseMaybeDefault=function(p,S,w){if(w=w||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(C.eq))return w;var T=this.startNodeAt(p,S);return T.left=w,T.right=this.parseMaybeAssign(),this.finishNode(T,"AssignmentPattern")},an.checkLValSimple=function(p,S,w){S===void 0&&(S=Ri);var T=S!==Ri;switch(p.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(p.name)&&this.raiseRecoverable(p.start,(T?"Binding ":"Assigning to ")+p.name+" in strict mode"),T&&(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":T&&this.raiseRecoverable(p.start,"Binding member expression");break;case"ParenthesizedExpression":return T&&this.raiseRecoverable(p.start,"Binding parenthesized expression"),this.checkLValSimple(p.expression,S,w);default:this.raise(p.start,(T?"Binding":"Assigning to")+" rvalue")}},an.checkLValPattern=function(p,S,w){switch(S===void 0&&(S=Ri),p.type){case"ObjectPattern":for(var T=0,B=p.properties;T<B.length;T+=1){var Z=B[T];this.checkLValInnerPattern(Z,S,w)}break;case"ArrayPattern":for(var ne=0,ge=p.elements;ne<ge.length;ne+=1){var xe=ge[ne];xe&&this.checkLValInnerPattern(xe,S,w)}break;default:this.checkLValSimple(p,S,w)}},an.checkLValInnerPattern=function(p,S,w){switch(S===void 0&&(S=Ri),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,T,B,Z){this.token=S,this.isExpr=!!w,this.preserveSpace=!!T,this.override=B,this.generator=!!Z},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)},Ir=_.prototype;Ir.initialContext=function(){return[gt.b_stat]},Ir.curContext=function(){return this.context[this.context.length-1]},Ir.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?z.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},Ir.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},Ir.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},Ir.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&&z.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=_.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 T=p.key,B;switch(T.type){case"Identifier":B=T.name;break;case"Literal":B=String(T.value);break;default:return}var Z=p.kind;if(this.options.ecmaVersion>=6){B==="__proto__"&&Z==="init"&&(S.proto&&(w?w.doubleProto<0&&(w.doubleProto=T.start):this.raiseRecoverable(T.start,"Redefinition of __proto__ property")),S.proto=!0);return}B="$"+B;var ne=S[B];if(ne){var ge;Z==="init"?ge=this.strict&&ne.init||ne.get||ne.set:ge=ne.init||ne[Z],ge&&this.raiseRecoverable(T.start,"Redefinition of property")}else ne=S[B]={init:!1,get:!1,set:!1};ne[Z]=!0}},je.parseExpression=function(p,S){var w=this.start,T=this.startLoc,B=this.parseMaybeAssign(p,S);if(this.type===C.comma){var Z=this.startNodeAt(w,T);for(Z.expressions=[B];this.eat(C.comma);)Z.expressions.push(this.parseMaybeAssign(p,S));return this.finishNode(Z,"SequenceExpression")}return B},je.parseMaybeAssign=function(p,S,w){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(p);this.exprAllowed=!1}var T=!1,B=-1,Z=-1,ne=-1;S?(B=S.parenthesizedAssign,Z=S.trailingComma,ne=S.doubleProto,S.parenthesizedAssign=S.trailingComma=-1):(S=new Zn,T=!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 Ge=this.startNodeAt(ge,xe);return Ge.operator=this.value,this.type===C.eq&&(Le=this.toAssignable(Le,!1,S)),T||(S.parenthesizedAssign=S.trailingComma=S.doubleProto=-1),S.shorthandAssign>=Le.start&&(S.shorthandAssign=-1),this.type===C.eq?this.checkLValPattern(Le):this.checkLValSimple(Le),Ge.left=Le,this.next(),Ge.right=this.parseMaybeAssign(p),ne>-1&&(S.doubleProto=ne),this.finishNode(Ge,"AssignmentExpression")}else T&&this.checkExpressionErrors(S,!0);return B>-1&&(S.parenthesizedAssign=B),Z>-1&&(S.trailingComma=Z),Le},je.parseMaybeConditional=function(p,S){var w=this.start,T=this.startLoc,B=this.parseExprOps(p,S);if(this.checkExpressionErrors(S))return B;if(this.eat(C.question)){var Z=this.startNodeAt(w,T);return Z.test=B,Z.consequent=this.parseMaybeAssign(),this.expect(C.colon),Z.alternate=this.parseMaybeAssign(p),this.finishNode(Z,"ConditionalExpression")}return B},je.parseExprOps=function(p,S){var w=this.start,T=this.startLoc,B=this.parseMaybeUnary(S,!1,!1,p);return this.checkExpressionErrors(S)||B.start===w&&B.type==="ArrowFunctionExpression"?B:this.parseExprOp(B,w,T,-1,p)},je.parseExprOp=function(p,S,w,T,B){var Z=this.type.binop;if(Z!=null&&(!B||this.type!==C._in)&&Z>T){var ne=this.type===C.logicalOR||this.type===C.logicalAND,ge=this.type===C.coalesce;ge&&(Z=C.logicalAND.binop);var xe=this.value;this.next();var Le=this.start,Ge=this.startLoc,yt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,B),Le,Ge,Z,B),Ft=this.buildBinary(S,w,p,yt,xe,ne||ge);return(ne&&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,T,B)}return p},je.buildBinary=function(p,S,w,T,B,Z){T.type==="PrivateIdentifier"&&this.raise(T.start,"Private identifier can only be left side of binary expression");var ne=this.startNodeAt(p,S);return ne.left=w,ne.operator=B,ne.right=T,this.finishNode(ne,Z?"LogicalExpression":"BinaryExpression")},je.parseMaybeUnary=function(p,S,w,T){var B=this.start,Z=this.startLoc,ne;if(this.isContextual("await")&&this.canAwait)ne=this.parseAwait(T),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,T),this.checkExpressionErrors(p,!0),xe?this.checkLValSimple(ge.argument):this.strict&&ge.operator==="delete"&&ec(ge.argument)?this.raiseRecoverable(ge.start,"Deleting local variable in strict mode"):ge.operator==="delete"&&io(ge.argument)?this.raiseRecoverable(ge.start,"Private fields can not be deleted"):S=!0,ne=this.finishNode(ge,xe?"UpdateExpression":"UnaryExpression")}else if(!S&&this.type===C.privateId)(T||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),ne=this.parsePrivateIdent(),this.type!==C._in&&this.unexpected();else{if(ne=this.parseExprSubscripts(p,T),this.checkExpressionErrors(p))return ne;for(;this.type.postfix&&!this.canInsertSemicolon();){var Le=this.startNodeAt(B,Z);Le.operator=this.value,Le.prefix=!1,Le.argument=ne,this.checkLValSimple(ne),this.next(),ne=this.finishNode(Le,"UpdateExpression")}}if(!w&&this.eat(C.starstar))if(S)this.unexpected(this.lastTokStart);else return this.buildBinary(B,Z,ne,this.parseMaybeUnary(null,!1,!1,T),"**",!1);else return ne};function ec(p){return p.type==="Identifier"||p.type==="ParenthesizedExpression"&&ec(p.expression)}function io(p){return p.type==="MemberExpression"&&p.property.type==="PrivateIdentifier"||p.type==="ChainExpression"&&io(p.expression)||p.type==="ParenthesizedExpression"&&io(p.expression)}je.parseExprSubscripts=function(p,S){var w=this.start,T=this.startLoc,B=this.parseExprAtom(p,S);if(B.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return B;var Z=this.parseSubscripts(B,w,T,!1,S);return p&&Z.type==="MemberExpression"&&(p.parenthesizedAssign>=Z.start&&(p.parenthesizedAssign=-1),p.parenthesizedBind>=Z.start&&(p.parenthesizedBind=-1),p.trailingComma>=Z.start&&(p.trailingComma=-1)),Z},je.parseSubscripts=function(p,S,w,T,B){for(var Z=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,ne=!1;;){var ge=this.parseSubscript(p,S,w,T,Z,ne,B);if(ge.optional&&(ne=!0),ge===p||ge.type==="ArrowFunctionExpression"){if(ne){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,T){return this.parseArrowExpression(this.startNodeAt(p,S),w,!0,T)},je.parseSubscript=function(p,S,w,T,B,Z,ne){var ge=this.options.ecmaVersion>=11,xe=ge&&this.eat(C.questionDot);T&&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 Ge=this.startNodeAt(S,w);Ge.object=p,Le?(Ge.property=this.parseExpression(),this.expect(C.bracketR)):this.type===C.privateId&&p.type!=="Super"?Ge.property=this.parsePrivateIdent():Ge.property=this.parseIdent(this.options.allowReserved!=="never"),Ge.computed=!!Le,ge&&(Ge.optional=xe),p=this.finishNode(Ge,"MemberExpression")}else if(!T&&this.eat(C.parenL)){var yt=new Zn,Ft=this.yieldPos,ta=this.awaitPos,Pt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var zr=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1,yt);if(B&&!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=ta,this.awaitIdentPos=Pt,this.parseSubscriptAsyncArrow(S,w,zr,ne);this.checkExpressionErrors(yt,!0),this.yieldPos=Ft||this.yieldPos,this.awaitPos=ta||this.awaitPos,this.awaitIdentPos=Pt||this.awaitIdentPos;var gi=this.startNodeAt(S,w);gi.callee=p,gi.arguments=zr,ge&&(gi.optional=xe),p=this.finishNode(gi,"CallExpression")}else if(this.type===C.backQuote){(xe||Z)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Lr=this.startNodeAt(S,w);Lr.tag=p,Lr.quasi=this.parseTemplate({isTagged:!0}),p=this.finishNode(Lr,"TaggedTemplateExpression")}return p},je.parseExprAtom=function(p,S,w){this.type===C.slash&&this.readRegexp();var T,B=this.potentialArrowAt===this.start;switch(this.type){case C._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),T=this.startNode(),this.next(),this.type===C.parenL&&!this.allowDirectSuper&&this.raise(T.start,"super() call outside constructor of a subclass"),this.type!==C.dot&&this.type!==C.bracketL&&this.type!==C.parenL&&this.unexpected(),this.finishNode(T,"Super");case C._this:return T=this.startNode(),this.next(),this.finishNode(T,"ThisExpression");case C.name:var Z=this.start,ne=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(Z,ne),0,!1,!0,S);if(B&&!this.canInsertSemicolon()){if(this.eat(C.arrow))return this.parseArrowExpression(this.startNodeAt(Z,ne),[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(Z,ne),[xe],!0,S)}return xe;case C.regexp:var Le=this.value;return T=this.parseLiteral(Le.value),T.regex={pattern:Le.pattern,flags:Le.flags},T;case C.num:case C.string:return this.parseLiteral(this.value);case C._null:case C._true:case C._false:return T=this.startNode(),T.value=this.type===C._null?null:this.type===C._true,T.raw=this.type.keyword,this.next(),this.finishNode(T,"Literal");case C.parenL:var Ge=this.start,yt=this.parseParenAndDistinguishExpression(B,S);return p&&(p.parenthesizedAssign<0&&!this.isSimpleAssignTarget(yt)&&(p.parenthesizedAssign=Ge),p.parenthesizedBind<0&&(p.parenthesizedBind=Ge)),yt;case C.bracketL:return T=this.startNode(),this.next(),T.elements=this.parseExprList(C.bracketR,!0,!0,p),this.finishNode(T,"ArrayExpression");case C.braceL:return this.overrideContext(gt.b_expr),this.parseObj(!1,p);case C._function:return T=this.startNode(),this.next(),this.parseFunction(T,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,T=this.startLoc,B,Z=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ne=this.start,ge=this.startLoc,xe=[],Le=!0,Ge=!1,yt=new Zn,Ft=this.yieldPos,ta=this.awaitPos,Pt;for(this.yieldPos=0,this.awaitPos=0;this.type!==C.parenR;)if(Le?Le=!1:this.expect(C.comma),Z&&this.afterTrailingComma(C.parenR,!0)){Ge=!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 zr=this.lastTokEnd,gi=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=ta,this.parseParenArrowList(w,T,xe,S);(!xe.length||Ge)&&this.unexpected(this.lastTokStart),Pt&&this.unexpected(Pt),this.checkExpressionErrors(yt,!0),this.yieldPos=Ft||this.yieldPos,this.awaitPos=ta||this.awaitPos,xe.length>1?(B=this.startNodeAt(ne,ge),B.expressions=xe,this.finishNodeAt(B,"SequenceExpression",zr,gi)):B=xe[0]}else B=this.parseParenExpression();if(this.options.preserveParens){var Lr=this.startNodeAt(w,T);return Lr.expression=B,this.finishNode(Lr,"ParenthesizedExpression")}else return B},je.parseParenItem=function(p){return p},je.parseParenArrowList=function(p,S,w,T){return this.parseArrowExpression(this.startNodeAt(p,S),w,!1,T)};var so=[];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 T=this.start,B=this.startLoc;return p.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),T,B,!0,!1),this.eat(C.parenL)?p.arguments=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1):p.arguments=so,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,`
80
+ `),cooked:null}):w.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
81
+ `),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 T=this.parseTemplateElement({isTagged:S});for(w.quasis=[T];!T.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(T=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)&&!z.test(this.input.slice(this.lastTokEnd,this.start))},je.parseObj=function(p,S){var w=this.startNode(),T=!0,B={};for(w.properties=[],this.next();!this.eat(C.braceR);){if(T)T=!1;else if(this.expect(C.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(C.braceR))break;var Z=this.parseProperty(p,S);p||this.checkPropClash(Z,B,S),w.properties.push(Z)}return this.finishNode(w,p?"ObjectPattern":"ObjectExpression")},je.parseProperty=function(p,S){var w=this.startNode(),T,B,Z,ne;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)&&(Z=this.start,ne=this.startLoc),p||(T=this.eat(C.star)));var ge=this.containsEsc;return this.parsePropertyName(w),!p&&!ge&&this.options.ecmaVersion>=8&&!T&&this.isAsyncProp(w)?(B=!0,T=this.options.ecmaVersion>=9&&this.eat(C.star),this.parsePropertyName(w)):B=!1,this.parsePropertyValue(w,p,T,B,Z,ne,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 T=p.value.start;p.kind==="get"?this.raiseRecoverable(T,"getter should have no params"):this.raiseRecoverable(T,"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,T,B,Z,ne,ge){(w||T)&&this.type===C.colon&&this.unexpected(),this.eat(C.colon)?(p.value=S?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,ne),p.kind="init"):this.options.ecmaVersion>=6&&this.type===C.parenL?(S&&this.unexpected(),p.method=!0,p.value=this.parseMethod(w,T),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||T)&&this.unexpected(),this.parseGetterSetter(p)):this.options.ecmaVersion>=6&&!p.computed&&p.key.type==="Identifier"?((w||T)&&this.unexpected(),this.checkUnreserved(p.key),p.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=B),S?p.value=this.parseMaybeDefault(B,Z,this.copyNode(p.key)):this.type===C.eq&&ne?(ne.shorthandAssign<0&&(ne.shorthandAssign=this.start),p.value=this.parseMaybeDefault(B,Z,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 T=this.startNode(),B=this.yieldPos,Z=this.awaitPos,ne=this.awaitIdentPos;return this.initFunction(T),this.options.ecmaVersion>=6&&(T.generator=p),this.options.ecmaVersion>=8&&(T.async=!!S),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Rr(S,T.generator)|dr|(w?Or:0)),this.expect(C.parenL),T.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(T,!1,!0,!1),this.yieldPos=B,this.awaitPos=Z,this.awaitIdentPos=ne,this.finishNode(T,"FunctionExpression")},je.parseArrowExpression=function(p,S,w,T){var B=this.yieldPos,Z=this.awaitPos,ne=this.awaitIdentPos;return this.enterScope(Rr(w,!1)|ui),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,T),this.yieldPos=B,this.awaitPos=Z,this.awaitIdentPos=ne,this.finishNode(p,"ArrowFunctionExpression")},je.parseFunctionBody=function(p,S,w,T){var B=S&&this.type!==C.braceL,Z=this.strict,ne=!1;if(B)p.body=this.parseMaybeAssign(T),p.expression=!0,this.checkParams(p,!1);else{var ge=this.options.ecmaVersion>=7&&!this.isSimpleParamList(p.params);(!Z||ge)&&(ne=this.strictDirective(this.end),ne&&ge&&this.raiseRecoverable(p.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var xe=this.labels;this.labels=[],ne&&(this.strict=!0),this.checkParams(p,!Z&&!ne&&!S&&!w&&this.isSimpleParamList(p.params)),this.strict&&p.id&&this.checkLValSimple(p.id,me),p.body=this.parseBlock(!1,void 0,ne&&!Z),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 T=w[S];if(T.type!=="Identifier")return!1}return!0},je.checkParams=function(p,S){for(var w=Object.create(null),T=0,B=p.params;T<B.length;T+=1){var Z=B[T];this.checkLValInnerPattern(Z,Dr,S?null:w)}},je.parseExprList=function(p,S,w,T){for(var B=[],Z=!0;!this.eat(p);){if(Z)Z=!1;else if(this.expect(C.comma),S&&this.afterTrailingComma(p))break;var ne=void 0;w&&this.type===C.comma?ne=null:this.type===C.ellipsis?(ne=this.parseSpread(T),T&&this.type===C.comma&&T.trailingComma<0&&(T.trailingComma=this.start)):ne=this.parseMaybeAssign(!1,T),B.push(ne)}return B},je.checkUnreserved=function(p){var S=p.start,w=p.end,T=p.name;if(this.inGenerator&&T==="yield"&&this.raiseRecoverable(S,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&T==="await"&&this.raiseRecoverable(S,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Rn)&&T==="arguments"&&this.raiseRecoverable(S,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(T==="arguments"||T==="await")&&this.raise(S,"Cannot use "+T+" in class static initialization block"),this.keywords.test(T)&&this.raise(S,"Unexpected keyword '"+T+"'"),!(this.options.ecmaVersion<6&&this.input.slice(S,w).indexOf("\\")!==-1)){var B=this.strict?this.reservedWordsStrict:this.reservedWords;B.test(T)&&(!this.inAsync&&T==="await"&&this.raiseRecoverable(S,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(S,"The keyword '"+T+"' 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 Cl=_.prototype;Cl.raise=function(p,S){var w=be(this.input,p);S+=" ("+w.line+":"+w.column+")",this.sourceFile&&(S+=" in "+this.sourceFile);var T=new SyntaxError(S);throw T.pos=p,T.loc=w,T.raisedAt=this.pos,T},Cl.raiseRecoverable=Cl.raise,Cl.curPosition=function(){if(this.options.locations)return new ee(this.curLine,this.pos-this.lineStart)};var fi=_.prototype,gp=function(S){this.flags=S,this.var=[],this.lexical=[],this.functions=[]};fi.enterScope=function(p){this.scopeStack.push(new gp(p))},fi.exitScope=function(){this.scopeStack.pop()},fi.treatFunctionsAsVarInScope=function(p){return p.flags&zt||!this.inModule&&p.flags&Ze},fi.declareName=function(p,S,w){var T=!1;if(S===$e){var B=this.currentScope();T=B.lexical.indexOf(p)>-1||B.functions.indexOf(p)>-1||B.var.indexOf(p)>-1,B.lexical.push(p),this.inModule&&B.flags&Ze&&delete this.undefinedExports[p]}else if(S===le){var Z=this.currentScope();Z.lexical.push(p)}else if(S===Zi){var ne=this.currentScope();this.treatFunctionsAsVar?T=ne.lexical.indexOf(p)>-1:T=ne.lexical.indexOf(p)>-1||ne.var.indexOf(p)>-1,ne.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&Wn&&xe.lexical[0]===p)||!this.treatFunctionsAsVarInScope(xe)&&xe.functions.indexOf(p)>-1){T=!0;break}if(xe.var.push(p),this.inModule&&xe.flags&Ze&&delete this.undefinedExports[p],xe.flags&Rn)break}T&&this.raiseRecoverable(w,"Identifier '"+p+"' has already been declared")},fi.checkLocalExport=function(p){this.scopeStack[0].lexical.indexOf(p.name)===-1&&this.scopeStack[0].var.indexOf(p.name)===-1&&(this.undefinedExports[p.name]=p)},fi.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},fi.currentVarScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(Rn|mr|Xn))return S}},fi.currentThisScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(Rn|mr|Xn)&&!(S.flags&ui))return S}};var Gs=function(S,w,T){this.type="",this.start=w,this.end=0,S.options.locations&&(this.loc=new V(S,T)),S.options.directSourceFile&&(this.sourceFile=S.options.directSourceFile),S.options.ranges&&(this.range=[w,0])},ts=_.prototype;ts.startNode=function(){return new Gs(this,this.start,this.startLoc)},ts.startNodeAt=function(p,S){return new Gs(this,p,S)};function wl(p,S,w,T){return p.type=S,p.end=w,this.options.locations&&(p.loc.end=T),this.options.ranges&&(p.range[1]=w),p}ts.finishNode=function(p,S){return wl.call(this,p,S,this.lastTokEnd,this.lastTokEndLoc)},ts.finishNodeAt=function(p,S,w,T){return wl.call(this,p,S,w,T)},ts.copyNode=function(p){var S=new Gs(this,p.start,this.startLoc);for(var w in p)S[w]=p[w];return S};var yp="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",tc="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",hi=tc+" Extended_Pictographic",qt=hi,on=qt+" EBase EComp EMod EPres ExtPict",ns=on,nc=ns,t0={9:tc,10:hi,11:qt,12:on,13:ns,14:nc},n0="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",xp={9:"",10:"",11:"",12:"",13:"",14:n0},Ys="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",El="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",rs=El+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",is=rs+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Qs=is+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ss=Qs+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ht=ss+" "+yp,bp={9:El,10:rs,11:is,12:Qs,13:ss,14:Ht},rc={};function as(p){var S=rc[p]={binary:ze(t0[p]+" "+Ys),binaryOfStrings:ze(xp[p]),nonBinary:{General_Category:ze(Ys),Script:ze(bp[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 Di=0,Sp=[9,10,11,12,13,14];Di<Sp.length;Di+=1){var vp=Sp[Di];as(vp)}var we=_.prototype,Al=function(S,w){this.parent=S,this.base=w||this};Al.prototype.separatedFrom=function(S){for(var w=this;w;w=w.parent)for(var T=S;T;T=T.parent)if(w.base===T.base&&w!==T)return!0;return!1},Al.prototype.sibling=function(){return new Al(this.parent,this.base)};var In=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=rc[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};In.prototype.reset=function(S,w,T){var B=T.indexOf("v")!==-1,Z=T.indexOf("u")!==-1;this.start=S|0,this.source=w+"",this.flags=T,B&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=Z&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=Z&&this.parser.options.ecmaVersion>=9)},In.prototype.raise=function(S){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+S)},In.prototype.at=function(S,w){w===void 0&&(w=!1);var T=this.source,B=T.length;if(S>=B)return-1;var Z=T.charCodeAt(S);if(!(w||this.switchU)||Z<=55295||Z>=57344||S+1>=B)return Z;var ne=T.charCodeAt(S+1);return ne>=56320&&ne<=57343?(Z<<10)+ne-56613888:Z},In.prototype.nextIndex=function(S,w){w===void 0&&(w=!1);var T=this.source,B=T.length;if(S>=B)return B;var Z=T.charCodeAt(S),ne;return!(w||this.switchU)||Z<=55295||Z>=57344||S+1>=B||(ne=T.charCodeAt(S+1))<56320||ne>57343?S+1:S+2},In.prototype.current=function(S){return S===void 0&&(S=!1),this.at(this.pos,S)},In.prototype.lookahead=function(S){return S===void 0&&(S=!1),this.at(this.nextIndex(this.pos,S),S)},In.prototype.advance=function(S){S===void 0&&(S=!1),this.pos=this.nextIndex(this.pos,S)},In.prototype.eat=function(S,w){return w===void 0&&(w=!1),this.current(w)===S?(this.advance(w),!0):!1},In.prototype.eatChars=function(S,w){w===void 0&&(w=!1);for(var T=this.pos,B=0,Z=S;B<Z.length;B+=1){var ne=Z[B],ge=this.at(T,w);if(ge===-1||ge!==ne)return!1;T=this.nextIndex(T,w)}return this.pos=T,!0},we.validateRegExpFlags=function(p){for(var S=p.validFlags,w=p.flags,T=!1,B=!1,Z=0;Z<w.length;Z++){var ne=w.charAt(Z);S.indexOf(ne)===-1&&this.raise(p.start,"Invalid regular expression flag"),w.indexOf(ne,Z+1)>-1&&this.raise(p.start,"Duplicate regular expression flag"),ne==="u"&&(T=!0),ne==="v"&&(B=!0)}this.options.ecmaVersion>=15&&T&&B&&this.raise(p.start,"Invalid regular expression flag")};function Nl(p){for(var S in p)return!0;return!1}we.validateRegExpPattern=function(p){this.regexp_pattern(p),!p.switchN&&this.options.ecmaVersion>=9&&Nl(p.groupNames)&&(p.switchN=!0,this.regexp_pattern(p))},we.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 T=w[S];p.groupNames[T]||p.raise("Invalid named capture referenced")}},we.regexp_disjunction=function(p){var S=this.options.ecmaVersion>=16;for(S&&(p.branchID=new Al(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")},we.regexp_alternative=function(p){for(;p.pos<p.source.length&&this.regexp_eatTerm(p););},we.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},we.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},we.regexp_eatQuantifier=function(p,S){return S===void 0&&(S=!1),this.regexp_eatQuantifierPrefix(p,S)?(p.eat(63),!0):!1},we.regexp_eatQuantifierPrefix=function(p,S){return p.eat(42)||p.eat(43)||p.eat(63)||this.regexp_eatBracedQuantifier(p,S)},we.regexp_eatBracedQuantifier=function(p,S){var w=p.pos;if(p.eat(123)){var T=0,B=-1;if(this.regexp_eatDecimalDigits(p)&&(T=p.lastIntValue,p.eat(44)&&this.regexp_eatDecimalDigits(p)&&(B=p.lastIntValue),p.eat(125)))return B!==-1&&B<T&&!S&&p.raise("numbers out of order in {} quantifier"),!0;p.switchU&&!S&&p.raise("Incomplete quantifier"),p.pos=w}return!1},we.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)},we.regexp_eatReverseSolidusAtomEscape=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatAtomEscape(p))return!0;p.pos=S}return!1},we.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),T=p.eat(45);if(w||T){for(var B=0;B<w.length;B++){var Z=w.charAt(B);w.indexOf(Z,B+1)>-1&&p.raise("Duplicate regular expression modifiers")}if(T){var ne=this.regexp_eatModifiers(p);!w&&!ne&&p.current()===58&&p.raise("Invalid regular expression modifiers");for(var ge=0;ge<ne.length;ge++){var xe=ne.charAt(ge);(ne.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},we.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},we.regexp_eatModifiers=function(p){for(var S="",w=0;(w=p.current())!==-1&&pi(w);)S+=D(w),p.advance();return S};function pi(p){return p===105||p===109||p===115}we.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)},we.regexp_eatInvalidBracedQuantifier=function(p){return this.regexp_eatBracedQuantifier(p,!0)&&p.raise("Nothing to repeat"),!1},we.regexp_eatSyntaxCharacter=function(p){var S=p.current();return _n(S)?(p.lastIntValue=S,p.advance(),!0):!1};function _n(p){return p===36||p>=40&&p<=43||p===46||p===63||p>=91&&p<=94||p>=123&&p<=125}we.regexp_eatPatternCharacters=function(p){for(var S=p.pos,w=0;(w=p.current())!==-1&&!_n(w);)p.advance();return p.pos!==S},we.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},we.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 T=0,B=w;T<B.length;T+=1){var Z=B[T];Z.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}},we.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},we.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},we.regexp_eatRegExpIdentifierStart=function(p){var S=p.pos,w=this.options.ecmaVersion>=11,T=p.current(w);return p.advance(w),T===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,w)&&(T=p.lastIntValue),kp(T)?(p.lastIntValue=T,!0):(p.pos=S,!1)};function kp(p){return k(p,!0)||p===36||p===95}we.regexp_eatRegExpIdentifierPart=function(p){var S=p.pos,w=this.options.ecmaVersion>=11,T=p.current(w);return p.advance(w),T===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,w)&&(T=p.lastIntValue),r0(T)?(p.lastIntValue=T,!0):(p.pos=S,!1)};function r0(p){return E(p,!0)||p===36||p===95||p===8204||p===8205}we.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)},we.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},we.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},we.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)},we.regexp_eatCControlLetter=function(p){var S=p.pos;if(p.eat(99)){if(this.regexp_eatControlLetter(p))return!0;p.pos=S}return!1},we.regexp_eatZero=function(p){return p.current()===48&&!mi(p.lookahead())?(p.lastIntValue=0,p.advance(),!0):!1},we.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},we.regexp_eatControlLetter=function(p){var S=p.current();return Tl(S)?(p.lastIntValue=S%32,p.advance(),!0):!1};function Tl(p){return p>=65&&p<=90||p>=97&&p<=122}we.regexp_eatRegExpUnicodeEscapeSequence=function(p,S){S===void 0&&(S=!1);var w=p.pos,T=S||p.switchU;if(p.eat(117)){if(this.regexp_eatFixedHexDigits(p,4)){var B=p.lastIntValue;if(T&&B>=55296&&B<=56319){var Z=p.pos;if(p.eat(92)&&p.eat(117)&&this.regexp_eatFixedHexDigits(p,4)){var ne=p.lastIntValue;if(ne>=56320&&ne<=57343)return p.lastIntValue=(B-55296)*1024+(ne-56320)+65536,!0}p.pos=Z,p.lastIntValue=B}return!0}if(T&&p.eat(123)&&this.regexp_eatHexDigits(p)&&p.eat(125)&&Cp(p.lastIntValue))return!0;T&&p.raise("Invalid unicode escape"),p.pos=w}return!1};function Cp(p){return p>=0&&p<=1114111}we.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},we.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 ao=0,di=1,Tt=2;we.regexp_eatCharacterClassEscape=function(p){var S=p.current();if(ic(S))return p.lastIntValue=-1,p.advance(),di;var w=!1;if(p.switchU&&this.options.ecmaVersion>=9&&((w=S===80)||S===112)){p.lastIntValue=-1,p.advance();var T;if(p.eat(123)&&(T=this.regexp_eatUnicodePropertyValueExpression(p))&&p.eat(125))return w&&T===Tt&&p.raise("Invalid property name"),T;p.raise("Invalid property name")}return ao};function ic(p){return p===100||p===68||p===115||p===83||p===119||p===87}we.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 T=p.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(p,w,T),di}}if(p.pos=S,this.regexp_eatLoneUnicodePropertyNameOrValue(p)){var B=p.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(p,B)}return ao},we.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")},we.regexp_validateUnicodePropertyNameOrValue=function(p,S){if(p.unicodeProperties.binary.test(S))return di;if(p.switchV&&p.unicodeProperties.binaryOfStrings.test(S))return Tt;p.raise("Invalid property name")},we.regexp_eatUnicodePropertyName=function(p){var S=0;for(p.lastStringValue="";sc(S=p.current());)p.lastStringValue+=D(S),p.advance();return p.lastStringValue!==""};function sc(p){return Tl(p)||p===95}we.regexp_eatUnicodePropertyValue=function(p){var S=0;for(p.lastStringValue="";ac(S=p.current());)p.lastStringValue+=D(S),p.advance();return p.lastStringValue!==""};function ac(p){return sc(p)||mi(p)}we.regexp_eatLoneUnicodePropertyNameOrValue=function(p){return this.regexp_eatUnicodePropertyValue(p)},we.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},we.regexp_classContents=function(p){return p.current()===93?di:p.switchV?this.regexp_classSetExpression(p):(this.regexp_nonEmptyClassRanges(p),di)},we.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")}}},we.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||lc(w))&&p.raise("Invalid class escape"),p.raise("Invalid escape")}p.pos=S}var T=p.current();return T!==93?(p.lastIntValue=T,p.advance(),!0):!1},we.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)},we.regexp_classSetExpression=function(p){var S=di,w;if(!this.regexp_eatClassSetRange(p))if(w=this.regexp_eatClassSetOperand(p)){w===Tt&&(S=Tt);for(var T=p.pos;p.eatChars([38,38]);){if(p.current()!==38&&(w=this.regexp_eatClassSetOperand(p))){w!==Tt&&(S=di);continue}p.raise("Invalid character in character class")}if(T!==p.pos)return S;for(;p.eatChars([45,45]);)this.regexp_eatClassSetOperand(p)||p.raise("Invalid character in character class");if(T!==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)}},we.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 T=p.lastIntValue;return w!==-1&&T!==-1&&w>T&&p.raise("Range out of order in character class"),!0}p.pos=S}return!1},we.regexp_eatClassSetOperand=function(p){return this.regexp_eatClassSetCharacter(p)?di:this.regexp_eatClassStringDisjunction(p)||this.regexp_eatNestedClass(p)},we.regexp_eatNestedClass=function(p){var S=p.pos;if(p.eat(91)){var w=p.eat(94),T=this.regexp_classContents(p);if(p.eat(93))return w&&T===Tt&&p.raise("Negated character class may contain strings"),T;p.pos=S}if(p.eat(92)){var B=this.regexp_eatCharacterClassEscape(p);if(B)return B;p.pos=S}return null},we.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},we.regexp_classStringDisjunctionContents=function(p){for(var S=this.regexp_classString(p);p.eat(124);)this.regexp_classString(p)===Tt&&(S=Tt);return S},we.regexp_classString=function(p){for(var S=0;this.regexp_eatClassSetCharacter(p);)S++;return S===1?di:Tt},we.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()&&Ws(w)||wp(w)?!1:(p.advance(),p.lastIntValue=w,!0)};function Ws(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 wp(p){return p===40||p===41||p===45||p===47||p>=91&&p<=93||p>=123&&p<=125}we.regexp_eatClassSetReservedPunctuator=function(p){var S=p.current();return Ep(S)?(p.lastIntValue=S,p.advance(),!0):!1};function Ep(p){return p===33||p===35||p===37||p===38||p===44||p===45||p>=58&&p<=62||p===64||p===96||p===126}we.regexp_eatClassControlLetter=function(p){var S=p.current();return mi(S)||S===95?(p.lastIntValue=S%32,p.advance(),!0):!1},we.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},we.regexp_eatDecimalDigits=function(p){var S=p.pos,w=0;for(p.lastIntValue=0;mi(w=p.current());)p.lastIntValue=10*p.lastIntValue+(w-48),p.advance();return p.pos!==S};function mi(p){return p>=48&&p<=57}we.regexp_eatHexDigits=function(p){var S=p.pos,w=0;for(p.lastIntValue=0;Ap(w=p.current());)p.lastIntValue=16*p.lastIntValue+oc(w),p.advance();return p.pos!==S};function Ap(p){return p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102}function oc(p){return p>=65&&p<=70?10+(p-65):p>=97&&p<=102?10+(p-97):p-48}we.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},we.regexp_eatOctalDigit=function(p){var S=p.current();return lc(S)?(p.lastIntValue=S-48,p.advance(),!0):(p.lastIntValue=0,!1)};function lc(p){return p>=48&&p<=55}we.regexp_eatFixedHexDigits=function(p,S){var w=p.pos;p.lastIntValue=0;for(var T=0;T<S;++T){var B=p.current();if(!Ap(B))return p.pos=w,!1;p.lastIntValue=16*p.lastIntValue+oc(B),p.advance()}return!0};var Xs=function(S){this.type=S.type,this.value=S.value,this.start=S.start,this.end=S.end,S.options.locations&&(this.loc=new V(S,S.startLoc,S.endLoc)),S.options.ranges&&(this.range=[S.start,S.end])},et=_.prototype;et.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 Xs(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},et.getToken=function(){return this.next(),new Xs(this)},typeof Symbol<"u"&&(et[Symbol.iterator]=function(){var p=this;return{next:function(){var S=p.getToken();return{done:S.type===C.eof,value:S}}}}),et.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())},et.readToken=function(p){return k(p,this.options.ecmaVersion>=6)||p===92?this.readWord():this.getTokenFromCode(p)},et.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},et.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},et.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 T=void 0,B=S;(T=K(this.input,B,this.pos))>-1;)++this.curLine,B=this.lineStart=T;this.options.onComment&&this.options.onComment(!0,this.input.slice(S+2,w),S,this.pos,p,this.curPosition())},et.skipLineComment=function(p){for(var S=this.pos,w=this.options.onComment&&this.curPosition(),T=this.input.charCodeAt(this.pos+=p);this.pos<this.input.length&&!J(T);)T=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())},et.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&&de.test(String.fromCharCode(p)))++this.pos;else break e}}},et.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)},et.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))},et.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)},et.readToken_mult_modulo_exp=function(p){var S=this.input.charCodeAt(this.pos+1),w=1,T=p===42?C.star:C.modulo;return this.options.ecmaVersion>=7&&p===42&&S===42&&(++w,T=C.starstar,S=this.input.charCodeAt(this.pos+2)),S===61?this.finishOp(C.assign,w+1):this.finishOp(T,w)},et.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)},et.readToken_caret=function(){var p=this.input.charCodeAt(this.pos+1);return p===61?this.finishOp(C.assign,2):this.finishOp(C.bitwiseXOR,1)},et.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||z.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)},et.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))},et.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)},et.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 T=this.input.charCodeAt(this.pos+2);if(T===61)return this.finishOp(C.assign,3)}return this.finishOp(C.coalesce,2)}}return this.finishOp(C.question,1)},et.readToken_numberSign=function(){var p=this.options.ecmaVersion,S=35;if(p>=13&&(++this.pos,S=this.fullCharCodeAtPos(),k(S,!0)||S===92))return this.finishToken(C.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+D(S)+"'")},et.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)+"'")},et.finishOp=function(p,S){var w=this.input.slice(this.pos,this.pos+S);return this.pos+=S,this.finishToken(p,w)},et.readRegexp=function(){for(var p,S,w=this.pos;;){this.pos>=this.input.length&&this.raise(w,"Unterminated regular expression");var T=this.input.charAt(this.pos);if(z.test(T)&&this.raise(w,"Unterminated regular expression"),p)p=!1;else{if(T==="[")S=!0;else if(T==="]"&&S)S=!1;else if(T==="/"&&!S)break;p=T==="\\"}++this.pos}var B=this.input.slice(w,this.pos);++this.pos;var Z=this.pos,ne=this.readWord1();this.containsEsc&&this.unexpected(Z);var ge=this.regexpState||(this.regexpState=new In(this));ge.reset(w,B,ne),this.validateRegExpFlags(ge),this.validateRegExpPattern(ge);var xe=null;try{xe=new RegExp(B,ne)}catch{}return this.finishToken(C.regexp,{pattern:B,flags:ne,value:xe})},et.readInt=function(p,S,w){for(var T=this.options.ecmaVersion>=12&&S===void 0,B=w&&this.input.charCodeAt(this.pos)===48,Z=this.pos,ne=0,ge=0,xe=0,Le=S??1/0;xe<Le;++xe,++this.pos){var Ge=this.input.charCodeAt(this.pos),yt=void 0;if(T&&Ge===95){B&&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=Ge;continue}if(Ge>=97?yt=Ge-97+10:Ge>=65?yt=Ge-65+10:Ge>=48&&Ge<=57?yt=Ge-48:yt=1/0,yt>=p)break;ge=Ge,ne=ne*p+yt}return T&&ge===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===Z||S!=null&&this.pos-Z!==S?null:ne};function i0(p,S){return S?parseInt(p,8):parseFloat(p.replace(/_/g,""))}function oo(p){return typeof BigInt!="function"?null:BigInt(p.replace(/_/g,""))}et.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=oo(this.input.slice(S,this.pos)),++this.pos):k(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,w)},et.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 T=this.input.charCodeAt(this.pos);if(!w&&!p&&this.options.ecmaVersion>=11&&T===110){var B=oo(this.input.slice(S,this.pos));return++this.pos,k(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,B)}w&&/[89]/.test(this.input.slice(S,this.pos))&&(w=!1),T===46&&!w&&(++this.pos,this.readInt(10),T=this.input.charCodeAt(this.pos)),(T===69||T===101)&&!w&&(T=this.input.charCodeAt(++this.pos),(T===43||T===45)&&++this.pos,this.readInt(10)===null&&this.raise(S,"Invalid number")),k(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var Z=i0(this.input.slice(S,this.pos),w);return this.finishToken(C.num,Z)},et.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},et.readString=function(p){for(var S="",w=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var T=this.input.charCodeAt(this.pos);if(T===p)break;T===92?(S+=this.input.slice(w,this.pos),S+=this.readEscapedChar(!1),w=this.pos):T===8232||T===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(J(T)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return S+=this.input.slice(w,this.pos++),this.finishToken(C.string,S)};var _r={};et.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(p){if(p===_r)this.readInvalidTemplateToken();else throw p}this.inTemplateElement=!1},et.invalidStringToken=function(p,S){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw _r;this.raise(p,S)},et.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(J(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+=`
82
+ `;break;default:p+=String.fromCharCode(w);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),S=this.pos}else++this.pos}},et.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]===`
83
+ `&&++this.pos;case`
84
+ `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},et.readEscapedChar=function(p){var S=this.input.charCodeAt(++this.pos);switch(++this.pos,S){case 110:return`
85
+ `;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 T=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],B=parseInt(T,8);return B>255&&(T=T.slice(0,-1),B=parseInt(T,8)),this.pos+=T.length-1,S=this.input.charCodeAt(this.pos),(T!=="0"||S===56||S===57)&&(this.strict||p)&&this.invalidStringToken(this.pos-1-T.length,p?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(B)}return J(S)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(S)}},et.readHexChar=function(p){var S=this.pos,w=this.readInt(16,p);return w===null&&this.invalidStringToken(S,"Bad character escape sequence"),w},et.readWord1=function(){this.containsEsc=!1;for(var p="",S=!0,w=this.pos,T=this.options.ecmaVersion>=6;this.pos<this.input.length;){var B=this.fullCharCodeAtPos();if(E(B,T))this.pos+=B<=65535?1:2;else if(B===92){this.containsEsc=!0,p+=this.input.slice(w,this.pos);var Z=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var ne=this.readCodePoint();(S?k:E)(ne,T)||this.invalidStringToken(Z,"Invalid Unicode escape"),p+=D(ne),w=this.pos}else break;S=!1}return p+this.input.slice(w,this.pos)},et.readWord=function(){var p=this.readWord1(),S=C.name;return this.keywords.test(p)&&(S=U[p]),this.finishToken(S,p)};var Ml="8.16.0";_.acorn={Parser:_,version:Ml,defaultOptions:De,Position:ee,SourceLocation:V,getLineInfo:be,Node:Gs,TokenType:N,tokTypes:C,keywordTypes:U,TokContext:Jt,tokContexts:gt,isIdentifierChar:E,isIdentifierStart:k,Token:Xs,isNewLine:J,lineBreak:z,lineBreakG:G,nonASCIIwhitespace:de};function uc(p,S){return _.parse(p,S)}function Zs(p,S,w){return _.parseExpressionAt(p,S,w)}function ea(p,S){return _.tokenizer(p,S)}n.Node=Gs,n.Parser=_,n.Position=ee,n.SourceLocation=V,n.TokContext=Jt,n.Token=Xs,n.TokenType=N,n.defaultOptions=De,n.getLineInfo=be,n.isIdentifierChar=E,n.isIdentifierStart=k,n.isNewLine=J,n.keywordTypes=U,n.lineBreak=z,n.lineBreakG=G,n.nonASCIIwhitespace=de,n.parse=uc,n.parseExpressionAt=Zs,n.tokContexts=gt,n.tokTypes=C,n.tokenizer=ea,n.version=Ml}))})(jf,jf.exports)),jf.exports}var gT;function nG(){return gT||(gT=1,(function(t){const e=eG(),n=/^[\da-fA-F]+$/,r=/^\d+$/,i=new WeakMap;function s(c){c=c.Parser.acorn||c;let h=i.get(c);if(!h){const d=c.tokTypes,g=c.TokContext,y=c.TokenType,b=new g("<tag",!1),k=new g("</tag",!1),E=new g("<tag>...</tag>",!0,!0),N={tc_oTag:b,tc_cTag:k,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 P=this.context.pop();P===b&&j===d.slash||P===k?(this.context.pop(),this.exprAllowed=this.curContext()===E):this.exprAllowed=!0},h={tokContexts:N,tokTypes:M},i.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(mT()).tokTypes},configurable:!0,enumerable:!0});function u(c,h){const d=h.acorn||mT(),g=s(d),y=d.tokTypes,b=g.tokTypes,k=d.tokContexts,E=g.tokContexts.tc_oTag,N=g.tokContexts.tc_cTag,M=g.tokContexts.tc_expr,j=d.isNewLine,P=d.isIdentifierStart,U=d.isIdentifierChar;return class extends h{static get acornJsx(){return g}jsx_readToken(){let L="",C=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let z=this.input.charCodeAt(this.pos);switch(z){case 60:case 123:return this.pos===this.start?z===60&&this.exprAllowed?(++this.pos,this.finishToken(b.jsxTagStart)):this.getTokenFromCode(z):(L+=this.input.slice(C,this.pos),this.finishToken(b.jsxText,L));case 38:L+=this.input.slice(C,this.pos),L+=this.jsx_readEntity(),C=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(z===62?"&gt;":"&rbrace;")+'` or `{"'+this.input[this.pos]+'"}`?');default:j(z)?(L+=this.input.slice(C,this.pos),L+=this.jsx_readNewLine(!0),C=this.pos):++this.pos}}}jsx_readNewLine(L){let C=this.input.charCodeAt(this.pos),z;return++this.pos,C===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,z=L?`
86
+ `:`\r
87
+ `):z=String.fromCharCode(C),this.options.locations&&(++this.curLine,this.lineStart=this.pos),z}jsx_readString(L){let C="",z=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let G=this.input.charCodeAt(this.pos);if(G===L)break;G===38?(C+=this.input.slice(z,this.pos),C+=this.jsx_readEntity(),z=this.pos):j(G)?(C+=this.input.slice(z,this.pos),C+=this.jsx_readNewLine(!1),z=this.pos):++this.pos}return C+=this.input.slice(z,this.pos++),this.finishToken(y.string,C)}jsx_readEntity(){let L="",C=0,z,G=this.input[this.pos];G!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let J=++this.pos;for(;this.pos<this.input.length&&C++<10;){if(G=this.input[this.pos++],G===";"){L[0]==="#"?L[1]==="x"?(L=L.substr(2),n.test(L)&&(z=String.fromCharCode(parseInt(L,16)))):(L=L.substr(1),r.test(L)&&(z=String.fromCharCode(parseInt(L,10)))):z=e[L];break}L+=G}return z||(this.pos=J,"&")}jsx_readWord(){let L,C=this.pos;do L=this.input.charCodeAt(++this.pos);while(U(L)||L===45);return this.finishToken(b.jsxName,this.input.slice(C,this.pos))}jsx_parseIdentifier(){let L=this.startNode();return this.type===b.jsxName?L.name=this.value:this.type.keyword?L.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(L,"JSXIdentifier")}jsx_parseNamespacedName(){let L=this.start,C=this.startLoc,z=this.jsx_parseIdentifier();if(!c.allowNamespaces||!this.eat(y.colon))return z;var G=this.startNodeAt(L,C);return G.namespace=z,G.name=this.jsx_parseIdentifier(),this.finishNode(G,"JSXNamespacedName")}jsx_parseElementName(){if(this.type===b.jsxTagEnd)return"";let L=this.start,C=this.startLoc,z=this.jsx_parseNamespacedName();for(this.type===y.dot&&z.type==="JSXNamespacedName"&&!c.allowNamespacedObjects&&this.unexpected();this.eat(y.dot);){let G=this.startNodeAt(L,C);G.object=z,G.property=this.jsx_parseIdentifier(),z=this.finishNode(G,"JSXMemberExpression")}return z}jsx_parseAttributeValue(){switch(this.type){case y.braceL:let L=this.jsx_parseExpressionContainer();return L.expression.type==="JSXEmptyExpression"&&this.raise(L.start,"JSX attributes must only be assigned a non-empty expression"),L;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 L=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(L,"JSXEmptyExpression",this.start,this.startLoc)}jsx_parseExpressionContainer(){let L=this.startNode();return this.next(),L.expression=this.type===y.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(y.braceR),this.finishNode(L,"JSXExpressionContainer")}jsx_parseAttribute(){let L=this.startNode();return this.eat(y.braceL)?(this.expect(y.ellipsis),L.argument=this.parseMaybeAssign(),this.expect(y.braceR),this.finishNode(L,"JSXSpreadAttribute")):(L.name=this.jsx_parseNamespacedName(),L.value=this.eat(y.eq)?this.jsx_parseAttributeValue():null,this.finishNode(L,"JSXAttribute"))}jsx_parseOpeningElementAt(L,C){let z=this.startNodeAt(L,C);z.attributes=[];let G=this.jsx_parseElementName();for(G&&(z.name=G);this.type!==y.slash&&this.type!==b.jsxTagEnd;)z.attributes.push(this.jsx_parseAttribute());return z.selfClosing=this.eat(y.slash),this.expect(b.jsxTagEnd),this.finishNode(z,G?"JSXOpeningElement":"JSXOpeningFragment")}jsx_parseClosingElementAt(L,C){let z=this.startNodeAt(L,C),G=this.jsx_parseElementName();return G&&(z.name=G),this.expect(b.jsxTagEnd),this.finishNode(z,G?"JSXClosingElement":"JSXClosingFragment")}jsx_parseElementAt(L,C){let z=this.startNodeAt(L,C),G=[],J=this.jsx_parseOpeningElementAt(L,C),K=null;if(!J.selfClosing){e:for(;;)switch(this.type){case b.jsxTagStart:if(L=this.start,C=this.startLoc,this.next(),this.eat(y.slash)){K=this.jsx_parseClosingElementAt(L,C);break e}G.push(this.jsx_parseElementAt(L,C));break;case b.jsxText:G.push(this.parseExprAtom());break;case y.braceL:G.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}o(K.name)!==o(J.name)&&this.raise(K.start,"Expected corresponding JSX closing tag for <"+o(J.name)+">")}let de=J.name?"Element":"Fragment";return z["opening"+de]=J,z["closing"+de]=K,z.children=G,this.type===y.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(z,"JSX"+de)}jsx_parseText(){let L=this.parseLiteral(this.value);return L.type="JSXText",L}jsx_parseElement(){let L=this.start,C=this.startLoc;return this.next(),this.jsx_parseElementAt(L,C)}parseExprAtom(L){return this.type===b.jsxText?this.jsx_parseText():this.type===b.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(L)}readToken(L){let C=this.curContext();if(C===M)return this.jsx_readToken();if(C===E||C===N){if(P(L))return this.jsx_readWord();if(L==62)return++this.pos,this.finishToken(b.jsxTagEnd);if((L===34||L===39)&&C==E)return this.jsx_readString(L)}return L===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(b.jsxTagStart)):super.readToken(L)}updateContext(L){if(this.type==y.braceL){var C=this.curContext();C==E?this.context.push(k.b_expr):C==M?this.context.push(k.b_tmpl):super.updateContext(L),this.exprAllowed=!0}else if(this.type===y.slash&&L===b.jsxTagStart)this.context.length-=2,this.context.push(N),this.exprAllowed=!1;else return super.updateContext(L)}}}})(Ax)),Ax.exports}var rG=nG();const iG=VT(rG);const sG={}.hasOwnProperty,aG=Symbol("continue"),Tx=Symbol("exit"),oG=Symbol("skip");function lG(t,e){let n,r;typeof e=="function"?n=e:e&&typeof e=="object"&&(e.enter&&(n=e.enter),e.leave&&(r=e.leave)),i(t,void 0,void 0,[])();function i(s,o,u,c){return Mx(s)&&(h.displayName="node ("+s.type+")"),h;function h(){const d=n?yT(n(s,o,u,c)):[];if(d[0]===Tx)return d;if(d[0]!==oG){let g;for(g in s)if(sG.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 k=b;let E=0;for(;E>-1&&E<k.length;){const N=k[E];if(Mx(N)){const M=i(N,g,E,y)();if(M[0]===Tx)return M;E=typeof M[1]=="number"?M[1]:E+1}else E++}}else if(Mx(b)){const k=i(b,g,void 0,y)();if(k[0]===Tx)return k}}}return r?yT(r(s,o,u,c)):d}}}function yT(t){return Array.isArray(t)?t:typeof t=="number"?[aG,t]:[t]}function Mx(t){return!!(t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.length>0)}function O_(t,e){const n=e.prefix||"",r=e.suffix||"",i=Object.assign({},e.acornOptions),s=[],o=[],u=i.onComment,c=i.onToken;let h=!1,d,g;const y=Object.assign({},i,{onComment:s,preserveParens:!0});c&&(y.onToken=o);const b=uG(t,e.tokenTypes),k=b.value,E=n+k+r,N=e.expression&&xT(k);if(N&&!e.allowEmpty)throw new mt("Unexpected empty expression",{place:j(0),ruleId:"unexpected-empty-expression",source:"micromark-extension-mdx-expression"});try{d=e.expression&&!N?e.acorn.parseExpressionAt(E,0,y):e.acorn.parse(E,y)}catch(P){const U=P,L=j(U.pos);U.message=String(U.message).replace(/ \(\d+:\d+\)$/,""),U.pos=L.offset,U.loc={line:L.line,column:L.column-1},g=U,h=U.raisedAt>=n.length+k.length||U.message==="Unterminated comment"}if(d&&e.expression&&!N)if(xT(E.slice(d.end,E.length-r.length)))d={type:"Program",start:0,end:n.length+k.length,body:[{type:"ExpressionStatement",expression:d,start:0,end:n.length+k.length}],sourceType:"module",comments:[]};else{const P=j(d.end),U=new Error("Unexpected content after expression");U.pos=P.offset,U.loc={line:P.line,column:P.column-1},g=U,d=void 0}if(d){if(d.comments=s,lG(d,function(P,U,L,C){let z=C[C.length-1],G=U;P.type==="ParenthesizedExpression"&&z&&G&&(typeof L=="number"&&(z=z[G],G=L),z[G]=P.expression),M(P)}),Array.isArray(u))u.push(...s);else if(typeof u=="function")for(const P of s)u(P.type==="Block",P.value,P.start,P.end,P.loc.start,P.loc.end);for(const P of o)P.end<=n.length||P.start-n.length>=k.length||(M(P),Array.isArray(c)?c.push(P):c(P))}return{estree:d,error:g,swallow:h};function M(P){const U=j(P.start),L=j(P.end);P.start=U.offset,P.end=L.offset,P.loc={start:{line:U.line,column:U.column-1,offset:U.offset},end:{line:L.line,column:L.column-1,offset:L.offset}},P.range=[P.start,P.end]}function j(P){let U=P-n.length;U<0?U=0:U>k.length&&(U=k.length);let L=cG(b.stops,U);return L||(L={line:e.start.line,column:e.start.column,offset:e.start.offset}),L}}function xT(t){return/^\s*$/.test(t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,""))}function uG(t,e){const n={value:"",stops:[]};let r=-1;for(;++r<t.length;){const i=t[r];if(i[0]==="enter"){const s=i[1].type;if(s==="lineEnding"||e.includes(s)){const o=i[2].sliceStream(i[1]);for(;o.length>0&&o[0]===-1;)o.shift();const u=fG(o);n.stops.push([n.value.length,i[1].start]),n.value+=u,n.stops.push([n.value.length,i[1].end])}}}return n}function cG(t,e){let n=0;for(;n<t.length&&t[n][0]<=e;)n+=1;if(n===0)return;const[r,i]=t[n-1],s=e-r;return{line:i.line,column:i.column+s,offset:i.offset+s}}function fG(t){let e=-1;const n=[];let r;for(;++e<t.length;){const i=t[e];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
88
+ `;break}case-3:{s=`\r
89
+ `;break}case-2:{s=" ";break}case-1:{if(r)continue;s=" ";break}default:s=String.fromCharCode(i)}r=i===-2,n.push(s)}return n.join("")}function Sm(t){const e=t||{},n=e.loc||{},r=e.range||[void 0,void 0],i=bT(n.start,r[0]||e.start),s=bT(n.end,r[1]||e.end);if(i&&s)return{start:i,end:s}}function bT(t,e){if(t&&typeof t=="object"){const n="line"in t?Ox(t.line):void 0,r="column"in t?Ox(t.column):void 0;if(n&&r!==void 0)return{line:n,column:r+1,offset:Ox(e)}}}function Ox(t){return typeof t=="number"&&t>-1?t:void 0}const hG=2,Nu="https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression",pG="#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-",dG="#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed",ST="#unexpected-type-in-code-expected-an-object-spread-spread",mG="#unexpected-extra-content-in-spread-only-a-single-spread-is-supported",gG="#could-not-parse-expression-with-acorn";function ag(t,e,n,r,i,s,o,u,c,h,d){const g=this,y=this.events.length+3;let b=0,k,E;return N;function N(U){return t.enter(n),t.enter(r),t.consume(U),t.exit(r),k=g.now(),M}function M(U){if(U===null){if(E)throw E;const L=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 L.url=Nu+pG,L}if(Ce(U))return t.enter("lineEnding"),t.consume(U),t.exit("lineEnding"),P;if(U===125&&b===0){const L=s?yG.call(g,s,o,i,y,k,h||!1,c||!1):{type:"ok",estree:void 0};if(L.type==="ok"){t.enter(r),t.consume(U),t.exit(r);const C=t.exit(n);return u&&L.estree&&Object.assign(C,{estree:L.estree}),e}return E=L.message,t.enter(i),t.consume(U),j}return t.enter(i),j(U)}function j(U){return U===125&&b===0||U===null||Ce(U)?(t.exit(i),M(U)):(U===123&&!s?b+=1:U===125&&(b-=1),t.consume(U),j)}function P(U){const L=g.now();if(L.line!==k.line&&!d&&g.parser.lazy[L.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=Nu+dG,C}return qe(U)?He(t,M,"linePrefix",hG+1)(U):M(U)}}function yG(t,e,n,r,i,s,o){const u=O_(this.events.slice(r),{acorn:t,tokenTypes:[n],acornOptions:e,start:i,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 d=Sm(h),g=new mt("Unexpected `"+h.type+"` in code: expected an object spread (`{...spread}`)",{place:d.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=Nu+ST,g}if(h.expression.properties[1]){const d=Sm(h.expression.properties[1]),g=new mt("Unexpected extra content in spread: only a single spread is supported",{place:d.start,ruleId:"spread-extra",source:"micromark-extension-mdx-expression"});throw g.url=Nu+mG,g}if(h.expression.properties[0]&&h.expression.properties[0].type!=="SpreadElement"){const d=Sm(h.expression.properties[0]),g=new mt("Unexpected `"+h.expression.properties[0].type+"` in code: only spread elements are supported",{place:d.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=Nu+ST,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=Nu+gG,{type:"nok",message:h}}return{type:"ok",estree:c}}function xG(t){const e=t||{},n=e.addResult,r=e.acorn,i=e.spread;let s=e.allowEmpty,o;if(s==null&&(s=!0),r){if(!r.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,d,g){const y=this;return b;function b(M){return k(M)}function k(M){return ag.call(y,h,E,"mdxFlowExpression","mdxFlowExpressionMarker","mdxFlowExpressionChunk",r,o,n,i,s)(M)}function E(M){return qe(M)?He(h,N,"whitespace")(M):N(M)}function N(M){const j=y.parser.constructs.flow[60],U=(Array.isArray(j)?j:j?[j]:[]).find(function(L){return L.name==="mdxJsxFlowTag"});return M===60&&U?h.attempt(U,N,g)(M):M===null||Ce(M)?d(M):g(M)}}function c(h,d){const g=this;return y;function y(b){return ag.call(g,h,d,"mdxTextExpression","mdxTextExpressionMarker","mdxTextExpressionChunk",r,o,n,i,s,!0)(b)}}}const bG=/[$_\p{ID_Start}]/u,SG=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,vG=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,kG={};function Si(t){return t?bG.test(String.fromCodePoint(t)):!1}function Zc(t,e){const r=(e||kG).jsx?vG:SG;return t?r.test(String.fromCodePoint(t)):!1}const vT="https://github.com/micromark/micromark-extension-mdx-jsx";function R_(t,e,n,r,i,s,o,u,c,h,d,g,y,b,k,E,N,M,j,P,U,L,C,z,G,J,K,de,ce,Se,Re,Y){const W=this;let ue,ke;return ze;function ze(_){return t.enter(u),t.enter(c),t.consume(_),t.exit(c),D}function D(_){return We(_)?n(_):(ue=F,$e(_))}function F(_){if(_===47)return t.enter(h),t.consume(_),t.exit(h),ue=ee,$e;if(_===62)return Dr(_);if(_!==null&&_>=0&&Si(_))return t.enter(g),t.enter(y),t.consume(_),V;me(_,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(_===33?" (note: to create a comment in MDX, use `{/* text */}`)":""))}function ee(_){if(_===62)return Dr(_);if(_!==null&&_>=0&&Si(_))return t.enter(g),t.enter(y),t.consume(_),V;me(_,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(_===42||_===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function V(_){if(_!==null&&_>=0&&Zc(_,{jsx:!0}))return t.consume(_),V;if(_===46||_===47||_===58||_===62||_===123||We(_)||Vn(_))return t.exit(y),ue=be,$e(_);me(_,"in name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(_===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function be(_){if(_===46)return t.enter(b),t.consume(_),t.exit(b),ue=De,$e;if(_===58)return t.enter(E),t.consume(_),t.exit(E),ue=Ct,$e;if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(g),Lt(_);me(_,"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 De(_){if(_!==null&&_>=0&&Si(_))return t.enter(k),t.consume(_),Me;me(_,"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(_){if(_!==null&&_>=0&&Zc(_,{jsx:!0}))return t.consume(_),Me;if(_===46||_===47||_===62||_===123||We(_)||Vn(_))return t.exit(k),ue=Xe,$e(_);me(_,"in member name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(_===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function Xe(_){if(_===46)return t.enter(b),t.consume(_),t.exit(b),ue=De,$e;if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(g),Lt(_);me(_,"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(_){if(_!==null&&_>=0&&Si(_))return t.enter(N),t.consume(_),Ze;me(_,"before local name","a character that can start a name, such as a letter, `$`, or `_`"+(_===43||_!==null&&_>46&&_<58?" (note: to create a link in MDX, use `[text](url)`)":""))}function Ze(_){if(_!==null&&_>=0&&Zc(_,{jsx:!0}))return t.consume(_),Ze;if(_===47||_===62||_===123||We(_)||Vn(_))return t.exit(N),ue=zt,$e(_);me(_,"in local name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function zt(_){if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(g),Lt(_);me(_,"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(_){if(_===47)return t.enter(d),t.consume(_),t.exit(d),ue=Ri,$e;if(_===62)return Dr(_);if(_===123)return ag.call(W,t,Oi,M,j,P,r,i,s,!0,!1,o)(_);if(_!==null&&_>=0&&Si(_))return t.enter(U),t.enter(L),t.enter(C),t.consume(_),ui;me(_,"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 Oi(_){return ue=Lt,$e(_)}function ui(_){if(_!==null&&_>=0&&Zc(_,{jsx:!0}))return t.consume(_),ui;if(_===47||_===58||_===61||_===62||_===123||We(_)||Vn(_))return t.exit(C),ue=Wn,$e(_);me(_,"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 Wn(_){if(_===58)return t.enter(z),t.consume(_),t.exit(z),ue=dr,$e;if(_===61)return t.exit(L),t.enter(J),t.consume(_),t.exit(J),ue=mr,$e;if(_===47||_===62||_===123||We(_)||Vn(_)||_!==null&&_>=0&&Si(_))return t.exit(L),t.exit(U),ue=Lt,$e(_);me(_,"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 dr(_){if(_!==null&&_>=0&&Si(_))return t.enter(G),t.consume(_),Or;me(_,"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 Or(_){if(_!==null&&_>=0&&Zc(_,{jsx:!0}))return t.consume(_),Or;if(_===47||_===61||_===62||_===123||We(_)||Vn(_))return t.exit(G),t.exit(L),ue=Xn,$e(_);me(_,"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 Xn(_){if(_===61)return t.enter(J),t.consume(_),t.exit(J),ue=mr,$e;if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(U),Lt(_);me(_,"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 mr(_){if(_===34||_===39)return t.enter(K),t.enter(de),t.consume(_),t.exit(de),ke=_,Rn;if(_===123)return ag.call(W,t,ci,Se,Re,Y,r,i,s,!1,!1,o)(_);me(_,"before attribute value","a character that can start an attribute value, such as `\"`, `'`, or `{`"+(_===60?" (note: to use an element or fragment as a prop value in MDX, use `{<element />}`)":""))}function ci(_){return t.exit(U),ue=Lt,$e(_)}function Rn(_){return _===null&&me(_,"in attribute value","a corresponding closing quote `"+String.fromCodePoint(ke)+"`"),_===ke?(t.enter(de),t.consume(_),t.exit(de),t.exit(K),t.exit(U),ke=void 0,ue=Lt,$e):Ce(_)?(ue=Rn,$e(_)):(t.enter(ce),Rr(_))}function Rr(_){return _===null||_===ke||Ce(_)?(t.exit(ce),Rn(_)):(t.consume(_),Rr)}function Ri(_){if(_===62)return Dr(_);me(_,"after self-closing slash","`>` to end the tag"+(_===42||_===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function Dr(_){return t.enter(c),t.consume(_),t.exit(c),t.exit(u),e}function $e(_){return Ce(_)?(t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),le):qe(_)||Vn(_)?(t.enter("esWhitespace"),Zi(_)):ue(_)}function Zi(_){return Ce(_)?(t.exit("esWhitespace"),$e(_)):qe(_)||Vn(_)?(t.consume(_),Zi):(t.exit("esWhitespace"),ue(_))}function le(_){if(!o&&W.parser.lazy[W.now().line]){const Ie=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 Ie.url=vT+"#unexpected-lazy-line-in-container-expected-line-to-be",Ie}return $e(_)}function me(_,Ie,Pe){const tn=new mt("Unexpected "+(_===null?"end of file":"character `"+(_===96?"` ` `":String.fromCodePoint(_))+"` ("+CG(_)+")")+" "+Ie+", expected "+Pe,W.now(),"micromark-extension-mdx-jsx:unexpected-"+(_===null?"eof":"character"));throw tn.url=vT+(_===null?"#unexpected-end-of-file-at-expected-expect":"#unexpected-character-at-expected-expect"),tn}}function CG(t){return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function wG(t,e){return{name:"mdxJsxTextTag",tokenize:n};function n(r,i,s){return R_.call(this,r,i,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 EG(t,e){return{concrete:!0,name:"mdxJsxFlowTag",tokenize:n};function n(r,i,s){const o=this;return u;function u(g){return c(g)}function c(g){return R_.call(o,r,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 qe(g)?He(r,d,"whitespace")(g):d(g)}function d(g){const y=o.parser.constructs.flow[123],b=Array.isArray(y)?y:y?[y]:[];let k;for(const E of b)if(E.name==="mdxFlowExpression"){k=E;break}return g===60?u(g):g===123&&k?r.attempt(k,d,s)(g):g===null||Ce(g)?i(g):s(g)}}}function AG(t){const e=t||{},n=e.acorn;let r;if(n){if(!n.parse||!n.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");r=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:EG(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})},text:{60:wG(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})}}}function NG(){return{disable:{null:["autolink","codeIndented","htmlFlow","htmlText"]}}}const TG={tokenize:RG,partial:!0},kT="https://github.com/micromark/micromark-extension-mdxjs-esm",MG=new Set(["ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ImportDeclaration"]);function OG(t){const e={tokenize:i,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,r=Object.assign({ecmaVersion:2024,sourceType:"module"},t.acornOptions,{locations:!0});return{flow:{101:e,105:e}};function i(s,o,u){const c=this,h=c.parser.definedModuleSpecifiers||(c.parser.definedModuleSpecifiers=[]),d=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 sn(j)?(s.consume(j),g+=String.fromCharCode(j),b):(g==="import"||g==="export")&&j===32?(s.consume(j),k):u(j)}function k(j){return j===null||Ce(j)?(s.exit("mdxjsEsmData"),E(j)):(s.consume(j),k)}function E(j){return j===null?M(j):Ce(j)?s.check(TG,M,N)(j):(s.enter("mdxjsEsmData"),k(j))}function N(j){return s.enter("lineEnding"),s.consume(j),s.exit("lineEnding"),E}function M(j){const P=O_(c.events.slice(d),{acorn:n,acornOptions:r,tokenTypes:["mdxjsEsmData"],prefix:h.length>0?"var "+h.join(",")+`
90
+ `:""});if(P.error){if(j!==null&&P.swallow)return N(j);const L=new mt("Could not parse import/exports with acorn",{cause:P.error,place:{line:P.error.loc.line,column:P.error.loc.column+1,offset:P.error.pos},ruleId:"acorn",source:"micromark-extension-mdxjs-esm"});throw L.url=kT+"#could-not-parse-importexports-with-acorn",L}h.length>0&&P.estree.body.shift();let U=-1;for(;++U<P.estree.body.length;){const L=P.estree.body[U];if(!MG.has(L.type)){const C=new mt("Unexpected `"+L.type+"` in code: only import/exports are supported",{place:Sm(L),ruleId:"non-esm",source:"micromark-extension-mdxjs-esm"});throw C.url=kT+"#unexpected-type-in-code-only-importexports-are-supported",C}if(L.type==="ImportDeclaration"&&!c.interrupt){let C=-1;for(;++C<L.specifiers.length;){const z=L.specifiers[C];h.push(z.local.name)}}}return Object.assign(s.exit("mdxjsEsm"),t.addResult?{estree:P.estree}:void 0),o(j)}}}function RG(t,e,n){return r;function r(i){return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),t.attempt(ju,e,n)}}function DG(t){const e=Object.assign({acorn:Zt.extend(iG()),acornOptions:{ecmaVersion:2024,sourceType:"module"},addResult:!0},t);return dS([OG(e),xG(e),AG(e),NG()])}const IG={};function _G(t){const e=this,n=t||IG,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(DG(n)),s.push(pK()),o.push(dK(n))}const Bh="__mdx_expr__:",zG=new Set(["br","hr","img","input","meta","link","area","base","col","embed","source","track","wbr"]),LG=Am().use(wm),BG=Ni("remarkMdx",()=>_G);function VG(t){const e={};let n=!1;if(!Array.isArray(t))return{props:e,hasExpressions:n};for(const r of t)r.type==="mdxJsxAttribute"&&r.name&&(r.value===null||r.value===void 0?e[r.name]="true":typeof r.value=="string"?e[r.name]=r.value:r.value?.type==="mdxJsxAttributeValueExpression"&&(e[r.name]=`${Bh}${r.value.value}`,n=!0)),r.type==="mdxJsxExpressionAttribute"&&(n=!0);return{props:e,hasExpressions:n}}function FG(t){const e=[];for(const[n,r]of Object.entries(t))r.startsWith(Bh)?e.push({type:"mdxJsxAttribute",name:n,value:{type:"mdxJsxAttributeValueExpression",value:r.slice(Bh.length)}}):e.push({type:"mdxJsxAttribute",name:n,value:r});return e}function D_(t){if(!t||t.length===0)return"";const e=[];for(const n of t)if(n.type==="paragraph"){const r=vm(n.children??[]);e.push(r)}else if(n.type==="text")e.push(n.value??"");else if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement"){const r=n.name??"",i=(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=D_(n.children??[]);s?e.push(`<${r}${i?" "+i:""}>${s}</${r}>`):e.push(`<${r}${i?" "+i:""} />`)}else n.value&&e.push(n.value);return e.join(`
91
+
92
+ `)}function vm(t){return t.map(e=>e.type==="text"?e.value??"":e.type==="strong"?`**${vm(e.children??[])}**`:e.type==="emphasis"?`*${vm(e.children??[])}*`:e.type==="inlineCode"?`\`${e.value??""}\``:e.type==="link"?`[${vm(e.children??[])}](${e.url??""})`:e.value??"").join("")}const I_=Ju("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 r=e.name;if(!r||zG.has(r.toLowerCase()))return;const{props:i,hasExpressions:s}=VG(e.attributes),o=D_(e.children??[]);t.addNode(n,{componentName:r,props:JSON.stringify(i),hasExpressions:s,children:o})}},toMarkdown:{match:t=>t.type.name==="mdx_component",runner:(t,e)=>{const n=e.attrs.componentName,r=JSON.parse(e.attrs.props),i=e.attrs.children||"",s=FG(r);if(i.trim()){const o=LG.parse(i);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:[]})}}})),CT=Ue("insertMdxComponent",()=>t=>(e,n)=>{if(!t)return!1;const r=e.schema.nodes.mdx_component;if(!r)return!1;const i=r.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,i);n(o)}return!0}),PG=Ju("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 jG=typeof global=="object"&&global&&global.Object===Object&&global,$G=typeof self=="object"&&self&&self.Object===Object&&self,__=jG||$G||Function("return this")(),og=__.Symbol,z_=Object.prototype,UG=z_.hasOwnProperty,JG=z_.toString,ef=og?og.toStringTag:void 0;function qG(t){var e=UG.call(t,ef),n=t[ef];try{t[ef]=void 0;var r=!0}catch{}var i=JG.call(t);return r&&(e?t[ef]=n:delete t[ef]),i}var HG=Object.prototype,KG=HG.toString;function GG(t){return KG.call(t)}var YG="[object Null]",QG="[object Undefined]",wT=og?og.toStringTag:void 0;function WG(t){return t==null?t===void 0?QG:YG:wT&&wT in Object(t)?qG(t):GG(t)}function XG(t){return t!=null&&typeof t=="object"}var ZG="[object Symbol]";function eY(t){return typeof t=="symbol"||XG(t)&&WG(t)==ZG}var tY=/\s/;function nY(t){for(var e=t.length;e--&&tY.test(t.charAt(e)););return e}var rY=/^\s+/;function iY(t){return t&&t.slice(0,nY(t)+1).replace(rY,"")}function uS(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ET=NaN,sY=/^[-+]0x[0-9a-f]+$/i,aY=/^0b[01]+$/i,oY=/^0o[0-7]+$/i,lY=parseInt;function AT(t){if(typeof t=="number")return t;if(eY(t))return ET;if(uS(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=uS(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=iY(t);var n=aY.test(t);return n||oY.test(t)?lY(t.slice(2),n?2:8):sY.test(t)?ET:+t}var Rx=function(){return __.Date.now()},uY="Expected a function",cY=Math.max,fY=Math.min;function hY(t,e,n){var r,i,s,o,u,c,h=0,d=!1,g=!1,y=!0;if(typeof t!="function")throw new TypeError(uY);e=AT(e)||0,uS(n)&&(d=!!n.leading,g="maxWait"in n,s=g?cY(AT(n.maxWait)||0,e):s,y="trailing"in n?!!n.trailing:y);function b(C){var z=r,G=i;return r=i=void 0,h=C,o=t.apply(G,z),o}function k(C){return h=C,u=setTimeout(M,e),d?b(C):o}function E(C){var z=C-c,G=C-h,J=e-z;return g?fY(J,s-G):J}function N(C){var z=C-c,G=C-h;return c===void 0||z>=e||z<0||g&&G>=s}function M(){var C=Rx();if(N(C))return j(C);u=setTimeout(M,E(C))}function j(C){return u=void 0,y&&r?b(C):(r=i=void 0,o)}function P(){u!==void 0&&clearTimeout(u),h=0,r=c=i=u=void 0}function U(){return u===void 0?o:j(Rx())}function L(){var C=Rx(),z=N(C);if(r=arguments,i=this,c=C,z){if(u===void 0)return k(c);if(g)return clearTimeout(u),u=setTimeout(M,e),b(c)}return u===void 0&&(u=setTimeout(M,e)),o}return L.cancel=P,L.flush=U,L}var L_=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}},lg=at(new L_,"listener"),pY=new hr("MILKDOWN_LISTENER"),Tk=t=>(t.inject(lg,new L_),async()=>{await t.wait(Ho);const{listeners:e}=t.get(lg);e.beforeMount.forEach(h=>h(t)),await t.wait(Zf);const n=t.get(rm);let r=null,i=null,s=null,o=null;const u=hY(()=>{if(!o)return;const{doc:h}=o;if(e.updated.length>0&&r&&!r.eq(h)&&e.updated.forEach(d=>{d(t,h,r)}),e.markdownUpdated.length>0&&r&&!r.eq(h)){const d=n(h);e.markdownUpdated.forEach(g=>{g(t,d,i)}),i=d}r=h,o=null},200),c=new fr({key:pY,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,d)=>{r=d.doc,i=n(d.doc)},apply:h=>{const d=h.selection;(!s&&d||s&&!d.eq(s))&&(e.selectionUpdated.forEach(g=>{g(t,d,s)}),s=d),!(!(h.docChanged||h.storedMarksSet)||h.getMeta("addToHistory")===!1)&&(o=h,u())}}});t.update(Bs,h=>h.concat(c)),await t.wait(om),e.mounted.forEach(h=>h(t))});Tk.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const dY={border:"1px solid #e4e4e7",borderRadius:6,background:"#fff"},mY={padding:"6px 10px",minHeight:60,fontSize:13,lineHeight:1.5,outline:"none"};function gY({value:t,onChange:e}){const n=ae.useRef(null),r=ae.useRef(null),[i,s]=ae.useState(null),o=ae.useRef(t),u=ae.useRef(!1),c=ae.useRef(e);return c.current=e,ae.useEffect(()=>{const h=n.current;if(!h)return;let d=!1;return(async()=>{const y=await V3.make().config(b=>{b.set(th,h),b.set(eh,o.current),b.get(lg).markdownUpdated((k,E)=>{o.current=E})}).use(AR).use(II).use(Tk).create();if(d){y.destroy();return}r.current=y,s(y)})(),()=>{d=!0,r.current?.destroy(),r.current=null,s(null)}},[]),ae.useEffect(()=>{!r.current||u.current||t!==o.current&&(r.current.action(j3(t)),o.current=t)},[t]),I.jsxs("div",{style:dY,children:[I.jsx(qI,{editor:i}),I.jsx("div",{ref:n,style:mY,onFocusCapture:()=>{u.current=!0},onBlurCapture:()=>{u.current=!1,o.current!==t&&c.current(o.current)}})]})}const yY={number:"number",url:"url",date:"date",datetime:"datetime-local",time:"time",email:"email",tel:"tel"};function xY(t){return t!==""&&/^(https?:\/\/|\/|\.\/)/.test(t)}const bY={border:"1px solid #d4d4d8",borderRadius:8,background:"#fafafa",margin:"8px 0",fontSize:13},SY={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"6px 10px",borderBottom:"1px solid #ececed",background:"#f1f1f3",borderTopLeftRadius:8,borderTopRightRadius:8},vY={fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},kY={padding:"8px 10px",display:"flex",flexDirection:"column",gap:8},NT={fontSize:11,color:"#71717a",marginBottom:2},km={width:"100%",boxSizing:"border-box",border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 6px",font:"inherit",background:"#fff"},lh={...km,background:"#f4f4f5",color:"#71717a"},TT={fontSize:10,color:"#a16207",background:"#fef9c3",borderRadius:3,padding:"0 4px",marginLeft:6},CY={border:"none",background:"transparent",color:"#a1a1aa",cursor:"pointer",fontSize:16,lineHeight:1,padding:2},wY={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"};function EY({name:t,value:e,propType:n,editable:r,hasMedia:i,onChange:s,onBrowse:o}){if(n==="boolean")return I.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[I.jsx("input",{type:"checkbox",checked:e==="true",disabled:!r,onChange:c=>s(c.target.checked?"true":"false")}),I.jsx("span",{style:{color:"#52525b"},children:e==="true"?"Yes":"No"})]});if(n==="image")return I.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[xY(e)?I.jsx("img",{src:e,alt:"",style:{maxHeight:96,maxWidth:"100%",objectFit:"contain",borderRadius:4,alignSelf:"flex-start"}}):null,I.jsxs("div",{style:{display:"flex",gap:6},children:[I.jsx("input",{style:r?km:lh,value:e,readOnly:!r,placeholder:"Image URL or path",onChange:r?c=>s(c.target.value):void 0}),r&&i?I.jsx("button",{type:"button",style:wY,"data-mdx-action":"props",onClick:o,children:"Browse"}):null]})]});if(n==="color")return I.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[I.jsx("input",{type:"color",value:e||"#000000",disabled:!r,onChange:c=>s(c.target.value),style:{width:30,height:28,padding:0,border:"1px solid #d4d4d8",borderRadius:4,background:"transparent",cursor:r?"pointer":"default"}}),I.jsx("input",{style:r?km:lh,value:e,readOnly:!r,placeholder:"#000000",onChange:r?c=>s(c.target.value):void 0})]});const u=yY[n]??"text";return I.jsx("input",{type:u,style:r?km:lh,value:e,readOnly:!r,placeholder:`Enter ${t}…`,onChange:r?c=>s(c.target.value):void 0})}function AY({componentName:t,props:e,hasExpressions:n,slotContent:r,definition:i,media:s,mediaContext:o,onRemove:u,onSlotContentChange:c,onPropsChange:h}){const d=i?.slots?.includes("default")??!!c,g=Object.entries(e),[y,b]=ae.useState(null),k=ae.useMemo(()=>{const N=new Map;for(const M of i?.props??[])N.set(M.name,M);return N},[i]),E=(N,M)=>{h&&h({...e,[N]:M})};return I.jsxs("div",{style:bY,"data-cms-ui":"",contentEditable:!1,children:[I.jsxs("div",{style:SY,children:[I.jsxs("span",{style:vY,children:[`<${t} />`,n?I.jsx("span",{style:TT,children:"expr · read-only"}):null]}),I.jsx("button",{type:"button",style:CY,title:"Remove block","data-mdx-action":"remove",onClick:u,children:"×"})]}),I.jsxs("div",{style:kY,children:[d?I.jsxs("div",{"data-mdx-action":"children",children:[I.jsx("div",{style:NT,children:"Content"}),c?I.jsx(gY,{value:r,onChange:c}):I.jsx("div",{style:{...lh,whiteSpace:"pre-wrap",minHeight:40},children:r})]}):null,g.length===0&&!d?I.jsx("div",{style:{color:"#a1a1aa",fontSize:12},children:"No props"}):null,g.map(([N,M])=>{const j=M.startsWith(Bh),P=!!h&&!j,U=k.get(N),L=(U?.type??"").toLowerCase();return I.jsxs("div",{style:{display:"block"},"data-mdx-action":"props",children:[I.jsxs("div",{style:NT,children:[N,U?.required?I.jsx("span",{style:{color:"#dc2626"},children:"*"}):null,j?I.jsx("span",{style:TT,children:"expression"}):null]}),j?I.jsx("input",{style:lh,value:`{${M.slice(Bh.length)}}`,readOnly:!0}):I.jsx(EY,{name:N,value:M,propType:L,editable:P,hasMedia:!!s,onChange:C=>E(N,C),onBrowse:()=>b(N)})]},N)})]}),y!==null&&s?I.jsx(_I,{media:s,context:o,field:y,accept:"image/*",onSelect:N=>{E(y,N),b(null)},onClose:()=>b(null)}):null]})}var Dx={exports:{}},tf={},Ix={exports:{}},_x={};var MT;function NY(){return MT||(MT=1,(function(t){function e(W,ue){var ke=W.length;W.push(ue);e:for(;0<ke;){var ze=ke-1>>>1,D=W[ze];if(0<i(D,ue))W[ze]=ue,W[ke]=D,ke=ze;else break e}}function n(W){return W.length===0?null:W[0]}function r(W){if(W.length===0)return null;var ue=W[0],ke=W.pop();if(ke!==ue){W[0]=ke;e:for(var ze=0,D=W.length,F=D>>>1;ze<F;){var ee=2*(ze+1)-1,V=W[ee],be=ee+1,De=W[be];if(0>i(V,ke))be<D&&0>i(De,V)?(W[ze]=De,W[be]=ke,ze=be):(W[ze]=V,W[ee]=ke,ze=ee);else if(be<D&&0>i(De,ke))W[ze]=De,W[be]=ke,ze=be;else break e}}return ue}function i(W,ue){var ke=W.sortIndex-ue.sortIndex;return ke!==0?ke:W.id-ue.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=[],d=1,g=null,y=3,b=!1,k=!1,E=!1,N=!1,M=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;function U(W){for(var ue=n(h);ue!==null;){if(ue.callback===null)r(h);else if(ue.startTime<=W)r(h),ue.sortIndex=ue.expirationTime,e(c,ue);else break;ue=n(h)}}function L(W){if(E=!1,U(W),!k)if(n(c)!==null)k=!0,C||(C=!0,ce());else{var ue=n(h);ue!==null&&Y(L,ue.startTime-W)}}var C=!1,z=-1,G=5,J=-1;function K(){return N?!0:!(t.unstable_now()-J<G)}function de(){if(N=!1,C){var W=t.unstable_now();J=W;var ue=!0;try{e:{k=!1,E&&(E=!1,j(z),z=-1),b=!0;var ke=y;try{t:{for(U(W),g=n(c);g!==null&&!(g.expirationTime>W&&K());){var ze=g.callback;if(typeof ze=="function"){g.callback=null,y=g.priorityLevel;var D=ze(g.expirationTime<=W);if(W=t.unstable_now(),typeof D=="function"){g.callback=D,U(W),ue=!0;break t}g===n(c)&&r(c),U(W)}else r(c);g=n(c)}if(g!==null)ue=!0;else{var F=n(h);F!==null&&Y(L,F.startTime-W),ue=!1}}break e}finally{g=null,y=ke,b=!1}ue=void 0}}finally{ue?ce():C=!1}}}var ce;if(typeof P=="function")ce=function(){P(de)};else if(typeof MessageChannel<"u"){var Se=new MessageChannel,Re=Se.port2;Se.port1.onmessage=de,ce=function(){Re.postMessage(null)}}else ce=function(){M(de,0)};function Y(W,ue){z=M(function(){W(t.unstable_now())},ue)}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"):G=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 ue=3;break;default:ue=y}var ke=y;y=ue;try{return W()}finally{y=ke}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(W,ue){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ke=y;y=W;try{return ue()}finally{y=ke}},t.unstable_scheduleCallback=function(W,ue,ke){var ze=t.unstable_now();switch(typeof ke=="object"&&ke!==null?(ke=ke.delay,ke=typeof ke=="number"&&0<ke?ze+ke:ze):ke=ze,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=ke+D,W={id:d++,callback:ue,priorityLevel:W,startTime:ke,expirationTime:D,sortIndex:-1},ke>ze?(W.sortIndex=ke,e(h,W),n(c)===null&&W===n(h)&&(E?(j(z),z=-1):E=!0,Y(L,ke-ze))):(W.sortIndex=D,e(c,W),k||b||(k=!0,C||(C=!0,ce()))),W},t.unstable_shouldYield=K,t.unstable_wrapCallback=function(W){var ue=y;return function(){var ke=y;y=ue;try{return W.apply(this,arguments)}finally{y=ke}}}})(_x)),_x}var OT;function TY(){return OT||(OT=1,Ix.exports=NY()),Ix.exports}var zx={exports:{}},xn={};var RT;function MY(){if(RT)return xn;RT=1;var t=hS();function e(c){var h="https://react.dev/errors/"+c;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)h+="&args[]="+encodeURIComponent(arguments[d])}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 r={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},i=Symbol.for("react.portal");function s(c,h,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:c,containerInfo:h,implementation:d}}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 xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,xn.createPortal=function(c,h){var d=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,d)},xn.flushSync=function(c){var h=o.T,d=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=h,r.p=d,r.d.f()}},xn.preconnect=function(c,h){typeof c=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(c,h))},xn.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},xn.preinit=function(c,h){if(typeof c=="string"&&h&&typeof h.as=="string"){var d=h.as,g=u(d,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;d==="style"?r.d.S(c,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:b}):d==="script"&&r.d.X(c,{crossOrigin:g,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},xn.preinitModule=function(c,h){if(typeof c=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var d=u(h.as,h.crossOrigin);r.d.M(c,{crossOrigin:d,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(c)},xn.preload=function(c,h){if(typeof c=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var d=h.as,g=u(d,h.crossOrigin);r.d.L(c,d,{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})}},xn.preloadModule=function(c,h){if(typeof c=="string")if(h){var d=u(h.as,h.crossOrigin);r.d.m(c,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:d,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(c)},xn.requestFormReset=function(c){r.d.r(c)},xn.unstable_batchedUpdates=function(c,h){return c(h)},xn.useFormState=function(c,h,d){return o.H.useFormState(c,h,d)},xn.useFormStatus=function(){return o.H.useHostTransitionStatus()},xn.version="19.2.7",xn}var DT;function OY(){if(DT)return zx.exports;DT=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(),zx.exports=MY(),zx.exports}var IT;function RY(){if(IT)return tf;IT=1;var t=TY(),e=hS(),n=OY();function r(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 i(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(r(188))}function h(a){var l=a.alternate;if(!l){if(l=s(a),l===null)throw Error(r(188));return l!==a?null:a}for(var f=a,m=l;;){var x=f.return;if(x===null)break;var v=x.alternate;if(v===null){if(m=x.return,m!==null){f=m;continue}break}if(x.child===v.child){for(v=x.child;v;){if(v===f)return c(x),a;if(v===m)return c(x),l;v=v.sibling}throw Error(r(188))}if(f.return!==m.return)f=x,m=v;else{for(var A=!1,R=x.child;R;){if(R===f){A=!0,f=x,m=v;break}if(R===m){A=!0,m=x,f=v;break}R=R.sibling}if(!A){for(R=v.child;R;){if(R===f){A=!0,f=v,m=x;break}if(R===m){A=!0,m=v,f=x;break}R=R.sibling}if(!A)throw Error(r(189))}}if(f.alternate!==m)throw Error(r(190))}if(f.tag!==3)throw Error(r(188));return f.stateNode.current===f?a:l}function d(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a;for(a=a.child;a!==null;){if(l=d(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"),k=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),P=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),de=Symbol.iterator;function ce(a){return a===null||typeof a!="object"?null:(a=de&&a[de]||a["@@iterator"],typeof a=="function"?a:null)}var Se=Symbol.for("react.client.reference");function Re(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===Se?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case E:return"Fragment";case M:return"Profiler";case N:return"StrictMode";case L:return"Suspense";case C:return"SuspenseList";case J:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case k:return"Portal";case P:return a.displayName||"Context";case j:return(a._context.displayName||"Context")+".Consumer";case U:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case z:return l=a.displayName||null,l!==null?l:Re(a.type)||"Memo";case G:l=a._payload,a=a._init;try{return Re(a(l))}catch{}}return null}var Y=Array.isArray,W=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ke={pending:!1,data:null,method:null,action:null},ze=[],D=-1;function F(a){return{current:a}}function ee(a){0>D||(a.current=ze[D],ze[D]=null,D--)}function V(a,l){D++,ze[D]=a.current,a.current=l}var be=F(null),De=F(null),Me=F(null),Xe=F(null);function Ct(a,l){switch(V(Me,l),V(De,a),V(be,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?N2(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=N2(l),a=T2(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}ee(be),V(be,a)}function Ze(){ee(be),ee(De),ee(Me)}function zt(a){a.memoizedState!==null&&V(Xe,a);var l=be.current,f=T2(l,a.type);l!==f&&(V(De,a),V(be,f))}function Lt(a){De.current===a&&(ee(be),ee(De)),Xe.current===a&&(ee(Xe),Jc._currentValue=ke)}var Oi,ui;function Wn(a){if(Oi===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);Oi=l&&l[1]||"",ui=-1<f.stack.indexOf(`
93
+ at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
94
+ `+Oi+a+ui}var dr=!1;function Or(a,l){if(!a||dr)return"";dr=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(se){var ie=se}Reflect.construct(a,[],pe)}else{try{pe.call()}catch(se){ie=se}a.call(pe.prototype)}}else{try{throw Error()}catch(se){ie=se}(pe=a())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(se){if(se&&ie&&typeof se.stack=="string")return[se.stack,ie.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=m.DetermineComponentFrameRoot(),A=v[0],R=v[1];if(A&&R){var $=A.split(`
95
+ `),re=R.split(`
96
+ `);for(x=m=0;m<$.length&&!$[m].includes("DetermineComponentFrameRoot");)m++;for(;x<re.length&&!re[x].includes("DetermineComponentFrameRoot");)x++;if(m===$.length||x===re.length)for(m=$.length-1,x=re.length-1;1<=m&&0<=x&&$[m]!==re[x];)x--;for(;1<=m&&0<=x;m--,x--)if($[m]!==re[x]){if(m!==1||x!==1)do if(m--,x--,0>x||$[m]!==re[x]){var oe=`
97
+ `+$[m].replace(" at new "," at ");return a.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",a.displayName)),oe}while(1<=m&&0<=x);break}}}finally{dr=!1,Error.prepareStackTrace=f}return(f=a?a.displayName||a.name:"")?Wn(f):""}function Xn(a,l){switch(a.tag){case 26:case 27:case 5:return Wn(a.type);case 16:return Wn("Lazy");case 13:return a.child!==l&&l!==null?Wn("Suspense Fallback"):Wn("Suspense");case 19:return Wn("SuspenseList");case 0:case 15:return Or(a.type,!1);case 11:return Or(a.type.render,!1);case 1:return Or(a.type,!0);case 31:return Wn("Activity");default:return""}}function mr(a){try{var l="",f=null;do l+=Xn(a,f),f=a,a=a.return;while(a);return l}catch(m){return`
98
+ Error generating stack: `+m.message+`
99
+ `+m.stack}}var ci=Object.prototype.hasOwnProperty,Rn=t.unstable_scheduleCallback,Rr=t.unstable_cancelCallback,Ri=t.unstable_shouldYield,Dr=t.unstable_requestPaint,$e=t.unstable_now,Zi=t.unstable_getCurrentPriorityLevel,le=t.unstable_ImmediatePriority,me=t.unstable_UserBlockingPriority,_=t.unstable_NormalPriority,Ie=t.unstable_LowPriority,Pe=t.unstable_IdlePriority,tn=t.log,Zn=t.unstable_setDisableYieldValue,ve=null,_t=null;function yn(a){if(typeof tn=="function"&&Zn(a),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(ve,a)}catch{}}var St=Math.clz32?Math.clz32:mp,er=Math.log,Dn=Math.LN2;function mp(a){return a>>>=0,a===0?32:31-(er(a)/Dn|0)|0}var kl=256,es=262144,an=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 m=a.pendingLanes;if(m===0)return 0;var x=0,v=a.suspendedLanes,A=a.pingedLanes;a=a.warmLanes;var R=m&134217727;return R!==0?(m=R&~v,m!==0?x=Jt(m):(A&=R,A!==0?x=Jt(A):f||(f=R&~a,f!==0&&(x=Jt(f))))):(R=m&~v,R!==0?x=Jt(R):A!==0?x=Jt(A):f||(f=m&~a,f!==0&&(x=Jt(f)))),x===0?0:l!==0&&l!==x&&(l&v)===0&&(v=x&-x,f=l&-l,v>=f||v===32&&(f&4194048)!==0)?l:x}function Ir(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 ec(){var a=an;return an<<=1,(an&62914560)===0&&(an=4194304),a}function io(a){for(var l=[],f=0;31>f;f++)l.push(a);return l}function so(a,l){a.pendingLanes|=l,l!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Cl(a,l,f,m,x,v){var A=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,re=a.hiddenUpdates;for(f=A&~f;0<f;){var oe=31-St(f),pe=1<<oe;R[oe]=0,$[oe]=-1;var ie=re[oe];if(ie!==null)for(re[oe]=null,oe=0;oe<ie.length;oe++){var se=ie[oe];se!==null&&(se.lane&=-536870913)}f&=~pe}m!==0&&fi(a,m,0),v!==0&&x===0&&a.tag!==0&&(a.suspendedLanes|=v&~(A&~l))}function fi(a,l,f){a.pendingLanes|=l,a.suspendedLanes&=~l;var m=31-St(l);a.entangledLanes|=l,a.entanglements[m]=a.entanglements[m]|1073741824|f&261930}function gp(a,l){var f=a.entangledLanes|=l;for(a=a.entanglements;f;){var m=31-St(f),x=1<<m;x&l|a[m]&l&&(a[m]|=l),f&=~x}}function Gs(a,l){var f=l&-l;return f=(f&42)!==0?1:ts(f),(f&(a.suspendedLanes|l))!==0?0:f}function ts(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 wl(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function yp(){var a=ue.p;return a!==0?a:(a=window.event,a===void 0?32:W2(a.type))}function tc(a,l){var f=ue.p;try{return ue.p=a,l()}finally{ue.p=f}}var hi=Math.random().toString(36).slice(2),qt="__reactFiber$"+hi,on="__reactProps$"+hi,ns="__reactContainer$"+hi,nc="__reactEvents$"+hi,t0="__reactListeners$"+hi,n0="__reactHandles$"+hi,xp="__reactResources$"+hi,Ys="__reactMarker$"+hi;function El(a){delete a[qt],delete a[on],delete a[nc],delete a[t0],delete a[n0]}function rs(a){var l=a[qt];if(l)return l;for(var f=a.parentNode;f;){if(l=f[ns]||f[qt]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(a=z2(a);a!==null;){if(f=a[qt])return f;a=z2(a)}return l}a=f,f=a.parentNode}return null}function is(a){if(a=a[qt]||a[ns]){var l=a.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return a}return null}function Qs(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a.stateNode;throw Error(r(33))}function ss(a){var l=a[xp];return l||(l=a[xp]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Ht(a){a[Ys]=!0}var bp=new Set,rc={};function as(a,l){Di(a,l),Di(a+"Capture",l)}function Di(a,l){for(rc[a]=l,a=0;a<l.length;a++)bp.add(l[a])}var Sp=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]*$"),vp={},we={};function Al(a){return ci.call(we,a)?!0:ci.call(vp,a)?!1:Sp.test(a)?we[a]=!0:(vp[a]=!0,!1)}function In(a,l,f){if(Al(l))if(f===null)a.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":a.removeAttribute(l);return;case"boolean":var m=l.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){a.removeAttribute(l);return}}a.setAttribute(l,""+f)}}function Nl(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 pi(a,l,f,m){if(m===null)a.removeAttribute(f);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(f);return}a.setAttributeNS(l,f,""+m)}}function _n(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function kp(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function r0(a,l,f){var m=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);if(!a.hasOwnProperty(l)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var x=m.get,v=m.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return x.call(this)},set:function(A){f=""+A,v.call(this,A)}}),Object.defineProperty(a,l,{enumerable:m.enumerable}),{getValue:function(){return f},setValue:function(A){f=""+A},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function Tl(a){if(!a._valueTracker){var l=kp(a)?"checked":"value";a._valueTracker=r0(a,l,""+a[l])}}function Cp(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var f=l.getValue(),m="";return a&&(m=kp(a)?a.checked?"true":"false":a.value),a=m,a!==f?(l.setValue(a),!0):!1}function ao(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 di=/[\n"\\]/g;function Tt(a){return a.replace(di,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ic(a,l,f,m,x,v,A,R){a.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?a.type=A:a.removeAttribute("type"),l!=null?A==="number"?(l===0&&a.value===""||a.value!=l)&&(a.value=""+_n(l)):a.value!==""+_n(l)&&(a.value=""+_n(l)):A!=="submit"&&A!=="reset"||a.removeAttribute("value"),l!=null?ac(a,A,_n(l)):f!=null?ac(a,A,_n(f)):m!=null&&a.removeAttribute("value"),x==null&&v!=null&&(a.defaultChecked=!!v),x!=null&&(a.checked=x&&typeof x!="function"&&typeof x!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?a.name=""+_n(R):a.removeAttribute("name")}function sc(a,l,f,m,x,v,A,R){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(a.type=v),l!=null||f!=null){if(!(v!=="submit"&&v!=="reset"||l!=null)){Tl(a);return}f=f!=null?""+_n(f):"",l=l!=null?""+_n(l):f,R||l===a.value||(a.value=l),a.defaultValue=l}m=m??x,m=typeof m!="function"&&typeof m!="symbol"&&!!m,a.checked=R?a.checked:!!m,a.defaultChecked=!!m,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(a.name=A),Tl(a)}function ac(a,l,f){l==="number"&&ao(a.ownerDocument)===a||a.defaultValue===""+f||(a.defaultValue=""+f)}function Ws(a,l,f,m){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&&m&&(a[f].defaultSelected=!0)}else{for(f=""+_n(f),l=null,x=0;x<a.length;x++){if(a[x].value===f){a[x].selected=!0,m&&(a[x].defaultSelected=!0);return}l!==null||a[x].disabled||(l=a[x])}l!==null&&(l.selected=!0)}}function wp(a,l,f){if(l!=null&&(l=""+_n(l),l!==a.value&&(a.value=l),f==null)){a.defaultValue!==l&&(a.defaultValue=l);return}a.defaultValue=f!=null?""+_n(f):""}function Ep(a,l,f,m){if(l==null){if(m!=null){if(f!=null)throw Error(r(92));if(Y(m)){if(1<m.length)throw Error(r(93));m=m[0]}f=m}f==null&&(f=""),l=f}f=_n(l),a.defaultValue=f,m=a.textContent,m===f&&m!==""&&m!==null&&(a.value=m),Tl(a)}function mi(a,l){if(l){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=l;return}}a.textContent=l}var Ap=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 oc(a,l,f){var m=l.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?m?a.setProperty(l,""):l==="float"?a.cssFloat="":a[l]="":m?a.setProperty(l,f):typeof f!="number"||f===0||Ap.has(l)?l==="float"?a.cssFloat=f:a[l]=(""+f).trim():a[l]=f+"px"}function lc(a,l,f){if(l!=null&&typeof l!="object")throw Error(r(62));if(a=a.style,f!=null){for(var m in f)!f.hasOwnProperty(m)||l!=null&&l.hasOwnProperty(m)||(m.indexOf("--")===0?a.setProperty(m,""):m==="float"?a.cssFloat="":a[m]="");for(var x in l)m=l[x],l.hasOwnProperty(x)&&f[x]!==m&&oc(a,x,m)}else for(var v in l)l.hasOwnProperty(v)&&oc(a,v,l[v])}function Xs(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 et=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"]]),i0=/^[\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 oo(a){return i0.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function _r(){}var Ml=null;function uc(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Zs=null,ea=null;function p(a){var l=is(a);if(l&&(a=l.stateNode)){var f=a[on]||null;e:switch(a=l.stateNode,l.type){case"input":if(ic(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 m=f[l];if(m!==a&&m.form===a.form){var x=m[on]||null;if(!x)throw Error(r(90));ic(m,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(l=0;l<f.length;l++)m=f[l],m.form===a.form&&Cp(m)}break e;case"textarea":wp(a,f.value,f.defaultValue);break e;case"select":l=f.value,l!=null&&Ws(a,!!f.multiple,l,!1)}}}var S=!1;function w(a,l,f){if(S)return a(l,f);S=!0;try{var m=a(l);return m}finally{if(S=!1,(Zs!==null||ea!==null)&&(ud(),Zs&&(l=Zs,a=ea,ea=Zs=null,p(l),a)))for(l=0;l<a.length;l++)p(a[l])}}function T(a,l){var f=a.stateNode;if(f===null)return null;var m=f[on]||null;if(m===null)return null;f=m[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":(m=!m.disabled)||(a=a.type,m=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!m;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(r(231,l,typeof f));return f}var B=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Z=!1;if(B)try{var ne={};Object.defineProperty(ne,"passive",{get:function(){Z=!0}}),window.addEventListener("test",ne,ne),window.removeEventListener("test",ne,ne)}catch{Z=!1}var ge=null,xe=null,Le=null;function Ge(){if(Le)return Le;var a,l=xe,f=l.length,m,x="value"in ge?ge.value:ge.textContent,v=x.length;for(a=0;a<f&&l[a]===x[a];a++);var A=f-a;for(m=1;m<=A&&l[f-m]===x[v-m];m++);return Le=x.slice(a,1<m?1-m: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 ta(){return!1}function Pt(a){function l(f,m,x,v,A){this._reactName=f,this._targetInst=x,this.type=m,this.nativeEvent=v,this.target=A,this.currentTarget=null;for(var R in a)a.hasOwnProperty(R)&&(f=a[R],this[R]=f?f(v):v[R]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ft:ta,this.isPropagationStopped=ta,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 zr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gi=Pt(zr),Lr=g({},zr,{view:0,detail:0}),j_=Pt(Lr),s0,a0,cc,Np=g({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:l0,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!==cc&&(cc&&a.type==="mousemove"?(s0=a.screenX-cc.screenX,a0=a.screenY-cc.screenY):a0=s0=0,cc=a),s0)},movementY:function(a){return"movementY"in a?a.movementY:a0}}),Ok=Pt(Np),$_=g({},Np,{dataTransfer:0}),U_=Pt($_),J_=g({},Lr,{relatedTarget:0}),o0=Pt(J_),q_=g({},zr,{animationName:0,elapsedTime:0,pseudoElement:0}),H_=Pt(q_),K_=g({},zr,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),G_=Pt(K_),Y_=g({},zr,{data:0}),Rk=Pt(Y_),Q_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W_={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"},X_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z_(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=X_[a])?!!l[a]:!1}function l0(){return Z_}var e6=g({},Lr,{key:function(a){if(a.key){var l=Q_[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"?W_[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:l0,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}}),t6=Pt(e6),n6=g({},Np,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dk=Pt(n6),r6=g({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:l0}),i6=Pt(r6),s6=g({},zr,{propertyName:0,elapsedTime:0,pseudoElement:0}),a6=Pt(s6),o6=g({},Np,{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}),l6=Pt(o6),u6=g({},zr,{newState:0,oldState:0}),c6=Pt(u6),f6=[9,13,27,32],u0=B&&"CompositionEvent"in window,fc=null;B&&"documentMode"in document&&(fc=document.documentMode);var h6=B&&"TextEvent"in window&&!fc,Ik=B&&(!u0||fc&&8<fc&&11>=fc),_k=" ",zk=!1;function Lk(a,l){switch(a){case"keyup":return f6.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bk(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ol=!1;function p6(a,l){switch(a){case"compositionend":return Bk(l);case"keypress":return l.which!==32?null:(zk=!0,_k);case"textInput":return a=l.data,a===_k&&zk?null:a;default:return null}}function d6(a,l){if(Ol)return a==="compositionend"||!u0&&Lk(a,l)?(a=Ge(),Le=xe=ge=null,Ol=!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 Ik&&l.locale!=="ko"?null:l.data;default:return null}}var m6={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 Vk(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!m6[a.type]:l==="textarea"}function Fk(a,l,f,m){Zs?ea?ea.push(m):ea=[m]:Zs=m,l=gd(l,"onChange"),0<l.length&&(f=new gi("onChange","change",null,f,m),a.push({event:f,listeners:l}))}var hc=null,pc=null;function g6(a){v2(a,0)}function Tp(a){var l=Qs(a);if(Cp(l))return a}function Pk(a,l){if(a==="change")return l}var jk=!1;if(B){var c0;if(B){var f0="oninput"in document;if(!f0){var $k=document.createElement("div");$k.setAttribute("oninput","return;"),f0=typeof $k.oninput=="function"}c0=f0}else c0=!1;jk=c0&&(!document.documentMode||9<document.documentMode)}function Uk(){hc&&(hc.detachEvent("onpropertychange",Jk),pc=hc=null)}function Jk(a){if(a.propertyName==="value"&&Tp(pc)){var l=[];Fk(l,pc,a,uc(a)),w(g6,l)}}function y6(a,l,f){a==="focusin"?(Uk(),hc=l,pc=f,hc.attachEvent("onpropertychange",Jk)):a==="focusout"&&Uk()}function x6(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Tp(pc)}function b6(a,l){if(a==="click")return Tp(l)}function S6(a,l){if(a==="input"||a==="change")return Tp(l)}function v6(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var gr=typeof Object.is=="function"?Object.is:v6;function dc(a,l){if(gr(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var f=Object.keys(a),m=Object.keys(l);if(f.length!==m.length)return!1;for(m=0;m<f.length;m++){var x=f[m];if(!ci.call(l,x)||!gr(a[x],l[x]))return!1}return!0}function qk(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Hk(a,l){var f=qk(a);a=0;for(var m;f;){if(f.nodeType===3){if(m=a+f.textContent.length,a<=l&&m>=l)return{node:f,offset:l-a};a=m}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=qk(f)}}function Kk(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?Kk(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function Gk(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var l=ao(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=ao(a.document)}return l}function h0(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 k6=B&&"documentMode"in document&&11>=document.documentMode,Rl=null,p0=null,mc=null,d0=!1;function Yk(a,l,f){var m=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;d0||Rl==null||Rl!==ao(m)||(m=Rl,"selectionStart"in m&&h0(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),mc&&dc(mc,m)||(mc=m,m=gd(p0,"onSelect"),0<m.length&&(l=new gi("onSelect","select",null,l,f),a.push({event:l,listeners:m}),l.target=Rl)))}function lo(a,l){var f={};return f[a.toLowerCase()]=l.toLowerCase(),f["Webkit"+a]="webkit"+l,f["Moz"+a]="moz"+l,f}var Dl={animationend:lo("Animation","AnimationEnd"),animationiteration:lo("Animation","AnimationIteration"),animationstart:lo("Animation","AnimationStart"),transitionrun:lo("Transition","TransitionRun"),transitionstart:lo("Transition","TransitionStart"),transitioncancel:lo("Transition","TransitionCancel"),transitionend:lo("Transition","TransitionEnd")},m0={},Qk={};B&&(Qk=document.createElement("div").style,"AnimationEvent"in window||(delete Dl.animationend.animation,delete Dl.animationiteration.animation,delete Dl.animationstart.animation),"TransitionEvent"in window||delete Dl.transitionend.transition);function uo(a){if(m0[a])return m0[a];if(!Dl[a])return a;var l=Dl[a],f;for(f in l)if(l.hasOwnProperty(f)&&f in Qk)return m0[a]=l[f];return a}var Wk=uo("animationend"),Xk=uo("animationiteration"),Zk=uo("animationstart"),C6=uo("transitionrun"),w6=uo("transitionstart"),E6=uo("transitioncancel"),eC=uo("transitionend"),tC=new Map,g0="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(" ");g0.push("scrollEnd");function yi(a,l){tC.set(a,l),as(l,[a])}var Mp=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)},Br=[],Il=0,y0=0;function Op(){for(var a=Il,l=y0=Il=0;l<a;){var f=Br[l];Br[l++]=null;var m=Br[l];Br[l++]=null;var x=Br[l];Br[l++]=null;var v=Br[l];if(Br[l++]=null,m!==null&&x!==null){var A=m.pending;A===null?x.next=x:(x.next=A.next,A.next=x),m.pending=x}v!==0&&nC(f,x,v)}}function Rp(a,l,f,m){Br[Il++]=a,Br[Il++]=l,Br[Il++]=f,Br[Il++]=m,y0|=m,a.lanes|=m,a=a.alternate,a!==null&&(a.lanes|=m)}function x0(a,l,f,m){return Rp(a,l,f,m),Dp(a)}function co(a,l){return Rp(a,null,null,l),Dp(a)}function nC(a,l,f){a.lanes|=f;var m=a.alternate;m!==null&&(m.lanes|=f);for(var x=!1,v=a.return;v!==null;)v.childLanes|=f,m=v.alternate,m!==null&&(m.childLanes|=f),v.tag===22&&(a=v.stateNode,a===null||a._visibility&1||(x=!0)),a=v,v=v.return;return a.tag===3?(v=a.stateNode,x&&l!==null&&(x=31-St(f),a=v.hiddenUpdates,m=a[x],m===null?a[x]=[l]:m.push(l),l.lane=f|536870912),v):null}function Dp(a){if(50<Bc)throw Bc=0,Ny=null,Error(r(185));for(var l=a.return;l!==null;)a=l,l=a.return;return a.tag===3?a.stateNode:null}var _l={};function A6(a,l,f,m){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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yr(a,l,f,m){return new A6(a,l,f,m)}function b0(a){return a=a.prototype,!(!a||!a.isReactComponent)}function ls(a,l){var f=a.alternate;return f===null?(f=yr(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 rC(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 Ip(a,l,f,m,x,v){var A=0;if(m=a,typeof a=="function")b0(a)&&(A=1);else if(typeof a=="string")A=R4(a,f,be.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case J:return a=yr(31,f,l,x),a.elementType=J,a.lanes=v,a;case E:return fo(f.children,x,v,l);case N:A=8,x|=24;break;case M:return a=yr(12,f,l,x|2),a.elementType=M,a.lanes=v,a;case L:return a=yr(13,f,l,x),a.elementType=L,a.lanes=v,a;case C:return a=yr(19,f,l,x),a.elementType=C,a.lanes=v,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case P:A=10;break e;case j:A=9;break e;case U:A=11;break e;case z:A=14;break e;case G:A=16,m=null;break e}A=29,f=Error(r(130,a===null?"null":typeof a,"")),m=null}return l=yr(A,f,l,x),l.elementType=a,l.type=m,l.lanes=v,l}function fo(a,l,f,m){return a=yr(7,a,m,l),a.lanes=f,a}function S0(a,l,f){return a=yr(6,a,null,l),a.lanes=f,a}function iC(a){var l=yr(18,null,null,0);return l.stateNode=a,l}function v0(a,l,f){return l=yr(4,a.children!==null?a.children:[],a.key,l),l.lanes=f,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}var sC=new WeakMap;function Vr(a,l){if(typeof a=="object"&&a!==null){var f=sC.get(a);return f!==void 0?f:(l={value:a,source:l,stack:mr(l)},sC.set(a,l),l)}return{value:a,source:l,stack:mr(l)}}var zl=[],Ll=0,_p=null,gc=0,Fr=[],Pr=0,na=null,Ii=1,_i="";function us(a,l){zl[Ll++]=gc,zl[Ll++]=_p,_p=a,gc=l}function aC(a,l,f){Fr[Pr++]=Ii,Fr[Pr++]=_i,Fr[Pr++]=na,na=a;var m=Ii;a=_i;var x=32-St(m)-1;m&=~(1<<x),f+=1;var v=32-St(l)+x;if(30<v){var A=x-x%5;v=(m&(1<<A)-1).toString(32),m>>=A,x-=A,Ii=1<<32-St(l)+x|f<<x|m,_i=v+a}else Ii=1<<v|f<<x|m,_i=a}function k0(a){a.return!==null&&(us(a,1),aC(a,1,0))}function C0(a){for(;a===_p;)_p=zl[--Ll],zl[Ll]=null,gc=zl[--Ll],zl[Ll]=null;for(;a===na;)na=Fr[--Pr],Fr[Pr]=null,_i=Fr[--Pr],Fr[Pr]=null,Ii=Fr[--Pr],Fr[Pr]=null}function oC(a,l){Fr[Pr++]=Ii,Fr[Pr++]=_i,Fr[Pr++]=na,Ii=l.id,_i=l.overflow,na=a}var ln=null,Mt=null,lt=!1,ra=null,jr=!1,w0=Error(r(519));function ia(a){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yc(Vr(l,a)),w0}function lC(a){var l=a.stateNode,f=a.type,m=a.memoizedProps;switch(l[qt]=a,l[on]=m,f){case"dialog":rt("cancel",l),rt("close",l);break;case"iframe":case"object":case"embed":rt("load",l);break;case"video":case"audio":for(f=0;f<Fc.length;f++)rt(Fc[f],l);break;case"source":rt("error",l);break;case"img":case"image":case"link":rt("error",l),rt("load",l);break;case"details":rt("toggle",l);break;case"input":rt("invalid",l),sc(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":rt("invalid",l);break;case"textarea":rt("invalid",l),Ep(l,m.value,m.defaultValue,m.children)}f=m.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||l.textContent===""+f||m.suppressHydrationWarning===!0||E2(l.textContent,f)?(m.popover!=null&&(rt("beforetoggle",l),rt("toggle",l)),m.onScroll!=null&&rt("scroll",l),m.onScrollEnd!=null&&rt("scrollend",l),m.onClick!=null&&(l.onclick=_r),l=!0):l=!1,l||ia(a,!0)}function uC(a){for(ln=a.return;ln;)switch(ln.tag){case 5:case 31:case 13:jr=!1;return;case 27:case 3:jr=!0;return;default:ln=ln.return}}function Bl(a){if(a!==ln)return!1;if(!lt)return uC(a),lt=!0,!1;var l=a.tag,f;if((f=l!==3&&l!==27)&&((f=l===5)&&(f=a.type,f=!(f!=="form"&&f!=="button")||$y(a.type,a.memoizedProps)),f=!f),f&&Mt&&ia(a),uC(a),l===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Mt=_2(a)}else if(l===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Mt=_2(a)}else l===27?(l=Mt,xa(a.type)?(a=Ky,Ky=null,Mt=a):Mt=l):Mt=ln?Ur(a.stateNode.nextSibling):null;return!0}function ho(){Mt=ln=null,lt=!1}function E0(){var a=ra;return a!==null&&(ir===null?ir=a:ir.push.apply(ir,a),ra=null),a}function yc(a){ra===null?ra=[a]:ra.push(a)}var A0=F(null),po=null,cs=null;function sa(a,l,f){V(A0,l._currentValue),l._currentValue=f}function fs(a){a._currentValue=A0.current,ee(A0)}function N0(a,l,f){for(;a!==null;){var m=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),a===f)break;a=a.return}}function T0(a,l,f,m){var x=a.child;for(x!==null&&(x.return=a);x!==null;){var v=x.dependencies;if(v!==null){var A=x.child;v=v.firstContext;e:for(;v!==null;){var R=v;v=x;for(var $=0;$<l.length;$++)if(R.context===l[$]){v.lanes|=f,R=v.alternate,R!==null&&(R.lanes|=f),N0(v.return,f,a),m||(A=null);break e}v=R.next}}else if(x.tag===18){if(A=x.return,A===null)throw Error(r(341));A.lanes|=f,v=A.alternate,v!==null&&(v.lanes|=f),N0(A,f,a),A=null}else A=x.child;if(A!==null)A.return=x;else for(A=x;A!==null;){if(A===a){A=null;break}if(x=A.sibling,x!==null){x.return=A.return,A=x;break}A=A.return}x=A}}function Vl(a,l,f,m){a=null;for(var x=l,v=!1;x!==null;){if(!v){if((x.flags&524288)!==0)v=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var A=x.alternate;if(A===null)throw Error(r(387));if(A=A.memoizedProps,A!==null){var R=x.type;gr(x.pendingProps.value,A.value)||(a!==null?a.push(R):a=[R])}}else if(x===Xe.current){if(A=x.alternate,A===null)throw Error(r(387));A.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(a!==null?a.push(Jc):a=[Jc])}x=x.return}a!==null&&T0(l,a,f,m),l.flags|=262144}function zp(a){for(a=a.firstContext;a!==null;){if(!gr(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function mo(a){po=a,cs=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function un(a){return cC(po,a)}function Lp(a,l){return po===null&&mo(a),cC(a,l)}function cC(a,l){var f=l._currentValue;if(l={context:l,memoizedValue:f,next:null},cs===null){if(a===null)throw Error(r(308));cs=l,a.dependencies={lanes:0,firstContext:l},a.flags|=524288}else cs=cs.next=l;return f}var N6=typeof AbortController<"u"?AbortController:function(){var a=[],l=this.signal={aborted:!1,addEventListener:function(f,m){a.push(m)}};this.abort=function(){l.aborted=!0,a.forEach(function(f){return f()})}},T6=t.unstable_scheduleCallback,M6=t.unstable_NormalPriority,Kt={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function M0(){return{controller:new N6,data:new Map,refCount:0}}function xc(a){a.refCount--,a.refCount===0&&T6(M6,function(){a.controller.abort()})}var bc=null,O0=0,Fl=0,Pl=null;function O6(a,l){if(bc===null){var f=bc=[];O0=0,Fl=Iy(),Pl={status:"pending",value:void 0,then:function(m){f.push(m)}}}return O0++,l.then(fC,fC),l}function fC(){if(--O0===0&&bc!==null){Pl!==null&&(Pl.status="fulfilled");var a=bc;bc=null,Fl=0,Pl=null;for(var l=0;l<a.length;l++)(0,a[l])()}}function R6(a,l){var f=[],m={status:"pending",value:null,reason:null,then:function(x){f.push(x)}};return a.then(function(){m.status="fulfilled",m.value=l;for(var x=0;x<f.length;x++)(0,f[x])(l)},function(x){for(m.status="rejected",m.reason=x,x=0;x<f.length;x++)(0,f[x])(void 0)}),m}var hC=W.S;W.S=function(a,l){Yw=$e(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&O6(a,l),hC!==null&&hC(a,l)};var go=F(null);function R0(){var a=go.current;return a!==null?a:Nt.pooledCache}function Bp(a,l){l===null?V(go,go.current):V(go,l.pool)}function pC(){var a=R0();return a===null?null:{parent:Kt._currentValue,pool:a}}var jl=Error(r(460)),D0=Error(r(474)),Vp=Error(r(542)),Fp={then:function(){}};function dC(a){return a=a.status,a==="fulfilled"||a==="rejected"}function mC(a,l,f){switch(f=a[f],f===void 0?a.push(l):f!==l&&(l.then(_r,_r),l=f),l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,yC(a),a;default:if(typeof l.status=="string")l.then(_r,_r);else{if(a=Nt,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=l,a.status="pending",a.then(function(m){if(l.status==="pending"){var x=l;x.status="fulfilled",x.value=m}},function(m){if(l.status==="pending"){var x=l;x.status="rejected",x.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,yC(a),a}throw xo=l,jl}}function yo(a){try{var l=a._init;return l(a._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(xo=f,jl):f}}var xo=null;function gC(){if(xo===null)throw Error(r(459));var a=xo;return xo=null,a}function yC(a){if(a===jl||a===Vp)throw Error(r(483))}var $l=null,Sc=0;function Pp(a){var l=Sc;return Sc+=1,$l===null&&($l=[]),mC($l,a,l)}function vc(a,l){l=l.props.ref,a.ref=l!==void 0?l:null}function jp(a,l){throw l.$$typeof===y?Error(r(525)):(a=Object.prototype.toString.call(l),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a)))}function xC(a){function l(X,q){if(a){var te=X.deletions;te===null?(X.deletions=[q],X.flags|=16):te.push(q)}}function f(X,q){if(!a)return null;for(;q!==null;)l(X,q),q=q.sibling;return null}function m(X){for(var q=new Map;X!==null;)X.key!==null?q.set(X.key,X):q.set(X.index,X),X=X.sibling;return q}function x(X,q){return X=ls(X,q),X.index=0,X.sibling=null,X}function v(X,q,te){return X.index=te,a?(te=X.alternate,te!==null?(te=te.index,te<q?(X.flags|=67108866,q):te):(X.flags|=67108866,q)):(X.flags|=1048576,q)}function A(X){return a&&X.alternate===null&&(X.flags|=67108866),X}function R(X,q,te,fe){return q===null||q.tag!==6?(q=S0(te,X.mode,fe),q.return=X,q):(q=x(q,te),q.return=X,q)}function $(X,q,te,fe){var _e=te.type;return _e===E?oe(X,q,te.props.children,fe,te.key):q!==null&&(q.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===G&&yo(_e)===q.type)?(q=x(q,te.props),vc(q,te),q.return=X,q):(q=Ip(te.type,te.key,te.props,null,X.mode,fe),vc(q,te),q.return=X,q)}function re(X,q,te,fe){return q===null||q.tag!==4||q.stateNode.containerInfo!==te.containerInfo||q.stateNode.implementation!==te.implementation?(q=v0(te,X.mode,fe),q.return=X,q):(q=x(q,te.children||[]),q.return=X,q)}function oe(X,q,te,fe,_e){return q===null||q.tag!==7?(q=fo(te,X.mode,fe,_e),q.return=X,q):(q=x(q,te),q.return=X,q)}function pe(X,q,te){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=S0(""+q,X.mode,te),q.return=X,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case b:return te=Ip(q.type,q.key,q.props,null,X.mode,te),vc(te,q),te.return=X,te;case k:return q=v0(q,X.mode,te),q.return=X,q;case G:return q=yo(q),pe(X,q,te)}if(Y(q)||ce(q))return q=fo(q,X.mode,te,null),q.return=X,q;if(typeof q.then=="function")return pe(X,Pp(q),te);if(q.$$typeof===P)return pe(X,Lp(X,q),te);jp(X,q)}return null}function ie(X,q,te,fe){var _e=q!==null?q.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return _e!==null?null:R(X,q,""+te,fe);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case b:return te.key===_e?$(X,q,te,fe):null;case k:return te.key===_e?re(X,q,te,fe):null;case G:return te=yo(te),ie(X,q,te,fe)}if(Y(te)||ce(te))return _e!==null?null:oe(X,q,te,fe,null);if(typeof te.then=="function")return ie(X,q,Pp(te),fe);if(te.$$typeof===P)return ie(X,q,Lp(X,te),fe);jp(X,te)}return null}function se(X,q,te,fe,_e){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return X=X.get(te)||null,R(q,X,""+fe,_e);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return X=X.get(fe.key===null?te:fe.key)||null,$(q,X,fe,_e);case k:return X=X.get(fe.key===null?te:fe.key)||null,re(q,X,fe,_e);case G:return fe=yo(fe),se(X,q,te,fe,_e)}if(Y(fe)||ce(fe))return X=X.get(te)||null,oe(q,X,fe,_e,null);if(typeof fe.then=="function")return se(X,q,te,Pp(fe),_e);if(fe.$$typeof===P)return se(X,q,te,Lp(q,fe),_e);jp(q,fe)}return null}function Ee(X,q,te,fe){for(var _e=null,ht=null,Oe=q,Qe=q=0,st=null;Oe!==null&&Qe<te.length;Qe++){Oe.index>Qe?(st=Oe,Oe=null):st=Oe.sibling;var pt=ie(X,Oe,te[Qe],fe);if(pt===null){Oe===null&&(Oe=st);break}a&&Oe&&pt.alternate===null&&l(X,Oe),q=v(pt,q,Qe),ht===null?_e=pt:ht.sibling=pt,ht=pt,Oe=st}if(Qe===te.length)return f(X,Oe),lt&&us(X,Qe),_e;if(Oe===null){for(;Qe<te.length;Qe++)Oe=pe(X,te[Qe],fe),Oe!==null&&(q=v(Oe,q,Qe),ht===null?_e=Oe:ht.sibling=Oe,ht=Oe);return lt&&us(X,Qe),_e}for(Oe=m(Oe);Qe<te.length;Qe++)st=se(Oe,X,Qe,te[Qe],fe),st!==null&&(a&&st.alternate!==null&&Oe.delete(st.key===null?Qe:st.key),q=v(st,q,Qe),ht===null?_e=st:ht.sibling=st,ht=st);return a&&Oe.forEach(function(Ca){return l(X,Ca)}),lt&&us(X,Qe),_e}function Be(X,q,te,fe){if(te==null)throw Error(r(151));for(var _e=null,ht=null,Oe=q,Qe=q=0,st=null,pt=te.next();Oe!==null&&!pt.done;Qe++,pt=te.next()){Oe.index>Qe?(st=Oe,Oe=null):st=Oe.sibling;var Ca=ie(X,Oe,pt.value,fe);if(Ca===null){Oe===null&&(Oe=st);break}a&&Oe&&Ca.alternate===null&&l(X,Oe),q=v(Ca,q,Qe),ht===null?_e=Ca:ht.sibling=Ca,ht=Ca,Oe=st}if(pt.done)return f(X,Oe),lt&&us(X,Qe),_e;if(Oe===null){for(;!pt.done;Qe++,pt=te.next())pt=pe(X,pt.value,fe),pt!==null&&(q=v(pt,q,Qe),ht===null?_e=pt:ht.sibling=pt,ht=pt);return lt&&us(X,Qe),_e}for(Oe=m(Oe);!pt.done;Qe++,pt=te.next())pt=se(Oe,X,Qe,pt.value,fe),pt!==null&&(a&&pt.alternate!==null&&Oe.delete(pt.key===null?Qe:pt.key),q=v(pt,q,Qe),ht===null?_e=pt:ht.sibling=pt,ht=pt);return a&&Oe.forEach(function($4){return l(X,$4)}),lt&&us(X,Qe),_e}function At(X,q,te,fe){if(typeof te=="object"&&te!==null&&te.type===E&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case b:e:{for(var _e=te.key;q!==null;){if(q.key===_e){if(_e=te.type,_e===E){if(q.tag===7){f(X,q.sibling),fe=x(q,te.props.children),fe.return=X,X=fe;break e}}else if(q.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===G&&yo(_e)===q.type){f(X,q.sibling),fe=x(q,te.props),vc(fe,te),fe.return=X,X=fe;break e}f(X,q);break}else l(X,q);q=q.sibling}te.type===E?(fe=fo(te.props.children,X.mode,fe,te.key),fe.return=X,X=fe):(fe=Ip(te.type,te.key,te.props,null,X.mode,fe),vc(fe,te),fe.return=X,X=fe)}return A(X);case k:e:{for(_e=te.key;q!==null;){if(q.key===_e)if(q.tag===4&&q.stateNode.containerInfo===te.containerInfo&&q.stateNode.implementation===te.implementation){f(X,q.sibling),fe=x(q,te.children||[]),fe.return=X,X=fe;break e}else{f(X,q);break}else l(X,q);q=q.sibling}fe=v0(te,X.mode,fe),fe.return=X,X=fe}return A(X);case G:return te=yo(te),At(X,q,te,fe)}if(Y(te))return Ee(X,q,te,fe);if(ce(te)){if(_e=ce(te),typeof _e!="function")throw Error(r(150));return te=_e.call(te),Be(X,q,te,fe)}if(typeof te.then=="function")return At(X,q,Pp(te),fe);if(te.$$typeof===P)return At(X,q,Lp(X,te),fe);jp(X,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,q!==null&&q.tag===6?(f(X,q.sibling),fe=x(q,te),fe.return=X,X=fe):(f(X,q),fe=S0(te,X.mode,fe),fe.return=X,X=fe),A(X)):f(X,q)}return function(X,q,te,fe){try{Sc=0;var _e=At(X,q,te,fe);return $l=null,_e}catch(Oe){if(Oe===jl||Oe===Vp)throw Oe;var ht=yr(29,Oe,null,X.mode);return ht.lanes=fe,ht.return=X,ht}}}var bo=xC(!0),bC=xC(!1),aa=!1;function I0(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _0(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 oa(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function la(a,l,f){var m=a.updateQueue;if(m===null)return null;if(m=m.shared,(dt&2)!==0){var x=m.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),m.pending=l,l=Dp(a),nC(a,null,f),l}return Rp(a,m,l,f),Dp(a)}function kc(a,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194048)!==0)){var m=l.lanes;m&=a.pendingLanes,f|=m,l.lanes=f,gp(a,f)}}function z0(a,l){var f=a.updateQueue,m=a.alternate;if(m!==null&&(m=m.updateQueue,f===m)){var x=null,v=null;if(f=f.firstBaseUpdate,f!==null){do{var A={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};v===null?x=v=A:v=v.next=A,f=f.next}while(f!==null);v===null?x=v=l:v=v.next=l}else x=v=l;f={baseState:m.baseState,firstBaseUpdate:x,lastBaseUpdate:v,shared:m.shared,callbacks:m.callbacks},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=l}var L0=!1;function Cc(){if(L0){var a=Pl;if(a!==null)throw a}}function wc(a,l,f,m){L0=!1;var x=a.updateQueue;aa=!1;var v=x.firstBaseUpdate,A=x.lastBaseUpdate,R=x.shared.pending;if(R!==null){x.shared.pending=null;var $=R,re=$.next;$.next=null,A===null?v=re:A.next=re,A=$;var oe=a.alternate;oe!==null&&(oe=oe.updateQueue,R=oe.lastBaseUpdate,R!==A&&(R===null?oe.firstBaseUpdate=re:R.next=re,oe.lastBaseUpdate=$))}if(v!==null){var pe=x.baseState;A=0,oe=re=$=null,R=v;do{var ie=R.lane&-536870913,se=ie!==R.lane;if(se?(it&ie)===ie:(m&ie)===ie){ie!==0&&ie===Fl&&(L0=!0),oe!==null&&(oe=oe.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ee=a,Be=R;ie=l;var At=f;switch(Be.tag){case 1:if(Ee=Be.payload,typeof Ee=="function"){pe=Ee.call(At,pe,ie);break e}pe=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Be.payload,ie=typeof Ee=="function"?Ee.call(At,pe,ie):Ee,ie==null)break e;pe=g({},pe,ie);break e;case 2:aa=!0}}ie=R.callback,ie!==null&&(a.flags|=64,se&&(a.flags|=8192),se=x.callbacks,se===null?x.callbacks=[ie]:se.push(ie))}else se={lane:ie,tag:R.tag,payload:R.payload,callback:R.callback,next:null},oe===null?(re=oe=se,$=pe):oe=oe.next=se,A|=ie;if(R=R.next,R===null){if(R=x.shared.pending,R===null)break;se=R,R=se.next,se.next=null,x.lastBaseUpdate=se,x.shared.pending=null}}while(!0);oe===null&&($=pe),x.baseState=$,x.firstBaseUpdate=re,x.lastBaseUpdate=oe,v===null&&(x.shared.lanes=0),pa|=A,a.lanes=A,a.memoizedState=pe}}function SC(a,l){if(typeof a!="function")throw Error(r(191,a));a.call(l)}function vC(a,l){var f=a.callbacks;if(f!==null)for(a.callbacks=null,a=0;a<f.length;a++)SC(f[a],l)}var Ul=F(null),$p=F(0);function kC(a,l){a=Ss,V($p,a),V(Ul,l),Ss=a|l.baseLanes}function B0(){V($p,Ss),V(Ul,Ul.current)}function V0(){Ss=$p.current,ee(Ul),ee($p)}var xr=F(null),$r=null;function ua(a){var l=a.alternate;V(jt,jt.current&1),V(xr,a),$r===null&&(l===null||Ul.current!==null||l.memoizedState!==null)&&($r=a)}function F0(a){V(jt,jt.current),V(xr,a),$r===null&&($r=a)}function CC(a){a.tag===22?(V(jt,jt.current),V(xr,a),$r===null&&($r=a)):ca()}function ca(){V(jt,jt.current),V(xr,xr.current)}function br(a){ee(xr),$r===a&&($r=null),ee(jt)}var jt=F(0);function Up(a){for(var l=a;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||qy(f)||Hy(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 hs=0,Ye=null,wt=null,Gt=null,Jp=!1,Jl=!1,So=!1,qp=0,Ec=0,ql=null,D6=0;function Bt(){throw Error(r(321))}function P0(a,l){if(l===null)return!1;for(var f=0;f<l.length&&f<a.length;f++)if(!gr(a[f],l[f]))return!1;return!0}function j0(a,l,f,m,x,v){return hs=v,Ye=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,W.H=a===null||a.memoizedState===null?aw:ny,So=!1,v=f(m,x),So=!1,Jl&&(v=EC(l,f,m,x)),wC(a),v}function wC(a){W.H=Tc;var l=wt!==null&&wt.next!==null;if(hs=0,Gt=wt=Ye=null,Jp=!1,Ec=0,ql=null,l)throw Error(r(300));a===null||Yt||(a=a.dependencies,a!==null&&zp(a)&&(Yt=!0))}function EC(a,l,f,m){Ye=a;var x=0;do{if(Jl&&(ql=null),Ec=0,Jl=!1,25<=x)throw Error(r(301));if(x+=1,Gt=wt=null,a.updateQueue!=null){var v=a.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}W.H=ow,v=l(f,m)}while(Jl);return v}function I6(){var a=W.H,l=a.useState()[0];return l=typeof l.then=="function"?Ac(l):l,a=a.useState()[0],(wt!==null?wt.memoizedState:null)!==a&&(Ye.flags|=1024),l}function $0(){var a=qp!==0;return qp=0,a}function U0(a,l,f){l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~f}function J0(a){if(Jp){for(a=a.memoizedState;a!==null;){var l=a.queue;l!==null&&(l.pending=null),a=a.next}Jp=!1}hs=0,Gt=wt=Ye=null,Jl=!1,Ec=qp=0,ql=null}function zn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?Ye.memoizedState=Gt=a:Gt=Gt.next=a,Gt}function $t(){if(wt===null){var a=Ye.alternate;a=a!==null?a.memoizedState:null}else a=wt.next;var l=Gt===null?Ye.memoizedState:Gt.next;if(l!==null)Gt=l,wt=a;else{if(a===null)throw Ye.alternate===null?Error(r(467)):Error(r(310));wt=a,a={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Gt===null?Ye.memoizedState=Gt=a:Gt=Gt.next=a}return Gt}function Hp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ac(a){var l=Ec;return Ec+=1,ql===null&&(ql=[]),a=mC(ql,a,l),l=Ye,(Gt===null?l.memoizedState:Gt.next)===null&&(l=l.alternate,W.H=l===null||l.memoizedState===null?aw:ny),a}function Kp(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Ac(a);if(a.$$typeof===P)return un(a)}throw Error(r(438,String(a)))}function q0(a){var l=null,f=Ye.updateQueue;if(f!==null&&(l=f.memoCache),l==null){var m=Ye.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(x){return x.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),f===null&&(f=Hp(),Ye.updateQueue=f),f.memoCache=l,f=l.data[l.index],f===void 0)for(f=l.data[l.index]=Array(a),m=0;m<a;m++)f[m]=K;return l.index++,f}function ps(a,l){return typeof l=="function"?l(a):l}function Gp(a){var l=$t();return H0(l,wt,a)}function H0(a,l,f){var m=a.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=f;var x=a.baseQueue,v=m.pending;if(v!==null){if(x!==null){var A=x.next;x.next=v.next,v.next=A}l.baseQueue=x=v,m.pending=null}if(v=a.baseState,x===null)a.memoizedState=v;else{l=x.next;var R=A=null,$=null,re=l,oe=!1;do{var pe=re.lane&-536870913;if(pe!==re.lane?(it&pe)===pe:(hs&pe)===pe){var ie=re.revertLane;if(ie===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),pe===Fl&&(oe=!0);else if((hs&ie)===ie){re=re.next,ie===Fl&&(oe=!0);continue}else pe={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},$===null?(R=$=pe,A=v):$=$.next=pe,Ye.lanes|=ie,pa|=ie;pe=re.action,So&&f(v,pe),v=re.hasEagerState?re.eagerState:f(v,pe)}else ie={lane:pe,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},$===null?(R=$=ie,A=v):$=$.next=ie,Ye.lanes|=pe,pa|=pe;re=re.next}while(re!==null&&re!==l);if($===null?A=v:$.next=R,!gr(v,a.memoizedState)&&(Yt=!0,oe&&(f=Pl,f!==null)))throw f;a.memoizedState=v,a.baseState=A,a.baseQueue=$,m.lastRenderedState=v}return x===null&&(m.lanes=0),[a.memoizedState,m.dispatch]}function K0(a){var l=$t(),f=l.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=a;var m=f.dispatch,x=f.pending,v=l.memoizedState;if(x!==null){f.pending=null;var A=x=x.next;do v=a(v,A.action),A=A.next;while(A!==x);gr(v,l.memoizedState)||(Yt=!0),l.memoizedState=v,l.baseQueue===null&&(l.baseState=v),f.lastRenderedState=v}return[v,m]}function AC(a,l,f){var m=Ye,x=$t(),v=lt;if(v){if(f===void 0)throw Error(r(407));f=f()}else f=l();var A=!gr((wt||x).memoizedState,f);if(A&&(x.memoizedState=f,Yt=!0),x=x.queue,Q0(MC.bind(null,m,x,a),[a]),x.getSnapshot!==l||A||Gt!==null&&Gt.memoizedState.tag&1){if(m.flags|=2048,Hl(9,{destroy:void 0},TC.bind(null,m,x,f,l),null),Nt===null)throw Error(r(349));v||(hs&127)!==0||NC(m,l,f)}return f}function NC(a,l,f){a.flags|=16384,a={getSnapshot:l,value:f},l=Ye.updateQueue,l===null?(l=Hp(),Ye.updateQueue=l,l.stores=[a]):(f=l.stores,f===null?l.stores=[a]:f.push(a))}function TC(a,l,f,m){l.value=f,l.getSnapshot=m,OC(l)&&RC(a)}function MC(a,l,f){return f(function(){OC(l)&&RC(a)})}function OC(a){var l=a.getSnapshot;a=a.value;try{var f=l();return!gr(a,f)}catch{return!0}}function RC(a){var l=co(a,2);l!==null&&sr(l,a,2)}function G0(a){var l=zn();if(typeof a=="function"){var f=a;if(a=f(),So){yn(!0);try{f()}finally{yn(!1)}}}return l.memoizedState=l.baseState=a,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:a},l}function DC(a,l,f,m){return a.baseState=f,H0(a,wt,typeof m=="function"?m:ps)}function _6(a,l,f,m,x){if(Wp(a))throw Error(r(485));if(a=l.action,a!==null){var v={payload:x,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){v.listeners.push(A)}};W.T!==null?f(!0):v.isTransition=!1,m(v),f=l.pending,f===null?(v.next=l.pending=v,IC(l,v)):(v.next=f.next,l.pending=f.next=v)}}function IC(a,l){var f=l.action,m=l.payload,x=a.state;if(l.isTransition){var v=W.T,A={};W.T=A;try{var R=f(x,m),$=W.S;$!==null&&$(A,R),_C(a,l,R)}catch(re){Y0(a,l,re)}finally{v!==null&&A.types!==null&&(v.types=A.types),W.T=v}}else try{v=f(x,m),_C(a,l,v)}catch(re){Y0(a,l,re)}}function _C(a,l,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(m){zC(a,l,m)},function(m){return Y0(a,l,m)}):zC(a,l,f)}function zC(a,l,f){l.status="fulfilled",l.value=f,LC(l),a.state=f,l=a.pending,l!==null&&(f=l.next,f===l?a.pending=null:(f=f.next,l.next=f,IC(a,f)))}function Y0(a,l,f){var m=a.pending;if(a.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=f,LC(l),l=l.next;while(l!==m)}a.action=null}function LC(a){a=a.listeners;for(var l=0;l<a.length;l++)(0,a[l])()}function BC(a,l){return l}function VC(a,l){if(lt){var f=Nt.formState;if(f!==null){e:{var m=Ye;if(lt){if(Mt){t:{for(var x=Mt,v=jr;x.nodeType!==8;){if(!v){x=null;break t}if(x=Ur(x.nextSibling),x===null){x=null;break t}}v=x.data,x=v==="F!"||v==="F"?x:null}if(x){Mt=Ur(x.nextSibling),m=x.data==="F!";break e}}ia(m)}m=!1}m&&(l=f[0])}}return f=zn(),f.memoizedState=f.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:BC,lastRenderedState:l},f.queue=m,f=rw.bind(null,Ye,m),m.dispatch=f,m=G0(!1),v=ty.bind(null,Ye,!1,m.queue),m=zn(),x={state:l,dispatch:null,action:a,pending:null},m.queue=x,f=_6.bind(null,Ye,x,v,f),x.dispatch=f,m.memoizedState=a,[l,f,!1]}function FC(a){var l=$t();return PC(l,wt,a)}function PC(a,l,f){if(l=H0(a,l,BC)[0],a=Gp(ps)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=Ac(l)}catch(A){throw A===jl?Vp:A}else m=l;l=$t();var x=l.queue,v=x.dispatch;return f!==l.memoizedState&&(Ye.flags|=2048,Hl(9,{destroy:void 0},z6.bind(null,x,f),null)),[m,v,a]}function z6(a,l){a.action=l}function jC(a){var l=$t(),f=wt;if(f!==null)return PC(l,f,a);$t(),l=l.memoizedState,f=$t();var m=f.queue.dispatch;return f.memoizedState=a,[l,m,!1]}function Hl(a,l,f,m){return a={tag:a,create:f,deps:m,inst:l,next:null},l=Ye.updateQueue,l===null&&(l=Hp(),Ye.updateQueue=l),f=l.lastEffect,f===null?l.lastEffect=a.next=a:(m=f.next,f.next=a,a.next=m,l.lastEffect=a),a}function $C(){return $t().memoizedState}function Yp(a,l,f,m){var x=zn();Ye.flags|=a,x.memoizedState=Hl(1|l,{destroy:void 0},f,m===void 0?null:m)}function Qp(a,l,f,m){var x=$t();m=m===void 0?null:m;var v=x.memoizedState.inst;wt!==null&&m!==null&&P0(m,wt.memoizedState.deps)?x.memoizedState=Hl(l,v,f,m):(Ye.flags|=a,x.memoizedState=Hl(1|l,v,f,m))}function UC(a,l){Yp(8390656,8,a,l)}function Q0(a,l){Qp(2048,8,a,l)}function L6(a){Ye.flags|=4;var l=Ye.updateQueue;if(l===null)l=Hp(),Ye.updateQueue=l,l.events=[a];else{var f=l.events;f===null?l.events=[a]:f.push(a)}}function JC(a){var l=$t().memoizedState;return L6({ref:l,nextImpl:a}),function(){if((dt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function qC(a,l){return Qp(4,2,a,l)}function HC(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 GC(a,l,f){f=f!=null?f.concat([a]):null,Qp(4,4,KC.bind(null,l,a),f)}function W0(){}function YC(a,l){var f=$t();l=l===void 0?null:l;var m=f.memoizedState;return l!==null&&P0(l,m[1])?m[0]:(f.memoizedState=[a,l],a)}function QC(a,l){var f=$t();l=l===void 0?null:l;var m=f.memoizedState;if(l!==null&&P0(l,m[1]))return m[0];if(m=a(),So){yn(!0);try{a()}finally{yn(!1)}}return f.memoizedState=[m,l],m}function X0(a,l,f){return f===void 0||(hs&1073741824)!==0&&(it&261930)===0?a.memoizedState=l:(a.memoizedState=f,a=Ww(),Ye.lanes|=a,pa|=a,f)}function WC(a,l,f,m){return gr(f,l)?f:Ul.current!==null?(a=X0(a,f,m),gr(a,l)||(Yt=!0),a):(hs&42)===0||(hs&1073741824)!==0&&(it&261930)===0?(Yt=!0,a.memoizedState=f):(a=Ww(),Ye.lanes|=a,pa|=a,l)}function XC(a,l,f,m,x){var v=ue.p;ue.p=v!==0&&8>v?v:8;var A=W.T,R={};W.T=R,ty(a,!1,l,f);try{var $=x(),re=W.S;if(re!==null&&re(R,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var oe=R6($,m);Nc(a,l,oe,kr(a))}else Nc(a,l,m,kr(a))}catch(pe){Nc(a,l,{then:function(){},status:"rejected",reason:pe},kr())}finally{ue.p=v,A!==null&&R.types!==null&&(A.types=R.types),W.T=A}}function B6(){}function Z0(a,l,f,m){if(a.tag!==5)throw Error(r(476));var x=ZC(a).queue;XC(a,x,l,ke,f===null?B6:function(){return ew(a),f(m)})}function ZC(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:ke,baseState:ke,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:ke},next:null};var f={};return l.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:f},next:null},a.memoizedState=l,a=a.alternate,a!==null&&(a.memoizedState=l),l}function ew(a){var l=ZC(a);l.next===null&&(l=a.alternate.memoizedState),Nc(a,l.next.queue,{},kr())}function ey(){return un(Jc)}function tw(){return $t().memoizedState}function nw(){return $t().memoizedState}function V6(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var f=kr();a=oa(f);var m=la(l,a,f);m!==null&&(sr(m,l,f),kc(m,l,f)),l={cache:M0()},a.payload=l;return}l=l.return}}function F6(a,l,f){var m=kr();f={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Wp(a)?iw(l,f):(f=x0(a,l,f,m),f!==null&&(sr(f,a,m),sw(f,l,m)))}function rw(a,l,f){var m=kr();Nc(a,l,f,m)}function Nc(a,l,f,m){var x={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(Wp(a))iw(l,x);else{var v=a.alternate;if(a.lanes===0&&(v===null||v.lanes===0)&&(v=l.lastRenderedReducer,v!==null))try{var A=l.lastRenderedState,R=v(A,f);if(x.hasEagerState=!0,x.eagerState=R,gr(R,A))return Rp(a,l,x,0),Nt===null&&Op(),!1}catch{}if(f=x0(a,l,x,m),f!==null)return sr(f,a,m),sw(f,l,m),!0}return!1}function ty(a,l,f,m){if(m={lane:2,revertLane:Iy(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Wp(a)){if(l)throw Error(r(479))}else l=x0(a,f,m,2),l!==null&&sr(l,a,2)}function Wp(a){var l=a.alternate;return a===Ye||l!==null&&l===Ye}function iw(a,l){Jl=Jp=!0;var f=a.pending;f===null?l.next=l:(l.next=f.next,f.next=l),a.pending=l}function sw(a,l,f){if((f&4194048)!==0){var m=l.lanes;m&=a.pendingLanes,f|=m,l.lanes=f,gp(a,f)}}var Tc={readContext:un,use:Kp,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};Tc.useEffectEvent=Bt;var aw={readContext:un,use:Kp,useCallback:function(a,l){return zn().memoizedState=[a,l===void 0?null:l],a},useContext:un,useEffect:UC,useImperativeHandle:function(a,l,f){f=f!=null?f.concat([a]):null,Yp(4194308,4,KC.bind(null,l,a),f)},useLayoutEffect:function(a,l){return Yp(4194308,4,a,l)},useInsertionEffect:function(a,l){Yp(4,2,a,l)},useMemo:function(a,l){var f=zn();l=l===void 0?null:l;var m=a();if(So){yn(!0);try{a()}finally{yn(!1)}}return f.memoizedState=[m,l],m},useReducer:function(a,l,f){var m=zn();if(f!==void 0){var x=f(l);if(So){yn(!0);try{f(l)}finally{yn(!1)}}}else x=l;return m.memoizedState=m.baseState=x,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:x},m.queue=a,a=a.dispatch=F6.bind(null,Ye,a),[m.memoizedState,a]},useRef:function(a){var l=zn();return a={current:a},l.memoizedState=a},useState:function(a){a=G0(a);var l=a.queue,f=rw.bind(null,Ye,l);return l.dispatch=f,[a.memoizedState,f]},useDebugValue:W0,useDeferredValue:function(a,l){var f=zn();return X0(f,a,l)},useTransition:function(){var a=G0(!1);return a=XC.bind(null,Ye,a.queue,!0,!1),zn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,f){var m=Ye,x=zn();if(lt){if(f===void 0)throw Error(r(407));f=f()}else{if(f=l(),Nt===null)throw Error(r(349));(it&127)!==0||NC(m,l,f)}x.memoizedState=f;var v={value:f,getSnapshot:l};return x.queue=v,UC(MC.bind(null,m,v,a),[a]),m.flags|=2048,Hl(9,{destroy:void 0},TC.bind(null,m,v,f,l),null),f},useId:function(){var a=zn(),l=Nt.identifierPrefix;if(lt){var f=_i,m=Ii;f=(m&~(1<<32-St(m)-1)).toString(32)+f,l="_"+l+"R_"+f,f=qp++,0<f&&(l+="H"+f.toString(32)),l+="_"}else f=D6++,l="_"+l+"r_"+f.toString(32)+"_";return a.memoizedState=l},useHostTransitionStatus:ey,useFormState:VC,useActionState:VC,useOptimistic:function(a){var l=zn();l.memoizedState=l.baseState=a;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=f,l=ty.bind(null,Ye,!0,f),f.dispatch=l,[a,l]},useMemoCache:q0,useCacheRefresh:function(){return zn().memoizedState=V6.bind(null,Ye)},useEffectEvent:function(a){var l=zn(),f={impl:a};return l.memoizedState=f,function(){if((dt&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}},ny={readContext:un,use:Kp,useCallback:YC,useContext:un,useEffect:Q0,useImperativeHandle:GC,useInsertionEffect:qC,useLayoutEffect:HC,useMemo:QC,useReducer:Gp,useRef:$C,useState:function(){return Gp(ps)},useDebugValue:W0,useDeferredValue:function(a,l){var f=$t();return WC(f,wt.memoizedState,a,l)},useTransition:function(){var a=Gp(ps)[0],l=$t().memoizedState;return[typeof a=="boolean"?a:Ac(a),l]},useSyncExternalStore:AC,useId:tw,useHostTransitionStatus:ey,useFormState:FC,useActionState:FC,useOptimistic:function(a,l){var f=$t();return DC(f,wt,a,l)},useMemoCache:q0,useCacheRefresh:nw};ny.useEffectEvent=JC;var ow={readContext:un,use:Kp,useCallback:YC,useContext:un,useEffect:Q0,useImperativeHandle:GC,useInsertionEffect:qC,useLayoutEffect:HC,useMemo:QC,useReducer:K0,useRef:$C,useState:function(){return K0(ps)},useDebugValue:W0,useDeferredValue:function(a,l){var f=$t();return wt===null?X0(f,a,l):WC(f,wt.memoizedState,a,l)},useTransition:function(){var a=K0(ps)[0],l=$t().memoizedState;return[typeof a=="boolean"?a:Ac(a),l]},useSyncExternalStore:AC,useId:tw,useHostTransitionStatus:ey,useFormState:jC,useActionState:jC,useOptimistic:function(a,l){var f=$t();return wt!==null?DC(f,wt,a,l):(f.baseState=a,[a,f.queue.dispatch])},useMemoCache:q0,useCacheRefresh:nw};ow.useEffectEvent=JC;function ry(a,l,f,m){l=a.memoizedState,f=f(m,l),f=f==null?l:g({},l,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var iy={enqueueSetState:function(a,l,f){a=a._reactInternals;var m=kr(),x=oa(m);x.payload=l,f!=null&&(x.callback=f),l=la(a,x,m),l!==null&&(sr(l,a,m),kc(l,a,m))},enqueueReplaceState:function(a,l,f){a=a._reactInternals;var m=kr(),x=oa(m);x.tag=1,x.payload=l,f!=null&&(x.callback=f),l=la(a,x,m),l!==null&&(sr(l,a,m),kc(l,a,m))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var f=kr(),m=oa(f);m.tag=2,l!=null&&(m.callback=l),l=la(a,m,f),l!==null&&(sr(l,a,f),kc(l,a,f))}};function lw(a,l,f,m,x,v,A){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(m,v,A):l.prototype&&l.prototype.isPureReactComponent?!dc(f,m)||!dc(x,v):!0}function uw(a,l,f,m){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,m),l.state!==a&&iy.enqueueReplaceState(l,l.state,null)}function vo(a,l){var f=l;if("ref"in l){f={};for(var m in l)m!=="ref"&&(f[m]=l[m])}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 cw(a){Mp(a)}function fw(a){console.error(a)}function hw(a){Mp(a)}function Xp(a,l){try{var f=a.onUncaughtError;f(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function pw(a,l,f){try{var m=a.onCaughtError;m(f.value,{componentStack:f.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function sy(a,l,f){return f=oa(f),f.tag=3,f.payload={element:null},f.callback=function(){Xp(a,l)},f}function dw(a){return a=oa(a),a.tag=3,a}function mw(a,l,f,m){var x=f.type.getDerivedStateFromError;if(typeof x=="function"){var v=m.value;a.payload=function(){return x(v)},a.callback=function(){pw(l,f,m)}}var A=f.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(a.callback=function(){pw(l,f,m),typeof x!="function"&&(da===null?da=new Set([this]):da.add(this));var R=m.stack;this.componentDidCatch(m.value,{componentStack:R!==null?R:""})})}function P6(a,l,f,m,x){if(f.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=f.alternate,l!==null&&Vl(l,f,x,!0),f=xr.current,f!==null){switch(f.tag){case 31:case 13:return $r===null?cd():f.alternate===null&&Vt===0&&(Vt=3),f.flags&=-257,f.flags|=65536,f.lanes=x,m===Fp?f.flags|=16384:(l=f.updateQueue,l===null?f.updateQueue=new Set([m]):l.add(m),Oy(a,m,x)),!1;case 22:return f.flags|=65536,m===Fp?f.flags|=16384:(l=f.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([m])},f.updateQueue=l):(f=l.retryQueue,f===null?l.retryQueue=new Set([m]):f.add(m)),Oy(a,m,x)),!1}throw Error(r(435,f.tag))}return Oy(a,m,x),cd(),!1}if(lt)return l=xr.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=x,m!==w0&&(a=Error(r(422),{cause:m}),yc(Vr(a,f)))):(m!==w0&&(l=Error(r(423),{cause:m}),yc(Vr(l,f))),a=a.current.alternate,a.flags|=65536,x&=-x,a.lanes|=x,m=Vr(m,f),x=sy(a.stateNode,m,x),z0(a,x),Vt!==4&&(Vt=2)),!1;var v=Error(r(520),{cause:m});if(v=Vr(v,f),Lc===null?Lc=[v]:Lc.push(v),Vt!==4&&(Vt=2),l===null)return!0;m=Vr(m,f),f=l;do{switch(f.tag){case 3:return f.flags|=65536,a=x&-x,f.lanes|=a,a=sy(f.stateNode,m,a),z0(f,a),!1;case 1:if(l=f.type,v=f.stateNode,(f.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(da===null||!da.has(v))))return f.flags|=65536,x&=-x,f.lanes|=x,x=dw(x),mw(x,a,f,m),z0(f,x),!1}f=f.return}while(f!==null);return!1}var ay=Error(r(461)),Yt=!1;function cn(a,l,f,m){l.child=a===null?bC(l,null,f,m):bo(l,a.child,f,m)}function gw(a,l,f,m,x){f=f.render;var v=l.ref;if("ref"in m){var A={};for(var R in m)R!=="ref"&&(A[R]=m[R])}else A=m;return mo(l),m=j0(a,l,f,A,v,x),R=$0(),a!==null&&!Yt?(U0(a,l,x),ds(a,l,x)):(lt&&R&&k0(l),l.flags|=1,cn(a,l,m,x),l.child)}function yw(a,l,f,m,x){if(a===null){var v=f.type;return typeof v=="function"&&!b0(v)&&v.defaultProps===void 0&&f.compare===null?(l.tag=15,l.type=v,xw(a,l,v,m,x)):(a=Ip(f.type,null,m,l,l.mode,x),a.ref=l.ref,a.return=l,l.child=a)}if(v=a.child,!dy(a,x)){var A=v.memoizedProps;if(f=f.compare,f=f!==null?f:dc,f(A,m)&&a.ref===l.ref)return ds(a,l,x)}return l.flags|=1,a=ls(v,m),a.ref=l.ref,a.return=l,l.child=a}function xw(a,l,f,m,x){if(a!==null){var v=a.memoizedProps;if(dc(v,m)&&a.ref===l.ref)if(Yt=!1,l.pendingProps=m=v,dy(a,x))(a.flags&131072)!==0&&(Yt=!0);else return l.lanes=a.lanes,ds(a,l,x)}return oy(a,l,f,m,x)}function bw(a,l,f,m){var x=m.children,v=a!==null?a.memoizedState:null;if(a===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((l.flags&128)!==0){if(v=v!==null?v.baseLanes|f:f,a!==null){for(m=l.child=a.child,x=0;m!==null;)x=x|m.lanes|m.childLanes,m=m.sibling;m=x&~v}else m=0,l.child=null;return Sw(a,l,v,f,m)}if((f&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},a!==null&&Bp(l,v!==null?v.cachePool:null),v!==null?kC(l,v):B0(),CC(l);else return m=l.lanes=536870912,Sw(a,l,v!==null?v.baseLanes|f:f,f,m)}else v!==null?(Bp(l,v.cachePool),kC(l,v),ca(),l.memoizedState=null):(a!==null&&Bp(l,null),B0(),ca());return cn(a,l,x,f),l.child}function Mc(a,l){return a!==null&&a.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Sw(a,l,f,m,x){var v=R0();return v=v===null?null:{parent:Kt._currentValue,pool:v},l.memoizedState={baseLanes:f,cachePool:v},a!==null&&Bp(l,null),B0(),CC(l),a!==null&&Vl(a,l,m,!0),l.childLanes=x,null}function Zp(a,l){return l=td({mode:l.mode,children:l.children},a.mode),l.ref=a.ref,a.child=l,l.return=a,l}function vw(a,l,f){return bo(l,a.child,null,f),a=Zp(l,l.pendingProps),a.flags|=2,br(l),l.memoizedState=null,a}function j6(a,l,f){var m=l.pendingProps,x=(l.flags&128)!==0;if(l.flags&=-129,a===null){if(lt){if(m.mode==="hidden")return a=Zp(l,m),l.lanes=536870912,Mc(null,a);if(F0(l),(a=Mt)?(a=I2(a,jr),a=a!==null&&a.data==="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:na!==null?{id:Ii,overflow:_i}:null,retryLane:536870912,hydrationErrors:null},f=iC(a),f.return=l,l.child=f,ln=l,Mt=null)):a=null,a===null)throw ia(l);return l.lanes=536870912,null}return Zp(l,m)}var v=a.memoizedState;if(v!==null){var A=v.dehydrated;if(F0(l),x)if(l.flags&256)l.flags&=-257,l=vw(a,l,f);else if(l.memoizedState!==null)l.child=a.child,l.flags|=128,l=null;else throw Error(r(558));else if(Yt||Vl(a,l,f,!1),x=(f&a.childLanes)!==0,Yt||x){if(m=Nt,m!==null&&(A=Gs(m,f),A!==0&&A!==v.retryLane))throw v.retryLane=A,co(a,A),sr(m,a,A),ay;cd(),l=vw(a,l,f)}else a=v.treeContext,Mt=Ur(A.nextSibling),ln=l,lt=!0,ra=null,jr=!1,a!==null&&oC(l,a),l=Zp(l,m),l.flags|=4096;return l}return a=ls(a.child,{mode:m.mode,children:m.children}),a.ref=l.ref,l.child=a,a.return=l,a}function ed(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(r(284));(a===null||a.ref!==f)&&(l.flags|=4194816)}}function oy(a,l,f,m,x){return mo(l),f=j0(a,l,f,m,void 0,x),m=$0(),a!==null&&!Yt?(U0(a,l,x),ds(a,l,x)):(lt&&m&&k0(l),l.flags|=1,cn(a,l,f,x),l.child)}function kw(a,l,f,m,x,v){return mo(l),l.updateQueue=null,f=EC(l,m,f,x),wC(a),m=$0(),a!==null&&!Yt?(U0(a,l,v),ds(a,l,v)):(lt&&m&&k0(l),l.flags|=1,cn(a,l,f,v),l.child)}function Cw(a,l,f,m,x){if(mo(l),l.stateNode===null){var v=_l,A=f.contextType;typeof A=="object"&&A!==null&&(v=un(A)),v=new f(m,v),l.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=iy,l.stateNode=v,v._reactInternals=l,v=l.stateNode,v.props=m,v.state=l.memoizedState,v.refs={},I0(l),A=f.contextType,v.context=typeof A=="object"&&A!==null?un(A):_l,v.state=l.memoizedState,A=f.getDerivedStateFromProps,typeof A=="function"&&(ry(l,f,A,m),v.state=l.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(A=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),A!==v.state&&iy.enqueueReplaceState(v,v.state,null),wc(l,m,v,x),Cc(),v.state=l.memoizedState),typeof v.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(a===null){v=l.stateNode;var R=l.memoizedProps,$=vo(f,R);v.props=$;var re=v.context,oe=f.contextType;A=_l,typeof oe=="object"&&oe!==null&&(A=un(oe));var pe=f.getDerivedStateFromProps;oe=typeof pe=="function"||typeof v.getSnapshotBeforeUpdate=="function",R=l.pendingProps!==R,oe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(R||re!==A)&&uw(l,v,m,A),aa=!1;var ie=l.memoizedState;v.state=ie,wc(l,m,v,x),Cc(),re=l.memoizedState,R||ie!==re||aa?(typeof pe=="function"&&(ry(l,f,pe,m),re=l.memoizedState),($=aa||lw(l,f,$,m,ie,re,A))?(oe||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(l.flags|=4194308)):(typeof v.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=re),v.props=m,v.state=re,v.context=A,m=$):(typeof v.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{v=l.stateNode,_0(a,l),A=l.memoizedProps,oe=vo(f,A),v.props=oe,pe=l.pendingProps,ie=v.context,re=f.contextType,$=_l,typeof re=="object"&&re!==null&&($=un(re)),R=f.getDerivedStateFromProps,(re=typeof R=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A!==pe||ie!==$)&&uw(l,v,m,$),aa=!1,ie=l.memoizedState,v.state=ie,wc(l,m,v,x),Cc();var se=l.memoizedState;A!==pe||ie!==se||aa||a!==null&&a.dependencies!==null&&zp(a.dependencies)?(typeof R=="function"&&(ry(l,f,R,m),se=l.memoizedState),(oe=aa||lw(l,f,oe,m,ie,se,$)||a!==null&&a.dependencies!==null&&zp(a.dependencies))?(re||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(m,se,$),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(m,se,$)),typeof v.componentDidUpdate=="function"&&(l.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof v.componentDidUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(l.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=se),v.props=m,v.state=se,v.context=$,m=oe):(typeof v.componentDidUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(l.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(l.flags|=1024),m=!1)}return v=m,ed(a,l),m=(l.flags&128)!==0,v||m?(v=l.stateNode,f=m&&typeof f.getDerivedStateFromError!="function"?null:v.render(),l.flags|=1,a!==null&&m?(l.child=bo(l,a.child,null,x),l.child=bo(l,null,f,x)):cn(a,l,f,x),l.memoizedState=v.state,a=l.child):a=ds(a,l,x),a}function ww(a,l,f,m){return ho(),l.flags|=256,cn(a,l,f,m),l.child}var ly={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function uy(a){return{baseLanes:a,cachePool:pC()}}function cy(a,l,f){return a=a!==null?a.childLanes&~f:0,l&&(a|=vr),a}function Ew(a,l,f){var m=l.pendingProps,x=!1,v=(l.flags&128)!==0,A;if((A=v)||(A=a!==null&&a.memoizedState===null?!1:(jt.current&2)!==0),A&&(x=!0,l.flags&=-129),A=(l.flags&32)!==0,l.flags&=-33,a===null){if(lt){if(x?ua(l):ca(),(a=Mt)?(a=I2(a,jr),a=a!==null&&a.data!=="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:na!==null?{id:Ii,overflow:_i}:null,retryLane:536870912,hydrationErrors:null},f=iC(a),f.return=l,l.child=f,ln=l,Mt=null)):a=null,a===null)throw ia(l);return Hy(a)?l.lanes=32:l.lanes=536870912,null}var R=m.children;return m=m.fallback,x?(ca(),x=l.mode,R=td({mode:"hidden",children:R},x),m=fo(m,x,f,null),R.return=l,m.return=l,R.sibling=m,l.child=R,m=l.child,m.memoizedState=uy(f),m.childLanes=cy(a,A,f),l.memoizedState=ly,Mc(null,m)):(ua(l),fy(l,R))}var $=a.memoizedState;if($!==null&&(R=$.dehydrated,R!==null)){if(v)l.flags&256?(ua(l),l.flags&=-257,l=hy(a,l,f)):l.memoizedState!==null?(ca(),l.child=a.child,l.flags|=128,l=null):(ca(),R=m.fallback,x=l.mode,m=td({mode:"visible",children:m.children},x),R=fo(R,x,f,null),R.flags|=2,m.return=l,R.return=l,m.sibling=R,l.child=m,bo(l,a.child,null,f),m=l.child,m.memoizedState=uy(f),m.childLanes=cy(a,A,f),l.memoizedState=ly,l=Mc(null,m));else if(ua(l),Hy(R)){if(A=R.nextSibling&&R.nextSibling.dataset,A)var re=A.dgst;A=re,m=Error(r(419)),m.stack="",m.digest=A,yc({value:m,source:null,stack:null}),l=hy(a,l,f)}else if(Yt||Vl(a,l,f,!1),A=(f&a.childLanes)!==0,Yt||A){if(A=Nt,A!==null&&(m=Gs(A,f),m!==0&&m!==$.retryLane))throw $.retryLane=m,co(a,m),sr(A,a,m),ay;qy(R)||cd(),l=hy(a,l,f)}else qy(R)?(l.flags|=192,l.child=a.child,l=null):(a=$.treeContext,Mt=Ur(R.nextSibling),ln=l,lt=!0,ra=null,jr=!1,a!==null&&oC(l,a),l=fy(l,m.children),l.flags|=4096);return l}return x?(ca(),R=m.fallback,x=l.mode,$=a.child,re=$.sibling,m=ls($,{mode:"hidden",children:m.children}),m.subtreeFlags=$.subtreeFlags&65011712,re!==null?R=ls(re,R):(R=fo(R,x,f,null),R.flags|=2),R.return=l,m.return=l,m.sibling=R,l.child=m,Mc(null,m),m=l.child,R=a.child.memoizedState,R===null?R=uy(f):(x=R.cachePool,x!==null?($=Kt._currentValue,x=x.parent!==$?{parent:$,pool:$}:x):x=pC(),R={baseLanes:R.baseLanes|f,cachePool:x}),m.memoizedState=R,m.childLanes=cy(a,A,f),l.memoizedState=ly,Mc(a.child,m)):(ua(l),f=a.child,a=f.sibling,f=ls(f,{mode:"visible",children:m.children}),f.return=l,f.sibling=null,a!==null&&(A=l.deletions,A===null?(l.deletions=[a],l.flags|=16):A.push(a)),l.child=f,l.memoizedState=null,f)}function fy(a,l){return l=td({mode:"visible",children:l},a.mode),l.return=a,a.child=l}function td(a,l){return a=yr(22,a,null,l),a.lanes=0,a}function hy(a,l,f){return bo(l,a.child,null,f),a=fy(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function Aw(a,l,f){a.lanes|=l;var m=a.alternate;m!==null&&(m.lanes|=l),N0(a.return,l,f)}function py(a,l,f,m,x,v){var A=a.memoizedState;A===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:x,treeForkCount:v}:(A.isBackwards=l,A.rendering=null,A.renderingStartTime=0,A.last=m,A.tail=f,A.tailMode=x,A.treeForkCount=v)}function Nw(a,l,f){var m=l.pendingProps,x=m.revealOrder,v=m.tail;m=m.children;var A=jt.current,R=(A&2)!==0;if(R?(A=A&1|2,l.flags|=128):A&=1,V(jt,A),cn(a,l,m,f),m=lt?gc:0,!R&&a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Aw(a,f,l);else if(a.tag===19)Aw(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&&Up(a)===null&&(x=f),f=f.sibling;f=x,f===null?(x=l.child,l.child=null):(x=f.sibling,f.sibling=null),py(l,!1,x,f,v,m);break;case"backwards":case"unstable_legacy-backwards":for(f=null,x=l.child,l.child=null;x!==null;){if(a=x.alternate,a!==null&&Up(a)===null){l.child=x;break}a=x.sibling,x.sibling=f,f=x,x=a}py(l,!0,f,null,v,m);break;case"together":py(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function ds(a,l,f){if(a!==null&&(l.dependencies=a.dependencies),pa|=l.lanes,(f&l.childLanes)===0)if(a!==null){if(Vl(a,l,f,!1),(f&l.childLanes)===0)return null}else return null;if(a!==null&&l.child!==a.child)throw Error(r(153));if(l.child!==null){for(a=l.child,f=ls(a,a.pendingProps),l.child=f,f.return=l;a.sibling!==null;)a=a.sibling,f=f.sibling=ls(a,a.pendingProps),f.return=l;f.sibling=null}return l.child}function dy(a,l){return(a.lanes&l)!==0?!0:(a=a.dependencies,!!(a!==null&&zp(a)))}function $6(a,l,f){switch(l.tag){case 3:Ct(l,l.stateNode.containerInfo),sa(l,Kt,a.memoizedState.cache),ho();break;case 27:case 5:zt(l);break;case 4:Ct(l,l.stateNode.containerInfo);break;case 10:sa(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,F0(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(ua(l),l.flags|=128,null):(f&l.child.childLanes)!==0?Ew(a,l,f):(ua(l),a=ds(a,l,f),a!==null?a.sibling:null);ua(l);break;case 19:var x=(a.flags&128)!==0;if(m=(f&l.childLanes)!==0,m||(Vl(a,l,f,!1),m=(f&l.childLanes)!==0),x){if(m)return Nw(a,l,f);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),V(jt,jt.current),m)break;return null;case 22:return l.lanes=0,bw(a,l,f,l.pendingProps);case 24:sa(l,Kt,a.memoizedState.cache)}return ds(a,l,f)}function Tw(a,l,f){if(a!==null)if(a.memoizedProps!==l.pendingProps)Yt=!0;else{if(!dy(a,f)&&(l.flags&128)===0)return Yt=!1,$6(a,l,f);Yt=(a.flags&131072)!==0}else Yt=!1,lt&&(l.flags&1048576)!==0&&aC(l,gc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var m=l.pendingProps;if(a=yo(l.elementType),l.type=a,typeof a=="function")b0(a)?(m=vo(a,m),l.tag=1,l=Cw(null,l,a,m,f)):(l.tag=0,l=oy(null,l,a,m,f));else{if(a!=null){var x=a.$$typeof;if(x===U){l.tag=11,l=gw(null,l,a,m,f);break e}else if(x===z){l.tag=14,l=yw(null,l,a,m,f);break e}}throw l=Re(a)||a,Error(r(306,l,""))}}return l;case 0:return oy(a,l,l.type,l.pendingProps,f);case 1:return m=l.type,x=vo(m,l.pendingProps),Cw(a,l,m,x,f);case 3:e:{if(Ct(l,l.stateNode.containerInfo),a===null)throw Error(r(387));m=l.pendingProps;var v=l.memoizedState;x=v.element,_0(a,l),wc(l,m,null,f);var A=l.memoizedState;if(m=A.cache,sa(l,Kt,m),m!==v.cache&&T0(l,[Kt],f,!0),Cc(),m=A.element,v.isDehydrated)if(v={element:m,isDehydrated:!1,cache:A.cache},l.updateQueue.baseState=v,l.memoizedState=v,l.flags&256){l=ww(a,l,m,f);break e}else if(m!==x){x=Vr(Error(r(424)),l),yc(x),l=ww(a,l,m,f);break e}else for(a=l.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,Mt=Ur(a.firstChild),ln=l,lt=!0,ra=null,jr=!0,f=bC(l,null,m,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(ho(),m===x){l=ds(a,l,f);break e}cn(a,l,m,f)}l=l.child}return l;case 26:return ed(a,l),a===null?(f=F2(l.type,null,l.pendingProps,null))?l.memoizedState=f:lt||(f=l.type,a=l.pendingProps,m=yd(Me.current).createElement(f),m[qt]=l,m[on]=a,fn(m,f,a),Ht(m),l.stateNode=m):l.memoizedState=F2(l.type,a.memoizedProps,l.pendingProps,a.memoizedState),null;case 27:return zt(l),a===null&&lt&&(m=l.stateNode=L2(l.type,l.pendingProps,Me.current),ln=l,jr=!0,x=Mt,xa(l.type)?(Ky=x,Mt=Ur(m.firstChild)):Mt=x),cn(a,l,l.pendingProps.children,f),ed(a,l),a===null&&(l.flags|=4194304),l.child;case 5:return a===null&&lt&&((x=m=Mt)&&(m=x4(m,l.type,l.pendingProps,jr),m!==null?(l.stateNode=m,ln=l,Mt=Ur(m.firstChild),jr=!1,x=!0):x=!1),x||ia(l)),zt(l),x=l.type,v=l.pendingProps,A=a!==null?a.memoizedProps:null,m=v.children,$y(x,v)?m=null:A!==null&&$y(x,A)&&(l.flags|=32),l.memoizedState!==null&&(x=j0(a,l,I6,null,null,f),Jc._currentValue=x),ed(a,l),cn(a,l,m,f),l.child;case 6:return a===null&&lt&&((a=f=Mt)&&(f=b4(f,l.pendingProps,jr),f!==null?(l.stateNode=f,ln=l,Mt=null,a=!0):a=!1),a||ia(l)),null;case 13:return Ew(a,l,f);case 4:return Ct(l,l.stateNode.containerInfo),m=l.pendingProps,a===null?l.child=bo(l,null,m,f):cn(a,l,m,f),l.child;case 11:return gw(a,l,l.type,l.pendingProps,f);case 7:return cn(a,l,l.pendingProps,f),l.child;case 8:return cn(a,l,l.pendingProps.children,f),l.child;case 12:return cn(a,l,l.pendingProps.children,f),l.child;case 10:return m=l.pendingProps,sa(l,l.type,m.value),cn(a,l,m.children,f),l.child;case 9:return x=l.type._context,m=l.pendingProps.children,mo(l),x=un(x),m=m(x),l.flags|=1,cn(a,l,m,f),l.child;case 14:return yw(a,l,l.type,l.pendingProps,f);case 15:return xw(a,l,l.type,l.pendingProps,f);case 19:return Nw(a,l,f);case 31:return j6(a,l,f);case 22:return bw(a,l,f,l.pendingProps);case 24:return mo(l),m=un(Kt),a===null?(x=R0(),x===null&&(x=Nt,v=M0(),x.pooledCache=v,v.refCount++,v!==null&&(x.pooledCacheLanes|=f),x=v),l.memoizedState={parent:m,cache:x},I0(l),sa(l,Kt,x)):((a.lanes&f)!==0&&(_0(a,l),wc(l,null,null,f),Cc()),x=a.memoizedState,v=l.memoizedState,x.parent!==m?(x={parent:m,cache:m},l.memoizedState=x,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=x),sa(l,Kt,m)):(m=v.cache,sa(l,Kt,m),m!==x.cache&&T0(l,[Kt],f,!0))),cn(a,l,l.pendingProps.children,f),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function ms(a){a.flags|=4}function my(a,l,f,m,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(t2())a.flags|=8192;else throw xo=Fp,D0}else a.flags&=-16777217}function Mw(a,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!J2(l))if(t2())a.flags|=8192;else throw xo=Fp,D0}function nd(a,l){l!==null&&(a.flags|=4),a.flags&16384&&(l=a.tag!==22?ec():536870912,a.lanes|=l,Ql|=l)}function Oc(a,l){if(!lt)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 m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:m.sibling=null}}function Ot(a){var l=a.alternate!==null&&a.alternate.child===a.child,f=0,m=0;if(l)for(var x=a.child;x!==null;)f|=x.lanes|x.childLanes,m|=x.subtreeFlags&65011712,m|=x.flags&65011712,x.return=a,x=x.sibling;else for(x=a.child;x!==null;)f|=x.lanes|x.childLanes,m|=x.subtreeFlags,m|=x.flags,x.return=a,x=x.sibling;return a.subtreeFlags|=m,a.childLanes=f,l}function U6(a,l,f){var m=l.pendingProps;switch(C0(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,m=null,a!==null&&(m=a.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),fs(Kt),Ze(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(a===null||a.child===null)&&(Bl(l)?ms(l):a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,E0())),Ot(l),null;case 26:var x=l.type,v=l.memoizedState;return a===null?(ms(l),v!==null?(Ot(l),Mw(l,v)):(Ot(l),my(l,x,null,m,f))):v?v!==a.memoizedState?(ms(l),Ot(l),Mw(l,v)):(Ot(l),l.flags&=-16777217):(a=a.memoizedProps,a!==m&&ms(l),Ot(l),my(l,x,a,m,f)),null;case 27:if(Lt(l),f=Me.current,x=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==m&&ms(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return Ot(l),null}a=be.current,Bl(l)?lC(l):(a=L2(x,m,f),l.stateNode=a,ms(l))}return Ot(l),null;case 5:if(Lt(l),x=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==m&&ms(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return Ot(l),null}if(v=be.current,Bl(l))lC(l);else{var A=yd(Me.current);switch(v){case 1:v=A.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:v=A.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":v=A.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":v=A.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":v=A.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof m.is=="string"?A.createElement("select",{is:m.is}):A.createElement("select"),m.multiple?v.multiple=!0:m.size&&(v.size=m.size);break;default:v=typeof m.is=="string"?A.createElement(x,{is:m.is}):A.createElement(x)}}v[qt]=l,v[on]=m;e:for(A=l.child;A!==null;){if(A.tag===5||A.tag===6)v.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&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}l.stateNode=v;e:switch(fn(v,x,m),x){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&ms(l)}}return Ot(l),my(l,l.type,a===null?null:a.memoizedProps,l.pendingProps,f),null;case 6:if(a&&l.stateNode!=null)a.memoizedProps!==m&&ms(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(r(166));if(a=Me.current,Bl(l)){if(a=l.stateNode,f=l.memoizedProps,m=null,x=ln,x!==null)switch(x.tag){case 27:case 5:m=x.memoizedProps}a[qt]=l,a=!!(a.nodeValue===f||m!==null&&m.suppressHydrationWarning===!0||E2(a.nodeValue,f)),a||ia(l,!0)}else a=yd(a).createTextNode(m),a[qt]=l,l.stateNode=a}return Ot(l),null;case 31:if(f=l.memoizedState,a===null||a.memoizedState!==null){if(m=Bl(l),f!==null){if(a===null){if(!m)throw Error(r(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[qt]=l}else ho(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),a=!1}else f=E0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=f),a=!0;if(!a)return l.flags&256?(br(l),l):(br(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Ot(l),null;case 13:if(m=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(x=Bl(l),m!==null&&m.dehydrated!==null){if(a===null){if(!x)throw Error(r(318));if(x=l.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[qt]=l}else ho(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),x=!1}else x=E0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=x),x=!0;if(!x)return l.flags&256?(br(l),l):(br(l),null)}return br(l),(l.flags&128)!==0?(l.lanes=f,l):(f=m!==null,a=a!==null&&a.memoizedState!==null,f&&(m=l.child,x=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(x=m.alternate.memoizedState.cachePool.pool),v=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(v=m.memoizedState.cachePool.pool),v!==x&&(m.flags|=2048)),f!==a&&f&&(l.child.flags|=8192),nd(l,l.updateQueue),Ot(l),null);case 4:return Ze(),a===null&&By(l.stateNode.containerInfo),Ot(l),null;case 10:return fs(l.type),Ot(l),null;case 19:if(ee(jt),m=l.memoizedState,m===null)return Ot(l),null;if(x=(l.flags&128)!==0,v=m.rendering,v===null)if(x)Oc(m,!1);else{if(Vt!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(v=Up(a),v!==null){for(l.flags|=128,Oc(m,!1),a=v.updateQueue,l.updateQueue=a,nd(l,a),l.subtreeFlags=0,a=f,f=l.child;f!==null;)rC(f,a),f=f.sibling;return V(jt,jt.current&1|2),lt&&us(l,m.treeForkCount),l.child}a=a.sibling}m.tail!==null&&$e()>od&&(l.flags|=128,x=!0,Oc(m,!1),l.lanes=4194304)}else{if(!x)if(a=Up(v),a!==null){if(l.flags|=128,x=!0,a=a.updateQueue,l.updateQueue=a,nd(l,a),Oc(m,!0),m.tail===null&&m.tailMode==="hidden"&&!v.alternate&&!lt)return Ot(l),null}else 2*$e()-m.renderingStartTime>od&&f!==536870912&&(l.flags|=128,x=!0,Oc(m,!1),l.lanes=4194304);m.isBackwards?(v.sibling=l.child,l.child=v):(a=m.last,a!==null?a.sibling=v:l.child=v,m.last=v)}return m.tail!==null?(a=m.tail,m.rendering=a,m.tail=a.sibling,m.renderingStartTime=$e(),a.sibling=null,f=jt.current,V(jt,x?f&1|2:f&1),lt&&us(l,m.treeForkCount),a):(Ot(l),null);case 22:case 23:return br(l),V0(),m=l.memoizedState!==null,a!==null?a.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(f&536870912)!==0&&(l.flags&128)===0&&(Ot(l),l.subtreeFlags&6&&(l.flags|=8192)):Ot(l),f=l.updateQueue,f!==null&&nd(l,f.retryQueue),f=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048),a!==null&&ee(go),null;case 24:return f=null,a!==null&&(f=a.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),fs(Kt),Ot(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function J6(a,l){switch(C0(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return fs(Kt),Ze(),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(br(l),l.alternate===null)throw Error(r(340));ho()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 13:if(br(l),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(r(340));ho()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return ee(jt),null;case 4:return Ze(),null;case 10:return fs(l.type),null;case 22:case 23:return br(l),V0(),a!==null&&ee(go),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return fs(Kt),null;case 25:return null;default:return null}}function Ow(a,l){switch(C0(l),l.tag){case 3:fs(Kt),Ze();break;case 26:case 27:case 5:Lt(l);break;case 4:Ze();break;case 31:l.memoizedState!==null&&br(l);break;case 13:br(l);break;case 19:ee(jt);break;case 10:fs(l.type);break;case 22:case 23:br(l),V0(),a!==null&&ee(go);break;case 24:fs(Kt)}}function Rc(a,l){try{var f=l.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var x=m.next;f=x;do{if((f.tag&a)===a){m=void 0;var v=f.create,A=f.inst;m=v(),A.destroy=m}f=f.next}while(f!==x)}}catch(R){kt(l,l.return,R)}}function fa(a,l,f){try{var m=l.updateQueue,x=m!==null?m.lastEffect:null;if(x!==null){var v=x.next;m=v;do{if((m.tag&a)===a){var A=m.inst,R=A.destroy;if(R!==void 0){A.destroy=void 0,x=l;var $=f,re=R;try{re()}catch(oe){kt(x,$,oe)}}}m=m.next}while(m!==v)}}catch(oe){kt(l,l.return,oe)}}function Rw(a){var l=a.updateQueue;if(l!==null){var f=a.stateNode;try{vC(l,f)}catch(m){kt(a,a.return,m)}}}function Dw(a,l,f){f.props=vo(a.type,a.memoizedProps),f.state=a.memoizedState;try{f.componentWillUnmount()}catch(m){kt(a,l,m)}}function Dc(a,l){try{var f=a.ref;if(f!==null){switch(a.tag){case 26:case 27:case 5:var m=a.stateNode;break;case 30:m=a.stateNode;break;default:m=a.stateNode}typeof f=="function"?a.refCleanup=f(m):f.current=m}}catch(x){kt(a,l,x)}}function zi(a,l){var f=a.ref,m=a.refCleanup;if(f!==null)if(typeof m=="function")try{m()}catch(x){kt(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){kt(a,l,x)}else f.current=null}function Iw(a){var l=a.type,f=a.memoizedProps,m=a.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":f.autoFocus&&m.focus();break e;case"img":f.src?m.src=f.src:f.srcSet&&(m.srcset=f.srcSet)}}catch(x){kt(a,a.return,x)}}function gy(a,l,f){try{var m=a.stateNode;h4(m,a.type,f,l),m[on]=l}catch(x){kt(a,a.return,x)}}function _w(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&xa(a.type)||a.tag===4}function yy(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||_w(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&&xa(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 xy(a,l,f){var m=a.tag;if(m===5||m===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=_r));else if(m!==4&&(m===27&&xa(a.type)&&(f=a.stateNode,l=null),a=a.child,a!==null))for(xy(a,l,f),a=a.sibling;a!==null;)xy(a,l,f),a=a.sibling}function rd(a,l,f){var m=a.tag;if(m===5||m===6)a=a.stateNode,l?f.insertBefore(a,l):f.appendChild(a);else if(m!==4&&(m===27&&xa(a.type)&&(f=a.stateNode),a=a.child,a!==null))for(rd(a,l,f),a=a.sibling;a!==null;)rd(a,l,f),a=a.sibling}function zw(a){var l=a.stateNode,f=a.memoizedProps;try{for(var m=a.type,x=l.attributes;x.length;)l.removeAttributeNode(x[0]);fn(l,m,f),l[qt]=a,l[on]=f}catch(v){kt(a,a.return,v)}}var gs=!1,Qt=!1,by=!1,Lw=typeof WeakSet=="function"?WeakSet:Set,nn=null;function q6(a,l){if(a=a.containerInfo,Py=wd,a=Gk(a),h0(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var m=f.getSelection&&f.getSelection();if(m&&m.rangeCount!==0){f=m.anchorNode;var x=m.anchorOffset,v=m.focusNode;m=m.focusOffset;try{f.nodeType,v.nodeType}catch{f=null;break e}var A=0,R=-1,$=-1,re=0,oe=0,pe=a,ie=null;t:for(;;){for(var se;pe!==f||x!==0&&pe.nodeType!==3||(R=A+x),pe!==v||m!==0&&pe.nodeType!==3||($=A+m),pe.nodeType===3&&(A+=pe.nodeValue.length),(se=pe.firstChild)!==null;)ie=pe,pe=se;for(;;){if(pe===a)break t;if(ie===f&&++re===x&&(R=A),ie===v&&++oe===m&&($=A),(se=pe.nextSibling)!==null)break;pe=ie,ie=pe.parentNode}pe=se}f=R===-1||$===-1?null:{start:R,end:$}}else f=null}f=f||{start:0,end:0}}else f=null;for(jy={focusedElem:a,selectionRange:f},wd=!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,v=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&&v!==null){a=void 0,f=l,x=v.memoizedProps,v=v.memoizedState,m=f.stateNode;try{var Ee=vo(f.type,x);a=m.getSnapshotBeforeUpdate(Ee,v),m.__reactInternalSnapshotBeforeUpdate=a}catch(Be){kt(f,f.return,Be)}}break;case 3:if((a&1024)!==0){if(a=l.stateNode.containerInfo,f=a.nodeType,f===9)Jy(a);else if(f===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Jy(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(r(163))}if(a=l.sibling,a!==null){a.return=l.return,nn=a;break}nn=l.return}}function Bw(a,l,f){var m=f.flags;switch(f.tag){case 0:case 11:case 15:xs(a,f),m&4&&Rc(5,f);break;case 1:if(xs(a,f),m&4)if(a=f.stateNode,l===null)try{a.componentDidMount()}catch(A){kt(f,f.return,A)}else{var x=vo(f.type,l.memoizedProps);l=l.memoizedState;try{a.componentDidUpdate(x,l,a.__reactInternalSnapshotBeforeUpdate)}catch(A){kt(f,f.return,A)}}m&64&&Rw(f),m&512&&Dc(f,f.return);break;case 3:if(xs(a,f),m&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{vC(a,l)}catch(A){kt(f,f.return,A)}}break;case 27:l===null&&m&4&&zw(f);case 26:case 5:xs(a,f),l===null&&m&4&&Iw(f),m&512&&Dc(f,f.return);break;case 12:xs(a,f);break;case 31:xs(a,f),m&4&&Pw(a,f);break;case 13:xs(a,f),m&4&&jw(a,f),m&64&&(a=f.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(f=e4.bind(null,f),S4(a,f))));break;case 22:if(m=f.memoizedState!==null||gs,!m){l=l!==null&&l.memoizedState!==null||Qt,x=gs;var v=Qt;gs=m,(Qt=l)&&!v?bs(a,f,(f.subtreeFlags&8772)!==0):xs(a,f),gs=x,Qt=v}break;case 30:break;default:xs(a,f)}}function Vw(a){var l=a.alternate;l!==null&&(a.alternate=null,Vw(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&El(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,tr=!1;function ys(a,l,f){for(f=f.child;f!==null;)Fw(a,l,f),f=f.sibling}function Fw(a,l,f){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(ve,f)}catch{}switch(f.tag){case 26:Qt||zi(f,l),ys(a,l,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:Qt||zi(f,l);var m=Dt,x=tr;xa(f.type)&&(Dt=f.stateNode,tr=!1),ys(a,l,f),jc(f.stateNode),Dt=m,tr=x;break;case 5:Qt||zi(f,l);case 6:if(m=Dt,x=tr,Dt=null,ys(a,l,f),Dt=m,tr=x,Dt!==null)if(tr)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(f.stateNode)}catch(v){kt(f,l,v)}else try{Dt.removeChild(f.stateNode)}catch(v){kt(f,l,v)}break;case 18:Dt!==null&&(tr?(a=Dt,R2(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,f.stateNode),iu(a)):R2(Dt,f.stateNode));break;case 4:m=Dt,x=tr,Dt=f.stateNode.containerInfo,tr=!0,ys(a,l,f),Dt=m,tr=x;break;case 0:case 11:case 14:case 15:fa(2,f,l),Qt||fa(4,f,l),ys(a,l,f);break;case 1:Qt||(zi(f,l),m=f.stateNode,typeof m.componentWillUnmount=="function"&&Dw(f,l,m)),ys(a,l,f);break;case 21:ys(a,l,f);break;case 22:Qt=(m=Qt)||f.memoizedState!==null,ys(a,l,f),Qt=m;break;default:ys(a,l,f)}}function Pw(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{iu(a)}catch(f){kt(l,l.return,f)}}}function jw(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{iu(a)}catch(f){kt(l,l.return,f)}}function H6(a){switch(a.tag){case 31:case 13:case 19:var l=a.stateNode;return l===null&&(l=a.stateNode=new Lw),l;case 22:return a=a.stateNode,l=a._retryCache,l===null&&(l=a._retryCache=new Lw),l;default:throw Error(r(435,a.tag))}}function id(a,l){var f=H6(a);l.forEach(function(m){if(!f.has(m)){f.add(m);var x=t4.bind(null,a,m);m.then(x,x)}})}function nr(a,l){var f=l.deletions;if(f!==null)for(var m=0;m<f.length;m++){var x=f[m],v=a,A=l,R=A;e:for(;R!==null;){switch(R.tag){case 27:if(xa(R.type)){Dt=R.stateNode,tr=!1;break e}break;case 5:Dt=R.stateNode,tr=!1;break e;case 3:case 4:Dt=R.stateNode.containerInfo,tr=!0;break e}R=R.return}if(Dt===null)throw Error(r(160));Fw(v,A,x),Dt=null,tr=!1,v=x.alternate,v!==null&&(v.return=null),x.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)$w(l,a),l=l.sibling}var xi=null;function $w(a,l){var f=a.alternate,m=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:nr(l,a),rr(a),m&4&&(fa(3,a,a.return),Rc(3,a),fa(5,a,a.return));break;case 1:nr(l,a),rr(a),m&512&&(Qt||f===null||zi(f,f.return)),m&64&&gs&&(a=a.updateQueue,a!==null&&(m=a.callbacks,m!==null&&(f=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=f===null?m:f.concat(m))));break;case 26:var x=xi;if(nr(l,a),rr(a),m&512&&(Qt||f===null||zi(f,f.return)),m&4){var v=f!==null?f.memoizedState:null;if(m=a.memoizedState,f===null)if(m===null)if(a.stateNode===null){e:{m=a.type,f=a.memoizedProps,x=x.ownerDocument||x;t:switch(m){case"title":v=x.getElementsByTagName("title")[0],(!v||v[Ys]||v[qt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=x.createElement(m),x.head.insertBefore(v,x.querySelector("head > title"))),fn(v,m,f),v[qt]=a,Ht(v),m=v;break e;case"link":var A=$2("link","href",x).get(m+(f.href||""));if(A){for(var R=0;R<A.length;R++)if(v=A[R],v.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&v.getAttribute("rel")===(f.rel==null?null:f.rel)&&v.getAttribute("title")===(f.title==null?null:f.title)&&v.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){A.splice(R,1);break t}}v=x.createElement(m),fn(v,m,f),x.head.appendChild(v);break;case"meta":if(A=$2("meta","content",x).get(m+(f.content||""))){for(R=0;R<A.length;R++)if(v=A[R],v.getAttribute("content")===(f.content==null?null:""+f.content)&&v.getAttribute("name")===(f.name==null?null:f.name)&&v.getAttribute("property")===(f.property==null?null:f.property)&&v.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&v.getAttribute("charset")===(f.charSet==null?null:f.charSet)){A.splice(R,1);break t}}v=x.createElement(m),fn(v,m,f),x.head.appendChild(v);break;default:throw Error(r(468,m))}v[qt]=a,Ht(v),m=v}a.stateNode=m}else U2(x,a.type,a.stateNode);else a.stateNode=j2(x,m,a.memoizedProps);else v!==m?(v===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):v.count--,m===null?U2(x,a.type,a.stateNode):j2(x,m,a.memoizedProps)):m===null&&a.stateNode!==null&&gy(a,a.memoizedProps,f.memoizedProps)}break;case 27:nr(l,a),rr(a),m&512&&(Qt||f===null||zi(f,f.return)),f!==null&&m&4&&gy(a,a.memoizedProps,f.memoizedProps);break;case 5:if(nr(l,a),rr(a),m&512&&(Qt||f===null||zi(f,f.return)),a.flags&32){x=a.stateNode;try{mi(x,"")}catch(Ee){kt(a,a.return,Ee)}}m&4&&a.stateNode!=null&&(x=a.memoizedProps,gy(a,x,f!==null?f.memoizedProps:x)),m&1024&&(by=!0);break;case 6:if(nr(l,a),rr(a),m&4){if(a.stateNode===null)throw Error(r(162));m=a.memoizedProps,f=a.stateNode;try{f.nodeValue=m}catch(Ee){kt(a,a.return,Ee)}}break;case 3:if(Sd=null,x=xi,xi=xd(l.containerInfo),nr(l,a),xi=x,rr(a),m&4&&f!==null&&f.memoizedState.isDehydrated)try{iu(l.containerInfo)}catch(Ee){kt(a,a.return,Ee)}by&&(by=!1,Uw(a));break;case 4:m=xi,xi=xd(a.stateNode.containerInfo),nr(l,a),rr(a),xi=m;break;case 12:nr(l,a),rr(a);break;case 31:nr(l,a),rr(a),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,id(a,m)));break;case 13:nr(l,a),rr(a),a.child.flags&8192&&a.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(ad=$e()),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,id(a,m)));break;case 22:x=a.memoizedState!==null;var $=f!==null&&f.memoizedState!==null,re=gs,oe=Qt;if(gs=re||x,Qt=oe||$,nr(l,a),Qt=oe,gs=re,rr(a),m&8192)e:for(l=a.stateNode,l._visibility=x?l._visibility&-2:l._visibility|1,x&&(f===null||$||gs||Qt||ko(a)),f=null,l=a;;){if(l.tag===5||l.tag===26){if(f===null){$=f=l;try{if(v=$.stateNode,x)A=v.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{R=$.stateNode;var pe=$.memoizedProps.style,ie=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;R.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Ee){kt($,$.return,Ee)}}}else if(l.tag===6){if(f===null){$=l;try{$.stateNode.nodeValue=x?"":$.memoizedProps}catch(Ee){kt($,$.return,Ee)}}}else if(l.tag===18){if(f===null){$=l;try{var se=$.stateNode;x?D2(se,!0):D2($.stateNode,!1)}catch(Ee){kt($,$.return,Ee)}}}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}m&4&&(m=a.updateQueue,m!==null&&(f=m.retryQueue,f!==null&&(m.retryQueue=null,id(a,f))));break;case 19:nr(l,a),rr(a),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,id(a,m)));break;case 30:break;case 21:break;default:nr(l,a),rr(a)}}function rr(a){var l=a.flags;if(l&2){try{for(var f,m=a.return;m!==null;){if(_w(m)){f=m;break}m=m.return}if(f==null)throw Error(r(160));switch(f.tag){case 27:var x=f.stateNode,v=yy(a);rd(a,v,x);break;case 5:var A=f.stateNode;f.flags&32&&(mi(A,""),f.flags&=-33);var R=yy(a);rd(a,R,A);break;case 3:case 4:var $=f.stateNode.containerInfo,re=yy(a);xy(a,re,$);break;default:throw Error(r(161))}}catch(oe){kt(a,a.return,oe)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function Uw(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var l=a;Uw(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),a=a.sibling}}function xs(a,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)Bw(a,l.alternate,l),l=l.sibling}function ko(a){for(a=a.child;a!==null;){var l=a;switch(l.tag){case 0:case 11:case 14:case 15:fa(4,l,l.return),ko(l);break;case 1:zi(l,l.return);var f=l.stateNode;typeof f.componentWillUnmount=="function"&&Dw(l,l.return,f),ko(l);break;case 27:jc(l.stateNode);case 26:case 5:zi(l,l.return),ko(l);break;case 22:l.memoizedState===null&&ko(l);break;case 30:ko(l);break;default:ko(l)}a=a.sibling}}function bs(a,l,f){for(f=f&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,x=a,v=l,A=v.flags;switch(v.tag){case 0:case 11:case 15:bs(x,v,f),Rc(4,v);break;case 1:if(bs(x,v,f),m=v,x=m.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(re){kt(m,m.return,re)}if(m=v,x=m.updateQueue,x!==null){var R=m.stateNode;try{var $=x.shared.hiddenCallbacks;if($!==null)for(x.shared.hiddenCallbacks=null,x=0;x<$.length;x++)SC($[x],R)}catch(re){kt(m,m.return,re)}}f&&A&64&&Rw(v),Dc(v,v.return);break;case 27:zw(v);case 26:case 5:bs(x,v,f),f&&m===null&&A&4&&Iw(v),Dc(v,v.return);break;case 12:bs(x,v,f);break;case 31:bs(x,v,f),f&&A&4&&Pw(x,v);break;case 13:bs(x,v,f),f&&A&4&&jw(x,v);break;case 22:v.memoizedState===null&&bs(x,v,f),Dc(v,v.return);break;case 30:break;default:bs(x,v,f)}l=l.sibling}}function Sy(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&&xc(f))}function vy(a,l){a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&xc(a))}function bi(a,l,f,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Jw(a,l,f,m),l=l.sibling}function Jw(a,l,f,m){var x=l.flags;switch(l.tag){case 0:case 11:case 15:bi(a,l,f,m),x&2048&&Rc(9,l);break;case 1:bi(a,l,f,m);break;case 3:bi(a,l,f,m),x&2048&&(a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&xc(a)));break;case 12:if(x&2048){bi(a,l,f,m),a=l.stateNode;try{var v=l.memoizedProps,A=v.id,R=v.onPostCommit;typeof R=="function"&&R(A,l.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch($){kt(l,l.return,$)}}else bi(a,l,f,m);break;case 31:bi(a,l,f,m);break;case 13:bi(a,l,f,m);break;case 23:break;case 22:v=l.stateNode,A=l.alternate,l.memoizedState!==null?v._visibility&2?bi(a,l,f,m):Ic(a,l):v._visibility&2?bi(a,l,f,m):(v._visibility|=2,Kl(a,l,f,m,(l.subtreeFlags&10256)!==0||!1)),x&2048&&Sy(A,l);break;case 24:bi(a,l,f,m),x&2048&&vy(l.alternate,l);break;default:bi(a,l,f,m)}}function Kl(a,l,f,m,x){for(x=x&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var v=a,A=l,R=f,$=m,re=A.flags;switch(A.tag){case 0:case 11:case 15:Kl(v,A,R,$,x),Rc(8,A);break;case 23:break;case 22:var oe=A.stateNode;A.memoizedState!==null?oe._visibility&2?Kl(v,A,R,$,x):Ic(v,A):(oe._visibility|=2,Kl(v,A,R,$,x)),x&&re&2048&&Sy(A.alternate,A);break;case 24:Kl(v,A,R,$,x),x&&re&2048&&vy(A.alternate,A);break;default:Kl(v,A,R,$,x)}l=l.sibling}}function Ic(a,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var f=a,m=l,x=m.flags;switch(m.tag){case 22:Ic(f,m),x&2048&&Sy(m.alternate,m);break;case 24:Ic(f,m),x&2048&&vy(m.alternate,m);break;default:Ic(f,m)}l=l.sibling}}var _c=8192;function Gl(a,l,f){if(a.subtreeFlags&_c)for(a=a.child;a!==null;)qw(a,l,f),a=a.sibling}function qw(a,l,f){switch(a.tag){case 26:Gl(a,l,f),a.flags&_c&&a.memoizedState!==null&&D4(f,xi,a.memoizedState,a.memoizedProps);break;case 5:Gl(a,l,f);break;case 3:case 4:var m=xi;xi=xd(a.stateNode.containerInfo),Gl(a,l,f),xi=m;break;case 22:a.memoizedState===null&&(m=a.alternate,m!==null&&m.memoizedState!==null?(m=_c,_c=16777216,Gl(a,l,f),_c=m):Gl(a,l,f));break;default:Gl(a,l,f)}}function Hw(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 zc(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];nn=m,Gw(m,a)}Hw(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:zc(a),a.flags&2048&&fa(9,a,a.return);break;case 3:zc(a);break;case 12:zc(a);break;case 22:var l=a.stateNode;a.memoizedState!==null&&l._visibility&2&&(a.return===null||a.return.tag!==13)?(l._visibility&=-3,sd(a)):zc(a);break;default:zc(a)}}function sd(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];nn=m,Gw(m,a)}Hw(a)}for(a=a.child;a!==null;){switch(l=a,l.tag){case 0:case 11:case 15:fa(8,l,l.return),sd(l);break;case 22:f=l.stateNode,f._visibility&2&&(f._visibility&=-3,sd(l));break;default:sd(l)}a=a.sibling}}function Gw(a,l){for(;nn!==null;){var f=nn;switch(f.tag){case 0:case 11:case 15:fa(8,f,l);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var m=f.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:xc(f.memoizedState.cache)}if(m=f.child,m!==null)m.return=f,nn=m;else e:for(f=a;nn!==null;){m=nn;var x=m.sibling,v=m.return;if(Vw(m),m===f){nn=null;break e}if(x!==null){x.return=v,nn=x;break e}nn=v}}}var K6={getCacheForType:function(a){var l=un(Kt),f=l.data.get(a);return f===void 0&&(f=a(),l.data.set(a,f)),f},cacheSignal:function(){return un(Kt).controller.signal}},G6=typeof WeakMap=="function"?WeakMap:Map,dt=0,Nt=null,nt=null,it=0,vt=0,Sr=null,ha=!1,Yl=!1,ky=!1,Ss=0,Vt=0,pa=0,Co=0,Cy=0,vr=0,Ql=0,Lc=null,ir=null,wy=!1,ad=0,Yw=0,od=1/0,ld=null,da=null,Xt=0,ma=null,Wl=null,vs=0,Ey=0,Ay=null,Qw=null,Bc=0,Ny=null;function kr(){return(dt&2)!==0&&it!==0?it&-it:W.T!==null?Iy():yp()}function Ww(){if(vr===0)if((it&536870912)===0||lt){var a=es;es<<=1,(es&3932160)===0&&(es=262144),vr=a}else vr=536870912;return a=xr.current,a!==null&&(a.flags|=32),vr}function sr(a,l,f){(a===Nt&&(vt===2||vt===9)||a.cancelPendingCommit!==null)&&(Xl(a,0),ga(a,it,vr,!1)),so(a,f),((dt&2)===0||a!==Nt)&&(a===Nt&&((dt&2)===0&&(Co|=f),Vt===4&&ga(a,it,vr,!1)),Li(a))}function Xw(a,l,f){if((dt&6)!==0)throw Error(r(327));var m=!f&&(l&127)===0&&(l&a.expiredLanes)===0||Ir(a,l),x=m?W6(a,l):My(a,l,!0),v=m;do{if(x===0){Yl&&!m&&ga(a,l,0,!1);break}else{if(f=a.current.alternate,v&&!Y6(f)){x=My(a,l,!1),v=!1;continue}if(x===2){if(v=l,a.errorRecoveryDisabledLanes&v)var A=0;else A=a.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){l=A;e:{var R=a;x=Lc;var $=R.current.memoizedState.isDehydrated;if($&&(Xl(R,A).flags|=256),A=My(R,A,!1),A!==2){if(ky&&!$){R.errorRecoveryDisabledLanes|=v,Co|=v,x=4;break e}v=ir,ir=x,v!==null&&(ir===null?ir=v:ir.push.apply(ir,v))}x=A}if(v=!1,x!==2)continue}}if(x===1){Xl(a,0),ga(a,l,0,!0);break}e:{switch(m=a,v=x,v){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:ga(m,l,vr,!ha);break e;case 2:ir=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(x=ad+300-$e(),10<x)){if(ga(m,l,vr,!ha),gt(m,0,!0)!==0)break e;vs=l,m.timeoutHandle=M2(Zw.bind(null,m,f,ir,ld,wy,l,vr,Co,Ql,ha,v,"Throttled",-0,0),x);break e}Zw(m,f,ir,ld,wy,l,vr,Co,Ql,ha,v,null,-0,0)}}break}while(!0);Li(a)}function Zw(a,l,f,m,x,v,A,R,$,re,oe,pe,ie,se){if(a.timeoutHandle=-1,pe=l.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_r},qw(l,v,pe);var Ee=(v&62914560)===v?ad-$e():(v&4194048)===v?Yw-$e():0;if(Ee=I4(pe,Ee),Ee!==null){vs=v,a.cancelPendingCommit=Ee(o2.bind(null,a,l,v,f,m,x,A,R,$,oe,pe,null,ie,se)),ga(a,v,A,!re);return}}o2(a,l,v,f,m,x,A,R,$)}function Y6(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 m=0;m<f.length;m++){var x=f[m],v=x.getSnapshot;x=x.value;try{if(!gr(v(),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 ga(a,l,f,m){l&=~Cy,l&=~Co,a.suspendedLanes|=l,a.pingedLanes&=~l,m&&(a.warmLanes|=l),m=a.expirationTimes;for(var x=l;0<x;){var v=31-St(x),A=1<<v;m[v]=-1,x&=~A}f!==0&&fi(a,f,l)}function ud(){return(dt&6)===0?(Vc(0),!1):!0}function Ty(){if(nt!==null){if(vt===0)var a=nt.return;else a=nt,cs=po=null,J0(a),$l=null,Sc=0,a=nt;for(;a!==null;)Ow(a.alternate,a),a=a.return;nt=null}}function Xl(a,l){var f=a.timeoutHandle;f!==-1&&(a.timeoutHandle=-1,m4(f)),f=a.cancelPendingCommit,f!==null&&(a.cancelPendingCommit=null,f()),vs=0,Ty(),Nt=a,nt=f=ls(a.current,null),it=l,vt=0,Sr=null,ha=!1,Yl=Ir(a,l),ky=!1,Ql=vr=Cy=Co=pa=Vt=0,ir=Lc=null,wy=!1,(l&8)!==0&&(l|=l&32);var m=a.entangledLanes;if(m!==0)for(a=a.entanglements,m&=l;0<m;){var x=31-St(m),v=1<<x;l|=a[x],m&=~v}return Ss=l,Op(),f}function e2(a,l){Ye=null,W.H=Tc,l===jl||l===Vp?(l=gC(),vt=3):l===D0?(l=gC(),vt=4):vt=l===ay?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Sr=l,nt===null&&(Vt=1,Xp(a,Vr(l,a.current)))}function t2(){var a=xr.current;return a===null?!0:(it&4194048)===it?$r===null:(it&62914560)===it||(it&536870912)!==0?a===$r:!1}function n2(){var a=W.H;return W.H=Tc,a===null?Tc:a}function r2(){var a=W.A;return W.A=K6,a}function cd(){Vt=4,ha||(it&4194048)!==it&&xr.current!==null||(Yl=!0),(pa&134217727)===0&&(Co&134217727)===0||Nt===null||ga(Nt,it,vr,!1)}function My(a,l,f){var m=dt;dt|=2;var x=n2(),v=r2();(Nt!==a||it!==l)&&(ld=null,Xl(a,l)),l=!1;var A=Vt;e:do try{if(vt!==0&&nt!==null){var R=nt,$=Sr;switch(vt){case 8:Ty(),A=6;break e;case 3:case 2:case 9:case 6:xr.current===null&&(l=!0);var re=vt;if(vt=0,Sr=null,Zl(a,R,$,re),f&&Yl){A=0;break e}break;default:re=vt,vt=0,Sr=null,Zl(a,R,$,re)}}Q6(),A=Vt;break}catch(oe){e2(a,oe)}while(!0);return l&&a.shellSuspendCounter++,cs=po=null,dt=m,W.H=x,W.A=v,nt===null&&(Nt=null,it=0,Op()),A}function Q6(){for(;nt!==null;)i2(nt)}function W6(a,l){var f=dt;dt|=2;var m=n2(),x=r2();Nt!==a||it!==l?(ld=null,od=$e()+500,Xl(a,l)):Yl=Ir(a,l);e:do try{if(vt!==0&&nt!==null){l=nt;var v=Sr;t:switch(vt){case 1:vt=0,Sr=null,Zl(a,l,v,1);break;case 2:case 9:if(dC(v)){vt=0,Sr=null,s2(l);break}l=function(){vt!==2&&vt!==9||Nt!==a||(vt=7),Li(a)},v.then(l,l);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:dC(v)?(vt=0,Sr=null,s2(l)):(vt=0,Sr=null,Zl(a,l,v,7));break;case 5:var A=null;switch(nt.tag){case 26:A=nt.memoizedState;case 5:case 27:var R=nt;if(A?J2(A):R.stateNode.complete){vt=0,Sr=null;var $=R.sibling;if($!==null)nt=$;else{var re=R.return;re!==null?(nt=re,fd(re)):nt=null}break t}}vt=0,Sr=null,Zl(a,l,v,5);break;case 6:vt=0,Sr=null,Zl(a,l,v,6);break;case 8:Ty(),Vt=6;break e;default:throw Error(r(462))}}X6();break}catch(oe){e2(a,oe)}while(!0);return cs=po=null,W.H=m,W.A=x,dt=f,nt!==null?0:(Nt=null,it=0,Op(),Vt)}function X6(){for(;nt!==null&&!Ri();)i2(nt)}function i2(a){var l=Tw(a.alternate,a,Ss);a.memoizedProps=a.pendingProps,l===null?fd(a):nt=l}function s2(a){var l=a,f=l.alternate;switch(l.tag){case 15:case 0:l=kw(f,l,l.pendingProps,l.type,void 0,it);break;case 11:l=kw(f,l,l.pendingProps,l.type.render,l.ref,it);break;case 5:J0(l);default:Ow(f,l),l=nt=rC(l,Ss),l=Tw(f,l,Ss)}a.memoizedProps=a.pendingProps,l===null?fd(a):nt=l}function Zl(a,l,f,m){cs=po=null,J0(l),$l=null,Sc=0;var x=l.return;try{if(P6(a,x,l,f,it)){Vt=1,Xp(a,Vr(f,a.current)),nt=null;return}}catch(v){if(x!==null)throw nt=x,v;Vt=1,Xp(a,Vr(f,a.current)),nt=null;return}l.flags&32768?(lt||m===1?a=!0:Yl||(it&536870912)!==0?a=!1:(ha=a=!0,(m===2||m===9||m===3||m===6)&&(m=xr.current,m!==null&&m.tag===13&&(m.flags|=16384))),a2(l,a)):fd(l)}function fd(a){var l=a;do{if((l.flags&32768)!==0){a2(l,ha);return}a=l.return;var f=U6(l.alternate,l,Ss);if(f!==null){nt=f;return}if(l=l.sibling,l!==null){nt=l;return}nt=l=a}while(l!==null);Vt===0&&(Vt=5)}function a2(a,l){do{var f=J6(a.alternate,a);if(f!==null){f.flags&=32767,nt=f;return}if(f=a.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!l&&(a=a.sibling,a!==null)){nt=a;return}nt=a=f}while(a!==null);Vt=6,nt=null}function o2(a,l,f,m,x,v,A,R,$){a.cancelPendingCommit=null;do hd();while(Xt!==0);if((dt&6)!==0)throw Error(r(327));if(l!==null){if(l===a.current)throw Error(r(177));if(v=l.lanes|l.childLanes,v|=y0,Cl(a,f,v,A,R,$),a===Nt&&(nt=Nt=null,it=0),Wl=l,ma=a,vs=f,Ey=v,Ay=x,Qw=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,n4(_,function(){return h2(),null})):(a.callbackNode=null,a.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=W.T,W.T=null,x=ue.p,ue.p=2,A=dt,dt|=4;try{q6(a,l,f)}finally{dt=A,ue.p=x,W.T=m}}Xt=1,l2(),u2(),c2()}}function l2(){if(Xt===1){Xt=0;var a=ma,l=Wl,f=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||f){f=W.T,W.T=null;var m=ue.p;ue.p=2;var x=dt;dt|=4;try{$w(l,a);var v=jy,A=Gk(a.containerInfo),R=v.focusedElem,$=v.selectionRange;if(A!==R&&R&&R.ownerDocument&&Kk(R.ownerDocument.documentElement,R)){if($!==null&&h0(R)){var re=$.start,oe=$.end;if(oe===void 0&&(oe=re),"selectionStart"in R)R.selectionStart=re,R.selectionEnd=Math.min(oe,R.value.length);else{var pe=R.ownerDocument||document,ie=pe&&pe.defaultView||window;if(ie.getSelection){var se=ie.getSelection(),Ee=R.textContent.length,Be=Math.min($.start,Ee),At=$.end===void 0?Be:Math.min($.end,Ee);!se.extend&&Be>At&&(A=At,At=Be,Be=A);var X=Hk(R,Be),q=Hk(R,At);if(X&&q&&(se.rangeCount!==1||se.anchorNode!==X.node||se.anchorOffset!==X.offset||se.focusNode!==q.node||se.focusOffset!==q.offset)){var te=pe.createRange();te.setStart(X.node,X.offset),se.removeAllRanges(),Be>At?(se.addRange(te),se.extend(q.node,q.offset)):(te.setEnd(q.node,q.offset),se.addRange(te))}}}}for(pe=[],se=R;se=se.parentNode;)se.nodeType===1&&pe.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<pe.length;R++){var fe=pe[R];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}wd=!!Py,jy=Py=null}finally{dt=x,ue.p=m,W.T=f}}a.current=l,Xt=2}}function u2(){if(Xt===2){Xt=0;var a=ma,l=Wl,f=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||f){f=W.T,W.T=null;var m=ue.p;ue.p=2;var x=dt;dt|=4;try{Bw(a,l.alternate,l)}finally{dt=x,ue.p=m,W.T=f}}Xt=3}}function c2(){if(Xt===4||Xt===3){Xt=0,Dr();var a=ma,l=Wl,f=vs,m=Qw;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Xt=5:(Xt=0,Wl=ma=null,f2(a,a.pendingLanes));var x=a.pendingLanes;if(x===0&&(da=null),wl(f),l=l.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(ve,l,void 0,(l.current.flags&128)===128)}catch{}if(m!==null){l=W.T,x=ue.p,ue.p=2,W.T=null;try{for(var v=a.onRecoverableError,A=0;A<m.length;A++){var R=m[A];v(R.value,{componentStack:R.stack})}}finally{W.T=l,ue.p=x}}(vs&3)!==0&&hd(),Li(a),x=a.pendingLanes,(f&261930)!==0&&(x&42)!==0?a===Ny?Bc++:(Bc=0,Ny=a):Bc=0,Vc(0)}}function f2(a,l){(a.pooledCacheLanes&=l)===0&&(l=a.pooledCache,l!=null&&(a.pooledCache=null,xc(l)))}function hd(){return l2(),u2(),c2(),h2()}function h2(){if(Xt!==5)return!1;var a=ma,l=Ey;Ey=0;var f=wl(vs),m=W.T,x=ue.p;try{ue.p=32>f?32:f,W.T=null,f=Ay,Ay=null;var v=ma,A=vs;if(Xt=0,Wl=ma=null,vs=0,(dt&6)!==0)throw Error(r(331));var R=dt;if(dt|=4,Kw(v.current),Jw(v,v.current,A,f),dt=R,Vc(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(ve,v)}catch{}return!0}finally{ue.p=x,W.T=m,f2(a,l)}}function p2(a,l,f){l=Vr(f,l),l=sy(a.stateNode,l,2),a=la(a,l,2),a!==null&&(so(a,2),Li(a))}function kt(a,l,f){if(a.tag===3)p2(a,a,f);else for(;l!==null;){if(l.tag===3){p2(l,a,f);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(da===null||!da.has(m))){a=Vr(f,a),f=dw(2),m=la(l,f,2),m!==null&&(mw(f,m,l,a),so(m,2),Li(m));break}}l=l.return}}function Oy(a,l,f){var m=a.pingCache;if(m===null){m=a.pingCache=new G6;var x=new Set;m.set(l,x)}else x=m.get(l),x===void 0&&(x=new Set,m.set(l,x));x.has(f)||(ky=!0,x.add(f),a=Z6.bind(null,a,l,f),l.then(a,a))}function Z6(a,l,f){var m=a.pingCache;m!==null&&m.delete(l),a.pingedLanes|=a.suspendedLanes&f,a.warmLanes&=~f,Nt===a&&(it&f)===f&&(Vt===4||Vt===3&&(it&62914560)===it&&300>$e()-ad?(dt&2)===0&&Xl(a,0):Cy|=f,Ql===it&&(Ql=0)),Li(a)}function d2(a,l){l===0&&(l=ec()),a=co(a,l),a!==null&&(so(a,l),Li(a))}function e4(a){var l=a.memoizedState,f=0;l!==null&&(f=l.retryLane),d2(a,f)}function t4(a,l){var f=0;switch(a.tag){case 31:case 13:var m=a.stateNode,x=a.memoizedState;x!==null&&(f=x.retryLane);break;case 19:m=a.stateNode;break;case 22:m=a.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(l),d2(a,f)}function n4(a,l){return Rn(a,l)}var pd=null,eu=null,Ry=!1,dd=!1,Dy=!1,ya=0;function Li(a){a!==eu&&a.next===null&&(eu===null?pd=eu=a:eu=eu.next=a),dd=!0,Ry||(Ry=!0,i4())}function Vc(a,l){if(!Dy&&dd){Dy=!0;do for(var f=!1,m=pd;m!==null;){if(a!==0){var x=m.pendingLanes;if(x===0)var v=0;else{var A=m.suspendedLanes,R=m.pingedLanes;v=(1<<31-St(42|a)+1)-1,v&=x&~(A&~R),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(f=!0,x2(m,v))}else v=it,v=gt(m,m===Nt?v:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(v&3)===0||Ir(m,v)||(f=!0,x2(m,v));m=m.next}while(f);Dy=!1}}function r4(){m2()}function m2(){dd=Ry=!1;var a=0;ya!==0&&d4()&&(a=ya);for(var l=$e(),f=null,m=pd;m!==null;){var x=m.next,v=g2(m,l);v===0?(m.next=null,f===null?pd=x:f.next=x,x===null&&(eu=f)):(f=m,(a!==0||(v&3)!==0)&&(dd=!0)),m=x}Xt!==0&&Xt!==5||Vc(a),ya!==0&&(ya=0)}function g2(a,l){for(var f=a.suspendedLanes,m=a.pingedLanes,x=a.expirationTimes,v=a.pendingLanes&-62914561;0<v;){var A=31-St(v),R=1<<A,$=x[A];$===-1?((R&f)===0||(R&m)!==0)&&(x[A]=je(R,l)):$<=l&&(a.expiredLanes|=R),v&=~R}if(l=Nt,f=it,f=gt(a,a===l?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),m=a.callbackNode,f===0||a===l&&(vt===2||vt===9)||a.cancelPendingCommit!==null)return m!==null&&m!==null&&Rr(m),a.callbackNode=null,a.callbackPriority=0;if((f&3)===0||Ir(a,f)){if(l=f&-f,l===a.callbackPriority)return l;switch(m!==null&&Rr(m),wl(f)){case 2:case 8:f=me;break;case 32:f=_;break;case 268435456:f=Pe;break;default:f=_}return m=y2.bind(null,a),f=Rn(f,m),a.callbackPriority=l,a.callbackNode=f,l}return m!==null&&m!==null&&Rr(m),a.callbackPriority=2,a.callbackNode=null,2}function y2(a,l){if(Xt!==0&&Xt!==5)return a.callbackNode=null,a.callbackPriority=0,null;var f=a.callbackNode;if(hd()&&a.callbackNode!==f)return null;var m=it;return m=gt(a,a===Nt?m:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),m===0?null:(Xw(a,m,l),g2(a,$e()),a.callbackNode!=null&&a.callbackNode===f?y2.bind(null,a):null)}function x2(a,l){if(hd())return null;Xw(a,l,!0)}function i4(){g4(function(){(dt&6)!==0?Rn(le,r4):m2()})}function Iy(){if(ya===0){var a=Fl;a===0&&(a=kl,kl<<=1,(kl&261888)===0&&(kl=256)),ya=a}return ya}function b2(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:oo(""+a)}function S2(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 s4(a,l,f,m,x){if(l==="submit"&&f&&f.stateNode===x){var v=b2((x[on]||null).action),A=m.submitter;A&&(l=(l=A[on]||null)?b2(l.formAction):A.getAttribute("formAction"),l!==null&&(v=l,A=null));var R=new gi("action","action",null,m,x);a.push({event:R,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(ya!==0){var $=A?S2(x,A):new FormData(x);Z0(f,{pending:!0,data:$,method:x.method,action:v},null,$)}}else typeof v=="function"&&(R.preventDefault(),$=A?S2(x,A):new FormData(x),Z0(f,{pending:!0,data:$,method:x.method,action:v},v,$))},currentTarget:x}]})}}for(var _y=0;_y<g0.length;_y++){var zy=g0[_y],a4=zy.toLowerCase(),o4=zy[0].toUpperCase()+zy.slice(1);yi(a4,"on"+o4)}yi(Wk,"onAnimationEnd"),yi(Xk,"onAnimationIteration"),yi(Zk,"onAnimationStart"),yi("dblclick","onDoubleClick"),yi("focusin","onFocus"),yi("focusout","onBlur"),yi(C6,"onTransitionRun"),yi(w6,"onTransitionStart"),yi(E6,"onTransitionCancel"),yi(eC,"onTransitionEnd"),Di("onMouseEnter",["mouseout","mouseover"]),Di("onMouseLeave",["mouseout","mouseover"]),Di("onPointerEnter",["pointerout","pointerover"]),Di("onPointerLeave",["pointerout","pointerover"]),as("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),as("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),as("onBeforeInput",["compositionend","keypress","textInput","paste"]),as("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),as("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),as("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fc="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(" "),l4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fc));function v2(a,l){l=(l&4)!==0;for(var f=0;f<a.length;f++){var m=a[f],x=m.event;m=m.listeners;e:{var v=void 0;if(l)for(var A=m.length-1;0<=A;A--){var R=m[A],$=R.instance,re=R.currentTarget;if(R=R.listener,$!==v&&x.isPropagationStopped())break e;v=R,x.currentTarget=re;try{v(x)}catch(oe){Mp(oe)}x.currentTarget=null,v=$}else for(A=0;A<m.length;A++){if(R=m[A],$=R.instance,re=R.currentTarget,R=R.listener,$!==v&&x.isPropagationStopped())break e;v=R,x.currentTarget=re;try{v(x)}catch(oe){Mp(oe)}x.currentTarget=null,v=$}}}}function rt(a,l){var f=l[nc];f===void 0&&(f=l[nc]=new Set);var m=a+"__bubble";f.has(m)||(k2(l,a,2,!1),f.add(m))}function Ly(a,l,f){var m=0;l&&(m|=4),k2(f,a,m,l)}var md="_reactListening"+Math.random().toString(36).slice(2);function By(a){if(!a[md]){a[md]=!0,bp.forEach(function(f){f!=="selectionchange"&&(l4.has(f)||Ly(f,!1,a),Ly(f,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[md]||(l[md]=!0,Ly("selectionchange",!1,l))}}function k2(a,l,f,m){switch(W2(l)){case 2:var x=L4;break;case 8:x=B4;break;default:x=Xy}f=x.bind(null,l,f,a),x=void 0,!Z||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),m?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 Vy(a,l,f,m,x){var v=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var A=m.tag;if(A===3||A===4){var R=m.stateNode.containerInfo;if(R===x)break;if(A===4)for(A=m.return;A!==null;){var $=A.tag;if(($===3||$===4)&&A.stateNode.containerInfo===x)return;A=A.return}for(;R!==null;){if(A=rs(R),A===null)return;if($=A.tag,$===5||$===6||$===26||$===27){m=v=A;continue e}R=R.parentNode}}m=m.return}w(function(){var re=v,oe=uc(f),pe=[];e:{var ie=tC.get(a);if(ie!==void 0){var se=gi,Ee=a;switch(a){case"keypress":if(yt(f)===0)break e;case"keydown":case"keyup":se=t6;break;case"focusin":Ee="focus",se=o0;break;case"focusout":Ee="blur",se=o0;break;case"beforeblur":case"afterblur":se=o0;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":se=Ok;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=U_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=i6;break;case Wk:case Xk:case Zk:se=H_;break;case eC:se=a6;break;case"scroll":case"scrollend":se=j_;break;case"wheel":se=l6;break;case"copy":case"cut":case"paste":se=G_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=Dk;break;case"toggle":case"beforetoggle":se=c6}var Be=(l&4)!==0,At=!Be&&(a==="scroll"||a==="scrollend"),X=Be?ie!==null?ie+"Capture":null:ie;Be=[];for(var q=re,te;q!==null;){var fe=q;if(te=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||te===null||X===null||(fe=T(q,X),fe!=null&&Be.push(Pc(q,fe,te))),At)break;q=q.return}0<Be.length&&(ie=new se(ie,Ee,null,f,oe),pe.push({event:ie,listeners:Be}))}}if((l&7)===0){e:{if(ie=a==="mouseover"||a==="pointerover",se=a==="mouseout"||a==="pointerout",ie&&f!==Ml&&(Ee=f.relatedTarget||f.fromElement)&&(rs(Ee)||Ee[ns]))break e;if((se||ie)&&(ie=oe.window===oe?oe:(ie=oe.ownerDocument)?ie.defaultView||ie.parentWindow:window,se?(Ee=f.relatedTarget||f.toElement,se=re,Ee=Ee?rs(Ee):null,Ee!==null&&(At=s(Ee),Be=Ee.tag,Ee!==At||Be!==5&&Be!==27&&Be!==6)&&(Ee=null)):(se=null,Ee=re),se!==Ee)){if(Be=Ok,fe="onMouseLeave",X="onMouseEnter",q="mouse",(a==="pointerout"||a==="pointerover")&&(Be=Dk,fe="onPointerLeave",X="onPointerEnter",q="pointer"),At=se==null?ie:Qs(se),te=Ee==null?ie:Qs(Ee),ie=new Be(fe,q+"leave",se,f,oe),ie.target=At,ie.relatedTarget=te,fe=null,rs(oe)===re&&(Be=new Be(X,q+"enter",Ee,f,oe),Be.target=te,Be.relatedTarget=At,fe=Be),At=fe,se&&Ee)t:{for(Be=u4,X=se,q=Ee,te=0,fe=X;fe;fe=Be(fe))te++;fe=0;for(var _e=q;_e;_e=Be(_e))fe++;for(;0<te-fe;)X=Be(X),te--;for(;0<fe-te;)q=Be(q),fe--;for(;te--;){if(X===q||q!==null&&X===q.alternate){Be=X;break t}X=Be(X),q=Be(q)}Be=null}else Be=null;se!==null&&C2(pe,ie,se,Be,!1),Ee!==null&&At!==null&&C2(pe,At,Ee,Be,!0)}}e:{if(ie=re?Qs(re):window,se=ie.nodeName&&ie.nodeName.toLowerCase(),se==="select"||se==="input"&&ie.type==="file")var ht=Pk;else if(Vk(ie))if(jk)ht=S6;else{ht=x6;var Oe=y6}else se=ie.nodeName,!se||se.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?re&&Xs(re.elementType)&&(ht=Pk):ht=b6;if(ht&&(ht=ht(a,re))){Fk(pe,ht,f,oe);break e}Oe&&Oe(a,ie,re),a==="focusout"&&re&&ie.type==="number"&&re.memoizedProps.value!=null&&ac(ie,"number",ie.value)}switch(Oe=re?Qs(re):window,a){case"focusin":(Vk(Oe)||Oe.contentEditable==="true")&&(Rl=Oe,p0=re,mc=null);break;case"focusout":mc=p0=Rl=null;break;case"mousedown":d0=!0;break;case"contextmenu":case"mouseup":case"dragend":d0=!1,Yk(pe,f,oe);break;case"selectionchange":if(k6)break;case"keydown":case"keyup":Yk(pe,f,oe)}var Qe;if(u0)e:{switch(a){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else Ol?Lk(a,f)&&(st="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(st="onCompositionStart");st&&(Ik&&f.locale!=="ko"&&(Ol||st!=="onCompositionStart"?st==="onCompositionEnd"&&Ol&&(Qe=Ge()):(ge=oe,xe="value"in ge?ge.value:ge.textContent,Ol=!0)),Oe=gd(re,st),0<Oe.length&&(st=new Rk(st,a,null,f,oe),pe.push({event:st,listeners:Oe}),Qe?st.data=Qe:(Qe=Bk(f),Qe!==null&&(st.data=Qe)))),(Qe=h6?p6(a,f):d6(a,f))&&(st=gd(re,"onBeforeInput"),0<st.length&&(Oe=new Rk("onBeforeInput","beforeinput",null,f,oe),pe.push({event:Oe,listeners:st}),Oe.data=Qe)),s4(pe,a,re,f,oe)}v2(pe,l)})}function Pc(a,l,f){return{instance:a,listener:l,currentTarget:f}}function gd(a,l){for(var f=l+"Capture",m=[];a!==null;){var x=a,v=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||v===null||(x=T(a,f),x!=null&&m.unshift(Pc(a,x,v)),x=T(a,l),x!=null&&m.push(Pc(a,x,v))),a.tag===3)return m;a=a.return}return[]}function u4(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function C2(a,l,f,m,x){for(var v=l._reactName,A=[];f!==null&&f!==m;){var R=f,$=R.alternate,re=R.stateNode;if(R=R.tag,$!==null&&$===m)break;R!==5&&R!==26&&R!==27||re===null||($=re,x?(re=T(f,v),re!=null&&A.unshift(Pc(f,re,$))):x||(re=T(f,v),re!=null&&A.push(Pc(f,re,$)))),f=f.return}A.length!==0&&a.push({event:l,listeners:A})}var c4=/\r\n?/g,f4=/\u0000|\uFFFD/g;function w2(a){return(typeof a=="string"?a:""+a).replace(c4,`
100
+ `).replace(f4,"")}function E2(a,l){return l=w2(l),w2(a)===l}function Et(a,l,f,m,x,v){switch(f){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||mi(a,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&mi(a,""+m);break;case"className":Nl(a,"class",m);break;case"tabIndex":Nl(a,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Nl(a,f,m);break;case"style":lc(a,m,v);break;case"data":if(l!=="object"){Nl(a,"data",m);break}case"src":case"href":if(m===""&&(l!=="a"||f!=="href")){a.removeAttribute(f);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){a.removeAttribute(f);break}m=oo(""+m),a.setAttribute(f,m);break;case"action":case"formAction":if(typeof m=="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 v=="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(m==null||typeof m=="symbol"||typeof m=="boolean"){a.removeAttribute(f);break}m=oo(""+m),a.setAttribute(f,m);break;case"onClick":m!=null&&(a.onclick=_r);break;case"onScroll":m!=null&&rt("scroll",a);break;case"onScrollEnd":m!=null&&rt("scrollend",a);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(x.children!=null)throw Error(r(60));a.innerHTML=f}}break;case"multiple":a.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":a.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){a.removeAttribute("xlink:href");break}f=oo(""+m),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":m!=null&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,""+m):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":m&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":m===!0?a.setAttribute(f,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?a.setAttribute(f,m):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?a.setAttribute(f,m):a.removeAttribute(f);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?a.removeAttribute(f):a.setAttribute(f,m);break;case"popover":rt("beforetoggle",a),rt("toggle",a),In(a,"popover",m);break;case"xlinkActuate":pi(a,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":pi(a,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":pi(a,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":pi(a,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":pi(a,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":pi(a,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":pi(a,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":pi(a,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":pi(a,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":In(a,"is",m);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=et.get(f)||f,In(a,f,m))}}function Fy(a,l,f,m,x,v){switch(f){case"style":lc(a,m,v);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(x.children!=null)throw Error(r(60));a.innerHTML=f}}break;case"children":typeof m=="string"?mi(a,m):(typeof m=="number"||typeof m=="bigint")&&mi(a,""+m);break;case"onScroll":m!=null&&rt("scroll",a);break;case"onScrollEnd":m!=null&&rt("scrollend",a);break;case"onClick":m!=null&&(a.onclick=_r);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rc.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(x=f.endsWith("Capture"),l=f.slice(2,x?f.length-7:void 0),v=a[on]||null,v=v!=null?v[f]:null,typeof v=="function"&&a.removeEventListener(l,v,x),typeof m=="function")){typeof v!="function"&&v!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(l,m,x);break e}f in a?a[f]=m:m===!0?a.setAttribute(f,""):In(a,f,m)}}}function fn(a,l,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":rt("error",a),rt("load",a);var m=!1,x=!1,v;for(v in f)if(f.hasOwnProperty(v)){var A=f[v];if(A!=null)switch(v){case"src":m=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Et(a,l,v,A,f,null)}}x&&Et(a,l,"srcSet",f.srcSet,f,null),m&&Et(a,l,"src",f.src,f,null);return;case"input":rt("invalid",a);var R=v=A=x=null,$=null,re=null;for(m in f)if(f.hasOwnProperty(m)){var oe=f[m];if(oe!=null)switch(m){case"name":x=oe;break;case"type":A=oe;break;case"checked":$=oe;break;case"defaultChecked":re=oe;break;case"value":v=oe;break;case"defaultValue":R=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,l));break;default:Et(a,l,m,oe,f,null)}}sc(a,v,R,$,re,A,x,!1);return;case"select":rt("invalid",a),m=A=v=null;for(x in f)if(f.hasOwnProperty(x)&&(R=f[x],R!=null))switch(x){case"value":v=R;break;case"defaultValue":A=R;break;case"multiple":m=R;default:Et(a,l,x,R,f,null)}l=v,f=A,a.multiple=!!m,l!=null?Ws(a,!!m,l,!1):f!=null&&Ws(a,!!m,f,!0);return;case"textarea":rt("invalid",a),v=x=m=null;for(A in f)if(f.hasOwnProperty(A)&&(R=f[A],R!=null))switch(A){case"value":m=R;break;case"defaultValue":x=R;break;case"children":v=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(r(91));break;default:Et(a,l,A,R,f,null)}Ep(a,m,x,v);return;case"option":for($ in f)f.hasOwnProperty($)&&(m=f[$],m!=null)&&($==="selected"?a.selected=m&&typeof m!="function"&&typeof m!="symbol":Et(a,l,$,m,f,null));return;case"dialog":rt("beforetoggle",a),rt("toggle",a),rt("cancel",a),rt("close",a);break;case"iframe":case"object":rt("load",a);break;case"video":case"audio":for(m=0;m<Fc.length;m++)rt(Fc[m],a);break;case"image":rt("error",a),rt("load",a);break;case"details":rt("toggle",a);break;case"embed":case"source":case"link":rt("error",a),rt("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(re in f)if(f.hasOwnProperty(re)&&(m=f[re],m!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Et(a,l,re,m,f,null)}return;default:if(Xs(l)){for(oe in f)f.hasOwnProperty(oe)&&(m=f[oe],m!==void 0&&Fy(a,l,oe,m,f,void 0));return}}for(R in f)f.hasOwnProperty(R)&&(m=f[R],m!=null&&Et(a,l,R,m,f,null))}function h4(a,l,f,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,v=null,A=null,R=null,$=null,re=null,oe=null;for(se in f){var pe=f[se];if(f.hasOwnProperty(se)&&pe!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":$=pe;default:m.hasOwnProperty(se)||Et(a,l,se,null,m,pe)}}for(var ie in m){var se=m[ie];if(pe=f[ie],m.hasOwnProperty(ie)&&(se!=null||pe!=null))switch(ie){case"type":v=se;break;case"name":x=se;break;case"checked":re=se;break;case"defaultChecked":oe=se;break;case"value":A=se;break;case"defaultValue":R=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,l));break;default:se!==pe&&Et(a,l,ie,se,m,pe)}}ic(a,A,R,$,re,oe,v,x);return;case"select":se=A=R=ie=null;for(v in f)if($=f[v],f.hasOwnProperty(v)&&$!=null)switch(v){case"value":break;case"multiple":se=$;default:m.hasOwnProperty(v)||Et(a,l,v,null,m,$)}for(x in m)if(v=m[x],$=f[x],m.hasOwnProperty(x)&&(v!=null||$!=null))switch(x){case"value":ie=v;break;case"defaultValue":R=v;break;case"multiple":A=v;default:v!==$&&Et(a,l,x,v,m,$)}l=R,f=A,m=se,ie!=null?Ws(a,!!f,ie,!1):!!m!=!!f&&(l!=null?Ws(a,!!f,l,!0):Ws(a,!!f,f?[]:"",!1));return;case"textarea":se=ie=null;for(R in f)if(x=f[R],f.hasOwnProperty(R)&&x!=null&&!m.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:Et(a,l,R,null,m,x)}for(A in m)if(x=m[A],v=f[A],m.hasOwnProperty(A)&&(x!=null||v!=null))switch(A){case"value":ie=x;break;case"defaultValue":se=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==v&&Et(a,l,A,x,m,v)}wp(a,ie,se);return;case"option":for(var Ee in f)ie=f[Ee],f.hasOwnProperty(Ee)&&ie!=null&&!m.hasOwnProperty(Ee)&&(Ee==="selected"?a.selected=!1:Et(a,l,Ee,null,m,ie));for($ in m)ie=m[$],se=f[$],m.hasOwnProperty($)&&ie!==se&&(ie!=null||se!=null)&&($==="selected"?a.selected=ie&&typeof ie!="function"&&typeof ie!="symbol":Et(a,l,$,ie,m,se));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)ie=f[Be],f.hasOwnProperty(Be)&&ie!=null&&!m.hasOwnProperty(Be)&&Et(a,l,Be,null,m,ie);for(re in m)if(ie=m[re],se=f[re],m.hasOwnProperty(re)&&ie!==se&&(ie!=null||se!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,l));break;default:Et(a,l,re,ie,m,se)}return;default:if(Xs(l)){for(var At in f)ie=f[At],f.hasOwnProperty(At)&&ie!==void 0&&!m.hasOwnProperty(At)&&Fy(a,l,At,void 0,m,ie);for(oe in m)ie=m[oe],se=f[oe],!m.hasOwnProperty(oe)||ie===se||ie===void 0&&se===void 0||Fy(a,l,oe,ie,m,se);return}}for(var X in f)ie=f[X],f.hasOwnProperty(X)&&ie!=null&&!m.hasOwnProperty(X)&&Et(a,l,X,null,m,ie);for(pe in m)ie=m[pe],se=f[pe],!m.hasOwnProperty(pe)||ie===se||ie==null&&se==null||Et(a,l,pe,ie,m,se)}function A2(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function p4(){if(typeof performance.getEntriesByType=="function"){for(var a=0,l=0,f=performance.getEntriesByType("resource"),m=0;m<f.length;m++){var x=f[m],v=x.transferSize,A=x.initiatorType,R=x.duration;if(v&&R&&A2(A)){for(A=0,R=x.responseEnd,m+=1;m<f.length;m++){var $=f[m],re=$.startTime;if(re>R)break;var oe=$.transferSize,pe=$.initiatorType;oe&&A2(pe)&&($=$.responseEnd,A+=oe*($<R?1:(R-re)/($-re)))}if(--m,l+=8*(v+A)/(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 Py=null,jy=null;function yd(a){return a.nodeType===9?a:a.ownerDocument}function N2(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 T2(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 $y(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 Uy=null;function d4(){var a=window.event;return a&&a.type==="popstate"?a===Uy?!1:(Uy=a,!0):(Uy=null,!1)}var M2=typeof setTimeout=="function"?setTimeout:void 0,m4=typeof clearTimeout=="function"?clearTimeout:void 0,O2=typeof Promise=="function"?Promise:void 0,g4=typeof queueMicrotask=="function"?queueMicrotask:typeof O2<"u"?function(a){return O2.resolve(null).then(a).catch(y4)}:M2;function y4(a){setTimeout(function(){throw a})}function xa(a){return a==="head"}function R2(a,l){var f=l,m=0;do{var x=f.nextSibling;if(a.removeChild(f),x&&x.nodeType===8)if(f=x.data,f==="/$"||f==="/&"){if(m===0){a.removeChild(x),iu(l);return}m--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")m++;else if(f==="html")jc(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,jc(f);for(var v=f.firstChild;v;){var A=v.nextSibling,R=v.nodeName;v[Ys]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&v.rel.toLowerCase()==="stylesheet"||f.removeChild(v),v=A}}else f==="body"&&jc(a.ownerDocument.body);f=x}while(f);iu(l)}function D2(a,l){var f=a;a=0;do{var m=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||""),m&&m.nodeType===8)if(f=m.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=m}while(f)}function Jy(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":Jy(f),El(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function x4(a,l,f,m){for(;a.nodeType===1;){var x=f;if(a.nodeName.toLowerCase()!==l.toLowerCase()){if(!m&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(m){if(!a[Ys])switch(l){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(v=a.getAttribute("rel"),v==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(v!==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(v=a.getAttribute("src"),(v!==(x.src==null?null:x.src)||a.getAttribute("type")!==(x.type==null?null:x.type)||a.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&v&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(l==="input"&&a.type==="hidden"){var v=x.name==null?null:""+x.name;if(x.type==="hidden"&&a.getAttribute("name")===v)return a}else return a;if(a=Ur(a.nextSibling),a===null)break}return null}function b4(a,l,f){if(l==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=Ur(a.nextSibling),a===null))return null;return a}function I2(a,l){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=Ur(a.nextSibling),a===null))return null;return a}function qy(a){return a.data==="$?"||a.data==="$~"}function Hy(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function S4(a,l){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=l;else if(a.data!=="$?"||f.readyState!=="loading")l();else{var m=function(){l(),f.removeEventListener("DOMContentLoaded",m)};f.addEventListener("DOMContentLoaded",m),a._reactRetry=m}}function Ur(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 Ky=null;function _2(a){a=a.nextSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(l===0)return Ur(a.nextSibling);l--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||l++}a=a.nextSibling}return null}function z2(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 L2(a,l,f){switch(l=yd(f),a){case"html":if(a=l.documentElement,!a)throw Error(r(452));return a;case"head":if(a=l.head,!a)throw Error(r(453));return a;case"body":if(a=l.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function jc(a){for(var l=a.attributes;l.length;)a.removeAttributeNode(l[0]);El(a)}var Jr=new Map,B2=new Set;function xd(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var ks=ue.d;ue.d={f:v4,r:k4,D:C4,C:w4,L:E4,m:A4,X:T4,S:N4,M:M4};function v4(){var a=ks.f(),l=ud();return a||l}function k4(a){var l=is(a);l!==null&&l.tag===5&&l.type==="form"?ew(l):ks.r(a)}var tu=typeof document>"u"?null:document;function V2(a,l,f){var m=tu;if(m&&typeof l=="string"&&l){var x=Tt(l);x='link[rel="'+a+'"][href="'+x+'"]',typeof f=="string"&&(x+='[crossorigin="'+f+'"]'),B2.has(x)||(B2.add(x),a={rel:a,crossOrigin:f,href:l},m.querySelector(x)===null&&(l=m.createElement("link"),fn(l,"link",a),Ht(l),m.head.appendChild(l)))}}function C4(a){ks.D(a),V2("dns-prefetch",a,null)}function w4(a,l){ks.C(a,l),V2("preconnect",a,l)}function E4(a,l,f){ks.L(a,l,f);var m=tu;if(m&&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 v=x;switch(l){case"style":v=nu(a);break;case"script":v=ru(a)}Jr.has(v)||(a=g({rel:"preload",href:l==="image"&&f&&f.imageSrcSet?void 0:a,as:l},f),Jr.set(v,a),m.querySelector(x)!==null||l==="style"&&m.querySelector($c(v))||l==="script"&&m.querySelector(Uc(v))||(l=m.createElement("link"),fn(l,"link",a),Ht(l),m.head.appendChild(l)))}}function A4(a,l){ks.m(a,l);var f=tu;if(f&&a){var m=l&&typeof l.as=="string"?l.as:"script",x='link[rel="modulepreload"][as="'+Tt(m)+'"][href="'+Tt(a)+'"]',v=x;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ru(a)}if(!Jr.has(v)&&(a=g({rel:"modulepreload",href:a},l),Jr.set(v,a),f.querySelector(x)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Uc(v)))return}m=f.createElement("link"),fn(m,"link",a),Ht(m),f.head.appendChild(m)}}}function N4(a,l,f){ks.S(a,l,f);var m=tu;if(m&&a){var x=ss(m).hoistableStyles,v=nu(a);l=l||"default";var A=x.get(v);if(!A){var R={loading:0,preload:null};if(A=m.querySelector($c(v)))R.loading=5;else{a=g({rel:"stylesheet",href:a,"data-precedence":l},f),(f=Jr.get(v))&&Gy(a,f);var $=A=m.createElement("link");Ht($),fn($,"link",a),$._p=new Promise(function(re,oe){$.onload=re,$.onerror=oe}),$.addEventListener("load",function(){R.loading|=1}),$.addEventListener("error",function(){R.loading|=2}),R.loading|=4,bd(A,l,m)}A={type:"stylesheet",instance:A,count:1,state:R},x.set(v,A)}}}function T4(a,l){ks.X(a,l);var f=tu;if(f&&a){var m=ss(f).hoistableScripts,x=ru(a),v=m.get(x);v||(v=f.querySelector(Uc(x)),v||(a=g({src:a,async:!0},l),(l=Jr.get(x))&&Yy(a,l),v=f.createElement("script"),Ht(v),fn(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},m.set(x,v))}}function M4(a,l){ks.M(a,l);var f=tu;if(f&&a){var m=ss(f).hoistableScripts,x=ru(a),v=m.get(x);v||(v=f.querySelector(Uc(x)),v||(a=g({src:a,async:!0,type:"module"},l),(l=Jr.get(x))&&Yy(a,l),v=f.createElement("script"),Ht(v),fn(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},m.set(x,v))}}function F2(a,l,f,m){var x=(x=Me.current)?xd(x):null;if(!x)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(l=nu(f.href),f=ss(x).hoistableStyles,m=f.get(l),m||(m={type:"style",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=nu(f.href);var v=ss(x).hoistableStyles,A=v.get(a);if(A||(x=x.ownerDocument||x,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(a,A),(v=x.querySelector($c(a)))&&!v._p&&(A.instance=v,A.state.loading=5),Jr.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},Jr.set(a,f),v||O4(x,a,f,A.state))),l&&m===null)throw Error(r(528,""));return A}if(l&&m!==null)throw Error(r(529,""));return null;case"script":return l=f.async,f=f.src,typeof f=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=ru(f),f=ss(x).hoistableScripts,m=f.get(l),m||(m={type:"script",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function nu(a){return'href="'+Tt(a)+'"'}function $c(a){return'link[rel="stylesheet"]['+a+"]"}function P2(a){return g({},a,{"data-precedence":a.precedence,precedence:null})}function O4(a,l,f,m){a.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=a.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),fn(l,"link",f),Ht(l),a.head.appendChild(l))}function ru(a){return'[src="'+Tt(a)+'"]'}function Uc(a){return"script[async]"+a}function j2(a,l,f){if(l.count++,l.instance===null)switch(l.type){case"style":var m=a.querySelector('style[data-href~="'+Tt(f.href)+'"]');if(m)return l.instance=m,Ht(m),m;var x=g({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return m=(a.ownerDocument||a).createElement("style"),Ht(m),fn(m,"style",x),bd(m,f.precedence,a),l.instance=m;case"stylesheet":x=nu(f.href);var v=a.querySelector($c(x));if(v)return l.state.loading|=4,l.instance=v,Ht(v),v;m=P2(f),(x=Jr.get(x))&&Gy(m,x),v=(a.ownerDocument||a).createElement("link"),Ht(v);var A=v;return A._p=new Promise(function(R,$){A.onload=R,A.onerror=$}),fn(v,"link",m),l.state.loading|=4,bd(v,f.precedence,a),l.instance=v;case"script":return v=ru(f.src),(x=a.querySelector(Uc(v)))?(l.instance=x,Ht(x),x):(m=f,(x=Jr.get(v))&&(m=g({},f),Yy(m,x)),a=a.ownerDocument||a,x=a.createElement("script"),Ht(x),fn(x,"link",m),a.head.appendChild(x),l.instance=x);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,bd(m,f.precedence,a));return l.instance}function bd(a,l,f){for(var m=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=m.length?m[m.length-1]:null,v=x,A=0;A<m.length;A++){var R=m[A];if(R.dataset.precedence===l)v=R;else if(v!==x)break}v?v.parentNode.insertBefore(a,v.nextSibling):(l=f.nodeType===9?f.head:f,l.insertBefore(a,l.firstChild))}function Gy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.title==null&&(a.title=l.title)}function Yy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.integrity==null&&(a.integrity=l.integrity)}var Sd=null;function $2(a,l,f){if(Sd===null){var m=new Map,x=Sd=new Map;x.set(f,m)}else x=Sd,m=x.get(f),m||(m=new Map,x.set(f,m));if(m.has(a))return m;for(m.set(a,null),f=f.getElementsByTagName(a),x=0;x<f.length;x++){var v=f[x];if(!(v[Ys]||v[qt]||a==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var A=v.getAttribute(l)||"";A=a+A;var R=m.get(A);R?R.push(v):m.set(A,[v])}}return m}function U2(a,l,f){a=a.ownerDocument||a,a.head.insertBefore(f,l==="title"?a.querySelector("head > title"):null)}function R4(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 J2(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function D4(a,l,f,m){if(f.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var x=nu(m.href),v=l.querySelector($c(x));if(v){l=v._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=vd.bind(a),l.then(a,a)),f.state.loading|=4,f.instance=v,Ht(v);return}v=l.ownerDocument||l,m=P2(m),(x=Jr.get(x))&&Gy(m,x),v=v.createElement("link"),Ht(v);var A=v;A._p=new Promise(function(R,$){A.onload=R,A.onerror=$}),fn(v,"link",m),f.instance=v}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,l),(l=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=vd.bind(a),l.addEventListener("load",f),l.addEventListener("error",f))}}var Qy=0;function I4(a,l){return a.stylesheets&&a.count===0&&Cd(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var m=setTimeout(function(){if(a.stylesheets&&Cd(a,a.stylesheets),a.unsuspend){var v=a.unsuspend;a.unsuspend=null,v()}},6e4+l);0<a.imgBytes&&Qy===0&&(Qy=62500*p4());var x=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Cd(a,a.stylesheets),a.unsuspend)){var v=a.unsuspend;a.unsuspend=null,v()}},(a.imgBytes>Qy?50:800)+l);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(m),clearTimeout(x)}}:null}function vd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cd(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var kd=null;function Cd(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,kd=new Map,l.forEach(_4,a),kd=null,vd.call(a))}function _4(a,l){if(!(l.state.loading&4)){var f=kd.get(a);if(f)var m=f.get(null);else{f=new Map,kd.set(a,f);for(var x=a.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<x.length;v++){var A=x[v];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(f.set(A.dataset.precedence,A),m=A)}m&&f.set(null,m)}x=l.instance,A=x.getAttribute("data-precedence"),v=f.get(A)||m,v===m&&f.set(null,x),f.set(A,x),this.count++,m=vd.bind(this),x.addEventListener("load",m),x.addEventListener("error",m),v?v.parentNode.insertBefore(x,v.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(x,a.firstChild)),l.state.loading|=4}}var Jc={$$typeof:P,Provider:null,Consumer:null,_currentValue:ke,_currentValue2:ke,_threadCount:0};function z4(a,l,f,m,x,v,A,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=io(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=io(0),this.hiddenUpdates=io(null),this.identifierPrefix=m,this.onUncaughtError=x,this.onCaughtError=v,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function q2(a,l,f,m,x,v,A,R,$,re,oe,pe){return a=new z4(a,l,f,A,$,re,oe,pe,R),l=1,v===!0&&(l|=24),v=yr(3,null,null,l),a.current=v,v.stateNode=a,l=M0(),l.refCount++,a.pooledCache=l,l.refCount++,v.memoizedState={element:m,isDehydrated:f,cache:l},I0(v),a}function H2(a){return a?(a=_l,a):_l}function K2(a,l,f,m,x,v){x=H2(x),m.context===null?m.context=x:m.pendingContext=x,m=oa(l),m.payload={element:f},v=v===void 0?null:v,v!==null&&(m.callback=v),f=la(a,m,l),f!==null&&(sr(f,a,l),kc(f,a,l))}function G2(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<l?f:l}}function Wy(a,l){G2(a,l),(a=a.alternate)&&G2(a,l)}function Y2(a){if(a.tag===13||a.tag===31){var l=co(a,67108864);l!==null&&sr(l,a,67108864),Wy(a,67108864)}}function Q2(a){if(a.tag===13||a.tag===31){var l=kr();l=ts(l);var f=co(a,l);f!==null&&sr(f,a,l),Wy(a,l)}}var wd=!0;function L4(a,l,f,m){var x=W.T;W.T=null;var v=ue.p;try{ue.p=2,Xy(a,l,f,m)}finally{ue.p=v,W.T=x}}function B4(a,l,f,m){var x=W.T;W.T=null;var v=ue.p;try{ue.p=8,Xy(a,l,f,m)}finally{ue.p=v,W.T=x}}function Xy(a,l,f,m){if(wd){var x=Zy(m);if(x===null)Vy(a,l,m,Ed,f),X2(a,m);else if(F4(x,a,l,f,m))m.stopPropagation();else if(X2(a,m),l&4&&-1<V4.indexOf(a)){for(;x!==null;){var v=is(x);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var A=Jt(v.pendingLanes);if(A!==0){var R=v;for(R.pendingLanes|=2,R.entangledLanes|=2;A;){var $=1<<31-St(A);R.entanglements[1]|=$,A&=~$}Li(v),(dt&6)===0&&(od=$e()+500,Vc(0))}}break;case 31:case 13:R=co(v,2),R!==null&&sr(R,v,2),ud(),Wy(v,2)}if(v=Zy(m),v===null&&Vy(a,l,m,Ed,f),v===x)break;x=v}x!==null&&m.stopPropagation()}else Vy(a,l,m,null,f)}}function Zy(a){return a=uc(a),e1(a)}var Ed=null;function e1(a){if(Ed=null,a=rs(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 Ed=a,null}function W2(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(Zi()){case le:return 2;case me:return 8;case _:case Ie:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var t1=!1,ba=null,Sa=null,va=null,qc=new Map,Hc=new Map,ka=[],V4="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 X2(a,l){switch(a){case"focusin":case"focusout":ba=null;break;case"dragenter":case"dragleave":Sa=null;break;case"mouseover":case"mouseout":va=null;break;case"pointerover":case"pointerout":qc.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hc.delete(l.pointerId)}}function Kc(a,l,f,m,x,v){return a===null||a.nativeEvent!==v?(a={blockedOn:l,domEventName:f,eventSystemFlags:m,nativeEvent:v,targetContainers:[x]},l!==null&&(l=is(l),l!==null&&Y2(l)),a):(a.eventSystemFlags|=m,l=a.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),a)}function F4(a,l,f,m,x){switch(l){case"focusin":return ba=Kc(ba,a,l,f,m,x),!0;case"dragenter":return Sa=Kc(Sa,a,l,f,m,x),!0;case"mouseover":return va=Kc(va,a,l,f,m,x),!0;case"pointerover":var v=x.pointerId;return qc.set(v,Kc(qc.get(v)||null,a,l,f,m,x)),!0;case"gotpointercapture":return v=x.pointerId,Hc.set(v,Kc(Hc.get(v)||null,a,l,f,m,x)),!0}return!1}function Z2(a){var l=rs(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,tc(a.priority,function(){Q2(f)});return}}else if(l===31){if(l=u(f),l!==null){a.blockedOn=l,tc(a.priority,function(){Q2(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 Ad(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var f=Zy(a.nativeEvent);if(f===null){f=a.nativeEvent;var m=new f.constructor(f.type,f);Ml=m,f.target.dispatchEvent(m),Ml=null}else return l=is(f),l!==null&&Y2(l),a.blockedOn=f,!1;l.shift()}return!0}function eE(a,l,f){Ad(a)&&f.delete(l)}function P4(){t1=!1,ba!==null&&Ad(ba)&&(ba=null),Sa!==null&&Ad(Sa)&&(Sa=null),va!==null&&Ad(va)&&(va=null),qc.forEach(eE),Hc.forEach(eE)}function Nd(a,l){a.blockedOn===l&&(a.blockedOn=null,t1||(t1=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,P4)))}var Td=null;function tE(a){Td!==a&&(Td=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Td===a&&(Td=null);for(var l=0;l<a.length;l+=3){var f=a[l],m=a[l+1],x=a[l+2];if(typeof m!="function"){if(e1(m||f)===null)continue;break}var v=is(f);v!==null&&(a.splice(l,3),l-=3,Z0(v,{pending:!0,data:x,method:f.method,action:m},m,x))}}))}function iu(a){function l($){return Nd($,a)}ba!==null&&Nd(ba,a),Sa!==null&&Nd(Sa,a),va!==null&&Nd(va,a),qc.forEach(l),Hc.forEach(l);for(var f=0;f<ka.length;f++){var m=ka[f];m.blockedOn===a&&(m.blockedOn=null)}for(;0<ka.length&&(f=ka[0],f.blockedOn===null);)Z2(f),f.blockedOn===null&&ka.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(m=0;m<f.length;m+=3){var x=f[m],v=f[m+1],A=x[on]||null;if(typeof v=="function")A||tE(f);else if(A){var R=null;if(v&&v.hasAttribute("formAction")){if(x=v,A=v[on]||null)R=A.formAction;else if(e1(x)!==null)continue}else R=A.action;typeof R=="function"?f[m+1]=R:(f.splice(m,3),m-=3),tE(f)}}}function nE(){function a(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(A){return x=A})},focusReset:"manual",scroll:"manual"})}function l(){x!==null&&(x(),x=null),m||setTimeout(f,20)}function f(){if(!m&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,x=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(f,100),function(){m=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),x!==null&&(x(),x=null)}}}function n1(a){this._internalRoot=a}Md.prototype.render=n1.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(r(409));var f=l.current,m=kr();K2(f,m,a,l,null,null)},Md.prototype.unmount=n1.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),ud(),l[ns]=null}};function Md(a){this._internalRoot=a}Md.prototype.unstable_scheduleHydration=function(a){if(a){var l=yp();a={blockedOn:null,target:a,priority:l};for(var f=0;f<ka.length&&l!==0&&l<ka[f].priority;f++);ka.splice(f,0,a),f===0&&Z2(a)}};var rE=e.version;if(rE!=="19.2.7")throw Error(r(527,rE,"19.2.7"));ue.findDOMNode=function(a){var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=h(l),a=a!==null?d(a):null,a=a===null?null:a.stateNode,a};var j4={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Od=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Od.isDisabled&&Od.supportsFiber)try{ve=Od.inject(j4),_t=Od}catch{}}return tf.createRoot=function(a,l){if(!i(a))throw Error(r(299));var f=!1,m="",x=cw,v=fw,A=hw;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(v=l.onCaughtError),l.onRecoverableError!==void 0&&(A=l.onRecoverableError)),l=q2(a,1,!1,null,null,f,m,null,x,v,A,nE),a[ns]=l.current,By(a),new n1(l)},tf.hydrateRoot=function(a,l,f){if(!i(a))throw Error(r(299));var m=!1,x="",v=cw,A=fw,R=hw,$=null;return f!=null&&(f.unstable_strictMode===!0&&(m=!0),f.identifierPrefix!==void 0&&(x=f.identifierPrefix),f.onUncaughtError!==void 0&&(v=f.onUncaughtError),f.onCaughtError!==void 0&&(A=f.onCaughtError),f.onRecoverableError!==void 0&&(R=f.onRecoverableError),f.formState!==void 0&&($=f.formState)),l=q2(a,1,!0,l,f??null,m,x,$,v,A,R,nE),l.context=H2(null),f=l.current,m=kr(),m=ts(m),x=oa(m),x.callback=null,la(f,x,m),f=m,l.current.lanes=f,so(l,f),Li(l),a[ns]=l.current,By(a),new Md(l)},tf.version="19.2.7",tf}var _T;function DY(){if(_T)return Dx.exports;_T=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(),Dx.exports=RY(),Dx.exports}var Mk=DY();function IY(t,e,n){return P3(I_,()=>(r,i,s)=>{const o=document.createElement("div");o.className="mdx-block-card-wrapper",o.setAttribute("data-cms-ui",""),o.contentEditable="false";const u=Mk.createRoot(o);let c=null;const h=y=>{const b=typeof s=="function"?s():null;if(b==null)return;const k=i.state.doc.nodeAt(b);if(!k)return;const E=i.state.tr.setNodeMarkup(b,void 0,{...k.attrs,...y});i.dispatch(E)},d=()=>{const y=typeof s=="function"?s():null;if(y==null)return;const b=i.state.doc.nodeAt(y);b&&i.dispatch(i.state.tr.delete(y,y+b.nodeSize))},g=y=>{const b=y.attrs.componentName,k=y.attrs.props,E=y.attrs.hasExpressions,N=y.attrs.children||"";o.setAttribute("data-mdx-component",b),o.setAttribute("data-mdx-props",k),o.setAttribute("data-mdx-children",N);const M=JSON.parse(k),j=t(b),P=(j?.slots?.includes("default")??!1)||N.trim()!=="";c={componentName:b,props:k,hasExpressions:E,children:N},u.render(ae.createElement(AY,{componentName:b,props:M,hasExpressions:E,slotContent:N,definition:j,media:e,mediaContext:n,onRemove:d,onSlotContentChange:P?U=>h({children:U}):void 0,onPropsChange:E?void 0:U=>h({props:JSON.stringify(U)})}))};return g(r),{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 cS={position:"relative",width:"100%",maxWidth:560,aspectRatio:"16 / 9",margin:"0.5rem 0",borderRadius:8,overflow:"hidden",background:"#000",border:"1px solid rgba(0,0,0,0.1)"},_Y={position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",cursor:"pointer"},zY={position:"absolute",inset:0,margin:"auto",width:68,height:48,border:"none",borderRadius:12,background:"rgba(0,0,0,0.7)",color:"#fff",fontSize:22,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},LY={position:"absolute",top:6,right:6,zIndex:2,width:24,height:24,border:"none",borderRadius:6,background:"rgba(0,0,0,0.6)",color:"#fff",cursor:"pointer",lineHeight:"24px"},BY={position:"absolute",inset:0,width:"100%",height:"100%",border:"none"},VY={...cS,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:13};function FY({videoId:t,onRemove:e}){const[n,r]=ae.useState(!1);if(!t)return ae.createElement("div",{style:VY,"data-cms-ui":""},"YouTube: missing video id");const i=ae.createElement("button",{type:"button",style:LY,title:"Remove","data-mdx-action":"youtube-remove",onClick:e},"✕");return n?ae.createElement("div",{style:cS,"data-cms-ui":""},i,ae.createElement("iframe",{style:BY,src:`https://www.youtube-nocookie.com/embed/${t}?autoplay=1`,title:"YouTube video",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})):ae.createElement("div",{style:cS,"data-cms-ui":""},i,ae.createElement("img",{style:_Y,src:`https://i.ytimg.com/vi/${t}/hqdefault.jpg`,alt:"YouTube thumbnail",loading:"lazy",onClick:()=>r(!0)}),ae.createElement("button",{type:"button",style:zY,title:"Play","data-mdx-action":"youtube-play",onClick:()=>r(!0)},"▶"))}function PY(){return P3(LI,()=>(t,e,n)=>{const r=document.createElement("div");r.setAttribute("data-cms-ui",""),r.contentEditable="false";const i=Mk.createRoot(r);let s=null;const o=()=>{const c=typeof n=="function"?n():null;if(c==null)return;const h=e.state.doc.nodeAt(c);h&&e.dispatch(e.state.tr.delete(c,c+h.nodeSize))},u=c=>{const h=c.attrs.videoId;r.setAttribute("data-youtube",h),s=h,i.render(ae.createElement(FY,{videoId:h,onRemove:o}))};return u(t),{dom:r,stopEvent:c=>{const h=c.target;return h.closest("[data-mdx-action]")||h.tagName==="IFRAME"||h.tagName==="IMG"?!0:c.type==="mousedown"||c.type==="click"?!!h.closest("button"):!1},ignoreMutation:()=>!0,update:c=>c.type.name!=="youtube"?!1:(s===c.attrs.videoId||u(c),!0),destroy:()=>{queueMicrotask(()=>i.unmount())}}})}const jY={border:"1px solid #d4d4d8",borderRadius:6,background:"#fff"},$Y={padding:"8px 12px",minHeight:240,outline:"none"},zT="nua-mdx-editor-styles",UY=`
101
+ .nua-mdx-editor .ProseMirror { line-height: 1.6; color: #18181b; }
102
+ .nua-mdx-editor .ProseMirror:focus { outline: none; }
103
+ .nua-mdx-editor .ProseMirror h1 { font-size: 1.6em; font-weight: 700; line-height: 1.25; margin: 0.7em 0 0.35em; }
104
+ .nua-mdx-editor .ProseMirror h2 { font-size: 1.35em; font-weight: 700; line-height: 1.3; margin: 0.7em 0 0.35em; }
105
+ .nua-mdx-editor .ProseMirror h3 { font-size: 1.15em; font-weight: 600; line-height: 1.35; margin: 0.6em 0 0.3em; }
106
+ .nua-mdx-editor .ProseMirror h4 { font-size: 1em; font-weight: 600; margin: 0.6em 0 0.3em; }
107
+ .nua-mdx-editor .ProseMirror p { margin: 0.5em 0; }
108
+ .nua-mdx-editor .ProseMirror ul { list-style: disc; padding-left: 1.5em; margin: 0.5em 0; }
109
+ .nua-mdx-editor .ProseMirror ol { list-style: decimal; padding-left: 1.5em; margin: 0.5em 0; }
110
+ .nua-mdx-editor .ProseMirror li { margin: 0.2em 0; }
111
+ .nua-mdx-editor .ProseMirror li > p { margin: 0.1em 0; }
112
+ .nua-mdx-editor .ProseMirror blockquote { border-left: 3px solid #d4d4d8; padding-left: 0.8em; margin: 0.6em 0; color: #52525b; }
113
+ .nua-mdx-editor .ProseMirror strong { font-weight: 700; }
114
+ .nua-mdx-editor .ProseMirror em { font-style: italic; }
115
+ .nua-mdx-editor .ProseMirror a { color: #2563eb; text-decoration: underline; }
116
+ .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; }
117
+ .nua-mdx-editor .ProseMirror pre { background: #f4f4f5; padding: 0.7em 0.9em; border-radius: 6px; overflow-x: auto; }
118
+ .nua-mdx-editor .ProseMirror pre code { background: none; padding: 0; }
119
+ .nua-mdx-editor .ProseMirror img { max-width: 100%; height: auto; border-radius: 4px; }
120
+ .nua-mdx-editor .ProseMirror hr { border: none; border-top: 1px solid #e4e4e7; margin: 1em 0; }
121
+ /* tables (GFM) — PM/prosemirror-tables ship no usable styles; without these the
122
+ cells collapse to 0 width and the table is invisible & uneditable */
123
+ .nua-mdx-editor .ProseMirror .tableWrapper { overflow-x: auto; margin: 0.8em 0; }
124
+ .nua-mdx-editor .ProseMirror table { border-collapse: collapse; table-layout: fixed; width: 100%; margin: 0.8em 0; overflow: hidden; }
125
+ .nua-mdx-editor .ProseMirror th, .nua-mdx-editor .ProseMirror td { border: 1px solid #d4d4d8; padding: 0.4em 0.6em; vertical-align: top; box-sizing: border-box; position: relative; min-width: 5em; }
126
+ .nua-mdx-editor .ProseMirror th { background: #f4f4f5; font-weight: 600; text-align: left; }
127
+ .nua-mdx-editor .ProseMirror th > p, .nua-mdx-editor .ProseMirror td > p { margin: 0; }
128
+ .nua-mdx-editor .ProseMirror .column-resize-handle { position: absolute; right: -2px; top: 0; bottom: 0; width: 4px; z-index: 20; background-color: #93c5fd; pointer-events: none; }
129
+ .nua-mdx-editor .ProseMirror .selectedCell:after { content: ''; position: absolute; inset: 0; z-index: 2; background: rgba(200,200,255,0.4); pointer-events: none; }
130
+ `;function JY(){ae.useEffect(()=>{if(typeof document>"u"||document.getElementById(zT))return;const t=document.createElement("style");t.id=zT,t.textContent=UY,document.head.appendChild(t)},[])}function B_({value:t,onChange:e,components:n,listStyles:r,media:i,mediaContext:s,allowComponents:o=!0}){JY();const u=ae.useRef(null),c=ae.useRef(null),h=ae.useRef(t),d=ae.useRef(!1),g=ae.useRef(!1),y=ae.useRef(e);y.current=e;const b=ae.useRef(new Map);ae.useEffect(()=>{b.current=new Map((n??[]).map(L=>[L.name,L]))},[n]);const k=ae.useRef(i);k.current=i;const E=ae.useRef(s);E.current=s;const[N,M]=ae.useState(!1),[j,P]=ae.useState(null);ae.useEffect(()=>{const L=u.current;if(!L)return;let C=!1;const z=J=>b.current.get(J);return(async()=>{const J=await V3.make().config(K=>{K.set(th,L),K.set(eh,h.current),K.get(lg).markdownUpdated((de,ce)=>{h.current=ce,d.current&&!g.current&&y.current(ce)})}).use(AR).use(PH).use(II).use(Tk).use(BG).use(PG).use(I_).use(IY(z,k.current,E.current)).use(CT).use(kH).use(LI).use(PY()).use(BI).create();if(C){J.destroy();return}c.current=J,P(J),queueMicrotask(()=>{d.current=!0})})(),()=>{C=!0,d.current=!1,c.current?.destroy(),c.current=null,P(null)}},[]),ae.useEffect(()=>{!c.current||!d.current||t!==h.current&&(g.current=!0,c.current.action(j3(t)),h.current=t,queueMicrotask(()=>{g.current=!1}))},[t]);const U=(L,C,z)=>{c.current?.action(ki(CT.key,{componentName:L,props:C,children:z}))};return I.jsxs("div",{className:"nua-mdx-editor",style:jY,children:[I.jsx(qI,{editor:j,listStyles:r,media:i,mediaContext:s,field:"body",onInsertComponent:o?()=>M(!0):void 0}),I.jsx("div",{ref:u,style:$Y}),o?I.jsx(uz,{open:N,components:n??[],onInsert:U,onClose:()=>M(!1)}):null]})}function qY({client:t,value:e,collection:n,entry:r,field:i,accept:s,onChange:o}){const[u,c]=ae.useState({kind:"probing"}),h=ae.useRef(null);ae.useEffect(()=>{let E=!0;return t.listMedia({limit:1}).then(()=>{E&&c({kind:"ready"})},N=>{E&&c(uE(N)?{kind:"unavailable"}:{kind:"ready"})}),()=>{E=!1}},[t]);const d=async E=>{c({kind:"uploading"});try{const N=await t.uploadMedia(E,{collection:n,entry:r,field:i});N.success&&N.url?(o(N.url),c({kind:"ready"})):c({kind:"error",message:N.error??"Upload failed"})}catch(N){if(uE(N)){c({kind:"unavailable"});return}c({kind:"error",message:N instanceof Error?N.message:"Upload failed"})}},g=u.kind==="ready"||u.kind==="error",y=e!==""&&/^(https?:\/\/|data:|\/)/.test(e),b=e===""?"":y?e:r!==void 0?t.mediaFileUrl(n,r,e):"",k=b!==""&&(e.startsWith("data:image/")||/\.(png|jpe?g|gif|webp|avif|svg|ico|bmp)(\?|#|$)/i.test(e));return I.jsxs("div",{className:"nua-cadmin-media",children:[k?I.jsx("img",{className:"nua-cadmin-img",src:b,alt:""}):null,I.jsxs("div",{className:"nua-cadmin-media-row",children:[I.jsx("input",{type:"text",className:"nua-cadmin-input",value:e,placeholder:"Image URL or path",onChange:E=>o(E.target.value)}),e!==""?I.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Clear",onClick:()=>o(""),children:"×"}):null]}),u.kind==="uploading"?I.jsx("div",{className:"nua-cadmin-field-loading",children:"Uploading…"}):null,u.kind==="unavailable"?I.jsx("div",{className:"nua-cadmin-media-hint",children:"Media uploads unavailable — paste a URL or path instead."}):null,u.kind==="error"?I.jsx("div",{className:"nua-cadmin-media-error",children:u.message}):null,g||u.kind==="probing"?I.jsxs(I.Fragment,{children:[I.jsx("input",{ref:h,type:"file",accept:s,className:"nua-cadmin-file-input",disabled:!g,onChange:E=>{const N=E.target.files?.[0];N&&d(N),E.target.value=""}}),I.jsx("button",{type:"button",className:"nua-cadmin-add-btn",disabled:!g,onClick:()=>h.current?.click(),children:"Upload file"})]}):null]})}const HY=[],KY={url:"url",email:"email",tel:"tel"},GY={date:"date",datetime:"datetime-local",time:"time",month:"month"};function YY({field:t,value:e,onChange:n}){const r=t.hints;return I.jsx("input",{type:KY[t.type]??"text",className:"nua-cadmin-input",value:Ps(e),placeholder:r?.placeholder,maxLength:r?.maxLength,minLength:r?.minLength,onChange:i=>n(fS(t.type,i.target.value))})}function QY({value:t,rows:e,placeholder:n,maxLength:r,onChange:i}){const s=ae.useRef(null);return ae.useEffect(()=>{const o=s.current;o&&(o.style.height="auto",o.style.height=`${o.scrollHeight}px`)},[t]),I.jsx("textarea",{ref:s,className:"nua-cadmin-textarea nua-cadmin-textarea-autosize",value:t,rows:e,placeholder:n,maxLength:r,onChange:o=>i(o.target.value)})}function WY({field:t,value:e,onChange:n}){return I.jsx(QY,{value:Ps(e),rows:t.hints?.rows??4,placeholder:t.hints?.placeholder,maxLength:t.hints?.maxLength,onChange:n})}function XY({value:t,onChange:e,ctx:n}){const r=ae.useMemo(()=>({collection:n.collection,entry:n.slug}),[n.collection,n.slug]),[i,s]=ae.useState([]);return ae.useEffect(()=>{let o=!0;return n.client.getConfig().then(u=>{o&&s(u.listStyles??[])},()=>{o&&s([])}),()=>{o=!1}},[n.client]),I.jsx(B_,{value:Ps(t),onChange:e,components:HY,listStyles:i,media:n.client,mediaContext:r})}function ZY({field:t,value:e,onChange:n}){return I.jsx("input",{type:"number",className:"nua-cadmin-input",value:Ps(e),min:t.hints?.min,max:t.hints?.max,step:t.hints?.step,placeholder:t.hints?.placeholder,onChange:r=>n(fS("number",r.target.value))})}function eQ({value:t,onChange:e}){return I.jsx("input",{type:"number",className:"nua-cadmin-input",value:Ps(t),min:1e3,max:9999,step:1,onChange:n=>e(fS("year",n.target.value))})}function tQ({field:t,value:e,onChange:n}){return I.jsx("input",{type:GY[t.type]??"date",className:"nua-cadmin-input",value:Ps(e),onChange:r=>n(r.target.value)})}function nQ({field:t,value:e,onChange:n}){const r=ez(e),i=t.role==="publish-toggle";return I.jsxs("button",{type:"button",className:`nua-cadmin-toggle${r?" nua-cadmin-toggle-on":""}${i?" nua-cadmin-toggle-publish":""}`,role:"switch","aria-checked":r,onClick:()=>n(!r),children:[I.jsx("span",{className:"nua-cadmin-toggle-knob"}),I.jsx("span",{className:"nua-cadmin-toggle-label",children:r?"On":"Off"})]})}function rQ({field:t,value:e,onChange:n}){const r=t.options??[],i=Ps(e);return I.jsxs("select",{className:"nua-cadmin-input",value:i,onChange:s=>n(s.target.value),children:[t.required?null:I.jsx("option",{value:"",children:"— none —"}),r.map(s=>I.jsx("option",{value:s,children:s},s)),i!==""&&!r.includes(i)?I.jsxs("option",{value:i,children:[i," (current)"]}):null]})}function iQ({field:t,value:e,onChange:n,ctx:r}){const i=t.collection,[s,o]=ae.useState(null),[u,c]=ae.useState(!1),h=Ps(e);return ae.useEffect(()=>{if(!i)return;let d=!0;return r.client.getEntries(i,{fields:"slug,title",draft:"all",limit:200}).then(g=>{d&&o(g.entries.map(y=>y.slug))},()=>{d&&c(!0)}),()=>{d=!1}},[r.client,i]),!i||u?I.jsx("input",{type:"text",className:"nua-cadmin-input",value:h,placeholder:"entry slug",onChange:d=>n(d.target.value)}):s===null?I.jsxs("div",{className:"nua-cadmin-field-loading",children:["Loading ",i,"…"]}):I.jsxs("select",{className:"nua-cadmin-input",value:h,onChange:d=>n(d.target.value),children:[I.jsx("option",{value:"",children:"— none —"}),s.map(d=>I.jsx("option",{value:d,children:d},d)),h!==""&&!s.includes(h)?I.jsxs("option",{value:h,children:[h," (current)"]}):null]})}function sQ({field:t,value:e,onChange:n,ctx:r}){const i=tz(e),s=t.itemType??"text",o={name:t.name,type:s,required:!1,fields:t.fields,options:t.options,collection:t.collection},u=ae.useCallback((d,g)=>{const y=i.slice();y[d]=g,n(y)},[i,n]),c=ae.useCallback(d=>{n(i.filter((g,y)=>y!==d))},[i,n]),h=ae.useCallback(()=>{n([...i,PT(s)])},[i,s,n]);return I.jsxs("div",{className:"nua-cadmin-array",children:[i.length===0?I.jsx("div",{className:"nua-cadmin-field-empty",children:"No items."}):null,i.map((d,g)=>I.jsxs("div",{className:"nua-cadmin-array-item",children:[I.jsx("div",{className:"nua-cadmin-array-item-body",children:I.jsx(e0,{field:o,value:d,onChange:y=>u(g,y),ctx:r})}),I.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Remove item",onClick:()=>c(g),children:"×"})]},g)),I.jsx("button",{type:"button",className:"nua-cadmin-add-btn",onClick:h,children:"+ Add item"})]})}function aQ({field:t,value:e,onChange:n,ctx:r}){const i=nz(e),s=t.fields??[],o=ae.useCallback((u,c)=>{n({...i,[u]:c})},[i,n]);return s.length===0?I.jsx("div",{className:"nua-cadmin-field-empty",children:"No nested fields."}):I.jsx("div",{className:"nua-cadmin-object",children:s.map(u=>I.jsxs("div",{className:"nua-cadmin-object-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:u.name}),I.jsx("span",{className:"nua-cadmin-field-type",children:u.type})]}),I.jsx(e0,{field:u,value:i[u.name],onChange:c=>o(u.name,c),ctx:r})]},u.name))})}function e0({field:t,value:e,onChange:n,ctx:r}){switch(t.type){case"text":case"url":case"email":case"tel":case"color":return I.jsx(YY,{field:t,value:e,onChange:n});case"textarea":return I.jsx(WY,{field:t,value:e,onChange:n});case"markdown":return I.jsx(XY,{value:e,onChange:n,ctx:r});case"number":return I.jsx(ZY,{field:t,value:e,onChange:n});case"year":return I.jsx(eQ,{value:e,onChange:n});case"date":case"datetime":case"time":case"month":return I.jsx(tQ,{field:t,value:e,onChange:n});case"boolean":return I.jsx(nQ,{field:t,value:e,onChange:n});case"select":return I.jsx(rQ,{field:t,value:e,onChange:n});case"image":case"file":return I.jsx(qY,{client:r.client,value:Ps(e),collection:r.collection,entry:r.slug,field:t.name,accept:t.hints?.accept,onChange:i=>n(i)});case"reference":return I.jsx(iQ,{field:t,value:e,onChange:n,ctx:r});case"array":return I.jsx(sQ,{field:t,value:e,onChange:n,ctx:r});case"object":return I.jsx(aQ,{field:t,value:e,onChange:n,ctx:r})}}function oQ(t){return t.filter(e=>!e.hidden)}function lQ({client:t,definition:e,collection:n,onCreated:r,onCancel:i}){const s=ae.useMemo(()=>e?.fields??[],[e]),[o,u]=ae.useState(""),[c,h]=ae.useState(()=>X4(s)),[d,g]=ae.useState(!1),[y,b]=ae.useState(null),k=ae.useMemo(()=>({client:t,collection:n}),[t,n]),E=ae.useCallback((j,P)=>{h(U=>jT(U,j,P))},[]),N=ae.useCallback(async()=>{const j=o.trim();if(j===""){b("A slug is required.");return}g(!0),b(null);try{const P=await t.createEntry(n,{slug:j,frontmatter:c.frontmatter,body:c.body,fileExtension:e?.fileExtension});P.success?r(j):b(P.error??"Could not create the entry.")}catch(P){b(P instanceof Ci?P.message:"Could not create the entry.")}finally{g(!1)}},[t,n,e,c,o,r]),M=e?.type==="data";return I.jsxs("div",{className:"nua-cadmin-editor",children:[I.jsxs("div",{className:"nua-cadmin-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:"slug"}),I.jsx("span",{className:"nua-cadmin-field-type",children:"text · required"})]}),I.jsx("input",{type:"text",className:"nua-cadmin-input",value:o,placeholder:"my-new-entry",onChange:j=>u(j.target.value)})]}),oQ(s).map(j=>I.jsxs("div",{className:`nua-cadmin-field${j.role?` nua-cadmin-field-${j.role}`:""}`,children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:j.name}),I.jsxs("span",{className:"nua-cadmin-field-type",children:[j.type,j.required?" · required":""]})]}),I.jsx(e0,{field:j,value:c.frontmatter[j.name],onChange:P=>E(j.name,P),ctx:k})]},j.name)),M?null:I.jsxs("div",{className:"nua-cadmin-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:"Body"}),I.jsx("span",{className:"nua-cadmin-field-type",children:"markdown"})]}),I.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:10,onChange:j=>h(P=>({...P,body:j.target.value}))})]}),y?I.jsx("div",{className:"nua-cadmin-media-error",children:y}):null,I.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",disabled:d,onClick:i,children:"Cancel"}),I.jsx("span",{className:"nua-cadmin-spacer"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",disabled:d,onClick:()=>{N()},children:d?"Creating…":"Create entry"})]})]})}const uQ=700,cQ=4,fQ=t=>t.label??t.name,hQ=t=>{const e=t.replace(/[_-]+/g," ").trim();return e.charAt(0).toUpperCase()+e.slice(1)},LT=t=>t.role==="publish-toggle"?0:t.role==="publish-date"?1:2;function pQ(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 dQ(t){const e=[],n=new Map,r=[];for(const i of t)if(i.type==="object"||i.type==="array")r.push({title:i.label??hQ(i.name),fields:[i],collapsed:!0});else{const s=i.group??"";let o=n.get(s);o||(o={title:i.group,fields:[]},n.set(s,o),e.push(o)),o.fields.push(i)}return[...e,...r]}function mQ(t,e){const n=pQ(e.filter(g=>!g.hidden)),r=n.filter(g=>g.position==="header"),i=new Map(n.map(g=>[g.name,g])),s=t?.layout,o=[],u=new Set;for(const g of s?.sidebar??[]){const y=i.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)=>LT(g)-LT(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 k=b.fields.map(E=>i.get(E)).filter(E=>E!==void 0&&c.includes(E));for(const E of k)g.add(E.name);return{title:b.title,fields:k,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=dQ(c);const d=s?.display??(h.length>cQ?"tabs":"sections");return{header:r,sidebar:o,sections:h,display:d}}function gQ({field:t,draft:e,onField:n,ctx:r}){return I.jsxs("div",{className:`nua-cadmin-field${t.width==="half"?" nua-cadmin-field-half":""}${t.role?` nua-cadmin-field-${t.role}`:""}`,children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:fQ(t)}),I.jsxs("span",{className:"nua-cadmin-field-type",children:[t.type,t.required?" · required":""]})]}),t.help?I.jsx("div",{className:"nua-cadmin-field-help",children:t.help}):null,I.jsx(e0,{field:t,value:e.frontmatter[t.name],onChange:i=>n(t.name,i),ctx:r})]})}function uh({fields:t,draft:e,onField:n,ctx:r}){return I.jsx("div",{className:"nua-cadmin-field-grid",children:t.map(i=>I.jsx(gQ,{field:i,draft:e,onField:n,ctx:r},i.name))})}function yQ({sections:t,display:e,draft:n,onField:r,ctx:i}){const[s,o]=ae.useState(0);if(e==="tabs"){const u=t[Math.min(s,t.length-1)];return I.jsxs("div",{className:"nua-cadmin-tabs",children:[I.jsx("div",{className:"nua-cadmin-tabbar",role:"tablist",children:t.map((c,h)=>I.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?I.jsx(uh,{fields:u.fields,draft:n,onField:r,ctx:i}):null]})}return I.jsx(I.Fragment,{children:t.map((u,c)=>u.title===void 0?I.jsx(uh,{fields:u.fields,draft:n,onField:r,ctx:i},`section-${c}`):I.jsxs("details",{className:"nua-cadmin-section",open:!u.collapsed,children:[I.jsx("summary",{className:"nua-cadmin-section-summary",children:u.title}),I.jsx("div",{className:"nua-cadmin-section-body",children:I.jsx(uh,{fields:u.fields,draft:n,onField:r,ctx:i})})]},u.title))})}function xQ({onUseServer:t,onUseOurs:e,onDismiss:n}){return I.jsx("div",{className:"nua-cadmin-dialog-backdrop",role:"dialog","aria-modal":"true","aria-label":"Edit conflict",children:I.jsxs("div",{className:"nua-cadmin-dialog",children:[I.jsx("div",{className:"nua-cadmin-dialog-title",children:"This entry changed elsewhere"}),I.jsx("div",{className:"nua-cadmin-dialog-body",children:"Someone (or the agent) edited this entry after you opened it. Choose which version to keep."}),I.jsxs("div",{className:"nua-cadmin-dialog-actions",children:[I.jsx("button",{type:"button",className:"nua-cadmin-btn",onClick:t,children:"Use server version"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:e,children:"Keep my changes"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:n,children:"Keep editing"})]})]})})}function bQ({status:t}){switch(t.kind){case"saving":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saving",children:"Saving…"});case"saved":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saved",children:"Saved"});case"conflict":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-conflict",children:"Conflict"});case"error":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-error",children:t.message});default:return null}}function SQ({client:t,definition:e,collection:n,slug:r,onDeleted:i,onRenamed:s}){const o=ae.useMemo(()=>e?.fields??[],[e]),u=e?.fileExtension==="mdx",[c,h]=ae.useState(null),[d,g]=ae.useState(null),[y,b]=ae.useState({kind:"idle"}),[k,E]=ae.useState([]),[N,M]=ae.useState([]),j=ae.useRef(void 0),P=ae.useRef(null);P.current=c;const U=ae.useRef(null),L=ae.useMemo(()=>({client:t,collection:n,slug:r}),[t,n,r]),C=ae.useMemo(()=>({collection:n,entry:r}),[n,r]);ae.useEffect(()=>{let D=!0;return j.current=void 0,h(null),g(null),b({kind:"idle"}),t.getEntry(n,r).then(F=>{D&&h(W4(F,o))},F=>{D&&g(F instanceof Error?F:new Error(String(F)))}),()=>{D=!1,U.current&&clearTimeout(U.current)}},[t,n,r,o]),ae.useEffect(()=>{if(!u)return;let D=!0;return t.getComponents().then(F=>{D&&E(F)},()=>{D&&E([])}),()=>{D=!1}},[t,u]),ae.useEffect(()=>{if(!u)return;let D=!0;return t.getConfig().then(F=>{D&&M(F.listStyles??[])},()=>{D&&M([])}),()=>{D=!1}},[t,u]);const z=ae.useCallback(async(D,F)=>{b({kind:"saving"});try{const ee=await t.updateEntry(n,r,{frontmatter:D.frontmatter,body:D.body,baseHash:F});if(ee.status==="conflict"){b({kind:"conflict",conflict:ee.conflict});return}ee.result.sourceHash!==void 0&&(j.current=ee.result.sourceHash),b({kind:"saved"})}catch(ee){b({kind:"error",message:ee instanceof Ci?ee.message:"Save failed"})}},[t,n,r]),G=ae.useCallback(D=>{U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{z(D,j.current)},uQ)},[z]),J=ae.useCallback((D,F)=>{h(ee=>{if(!ee)return ee;const V=jT(ee,D,F);return G(V),V})},[G]),K=ae.useCallback(D=>{h(F=>{if(!F)return F;const ee={...F,body:D};return G(ee),ee})},[G]),de=ae.useCallback(()=>{if(y.kind!=="conflict")return;const D=Z4(y.conflict.serverFrontmatter,y.conflict.serverBody,o);j.current=y.conflict.serverHash,h(D),b({kind:"saved"})},[y,o]),ce=ae.useCallback(()=>{if(y.kind!=="conflict")return;const D=P.current;D&&z(D,y.conflict.serverHash)},[y,z]),Se=ae.useCallback(()=>{y.kind==="conflict"&&b({kind:"idle"})},[y]),Re=ae.useCallback(async()=>{if(!(typeof window<"u"&&!window.confirm(`Delete entry "${r}"? This cannot be undone.`)))try{await t.deleteEntry(n,r),i()}catch(D){b({kind:"error",message:D instanceof Ci?D.message:"Delete failed"})}},[t,n,r,i]),Y=ae.useCallback(async()=>{if(typeof window>"u")return;const D=window.prompt("Rename entry to (new slug):",r);if(!(D===null||D.trim()===""||D===r))try{await t.renameEntry(n,r,D.trim()),s(D.trim())}catch(F){b({kind:"error",message:F instanceof Ci?F.message:"Rename failed"})}},[t,n,r,s]);if(d)return I.jsxs("div",{className:"nua-cadmin-error",children:[I.jsx("div",{className:"nua-cadmin-error-title",children:"Could not load entry"}),I.jsx("div",{children:d.message})]});if(!c)return I.jsxs("div",{className:"nua-cadmin-state",children:[I.jsx("div",{className:"nua-cadmin-spinner"}),I.jsx("div",{children:"Loading entry…"})]});const{header:W,sidebar:ue,sections:ke,display:ze}=mQ(e,o);return I.jsxs("div",{className:"nua-cadmin-editor",children:[I.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[I.jsx(bQ,{status:y}),I.jsx("span",{className:"nua-cadmin-spacer"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:()=>{Y()},children:"Rename"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-danger",onClick:()=>{Re()},children:"Delete"})]}),W.length>0?I.jsx("div",{className:"nua-cadmin-editor-header-fields",children:I.jsx(uh,{fields:W,draft:c,onField:J,ctx:L})}):null,I.jsxs("div",{className:"nua-cadmin-editor-grid",children:[I.jsxs("div",{className:"nua-cadmin-editor-main",children:[I.jsx(yQ,{sections:ke,display:ze,draft:c,onField:J,ctx:L}),e?.type!=="data"?I.jsxs("div",{className:"nua-cadmin-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:"Body"}),I.jsx("span",{className:"nua-cadmin-field-type",children:u?"mdx":"markdown"})]}),u?I.jsx(B_,{value:c.body,onChange:K,components:k,listStyles:N,media:t,mediaContext:C}):I.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:16,onChange:D=>K(D.target.value)})]}):null]}),ue.length>0?I.jsx("div",{className:"nua-cadmin-editor-sidebar",children:I.jsx(uh,{fields:ue,draft:c,onField:J,ctx:L})}):null]}),y.kind==="conflict"?I.jsx(xQ,{onUseServer:de,onUseOurs:ce,onDismiss:Se}):null]})}function BT(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 vQ(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 kQ(t,e){const[n,r]=ae.useState({data:null,error:null,loading:!0}),[i,s]=ae.useState(0),o=ae.useRef(t);o.current=t;const u=[...e,i];ae.useEffect(()=>{let h=!0;return r({data:null,error:null,loading:!0}),o.current().then(d=>{h&&r({data:d,error:null,loading:!1})},d=>{h&&r({data:null,error:d instanceof Error?d:new Error(String(d)),loading:!1})}),()=>{h=!1}},u);const c=ae.useCallback(()=>s(h=>h+1),[]);return{...n,reload:c}}function CQ({label:t}){return I.jsxs("div",{className:"nua-cadmin-state",children:[I.jsx("div",{className:"nua-cadmin-spinner"}),I.jsx("div",{children:t})]})}function V_({error:t,onRetry:e}){const n=t instanceof Ci&&t.isUnauthorized?"Session expired":t instanceof Ci&&t.isForbidden?"No access":"Something went wrong";return I.jsxs("div",{className:"nua-cadmin-error",children:[I.jsx("div",{className:"nua-cadmin-error-title",children:n}),I.jsx("div",{children:t.message}),e?I.jsx("button",{type:"button",className:"nua-cadmin-retry",onClick:e,children:"Try again"}):null]})}function F_({label:t}){return I.jsx("div",{className:"nua-cadmin-state",children:t})}function wQ({collections:t,loading:e,error:n,activeCollection:r,onSelect:i,onReload:s,onClose:o}){const u=new Map;for(const d of t){if(!d.parentCollection)continue;const g=u.get(d.parentCollection)??[];g.push(d),u.set(d.parentCollection,g)}const c=t.filter(d=>!d.parentCollection),h=(d,g)=>I.jsxs("button",{type:"button",className:`nua-cadmin-nav-item${d.name===r?" is-active":""}`,style:g>0?{paddingLeft:12+g*14}:void 0,onClick:()=>i(d.name),title:d.name,children:[I.jsx("span",{className:"nua-cadmin-nav-label",children:d.label||d.name}),I.jsx("span",{className:"nua-cadmin-nav-count",children:d.entryCount})]},d.name);return I.jsxs("aside",{className:"nua-cadmin-sidebar",children:[I.jsxs("div",{className:"nua-cadmin-sidebar-head",children:[I.jsx("span",{className:"nua-cadmin-brand",children:"Collections"}),o?I.jsx("button",{type:"button",className:"nua-cadmin-close","aria-label":"Close",onClick:o,children:"×"}):null]}),I.jsxs("nav",{className:"nua-cadmin-nav",children:[e?I.jsx("div",{className:"nua-cadmin-nav-state",children:"Loading…"}):null,n?I.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?I.jsx("div",{className:"nua-cadmin-nav-state",children:"No content types"}):null,!e&&!n?c.flatMap(d=>[h(d,0),...(u.get(d.name)??[]).map(g=>h(g,1))]):null]})]})}const EQ=50,AQ="slug,title,draft,pathname";function NQ({client:t,collection:e,onOpen:n,onCreate:r}){const[i,s]=ae.useState([]),[o,u]=ae.useState(void 0),[c,h]=ae.useState(!1),[d,g]=ae.useState(null),[y,b]=ae.useState(!0),[k,E]=ae.useState(!1),N=ae.useCallback(async(j,P)=>{P?E(!0):b(!0),g(null);try{const U=await t.getEntries(e,{fields:AQ,draft:"all",limit:EQ,cursor:j});s(L=>P?[...L,...U.entries]:U.entries),u(U.cursor),h(U.hasMore)}catch(U){g(U instanceof Error?U:new Error(String(U)))}finally{b(!1),E(!1)}},[t,e]);if(ae.useEffect(()=>{s([]),u(void 0),h(!1),N(void 0,!1)},[N]),y)return I.jsx(CQ,{label:"Loading entries…"});if(d)return I.jsx(V_,{error:d,onRetry:()=>{N(void 0,!1)}});const M=I.jsx("div",{className:"nua-cadmin-entries-toolbar",children:I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:r,children:"+ New entry"})});return i.length===0?I.jsxs("div",{children:[M,I.jsx(F_,{label:"This collection has no entries."})]}):I.jsxs("div",{children:[M,I.jsxs("table",{className:"nua-cadmin-table",children:[I.jsx("thead",{children:I.jsxs("tr",{children:[I.jsx("th",{children:"Slug"}),I.jsx("th",{children:"Title"}),I.jsx("th",{children:"Draft"}),I.jsx("th",{children:"Pathname"})]})}),I.jsx("tbody",{children:i.map(j=>I.jsxs("tr",{className:"nua-cadmin-row",onClick:()=>n(j.slug),children:[I.jsx("td",{className:"nua-cadmin-cell-mono",children:j.slug}),I.jsx("td",{children:j.title??I.jsx("span",{className:"nua-cadmin-field-empty",children:"—"})}),I.jsx("td",{children:j.draft?I.jsx("span",{className:"nua-cadmin-badge nua-cadmin-badge-draft",children:"draft"}):""}),I.jsx("td",{className:"nua-cadmin-cell-mono",children:j.pathname??"—"})]},j.slug))})]}),c?I.jsx("button",{type:"button",className:"nua-cadmin-load-more",disabled:k,onClick:()=>{N(o,!0)},children:k?"Loading…":"Load more"}):null]})}function TQ({apiBase:t,onClose:e}){const n=ae.useMemo(()=>Y4(t),[t]),[r,i]=ae.useState(()=>typeof window<"u"?BT(window.location.hash):{view:"list"});ae.useEffect(()=>{const k=()=>i(BT(window.location.hash));return window.addEventListener("hashchange",k),k(),()=>window.removeEventListener("hashchange",k)},[]);const s=ae.useCallback(k=>{const E=vQ(k);typeof window<"u"&&window.location.hash!==E?window.location.hash=E:i(k)},[]),o=kQ(()=>n.getCollections(),[n]),u=o.data??[],c=r.view!=="list"?r.collection:void 0,h=c?u.find(k=>k.name===c):void 0,d=h?h.label||h.name:c??"",g=ae.useCallback(k=>s({view:"entries",collection:k}),[s]),y=ae.useCallback((k,E)=>s({view:"detail",collection:k,slug:E}),[s]),b=ae.useCallback(k=>s({view:"create",collection:k}),[s]);return I.jsxs("div",{className:"nua-cadmin",children:[I.jsx(wQ,{collections:u,loading:o.loading,error:o.error,activeCollection:c,onSelect:g,onReload:o.reload,onClose:e}),I.jsxs("main",{className:"nua-cadmin-main",children:[I.jsxs("div",{className:"nua-cadmin-header",children:[r.view==="detail"||r.view==="create"?I.jsxs("button",{type:"button",className:"nua-cadmin-back",onClick:()=>g(r.collection),children:["← ",d]}):null,I.jsxs("h2",{className:"nua-cadmin-title",children:[r.view==="list"?"Content":d,r.view==="detail"?I.jsxs("span",{className:"nua-cadmin-crumb",children:["/ ",r.slug]}):null,r.view==="create"?I.jsx("span",{className:"nua-cadmin-crumb",children:"/ new entry"}):null]}),I.jsx("span",{className:"nua-cadmin-spacer"})]}),I.jsxs("div",{className:"nua-cadmin-body",children:[r.view==="list"?o.error?I.jsx(V_,{error:o.error,onRetry:o.reload}):I.jsx(F_,{label:"Pick a content type from the left to browse its entries."}):null,r.view==="entries"?I.jsx(NQ,{client:n,collection:r.collection,onOpen:k=>y(r.collection,k),onCreate:()=>b(r.collection)}):null,r.view==="detail"?I.jsx(SQ,{client:n,definition:h,collection:r.collection,slug:r.slug,onDeleted:()=>g(r.collection),onRenamed:k=>y(r.collection,k)},`${r.collection}/${r.slug}`):null,r.view==="create"?I.jsx(lQ,{client:n,definition:h,collection:r.collection,onCreated:k=>y(r.collection,k),onCancel:()=>g(r.collection)}):null]})]})]})}const P_=document.getElementById("nua-studio-root");if(!P_)throw new Error("[cms-studio] #nua-studio-root container is missing");Mk.createRoot(P_).render(I.jsx(ae.StrictMode,{children:I.jsx(TQ,{apiBase:"/cms/v1"})}));