@nuasite/cms-studio 0.62.0 → 0.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
var aE=t=>{throw TypeError(t)};var oE=(t,e,n)=>e.has(t)||aE("Cannot "+n);var rt=(t,e,n)=>(oE(t,e,"read from private field"),n?n.call(t):e.get(t)),Kt=(t,e,n)=>e.has(t)?aE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ou=(t,e,n,r)=>(oE(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 WT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var sx={exports:{}},Wc={};var lE;function cL(){if(lE)return Wc;lE=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 Wc.Fragment=e,Wc.jsx=n,Wc.jsxs=n,Wc}var uE;function fL(){return uE||(uE=1,sx.exports=cL()),sx.exports}var O=fL();function hL(t){return t==null||t===""}function pL(t,e=()=>new Date){if(t.defaultValue!==void 0)return t.defaultValue;switch(t.type){case"boolean":return!1;case"number":return 0;case"array":return[];case"date":return e().toISOString().split("T")[0];default:return""}}function XT(t){if(t.defaultValue!==void 0)return t.defaultValue;switch(t.type){case"boolean":return!1;case"array":return[];case"object":return{};case"date":case"datetime":case"time":case"month":case"number":case"year":case"select":case"reference":return;default:return""}}function dL(t,e){const n={};for(const r of t)!r.required||r.hidden||(n[r.name]=pL(r,e));return n}function mL(t){return t.derivedDeclared===!0||t.layout?.derivedFrom!==void 0}const gL="slug",yL=new Set(["array","object","reference","image","file","video","boolean","number","date","datetime"]);function xL(t){return t.name===gL&&(t.type===void 0||!yL.has(t.type))}function bL(t,e,n){if(n==="")return e;const r=t.find(xL);return!r||mL(r)||!hL(e[r.name])?e:{...e,[r.name]:n}}const SL="en";function vL(t){let e=[];try{t!==void 0&&(e=Intl.Collator.supportedLocalesOf(t))}catch{}return new Intl.Collator(e.length>0?e:SL,{numeric:!0})}function kL(t,e){const n=vL(e.locale),r=t.filter(g=>!g.hidden).sort((g,y)=>{const b=g.order??Number.POSITIVE_INFINITY,k=y.order??Number.POSITIVE_INFINITY;return b!==k?b<k?-1:1:n.compare(g.label,y.label)||(g.name<y.name?-1:g.name>y.name?1:0)}),i=new Map(r.map(g=>[g.name,g])),s=g=>g.parentCollection===void 0?void 0:i.get(g.parentCollection),o=new Map,u=[],c=new Map,h=[];for(const g of r){const y=s(g);if(y&&!s(y)){h.push([y,g]);continue}const b={collection:g,children:[]};if(o.set(g.name,b),!g.group){u.push(b);continue}const k=c.get(g.group);k?k.push(b):c.set(g.group,[b])}for(const[g,y]of h)o.get(g.name)?.children.push(y);const d=u.length>0?[{items:u}]:[];for(const[g,y]of c)d.push({group:g,items:y});return d}function CL(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^\w\s\-/]/g,"").replace(/[\s_]+/g,"-").replace(/^[-/]+|[-/]+$/g,"")}const cE=new Set(["image/svg+xml","image/x-icon","image/vnd.microsoft.icon"]);function wL(t){const e=t.indexOf(";");return(e===-1?t:t.slice(0,e)).trim().toLowerCase()}function EL(t,e){if(e==="all")return!0;const n=wL(t);return e==="photo"?n.startsWith("image/")&&!cE.has(n):e==="graphic"?cE.has(n):e==="video"?n.startsWith("video/"):n==="application/pdf"}function AL(t,e){return e==="all"?t:t.filter(n=>EL(n.contentType,e))}const QT="video/mp4,video/webm",NL=409;class Ni 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 fE(t){return hh(t)&&typeof t.error=="string"&&typeof t.code=="string"}function hh(t){return typeof t=="object"&&t!==null}function TL(t){return hh(t)?t.code==="conflict"&&typeof t.serverHash=="string"&&hh(t.serverFrontmatter):!1}const ML=["not_found","conflict","validation","parse_error","io_error","unsupported","unauthorized"];function OL(t){return ML.includes(t)}function hE(t){return t instanceof Ni&&(t.status===501||t.code==="unsupported")}function RL(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(fE(h))return h.error;if(hh(h)){const g=h.error;if(hh(g)&&typeof g.message=="string")return g.message}return d}function s(h,d){return h===403?new Ni(403,"forbidden",i(d,"You do not have access to this project.")):fE(d)&&OL(d.code)?new Ni(h,d.code,d.error):h===401?new Ni(401,"unauthorized","Your session has expired. Please reload."):new Ni(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===NL){const k=await y.json().catch(()=>null);if(TL(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)),h.type!==void 0&&h.type!=="all"&&d.set("type",h.type),h.includeProjectImages&&d.set("includeProjectImages","true");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)}`},mediaAssetUrl(h){return`${e}/asset?path=${encodeURIComponent(h)}`},deleteMedia(h){return u(`/media/${encodeURIComponent(h)}`,"DELETE")},createFolder(h){return u("/media","POST",{folder:h})},updateMediaAnnotation(h,d){return u(`/media/${encodeURIComponent(h)}`,"PATCH",{annotation:d})}}}const DL=1e3;async function IL(t,e,n,r,i){const s=[];let o,u=!0;for(;u;){const c=await t.getEntries(e,{fields:n,draft:"all",limit:DL,cursor:o});u=c.hasMore;const h=Math.max(0,r-s.length),d=c.entries.length<=h?c.entries:c.entries.slice(0,h);s.push(...d);const g=s.length>=r;if(i?.(d,u&&!g),g)return{entries:s,truncated:u||c.entries.length>d.length};if(u){if(c.cursor===void 0)throw new Error("The CMS entries response is missing a pagination cursor.");o=c.cursor}}return{entries:s,truncated:!1}}function _L(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ZT(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 pE(e);case"array":case"object":return pE(e);default:return e}}function pE(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 LL(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?ZT(o.type,s.value):s.value}return{frontmatter:r,body:t.body}}function zL(t){const e={};for(const n of t)n.hidden||(e[n.name]=XT(n));return{frontmatter:e,body:""}}function BL(t){return XT({type:t})}function VL(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"?ZT(u.type,o):o}return{frontmatter:i,body:e??""}}function nl(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;case"select":case"reference":return e===""?void 0:e;default:return e}}function Ya(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function FL(t,e){if(t==null||t==="")return"";if(typeof t=="string"){const h=t.trim().match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/);if(h){const[,d,g,y,b,k]=h;switch(e){case"datetime":return`${d}-${g}-${y}T${b??"00"}:${k??"00"}`;case"time":return b?`${b}:${k}`:"";case"month":return`${d}-${g}`;default:return`${d}-${g}-${y}`}}if(e==="time"){const d=t.trim().match(/^(\d{2}):(\d{2})/);if(d)return`${d[1]}:${d[2]}`}}const n=t instanceof Date?t:new Date(String(t));if(Number.isNaN(n.getTime()))return"";const r=h=>String(h).padStart(2,"0"),i=n.getFullYear(),s=r(n.getMonth()+1),o=r(n.getDate()),u=r(n.getHours()),c=r(n.getMinutes());switch(e){case"datetime":return`${i}-${s}-${o}T${u}:${c}`;case"time":return`${u}:${c}`;case"month":return`${i}-${s}`;default:return`${i}-${s}-${o}`}}function PL(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"||t==="1"||t.toLowerCase()==="yes":!!t}function jL(t){return Array.isArray(t)?t:[]}function $L(t){return _L(t)?t:{}}function eM(t,e,n){return{...t,frontmatter:{...t.frontmatter,[e]:n}}}function UL(t){return t==null||t===""}function tM(t,e){return t.filter(n=>n.required&&!n.hidden&&!n.derivedDeclared&&UL(e[n.name])).map(n=>n.name)}function nM(t){return t.length===1?`“${t[0]}” is required.`:`Required fields are empty: ${t.join(", ")}.`}function JL(t,e,n){let r;async function i(s,o){try{const u=await t.updateEntry(e,n,{frontmatter:s.frontmatter,body:s.body,baseHash:o});return u.status==="conflict"?{status:"conflict",conflict:u.conflict}:(u.result.sourceHash!==void 0&&(r=u.result.sourceHash),{status:"saved",result:u.result})}catch(u){return{status:"error",message:u instanceof Ni?u.message:"Save failed",cause:u}}}return{get baseHash(){return r},save:s=>i(s,r),overwrite:(s,o)=>i(s,o.serverHash),adoptServer:(s,o)=>(r=s.serverHash,VL(s.serverFrontmatter,s.serverBody,o)),reset:()=>{r=void 0}}}const qL=4,HL=["title","name","heading","headline"];function KL(t){return t.toLowerCase().replace(/[_-]/g,"")}function GL(t){const e=t.filter(n=>n.type==="text"||n.type==="textarea");for(const n of HL){const r=e.find(i=>KL(i.name)===n);if(r)return r}}function rM(t){return t.label??t.name}function YL(t){const e=t.replace(/[_-]+/g," ").trim();return e.charAt(0).toUpperCase()+e.slice(1)}function dE(t){return t.role==="publish-toggle"?0:t.role==="publish-date"?1:2}function WL(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 XL(t){const e=[],n=new Map,r=[];for(const i of t)if(i.type==="object"||i.type==="array")r.push({title:i.label??YL(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 QL(t){const e=new Set;for(const n of t?.sections??[])for(const r of n.fields)e.add(r);return e}function ZL(t,e){return new Set([...t?.sidebar??[],...e])}function iM(t,e){const n=WL(t.filter(k=>!k.hidden)),r=new Map(n.map(k=>[k.name,k])),i=QL(e),s=ZL(e,i),o=GL(n),u=o&&!s.has(o.name)&&!o.positionDeclared&&o.position!=="header"?o:void 0,c=n.filter(k=>k!==u&&k.position==="header"),h=[],d=new Set;for(const k of e?.sidebar??[]){const w=r.get(k);w&&w!==u&&w.position!=="header"&&!d.has(k)&&(h.push(w),d.add(k))}for(const k of n)k===u||k.position==="header"||d.has(k.name)||i.has(k.name)||(k.position==="sidebar"||k.role!==void 0)&&(h.push(k),d.add(k.name));h.sort((k,w)=>dE(k)-dE(w));const g=n.filter(k=>k!==u&&k.position!=="header"&&!d.has(k.name));let y;if(e?.sections&&e.sections.length>0){const k=new Set;y=e.sections.map(N=>{const T=ez(N.fields,r,g,k);return{title:N.title,fields:T,collapsed:N.collapsed}}).filter(N=>N.fields.length>0);const w=g.filter(N=>!k.has(N.name));w.length>0&&y.push({title:"Other",fields:w})}else y=XL(g);const b=e?.display??(y.length>qL?"tabs":"sections");return{title:u,header:c,sidebar:h,sections:y,display:b}}function ez(t,e,n,r){const i=[];for(const s of t){const o=e.get(s);!o||r.has(s)||!n.includes(o)||(r.add(s),i.push(o))}return i}const tz=/^(https?:)?\/\/|^data:/i,nz=/\.(png|jpe?g|gif|webp|avif|svg|ico|bmp)(\?|#|$)/i,rz=/\.(mp4|webm)(\?|#|$)/i;function iz(t,e,n,r){return e===""?"":tz.test(e)?e:e.startsWith("/")?t.mediaAssetUrl(e):r===void 0?"":t.mediaFileUrl(n,r,e)}function sz(t){return t.startsWith("data:image/")||nz.test(t)}function az(t){return t.startsWith("data:video/")||rz.test(t)}var ax={exports:{}},Xe={};var mE;function oz(){if(mE)return Xe;mE=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(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,N={};function T(P,te,L){this.props=P,this.context=te,this.refs=N,this.updater=L||k}T.prototype.isReactComponent={},T.prototype.setState=function(P,te){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,te,"setState")},T.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function F(){}F.prototype=T.prototype;function V(P,te,L){this.props=P,this.context=te,this.refs=N,this.updater=L||k}var H=V.prototype=new F;H.constructor=V,w(H,T.prototype),H.isPureReactComponent=!0;var z=Array.isArray;function C(){}var _={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function $(P,te,L){var xe=L.ref;return{$$typeof:t,type:P,key:te,ref:xe!==void 0?xe:null,props:L}}function q(P,te){return $(P.type,te,P.props)}function ue(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function ae(P){var te={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(L){return te[L]})}var Se=/\/+/g;function Ee(P,te){return typeof P=="object"&&P!==null&&P.key!=null?ae(""+P.key):te.toString(36)}function Y(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(C,C):(P.status="pending",P.then(function(te){P.status==="pending"&&(P.status="fulfilled",P.value=te)},function(te){P.status==="pending"&&(P.status="rejected",P.reason=te)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function X(P,te,L,xe,Te){var Ae=typeof P;(Ae==="undefined"||Ae==="boolean")&&(P=null);var He=!1;if(P===null)He=!0;else switch(Ae){case"bigint":case"string":case"number":He=!0;break;case"object":switch(P.$$typeof){case t:case e:He=!0;break;case d:return He=P._init,X(He(P._payload),te,L,xe,Te)}}if(He)return Te=Te(P),He=xe===""?"."+Ee(P,0):xe,z(Te)?(L="",He!=null&&(L=He.replace(Se,"$&/")+"/"),X(Te,te,L,"",function(Ft){return Ft})):Te!=null&&(ue(Te)&&(Te=q(Te,L+(Te.key==null||P&&P.key===Te.key?"":(""+Te.key).replace(Se,"$&/")+"/")+He)),te.push(Te)),1;He=0;var pt=xe===""?".":xe+":";if(z(P))for(var Ke=0;Ke<P.length;Ke++)xe=P[Ke],Ae=pt+Ee(xe,Ke),He+=X(xe,te,L,Ae,Te);else if(Ke=b(P),typeof Ke=="function")for(P=Ke.call(P),Ke=0;!(xe=P.next()).done;)xe=xe.value,Ae=pt+Ee(xe,Ke++),He+=X(xe,te,L,Ae,Te);else if(Ae==="object"){if(typeof P.then=="function")return X(Y(P),te,L,xe,Te);throw te=String(P),Error("Objects are not valid as a React child (found: "+(te==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":te)+"). If you meant to render a collection of children, use an array instead.")}return He}function le(P,te,L){if(P==null)return P;var xe=[],Te=0;return X(P,xe,"","",function(Ae){return te.call(L,Ae,Te++)}),xe}function Ce(P){if(P._status===-1){var te=P._result;te=te(),te.then(function(L){(P._status===0||P._status===-1)&&(P._status=1,P._result=L)},function(L){(P._status===0||P._status===-1)&&(P._status=2,P._result=L)}),P._status===-1&&(P._status=0,P._result=te)}if(P._status===1)return P._result.default;throw P._result}var _e=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var te=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(te))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},j={map:le,forEach:function(P,te,L){le(P,function(){te.apply(this,arguments)},L)},count:function(P){var te=0;return le(P,function(){te++}),te},toArray:function(P){return le(P,function(te){return te})||[]},only:function(P){if(!ue(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Xe.Activity=g,Xe.Children=j,Xe.Component=T,Xe.Fragment=n,Xe.Profiler=i,Xe.PureComponent=V,Xe.StrictMode=r,Xe.Suspense=c,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(P){return _.H.useMemoCache(P)}},Xe.cache=function(P){return function(){return P.apply(null,arguments)}},Xe.cacheSignal=function(){return null},Xe.cloneElement=function(P,te,L){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var xe=w({},P.props),Te=P.key;if(te!=null)for(Ae in te.key!==void 0&&(Te=""+te.key),te)!U.call(te,Ae)||Ae==="key"||Ae==="__self"||Ae==="__source"||Ae==="ref"&&te.ref===void 0||(xe[Ae]=te[Ae]);var Ae=arguments.length-2;if(Ae===1)xe.children=L;else if(1<Ae){for(var He=Array(Ae),pt=0;pt<Ae;pt++)He[pt]=arguments[pt+2];xe.children=He}return $(P.type,Te,xe)},Xe.createContext=function(P){return P={$$typeof:o,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:s,_context:P},P},Xe.createElement=function(P,te,L){var xe,Te={},Ae=null;if(te!=null)for(xe in te.key!==void 0&&(Ae=""+te.key),te)U.call(te,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(Te[xe]=te[xe]);var He=arguments.length-2;if(He===1)Te.children=L;else if(1<He){for(var pt=Array(He),Ke=0;Ke<He;Ke++)pt[Ke]=arguments[Ke+2];Te.children=pt}if(P&&P.defaultProps)for(xe in He=P.defaultProps,He)Te[xe]===void 0&&(Te[xe]=He[xe]);return $(P,Ae,Te)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(P){return{$$typeof:u,render:P}},Xe.isValidElement=ue,Xe.lazy=function(P){return{$$typeof:d,_payload:{_status:-1,_result:P},_init:Ce}},Xe.memo=function(P,te){return{$$typeof:h,type:P,compare:te===void 0?null:te}},Xe.startTransition=function(P){var te=_.T,L={};_.T=L;try{var xe=P(),Te=_.S;Te!==null&&Te(L,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(C,_e)}catch(Ae){_e(Ae)}finally{te!==null&&L.types!==null&&(te.types=L.types),_.T=te}},Xe.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()},Xe.use=function(P){return _.H.use(P)},Xe.useActionState=function(P,te,L){return _.H.useActionState(P,te,L)},Xe.useCallback=function(P,te){return _.H.useCallback(P,te)},Xe.useContext=function(P){return _.H.useContext(P)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(P,te){return _.H.useDeferredValue(P,te)},Xe.useEffect=function(P,te){return _.H.useEffect(P,te)},Xe.useEffectEvent=function(P){return _.H.useEffectEvent(P)},Xe.useId=function(){return _.H.useId()},Xe.useImperativeHandle=function(P,te,L){return _.H.useImperativeHandle(P,te,L)},Xe.useInsertionEffect=function(P,te){return _.H.useInsertionEffect(P,te)},Xe.useLayoutEffect=function(P,te){return _.H.useLayoutEffect(P,te)},Xe.useMemo=function(P,te){return _.H.useMemo(P,te)},Xe.useOptimistic=function(P,te){return _.H.useOptimistic(P,te)},Xe.useReducer=function(P,te,L){return _.H.useReducer(P,te,L)},Xe.useRef=function(P){return _.H.useRef(P)},Xe.useState=function(P){return _.H.useState(P)},Xe.useSyncExternalStore=function(P,te,L){return _.H.useSyncExternalStore(P,te,L)},Xe.useTransition=function(){return _.H.useTransition()},Xe.version="19.2.7",Xe}var gE;function dS(){return gE||(gE=1,ax.exports=oz()),ax.exports}var ee=dS();function lz(t){const e={};for(const n of t.props)e[n.name]=n.defaultValue??"";return e}const uz={position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:1e3},cz={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},fz={border:"none",borderBottom:"1px solid #ececed",padding:"10px 12px",font:"inherit",outline:"none"},hz={textAlign:"left",border:"none",background:"transparent",padding:"8px 12px",cursor:"pointer",borderRadius:0};function pz({open:t,components:e,onInsert:n,onClose:r}){const[i,s]=ee.useState(""),o=ee.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?O.jsx("div",{style:uz,onMouseDown:r,children:O.jsxs("div",{style:cz,onMouseDown:u=>u.stopPropagation(),children:[O.jsx("input",{style:fz,placeholder:"Search components…",autoFocus:!0,value:i,onChange:u=>s(u.target.value)}),O.jsxs("div",{style:{overflowY:"auto"},children:[o.length===0?O.jsx("div",{style:{padding:12,color:"#a1a1aa"},children:"No components"}):null,o.map(u=>O.jsxs("button",{type:"button",style:hz,onClick:()=>{n(u.name,lz(u)),r()},children:[O.jsx("div",{style:{fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},children:u.name}),u.description?O.jsx("div",{style:{color:"#71717a",fontSize:12},children:u.description}):null]},u.name))]})]})}):null}var ci=(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})({}),fi=class extends Error{constructor(t,e){super(e),this.name="MilkdownError",this.code=t}},dz=(t,e)=>typeof e=="function"?"[Function]":e,Sg=t=>JSON.stringify(t,dz);function mz(t){return new fi(ci.docTypeError,`Doc type error, unsupported type: ${Sg(t)}`)}function gz(t){return new fi(ci.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function yz(t){return new fi(ci.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function vg(){return new fi(ci.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function xz(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 fi(ci.createNodeInParserFail,s.join(`
|
|
2
|
-
`))}function sM(){return new fi(ci.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function bz(t){return new fi(ci.parserMatchError,`Cannot match target parser for node: ${Sg(t)}.`)}function Sz(t){return new fi(ci.serializerMatchError,`Cannot match target serializer for node: ${Sg(t)}.`)}function Gi(t){return new fi(ci.expectDomTypeError,`Expect to be a dom, but get: ${Sg(t)}.`)}function ox(){return new fi(ci.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 vz(t){return new fi(ci.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${t}" in schema.`)}function kz(t){return new fi(ci.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${t}" in schema.`)}var aM=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 gz(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)}},Cz=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=[]}},wz=class{constructor(t,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=t,this._typeInfo=()=>{throw vg()}}create(t,e=this._defaultValue){return new Cz(t,e,this)}},lt=(t,e)=>new wz(t,e),Ez=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},Az=class oM{#t;#e;#r;#n;constructor(e,n,r){this.produce=i=>i&&Object.keys(i).length?new oM(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 Ez(e,n,r))}get meta(){return this.#r}get inspector(){return this.#n}},Nz=class{constructor(){this.store=new Map,this.get=t=>{const e=this.store.get(t.id);if(!e)throw yz(t.name);return e},this.remove=t=>{this.store.delete(t.id)},this.has=t=>this.store.has(t.id)}},Tz=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)}},Mz=class{constructor(t,e=3e3){this.create=n=>new Tz(n,this),this.id=Symbol(`Timer-${t}`),this.name=t,this.timeout=e}},Yi=(t,e=3e3)=>new Mz(t,e);const Oz={};function mS(t,e){const n=Oz,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lM(t,r,i)}function lM(t,e,n){if(Rz(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 yE(t.children,e,n)}return Array.isArray(t)?yE(t,e,n):""}function yE(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=lM(t[i],e,n);return r.join("")}function Rz(t){return!!(t&&typeof t=="object")}const xE=document.createElement("i");function ph(t){const e="&"+t+";";xE.innerHTML=e;const n=xE.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ir(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 ni(t,e){return t.length>0?(Ir(t,t.length,0,e),t):e}const bE={}.hasOwnProperty;function gS(t){const e={};let n=-1;for(;++n<t.length;)Dz(e,t[n]);return e}function Dz(t,e){let n;for(n in e){const i=(bE.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){bE.call(i,o)||(i[o]=[]);const u=s[o];Iz(i[o],Array.isArray(u)?u:u?[u]:[])}}}function Iz(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ir(t,0,0,r)}function uM(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 Ti(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cn=Wa(/[A-Za-z]/),On=Wa(/[\dA-Za-z]/),_z=Wa(/[#-'*+\--9=?A-Z^-~]/);function Em(t){return t!==null&&(t<32||t===127)}const V1=Wa(/\d/),Lz=Wa(/[\dA-Fa-f]/),zz=Wa(/[!-/:-@[-`{-~]/);function we(t){return t!==null&&t<-2}function tt(t){return t!==null&&(t<0||t===32)}function Ye(t){return t===-2||t===-1||t===32}const kg=Wa(new RegExp("\\p{P}|\\p{S}","u")),Kn=Wa(/\s/);function Wa(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function We(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return Ye(c)?(t.enter(n),u(c)):e(c)}function u(c){return Ye(c)&&s++<i?(t.consume(c),u):(t.exit(n),e(c))}}const Bz={tokenize:Vz};function Vz(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"),We(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 we(u)?(t.consume(u),t.exit("chunkText"),s):(t.consume(u),o)}}const Fz={tokenize:Pz},SE={tokenize:jz};function Pz(t){const e=this,n=[];let r=0,i,s,o;return u;function u(V){if(r<n.length){const H=n[r];return e.containerState=H[1],t.attempt(H[0].continuation,c,h)(V)}return h(V)}function c(V){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&F();const H=e.events.length;let z=H,C;for(;z--;)if(e.events[z][0]==="exit"&&e.events[z][1].type==="chunkFlow"){C=e.events[z][1].end;break}T(r);let _=H;for(;_<e.events.length;)e.events[_][1].end={...C},_++;return Ir(e.events,z+1,0,e.events.slice(H)),e.events.length=_,h(V)}return u(V)}function h(V){if(r===n.length){if(!i)return y(V);if(i.currentConstruct&&i.currentConstruct.concrete)return k(V);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(SE,d,g)(V)}function d(V){return i&&F(),T(r),y(V)}function g(V){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,k(V)}function y(V){return e.containerState={},t.attempt(SE,b,k)(V)}function b(V){return r++,n.push([e.currentConstruct,e.containerState]),y(V)}function k(V){if(V===null){i&&F(),T(0),t.consume(V);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(V)}function w(V){if(V===null){N(t.exit("chunkFlow"),!0),T(0),t.consume(V);return}return we(V)?(t.consume(V),N(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(V),w)}function N(V,H){const z=e.sliceStream(V);if(H&&z.push(null),V.previous=s,s&&(s.next=V),s=V,i.defineSkip(V.start),i.write(z),e.parser.lazy[V.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 _=e.events.length;let U=_,$,q;for(;U--;)if(e.events[U][0]==="exit"&&e.events[U][1].type==="chunkFlow"){if($){q=e.events[U][1].end;break}$=!0}for(T(r),C=_;C<e.events.length;)e.events[C][1].end={...q},C++;Ir(e.events,U+1,0,e.events.slice(_)),e.events.length=C}}function T(V){let H=n.length;for(;H-- >V;){const z=n[H];e.containerState=z[1],z[0].exit.call(e,t)}n.length=V}function F(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function jz(t,e,n){return We(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Lu(t){if(t===null||tt(t)||Kn(t))return 1;if(kg(t))return 2}function Cg(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 F1={name:"attention",resolveAll:$z,tokenize:Uz};function $z(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};vE(g,-c),vE(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=ni(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=ni(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=ni(h,Cg(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=ni(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=ni(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,Ir(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 Uz(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Lu(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=Lu(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 vE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Jz={name:"autolink",tokenize:qz};function qz(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 cn(b)?(t.consume(b),o):b===64?n(b):h(b)}function o(b){return b===43||b===45||b===46||On(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||On(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||Em(b)?n(b):(t.consume(b),c)}function h(b){return b===64?(t.consume(b),d):_z(b)?(t.consume(b),h):n(b)}function d(b){return On(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||On(b))&&r++<63){const k=b===45?y:g;return t.consume(b),k}return n(b)}}const Uu={partial:!0,tokenize:Hz};function Hz(t,e,n){return r;function r(s){return Ye(s)?We(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||we(s)?e(s):n(s)}}const cM={continuation:{tokenize:Gz},exit:Yz,name:"blockQuote",tokenize:Kz};function Kz(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 Ye(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function Gz(t,e,n){const r=this;return i;function i(o){return Ye(o)?We(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(cM,e,n)(o)}}function Yz(t){t.exit("blockQuote")}const fM={name:"characterEscape",tokenize:Wz};function Wz(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 zz(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const hM={name:"characterReference",tokenize:Xz};function Xz(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=On,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=Lz,d):(t.enter("characterReferenceValue"),s=7,o=V1,d(g))}function d(g){if(g===59&&i){const y=t.exit("characterReferenceValue");return o===On&&!ph(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 kE={partial:!0,tokenize:Zz},CE={concrete:!0,name:"codeFenced",tokenize:Qz};function Qz(t,e,n){const r=this,i={partial:!0,tokenize:z};let s=0,o=0,u;return c;function c(C){return h(C)}function h(C){const _=r.events[r.events.length-1];return s=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[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"),Ye(C)?We(t,g,"whitespace")(C):g(C))}function g(C){return C===null||we(C)?(t.exit("codeFencedFence"),r.interrupt?e(C):t.check(kE,w,H)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||we(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(C)):Ye(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),We(t,b,"whitespace")(C)):C===96&&C===u?n(C):(t.consume(C),y)}function b(C){return C===null||we(C)?g(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),k(C))}function k(C){return C===null||we(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(C)):C===96&&C===u?n(C):(t.consume(C),k)}function w(C){return t.attempt(i,H,N)(C)}function N(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),T}function T(C){return s>0&&Ye(C)?We(t,F,"linePrefix",s+1)(C):F(C)}function F(C){return C===null||we(C)?t.check(kE,w,H)(C):(t.enter("codeFlowValue"),V(C))}function V(C){return C===null||we(C)?(t.exit("codeFlowValue"),F(C)):(t.consume(C),V)}function H(C){return t.exit("codeFenced"),e(C)}function z(C,_,U){let $=0;return q;function q(Y){return C.enter("lineEnding"),C.consume(Y),C.exit("lineEnding"),ue}function ue(Y){return C.enter("codeFencedFence"),Ye(Y)?We(C,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):ae(Y)}function ae(Y){return Y===u?(C.enter("codeFencedFenceSequence"),Se(Y)):U(Y)}function Se(Y){return Y===u?($++,C.consume(Y),Se):$>=o?(C.exit("codeFencedFenceSequence"),Ye(Y)?We(C,Ee,"whitespace")(Y):Ee(Y)):U(Y)}function Ee(Y){return Y===null||we(Y)?(C.exit("codeFencedFence"),_(Y)):U(Y)}}}function Zz(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 lx={name:"codeIndented",tokenize:t5},e5={partial:!0,tokenize:n5};function t5(t,e,n){const r=this;return i;function i(h){return t.enter("codeIndented"),We(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):we(h)?t.attempt(e5,o,c)(h):(t.enter("codeFlowValue"),u(h))}function u(h){return h===null||we(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),u)}function c(h){return t.exit("codeIndented"),e(h)}}function n5(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):we(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):We(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):we(o)?i(o):n(o)}}const r5={name:"codeText",previous:s5,resolve:i5,tokenize:a5};function i5(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 s5(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function a5(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)):we(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||we(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 o5{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&&Xc(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),Xc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Xc(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);Xc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Xc(this.left,n.reverse())}}}function Xc(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 pM(t){const e={};let n=-1,r,i,s,o,u,c,h;const d=new o5(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,l5(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 Ir(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!h}function l5(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,w=0;const N=[w];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&&(w=y+1,N.push(w),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 T=u.slice(N[y],N[y+1]),F=s.pop();c.push([F,F+T.length-1]),t.splice(F,2,T)}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 u5={resolve:f5,tokenize:h5},c5={partial:!0,tokenize:p5};function f5(t){return pM(t),t}function h5(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):we(u)?t.check(c5,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 p5(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),We(t,s,"linePrefix")}function s(o){if(o===null||we(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 dM(t,e,n,r,i,s,o,u,c){const h=c||Number.POSITIVE_INFINITY;let d=0;return g;function g(T){return T===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(T),t.exit(s),y):T===null||T===32||T===41||Em(T)?n(T):(t.enter(r),t.enter(o),t.enter(u),t.enter("chunkString",{contentType:"string"}),w(T))}function y(T){return T===62?(t.enter(s),t.consume(T),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(u),t.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===62?(t.exit("chunkString"),t.exit(u),y(T)):T===null||T===60||we(T)?n(T):(t.consume(T),T===92?k:b)}function k(T){return T===60||T===62||T===92?(t.consume(T),b):b(T)}function w(T){return!d&&(T===null||T===41||tt(T))?(t.exit("chunkString"),t.exit(u),t.exit(o),t.exit(r),e(T)):d<h&&T===40?(t.consume(T),d++,w):T===41?(t.consume(T),d--,w):T===null||T===32||T===40||Em(T)?n(T):(t.consume(T),T===92?N:w)}function N(T){return T===40||T===41||T===92?(t.consume(T),w):w(T)}}function mM(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):we(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||we(b)||u++>999?(t.exit("chunkString"),d(b)):(t.consume(b),c||(c=!Ye(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(t.consume(b),u++,g):g(b)}}function gM(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):we(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),We(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===o||y===null||we(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 we(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ye(i)?We(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const d5={name:"definition",tokenize:g5},m5={partial:!0,tokenize:y5};function g5(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),o(b)}function o(b){return mM.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return i=Ti(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 tt(b)?Ts(t,h)(b):h(b)}function h(b){return dM(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function d(b){return t.attempt(m5,g,g)(b)}function g(b){return Ye(b)?We(t,y,"whitespace")(b):y(b)}function y(b){return b===null||we(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function y5(t,e,n){return r;function r(u){return tt(u)?Ts(t,i)(u):n(u)}function i(u){return gM(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return Ye(u)?We(t,o,"whitespace")(u):o(u)}function o(u){return u===null||we(u)?e(u):n(u)}}const x5={name:"hardBreakEscape",tokenize:b5};function b5(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return we(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const S5={name:"headingAtx",resolve:v5,tokenize:k5};function v5(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"},Ir(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function k5(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||tt(d)?(t.exit("atxHeadingSequence"),u(d)):n(d)}function u(d){return d===35?(t.enter("atxHeadingSequence"),c(d)):d===null||we(d)?(t.exit("atxHeading"),e(d)):Ye(d)?We(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||tt(d)?(t.exit("atxHeadingText"),u(d)):(t.consume(d),h)}}const C5=["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"],wE=["pre","script","style","textarea"],w5={concrete:!0,name:"htmlFlow",resolveTo:N5,tokenize:T5},E5={partial:!0,tokenize:O5},A5={partial:!0,tokenize:M5};function N5(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 T5(t,e,n){const r=this;let i,s,o,u,c;return h;function h(L){return d(L)}function d(L){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(L),g}function g(L){return L===33?(t.consume(L),y):L===47?(t.consume(L),s=!0,w):L===63?(t.consume(L),i=3,r.interrupt?e:j):cn(L)?(t.consume(L),o=String.fromCharCode(L),N):n(L)}function y(L){return L===45?(t.consume(L),i=2,b):L===91?(t.consume(L),i=5,u=0,k):cn(L)?(t.consume(L),i=4,r.interrupt?e:j):n(L)}function b(L){return L===45?(t.consume(L),r.interrupt?e:j):n(L)}function k(L){const xe="CDATA[";return L===xe.charCodeAt(u++)?(t.consume(L),u===xe.length?r.interrupt?e:ae:k):n(L)}function w(L){return cn(L)?(t.consume(L),o=String.fromCharCode(L),N):n(L)}function N(L){if(L===null||L===47||L===62||tt(L)){const xe=L===47,Te=o.toLowerCase();return!xe&&!s&&wE.includes(Te)?(i=1,r.interrupt?e(L):ae(L)):C5.includes(o.toLowerCase())?(i=6,xe?(t.consume(L),T):r.interrupt?e(L):ae(L)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):s?F(L):V(L))}return L===45||On(L)?(t.consume(L),o+=String.fromCharCode(L),N):n(L)}function T(L){return L===62?(t.consume(L),r.interrupt?e:ae):n(L)}function F(L){return Ye(L)?(t.consume(L),F):q(L)}function V(L){return L===47?(t.consume(L),q):L===58||L===95||cn(L)?(t.consume(L),H):Ye(L)?(t.consume(L),V):q(L)}function H(L){return L===45||L===46||L===58||L===95||On(L)?(t.consume(L),H):z(L)}function z(L){return L===61?(t.consume(L),C):Ye(L)?(t.consume(L),z):V(L)}function C(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(t.consume(L),c=L,_):Ye(L)?(t.consume(L),C):U(L)}function _(L){return L===c?(t.consume(L),c=null,$):L===null||we(L)?n(L):(t.consume(L),_)}function U(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||tt(L)?z(L):(t.consume(L),U)}function $(L){return L===47||L===62||Ye(L)?V(L):n(L)}function q(L){return L===62?(t.consume(L),ue):n(L)}function ue(L){return L===null||we(L)?ae(L):Ye(L)?(t.consume(L),ue):n(L)}function ae(L){return L===45&&i===2?(t.consume(L),X):L===60&&i===1?(t.consume(L),le):L===62&&i===4?(t.consume(L),P):L===63&&i===3?(t.consume(L),j):L===93&&i===5?(t.consume(L),_e):we(L)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(E5,te,Se)(L)):L===null||we(L)?(t.exit("htmlFlowData"),Se(L)):(t.consume(L),ae)}function Se(L){return t.check(A5,Ee,te)(L)}function Ee(L){return t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),Y}function Y(L){return L===null||we(L)?Se(L):(t.enter("htmlFlowData"),ae(L))}function X(L){return L===45?(t.consume(L),j):ae(L)}function le(L){return L===47?(t.consume(L),o="",Ce):ae(L)}function Ce(L){if(L===62){const xe=o.toLowerCase();return wE.includes(xe)?(t.consume(L),P):ae(L)}return cn(L)&&o.length<8?(t.consume(L),o+=String.fromCharCode(L),Ce):ae(L)}function _e(L){return L===93?(t.consume(L),j):ae(L)}function j(L){return L===62?(t.consume(L),P):L===45&&i===2?(t.consume(L),j):ae(L)}function P(L){return L===null||we(L)?(t.exit("htmlFlowData"),te(L)):(t.consume(L),P)}function te(L){return t.exit("htmlFlow"),e(L)}}function M5(t,e,n){const r=this;return i;function i(o){return we(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 O5(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Uu,e,n)}}const R5={name:"htmlText",tokenize:D5};function D5(t,e,n){const r=this;let i,s,o;return u;function u(j){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(j),c}function c(j){return j===33?(t.consume(j),h):j===47?(t.consume(j),z):j===63?(t.consume(j),V):cn(j)?(t.consume(j),U):n(j)}function h(j){return j===45?(t.consume(j),d):j===91?(t.consume(j),s=0,k):cn(j)?(t.consume(j),F):n(j)}function d(j){return j===45?(t.consume(j),b):n(j)}function g(j){return j===null?n(j):j===45?(t.consume(j),y):we(j)?(o=g,le(j)):(t.consume(j),g)}function y(j){return j===45?(t.consume(j),b):g(j)}function b(j){return j===62?X(j):j===45?y(j):g(j)}function k(j){const P="CDATA[";return j===P.charCodeAt(s++)?(t.consume(j),s===P.length?w:k):n(j)}function w(j){return j===null?n(j):j===93?(t.consume(j),N):we(j)?(o=w,le(j)):(t.consume(j),w)}function N(j){return j===93?(t.consume(j),T):w(j)}function T(j){return j===62?X(j):j===93?(t.consume(j),T):w(j)}function F(j){return j===null||j===62?X(j):we(j)?(o=F,le(j)):(t.consume(j),F)}function V(j){return j===null?n(j):j===63?(t.consume(j),H):we(j)?(o=V,le(j)):(t.consume(j),V)}function H(j){return j===62?X(j):V(j)}function z(j){return cn(j)?(t.consume(j),C):n(j)}function C(j){return j===45||On(j)?(t.consume(j),C):_(j)}function _(j){return we(j)?(o=_,le(j)):Ye(j)?(t.consume(j),_):X(j)}function U(j){return j===45||On(j)?(t.consume(j),U):j===47||j===62||tt(j)?$(j):n(j)}function $(j){return j===47?(t.consume(j),X):j===58||j===95||cn(j)?(t.consume(j),q):we(j)?(o=$,le(j)):Ye(j)?(t.consume(j),$):X(j)}function q(j){return j===45||j===46||j===58||j===95||On(j)?(t.consume(j),q):ue(j)}function ue(j){return j===61?(t.consume(j),ae):we(j)?(o=ue,le(j)):Ye(j)?(t.consume(j),ue):$(j)}function ae(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),i=j,Se):we(j)?(o=ae,le(j)):Ye(j)?(t.consume(j),ae):(t.consume(j),Ee)}function Se(j){return j===i?(t.consume(j),i=void 0,Y):j===null?n(j):we(j)?(o=Se,le(j)):(t.consume(j),Se)}function Ee(j){return j===null||j===34||j===39||j===60||j===61||j===96?n(j):j===47||j===62||tt(j)?$(j):(t.consume(j),Ee)}function Y(j){return j===47||j===62||tt(j)?$(j):n(j)}function X(j){return j===62?(t.consume(j),t.exit("htmlTextData"),t.exit("htmlText"),e):n(j)}function le(j){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),Ce}function Ce(j){return Ye(j)?We(t,_e,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):_e(j)}function _e(j){return t.enter("htmlTextData"),o(j)}}const yS={name:"labelEnd",resolveAll:z5,resolveTo:B5,tokenize:V5},I5={tokenize:F5},_5={tokenize:P5},L5={tokenize:j5};function z5(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&&Ir(t,0,t.length,n),t}function B5(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=ni(u,t.slice(s+1,s+r+3)),u=ni(u,[["enter",d,e]]),u=ni(u,Cg(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),u=ni(u,[["exit",d,e],t[o-2],t[o-1],["exit",h,e]]),u=ni(u,t.slice(o+1)),u=ni(u,[["exit",c,e]]),Ir(t,s,t.length,u),t}function V5(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(Ti(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(I5,d,o?d:g)(y):y===91?t.attempt(_5,d,o?h:g)(y):o?d(y):g(y)}function h(y){return t.attempt(L5,d,g)(y)}function d(y){return e(y)}function g(y){return s._balanced=!0,n(y)}}function F5(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 tt(g)?Ts(t,s)(g):s(g)}function s(g){return g===41?d(g):dM(t,o,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function o(g){return tt(g)?Ts(t,c)(g):d(g)}function u(g){return n(g)}function c(g){return g===34||g===39||g===40?gM(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):d(g)}function h(g){return tt(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 P5(t,e,n){const r=this;return i;function i(u){return mM.call(r,t,s,o,"reference","referenceMarker","referenceString")(u)}function s(u){return r.parser.defined.includes(Ti(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function o(u){return n(u)}}function j5(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 $5={name:"labelStartImage",resolveAll:yS.resolveAll,tokenize:U5};function U5(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 J5={name:"labelStartLink",resolveAll:yS.resolveAll,tokenize:q5};function q5(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 ux={name:"lineEnding",tokenize:H5};function H5(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),We(t,e,"linePrefix")}}const jd={name:"thematicBreak",tokenize:K5};function K5(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||we(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===i?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),Ye(h)?We(t,u,"whitespace")(h):u(h))}}const xr={continuation:{tokenize:X5},exit:Z5,name:"list",tokenize:W5},G5={partial:!0,tokenize:e9},Y5={partial:!0,tokenize:Q5};function W5(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:V1(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(jd,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 V1(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(Uu,r.interrupt?n:d,t.attempt(G5,y,g))}function d(b){return r.containerState.initialBlankLine=!0,s++,y(b)}function g(b){return Ye(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 X5(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Uu,i,s);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,We(t,e,"listItemIndent",r.containerState.size+1)(u)}function s(u){return r.containerState.furtherBlankLines||!Ye(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(Y5,e,o)(u))}function o(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,We(t,t.attempt(xr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function Q5(t,e,n){const r=this;return We(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 Z5(t){t.exit(this.containerState.type)}function e9(t,e,n){const r=this;return We(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!Ye(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const EE={name:"setextUnderline",resolveTo:t9,tokenize:n9};function t9(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 n9(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"),Ye(h)?We(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||we(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const r9={tokenize:i9};function i9(t){const e=this,n=t.attempt(Uu,r,t.attempt(this.parser.constructs.flowInitial,i,We(t,t.attempt(this.parser.constructs.flow,i,t.attempt(u5,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 s9={resolveAll:xM()},a9=yM("string"),o9=yM("text");function yM(t){return{resolveAll:xM(t==="text"?l9: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 xM(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 l9(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 u9={42:xr,43:xr,45:xr,48:xr,49:xr,50:xr,51:xr,52:xr,53:xr,54:xr,55:xr,56:xr,57:xr,62:cM},c9={91:d5},f9={[-2]:lx,[-1]:lx,32:lx},h9={35:S5,42:jd,45:[EE,jd],60:w5,61:EE,95:jd,96:CE,126:CE},p9={38:hM,92:fM},d9={[-5]:ux,[-4]:ux,[-3]:ux,33:$5,38:hM,42:F1,60:[Jz,R5],91:J5,92:[x5,fM],93:yS,95:F1,96:r5},m9={null:[F1,s9]},g9={null:[42,95]},y9={null:[]},x9=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:g9,contentInitial:c9,disable:y9,document:u9,flow:h9,flowInitial:f9,insideSpan:m9,string:p9,text:d9},Symbol.toStringTag,{value:"Module"}));function b9(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),check:_(C),consume:F,enter:V,exit:H,interrupt:_(C,{interrupt:!0})},h={code:null,containerState:{},defineSkip:w,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(ue){return o=ni(o,ue),N(),o[o.length-1]!==null?[]:(U(e,0),h.events=Cg(s,h.events,h),h.events)}function y(ue,ae){return v9(b(ue),ae)}function b(ue){return S9(o,ue)}function k(){const{_bufferIndex:ue,_index:ae,line:Se,column:Ee,offset:Y}=r;return{_bufferIndex:ue,_index:ae,line:Se,column:Ee,offset:Y}}function w(ue){i[ue.line]=ue.column,q()}function N(){let ue;for(;r._index<o.length;){const ae=o[r._index];if(typeof ae=="string")for(ue=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ue&&r._bufferIndex<ae.length;)T(ae.charCodeAt(r._bufferIndex));else T(ae)}}function T(ue){d=d(ue)}function F(ue){we(ue)?(r.line++,r.column=1,r.offset+=ue===-3?2:1,q()):ue!==-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=ue}function V(ue,ae){const Se=ae||{};return Se.type=ue,Se.start=k(),h.events.push(["enter",Se,h]),u.push(Se),Se}function H(ue){const ae=u.pop();return ae.end=k(),h.events.push(["exit",ae,h]),ae}function z(ue,ae){U(ue,ae.from)}function C(ue,ae){ae.restore()}function _(ue,ae){return Se;function Se(Ee,Y,X){let le,Ce,_e,j;return Array.isArray(Ee)?te(Ee):"tokenize"in Ee?te([Ee]):P(Ee);function P(Ae){return He;function He(pt){const Ke=pt!==null&&Ae[pt],Ft=pt!==null&&Ae.null,Ot=[...Array.isArray(Ke)?Ke:Ke?[Ke]:[],...Array.isArray(Ft)?Ft:Ft?[Ft]:[]];return te(Ot)(pt)}}function te(Ae){return le=Ae,Ce=0,Ae.length===0?X:L(Ae[Ce])}function L(Ae){return He;function He(pt){return j=$(),_e=Ae,Ae.partial||(h.currentConstruct=Ae),Ae.name&&h.parser.constructs.disable.null.includes(Ae.name)?Te():Ae.tokenize.call(ae?Object.assign(Object.create(h),ae):h,c,xe,Te)(pt)}}function xe(Ae){return ue(_e,j),Y}function Te(Ae){return j.restore(),++Ce<le.length?L(le[Ce]):X}}}function U(ue,ae){ue.resolveAll&&!s.includes(ue)&&s.push(ue),ue.resolve&&Ir(h.events,ae,h.events.length-ae,ue.resolve(h.events.slice(ae),h)),ue.resolveTo&&(h.events=ue.resolveTo(h.events,h))}function $(){const ue=k(),ae=h.previous,Se=h.currentConstruct,Ee=h.events.length,Y=Array.from(u);return{from:Ee,restore:X};function X(){r=ue,h.previous=ae,h.currentConstruct=Se,h.events.length=Ee,u=Y,q()}}function q(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function S9(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 v9(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 k9(t){const r={constructs:gS([x9,...(t||{}).extensions||[]]),content:i(Bz),defined:[],document:i(Fz),flow:i(r9),lazy:{},string:i(a9),text:i(o9)};return r;function i(s){return o;function o(u){return b9(r,s,u)}}}function C9(t){for(;!pM(t););return t}const AE=/[\0\t\n\r]/g;function w9(){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(AE.lastIndex=g,h=AE.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 E9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bM(t){return t.replace(E9,A9)}function A9(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return uM(n.slice(s?2:1),s?16:10)}return ph(n)||t}function Ms(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?NE(t.position):"start"in t||"end"in t?NE(t):"line"in t||"column"in t?P1(t):""}function P1(t){return TE(t&&t.line)+":"+TE(t&&t.column)}function NE(t){return P1(t&&t.start)+"-"+P1(t&&t.end)}function TE(t){return t&&typeof t=="number"?t:1}const SM={}.hasOwnProperty;function N9(t,e,n){return typeof e!="string"&&(n=e,e=void 0),T9(n)(C9(k9(n).document().write(w9()(t,e,!0))))}function T9(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ur),autolinkProtocol:$,autolinkEmail:$,atxHeading:s(hn),blockQuote:s(Ft),characterEscape:$,characterReference:$,codeFenced:s(Ot),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ot,o),codeText:s(ar,o),codeTextData:$,data:$,codeFlowValue:$,definition:s(or),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(fn),hardBreakEscape:s(lr),hardBreakTrailing:s(lr),htmlFlow:s(pn,o),htmlFlowData:$,htmlText:s(pn,o),htmlTextData:$,image:s(dn),label:o,link:s(ur),listItem:s(je),listItemValue:y,listOrdered:s(he,g),listUnordered:s(he),paragraph:s(Dt),reference:L,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(hn),strong:s(mt),thematicBreak:s(mn)},exit:{atxHeading:c(),atxHeadingSequence:z,autolink:c(),autolinkEmail:Ke,autolinkProtocol:pt,blockQuote:c(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:Ae,characterReference:He,codeFenced:c(N),codeFencedFence:w,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:q,codeIndented:c(T),codeText:c(Y),codeTextData:q,data:q,definition:c(),definitionDestinationString:H,definitionLabelString:F,definitionTitleString:V,emphasis:c(),hardBreakEscape:c(ae),hardBreakTrailing:c(ae),htmlFlow:c(Se),htmlFlowData:q,htmlText:c(Ee),htmlTextData:q,image:c(le),label:_e,labelText:Ce,lineEnding:ue,link:c(X),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:xe,resourceDestinationString:j,resourceTitleString:P,resource:te,setextHeading:c(U),setextHeadingLineSequence:_,setextHeadingText:C,strong:c(),thematicBreak:c()}};vM(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(fe){let ge={type:"root",children:[]};const I={stack:[ge],tokenStack:[],config:e,enter:u,exit:h,buffer:o,resume:d,data:n},Le=[];let Ue=-1;for(;++Ue<fe.length;)if(fe[Ue][1].type==="listOrdered"||fe[Ue][1].type==="listUnordered")if(fe[Ue][0]==="enter")Le.push(Ue);else{const on=Le.pop();Ue=i(fe,on,Ue)}for(Ue=-1;++Ue<fe.length;){const on=e[fe[Ue][0]];SM.call(on,fe[Ue][1].type)&&on[fe[Ue][1].type].call(Object.assign({sliceSerialize:fe[Ue][2].sliceSerialize},I),fe[Ue][1])}if(I.tokenStack.length>0){const on=I.tokenStack[I.tokenStack.length-1];(on[1]||ME).call(I,void 0,on[0])}for(ge.position={start:Ca(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ca(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},Ue=-1;++Ue<e.transforms.length;)ge=e.transforms[Ue](ge)||ge;return ge}function i(fe,ge,I){let Le=ge-1,Ue=-1,on=!1,cr,ke,Pt,An;for(;++Le<=I;){const wt=fe[Le];switch(wt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{wt[0]==="enter"?Ue++:Ue--,An=void 0;break}case"lineEndingBlank":{wt[0]==="enter"&&(cr&&!An&&!Ue&&!Pt&&(Pt=Le),An=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:An=void 0}if(!Ue&&wt[0]==="enter"&&wt[1].type==="listItemPrefix"||Ue===-1&&wt[0]==="exit"&&(wt[1].type==="listUnordered"||wt[1].type==="listOrdered")){if(cr){let fr=Le;for(ke=void 0;fr--;){const Pn=fe[fr];if(Pn[1].type==="lineEnding"||Pn[1].type==="lineEndingBlank"){if(Pn[0]==="exit")continue;ke&&(fe[ke][1].type="lineEndingBlank",on=!0),Pn[1].type="lineEnding",ke=fr}else if(!(Pn[1].type==="linePrefix"||Pn[1].type==="blockQuotePrefix"||Pn[1].type==="blockQuotePrefixWhitespace"||Pn[1].type==="blockQuoteMarker"||Pn[1].type==="listItemIndent"))break}Pt&&(!ke||Pt<ke)&&(cr._spread=!0),cr.end=Object.assign({},ke?fe[ke][1].start:wt[1].end),fe.splice(ke||Le,0,["exit",cr,wt[2]]),Le++,I++}if(wt[1].type==="listItemPrefix"){const fr={type:"listItem",_spread:!1,start:Object.assign({},wt[1].start),end:void 0};cr=fr,fe.splice(Le,0,["enter",fr,wt[2]]),Le++,I++,Pt=void 0,An=!0}}}return fe[ge][1]._spread=on,I}function s(fe,ge){return I;function I(Le){u.call(this,fe(Le),Le),ge&&ge.call(this,Le)}}function o(){this.stack.push({type:"fragment",children:[]})}function u(fe,ge,I){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([ge,I||void 0]),fe.position={start:Ca(ge.start),end:void 0}}function c(fe){return ge;function ge(I){fe&&fe.call(this,I),h.call(this,I)}}function h(fe,ge){const I=this.stack.pop(),Le=this.tokenStack.pop();if(Le)Le[0].type!==fe.type&&(ge?ge.call(this,fe,Le[0]):(Le[1]||ME).call(this,fe,Le[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ms({start:fe.start,end:fe.end})+"): it’s not open");I.position.end=Ca(fe.end)}function d(){return mS(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(fe){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function b(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=fe}function k(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=fe}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe.replace(/(\r?\n|\r)$/g,"")}function F(fe){const ge=this.resume(),I=this.stack[this.stack.length-1];I.label=ge,I.identifier=Ti(this.sliceSerialize(fe)).toLowerCase()}function V(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=fe}function H(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=fe}function z(fe){const ge=this.stack[this.stack.length-1];if(!ge.depth){const I=this.sliceSerialize(fe).length;ge.depth=I}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function _(fe){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function $(fe){const I=this.stack[this.stack.length-1].children;let Le=I[I.length-1];(!Le||Le.type!=="text")&&(Le=Be(),Le.position={start:Ca(fe.start),end:void 0},I.push(Le)),this.stack.push(Le)}function q(fe){const ge=this.stack.pop();ge.value+=this.sliceSerialize(fe),ge.position.end=Ca(fe.end)}function ue(fe){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const I=ge.children[ge.children.length-1];I.position.end=Ca(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ge.type)&&($.call(this,fe),q.call(this,fe))}function ae(){this.data.atHardBreak=!0}function Se(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function Ee(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function Y(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function X(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ge,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function le(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ge,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function Ce(fe){const ge=this.sliceSerialize(fe),I=this.stack[this.stack.length-2];I.label=bM(ge),I.identifier=Ti(ge).toLowerCase()}function _e(){const fe=this.stack[this.stack.length-1],ge=this.resume(),I=this.stack[this.stack.length-1];if(this.data.inReference=!0,I.type==="link"){const Le=fe.children;I.children=Le}else I.alt=ge}function j(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=fe}function P(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=fe}function te(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function xe(fe){const ge=this.resume(),I=this.stack[this.stack.length-1];I.label=ge,I.identifier=Ti(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Te(fe){this.data.characterReferenceType=fe.type}function Ae(fe){const ge=this.sliceSerialize(fe),I=this.data.characterReferenceType;let Le;I?(Le=uM(ge,I==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=ph(ge);const Ue=this.stack[this.stack.length-1];Ue.value+=Le}function He(fe){const ge=this.stack.pop();ge.position.end=Ca(fe.end)}function pt(fe){q.call(this,fe);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(fe)}function Ke(fe){q.call(this,fe);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(fe)}function Ft(){return{type:"blockquote",children:[]}}function Ot(){return{type:"code",lang:null,meta:null,value:""}}function ar(){return{type:"inlineCode",value:""}}function or(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function fn(){return{type:"emphasis",children:[]}}function hn(){return{type:"heading",depth:0,children:[]}}function lr(){return{type:"break"}}function pn(){return{type:"html",value:""}}function dn(){return{type:"image",title:null,url:"",alt:null}}function ur(){return{type:"link",title:null,url:"",children:[]}}function he(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function je(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function Dt(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function Be(){return{type:"text",value:""}}function mn(){return{type:"thematicBreak"}}}function Ca(t){return{line:t.line,column:t.column,offset:t.offset}}function vM(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?vM(t,r):M9(t,r)}}function M9(t,e){let n;for(n in e)if(SM.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 ME(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 Am(t){const e=this;e.parser=n;function n(r){return N9(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const OE={}.hasOwnProperty;function O9(t,e){const n=e||{};function r(i,...s){let o=r.invalid;const u=r.handlers;if(i&&OE.call(i,t)){const c=String(i[t]);o=OE.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 R9={}.hasOwnProperty;function kM(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)kM(t,e.extensions[n]);for(r in e)if(R9.call(e,r))switch(r){case"extensions":break;case"unsafe":{RE(t[r],e[r]);break}case"join":{RE(t[r],e[r]);break}case"handlers":{D9(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function RE(t,e){e&&t.push(...e)}function D9(t,e){e&&Object.assign(t,e)}function I9(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()),_9);return i(),o}function _9(t,e,n){return">"+(n?"":" ")+t}function CM(t,e){return DE(t,e.inConstruct,!0)&&!DE(t,e.notInConstruct,!1)}function DE(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 IE(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
5
|
-
`&&CM(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
6
|
-
`}function L9(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 j1(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 z9(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 B9(t,e,n,r){const i=z9(n),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(j1(t,n)){const g=n.enter("codeIndented"),y=n.indentLines(s,V9);return g(),y}const u=n.createTracker(r),c=i.repeat(Math.max(L9(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 V9(t,e,n){return(n?"":" ")+t}function xS(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 F9(t,e,n,r){const i=xS(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 P9(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 $a(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Nm(t,e,n){const r=Lu(t),i=Lu(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}}wM.peek=j9;function wM(t,e,n,r){const i=P9(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=Nm(r.before.charCodeAt(r.before.length-1),h,i);d.inside&&(c=$a(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Nm(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+$a(g));const b=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:d.outside},u+c+b}function j9(t,e,n){return n.options.emphasis||"*"}const wg=(function(t){if(t==null)return q9;if(typeof t=="function")return Eg(t);if(typeof t=="object")return Array.isArray(t)?$9(t):U9(t);if(typeof t=="string")return J9(t);throw new Error("Expected function, string, or object as test")});function $9(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=wg(t[n]);return Eg(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function U9(t){const e=t;return Eg(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function J9(t){return Eg(e);function e(n){return n&&n.type===t}}function Eg(t){return e;function e(n,r,i){return!!(H9(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function q9(){return!0}function H9(t){return t!==null&&typeof t=="object"&&"type"in t}const EM=[],K9=!0,$1=!1,U1="skip";function Ju(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=wg(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=EM,k,w,N;if((!e||s(c,h,d[d.length-1]||void 0))&&(b=G9(n(c,d)),b[0]===$1))return b;if("children"in c&&c.children){const T=c;if(T.children&&b[0]!==U1)for(w=(r?T.children.length:-1)+o,N=d.concat(T);w>-1&&w<T.children.length;){const F=T.children[w];if(k=u(F,w,N)(),k[0]===$1)return k;w=typeof k[1]=="number"?k[1]:w+o}}return b}}}function G9(t){return Array.isArray(t)?t:typeof t=="number"?[K9,t]:t==null?EM:[t]}function Y9(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),Ju(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 AM(t,e){let n=!1;return Y9(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,$1}),!!((!t.depth||t.depth<3)&&mS(t)&&(e.options.setext||n))}function W9(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(AM(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=$a(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,n.options.closeAtx&&(h+=" "+o),c(),u(),h}NM.peek=X9;function NM(t){return t.value||""}function X9(){return"<"}TM.peek=Q9;function TM(t,e,n,r){const i=xS(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 Q9(){return"!"}MM.peek=Z9;function MM(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 Z9(){return"!"}OM.peek=e8;function OM(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 e8(){return"`"}function RM(t,e){const n=mS(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))}DM.peek=t8;function DM(t,e,n,r){const i=xS(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let u,c;if(RM(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 t8(t,e,n){return RM(t,n)?"<":"["}IM.peek=n8;function IM(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 n8(){return"["}function bS(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 r8(t){const e=bS(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 i8(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 _M(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 s8(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=t.ordered?i8(n):bS(n);const u=t.ordered?o==="."?")":".":r8(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),_M(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 a8(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 o8(t,e,n,r){const i=a8(n);let s=n.bulletCurrent||bS(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 l8(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,r);return s(),i(),o}const u8=wg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function c8(t,e,n,r){return(t.children.some(function(o){return u8(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function f8(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}LM.peek=h8;function LM(t,e,n,r){const i=f8(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=Nm(r.before.charCodeAt(r.before.length-1),h,i);d.inside&&(c=$a(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Nm(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+$a(g));const b=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:d.outside},u+c+b}function h8(t,e,n){return n.options.strong||"*"}function p8(t,e,n,r){return n.safe(t.value,r)}function d8(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 m8(t,e,n){const r=(_M(n)+(n.options.ruleSpaces?" ":"")).repeat(d8(n));return n.options.ruleSpaces?r.slice(0,-1):r}const SS={blockquote:I9,break:IE,code:B9,definition:F9,emphasis:wM,hardBreak:IE,heading:W9,html:NM,image:TM,imageReference:MM,inlineCode:OM,link:DM,linkReference:IM,list:s8,listItem:o8,paragraph:l8,root:c8,strong:LM,text:p8,thematicBreak:m8},g8=[y8];function y8(t,e,n,r){if(e.type==="code"&&j1(e,r)&&(t.type==="list"||t.type===e.type&&j1(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"&&AM(e,r))?void 0:n.spread?1:0}const wo=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],x8=[{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 b8(t){return t.label||!t.identifier?t.label||"":bM(t.identifier)}function S8(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 v8(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=$a(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)+$a(u.charCodeAt(0))),b.after&&(c=g)),h.move(y),s.push(y),u=y.slice(-1)}return r.pop(),s.join("")}function k8(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(C8(c,i[u+1],t,e)))}return r.pop(),o.join("")}function C8(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 w8=/\r?\n|\r/g;function E8(t,e){const n=[];let r=0,i=0,s;for(;s=w8.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 A8(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(!CM(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,w=y.index+(b?y[1].length:0);i.includes(w)?(o[w].before&&!b&&(o[w].before=!1),o[w].after&&!k&&(o[w].after=!1)):(i.push(w),o[w]={before:b,after:k})}}i.sort(N8);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(_E(r.slice(c,d),"\\")),c=d,/[!-/:-@[-`{-~]/.test(r.charAt(d))&&(!n.encode||!n.encode.includes(r.charAt(d)))?s.push("\\"):(s.push($a(r.charCodeAt(d))),c++))}return s.push(_E(r.slice(c,h),n.after)),s.join("")}function N8(t,e){return t-e}function _E(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 T8(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 M8(t,e){const n=e||{},r={associationId:b8,containerPhrasing:I8,containerFlow:_8,createTracker:T8,compilePattern:S8,enter:s,handlers:{...SS},handle:void 0,indentLines:E8,indexStack:[],join:[...g8],options:{},safe:L8,stack:[],unsafe:[...x8]};kM(r,n),r.options.tightDefinitions&&r.join.push(D8),r.handle=O9("type",{invalid:O8,unknown:R8,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 O8(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function R8(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function D8(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function I8(t,e){return v8(t,this,e)}function _8(t,e){return k8(t,this,e)}function L8(t,e){return A8(this,t,e)}function J1(t){const e=this;e.compiler=n;function n(r){return M8(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function LE(t){if(t)throw t}var cx,zE;function z8(){if(zE)return cx;zE=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 cx=function c(){var h,d,g,y,b,k,w=arguments[0],N=1,T=arguments.length,F=!1;for(typeof w=="boolean"&&(F=w,w=arguments[1]||{},N=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});N<T;++N)if(h=arguments[N],h!=null)for(d in h)g=u(w,d),y=u(h,d),w!==y&&(F&&y&&(s(y)||(b=i(y)))?(b?(b=!1,k=g&&i(g)?g:[]):k=g&&s(g)?g:{},o(w,{name:d,newValue:c(F,k,y)})):typeof y<"u"&&o(w,{name:d,newValue:y}));return w},cx}var B8=z8();const fx=WT(B8);function q1(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 V8(){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?F8(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 F8(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 bt 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}}bt.prototype.file="";bt.prototype.name="";bt.prototype.reason="";bt.prototype.message="";bt.prototype.stack="";bt.prototype.column=void 0;bt.prototype.line=void 0;bt.prototype.ancestors=void 0;bt.prototype.cause=void 0;bt.prototype.fatal=void 0;bt.prototype.place=void 0;bt.prototype.ruleId=void 0;bt.prototype.source=void 0;const Vi={basename:P8,dirname:j8,extname:$8,join:U8,sep:"/"};function P8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Hh(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 j8(t){if(Hh(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 $8(t){Hh(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 U8(...t){let e=-1,n;for(;++e<t.length;)Hh(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":J8(n)}function J8(t){Hh(t);const e=t.codePointAt(0)===47;let n=q8(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function q8(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 Hh(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const H8={cwd:K8};function K8(){return"/"}function H1(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function G8(t){if(typeof t=="string")t=new URL(t);else if(!H1(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 Y8(t)}function Y8(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 hx=["history","path","basename","stem","extname","dirname"];class W8{constructor(e){let n;e?H1(e)?n={path:e}:typeof e=="string"||X8(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":H8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<hx.length;){const s=hx[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)hx.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Vi.basename(this.path):void 0}set basename(e){dx(e,"basename"),px(e,"basename"),this.path=Vi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Vi.dirname(this.path):void 0}set dirname(e){BE(this.basename,"dirname"),this.path=Vi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Vi.extname(this.path):void 0}set extname(e){if(px(e,"extname"),BE(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=Vi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){H1(e)&&(e=G8(e)),dx(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Vi.basename(this.path,this.extname):void 0}set stem(e){dx(e,"stem"),px(e,"stem"),this.path=Vi.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 bt(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 px(t,e){if(t&&t.includes(Vi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Vi.sep+"`")}function dx(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function BE(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function X8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Q8=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),Z8={}.hasOwnProperty;class vS extends Q8{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=V8()}copy(){const e=new vS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(fx(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(yx("data",this.frozen),this.namespace[e]=n,this):Z8.call(this.namespace,e)&&this.namespace[e]||void 0:e?(yx("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=Dd(e),r=this.parser||this.Parser;return mx("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),mx("process",this.parser||this.Parser),gx("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const u=Dd(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);tB(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(),mx("processSync",this.parser||this.Parser),gx("processSync",this.compiler||this.Compiler),this.process(e,i),FE("processSync","process",n),r;function i(s,o){n=!0,LE(s),r=o}}run(e,n,r){VE(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=Dd(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),FE("runSync","run",r),i;function s(o,u){LE(o),i=u,r=!0}}stringify(e,n){this.freeze();const r=Dd(n),i=this.compiler||this.Compiler;return gx("stringify",i),VE(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(yx("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=fx(!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 w=r[y][1];q1(w)&&q1(b)&&(b=fx(!0,w,b)),r[y]=[h,b,...k]}}}}const Tm=new vS().freeze();function mx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function gx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function yx(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 VE(t){if(!q1(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function FE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Dd(t){return eB(t)?t:new W8(t)}function eB(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function tB(t){return typeof t=="string"||nB(t)}function nB(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function kn(t){this.content=t}kn.prototype={constructor:kn,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 kn(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 kn(n)},addToStart:function(t,e){return new kn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new kn(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 kn(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=kn.from(t),t.size?new kn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=kn.from(t),t.size?new kn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=kn.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}};kn.from=function(t){if(t instanceof kn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new kn(e)};function zM(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=zM(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function BM(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=BM(o.content,u.content,n-1,r-1);if(h)return h}n-=c,r-=c}}class W{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 W(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 W(r,i)}cutByIndex(e,n){return e==n?W.empty:e==0&&n==this.content.length?this:new W(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 W(i,s)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let 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 zM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return BM(this,e,n,r)}findIndex(e){if(e==0)return Id(0,e);if(e==this.size)return Id(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?Id(n+1,s):Id(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 W.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.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 W(n||e,r)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const xx={index:0,offset:0};function Id(t,e){return xx.index=t,xx.offset=e,xx}function Mm(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(!Mm(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Mm(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class ht{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&&Mm(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 ht.none;if(e instanceof ht)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}}ht.none=[];class Mi extends Error{}class G{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=FM(this.content,e+this.openStart,n);return r&&new G(r,this.openStart,this.openEnd)}removeBetween(e,n){return new G(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 G.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 G(W.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 G(e,r,i)}}G.empty=new G(W.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 FM(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=FM(o.content,e-s-1,n,o);return u&&t.replaceChild(i,o.copy(u))}function rB(t,e,n){if(n.openStart>t.depth)throw new Mi("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Mi("Inconsistent open depths");return PM(t,e,n,0)}function PM(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=PM(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 Uo(o,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:o,end:u}=iB(n,t);return Uo(s,$M(t,o,u,e,r))}else return Uo(s,Om(t,e,r))}function jM(t,e){if(!e.type.compatibleContent(t.type))throw new Mi("Cannot join "+e.type.name+" onto "+t.type.name)}function K1(t,e,n){let r=t.node(n);return jM(r,e.node(n)),r}function $o(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 Jf(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&&($o(t.nodeAfter,r),s++));for(let u=s;u<o;u++)$o(i.child(u),r);e&&e.depth==n&&e.textOffset&&$o(e.nodeBefore,r)}function Uo(t,e){return t.type.checkContent(e),t.copy(e)}function $M(t,e,n,r,i){let s=t.depth>i&&K1(t,e,i+1),o=r.depth>i&&K1(n,r,i+1),u=[];return Jf(null,t,i,u),s&&o&&e.index(i)==n.index(i)?(jM(s,o),$o(Uo(s,$M(t,e,n,r,i+1)),u)):(s&&$o(Uo(s,Om(t,e,i+1)),u),Jf(e,n,i,u),o&&$o(Uo(o,Om(n,r,i+1)),u)),Jf(r,null,i,u),new W(u)}function Om(t,e,n){let r=[];if(Jf(null,t,n,r),t.depth>n){let i=K1(t,e,n+1);$o(Uo(i,Om(t,e,n+1)),r)}return Jf(e,null,n,r),new W(r)}function iB(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(W.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class dh{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 ht.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 UM(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 dh(n,r,s)}static resolveCached(e,n){let r=PE.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 PE.set(e,r=new sB);let i=r.elts[r.i]=dh.resolve(e,n);return r.i=(r.i+1)%aB,i}}class sB{constructor(){this.elts=[],this.i=0}}const aB=12,PE=new WeakMap;class UM{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 oB=Object.create(null);let Rs=class G1{constructor(e,n,r,i=ht.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||W.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,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&&Mm(this.attrs,n||e.defaultAttrs||oB)&&ht.sameSet(this.marks,r||ht.none)}copy(e=null){return e==this.content?this:new G1(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new G1(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 G.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 G(h,i.depth-o,s.depth-o)}replace(e,n,r){return rB(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 dh.resolveCached(this,e)}resolveNoCache(e){return dh.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()+")"),JM(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=W.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=ht.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(!ht.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=W.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 Rm 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):JM(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 Rm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Rm(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 JM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class rl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new lB(e,n);if(r.next==null)return rl.empty;let i=qM(r);r.next&&r.err("Unexpected trailing text");let s=mB(dB(i));return gB(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 W.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
|
-
`)}}rl.empty=new rl(!0);class lB{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 qM(t){let e=[];do e.push(uB(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function uB(t){let e=[];do e.push(cB(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function cB(t){let e=pB(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=fB(t,e);else break;return e}function jE(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function fB(t,e){let n=jE(t),r=n;return t.eat(",")&&(t.next!="}"?r=jE(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function hB(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 pB(t){if(t.eat("(")){let e=qM(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=hB(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 dB(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 HM(t,e){return e-t}function $E(t,e){let n=[];return r(e),n.sort(HM);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 mB(t){let e=Object.create(null);return n($E(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]);$E(t,c).forEach(d=>{h||i.push([u,h=[]]),h.indexOf(d)==-1&&h.push(d)})})});let s=e[r.join(",")]=new rl(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let u=i[o][1].sort(HM);s.next.push({type:i[o][0],next:e[u.join(",")]||n(u)})}return s}}function gB(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 KM(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 GM(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 YM(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 WM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new xB(t,r,e[r]);return n}let Dm=class XM{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=WM(e,r.attrs),this.defaultAttrs=KM(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==rl.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:GM(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),W.from(n),ht.setFrom(r))}createChecked(e=null,n,r){return n=W.from(n),this.checkContent(n),new Rs(this,this.computeAttrs(e),n,ht.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=W.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(W.empty,!0);return s?new Rs(this,e,n.append(s),ht.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){YM(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:ht.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new XM(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 yB(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 xB{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?yB(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Kh{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=WM(e,i.attrs),this.excluded=null;let s=KM(this.attrs);this.instance=s?new ht(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ht(this,GM(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Kh(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){YM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class bB{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=kn.from(e.nodes),n.marks=kn.from(e.marks||{}),this.nodes=Dm.compile(this.spec.nodes,this),this.marks=Kh.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]=rl.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?UE(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==""?[]:UE(this,o.split(" "))}this.nodeFromJSON=i=>Rs.fromJSON(this,i),this.markFromJSON=i=>ht.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 Dm){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 Rm(r,r.defaultAttrs,e,ht.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 UE(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 SB(t){return t.tag!=null}function vB(t){return t.style!=null}class Ua{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(SB(i))this.tags.push(i);else if(vB(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 qE(this,n,!1);return r.addAll(e,ht.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new qE(this,n,!0);return r.addAll(e,ht.none,n.from,n.to),G.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(wB(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=HE(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=HE(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ua(e,Ua.schemaRules(e)))}}const QM={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},kB={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ZM={ol:!0,ul:!0},mh=1,Y1=2,qf=4;function JE(t,e,n){return e!=null?(e?mh:0)|(e==="full"?Y1:0):t&&t.whitespace=="pre"?mh|Y1:n&~qf}class _d{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=ht.none,this.match=s||(o&qf?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(W.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&mh)){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=W.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(W.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&&!QM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qE{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=JE(null,n.preserveWhitespace,0)|(r?qf:0);i?s=new _d(i.type,i.attrs,ht.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new _d(null,null,ht.none,!0,null,o):s=new _d(e.schema.topNodeType,null,ht.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&Y1?"full":this.localPreserveWS||(i.options&mh)>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;ZM.hasOwnProperty(o)&&this.parser.normalizeLists&&CB(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(c?c.ignore:kB.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(QM.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=ht.none;for(let u of i.concat(e.marks))(s.type?s.type.allowsMarkType(u.type):KE(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=JE(e,s,o.options);o.options&qf&&o.content.length==0&&(u|=qf);let c=ht.none;return r=r.filter(h=>(o.type?o.type.allowsMarkType(h.type):KE(h.type,e))?(c=h.addToSet(c),!1):!0),this.nodes.push(new _d(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|=mh)}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 CB(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ZM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function wB(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function HE(t){let e={};for(let n in t)e[n]=t[n];return e}function KE(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 Wi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=bx(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}=$d(bx(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&&$d(bx(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return $d(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=GE(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return GE(e.marks)}}function GE(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function bx(t){return t.document||window.document}const YE=new WeakMap;function EB(t){let e=YE.get(t);return e===void 0&&YE.set(t,e=AB(t)),e}function AB(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 $d(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=EB(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}=$d(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 eO=65535,tO=Math.pow(2,16);function NB(t,e){return t+e*tO}function WE(t){return t&eO}function TB(t){return(t-(t&eO))/tO}const nO=1,rO=2,Ud=4,iO=8;let XE=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&iO)>0}get deletedBefore(){return(this.delInfo&(nO|Ud))>0}get deletedAfter(){return(this.delInfo&(rO|Ud))>0}get deletedAcross(){return(this.delInfo&Ud)>0}},il=class hu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&hu.empty)return hu.empty}recover(e){let n=0,r=WE(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+TB(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:NB(u/3,e-c),w=e==c?rO:e==g?nO:Ud;return(n<0?e!=c:e!=g)&&(w|=iO),new XE(b,w,k)}i+=d-h}return r?e+i:new XE(e+i,0,null)}touches(e,n){let r=0,i=WE(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 hu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?hu.empty:new hu(e<0?[0,-e,0]:[0,0,e])}};il.empty=new il([]);const Sx=Object.create(null);let Dn=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=Sx[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 Sx)throw new RangeError("Duplicate use of step JSON ID "+e);return Sx[e]=n,n.prototype.jsonID=e,n}},Gn=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 Mi)return sf.fail(s.message);throw s}}};function kS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(kS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let sO=class af extends Dn{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 G(kS(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 Gn.fromReplace(e,this.from,this.to,s)}invert(){return new aO(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 af(n.pos,r.pos,this.mark)}merge(e){return e instanceof af&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new af(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 af(n.from,n.to,e.markFromJSON(n.mark))}};Dn.jsonID("addMark",sO);let aO=class of extends Dn{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 G(kS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Gn.fromReplace(e,this.from,this.to,r)}invert(){return new sO(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 of(n.pos,r.pos,this.mark)}merge(e){return e instanceof of&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new of(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 of(n.from,n.to,e.markFromJSON(n.mark))}};Dn.jsonID("removeMark",aO);let oO=class lf extends Dn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Gn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Gn.fromReplace(e,this.pos,this.pos+1,new G(W.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 lf(this.pos,n.marks[i]);return new lf(this.pos,this.mark)}}return new lO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lf(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 lf(n.pos,e.markFromJSON(n.mark))}};Dn.jsonID("addNodeMark",oO);let lO=class W1 extends Dn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Gn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Gn.fromReplace(e,this.pos,this.pos+1,new G(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new oO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new W1(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 W1(n.pos,e.markFromJSON(n.mark))}};Dn.jsonID("removeNodeMark",lO);let Ag=class Ao extends Dn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&X1(e,this.from,this.to)?Gn.fail("Structure replace would overwrite content"):Gn.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 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?G.empty:new G(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?G.empty:new G(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,G.fromJSON(e,n.slice),!!n.structure)}};Dn.jsonID("replace",Ag);let Im=class Jd extends Dn{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&&(X1(e,this.from,this.gapFrom)||X1(e,this.gapTo,this.to)))return Gn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Gn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Gn.fromReplace(e,this.from,this.to,r):Gn.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 Jd(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 Jd(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 Jd(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};Dn.jsonID("replaceAround",Im);function X1(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 MB(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function CS(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||!MB(o,u,c))break;u&&(i=1),c<o.childCount&&(s=1)}return null}function OB(t,e,n=null,r=t){let i=RB(t,e),s=i&&DB(r,e);return s?i.map(QE).concat({type:e,attrs:n}).concat(s.map(QE)):null}function QE(t){return{type:t,attrs:null}}function RB(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 DB(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 qd(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 w=r&&r[d]||g;if(!g.canReplace(y+1,g.childCount)||!w.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 uO(t,e){let n=t.resolve(e),r=n.index();return _B(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function IB(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 _B(t,e){return!!(t&&e&&!t.isLeaf&&IB(t,e))}function wS(t,e,n=e,r=G.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return LB(i,s,r)?new Ag(e,n,r):new zB(i,s,r).fit()}function LB(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let zB=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=W.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=W.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 G(s,o,u);return e>-1?new Im(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Ag(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=vx(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(W.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=vx(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(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=vx(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new G(uf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new G(uf(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 w=0;w<s.length;w++)this.openFrontierNode(s[w]);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 w=0;w<i.childCount;w++)d.push(i.child(w));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let w=u.child(h),N=g.matchType(w.type);if(!N)break;h++,(h>1||c==0||w.content.size)&&(g=N,d.push(cO(w.mark(y.allowedMarks(w.marks)),h==1?c:0,h==u.childCount?b:-1)))}let k=h==u.childCount;k||(b=-1),this.placed=cf(this.placed,n,W.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 w=0,N=u;w<b;w++){let T=N.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),N=T.content}this.unplaced=k?e==0?G.empty:new G(uf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new G(uf(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||!kx(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=kx(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=kx(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=cf(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=cf(this.placed,this.depth,W.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(W.empty,!0);n.childCount&&(this.placed=cf(this.placed,this.frontier.length,n))}};function uf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(uf(t.firstChild.content,e-1,n)))}function cf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(cf(t.lastChild.content,e-1,n)))}function vx(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function cO(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,cO(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(W.empty,!0)))),t.copy(r)}function kx(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&&!BB(n,s.content,o)?u:null}function BB(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}let VB=class Hd extends Dn{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 Gn.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 Gn.fromReplace(e,this.pos,this.pos+1,new G(W.from(i),0,n.isLeaf?0:1))}getMap(){return il.empty}invert(e){return new Hd(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 Hd(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 Hd(n.pos,n.attr,n.value)}};Dn.jsonID("attr",VB);let FB=class Q1 extends Dn{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 Gn.ok(r)}getMap(){return il.empty}invert(e){return new Q1(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 Q1(n.attr,n.value)}};Dn.jsonID("docAttr",FB);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";const fO=65535,hO=Math.pow(2,16);function PB(t,e){return t+e*hO}function ZE(t){return t&fO}function jB(t){return(t-(t&fO))/hO}const pO=1,dO=2,Kd=4,mO=8;let Z1=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&mO)>0}get deletedBefore(){return(this.delInfo&(pO|Kd))>0}get deletedAfter(){return(this.delInfo&(dO|Kd))>0}get deletedAcross(){return(this.delInfo&Kd)>0}},sl=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=ZE(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+jB(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:PB(u/3,e-c),w=e==c?dO:e==g?pO:Kd;return(n<0?e!=c:e!=g)&&(w|=mO),new Z1(b,w,k)}i+=d-h}return r?e+i:new Z1(e+i,0,null)}touches(e,n){let r=0,i=ZE(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?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])}};sl.empty=new sl([]);let $B=class eb{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 eb(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 eb;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 Z1(e,i,null)}};const Cx=Object.create(null);let In=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=Cx[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 Cx)throw new RangeError("Duplicate use of step JSON ID "+e);return Cx[e]=n,n.prototype.jsonID=e,n}},Yn=class ff{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ff(e,null)}static fail(e){return new ff(null,e)}static fromReplace(e,n,r,i){try{return ff.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mi)return ff.fail(s.message);throw s}}};function ES(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(ES(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let AS=class hf extends In{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 G(ES(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 Yn.fromReplace(e,this.from,this.to,s)}invert(){return new Gh(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 hf(n.pos,r.pos,this.mark)}merge(e){return e instanceof hf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new hf(n.from,n.to,e.markFromJSON(n.mark))}};In.jsonID("addMark",AS);let Gh=class pf extends In{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 G(ES(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Yn.fromReplace(e,this.from,this.to,r)}invert(){return new AS(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 pf(n.pos,r.pos,this.mark)}merge(e){return e instanceof pf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new pf(n.from,n.to,e.markFromJSON(n.mark))}};In.jsonID("removeMark",Gh);let NS=class df extends In{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Yn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Yn.fromReplace(e,this.pos,this.pos+1,new G(W.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 df(this.pos,n.marks[i]);return new df(this.pos,this.mark)}}return new _m(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new df(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new df(n.pos,e.markFromJSON(n.mark))}};In.jsonID("addNodeMark",NS);let _m=class tb extends In{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Yn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Yn.fromReplace(e,this.pos,this.pos+1,new G(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new NS(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new tb(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 tb(n.pos,e.markFromJSON(n.mark))}};In.jsonID("removeNodeMark",_m);let zs=class No extends In{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&nb(e,this.from,this.to)?Yn.fail("Structure replace would overwrite content"):Yn.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 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?G.empty:new G(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?G.empty:new G(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,G.fromJSON(e,n.slice),!!n.structure)}};In.jsonID("replace",zs);let ml=class Gd extends In{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&&(nb(e,this.from,this.gapFrom)||nb(e,this.gapTo,this.to)))return Yn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Yn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Yn.fromReplace(e,this.from,this.to,r):Yn.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 Gd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),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 Gd(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 Gd(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};In.jsonID("replaceAround",ml);function nb(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 UB(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 w=0;w<g.length;w++)g[w].isInSet(k)||(o&&o.to==y&&o.mark.eq(g[w])?o.to=b:i.push(o=new Gh(y,b,g[w])));u&&u.to==y?u.to=b:s.push(u=new AS(y,b,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function JB(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 Kh){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 Gh(o.from,o.to,o.style)))}function TS(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 zs(u,d,G.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new Gh(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 G(W.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new zs(u+y.index,u+y.index+y[0].length,k))}}u=d}if(!r.validEnd){let c=r.fillBefore(W.empty,!0);t.replace(u,u,new G(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function qB(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=W.empty,g=0;for(let k=s,w=!1;k>n;k--)w||r.index(k)>0?(w=!0,d=W.from(r.node(k).copy(d)),g++):c--;let y=W.empty,b=0;for(let k=s,w=!1;k>n;k--)w||i.after(k+1)<i.end(k)?(w=!0,y=W.from(i.node(k).copy(y)),b++):h++;t.step(new ml(c,h,o,u,new G(d.append(y),g,b),d.size-g,!0))}function HB(t,e,n){let r=W.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=W.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new ml(i,s,i,s,new G(r,0,0),n.length,!0))}function KB(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)&&GB(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&&yO(t,o,u,s),TS(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 ml(g,y,g+1,y-1,new G(W.from(r.create(c,null,o.marks)),0,0),1,!0)),h===!0&&gO(t,o,u,s),!1}})}function gO(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 yO(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 GB(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function YB(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 ml(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new G(W.from(o),0,0),1,!0))}function WB(t,e,n=1,r){let i=t.doc.resolve(e),s=W.empty,o=W.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=W.from(i.node(u).copy(s));let d=r&&r[h];o=W.from(d?d.type.create(d.attrs,o):i.node(u).copy(o))}t.step(new zs(e,e,new G(s.append(o),n,n),!0))}function XB(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);yO(t,d.node(),d.before(),u)}o.inlineContent&&TS(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 zs(h,c.map(e+n,-1),G.empty,!0)),r===!0){let d=t.doc.resolve(h);gO(t,d.node(),d.before(),t.steps.length)}return t}function QB(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 ZB(t,e,n=e,r=G.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return xO(i,s,r)?new zs(e,n,r):new e7(i,s,r).fit()}function xO(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let e7=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=W.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=W.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 G(s,o,u);return e>-1?new ml(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new zs(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=wx(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(W.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=wx(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(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=wx(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new G(mf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new G(mf(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 w=0;w<s.length;w++)this.openFrontierNode(s[w]);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 w=0;w<i.childCount;w++)d.push(i.child(w));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let w=u.child(h),N=g.matchType(w.type);if(!N)break;h++,(h>1||c==0||w.content.size)&&(g=N,d.push(bO(w.mark(y.allowedMarks(w.marks)),h==1?c:0,h==u.childCount?b:-1)))}let k=h==u.childCount;k||(b=-1),this.placed=gf(this.placed,n,W.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 w=0,N=u;w<b;w++){let T=N.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),N=T.content}this.unplaced=k?e==0?G.empty:new G(mf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new G(mf(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||!Ex(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=Ex(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=Ex(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=gf(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=gf(this.placed,this.depth,W.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(W.empty,!0);n.childCount&&(this.placed=gf(this.placed,this.frontier.length,n))}};function mf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(mf(t.firstChild.content,e-1,n)))}function gf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(gf(t.lastChild.content,e-1,n)))}function wx(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function bO(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,bO(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(W.empty,!0)))),t.copy(r)}function Ex(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&&!t7(n,s.content,o)?u:null}function t7(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function n7(t){return t.spec.defining||t.spec.definingForContent}function r7(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(xO(i,s,r))return t.step(new zs(e,n,r));let o=vO(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=n7(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 w=0;w<o.length;w++){let N=o[(w+c)%o.length],T=!0;N<0&&(T=!1,N=-N);let F=i.node(N-1),V=i.index(N-1);if(F.canReplaceWith(V,V,k.type,k.marks))return t.replace(i.before(N),T?s.after(N):n,new G(SO(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 SO(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(SO(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(W.empty,!0))}return t}function i7(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=QB(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new G(W.from(r),0,0))}function s7(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=vO(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 vO(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 kO=class Yd extends In{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 Yn.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 Yn.fromReplace(e,this.pos,this.pos+1,new G(W.from(i),0,n.isLeaf?0:1))}getMap(){return sl.empty}invert(e){return new Yd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yd(n.pos,n.attr,n.value)}};In.jsonID("attr",kO);let CO=class rb extends In{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 Yn.ok(r)}getMap(){return sl.empty}invert(e){return new rb(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 rb(n.attr,n.value)}};In.jsonID("docAttr",CO);let zu=class extends Error{};zu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};zu.prototype=Object.create(Error.prototype);zu.prototype.constructor=zu;zu.prototype.name="TransformError";let a7=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new $B}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new zu(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=G.empty){let i=ZB(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new G(W.from(r),0,0))}delete(e,n){return this.replace(e,n,G.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return r7(this,e,n,r),this}replaceRangeWith(e,n,r){return i7(this,e,n,r),this}deleteRange(e,n){return s7(this,e,n),this}lift(e,n){return qB(this,e,n),this}join(e,n=1){return XB(this,e,n),this}wrap(e,n){return HB(this,e,n),this}setBlockType(e,n=e,r,i=null){return KB(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return YB(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new kO(e,n,r)),this}setDocAttribute(e,n){return this.step(new CO(e,n)),this}addNodeMark(e,n){return this.step(new NS(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 ht)n.isInSet(r.marks)&&this.step(new _m(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new _m(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 WB(this,e,n,r),this}addMark(e,n,r){return UB(this,e,n,r),this}removeMark(e,n,r){return JB(this,e,n,r),this}clearIncompatible(e,n,r){return TS(this,e,n,r),this}};const Ax=Object.create(null);class Pe{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new wO(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=G.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?G.empty:n),u==0&&nA(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),nA(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Oe(e):du(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?du(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):du(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 tr(e.node(0))}static atStart(e){return du(e,e,0,0,1)||new tr(e)}static atEnd(e){return du(e,e,e.content.size,e.childCount,-1)||new tr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ax[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 Ax)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ax[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class wO{constructor(e,n){this.$from=e,this.$to=n}}let eA=!1;function tA(t){!eA&&!t.parent.inlineContent&&(eA=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Pe{constructor(e,n=e){tA(e),tA(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 Pe.near(r);let i=e.resolve(n.map(this.anchor));return new Oe(i.parent.inlineContent?i:r,r)}replace(e,n=G.empty){if(super.replace(e,n),n==G.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ng(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 Oe(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=Pe.findFrom(n,r,!0)||Pe.findFrom(n,-r,!0);if(s)n=s.$head;else return Pe.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Pe.findFrom(e,-r,!0)||Pe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Oe(e,n)}}Pe.jsonID("text",Oe);class Ng{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ng(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class be extends Pe{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?Pe.near(s):new be(s)}content(){return new G(W.from(this.node),0,0)}eq(e){return e instanceof be&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new MS(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new be(e.resolve(n.anchor))}static create(e,n){return new be(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}be.prototype.visible=!1;Pe.jsonID("node",be);class MS{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ng(r,r):new MS(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&be.isSelectable(r)?new be(n):Pe.near(n)}}class tr extends Pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=G.empty){if(n==G.empty){e.delete(0,e.doc.content.size);let r=Pe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new tr(e)}map(e){return new tr(e)}eq(e){return e instanceof tr}getBookmark(){return o7}}Pe.jsonID("all",tr);const o7={map(){return this},resolve(t){return new tr(t)}};function du(t,e,n,r,i,s=!1){if(e.inlineContent)return Oe.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&&be.isSelectable(u))return be.create(t,n-(i<0?u.nodeSize:0))}else{let c=du(t,u,n+i,i<0?u.childCount:0,i,s);if(c)return c}n+=u.nodeSize*i}return null}function nA(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof zs||i instanceof ml))return;let s=t.mapping.maps[r],o;s.forEach((u,c,h,d)=>{o==null&&(o=d)}),t.setSelection(Pe.near(t.doc.resolve(o),n))}const rA=1,Ld=2,iA=4;class l7 extends a7{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|rA)&~Ld,this.storedMarks=null,this}get selectionSet(){return(this.updated&rA)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ld,this}ensureMarks(e){return ht.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&Ld)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ld,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)||ht.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(Pe.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|=iA,this}get scrolledIntoView(){return(this.updated&iA)>0}}function sA(t,e){return!e||!t?t:t.bind(e)}class yf{constructor(e,n,r){this.name=e,this.init=sA(n.init,r),this.apply=sA(n.apply,r)}}const u7=[new yf("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new yf("selection",{init(t,e){return t.selection||Pe.atStart(e.doc)},apply(t){return t.selection}}),new yf("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new yf("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Nx{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=u7.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 yf(r.key,r.spec.state,r))})}}class Lo{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 Lo(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 l7(this)}static create(e){let n=new Nx(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Lo(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 Nx(this.schema,e.plugins),r=n.fields,i=new Lo(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 Nx(e.schema,e.plugins),s=new Lo(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=Pe.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 EO(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=EO(i,e,{})),n[r]=i}return n}class vr{constructor(e){this.spec=e,this.props={},e.props&&EO(e.props,this,this.props),this.key=e.key?e.key.key:AO("plugin")}getState(e){return e[this.key]}}const Tx=Object.create(null);function AO(t){return t in Tx?t+"$"+ ++Tx[t]:(Tx[t]=0,t+"$")}class kr{constructor(e="key"){this.key=AO(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const OS=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function NO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const TO=(t,e,n)=>{let r=NO(t,n);if(!r)return!1;let i=RS(r);if(!i){let o=r.blockRange(),u=o&&CS(o);return u==null?!1:(e&&e(t.tr.lift(o,u).scrollIntoView()),!0)}let s=i.nodeBefore;if(RO(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Bu(s,"end")||be.isSelectable(s)))for(let o=r.depth;;o--){let u=wS(t.doc,r.before(o),r.after(o),G.empty);if(u&&u.slice.size<u.to-u.from){if(e){let c=t.tr.step(u);c.setSelection(Bu(s,"end")?Pe.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):be.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},c7=(t,e,n)=>{let r=NO(t,n);if(!r)return!1;let i=RS(r);return i?f7(t,i,e):!1};function f7(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=wS(t.doc,s,c,G.empty);if(!h||h.from!=s||h instanceof Ag&&h.slice.size>=c-s)return!1;if(n){let d=t.tr.step(h);d.setSelection(Oe.create(d.doc,s)),n(d.scrollIntoView())}return!0}function Bu(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 MO=(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=RS(r)}let o=s&&s.nodeBefore;return!o||!be.isSelectable(o)?!1:(e&&e(t.tr.setSelection(be.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function RS(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 h7(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const p7=(t,e,n)=>{let r=h7(t,n);if(!r)return!1;let i=OO(r);if(!i)return!1;let s=i.nodeAfter;if(RO(t,i,e,1))return!0;if(r.parent.content.size==0&&(Bu(s,"start")||be.isSelectable(s))){let o=wS(t.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size<o.to-o.from){if(e){let u=t.tr.step(o);u.setSelection(Bu(s,"start")?Pe.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):be.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},d7=(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=OO(r)}let o=s&&s.nodeAfter;return!o||!be.isSelectable(o)?!1:(e&&e(t.tr.setSelection(be.create(t.doc,s.pos)).scrollIntoView()),!0)};function OO(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 m7=(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 DS(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 g7=(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=DS(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(Pe.near(c.doc.resolve(u),1)),e(c.scrollIntoView())}return!0},y7=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof tr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=DS(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(Oe.create(u.doc,o+1)),e(u.scrollIntoView())}return!0},x7=(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(qd(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&CS(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function b7(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof be&&e.selection.node.isBlock)return!r.parentOffset||!qd(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=DS(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 Oe||e.selection instanceof tr)&&d.deleteSelection();let g=d.mapping.map(r.pos),y=qd(d.doc,g,s.length,s);if(y||(s[0]=u?{type:u}:null,y=qd(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 S7=b7(),v7=(t,e)=>(e&&e(t.tr.setSelection(new tr(t.doc))),!0);function k7(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||uO(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function RO(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,u,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&k7(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=W.empty;for(let T=o.length-1;T>=0;T--)k=W.from(o[T].create(null,k));k=W.from(i.copy(k));let w=t.tr.step(new Im(e.pos-1,b,e.pos,b,new G(k,1,0),o.length,!0)),N=w.doc.resolve(b+2*o.length);N.nodeAfter&&N.nodeAfter.type==i.type&&uO(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&c?null:Pe.findFrom(e,1),g=d&&d.$from.blockRange(d.$to),y=g&&CS(g);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(g,y).scrollIntoView()),!0;if(h&&Bu(s,"start",!0)&&Bu(i,"end")){let b=i,k=[];for(;k.push(b),!b.isTextblock;)b=b.lastChild;let w=s,N=1;for(;!w.isTextblock;w=w.firstChild)N++;if(b.canReplace(b.childCount,b.childCount,w.content)){if(n){let T=W.empty;for(let V=k.length-1;V>=0;V--)T=W.from(k[V].copy(T));let F=t.tr.step(new Im(e.pos-k.length,e.pos+s.nodeSize,e.pos+N,e.pos+s.nodeSize-N,new G(T,k.length,0),0,!0));n(F.scrollIntoView())}return!0}}return!1}function DO(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(Oe.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const C7=DO(-1),w7=DO(1);function IS(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),u=o&&OB(o,t,e);return u?(r&&r(n.tr.wrap(o,u).scrollIntoView()),!0):!1}}function yh(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 E7(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 Tg(t,e=null,n){return function(r,i){let{empty:s,$cursor:o,ranges:u}=r.selection;if(s&&!o||!E7(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,w=g.nodeAfter,N=y.nodeBefore,T=w&&w.isText?/^\s*/.exec(w.text)[0].length:0,F=N&&N.isText?/\s*$/.exec(N.text)[0].length:0;b+T<k&&(b+=T,k-=F),h.addMark(b,k,t.create(e))}}i(h.scrollIntoView())}return!0}}function qu(...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 Mx=qu(OS,TO,MO),aA=qu(OS,p7,d7);const As={Enter:qu(m7,y7,x7,S7),"Mod-Enter":g7,Backspace:Mx,"Mod-Backspace":Mx,"Shift-Backspace":Mx,Delete:aA,"Mod-Delete":aA,"Mod-a":v7},IO={"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":C7,"Ctrl-e":w7};for(let t in As)IO[t]=As[t];const A7=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,N7=A7?IO:As,_O=65535,LO=Math.pow(2,16);function T7(t,e){return t+e*LO}function oA(t){return t&_O}function M7(t){return(t-(t&_O))/LO}const zO=1,BO=2,Wd=4,VO=8;let lA=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&(zO|Wd))>0}get deletedAfter(){return(this.delInfo&(BO|Wd))>0}get deletedAcross(){return(this.delInfo&Wd)>0}},al=class mu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&mu.empty)return mu.empty}recover(e){let n=0,r=oA(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+M7(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:T7(u/3,e-c),w=e==c?BO:e==g?zO:Wd;return(n<0?e!=c:e!=g)&&(w|=VO),new lA(b,w,k)}i+=d-h}return r?e+i:new lA(e+i,0,null)}touches(e,n){let r=0,i=oA(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 mu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?mu.empty:new mu(e<0?[0,-e,0]:[0,0,e])}};al.empty=new al([]);const Ox=Object.create(null);let _n=class{getMap(){return al.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ox[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 Ox)throw new RangeError("Duplicate use of step JSON ID "+e);return Ox[e]=n,n.prototype.jsonID=e,n}},Wn=class xf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new xf(e,null)}static fail(e){return new xf(null,e)}static fromReplace(e,n,r,i){try{return xf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mi)return xf.fail(s.message);throw s}}};function _S(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(_S(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let FO=class bf extends _n{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 G(_S(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 Wn.fromReplace(e,this.from,this.to,s)}invert(){return new PO(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 bf(n.pos,r.pos,this.mark)}merge(e){return e instanceof bf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bf(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 bf(n.from,n.to,e.markFromJSON(n.mark))}};_n.jsonID("addMark",FO);let PO=class Sf extends _n{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 G(_S(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Wn.fromReplace(e,this.from,this.to,r)}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 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))}};_n.jsonID("removeMark",PO);let jO=class vf extends _n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Wn.fromReplace(e,this.pos,this.pos+1,new G(W.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 vf(this.pos,n.marks[i]);return new vf(this.pos,this.mark)}}return new $O(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new vf(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 vf(n.pos,e.markFromJSON(n.mark))}};_n.jsonID("addNodeMark",jO);let $O=class ib extends _n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Wn.fromReplace(e,this.pos,this.pos+1,new G(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new jO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ib(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 ib(n.pos,e.markFromJSON(n.mark))}};_n.jsonID("removeNodeMark",$O);let O7=class To extends _n{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&sb(e,this.from,this.to)?Wn.fail("Structure replace would overwrite content"):Wn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new al([this.from,this.to-this.from,this.slice.size])}invert(e){return new 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?G.empty:new G(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?G.empty:new G(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,G.fromJSON(e,n.slice),!!n.structure)}};_n.jsonID("replace",O7);let R7=class Xd extends _n{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&&(sb(e,this.from,this.gapFrom)||sb(e,this.gapTo,this.to)))return Wn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Wn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Wn.fromReplace(e,this.from,this.to,r):Wn.fail("Content does not fit in gap")}getMap(){return new al([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Xd(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 Xd(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 Xd(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};_n.jsonID("replaceAround",R7);function sb(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=null,r=t){let i=I7(t,e),s=i&&_7(r,e);return s?i.map(uA).concat({type:e,attrs:n}).concat(s.map(uA)):null}function uA(t){return{type:t,attrs:null}}function I7(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 _7(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 L7(t,e){let n=t.resolve(e),r=n.index();return B7(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function z7(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 B7(t,e){return!!(t&&e&&!t.isLeaf&&z7(t,e))}let V7=class Qd extends _n{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 Wn.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 Wn.fromReplace(e,this.pos,this.pos+1,new G(W.from(i),0,n.isLeaf?0:1))}getMap(){return al.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)}};_n.jsonID("attr",V7);let F7=class ab extends _n{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 Wn.ok(r)}getMap(){return al.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)}};_n.jsonID("docAttr",F7);let xh=class extends Error{};xh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};xh.prototype=Object.create(Error.prototype);xh.prototype.constructor=xh;xh.prototype.name="TransformError";class zr{constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?P7(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function P7(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 j7=(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 zr(/--$/,"—",{inCodeMark:!1});new zr(/\.\.\.$/,"…",{inCodeMark:!1});new zr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new zr(/"$/,"”",{inCodeMark:!1});new zr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new zr(/'$/,"’",{inCodeMark:!1});function LS(t,e,n=null,r){return new zr(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&&D7(g,e,c);if(!y)return null;h.wrap(g,y);let b=h.doc.resolve(o-1).nodeBefore;return b&&b.type==e&&L7(h.doc,o-1)&&(!r||r(s,b))&&h.join(o-1),h})}function UO(t,e,n=null){return new zr(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 Ja=typeof navigator<"u"?navigator:null,cA=typeof document<"u"?document:null,Xa=Ja&&Ja.userAgent||"",ob=/Edge\/(\d+)/.exec(Xa),JO=/MSIE \d/.exec(Xa),lb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xa),zS=!!(JO||lb||ob);JO?document.documentMode:lb?+lb[1]:ob&&+ob[1];const $7=!zS&&/gecko\/(\d+)/i.test(Xa);$7&&+(/Firefox\/(\d+)/.exec(Xa)||[0,0])[1];const ub=!zS&&/Chrome\/(\d+)/.exec(Xa),U7=!!ub;ub&&+ub[1];const J7=!zS&&!!Ja&&/Apple Computer/.test(Ja.vendor),q7=J7&&(/Mobile\/\w+/.test(Xa)||!!Ja&&Ja.maxTouchPoints>2);q7||Ja&&/Mac/.test(Ja.platform);const H7=/Android \d/.test(Xa),K7=!!cA&&"webkitFontSmoothing"in cA.documentElement.style;K7&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];function Rx(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 G7=new kr("MILKDOWN_CUSTOM_INPUTRULES");function Y7({rules:t}){const e=new vr({key:G7,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 Rx(n,r,i,s,t,e)},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&Rx(n,r.pos,r.pos,"",t,e)}),!1),keydown:(n,r)=>!(H7&&U7&&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?Rx(n,i.pos,i.pos,`
|
|
40
|
-
`,t,e):!1}}});return e}function Yh(t,e,n={}){return new zr(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],w=[],N;const T={group:b,fullMatch:k,start:s,end:o},F=(u=n.updateCaptured)==null?void 0:u.call(n,T);if(Object.assign(T,F),{group:b,fullMatch:k,start:s,end:o}=T,k===null||b?.trim()==="")return null;if(b){const V=k.search(/\S/),H=s+k.indexOf(b),z=H+b.length;w=(c=g.storedMarks)!=null?c:[],z<o&&g.delete(z,o),H>s&&g.delete(s+V,H),N=s+V+b.length;const C=(h=n.getAttr)==null?void 0:h.call(n,i);g.addMark(s,N,e.create(C)),g.setStoredMarks(w),(d=n.beforeDispatch)==null||d.call(n,{match:i,start:s,end:o,tr:g})}return g})}function qO(t){return Object.assign(Object.create(t),t).setTime(Date.now())}function W7(t,e){return Array.isArray(t)&&t.includes(e.type)||e.type===t}function X7(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 Q7(t,e){return X7(n=>n.type===e)(t)}function Z7(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 eV(t,e){if(!(t instanceof be))return;const{node:n,$from:r}=t;if(W7(e,n))return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}const tV=(t,e)=>{const{selection:n,doc:r}=t;if(n instanceof be)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 qa={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:"'"},Lm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nV=typeof navigator<"u"&&/Mac/.test(navigator.platform),rV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Cn=0;Cn<10;Cn++)qa[48+Cn]=qa[96+Cn]=String(Cn);for(var Cn=1;Cn<=24;Cn++)qa[Cn+111]="F"+Cn;for(var Cn=65;Cn<=90;Cn++)qa[Cn]=String.fromCharCode(Cn+32),Lm[Cn]=String.fromCharCode(Cn);for(var Dx in qa)Lm.hasOwnProperty(Dx)||(Lm[Dx]=qa[Dx]);function iV(t){var e=nV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||rV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Lm:qa)[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 sV=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),aV=typeof navigator<"u"&&/Win/.test(navigator.platform);function oV(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))sV?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 lV(t){let e=Object.create(null);for(let n in t)e[oV(n)]=t[n];return e}function Ix(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 uV(t){return new vr({props:{handleKeyDown:HO(t)}})}function HO(t){let e=lV(t);return function(n,r){let i=iV(r),s,o=e[Ix(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[Ix(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(aV&&r.ctrlKey&&r.altKey)&&(s=qa[r.keyCode])&&s!=i){let u=e[Ix(s,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}var KO=class{},GO=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 sM();return t}}},cV=class YO extends KO{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 YO(e,n,r)}},Fi,Fh,fg,hg,pg,Ph,jh,Zo,fV=(Zo=class extends GO{constructor(n){super();Kt(this,Fi,ht.none);Kt(this,Fh,n=>n.isText);Kt(this,fg,(n,r)=>{if(rt(this,Fh).call(this,n)&&rt(this,Fh).call(this,r)&&ht.sameSet(n.marks,r.marks))return this.schema.text(n.text+r.text,n.marks)});Kt(this,hg,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.parseMarkdown.match(n));if(!r)throw bz(n);return r});Kt(this,pg,n=>{const r=rt(this,hg).call(this,n);r.spec.parseMarkdown.runner(this,n,r)});Kt(this,Ph,()=>{ou(this,Fi,ht.none);const n=this.close();return rt(this,jh).call(this,n.type,n.attrs,n.content)});Kt(this,jh,(n,r,i)=>{const s=n.createAndFill(r,i,rt(this,Fi));if(!s)throw xz(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(cV.create(r,[],i)),this),this.closeNode=()=>{try{rt(this,Ph).call(this)}catch(r){console.error(r)}return this},this.addNode=(r,i,s)=>{try{rt(this,jh).call(this,r,i,s)}catch(o){console.error(o)}return this},this.openMark=(r,i)=>(ou(this,Fi,r.create(i).addToSet(rt(this,Fi))),this),this.closeMark=r=>(ou(this,Fi,r.removeFromSet(rt(this,Fi))),this),this.addText=r=>{try{const i=this.top();if(!i)throw sM();const s=i.pop(),o=this.schema.text(r,rt(this,Fi));if(!s)return i.push(o),this;const u=rt(this,fg).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=rt(this,Ph).call(this);while(this.size());return r},this.next=(r=[])=>([r].flat().forEach(i=>rt(this,pg).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}},Fi=new WeakMap,Fh=new WeakMap,fg=new WeakMap,hg=new WeakMap,pg=new WeakMap,Ph=new WeakMap,jh=new WeakMap,Zo.create=(n,r)=>{const i=new Zo(n);return s=>(i.run(r,s),i.toDoc())},Zo),el,fA=(el=class extends KO{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()}},el.create=(e,n,r,i={})=>new el(e,n,r,i),el),hV=t=>Object.prototype.hasOwnProperty.call(t,"size"),Ns,$h,dg,mg,Uh,gg,Jh,yg,xg,_u,jo,bg,qh,tl,pV=(tl=class extends GO{constructor(n){super();Kt(this,Ns,ht.none);Kt(this,$h,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.toMarkdown.match(n));if(!r)throw Sz(n.type);return r});Kt(this,dg,n=>rt(this,$h).call(this,n).spec.toMarkdown.runner(this,n));Kt(this,mg,(n,r)=>rt(this,$h).call(this,n).spec.toMarkdown.runner(this,n,r));Kt(this,Uh,n=>{const{marks:r}=n,i=s=>s.type.spec.priority??50;[...r].sort((s,o)=>i(s)-i(o)).every(s=>!rt(this,mg).call(this,s,n))&&rt(this,dg).call(this,n),r.forEach(s=>rt(this,qh).call(this,s))});Kt(this,gg,(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});Kt(this,Jh,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=rt(this,gg).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(rt(this,Jh).call(this,y))}}return i.concat(s)},[])),n});Kt(this,yg,n=>{const r={...n.props,type:n.type};return n.children&&(r.children=n.children),n.value&&(r.value=n.value),r});Kt(this,xg,(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&&rt(this,jo).call(this,"text",void 0,i);const d=r();return s.length&&rt(this,jo).call(this,"text",void 0,s),d});Kt(this,_u,(n=!1)=>{const r=this.close(),i=()=>rt(this,jo).call(this,r.type,r.children,r.value,r.props);return n?rt(this,xg).call(this,r,i):i()});Kt(this,jo,(n,r,i,s)=>{const o=fA.create(n,r,i,s),u=rt(this,Jh).call(this,rt(this,yg).call(this,o));return this.push(u),u});Kt(this,bg,(n,r,i,s)=>n.isInSet(rt(this,Ns))?this:(ou(this,Ns,n.addToSet(rt(this,Ns))),this.openNode(r,i,{...s,isMark:!0})));Kt(this,qh,n=>{n.isInSet(rt(this,Ns))&&(ou(this,Ns,n.type.removeFromSet(rt(this,Ns))),rt(this,_u).call(this,!0))});this.openNode=(r,i,s)=>(this.open(fA.create(r,void 0,i,s)),this),this.closeNode=()=>(rt(this,_u).call(this),this),this.addNode=(r,i,s,o)=>(rt(this,jo).call(this,r,i,s,o),this),this.withMark=(r,i,s,o)=>(rt(this,bg).call(this,r,i,s,o),this),this.closeMark=r=>(rt(this,qh).call(this,r),this),this.build=()=>{let r=null;do r=rt(this,_u).call(this);while(this.size());return r},this.next=r=>hV(r)?(r.forEach(i=>{rt(this,Uh).call(this,i)}),this):(rt(this,Uh).call(this,r),this),this.toString=r=>r.stringify(this.build()),this.run=r=>(this.next(r),this),this.schema=n}},Ns=new WeakMap,$h=new WeakMap,dg=new WeakMap,mg=new WeakMap,Uh=new WeakMap,gg=new WeakMap,Jh=new WeakMap,yg=new WeakMap,xg=new WeakMap,_u=new WeakMap,jo=new WeakMap,bg=new WeakMap,qh=new WeakMap,tl.create=(n,r)=>{const i=new tl(n);return s=>(i.run(s),i.toString(r))},tl);const WO=65535,XO=Math.pow(2,16);function dV(t,e){return t+e*XO}function hA(t){return t&WO}function mV(t){return(t-(t&WO))/XO}const QO=1,ZO=2,Zd=4,e3=8;let pA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&e3)>0}get deletedBefore(){return(this.delInfo&(QO|Zd))>0}get deletedAfter(){return(this.delInfo&(ZO|Zd))>0}get deletedAcross(){return(this.delInfo&Zd)>0}},ol=class gu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&gu.empty)return gu.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+mV(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:dV(u/3,e-c),w=e==c?ZO:e==g?QO:Zd;return(n<0?e!=c:e!=g)&&(w|=e3),new pA(b,w,k)}i+=d-h}return r?e+i:new pA(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 gu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?gu.empty:new gu(e<0?[0,-e,0]:[0,0,e])}};ol.empty=new ol([]);const _x=Object.create(null);let Ln=class{getMap(){return ol.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=_x[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 _x)throw new RangeError("Duplicate use of step JSON ID "+e);return _x[e]=n,n.prototype.jsonID=e,n}},Xn=class kf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new kf(e,null)}static fail(e){return new kf(null,e)}static fromReplace(e,n,r,i){try{return kf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mi)return kf.fail(s.message);throw s}}};function BS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(BS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let t3=class Cf extends Ln{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 G(BS(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 Xn.fromReplace(e,this.from,this.to,s)}invert(){return new n3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),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))}};Ln.jsonID("addMark",t3);let n3=class wf extends Ln{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 G(BS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Xn.fromReplace(e,this.from,this.to,r)}invert(){return new t3(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 wf(n.pos,r.pos,this.mark)}merge(e){return e instanceof wf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wf(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 wf(n.from,n.to,e.markFromJSON(n.mark))}};Ln.jsonID("removeMark",n3);let r3=class Ef extends Ln{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Xn.fromReplace(e,this.pos,this.pos+1,new G(W.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 Ef(this.pos,n.marks[i]);return new Ef(this.pos,this.mark)}}return new i3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ef(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ef(n.pos,e.markFromJSON(n.mark))}};Ln.jsonID("addNodeMark",r3);let i3=class cb extends Ln{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Xn.fromReplace(e,this.pos,this.pos+1,new G(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new r3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new cb(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 cb(n.pos,e.markFromJSON(n.mark))}};Ln.jsonID("removeNodeMark",i3);let gV=class Mo extends Ln{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&fb(e,this.from,this.to)?Xn.fail("Structure replace would overwrite content"):Xn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ol([this.from,this.to-this.from,this.slice.size])}invert(e){return new 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?G.empty:new G(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?G.empty:new G(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,G.fromJSON(e,n.slice),!!n.structure)}};Ln.jsonID("replace",gV);let yV=class em extends Ln{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&&(fb(e,this.from,this.gapFrom)||fb(e,this.gapTo,this.to)))return Xn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Xn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Xn.fromReplace(e,this.from,this.to,r):Xn.fail("Content does not fit in gap")}getMap(){return new ol([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new em(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 em(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 em(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};Ln.jsonID("replaceAround",yV);function fb(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 xV(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 bV=class tm extends Ln{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 Xn.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 Xn.fromReplace(e,this.pos,this.pos+1,new G(W.from(i),0,n.isLeaf?0:1))}getMap(){return ol.empty}invert(e){return new tm(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 tm(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 tm(n.pos,n.attr,n.value)}};Ln.jsonID("attr",bV);let SV=class hb extends Ln{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 Xn.ok(r)}getMap(){return ol.empty}invert(e){return new hb(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 hb(n.attr,n.value)}};Ln.jsonID("docAttr",SV);let bh=class extends Error{};bh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};bh.prototype=Object.create(Error.prototype);bh.prototype.constructor=bh;bh.prototype.name="TransformError";const wn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Vu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let pb=null;const Es=function(t,e,n){let r=pb||(pb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},vV=function(){pb=null},ll=function(t,e,n,r){return n&&(dA(t,e,n,r,-1)||dA(t,e,n,r,1))},kV=/^(img|br|input|textarea|hr)$/i;function dA(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ri(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Wh(t)||kV.test(t.nodeName)||t.contentEditable=="false")return!1;e=wn(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?ri(t):0}else return!1}}function ri(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function CV(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=ri(t)}else if(t.parentNode&&!Wh(t))e=wn(t),t=t.parentNode;else return null}}function wV(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&&!Wh(t))e=wn(t)+1,t=t.parentNode;else return null}}function EV(t,e,n){for(let r=e==0,i=e==ri(t);r||i;){if(t==n)return!0;let s=wn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==ri(t)}}function Wh(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 Mg=function(t){return t.focusNode&&ll(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Io(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function AV(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function NV(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ri(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ri(r.startContainer),r.startOffset)}}}const $i=typeof navigator<"u"?navigator:null,mA=typeof document<"u"?document:null,Qa=$i&&$i.userAgent||"",db=/Edge\/(\d+)/.exec(Qa),s3=/MSIE \d/.exec(Qa),mb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qa),br=!!(s3||mb||db),Fa=s3?document.documentMode:mb?+mb[1]:db?+db[1]:0,si=!br&&/gecko\/(\d+)/i.test(Qa);si&&+(/Firefox\/(\d+)/.exec(Qa)||[0,0])[1];const gb=!br&&/Chrome\/(\d+)/.exec(Qa),En=!!gb,a3=gb?+gb[1]:0,Rn=!br&&!!$i&&/Apple Computer/.test($i.vendor),Fu=Rn&&(/Mobile\/\w+/.test(Qa)||!!$i&&$i.maxTouchPoints>2),Zr=Fu||($i?/Mac/.test($i.platform):!1),o3=$i?/Win/.test($i.platform):!1,Os=/Android \d/.test(Qa),Xh=!!mA&&"webkitFontSmoothing"in mA.documentElement.style,TV=Xh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function MV(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 OV(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 gA(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=Vu(o);continue}let u=o,c=u==s.body,h=c?MV(s):OV(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 w=u.scrollLeft-b,N=u.scrollTop-k;e={left:e.left-w,top:e.top-N,right:e.right-w,bottom:e.bottom-N}}let y=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(y))break;o=y=="absolute"?o.offsetParent:Vu(o)}}function RV(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:l3(t.dom)}}function l3(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Vu(r));return e}function DV({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;u3(n,r==0?0:r-e)}function u3(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 lu=null;function IV(t){if(t.setActive)return t.setActive();if(lu)return t.focus(lu);let e=l3(t);t.focus(lu==null?{get preventScroll(){return lu={preventScroll:!0},!0}}:void 0),lu||(lu=!1,u3(e,0))}function c3(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 w=k.left>e.left?k.left-e.left:k.right<e.left?e.left-k.right:0;if(w<r){n=d,r=w,i=w&&n.nodeType==3?{left:k.right<e.left?k.right:k.left,top:e.top}:e,d.nodeType==1&&w&&(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?_V(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:c3(n,i)}function _V(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=wa(r,1);if(o.top!=o.bottom&&VS(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 VS(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function LV(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function zV(t,e,n){let{node:r,offset:i}=c3(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 BV(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 f3(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(VS(e,h))return f3(o,e,h)}}if((s=(s+1)%r)==i)break}return t}function VV(t,e){let n=t.dom.ownerDocument,r,i=0,s=NV(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(!VS(e,h)||(o=f3(t.dom,e,h),!o))return null}if(Rn)for(let h=o;r&&h;h=Vu(h))h.draggable&&(r=void 0);if(o=LV(o,e),r){if(si&&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;Xh&&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=BV(t,r,i,e))}u==null&&(u=zV(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:u,inside:c?c.posAtStart-c.border:-1}}function yA(t){return t.top<t.bottom||t.left<t.right}function wa(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(yA(r))return r}return Array.prototype.find.call(n,yA)||t.getBoundingClientRect()}const FV=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function h3(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Xh||si;if(r.nodeType==3)if(o&&(FV.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let c=wa(Es(r,i,i),n);if(si&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let h=wa(Es(r,i-1,i-1),-1);if(h.top==c.top){let d=wa(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(wa(Es(r,c,h),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==ri(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return Lx(c.getBoundingClientRect(),!1)}if(s==null&&i<ri(r)){let c=r.childNodes[i];if(c.nodeType==1)return Lx(c.getBoundingClientRect(),!0)}return Lx(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==ri(r))){let c=r.childNodes[i-1],h=c.nodeType==3?Es(c,ri(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(h)return Qc(wa(h,1),!1)}if(s==null&&i<ri(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(wa(h,-1),!0)}return Qc(wa(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 Lx(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 p3(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 PV(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return p3(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=h3(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 jV=/[\u0590-\u08ac]/;function $V(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?!jV.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?s:o:p3(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:w}=t.domSelectionRange(),N=k&&!b.contains(k.nodeType==1?k:k.parentNode)||c==k&&h==w;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 xA=null,bA=null,SA=!1;function UV(t,e,n){return xA==e&&bA==n?SA:(xA=e,bA=n,SA=n=="up"||n=="down"?PV(t,e,n):$V(t,e,n))}const ai=0,vA=1,zo=2,Ui=3;class Qh{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=ai,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>wn(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 m3){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 d3&&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?wn(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?wn(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=wn(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=wn(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 w=this.children[b],N=k+w.size;if(s>k&&o<N)return w.setSelection(e-k-w.border,n-k-w.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((si||Rn)&&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 w=b,N;w;w=w.parentNode){if(N=w.nextSibling){N.nodeName=="BR"&&(u=c={node:N.parentNode,offset:wn(N)+1});break}let T=w.pmViewDesc;if(T&&T.node&&T.node.isBlock)break}}else{let w=b.childNodes[k-1];g=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(si&&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&&Rn)&&ll(u.node,u.offset,d.anchorNode,d.anchorOffset)&&ll(c.node,c.offset,d.focusNode,d.focusOffset))return;let y=!1;if((h.extend||e==n)&&!(g&&si)){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:vA,e==u&&n==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ui:s.markDirty(e-u,n-u);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?zo:Ui}r=o}this.dirty=zo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?zo:vA;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class d3 extends Qh{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==ai&&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 JV extends Qh{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 ul extends Qh{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=Wi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ul(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ui||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ui&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ai){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ai}}slice(e,n,r){let i=ul.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=xb(s,n,o,r)),e>0&&(s=xb(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 Pa extends Qh{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}=Wi.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=x3(d,r,n),h?c=new qV(e,n,r,i,d,g||null,y,h,s,o+1):n.isText?new Og(e,n,r,i,d,y,s):new Pa(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=()=>W.empty)}return e}matchesNode(e,n,r){return this.dirty==ai&&e.eq(this.node)&&zm(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 KV(this,o&&o.node,e);WV(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?ht.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),g3(this.contentDOM,this.children,e),Fu&&XV(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Oe)||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=QV(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 JV(this,s,n,i);e.input.compositionNodes.push(o),this.children=xb(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Ui||!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=ai}updateOuterDeco(e){if(zm(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=y3(this.dom,this.nodeDOM,yb(this.outerDeco,this.node,n),yb(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 kA(t,e,n,r,i){x3(r,e,t);let s=new Pa(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Og extends Pa{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==Ui||this.dirty!=ai&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ai||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=ai,!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 Og(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=Ui)}get domAtom(){return!1}isText(e){return this.node.text==e}}class m3 extends Qh{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ai&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qV extends Pa{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==Ui)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 g3(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=CA(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(u,r);if(o instanceof ul){let c=r?r.previousSibling:t.lastChild;g3(o.contentDOM,o.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=CA(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Hf=function(t){t&&(this.nodeName=t)};Hf.prototype=Object.create(null);const Bo=[new Hf];function yb(t,e,n){if(t.length==0)return Bo;let r=n?Bo[0]:new Hf,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Hf(o.nodeName));for(let u in o){let c=o[u];c!=null&&(n&&i.length==1&&i.push(r=new Hf(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 y3(t,e,n,r){if(n==Bo&&r==Bo)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=Bo[0]),i=c}HV(i,u||Bo[0],o)}return i}function HV(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 x3(t,e,n){return y3(t,t,Bo,yb(e,n,t.nodeType!=1))}function zm(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 CA(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class KV{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=GV(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=ai,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=ul.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==Ui&&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 Pa){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!=Ui&&zm(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=ai),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)||!zm(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let u=Pa.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=Pa.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 d3(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 ul;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Og)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Rn||En)&&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 m3(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 GV(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 ul)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 YV(t,e){return t.type.side-e.type.side}function WV(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(YV);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 T=0;T<u.length;T++)u[T].to<N&&(N=u[T].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 w=y.isInline&&!y.isLeaf?u.filter(N=>!N.inline):u.slice();r(y,w,e.forChild(s,y),b),s=k}}function XV(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 QV(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 xb(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 FS(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(Mg(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&be.isSelectable(g)&&i.parent&&!(g.isInline&&EV(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new be(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=PS(t,d,u,g)}return h}function b3(t){return t.editable?t.hasFocus():v3(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ds(t,e=!1){let n=t.state.selection;if(S3(t,n),!!b3(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&En){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ll(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)eF(t);else{let{anchor:r,head:i}=n,s,o;wA&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=EA(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=EA(t,n.to))),t.docView.setSelection(r,i,t,e),wA&&(s&&AA(s),o&&AA(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ZV(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const wA=Rn||En&&a3<63;function EA(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(Rn&&i&&i.contentEditable=="false")return zx(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return zx(i);if(s)return zx(s)}}function zx(t){return t.contentEditable="true",Rn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function AA(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function ZV(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(()=>{(!b3(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function eF(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,wn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&br&&Fa<=11&&(n.disabled=!0,n.disabled=!1)}function S3(t,e){if(e instanceof be){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(NA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else NA(t)}function NA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function PS(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function TA(t){return t.editable&&!t.hasFocus()?!1:v3(t)}function v3(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 tF(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ll(e.node,e.offset,n.anchorNode,n.anchorOffset)}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&&Pe.findFrom(s,e)}function Ta(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function MA(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 Ta(t,new Oe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=bb(t.state,e);return i&&i instanceof be?Ta(t,i):!1}else if(!(Zr&&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?be.isSelectable(s)?Ta(t,new be(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Xh?Ta(t,new Oe(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof be&&r.node.isInline)return Ta(t,new Oe(e>0?r.$to:r.$from));{let i=bb(t.state,e);return i?Ta(t,i):!1}}}function Bm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Kf(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?nF(t):rF(t)}function nF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(si&&n.nodeType==1&&r<Bm(n)&&Kf(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(Kf(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(k3(n))break;{let u=n.previousSibling;for(;u&&Kf(u,-1);)i=n.parentNode,s=wn(u),u=u.previousSibling;if(u)n=u,r=Bm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Sb(t,n,r):i&&Sb(t,i,s)}function rF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Bm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(Kf(u,1))s=n,o=++r;else break}else{if(k3(n))break;{let u=n.nextSibling;for(;u&&Kf(u,1);)s=u.parentNode,o=wn(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=Bm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Sb(t,s,o)}function k3(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function iF(t,e){for(;t&&e==t.childNodes.length&&!Wh(t);)e=wn(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 sF(t,e){for(;t&&!e&&!Wh(t);)e=wn(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 Sb(t,e,n){if(e.nodeType!=3){let s,o;(o=iF(e,n))?(e=o,n=0):(s=sF(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Mg(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 OA(t,e){let n=t.state.doc.resolve(e);if(!(En||o3)&&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 RA(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||Zr&&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 be)return Ta(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof tr?Pe.near(o,e):Pe.findFrom(o,e);return u?Ta(t,u):!1}return!1}function DA(t,e){if(!(t.state.selection instanceof Oe))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 IA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function aF(t){if(!Rn||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;IA(t,r,"true"),setTimeout(()=>IA(t,r,"false"),20)}return!1}function oF(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function lF(t,e){let n=e.keyCode,r=oF(e);if(n==8||Zr&&n==72&&r=="c")return DA(t,-1)||uu(t,-1);if(n==46&&!e.shiftKey||Zr&&n==68&&r=="c")return DA(t,1)||uu(t,1);if(n==13||n==27)return!0;if(n==37||Zr&&n==66&&r=="c"){let i=n==37?OA(t,t.state.selection.from)=="ltr"?-1:1:-1;return MA(t,i,r)||uu(t,i)}else if(n==39||Zr&&n==70&&r=="c"){let i=n==39?OA(t,t.state.selection.from)=="ltr"?1:-1:1;return MA(t,i,r)||uu(t,i)}else{if(n==38||Zr&&n==80&&r=="c")return RA(t,-1,r)||uu(t,-1);if(n==40||Zr&&n==78&&r=="c")return aF(t)||RA(t,1,r)||uu(t,1);if(r==(Zr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function jS(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")||Wi.fromSchema(t.state.schema),u=T3(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=N3[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 C3(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 G(W.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=Wi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(k.serializeNode(b.text(w,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=hF(n),Xh&&pF(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")||Ua.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!uF.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=dF(_A(u,+d[1],+d[2]),d[4]);else if(u=G.maxOpen(cF(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=_A(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const uF=/^(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 cF(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&&E3(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=A3(o[o.length-1],s.length));let d=w3(u,c);o.push(d),i=i.matchType(d.type),s=c}}),o)return W.from(o)}return t}function w3(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,W.from(t));return t}function E3(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=E3(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(W.from(w3(n,t,i+1))))}}function A3(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,A3(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(W.empty,!0);return t.copy(n.append(r))}function vb(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=vb(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(W.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function _A(t,e,n){return e<t.openStart&&(t=new G(vb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new G(vb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const N3={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 LA=null;function T3(){return LA||(LA=document.implementation.createHTMLDocument("title"))}let Bx=null;function fF(t){let e=window.trustedTypes;return e?(Bx||(Bx=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Bx.createHTML(t)):t}function hF(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=T3().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&N3[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=fF(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function pF(t){let e=t.querySelectorAll(En?"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 dF(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=W.from(c.create(r[u+1],i)),s++,o++}return new G(i,s,o)}const rr={},ir={},mF={touchstart:!0,touchmove:!0};class gF{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 yF(t){for(let e in rr){let n=rr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{bF(t,r)&&!$S(t,r)&&(t.editable||!(r.type in ir))&&n(t,r)},mF[e]?{passive:!0}:void 0)}Rn&&t.dom.addEventListener("input",()=>null),kb(t)}function _a(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function xF(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 kb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>$S(t,r))})}function $S(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function bF(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 SF(t,e){!$S(t,e)&&rr[e.type]&&(t.editable||!(e.type in ir))&&rr[e.type](t,e)}ir.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!O3(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Os&&En&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Fu&&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,Io(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||lF(t,n)?n.preventDefault():_a(t,"key")};ir.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ir.keypress=(t,e)=>{let n=e;if(O3(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Zr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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 Rg(t){return{left:t.clientX,top:t.clientY}}function vF(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function US(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 Mu(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 kF(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&be.isSelectable(r)?(Mu(t,new be(n)),!0):!1}function CF(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof be&&(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(be.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?(Mu(t,be.create(t.state.doc,i)),!0):!1}function wF(t,e,n,r,i){return US(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?CF(t,n):kF(t,n))}function EF(t,e,n,r){return US(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function AF(t,e,n,r){return US(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||NF(t,n,r)}function NF(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Mu(t,Oe.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)Mu(t,Oe.create(r,u+1,u+1+o.content.size));else if(be.isSelectable(o))Mu(t,be.create(r,u));else continue;return!0}}function JS(t){return Vm(t)}const M3=Zr?"metaKey":"ctrlKey";rr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=JS(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&vF(n,t.input.lastClick)&&!n[M3]&&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(Rg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new TF(t,o,n,!!r)):(s=="doubleClick"?EF:AF)(t,o.pos,o.inside,n)?n.preventDefault():_a(t,"pointer"))};let TF=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[M3],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 be&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&si&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),_a(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>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(Rg(e))),this.updateAllowDefault(e),this.allowDefault||!n?_a(this.view,"pointer"):wF(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rn&&this.mightDrag&&!this.mightDrag.node.isAtom||En&&!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)?(Mu(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):_a(this.view,"pointer")}move(e){this.updateAllowDefault(e),_a(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};rr.touchstart=t=>{t.input.lastTouch=Date.now(),JS(t),_a(t,"pointer")};rr.touchmove=t=>{t.input.lastTouch=Date.now(),_a(t,"pointer")};rr.contextmenu=t=>JS(t);function O3(t,e){return t.composing?!0:Rn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const MF=Os?5e3:-1;ir.compositionstart=ir.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||En&&o3&&OF(t)))t.markCursor=t.state.storedMarks||n.marks(),Vm(t,!0),t.markCursor=null;else if(Vm(t,!e.selection.empty),si&&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}R3(t,MF)};function OF(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"}ir.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++,R3(t,20))};function R3(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Vm(t),e))}function D3(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=DF());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function RF(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=CV(e.focusNode,e.focusOffset),r=wV(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 DF(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Vm(t,e=!1){if(!(Os&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),D3(t),e||t.docView&&t.docView.dirty){let n=FS(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 IF(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 Sh=br&&Fa<15||Fu&&TV<604;rr.copy=ir.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Sh?null:n.clipboardData,o=r.content(),{dom:u,text:c}=jS(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):IF(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function _F(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function LF(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?vh(t,r.value,null,i,e):vh(t,r.textContent,r.innerHTML,i,e)},50)}function vh(t,e,n,r,i){let s=C3(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||G.empty)))return!0;if(!s)return!1;let o=_F(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 I3(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," "):""}ir.paste=(t,e)=>{let n=e;if(t.composing&&!Os)return;let r=Sh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&vh(t,I3(r),r.getData("text/html"),i,n)?n.preventDefault():LF(t,n)};let _3=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const zF=Zr?"altKey":"ctrlKey";function L3(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[zF]}rr.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(Rg(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof be?i.to-1:i.to))){if(r&&r.mightDrag)o=be.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=be.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:d}=jS(t,u);(!n.dataTransfer.files.length||!En||a3>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Sh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Sh||n.dataTransfer.setData("text/plain",h),t.dragging=new _3(d,L3(t,n),o)};rr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ir.dragover=ir.dragenter=(t,e)=>e.preventDefault();ir.drop=(t,e)=>{try{BF(t,e,t.dragging)}finally{t.dragging=null}};function BF(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Rg(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=C3(t,I3(e.dataTransfer),Sh?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&L3(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||G.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?xV(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&&be.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new be(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((k,w,N,T)=>b=T),c.setSelection(PS(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}rr.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))};rr.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)};rr.beforeinput=(t,e)=>{if(En&&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,Io(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 ir)rr[t]=ir[t];function kh(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 zA=class z3{constructor(e,n){this.toDOM=e,this.spec=n||Jo,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 Ha(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof z3&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&kh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Gf=class Cb{constructor(e,n){this.attrs=e,this.spec=n||Jo}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 Ha(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Cb&&kh(this.attrs,e.attrs)&&kh(this.spec,e.spec)}static is(e){return e.type instanceof Cb}destroy(){}},VF=class B3{constructor(e,n){this.attrs=e,this.spec=n||Jo}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 Ha(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 B3&&kh(this.attrs,e.attrs)&&kh(this.spec,e.spec)}destroy(){}},Ha=class Af{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Af(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 Af(e,e,new zA(n,r))}static inline(e,n,r,i){return new Af(e,n,new Gf(r,i))}static node(e,n,r,i){return new Af(e,n,new VF(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Gf}get widget(){return this.type instanceof zA}};const yu=[],Jo={};let oi=class Ea{constructor(e,n){this.local=e.length?e:yu,this.children=n.length?n:yu}static create(e,n){return n.length?Fm(n,e,0,Jo):Tn}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==Tn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Jo)}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?FF(this.children,o||[],e,n,r,i,s):o?new Ea(o.sort(qo),yu):Tn}add(e,n){return n.length?this==Tn?Ea.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=P3(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,Fm(d,u,h+1,Jo)),s+=3}});let o=F3(s?j3(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new Ea(o.length?this.local.concat(o).sort(qo):this.local,i||this.children)}remove(e){return e.length==0||this==Tn?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!=Tn?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 Ea(i,r):Tn}forChild(e,n){if(this==Tn)return this;if(n.isLeaf)return Ea.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 Gf){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 Ea(i.sort(qo),yu);return r?new V3([u,r]):u}return r||Tn}eq(e){if(this==e)return!0;if(!(e instanceof Ea)||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 qS(this.localsInner(e))}localsInner(e){if(this==Tn)return yu;if(e.inlineContent||!this.local.some(Gf.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Gf||n.push(this.local[r]);return n}forEachSet(e){e(this)}};oi.empty=new oi([],[]);oi.removeOverlap=qS;const Tn=oi.empty;let V3=class xu{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Jo));return xu.from(r)}forChild(e,n){if(n.isLeaf)return oi.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Tn&&(s instanceof xu?r=r.concat(s.members):r.push(s))}return xu.from(r)}eq(e){if(!(e instanceof xu)||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?qS(r?n:n.sort(qo)):yu}static from(e){switch(e.length){case 0:return Tn;case 1:return e[0];default:return new xu(e.every(n=>n instanceof oi)?e:e.reduce((n,r)=>n.concat(r instanceof oi?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function FF(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,w)=>{let N=w-k-(b-y);for(let T=0;T<u.length;T+=3){let F=u[T+1];if(F<0||y>F+d-g)continue;let V=u[T]+d-g;b>=V?u[T+1]=y<=V?-2:-1:y>=d&&N&&(u[T]+=N,u[T+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:w}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&w==g&&w+N.nodeSize==b){let T=u[h+2].mapInner(n,N,d+1,t[h]+s+1,o);T!=Tn?(u[h]=g,u[h+1]=b,u[h+2]=T):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=PF(u,t,e,n,i,s,o),d=Fm(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 oi(e.sort(qo),u)}function F3(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 Ha(i.from+e,i.to+e,i.type))}return n}function PF(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 P3(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 j3(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Fm(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=P3(t,u,c+n);if(h){s=!0;let d=Fm(h,u,n+c+1,r);d!=Tn&&i.push(c,c+u.nodeSize,d)}});let o=F3(s?j3(t):t,-n).sort(qo);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 oi(o,i):Tn}function qo(t,e){return t.from-e.from||t.to-e.to}function qS(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),BA(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),BA(e,i,r.copy(s.from,r.to)));break}}}return e}function BA(t,e,n){for(;e<t.length&&qo(n,t[e])>0;)e++;t.splice(e,0,n)}function Vx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Tn&&e.push(r)}),t.cursorWrapper&&e.push(oi.create(t.state.doc,[t.cursorWrapper.deco])),V3.from(e)}const jF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},$F=br&&Fa<=11;class UF{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 JF{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new UF,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]);br&&Fa<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Rn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),$F&&(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,jF)),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(TA(this.view)){if(this.suppressingSelectionUpdates)return Ds(this.view);if(br&&Fa<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ll(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=Vu(s))n.add(s);for(let s=e.anchorNode;s;s=Vu(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)&&TA(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(si&&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||KF(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&&Mg(r)&&(h=FS(e))&&h.eq(Pe.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),qF(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,GF(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(br&&Fa<=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?wn(i)+1:0,u=r.localPosFromDOM(e.target,o,-1),c=s&&s.parentNode==e.target?wn(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 VA=new WeakMap,FA=!1;function qF(t){if(!VA.has(t)&&(VA.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=si,FA)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."),FA=!0}}function PA(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return ll(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function HF(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return PA(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?PA(t,n):null}function KF(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 GF(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 YF(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}],Mg(c)||h.push({node:c.focusNode,offset:c.focusOffset})),En&&t.input.lastKeyCode===8)for(let N=s;N>i;N--){let T=r.childNodes[N-1],F=T.pmViewDesc;if(T.nodeName=="BR"&&!F){s=N;break}if(!F||F.size)break}let g=t.state.doc,y=t.someProp("domParser")||Ua.fromSchema(t.state.schema),b=g.resolve(o),k=null,w=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:WF,context:b});if(h&&h[0].pos!=null){let N=h[0].pos,T=h[1]&&h[1].pos;T==null&&(T=N),k={anchor:N+o,head:T+o}}return{doc:w,sel:k,from:o,to:u}}function WF(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Rn&&/^(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||Rn&&/^(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 XF=/^(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 QF(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let _=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,U=FS(t,_);if(U&&!t.state.selection.eq(U)){if(En&&Os&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",q=>q(t,Io(13,"Enter"))))return;let $=t.state.tr.setSelection(U);_=="pointer"?$.setMeta("pointer",!0):_=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),t.dispatch($)}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=YF(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=tP(g.content,h.doc.content,h.from,y,b);if(k&&t.input.domChangeCount++,(Fu&&t.input.lastIOSEnter>Date.now()-225||Os)&&i.some(_=>_.nodeType==1&&!XF.test(_.nodeName))&&(!k||k.endA>=k.endB)&&t.someProp("handleKeyDown",_=>_(t,Io(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!k)if(r&&c instanceof Oe&&!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 _=jA(t,t.state.doc,h.sel);if(_&&!_.eq(t.state.selection)){let U=t.state.tr.setSelection(_);s&&U.setMeta("composition",s),t.dispatch(U)}}return}t.state.selection.from<t.state.selection.to&&k.start==k.endB&&t.state.selection instanceof Oe&&(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)),br&&Fa<=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 w=h.doc.resolveNoCache(k.start-h.from),N=h.doc.resolveNoCache(k.endB-h.from),T=d.resolve(k.start),F=w.sameParent(N)&&w.parent.inlineContent&&T.end()>=k.endA;if((Fu&&t.input.lastIOSEnter>Date.now()-225&&(!F||i.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!F&&w.pos<h.doc.content.size&&(!w.sameParent(N)||!w.parent.inlineContent)&&w.pos<N.pos&&!/\S/.test(h.doc.textBetween(w.pos,N.pos,"","")))&&t.someProp("handleKeyDown",_=>_(t,Io(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>k.start&&eP(d,k.start,k.endA,w,N)&&t.someProp("handleKeyDown",_=>_(t,Io(8,"Backspace")))){Os&&En&&t.domObserver.suppressSelectionUpdates();return}En&&k.endB==k.start&&(t.input.lastChromeDelete=Date.now()),Os&&!F&&w.start()!=N.start()&&N.parentOffset==0&&w.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(_){return _(t,Io(13,"Enter"))})},20));let V=k.start,H=k.endA,z=_=>{let U=_||t.state.tr.replace(V,H,h.doc.slice(k.start-h.from,k.endB-h.from));if(h.sel){let $=jA(t,U.doc,h.sel);$&&!(En&&t.composing&&$.empty&&(k.start!=k.endB||t.input.lastChromeDelete<Date.now()-100)&&($.head==V||$.head==U.mapping.map(H)-1)||br&&$.empty&&$.head==V)&&U.setSelection($)}return s&&U.setMeta("composition",s),U.scrollIntoView()},C;if(F)if(w.pos==N.pos){br&&Fa<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ds(t),20));let _=z(t.state.tr.delete(V,H)),U=d.resolve(k.start).marksAcross(d.resolve(k.endA));U&&_.ensureMarks(U),t.dispatch(_)}else if(k.endA==k.endB&&(C=ZF(w.parent.content.cut(w.parentOffset,N.parentOffset),T.parent.content.cut(T.parentOffset,k.endA-T.start())))){let _=z(t.state.tr);C.type=="add"?_.addMark(V,H,C.mark):_.removeMark(V,H,C.mark),t.dispatch(_)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let _=w.parent.textBetween(w.parentOffset,N.parentOffset),U=()=>z(t.state.tr.insertText(_,V,H));t.someProp("handleTextInput",$=>$(t,V,H,_,U))||t.dispatch(U())}else t.dispatch(z());else t.dispatch(z())}function jA(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:PS(t,e.resolve(n.anchor),e.resolve(n.head))}function ZF(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(W.from(h).eq(t))return{mark:u,type:o}}function eP(t,e,n,r,i){if(n-e<=i.pos-r.pos||Fx(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(Fx(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Fx(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Fx(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 tP(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&&$A(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&&$A(t.textBetween(s-1,s+1))&&(s+=c?1:-1),o=s+(o-u),u=s}return{start:s,endA:o,endB:u}}function $A(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 $3{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 gF,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(KA),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=qA(this),JA(this),this.nodeViews=HA(this),this.docView=kA(this.state.doc,UA(this),Vx(this),this.dom,this),this.domObserver=new JF(this,(r,i,s,o)=>QF(this,r,i,s,o)),this.domObserver.start(),yF(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&&kb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(KA),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&&(D3(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=HA(this);rP(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&kb(this),this.editable=qA(this),JA(this);let c=Vx(this),h=UA(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&&RV(this);if(o){this.domObserver.stop();let b=g&&(br||En)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&nP(i.selection,e.selection);if(g){let k=En?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=RF(this)),(s||!this.docView.update(e.doc,h,c,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=kA(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())&&tF(this))?Ds(this,b):(S3(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&&DV(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 be){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&gA(this,n.getBoundingClientRect(),e)}else gA(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 _3(e.slice,e.move,i<0?void 0:be.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(br){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&&IV(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 VV(this,e)}coordsAtPos(e,n=1){return h3(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 UV(this,n||this.state,e)}pasteHTML(e,n){return vh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return vh(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return jS(this,e)}destroy(){this.docView&&(xF(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Vx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,vV())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return SF(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rn&&this.root.nodeType===11&&AV(this.dom.ownerDocument)==this.dom&&HF(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}$3.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function UA(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"),[Ha.node(0,t.state.doc.content.size,e)]}function JA(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:Ha.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function qA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function nP(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 HA(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 rP(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 KA(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 Ps(t,e){return t.meta={package:"@milkdown/core",group:"System",...e},t}var U3={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}},rn=lt({},"editorView"),Nf=lt({},"editorState"),Px=lt([],"initTimer"),GA=lt({},"editor"),Ch=lt([],"inputRules"),Bs=lt([],"prosePlugins"),wh=lt([],"remarkPlugins"),Eh=lt([],"nodeView"),Ah=lt([],"markView"),Ho=lt(Tm().use(Am).use(J1),"remark"),Yf=lt({handlers:U3,encode:[]},"remarkStringifyOptions"),nm=Yi("ConfigReady");function iP(t){const e=n=>(n.record(nm),async()=>(await t(n),n.done(nm),()=>{n.clearTimer(nm)}));return Ps(e,{displayName:"Config"}),e}var Ko=Yi("InitReady");function sP(t){const e=n=>(n.inject(GA,t).inject(Bs,[]).inject(wh,[]).inject(Ch,[]).inject(Eh,[]).inject(Ah,[]).inject(Yf,{handlers:U3,encode:[]}).inject(Ho,Tm().use(Am).use(J1)).inject(Px,[nm]).record(Ko),async()=>{await n.waitTimers(Px);const r=n.get(Yf);return n.set(Ho,Tm().use(Am).use(J1,r)),n.done(Ko),()=>{n.remove(GA).remove(Bs).remove(wh).remove(Ch).remove(Eh).remove(Ah).remove(Yf).remove(Ho).remove(Px).clearTimer(Ko)}});return Ps(e,{displayName:"Init"}),e}var nr=Yi("SchemaReady"),jx=lt([],"schemaTimer"),Is=lt({},"schema"),Wf=lt([],"nodes"),Xf=lt([],"marks");function YA(t){return{...t,parseDOM:t.parseDOM?.map(e=>({priority:t.priority,...e}))}}var J3=t=>(t.inject(Is,{}).inject(Wf,[]).inject(Xf,[]).inject(jx,[Ko]).record(nr),async()=>{await t.waitTimers(jx);const e=t.get(Ho),n=t.get(wh).reduce((i,s)=>i.use(s.plugin,s.options),e);t.set(Ho,n);const r=new bB({nodes:Object.fromEntries(t.get(Wf).map(([i,s])=>[i,YA(s)])),marks:Object.fromEntries(t.get(Xf).map(([i,s])=>[i,YA(s)]))});return t.set(Is,r),t.done(nr),()=>{t.remove(Is).remove(Wf).remove(Xf).remove(jx).clearTimer(nr)}});Ps(J3,{displayName:"Schema"});var q3=class{constructor(){this.setCtx=t=>{this.#e=t},this.chain=()=>{if(this.#e==null)throw ox();const t=this.#e,e=[],n=this.get.bind(this),r={run:()=>{const s=qu(...e),o=t.get(rn);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 aM;#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 ox();const n=this.get(t)(e),r=this.#e.get(rn);return n(r.state,r.dispatch,r)}inline(t){if(this.#e==null)throw ox();const e=this.#e.get(rn);return t(e.state,e.dispatch,e)}};function aP(t="cmdKey"){return lt((()=>()=>!1),t)}var kt=lt(new q3,"commands"),$x=lt([nr],"commandsTimer"),Qf=Yi("CommandsReady"),H3=t=>{const e=new q3;return e.setCtx(t),t.inject(kt,e).inject($x,[nr]).record(Qf),async()=>(await t.waitTimers($x),t.done(Qf),()=>{t.remove(kt).remove($x).clearTimer(Qf)})};Ps(H3,{displayName:"Commands"});function oP(t){return t.Backspace=qu(j7,OS,c7,MO),t}var K3=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=oP(N7);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 vg();return qu(...r.map(h=>h.onRun(c)))(s,o,u)}]}))}}#t=null;#e=[];get ctx(){return this.#t}},Pm=lt(new K3,"keymap"),Ux=lt([nr],"keymapTimer"),Zf=Yi("KeymapReady"),lP=t=>{const e=new K3;return e.setCtx(t),t.inject(Pm,e).inject(Ux,[nr]).record(Zf),async()=>(await t.waitTimers(Ux),t.done(Zf),()=>{t.remove(Pm).remove(Ux).clearTimer(Zf)})},rm=Yi("ParserReady"),G3=(()=>{throw vg()}),eh=lt(G3,"parser"),Jx=lt([],"parserTimer"),Y3=t=>(t.inject(eh,G3).inject(Jx,[nr]).record(rm),async()=>{await t.waitTimers(Jx);const e=t.get(Ho),n=t.get(Is);return t.set(eh,fV.create(n,e)),t.done(rm),()=>{t.remove(eh).remove(Jx).clearTimer(rm)}});Ps(Y3,{displayName:"Parser"});var th=Yi("SerializerReady"),qx=lt([],"serializerTimer"),W3=(()=>{throw vg()}),im=lt(W3,"serializer"),X3=t=>(t.inject(im,W3).inject(qx,[nr]).record(th),async()=>{await t.waitTimers(qx);const e=t.get(Ho),n=t.get(Is);return t.set(im,pV.create(n,e)),t.done(th),()=>{t.remove(im).remove(qx).clearTimer(th)}});Ps(X3,{displayName:"Serializer"});var nh=lt("","defaultValue"),sm=lt(t=>t,"stateOptions"),Hx=lt([],"editorStateTimer"),am=Yi("EditorStateReady");function uP(t,e,n){if(typeof t=="string")return e(t);if(t.type==="html")return Ua.fromSchema(n).parse(t.dom);if(t.type==="json")return Rs.fromJSON(n,t.value);throw mz(t)}var cP=new kr("MILKDOWN_STATE_TRACKER"),Q3=t=>(t.inject(nh,"").inject(Nf,{}).inject(sm,e=>e).inject(Hx,[rm,th,Qf,Zf]).record(am),async()=>{await t.waitTimers(Hx);const e=t.get(Is),n=t.get(eh),r=t.get(Ch),i=t.get(sm),s=t.get(Bs),o=uP(t.get(nh),n,e),u=t.get(Pm),c=u.addBaseKeymap(),h=[...s,new vr({key:cP,state:{init:()=>{},apply:(y,b,k,w)=>{t.set(Nf,w)}}}),Y7({rules:r}),uV(u.build())];t.set(Bs,h);const d=i({schema:e,doc:o,plugins:h}),g=Lo.create(d);return t.set(Nf,g),t.done(am),()=>{c(),t.remove(nh).remove(Nf).remove(sm).remove(Hx).clearTimer(am)}});Ps(Q3,{displayName:"EditorState"});var Nh=lt([],"pasteRule"),Kx=lt([nr],"pasteRuleTimer"),om=Yi("PasteRuleReady"),Z3=t=>(t.inject(Nh,[]).inject(Kx,[nr]).record(om),async()=>(await t.waitTimers(Kx),t.done(om),()=>{t.remove(Nh).remove(Kx).clearTimer(om)}));Ps(Z3,{displayName:"PasteRule"});var lm=Yi("EditorViewReady"),Gx=lt([],"editorViewTimer"),Yx=lt({},"editorViewOptions"),rh=lt(null,"root"),wb=lt(null,"rootDOM"),Eb=lt({},"rootAttrs");function fP(t,e){const n=document.createElement("div");n.className="milkdown",t.appendChild(n),e.set(wb,n);const r=e.get(Eb);return Object.entries(r).forEach(([i,s])=>n.setAttribute(i,s)),n}function hP(t){t.classList.add("editor"),t.setAttribute("role","textbox")}var pP=new kr("MILKDOWN_VIEW_CLEAR"),eR=t=>(t.inject(rh,document.body).inject(rn,{}).inject(Yx,{}).inject(wb,null).inject(Eb,{}).inject(Gx,[am,om]).record(lm),async()=>{await t.wait(Ko);const e=t.get(rh)||document.body,n=typeof e=="string"?document.querySelector(e):e;t.update(Bs,o=>[new vr({key:pP,view:u=>{const c=n?fP(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(Gx);const r=t.get(Nf),i=t.get(Yx),s=new $3(n,{state:r,nodeViews:Object.fromEntries(t.get(Eh)),markViews:Object.fromEntries(t.get(Ah)),transformPasted:(o,u,c)=>(t.get(Nh).sort((h,d)=>(d.priority??50)-(h.priority??50)).map(h=>h.run).forEach(h=>{o=h(o,u,c)}),o),...i});return hP(s.dom),t.set(rn,s),t.done(lm),()=>{s?.destroy(),t.remove(rh).remove(rn).remove(Yx).remove(wb).remove(Eb).remove(Gx).clearTimer(lm)}});Ps(eR,{displayName:"EditorView"});var Wr=(function(t){return t.Idle="Idle",t.OnCreate="OnCreate",t.Created="Created",t.OnDestroy="OnDestroy",t.Destroyed="Destroyed",t})({}),tR=class nR{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===Wr.Created&&this.#c(n,this.#i),this},this.remove=async e=>this.#e===Wr.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===Wr.OnCreate?this:(this.#e===Wr.Created&&await this.destroy(),this.#u(Wr.OnCreate),this.#p(),this.#c([...this.#i.keys()],this.#i),await Promise.all([this.#h(this.#a),this.#h(this.#i)].flat()),this.#u(Wr.Created),this),this.destroy=async(e=!1)=>this.#e===Wr.Destroyed||this.#e===Wr.OnDestroy?this:this.#e===Wr.OnCreate?new Promise(n=>{setTimeout(()=>{n(this.destroy(e))},50)}):(e&&(this.#r=[]),this.#u(Wr.OnDestroy),await this.#f([...this.#i.keys()],e),await this.#d(),this.#u(Wr.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 nR}#t=!1;#e=Wr.Idle;#r=[];#n=()=>{};#o=new aM;#s=new Nz;#i=new Map;#a=new Map;#l=new Az(this.#o,this.#s);#p=()=>{const e=iP(async r=>{await Promise.all(this.#r.map(i=>Promise.resolve(i(r))))}),n=[J3,Y3,X3,H3,lP,Z3,Q3,eR,sP(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 qe(t,e){const n=aP(t),r=i=>async()=>{r.key=n,await i.wait(Qf);const s=e(i);return i.get(kt).create(n,s),r.run=o=>i.get(kt).call(t,o),()=>{i.get(kt).remove(n)}};return r}function Cr(t){const e=n=>async()=>{await n.wait(nr);const r=t(n);return n.update(Ch,i=>[...i,r]),e.inputRule=r,()=>{n.update(Ch,i=>i.filter(s=>s!==r))}};return e}function dP(t){const e=n=>async()=>{await n.wait(nr);const r=t(n);return n.update(Nh,i=>[...i,r]),e.pasteRule=r,()=>{n.update(Nh,i=>i.filter(s=>s!==r))}};return e}function mP(t,e){const n=r=>async()=>{const i=e(r);return r.update(Xf,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(Xf,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Is).marks[t];if(!i)throw kz(t);return i},n}function Hu(t,e){const n=r=>async()=>{const i=e(r);return r.update(Wf,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(Wf,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Is).nodes[t];if(!i)throw vz(t);return i},n}function js(t){let e;const n=r=>async()=>(await r.wait(nr),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 gP(t){const e=n=>async()=>{await n.wait(Zf);const r=n.get(Pm),i=t(n),s=r.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function rR(t,e){const n=r=>async()=>{await r.wait(nr);const i=e(r);return t.type(r)instanceof Dm?r.update(Eh,s=>[...s,[t.id,i]]):r.update(Ah,s=>[...s,[t.id,i]]),n.view=i,n.type=t,()=>{t.type(r)instanceof Dm?r.update(Eh,s=>s.filter(o=>o[0]!==t.id)):r.update(Ah,s=>s.filter(o=>o[0]!==t.id))}};return n}function Za(t,e){const n=lt(t,e),r=i=>(i.inject(n),()=>()=>{i.remove(n)});return r.key=n,r}function an(t,e){const n=Za(e,t),r=Hu(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=>an(t,s(e)),i}function Ku(t,e){const n=Za(e,t),r=mP(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=>Ku(t,s(e)),i}function Br(t,e){const n=Za(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:o,priority:u}])=>[s,{shortcuts:o,priority:u}])),`${t}Keymap`),r=gP(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 Oi=(t,e=()=>({}))=>Za(e,`${t}Attr`),Zh=(t,e=()=>({}))=>Za(e,`${t}Attr`);function hi(t,e,n){const r=Za({},t),i=o=>async()=>{await o.wait(Ko);const u={plugin:e(o),options:o.get(r.key)};return o.update(wh,c=>[...c,u]),()=>{o.update(wh,c=>c.filter(h=>h!==u))}},s=[r,i];return s.id=t,s.plugin=i,s.options=r,s}function Ai(t,e){return n=>n.get(kt).call(t,e)}function iR(t,e=!1){return n=>{const r=n.get(rn),i=n.get(eh)(t);if(!i)return;if(!e){const{state:c}=r;return r.dispatch(c.tr.replace(0,c.doc.content.size,new G(i.content,0,0)))}const s=n.get(Is),o=n.get(sm)({schema:s,doc:i,plugins:n.get(Bs)}),u=Lo.create(o);r.updateState(u)}}const sR=65535,aR=Math.pow(2,16);function yP(t,e){return t+e*aR}function WA(t){return t&sR}function xP(t){return(t-(t&sR))/aR}const oR=1,lR=2,um=4,uR=8;let XA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&uR)>0}get deletedBefore(){return(this.delInfo&(oR|um))>0}get deletedAfter(){return(this.delInfo&(lR|um))>0}get deletedAcross(){return(this.delInfo&um)>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=WA(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+xP(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:yP(u/3,e-c),w=e==c?lR:e==g?oR:um;return(n<0?e!=c:e!=g)&&(w|=uR),new XA(b,w,k)}i+=d-h}return r?e+i:new XA(e+i,0,null)}touches(e,n){let r=0,i=WA(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([]);const Wx=Object.create(null);let zn=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=Wx[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 Wx)throw new RangeError("Duplicate use of step JSON ID "+e);return Wx[e]=n,n.prototype.jsonID=e,n}},Qn=class Tf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Tf(e,null)}static fail(e){return new Tf(null,e)}static fromReplace(e,n,r,i){try{return Tf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mi)return Tf.fail(s.message);throw s}}};function HS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(HS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let cR=class Mf extends zn{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 G(HS(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 fR(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 Mf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mf(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 Mf(n.from,n.to,e.markFromJSON(n.mark))}};zn.jsonID("addMark",cR);let fR=class Of extends zn{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 G(HS(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 cR(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 Of(n.pos,r.pos,this.mark)}merge(e){return e instanceof Of&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Of(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 Of(n.from,n.to,e.markFromJSON(n.mark))}};zn.jsonID("removeMark",fR);let hR=class Rf extends zn{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 G(W.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 Rf(this.pos,n.marks[i]);return new Rf(this.pos,this.mark)}}return new pR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Rf(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 Rf(n.pos,e.markFromJSON(n.mark))}};zn.jsonID("addNodeMark",hR);let pR=class Ab extends zn{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 G(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new hR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ab(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 Ab(n.pos,e.markFromJSON(n.mark))}};zn.jsonID("removeNodeMark",pR);let bP=class Oo extends zn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Nb(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 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?G.empty:new G(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?G.empty:new G(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,G.fromJSON(e,n.slice),!!n.structure)}};zn.jsonID("replace",bP);let Dg=class cm extends zn{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&&(Nb(e,this.from,this.gapFrom)||Nb(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 cm(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),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 cm(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 cm(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};zn.jsonID("replaceAround",Dg);function Nb(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 SP(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function vP(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||!SP(o,u,c))break;u&&(i=1),c<o.childCount&&(s=1)}return null}function kP(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 w=r&&r[d]||g;if(!g.canReplace(y+1,g.childCount)||!w.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 CP(t,e){let n=t.resolve(e),r=n.index();return EP(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function wP(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 EP(t,e){return!!(t&&e&&!t.isLeaf&&wP(t,e))}let AP=class fm extends zn{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 G(W.from(i),0,n.isLeaf?0:1))}getMap(){return cl.empty}invert(e){return new fm(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fm(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new fm(n.pos,n.attr,n.value)}};zn.jsonID("attr",AP);let NP=class Tb extends zn{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 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)}};zn.jsonID("docAttr",NP);let Th=class extends Error{};Th=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Th.prototype=Object.create(Error.prototype);Th.prototype.constructor=Th;Th.prototype.name="TransformError";function TP(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=W.empty,y=i.index(-1)?1:i.index(-2)?2:3;for(let T=i.depth-y;T>=i.depth-3;T--)g=W.from(i.node(T).copy(g));let b=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;g=g.append(W.from(t.createAndFill()));let k=i.before(i.depth-(y-1)),w=n.tr.replace(k,i.after(-b),new G(g,4-y,0)),N=-1;w.doc.nodesBetween(k,w.doc.content.size,(T,F)=>{if(N>-1)return!1;T.isTextblock&&T.content.size==0&&(N=F+1)}),N>-1&&w.setSelection(Pe.near(w.doc.resolve(N))),r(w.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 kP(h.doc,i.pos,2,d)?(r&&r(h.split(i.pos,2,d).scrollIntoView()),!0):!1}}function MP(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?OP(e,n,t,s):RP(e,n,s):!0:!1}}function OP(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Dg(s-1,o,s,o,new G(W.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new UM(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const u=vP(r);if(u==null)return!1;i.lift(r,u);let c=i.doc.resolve(i.mapping.map(s,-1)-1);return CP(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function RP(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,k=n.endIndex-1,w=n.startIndex;k>w;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?W.empty:W.from(i))))return!1;let g=s.pos,y=g+o.nodeSize;return r.step(new Dg(g-(u?1:0),y+(c?1:0),g+1,y-1,new G((u?W.empty:W.from(i.copy(W.empty))).append(c?W.empty:W.from(i.copy(W.empty))),u?0:1,c?0:1),u?0:1)),e(r.scrollIntoView()),!0}function DP(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=W.from(h?t.create():null),g=new G(W.from(t.create(null,W.from(u.type.create(null,d)))),h?3:1,0),y=s.start,b=s.end;n(e.tr.step(new Dg(y-(h?3:1),b,y,b,g,1,!0)).scrollIntoView())}return!0}}const dR=65535,mR=Math.pow(2,16);function IP(t,e){return t+e*mR}function QA(t){return t&dR}function _P(t){return(t-(t&dR))/mR}const gR=1,yR=2,hm=4,xR=8;let ZA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&xR)>0}get deletedBefore(){return(this.delInfo&(gR|hm))>0}get deletedAfter(){return(this.delInfo&(yR|hm))>0}get deletedAcross(){return(this.delInfo&hm)>0}},fl=class Su{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Su.empty)return Su.empty}recover(e){let n=0,r=QA(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+_P(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:IP(u/3,e-c),w=e==c?yR:e==g?gR:hm;return(n<0?e!=c:e!=g)&&(w|=xR),new ZA(b,w,k)}i+=d-h}return r?e+i:new ZA(e+i,0,null)}touches(e,n){let r=0,i=QA(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 Su(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Su.empty:new Su(e<0?[0,-e,0]:[0,0,e])}};fl.empty=new fl([]);const Xx=Object.create(null);let Bn=class{getMap(){return fl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Xx[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 Xx)throw new RangeError("Duplicate use of step JSON ID "+e);return Xx[e]=n,n.prototype.jsonID=e,n}},Zn=class Df{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Df(e,null)}static fail(e){return new Df(null,e)}static fromReplace(e,n,r,i){try{return Df.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mi)return Df.fail(s.message);throw s}}};function KS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(KS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let GS=class If extends Bn{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 G(KS(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 Zn.fromReplace(e,this.from,this.to,s)}invert(){return new bR(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 If(n.pos,r.pos,this.mark)}merge(e){return e instanceof If&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new If(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 If(n.from,n.to,e.markFromJSON(n.mark))}};Bn.jsonID("addMark",GS);let bR=class _f extends Bn{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 G(KS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Zn.fromReplace(e,this.from,this.to,r)}invert(){return new GS(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 _f(n.pos,r.pos,this.mark)}merge(e){return e instanceof _f&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _f(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 _f(n.from,n.to,e.markFromJSON(n.mark))}};Bn.jsonID("removeMark",bR);let SR=class Lf extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Zn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Zn.fromReplace(e,this.pos,this.pos+1,new G(W.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 Lf(this.pos,n.marks[i]);return new Lf(this.pos,this.mark)}}return new vR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Lf(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 Lf(n.pos,e.markFromJSON(n.mark))}};Bn.jsonID("addNodeMark",SR);let vR=class Mb extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Zn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Zn.fromReplace(e,this.pos,this.pos+1,new G(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new SR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mb(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 Mb(n.pos,e.markFromJSON(n.mark))}};Bn.jsonID("removeNodeMark",vR);let YS=class Aa extends Bn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Ob(e,this.from,this.to)?Zn.fail("Structure replace would overwrite content"):Zn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Aa(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Aa.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Aa(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Aa)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?G.empty:new G(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Aa(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?G.empty:new G(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Aa(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Aa(n.from,n.to,G.fromJSON(e,n.slice),!!n.structure)}};YS.MAP_BIAS=1;Bn.jsonID("replace",YS);let LP=class pm extends Bn{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&&(Ob(e,this.from,this.gapFrom)||Ob(e,this.gapTo,this.to)))return Zn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Zn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Zn.fromReplace(e,this.from,this.to,r):Zn.fail("Content does not fit in gap")}getMap(){return new fl([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 pm(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 pm(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 pm(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};Bn.jsonID("replaceAround",LP);function Ob(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 zP(t,e,n=null,r=t){let i=BP(t,e),s=i&&VP(r,e);return s?i.map(eN).concat({type:e,attrs:n}).concat(s.map(eN)):null}function eN(t){return{type:t,attrs:null}}function BP(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 VP(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 FP=class dm extends Bn{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 Zn.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 Zn.fromReplace(e,this.pos,this.pos+1,new G(W.from(i),0,n.isLeaf?0:1))}getMap(){return fl.empty}invert(e){return new dm(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 dm(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 dm(n.pos,n.attr,n.value)}};Bn.jsonID("attr",FP);let PP=class Rb extends Bn{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 Zn.ok(r)}getMap(){return fl.empty}invert(e){return new Rb(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 Rb(n.attr,n.value)}};Bn.jsonID("docAttr",PP);let Mh=class extends Error{};Mh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Mh.prototype=Object.create(Error.prototype);Mh.prototype.constructor=Mh;Mh.prototype.name="TransformError";function WS(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),Ju(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 jP(t,e,n,r){let i,s,o;s=e,o=n,i=r,Ju(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 $P(t){const e=new Map;if(!t||!t.type)throw new Error("mdast-util-definitions expected node");return jP(t,"definition",function(r){const i=tN(r.identifier);i&&!e.get(i)&&e.set(i,r)}),n;function n(r){const i=tN(r);return e.get(i)}}function tN(t){return String(t||"").toUpperCase()}function UP(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),Ju(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 JP(){return function(t){const e=$P(t);UP(t,function(n,r,i){if(n.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[U1,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},[U1,r]}})}}function kR(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(W.fromArray(n))}function de(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-commonmark",...e}}),t}var XS=Zh("emphasis");de(XS,{displayName:"Attr<emphasis>",group:"Emphasis"});var Gu=Ku("emphasis",t=>({attrs:{marker:{default:t.get(Yf).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",t.get(XS.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})}}}));de(Gu.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});de(Gu.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var Ig=qe("ToggleEmphasis",t=>()=>Tg(Gu.type(t)));de(Ig,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var CR=Cr(t=>Yh(/(?:^|[^*])\*([^*]+)\*$/,Gu.type(t),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:n+1}}));de(CR,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var wR=Cr(t=>Yh(/\b_(?![_\s])(.*?[^_\s])_\b/,Gu.type(t),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:n+1}}));de(wR,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var QS=Br("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:t=>{const e=t.get(kt);return()=>e.call(Ig.key)}}});de(QS.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});de(QS.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var ZS=Zh("strong");de(ZS,{displayName:"Attr<strong>",group:"Strong"});var ep=Ku("strong",t=>({attrs:{marker:{default:t.get(Yf).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(ZS.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})}}}));de(ep.mark,{displayName:"MarkSchema<strong>",group:"Strong"});de(ep.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var _g=qe("ToggleStrong",t=>()=>Tg(ep.type(t)));de(_g,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var ER=Cr(t=>Yh(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),ep.type(t),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));de(ER,{displayName:"InputRule<strong>",group:"Strong"});var ev=Br("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:t=>{const e=t.get(kt);return()=>e.call(_g.key)}}});de(ev.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});de(ev.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var tv=Zh("inlineCode");de(tv,{displayName:"Attr<inlineCode>",group:"InlineCode"});var La=Ku("inlineCode",t=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",t.get(tv.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)}}));de(La.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});de(La.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var nv=qe("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)});de(nv,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var AR=Cr(t=>Yh(/(?:`)([^`]+)(?:`)$/,La.type(t)));de(AR,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var rv=Br("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:t=>{const e=t.get(kt);return()=>e.call(nv.key)}}});de(rv.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});de(rv.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var iv=Zh("link");de(iv,{displayName:"Attr<link>",group:"Link"});var Ou=Ku("link",t=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Gi(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...t.get(iv.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})}}}));de(Ou.mark,{displayName:"MarkSchema<link>",group:"Link"});var sv=qe("ToggleLink",t=>(e={})=>Tg(Ou.type(t),e));de(sv,{displayName:"Command<toggleLinkCommand>",group:"Link"});var av=qe("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,w)=>{if(Ou.type(t).isInSet(k.marks))return i=k,s=w,!1}),!i)return!1;const h=i.marks.find(({type:k})=>k===Ou.type(t));if(!h)return!1;const d=s,g=s+i.nodeSize,{tr:y}=n,b=Ou.type(t).create({...h.attrs,...e});return b?(r(y.removeMark(d,g,h).addMark(d,g,b).setSelection(new Oe(y.selection.$anchor)).scrollIntoView()),!0):!1});de(av,{displayName:"Command<updateLinkCommand>",group:"Link"});var NR=Hu("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)}}}));de(NR,{displayName:"NodeSchema<doc>",group:"Doc"});function qP(t){return Ju(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 Lg=hi("remark-preserve-empty-line",()=>()=>qP);de(Lg.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});de(Lg.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var ov=Oi("paragraph");de(ov,{displayName:"Attr<paragraph>",group:"Paragraph"});var Ji=an("paragraph",t=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",t.get(ov.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(rn).state?.doc.lastChild;e.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==r&&HP(t)?e.addNode("html",void 0,"<br />"):kR(e,n),e.closeNode()}}}));function HP(t){let e=!1;try{t.get(Lg.id),e=!0}catch{e=!1}return e}de(Ji.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});de(Ji.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var lv=qe("TurnIntoText",t=>()=>yh(Ji.type(t)));de(lv,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var uv=Br("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:t=>{const e=t.get(kt);return()=>e.call(lv.key)}}});de(uv.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});de(uv.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var KP=Array(6).fill(0).map((t,e)=>e+1);function GP(t){return t.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var zg=Za(GP,"headingIdGenerator");de(zg,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var cv=Oi("heading");de(cv,{displayName:"Attr<heading>",group:"Heading"});var gl=an("heading",t=>{const e=t.get(zg.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:KP.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw Gi(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...t.get(cv.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}),kR(n,r),n.closeNode()}}}});de(gl.node,{displayName:"NodeSchema<heading>",group:"Heading"});de(gl.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var TR=Cr(t=>UO(/^(?<hashes>#+)\s$/,gl.type(t),e=>{const n=e.groups?.hashes?.length||0,{$from:r}=t.get(rn).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}}));de(TR,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var Ma=qe("WrapInHeading",t=>e=>(e??=1,e<1?yh(Ji.type(t)):yh(gl.type(t),{level:e})));de(Ma,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var fv=qe("DowngradeHeading",t=>()=>(e,n,r)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==gl.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):yh(Ji.type(t))(e,n,r)});de(fv,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var hv=Br("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:t=>{const e=t.get(kt);return()=>e.call(Ma.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:t=>{const e=t.get(kt);return()=>e.call(Ma.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:t=>{const e=t.get(kt);return()=>e.call(Ma.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:t=>{const e=t.get(kt);return()=>e.call(Ma.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:t=>{const e=t.get(kt);return()=>e.call(Ma.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:t=>{const e=t.get(kt);return()=>e.call(Ma.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:t=>{const e=t.get(kt);return()=>e.call(fv.key)}}});de(hv.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});de(hv.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var pv=Oi("blockquote");de(pv,{displayName:"Attr<blockquote>",group:"Blockquote"});var tp=an("blockquote",t=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",t.get(pv.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()}}}));de(tp.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});de(tp.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var MR=Cr(t=>LS(/^\s*>\s$/,tp.type(t)));de(MR,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var Bg=qe("WrapInBlockquote",t=>()=>IS(tp.type(t)));de(Bg,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var dv=Br("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:t=>{const e=t.get(kt);return()=>e.call(Bg.key)}}});de(dv.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});de(dv.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var mv=Oi("codeBlock",()=>({pre:{},code:{}}));de(mv,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var np=an("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 Gi(e);return{language:e.dataset.language}}}],toDOM:e=>{const n=t.get(mv.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})}}}));de(np.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});de(np.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var OR=Cr(t=>UO(/^```(?<language>[a-z]*)?[\s\n]$/,np.type(t),e=>({language:e.groups?.language??""})));de(OR,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var gv=qe("CreateCodeBlock",t=>(e="")=>yh(np.type(t),{language:e}));de(gv,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var YP=qe("UpdateCodeBlockLanguage",()=>({pos:t,language:e}={pos:-1,language:""})=>(n,r)=>t>=0?(r?.(n.tr.setNodeAttribute(t,"language",e)),!0):!1);de(YP,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var yv=Br("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:t=>{const e=t.get(kt);return()=>e.call(gv.key)}}});de(yv.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});de(yv.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var xv=Oi("image");de(xv,{displayName:"Attr<image>",group:"Image"});var Yu=an("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 Gi(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...t.get(xv.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})}}}));de(Yu.node,{displayName:"NodeSchema<image>",group:"Image"});de(Yu.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var RR=qe("InsertImage",t=>(e={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:s="",title:o=""}=e,u=Yu.type(t).create({src:i,alt:s,title:o});return u&&r(n.tr.replaceSelectionWith(u).scrollIntoView()),!0});de(RR,{displayName:"Command<insertImageCommand>",group:"Image"});var DR=qe("UpdateImage",t=>(e={})=>(n,r)=>{const i=eV(n.selection,Yu.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});de(DR,{displayName:"Command<updateImageCommand>",group:"Image"});var WP=Cr(t=>new zr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,n,r,i)=>{const[s,o,u="",c]=n;return s?e.tr.replaceWith(r,i,Yu.type(t).create({src:u,alt:o,title:c})):null}));de(WP,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var jm=Oi("hardbreak",t=>({"data-type":"hardbreak","data-is-inline":t.attrs.isInline}));de(jm,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var Go=an("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(jm.key)(e)," "]:["br",t.get(jm.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")}}}));de(Go.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});de(Go.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var bv=qe("InsertHardbreak",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(!(r instanceof Oe))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(Pe.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(Go.type(t).create()).scrollIntoView()),!0});de(bv,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var Sv=Br("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:t=>{const e=t.get(kt);return()=>e.call(bv.key)}}});de(Sv.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});de(Sv.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var vv=Oi("hr");de(vv,{displayName:"Attr<hr>",group:"Hr"});var rp=an("hr",t=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",t.get(vv.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")}}}));de(rp.node,{displayName:"NodeSchema<hr>",group:"Hr"});de(rp.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var IR=Cr(t=>new zr(/^(?:---|___\s|\*\*\*\s)$/,(e,n,r,i)=>{const{tr:s}=e;return n[0]&&s.replaceWith(r-1,i,rp.type(t).create()),s}));de(IR,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var _R=qe("InsertHr",t=>()=>(e,n)=>{if(!n)return!0;const r=Ji.node.type(t).create(),{tr:i,selection:s}=e,{from:o}=s,u=rp.type(t).create();if(!u)return!0;const c=i.replaceSelectionWith(u).insert(o,r),h=Pe.findFrom(c.doc.resolve(o),1,!0);return h&&n(c.setSelection(h).scrollIntoView()),!0});de(_R,{displayName:"Command<insertHrCommand>",group:"Hr"});var Vg=Oi("bulletList");de(Vg,{displayName:"Attr<bulletList>",group:"BulletList"});var yl=an("bullet_list",t=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Gi(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...t.get(Vg.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()}}}));de(yl.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});de(yl.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var LR=Cr(t=>LS(/^\s*([-+*])\s$/,yl.type(t)));de(LR,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var Fg=qe("WrapInBulletList",t=>()=>IS(yl.type(t)));de(Fg,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var kv=Br("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:t=>{const e=t.get(kt);return()=>e.call(Fg.key)}}});de(kv.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});de(kv.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var Pg=Oi("orderedList");de(Pg,{displayName:"Attr<orderedList>",group:"OrderedList"});var xl=an("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 Gi(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...t.get(Pg.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()}}}));de(xl.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});de(xl.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var zR=Cr(t=>LS(/^\s*(\d+)\.\s$/,xl.type(t),e=>({order:Number(e[1])}),(e,n)=>n.childCount+n.attrs.order===Number(e[1])));de(zR,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var jg=qe("WrapInOrderedList",t=>()=>IS(xl.type(t)));de(jg,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var Cv=Br("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:t=>{const e=t.get(kt);return()=>e.call(jg.key)}}});de(Cv.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});de(Cv.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var wv=Oi("listItem");de(wv,{displayName:"Attr<listItem>",group:"ListItem"});var $s=an("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 Gi(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...t.get(wv.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()}}}));de($s.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});de($s.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var Ev=qe("SinkListItem",t=>()=>DP($s.type(t)));de(Ev,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var $g=qe("LiftListItem",t=>()=>MP($s.type(t)));de($g,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var Av=qe("SplitListItem",t=>()=>TP($s.type(t)));de(Av,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function XP(t){return(e,n,r)=>{const{selection:i}=e;if(!(i instanceof Oe))return!1;const{empty:s,$from:o}=i;return!s||o.parentOffset!==0||o.node(-1).type!==$s.type(t)?!1:TO(e,n,r)}}var Nv=qe("LiftFirstListItem",t=>()=>XP(t));de(Nv,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var Tv=Br("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:t=>{const e=t.get(kt);return()=>e.call(Av.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:t=>{const e=t.get(kt);return()=>e.call(Ev.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:t=>{const e=t.get(kt);return()=>e.call($g.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:t=>{const e=t.get(kt);return()=>e.call(Nv.key)}}});de(Tv.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});de(Tv.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var BR=Hu("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)}}}));de(BR,{displayName:"NodeSchema<text>",group:"Text"});var Mv=Oi("html");de(Mv,{displayName:"Attr<html>",group:"Html"});var Ov=an("html",t=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const n=document.createElement("span"),r={...t.get(Mv.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)}}}));de(Ov.node,{displayName:"NodeSchema<html>",group:"Html"});de(Ov.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var QP=[NR,ov,Ji,zg,cv,gl,jm,Go,pv,tp,mv,np,vv,rp,xv,Yu,Vg,yl,Pg,xl,wv,$s,XS,Gu,ZS,ep,tv,La,iv,Ou,Mv,Ov,BR].flat(),ZP=[MR,LR,zR,OR,IR,TR].flat(),ej=[CR,wR,AR,ER],tj=qe("IsMarkSelected",()=>t=>e=>{if(!t)return!1;const{doc:n,selection:r}=e;return n.rangeHasMark(r.from,r.to,t)}),nj=qe("IsNoteSelected",()=>t=>e=>t?tV(e,t).hasNode:!1),rj=qe("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)}),ij=qe("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}),sj=qe("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&&zP(c,r,i);if(!h)return!1;s=s.wrap(c,h)}catch{return!1}return n?.(s),!0}),aj=qe("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}),oj=qe("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(Oe.near(o))}catch{return!1}return n?.(s.scrollIntoView()),!0}),lj=[lv,Bg,Ma,fv,gv,bv,_R,RR,DR,jg,Fg,Ev,Av,$g,Nv,Ig,nv,_g,sv,av,tj,nj,rj,ij,sj,aj,oj],uj=[dv,yv,Sv,hv,Tv,Cv,kv,uv,QS,rv,ev].flat(),Rv=hi("remarkAddOrderInList",()=>()=>t=>{WS(t,"list",e=>{if(e.ordered){const n=e.start??1;e.children.forEach((r,i)=>{r.label=i+n})}})});de(Rv.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});de(Rv.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var Dv=hi("remarkLineBreak",()=>()=>t=>{const e=/[\t ]*(?:\r?\n|\r)/g;WS(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})});de(Dv.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});de(Dv.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var Iv=hi("remarkInlineLink",()=>JP);de(Iv.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});de(Iv.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var cj=t=>!!t.children,fj=t=>t.type==="html";function hj(t,e){return n(t,0,null)[0];function n(r,i,s){if(cj(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 pj=["root","blockquote","listItem"],_v=hi("remarkHTMLTransformer",()=>()=>t=>{hj(t,(e,n,r)=>fj(e)?(r&&pj.includes(r.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});de(_v.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});de(_v.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var Lv=hi("remarkMarker",()=>()=>(t,e)=>{const n=r=>e.value.charAt(r.position.start.offset);WS(t,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});de(Lv.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});de(Lv.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var VR=js(()=>{let t=!1;const e=new vr({key:new kr("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=Ha.widget(r,i,{side:-1}),o=document.createElement("span"),u=Ha.widget(r,o);return setTimeout(()=>{i.contentEditable="true",o.contentEditable="true"}),oi.create(n.doc,[s,u])}return oi.empty}}});return e});de(VR,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var FR=js(t=>new vr({key:new kr("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 YS))return;const{from:o}=s;return r.tr.setNodeMarkup(o,Go.type(t),void 0,[])}if(s instanceof GS){let o=r.tr;const{from:u,to:c}=s;return r.doc.nodesBetween(u,c,(h,d)=>{h.type===Go.type(t)&&(o=o.setNodeMarkup(d,Go.type(t),void 0,[]))}),o}}}));de(FR,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var zv=Za(["table","code_block"],"hardbreakFilterNodes");de(zv,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var PR=js(t=>{const e=t.get(zv.key);return new vr({key:new kr("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}})});de(PR,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var jR=js(t=>{const e=new kr("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const i=t.get(zg.key),s=r.state.tr.setMeta("addToHistory",!1);let o=!1;const u={};r.state.doc.descendants((c,h)=>{if(c.type===gl.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 vr({key:e,view:r=>(n(r),{update:(i,s)=>{i.state.doc.eq(s.doc)||n(i)}})})});de(jR,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var $R=js(t=>{const e=(n,r,i)=>{if(!i.selection||n.some(g=>g.getMeta("addToHistory")===!1||!g.isGeneric))return null;const s=xl.type(t),o=yl.type(t),u=$s.type(t),c=(g,y,b=1)=>{let k=!1;const w=`${y+b}.`;return g.label!==w&&(g.label=w,k=!0),k};let h=i.tr,d=!1;return i.doc.descendants((g,y,b,k)=>{if(g.type===o){const w=g.maybeChild(0);w?.type===u&&w.attrs.listType==="ordered"&&(d=!0,h.setNodeMarkup(y,s,{spread:"true"}),g.descendants((N,T,F,V)=>{if(N.type===u){const H={...N.attrs};c(H,V)&&(h=h.setNodeMarkup(T,void 0,H))}return!1}))}else if(g.type===u&&b?.type===s){const w={...g.attrs};let N=!1;w.listType!=="ordered"&&(w.listType="ordered",N=!0),b?.maybeChild(0)&&(N=c(w,k,b?.attrs.order??1)),N&&(h=h.setNodeMarkup(y,void 0,w),d=!0)}}),d?h.setMeta("addToHistory",!1):null};return new vr({key:new kr("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});de($R,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var dj=[FR,zv,PR,VR,Rv,Iv,Dv,_v,Lv,Lg,jR,$R].flat(),UR=[QP,ZP,ej,lj,uj,dj].flat();const JR=65535,qR=Math.pow(2,16);function mj(t,e){return t+e*qR}function nN(t){return t&JR}function gj(t){return(t-(t&JR))/qR}const HR=1,KR=2,mm=4,GR=8;let Db=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&GR)>0}get deletedBefore(){return(this.delInfo&(HR|mm))>0}get deletedAfter(){return(this.delInfo&(KR|mm))>0}get deletedAcross(){return(this.delInfo&mm)>0}},hl=class vu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&vu.empty)return vu.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+gj(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:mj(u/3,e-c),w=e==c?KR:e==g?HR:mm;return(n<0?e!=c:e!=g)&&(w|=GR),new Db(b,w,k)}i+=d-h}return r?e+i:new Db(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 vu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?vu.empty:new vu(e<0?[0,-e,0]:[0,0,e])}};hl.empty=new hl([]);class $m{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 $m(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 $m;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 Db(e,i,null)}}const Qx=Object.create(null);let Vn=class{getMap(){return hl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Qx[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 Qx)throw new RangeError("Duplicate use of step JSON ID "+e);return Qx[e]=n,n.prototype.jsonID=e,n}},er=class zf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new zf(e,null)}static fail(e){return new zf(null,e)}static fromReplace(e,n,r,i){try{return zf.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mi)return zf.fail(s.message);throw s}}};function Bv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Bv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let Vv=class Bf extends Vn{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 G(Bv(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 er.fromReplace(e,this.from,this.to,s)}invert(){return new ip(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 Bf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Bf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bf(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 Bf(n.from,n.to,e.markFromJSON(n.mark))}};Vn.jsonID("addMark",Vv);let ip=class Vf extends Vn{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 G(Bv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return er.fromReplace(e,this.from,this.to,r)}invert(){return new Vv(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:"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 Vf(n.from,n.to,e.markFromJSON(n.mark))}};Vn.jsonID("removeMark",ip);let Fv=class Ff extends Vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return er.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return er.fromReplace(e,this.pos,this.pos+1,new G(W.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 Ff(this.pos,n.marks[i]);return new Ff(this.pos,this.mark)}}return new Um(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ff(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 Ff(n.pos,e.markFromJSON(n.mark))}};Vn.jsonID("addNodeMark",Fv);let Um=class Ib extends Vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return er.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return er.fromReplace(e,this.pos,this.pos+1,new G(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Fv(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ib(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 Ib(n.pos,e.markFromJSON(n.mark))}};Vn.jsonID("removeNodeMark",Um);let Ka=class Ro extends Vn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&_b(e,this.from,this.to)?er.fail("Structure replace would overwrite content"):er.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new hl([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?G.empty:new G(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?G.empty:new G(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,G.fromJSON(e,n.slice),!!n.structure)}};Vn.jsonID("replace",Ka);let Wu=class gm extends Vn{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&&(_b(e,this.from,this.gapFrom)||_b(e,this.gapTo,this.to)))return er.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return er.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?er.fromReplace(e,this.from,this.to,r):er.fail("Content does not fit in gap")}getMap(){return new hl([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 gm(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 gm(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 gm(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};Vn.jsonID("replaceAround",Wu);function _b(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 yj(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 w=0;w<g.length;w++)g[w].isInSet(k)||(o&&o.to==y&&o.mark.eq(g[w])?o.to=b:i.push(o=new ip(y,b,g[w])));u&&u.to==y?u.to=b:s.push(u=new Vv(y,b,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function xj(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 Kh){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 ip(o.from,o.to,o.style)))}function Pv(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 Ka(u,d,G.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new ip(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 G(W.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new Ka(u+y.index,u+y.index+y[0].length,k))}}u=d}if(!r.validEnd){let c=r.fillBefore(W.empty,!0);t.replace(u,u,new G(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function bj(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=W.empty,g=0;for(let k=s,w=!1;k>n;k--)w||r.index(k)>0?(w=!0,d=W.from(r.node(k).copy(d)),g++):c--;let y=W.empty,b=0;for(let k=s,w=!1;k>n;k--)w||i.after(k+1)<i.end(k)?(w=!0,y=W.from(i.node(k).copy(y)),b++):h++;t.step(new Wu(c,h,o,u,new G(d.append(y),g,b),d.size-g,!0))}function Sj(t,e,n){let r=W.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=W.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Wu(i,s,i,s,new G(r,0,0),n.length,!0))}function vj(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)&&kj(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&&WR(t,o,u,s),Pv(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 Wu(g,y,g+1,y-1,new G(W.from(r.create(c,null,o.marks)),0,0),1,!0)),h===!0&&YR(t,o,u,s),!1}})}function YR(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 WR(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 kj(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Cj(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 Wu(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new G(W.from(o),0,0),1,!0))}function wj(t,e,n=1,r){let i=t.doc.resolve(e),s=W.empty,o=W.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=W.from(i.node(u).copy(s));let d=r&&r[h];o=W.from(d?d.type.create(d.attrs,o):i.node(u).copy(o))}t.step(new Ka(e,e,new G(s.append(o),n,n),!0))}function Ej(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);WR(t,d.node(),d.before(),u)}o.inlineContent&&Pv(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 Ka(h,c.map(e+n,-1),G.empty,!0)),r===!0){let d=t.doc.resolve(h);YR(t,d.node(),d.before(),t.steps.length)}return t}function Aj(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 Nj(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 Tj(t,e,n=e,r=G.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return XR(i,s,r)?new Ka(e,n,r):new Mj(i,s,r).fit()}function XR(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Mj{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=W.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=W.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 G(s,o,u);return e>-1?new Wu(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Ka(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=Zx(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(W.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=Zx(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(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=Zx(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new G(Pf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new G(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 w=0;w<s.length;w++)this.openFrontierNode(s[w]);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 w=0;w<i.childCount;w++)d.push(i.child(w));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let w=u.child(h),N=g.matchType(w.type);if(!N)break;h++,(h>1||c==0||w.content.size)&&(g=N,d.push(QR(w.mark(y.allowedMarks(w.marks)),h==1?c:0,h==u.childCount?b:-1)))}let k=h==u.childCount;k||(b=-1),this.placed=jf(this.placed,n,W.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 w=0,N=u;w<b;w++){let T=N.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),N=T.content}this.unplaced=k?e==0?G.empty:new G(Pf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new G(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||!e1(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=e1(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=e1(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=jf(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=jf(this.placed,this.depth,W.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(W.empty,!0);n.childCount&&(this.placed=jf(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 jf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(jf(t.lastChild.content,e-1,n)))}function Zx(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function QR(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,QR(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(W.empty,!0)))),t.copy(r)}function e1(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&&!Oj(n,s.content,o)?u:null}function Oj(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Rj(t){return t.spec.defining||t.spec.definingForContent}function Dj(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(XR(i,s,r))return t.step(new Ka(e,n,r));let o=eD(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=Rj(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 w=0;w<o.length;w++){let N=o[(w+c)%o.length],T=!0;N<0&&(T=!1,N=-N);let F=i.node(N-1),V=i.index(N-1);if(F.canReplaceWith(V,V,k.type,k.marks))return t.replace(i.before(N),T?s.after(N):n,new G(ZR(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 ZR(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(ZR(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(W.empty,!0))}return t}function Ij(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Aj(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new G(W.from(r),0,0))}function _j(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=eD(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 eD(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 tD=class ym extends Vn{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 er.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 er.fromReplace(e,this.pos,this.pos+1,new G(W.from(i),0,n.isLeaf?0:1))}getMap(){return hl.empty}invert(e){return new ym(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 ym(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 ym(n.pos,n.attr,n.value)}};Vn.jsonID("attr",tD);let nD=class Lb extends Vn{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 er.ok(r)}getMap(){return hl.empty}invert(e){return new Lb(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 Lb(n.attr,n.value)}};Vn.jsonID("docAttr",nD);let Pu=class extends Error{};Pu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Pu.prototype=Object.create(Error.prototype);Pu.prototype.constructor=Pu;Pu.prototype.name="TransformError";class Lj{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new $m}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Pu(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=G.empty){let i=Tj(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new G(W.from(r),0,0))}delete(e,n){return this.replace(e,n,G.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Dj(this,e,n,r),this}replaceRangeWith(e,n,r){return Ij(this,e,n,r),this}deleteRange(e,n){return _j(this,e,n),this}lift(e,n){return bj(this,e,n),this}join(e,n=1){return Ej(this,e,n),this}wrap(e,n){return Sj(this,e,n),this}setBlockType(e,n=e,r,i=null){return vj(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Cj(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new tD(e,n,r)),this}setDocAttribute(e,n){return this.step(new nD(e,n)),this}addNodeMark(e,n){return this.step(new Fv(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 ht)n.isInSet(r.marks)&&this.step(new Um(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Um(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 wj(this,e,n,r),this}addMark(e,n,r){return yj(this,e,n,r),this}removeMark(e,n,r){return xj(this,e,n,r),this}clearIncompatible(e,n,r){return Pv(this,e,n,r),this}}const bl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},rD=function(t,e,n,r){return n&&(rN(t,e,n,r,-1)||rN(t,e,n,r,1))},zj=/^(img|br|input|textarea|hr)$/i;function rN(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Jm(t))){let o=t.parentNode;if(!o||o.nodeType!=1||jv(t)||zj.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?Jm(t):0}else return!1}}function Jm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Bj(t,e,n){for(let r=e==0,i=e==Jm(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==Jm(t)}}function jv(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 iD=function(t){return t.focusNode&&rD(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function sD(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,iN=typeof document<"u"?document:null,eo=qi&&qi.userAgent||"",zb=/Edge\/(\d+)/.exec(eo),aD=/MSIE \d/.exec(eo),Bb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(eo),sp=!!(aD||Bb||zb),oD=aD?document.documentMode:Bb?+Bb[1]:zb?+zb[1]:0,Ug=!sp&&/gecko\/(\d+)/i.test(eo);Ug&&+(/Firefox\/(\d+)/.exec(eo)||[0,0])[1];const Vb=!sp&&/Chrome\/(\d+)/.exec(eo),Us=!!Vb,lD=Vb?+Vb[1]:0,Sl=!sp&&!!qi&&/Apple Computer/.test(qi.vendor),$v=Sl&&(/Mobile\/\w+/.test(eo)||!!qi&&qi.maxTouchPoints>2),ei=$v||(qi?/Mac/.test(qi.platform):!1),uD=qi?/Win/.test(qi.platform):!1,ap=/Android \d/.test(eo),Uv=!!iN&&"webkitFontSmoothing"in iN.documentElement.style,Vj=Uv?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Fj(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(iD(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&be.isSelectable(g)&&i.parent&&!(g.isInline&&Bj(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new be(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=fD(t,d,u,g)}return h}function cD(t){return t.editable?t.hasFocus():Uj(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Jv(t,e=!1){let n=t.state.selection;if($j(t,n),!!cD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Us){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&rD(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)jj(t);else{let{anchor:r,head:i}=n,s,o;sN&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=aN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=aN(t,n.to))),t.docView.setSelection(r,i,t,e),sN&&(s&&oN(s),o&&oN(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Pj(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const sN=Sl||Us&&lD<63;function aN(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 t1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return t1(i);if(s)return t1(s)}}function t1(t){return t.contentEditable="true",Sl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function oN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Pj(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(()=>{(!cD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function jj(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&&sp&&oD<=11&&(n.disabled=!0,n.disabled=!1)}function $j(t,e){if(e instanceof be){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(lN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else lN(t)}function lN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function fD(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function Uj(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 Fb(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&&Pe.findFrom(s,e)}function Oa(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function uN(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 Oa(t,new Oe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Fb(t.state,e);return i&&i instanceof be?Oa(t,i):!1}else if(!(ei&&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?be.isSelectable(s)?Oa(t,new be(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Uv?Oa(t,new Oe(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof be&&r.node.isInline)return Oa(t,new Oe(e>0?r.$to:r.$from));{let i=Fb(t.state,e);return i?Oa(t,i):!1}}}function qm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ih(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function cu(t,e){return e<0?Jj(t):qj(t)}function Jj(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Ug&&n.nodeType==1&&r<qm(n)&&ih(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(ih(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(hD(n))break;{let u=n.previousSibling;for(;u&&ih(u,-1);)i=n.parentNode,s=bl(u),u=u.previousSibling;if(u)n=u,r=qm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Pb(t,n,r):i&&Pb(t,i,s)}function qj(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=qm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(ih(u,1))s=n,o=++r;else break}else{if(hD(n))break;{let u=n.nextSibling;for(;u&&ih(u,1);)s=u.parentNode,o=bl(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=qm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Pb(t,s,o)}function hD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Hj(t,e){for(;t&&e==t.childNodes.length&&!jv(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 Kj(t,e){for(;t&&!e&&!jv(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 Pb(t,e,n){if(e.nodeType!=3){let s,o;(o=Hj(e,n))?(e=o,n=0):(s=Kj(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(iD(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&&Jv(t)},50)}function cN(t,e){let n=t.state.doc.resolve(e);if(!(Us||uD)&&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 fN(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||ei&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Fb(t.state,e);if(o&&o instanceof be)return Oa(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof tr?Pe.near(o,e):Pe.findFrom(o,e);return u?Oa(t,u):!1}return!1}function hN(t,e){if(!(t.state.selection instanceof Oe))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 pN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Gj(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;pN(t,r,"true"),setTimeout(()=>pN(t,r,"false"),20)}return!1}function Yj(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Wj(t,e){let n=e.keyCode,r=Yj(e);if(n==8||ei&&n==72&&r=="c")return hN(t,-1)||cu(t,-1);if(n==46&&!e.shiftKey||ei&&n==68&&r=="c")return hN(t,1)||cu(t,1);if(n==13||n==27)return!0;if(n==37||ei&&n==66&&r=="c"){let i=n==37?cN(t,t.state.selection.from)=="ltr"?-1:1:-1;return uN(t,i,r)||cu(t,i)}else if(n==39||ei&&n==70&&r=="c"){let i=n==39?cN(t,t.state.selection.from)=="ltr"?1:-1:1;return uN(t,i,r)||cu(t,i)}else{if(n==38||ei&&n==80&&r=="c")return fN(t,-1,r)||cu(t,-1);if(n==40||ei&&n==78&&r=="c")return Gj(t)||fN(t,1,r)||cu(t,1);if(r==(ei?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function pD(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")||Wi.fromSchema(t.state.schema),u=bD(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=xD[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 dD(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 G(W.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=Wi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(k.serializeNode(b.text(w,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=e$(n),Uv&&t$(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")||Ua.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!Xj.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=n$(dN(u,+d[1],+d[2]),d[4]);else if(u=G.maxOpen(Qj(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=dN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const Xj=/^(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 Qj(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&&gD(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=yD(o[o.length-1],s.length));let d=mD(u,c);o.push(d),i=i.matchType(d.type),s=c}}),o)return W.from(o)}return t}function mD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,W.from(t));return t}function gD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=gD(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(W.from(mD(n,t,i+1))))}}function yD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,yD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(W.empty,!0);return t.copy(n.append(r))}function jb(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=jb(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(W.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function dN(t,e,n){return e<t.openStart&&(t=new G(jb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new G(jb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const xD={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 mN=null;function bD(){return mN||(mN=document.implementation.createHTMLDocument("title"))}let n1=null;function Zj(t){let e=window.trustedTypes;return e?(n1||(n1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),n1.createHTML(t)):t}function e$(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=bD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&xD[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Zj(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function t$(t){let e=t.querySelectorAll(Us?"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 n$(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=W.from(c.create(r[u+1],i)),s++,o++}return new G(i,s,o)}const Ri={},_r={};function za(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}_r.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!vD(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ap&&Us&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),$v&&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,sD(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Wj(t,n)?n.preventDefault():za(t,"key")};_r.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};_r.keypress=(t,e)=>{let n=e;if(vD(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ei&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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 Jg(t){return{left:t.clientX,top:t.clientY}}function r$(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function qv(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 i$(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&be.isSelectable(r)?(Ru(t,new be(n)),!0):!1}function s$(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof be&&(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(be.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,be.create(t.state.doc,i)),!0):!1}function a$(t,e,n,r,i){return qv(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?s$(t,n):i$(t,n))}function o$(t,e,n,r){return qv(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function l$(t,e,n,r){return qv(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||u$(t,n,r)}function u$(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ru(t,Oe.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,Oe.create(r,u+1,u+1+o.content.size));else if(be.isSelectable(o))Ru(t,be.create(r,u));else continue;return!0}}function Hv(t){return Hm(t)}const SD=ei?"metaKey":"ctrlKey";Ri.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Hv(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&r$(n,t.input.lastClick)&&!n[SD]&&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(Jg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new c$(t,o,n,!!r)):(s=="doubleClick"?o$:l$)(t,o.pos,o.inside,n)?n.preventDefault():za(t,"pointer"))};let c$=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[SD],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 be&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ug&&!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(()=>Jv(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(Jg(e))),this.updateAllowDefault(e),this.allowDefault||!n?za(this.view,"pointer"):a$(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Sl&&this.mightDrag&&!this.mightDrag.node.isAtom||Us&&!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,Pe.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)}};Ri.touchstart=t=>{t.input.lastTouch=Date.now(),Hv(t),za(t,"pointer")};Ri.touchmove=t=>{t.input.lastTouch=Date.now(),za(t,"pointer")};Ri.contextmenu=t=>Hv(t);function vD(t,e){return t.composing?!0:Sl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const f$=ap?5e3:-1;_r.compositionstart=_r.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Us&&uD&&h$(t)))t.markCursor=t.state.storedMarks||n.marks(),Hm(t,!0),t.markCursor=null;else if(Hm(t,!e.selection.empty),Ug&&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,f$)};function h$(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"}_r.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(()=>Hm(t),e))}function p$(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=d$());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function d$(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Hm(t,e=!1){if(!(ap&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),p$(t),e||t.docView&&t.docView.dirty){let n=Fj(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 m$(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 Oh=sp&&oD<15||$v&&Vj<604;Ri.copy=_r.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Oh?null:n.clipboardData,o=r.content(),{dom:u,text:c}=pD(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):m$(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function g$(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function y$(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?$b(t,r.value,null,i,e):$b(t,r.textContent,r.innerHTML,i,e)},50)}function $b(t,e,n,r,i){let s=dD(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||G.empty)))return!0;if(!s)return!1;let o=g$(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 CD(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," "):""}_r.paste=(t,e)=>{let n=e;if(t.composing&&!ap)return;let r=Oh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&$b(t,CD(r),r.getData("text/html"),i,n)?n.preventDefault():y$(t,n)};let x$=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const b$=ei?"altKey":"ctrlKey";function wD(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[b$]}Ri.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(Jg(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof be?i.to-1:i.to))){if(r&&r.mightDrag)o=be.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=be.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:d}=pD(t,u);(!n.dataTransfer.files.length||!Us||lD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Oh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Oh||n.dataTransfer.setData("text/plain",h),t.dragging=new x$(d,wD(t,n),o)};Ri.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};_r.dragover=_r.dragenter=(t,e)=>e.preventDefault();_r.drop=(t,e)=>{try{S$(t,e,t.dragging)}finally{t.dragging=null}};function S$(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Jg(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=dD(t,CD(e.dataTransfer),Oh?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&wD(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||G.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?Nj(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&&be.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new be(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((k,w,N,T)=>b=T),c.setSelection(fD(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Ri.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())&&Jv(t)},20))};Ri.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)};Ri.beforeinput=(t,e)=>{if(Us&&ap&&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,sD(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 _r)Ri[t]=_r[t];function Rh(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 gN=class ED{constructor(e,n){this.toDOM=e,this.spec=n||Yo,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 pl(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ED&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Rh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},sh=class Ub{constructor(e,n){this.attrs=e,this.spec=n||Yo}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 pl(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ub&&Rh(this.attrs,e.attrs)&&Rh(this.spec,e.spec)}static is(e){return e.type instanceof Ub}destroy(){}},v$=class AD{constructor(e,n){this.attrs=e,this.spec=n||Yo}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 pl(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 AD&&Rh(this.attrs,e.attrs)&&Rh(this.spec,e.spec)}destroy(){}},pl=class $f{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new $f(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 $f(e,e,new gN(n,r))}static inline(e,n,r,i){return new $f(e,n,new sh(r,i))}static node(e,n,r,i){return new $f(e,n,new v$(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof sh}get widget(){return this.type instanceof gN}};const ku=[],Yo={};let li=class Na{constructor(e,n){this.local=e.length?e:ku,this.children=n.length?n:ku}static create(e,n){return n.length?Km(n,e,0,Yo):qn}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==qn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Yo)}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?C$(this.children,o||[],e,n,r,i,s):o?new Na(o.sort(Wo),ku):qn}add(e,n){return n.length?this==qn?Na.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=TD(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,Km(d,u,h+1,Yo)),s+=3}});let o=ND(s?MD(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new Na(o.length?this.local.concat(o).sort(Wo):this.local,i||this.children)}remove(e){return e.length==0||this==qn?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!=qn?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 Na(i,r):qn}forChild(e,n){if(this==qn)return this;if(n.isLeaf)return Na.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 sh){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 Na(i.sort(Wo),ku);return r?new k$([u,r]):u}return r||qn}eq(e){if(this==e)return!0;if(!(e instanceof Na)||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 Kv(this.localsInner(e))}localsInner(e){if(this==qn)return ku;if(e.inlineContent||!this.local.some(sh.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof sh||n.push(this.local[r]);return n}forEachSet(e){e(this)}};li.empty=new li([],[]);li.removeOverlap=Kv;const qn=li.empty;let k$=class Cu{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Yo));return Cu.from(r)}forChild(e,n){if(n.isLeaf)return li.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=qn&&(s instanceof Cu?r=r.concat(s.members):r.push(s))}return Cu.from(r)}eq(e){if(!(e instanceof Cu)||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?Kv(r?n:n.sort(Wo)):ku}static from(e){switch(e.length){case 0:return qn;case 1:return e[0];default:return new Cu(e.every(n=>n instanceof li)?e:e.reduce((n,r)=>n.concat(r instanceof li?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function C$(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,w)=>{let N=w-k-(b-y);for(let T=0;T<u.length;T+=3){let F=u[T+1];if(F<0||y>F+d-g)continue;let V=u[T]+d-g;b>=V?u[T+1]=y<=V?-2:-1:y>=d&&N&&(u[T]+=N,u[T+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:w}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&w==g&&w+N.nodeSize==b){let T=u[h+2].mapInner(n,N,d+1,t[h]+s+1,o);T!=qn?(u[h]=g,u[h+1]=b,u[h+2]=T):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=w$(u,t,e,n,i,s,o),d=Km(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 li(e.sort(Wo),u)}function ND(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 pl(i.from+e,i.to+e,i.type))}return n}function w$(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 TD(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 MD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Km(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=TD(t,u,c+n);if(h){s=!0;let d=Km(h,u,n+c+1,r);d!=qn&&i.push(c,c+u.nodeSize,d)}});let o=ND(s?MD(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 li(o,i):qn}function Wo(t,e){return t.from-e.from||t.to-e.to}function Kv(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),yN(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),yN(e,i,r.copy(s.from,r.to)));break}}}return e}function yN(t,e,n){for(;e<t.length&&Wo(n,t[e])>0;)e++;t.splice(e,0,n)}let Jb,qb;if(typeof WeakMap<"u"){let t=new WeakMap;Jb=e=>t.get(e),qb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Jb=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},qb=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ct=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 Jb(t)||qb(t,E$(t))}};function E$(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=A$(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 w=g.child(k),{colspan:N,rowspan:T,colwidth:F}=w.attrs;for(let V=0;V<T;V++){if(V+h>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:T-V});break}const H=i+V*e;for(let z=0;z<N;z++){r[H+z]==0?r[H+z]=d:(s||(s=[])).push({type:"collision",row:h,pos:d,n:N-z});const C=F&&F[z];if(C){const _=(H+z)%e*2,U=o[_];U==null||U!=C&&o[_+1]==1?(o[_]=C,o[_+1]=1):U==C&&o[_+1]++}}}i+=N,d+=w.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 Ct(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&&N$(u,o,t),u}function A$(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 N$(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=T$(c)))[h]=d)}u&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:u})}}function T$(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function xN(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 bN(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 M$(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 O$(t){const e=t.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:M$}};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=>xN(r,e)}],toDOM(r){return["td",bN(r,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>xN(r,e)}],toDOM(r){return["th",bN(r,e),0]}}}}function ui(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 Ia=new kr("selectingCells");function ju(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 pi(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 qg(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=ju(e.$head)||R$(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function R$(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 Hb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function D$(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Gv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function OD(t,e,n){const r=t.node(-1),i=Ct.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 dl(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 I$(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 _$(t,e,n){const r=ui(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 zt=class ws extends Pe{constructor(e,n=e){const r=e.node(-1),i=Ct.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 wO(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(Hb(r)&&Hb(i)&&Gv(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 Oe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ct.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 w=i.left-b.left,N=b.right-i.right;if(w>0||N>0){let T=k.attrs;if(w>0&&(T=dl(T,0,w)),N>0&&(T=dl(T,T.colspan-N,N)),b.left<i.left){if(k=k.type.createAndFill(T),!k)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(T)}`)}else k=k.type.create(T,k.content)}if(b.top<i.top||b.bottom>i.bottom){const T={...k.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?k=k.type.createAndFill(T):k=k.type.create(T,k.content)}h.push(k)}o.push(e.child(c).copy(W.from(h)))}const u=this.isColSelection()&&this.isRowSelection()?e:o;return new G(W.from(u),1,1)}replace(e,n=G.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?G.empty:n)}const s=Pe.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new G(W.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ct.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=Ct.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=Ct.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=Ct.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 L$(this.$anchorCell.pos,this.$headCell.pos)}};zt.prototype.visible=!1;Pe.jsonID("cell",zt);var L$=class RD{constructor(e,n){this.anchor=e,this.head=n}map(e){return new RD(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&&Gv(n,r)?new zt(n,r):Pe.near(r,1)}};function z$(t){if(!(t.selection instanceof zt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(pl.node(r,r+n.nodeSize,{class:"selectedCell"}))}),li.create(t.doc,e)}function B$({$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 V$({$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 F$(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof be&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=zt.create(i,r.from);else if(o=="row"){const u=i.resolve(r.from+1);s=zt.rowSelection(u,u)}else if(!n){const u=Ct.get(r.node),c=r.from+1,h=c+u.map[u.width*u.height-1];s=zt.create(i,c+1,h)}}else r instanceof Oe&&B$(r)?s=Oe.create(i,r.from):r instanceof Oe&&V$(r)&&(s=Oe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const P$=new kr("fix-tables");function DD(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)?DD(t.child(u),c,n+1,r):c.nodesBetween(0,c.content.size,r,n+1),n+=c.nodeSize}}function j$(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=$$(t,i,s,n))};return e?e.doc!=t.doc&&DD(e.doc,t.doc,0,r):t.doc.descendants(r),n}function $$(t,e,n,r){const i=Ct.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,dl(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 T=ui(t.schema)[b].createAndFill();T&&k.push(T)}const w=(c==0||o==c-1)&&u==c?h+1:g-1;r.insert(r.mapping.map(w),k)}h=g}return r.setMeta(P$,{fixTables:!0})}function ID(t){const e=Ct.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 _D(t,e){const n=[],r=Ct.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 LD(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 op(t){return U$(e=>e.type.spec.tableRole==="table",t)}function U$(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 wu(t,e){const n=op(e.$from);if(!n)return;const r=Ct.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 Eu(t,e){const n=op(e.$from);if(!n)return;const r=Ct.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 SN(t,e,n=e){let r=e,i=n;for(let d=e;d>=0;d--){const g=wu(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=wu(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=wu(d,t.selection);g&&g.length>0&&s.push(d)}r=s[0],i=s[s.length-1];const o=wu(r,t.selection),u=Eu(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=wu(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 vN(t,e,n=e){let r=e,i=n;for(let d=e;d>=0;d--){const g=Eu(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=Eu(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=Eu(d,t.selection);g&&g.length>0&&s.push(d)}r=s[0],i=s[s.length-1];const o=Eu(r,t.selection),u=wu(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=Eu(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 kN(t){return t[0].map((e,n)=>t.map(r=>r[n]))}function J$(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:u}=t,c=op(r.doc.resolve(u));if(!c)return!1;const h=(e=SN(r,i))===null||e===void 0?void 0:e.indexes,d=(n=SN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!d||h.includes(s))return!1;const g=q$(c.node,h,d);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=Ct.get(g),b=c.start,k=s,w=y.positionAt(y.height-1,k,g),N=r.doc.resolve(b+w),T=y.positionAt(0,k,g),F=r.doc.resolve(b+T);return r.setSelection(zt.colSelection(N,F)),!0}function q$(t,e,n,r){let i=kN(ID(t));return i=LD(i,e,n),i=kN(i),_D(t,i)}function H$(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:u}=t,c=op(r.doc.resolve(u));if(!c)return!1;const h=(e=vN(r,i))===null||e===void 0?void 0:e.indexes,d=(n=vN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!d||h.includes(s))return!1;const g=K$(c.node,h,d);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=Ct.get(g),b=c.start,k=s,w=y.positionAt(k,y.width-1,g),N=r.doc.resolve(b+w),T=y.positionAt(k,0,g),F=r.doc.resolve(b+T);return r.setSelection(zt.rowSelection(N,F)),!0}function K$(t,e,n,r){let i=ID(t);return i=LD(i,e,n),_D(t,i)}function to(t){const e=t.selection,n=qg(t),r=n.node(-1),i=n.start(-1),s=Ct.get(r);return{...e instanceof zt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function zD(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;_$(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,I$(h.attrs,i-e.colCount(c))),o+=h.attrs.rowspan-1}else{const c=s==null?ui(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 G$(t,e){if(!pi(t))return!1;if(e){const n=to(t);e(zD(t.tr,n,n.left))}return!0}function Y$(t,e){if(!pi(t))return!1;if(e){const n=to(t);e(zD(t.tr,n,n.right))}return!0}function W$(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,dl(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 X$(t,e){if(!pi(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;W$(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=Ct.get(s)}e(r)}return!0}function Q$(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),w=e.positionAt(i+1,h,n);t.insert(t.mapping.slice(u).map(r+w),k),h+=b.colspan-1}}}}function Z$(t,e){if(!pi(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;Q$(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=Ct.get(n.table)}e(r)}return!0}function eU(t,e){return function(n,r){if(!pi(n))return!1;const i=qg(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof zt?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 tU(t){return function(e,n){if(!pi(e))return!1;if(n){const r=ui(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 CN(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 Yv(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?tU(t):function(n,r){if(!pi(n))return!1;if(r){const i=ui(n.schema),s=to(n),o=n.tr,u=CN("row",s,i),c=CN("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}}Yv("row",{useDeprecatedLogic:!0});Yv("column",{useDeprecatedLogic:!0});Yv("cell",{useDeprecatedLogic:!0});function nU(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 BD(t){return function(e,n){if(!pi(e))return!1;const r=nU(qg(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Oe.between(i,D$(i))).scrollIntoView())}return!0}}function rU(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 zt))return!1;if(e){const r=t.tr,i=ui(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 G(i,0,0))}),r.docChanged&&e(r)}return!0}function iU(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=t,u=e.tr;return H$({tr:u,originIndex:r,targetIndex:i,select:s,pos:o})?(n?.(u),!0):!1}}function sU(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 aU(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=Kb(ui(o).row,new G(h,d,g)).content),u.push(h)}else if(s=="cell"||s=="header_cell")u.push(n||r?Kb(ui(o).row,new G(e,n,r)).content:e);else return null;return oU(o,u)}function oU(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(W.empty),n[i]<r){const s=ui(t).cell.createAndFill(),o=[];for(let u=n[i];u<r;u++)o.push(s);e[i]=e[i].append(W.from(o))}return{height:e.length,width:r,rows:e}}function Kb(t,e){const n=t.createAndFill();return new Lj(n).replace(0,n.content.size,e).doc}function lU({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(dl(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(W.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(W.from(c))}n=s,e=i}return{width:t,height:e,rows:n}}function uU(t,e,n,r,i,s,o){const u=t.doc.type.schema,c=ui(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 w;b.lastChild==null||b.lastChild.type==c.cell?w=h||(h=c.cell.createAndFill()):w=d||(d=c.header_cell.createAndFill());for(let N=e.width;N<i;N++)k.push(w);t.insert(t.mapping.slice(o).map(y-1+r),k)}if(s>e.height){const g=[];for(let k=0,w=(e.height-1)*e.width;k<Math.max(e.width,i);k++){const N=k>=e.width?!1:n.nodeAt(e.map[w+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,W.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 wN(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 EN(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,dl(y.attrs,o-b,y.attrs.colspan-(o-b))),t.insert(k+y.nodeSize,y.type.createAndFill(dl(y.attrs,0,o-b))),h+=y.attrs.rowspan-1}}return c}function AN(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=Ct.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=Ct.get(s),y=g.mapping.maps.length}uU(g,o,s,n,h,d,y)&&b(),wN(g,o,s,n,c,h,u,y)&&b(),wN(g,o,s,n,c,h,d,y)&&b(),EN(g,o,s,n,u,d,c,y)&&b(),EN(g,o,s,n,u,d,h,y)&&b();for(let k=u;k<d;k++){const w=o.positionAt(k,c,s),N=o.positionAt(k,h,s);g.replace(g.mapping.slice(y).map(w+n),g.mapping.slice(y).map(N+n),new G(i.rows[k-u],0,0))}b(),g.setSelection(new zt(g.doc.resolve(n+o.positionAt(u,c,s)),g.doc.resolve(n+o.positionAt(d-1,h-1,s)))),e(g)}const cU=HO({ArrowLeft:Bd("horiz",-1),ArrowRight:Bd("horiz",1),ArrowUp:Bd("vert",-1),ArrowDown:Bd("vert",1),"Shift-ArrowLeft":Vd("horiz",-1),"Shift-ArrowRight":Vd("horiz",1),"Shift-ArrowUp":Vd("vert",-1),"Shift-ArrowDown":Vd("vert",1),Backspace:zd,"Mod-Backspace":zd,Delete:zd,"Mod-Delete":zd});function xm(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Bd(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof zt)return xm(n,r,Pe.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 xm(n,r,Pe.near(n.doc.resolve(s.head+e),e));{const u=n.doc.resolve(o),c=OD(u,t,e);let h;return c?h=Pe.near(c,1):e<0?h=Pe.near(n.doc.resolve(u.before(-1)),-1):h=Pe.near(n.doc.resolve(u.after(-1)),1),xm(n,r,h)}}}function Vd(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof zt)o=s;else{const c=VD(i,t,e);if(c==null)return!1;o=new zt(n.doc.resolve(c))}const u=OD(o.$headCell,t,e);return u?xm(n,r,new zt(o.$anchorCell,u)):!1}}function fU(t,e){const n=t.state.doc,r=ju(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new zt(r))),!0):!1}function hU(t,e,n){if(!pi(t.state))return!1;let r=aU(n);const i=t.state.selection;if(i instanceof zt){r||(r={width:1,height:1,rows:[W.from(Kb(ui(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),u=Ct.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=lU(r,u.right-u.left,u.bottom-u.top),AN(t.state,t.dispatch,o,u,r),!0}else if(r){const s=qg(t.state),o=s.start(-1);return AN(t.state,t.dispatch,o,Ct.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function pU(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=NN(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof zt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=ju(t.state.selection.$anchor))!=null&&((n=r1(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=r1(t,h);const g=Ia.getState(t.state)==null;if(!d||!Gv(c,d))if(g)d=c;else return;const y=new zt(c,d);if(g||!t.state.selection.eq(y)){const b=t.state.tr.setSelection(y);g&&b.setMeta(Ia,c.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",u),Ia.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ia,-1))}function u(c){const h=c,d=Ia.getState(t.state);let g;if(d!=null)g=t.state.doc.resolve(d);else if(NN(t,h.target)!=r&&(g=r1(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 Oe))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 NN(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function r1(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&&ju(t.state.doc.resolve(r))||ju(t.state.doc.resolve(i))}var dU=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")),Gb(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,Gb(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Gb(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 w=0;w<b;w++,y++){const N=i==y?s:k&&k[w],T=N?N+"px":"";if(o+=N||r,N||(u=!1),c)c.style.width!=T&&(c.style.width=T),c=c.nextSibling;else{const F=document.createElement("col");F.style.width=T,e.appendChild(F)}}}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 Rr=new kr("tableColumnResizing");function mU({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=dU,lastColumnResizable:i=!0}={}){const s=new vr({key:Rr,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=ui(u.schema).table.name;return r&&h&&(h[d]=(g,y)=>new r(g,n,y)),new gU(-1,!1)},apply(o,u){return u.apply(o)}},props:{attributes:o=>{const u=Rr.getState(o);return u&&u.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,u)=>{yU(o,u,t,i)},mouseleave:o=>{xU(o)},mousedown:(o,u)=>{bU(o,u,e,n)}},decorations:o=>{const u=Rr.getState(o);if(u&&u.activeHandle>-1)return wU(o,u.activeHandle)},nodeViews:{}}});return s}var gU=class bm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Rr);if(r&&r.setHandle!=null)return new bm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new bm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Hb(e.doc.resolve(i))||(i=-1),new bm(i,n.dragging)}return n}};function yU(t,e,n,r){if(!t.editable)return;const i=Rr.getState(t.state);if(i&&!i.dragging){const s=vU(e.target);let o=-1;if(s){const{left:u,right:c}=s.getBoundingClientRect();e.clientX-u<=n?o=TN(t,e,"left",n):c-e.clientX<=n&&(o=TN(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const u=t.state.doc.resolve(o),c=u.node(-1),h=Ct.get(c),d=u.start(-1);if(h.colCount(u.pos-d)+u.nodeAfter.attrs.colspan-1==h.width-1)return}FD(t,o)}}}function xU(t){if(!t.editable)return;const e=Rr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&FD(t,-1)}function bU(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=Rr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const u=t.state.doc.nodeAt(o.activeHandle),c=SU(t,o.activeHandle,u.attrs);t.dispatch(t.state.tr.setMeta(Rr,{setDragging:{startX:e.clientX,startWidth:c}}));function h(g){s.removeEventListener("mouseup",h),s.removeEventListener("mousemove",d);const y=Rr.getState(t.state);y?.dragging&&(kU(t,y.activeHandle,MN(y.dragging,g,n)),t.dispatch(t.state.tr.setMeta(Rr,{setDragging:null})))}function d(g){if(!g.which)return h(g);const y=Rr.getState(t.state);if(y&&y.dragging){const b=MN(y.dragging,g,n);ON(t,y.activeHandle,b,r)}}return ON(t,o.activeHandle,c,r),s.addEventListener("mouseup",h),s.addEventListener("mousemove",d),e.preventDefault(),!0}function SU(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 vU(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function TN(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=ju(t.state.doc.resolve(o));if(!u)return-1;if(n=="right")return u.pos;const c=Ct.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 MN(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function FD(t,e){t.dispatch(t.state.tr.setMeta(Rr,{setHandle:e}))}function kU(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Ct.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():CU(y.colspan);k[b]=n,c.setNodeMarkup(o+g,null,{...y,colwidth:k})}c.docChanged&&t.dispatch(c)}function ON(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),u=Ct.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&&Gb(s,c.firstChild,c,r,u,n)}function CU(t){return Array(t).fill(0)}function wU(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return li.empty;const s=Ct.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=Rr.getState(t))===null||c===void 0)&&c.dragging&&n.push(pl.node(o+g,o+g+i.nodeAt(g).nodeSize,{class:"column-resize-dragging"})),n.push(pl.widget(y,b))}}return li.create(t.doc,n)}function EU({allowTableNodeSelection:t=!1}={}){return new vr({key:Ia,state:{init(){return null},apply(e,n){const r=e.getMeta(Ia);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:z$,handleDOMEvents:{mousedown:pU},createSelectionBetween(e){return Ia.getState(e.state)!=null?e.state.selection:null},handleTripleClick:fU,handleKeyDown:cU,handlePaste:hU},appendTransaction(e,n,r){return F$(r,j$(r,n),t)}})}const PD=65535,jD=Math.pow(2,16);function AU(t,e){return t+e*jD}function RN(t){return t&PD}function NU(t){return(t-(t&PD))/jD}const $D=1,UD=2,Sm=4,JD=8;class DN{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&JD)>0}get deletedBefore(){return(this.delInfo&($D|Sm))>0}get deletedAfter(){return(this.delInfo&(UD|Sm))>0}get deletedAcross(){return(this.delInfo&Sm)>0}}class Dr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Dr.empty)return Dr.empty}recover(e){let n=0,r=RN(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+NU(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:AU(u/3,e-c),w=e==c?UD:e==g?$D:Sm;return(n<0?e!=c:e!=g)&&(w|=JD),new DN(b,w,k)}i+=d-h}return r?e+i:new DN(e+i,0,null)}touches(e,n){let r=0,i=RN(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 Dr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Dr.empty:new Dr(e<0?[0,-e,0]:[0,0,e])}}Dr.empty=new Dr([]);const i1=Object.create(null);class Fn{getMap(){return Dr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=i1[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 i1)throw new RangeError("Duplicate use of step JSON ID "+e);return i1[e]=n,n.prototype.jsonID=e,n}}class tn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new tn(e,null)}static fail(e){return new tn(null,e)}static fromReplace(e,n,r,i){try{return tn.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mi)return tn.fail(s.message);throw s}}}function Wv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Wv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}class Vo extends Fn{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 G(Wv(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 tn.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 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:"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 Vo(n.from,n.to,e.markFromJSON(n.mark))}}Fn.jsonID("addMark",Vo);class Fo extends Fn{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 G(Wv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return tn.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 Fo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Fo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fo(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 Fo(n.from,n.to,e.markFromJSON(n.mark))}}Fn.jsonID("removeMark",Fo);class Po extends Fn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return tn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return tn.fromReplace(e,this.pos,this.pos+1,new G(W.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 Po(this.pos,n.marks[i]);return new Po(this.pos,this.mark)}}return new Dh(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Po(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 Po(n.pos,e.markFromJSON(n.mark))}}Fn.jsonID("addNodeMark",Po);class Dh extends Fn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return tn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return tn.fromReplace(e,this.pos,this.pos+1,new G(W.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 Dh(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 Dh(n.pos,e.markFromJSON(n.mark))}}Fn.jsonID("removeNodeMark",Dh);class Ra extends Fn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Yb(e,this.from,this.to)?tn.fail("Structure replace would overwrite content"):tn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Dr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ra(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 Ra(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ra)||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?G.empty:new G(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ra(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?G.empty:new G(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ra(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 Ra(n.from,n.to,G.fromJSON(e,n.slice),!!n.structure)}}Fn.jsonID("replace",Ra);class ah extends Fn{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&&(Yb(e,this.from,this.gapFrom)||Yb(e,this.gapTo,this.to)))return tn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return tn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?tn.fromReplace(e,this.from,this.to,r):tn.fail("Content does not fit in gap")}getMap(){return new Dr([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 ah(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 ah(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 ah(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}}Fn.jsonID("replaceAround",ah);function Yb(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 TU(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 oh extends Fn{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 tn.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 tn.fromReplace(e,this.pos,this.pos+1,new G(W.from(i),0,n.isLeaf?0:1))}getMap(){return Dr.empty}invert(e){return new oh(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 oh(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 oh(n.pos,n.attr,n.value)}}Fn.jsonID("attr",oh);class Gm extends Fn{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 tn.ok(r)}getMap(){return Dr.empty}invert(e){return new Gm(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 Gm(n.attr,n.value)}}Fn.jsonID("docAttr",Gm);let Ih=class extends Error{};Ih=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ih.prototype=Object.create(Error.prototype);Ih.prototype.constructor=Ih;Ih.prototype.name="TransformError";const vl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},qD=function(t,e,n,r){return n&&(IN(t,e,n,r,-1)||IN(t,e,n,r,1))},MU=/^(img|br|input|textarea|hr)$/i;function IN(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ym(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Xv(t)||MU.test(t.nodeName)||t.contentEditable=="false")return!1;e=vl(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?Ym(t):0}else return!1}}function Ym(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function OU(t,e,n){for(let r=e==0,i=e==Ym(t);r||i;){if(t==n)return!0;let s=vl(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Ym(t)}}function Xv(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 HD=function(t){return t.focusNode&&qD(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function KD(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Hi=typeof navigator<"u"?navigator:null,_N=typeof document<"u"?document:null,no=Hi&&Hi.userAgent||"",Wb=/Edge\/(\d+)/.exec(no),GD=/MSIE \d/.exec(no),Xb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(no),lp=!!(GD||Xb||Wb),YD=GD?document.documentMode:Xb?+Xb[1]:Wb?+Wb[1]:0,Hg=!lp&&/gecko\/(\d+)/i.test(no);Hg&&+(/Firefox\/(\d+)/.exec(no)||[0,0])[1];const Qb=!lp&&/Chrome\/(\d+)/.exec(no),Js=!!Qb,WD=Qb?+Qb[1]:0,kl=!lp&&!!Hi&&/Apple Computer/.test(Hi.vendor),Qv=kl&&(/Mobile\/\w+/.test(no)||!!Hi&&Hi.maxTouchPoints>2),ti=Qv||(Hi?/Mac/.test(Hi.platform):!1),XD=Hi?/Win/.test(Hi.platform):!1,up=/Android \d/.test(no),Zv=!!_N&&"webkitFontSmoothing"in _N.documentElement.style,RU=Zv?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function DU(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(HD(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&be.isSelectable(g)&&i.parent&&!(g.isInline&&OU(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new be(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=ZD(t,d,u,g)}return h}function QD(t){return t.editable?t.hasFocus():zU(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ek(t,e=!1){let n=t.state.selection;if(LU(t,n),!!QD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Js){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&qD(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)_U(t);else{let{anchor:r,head:i}=n,s,o;LN&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=zN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=zN(t,n.to))),t.docView.setSelection(r,i,t,e),LN&&(s&&BN(s),o&&BN(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&IU(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const LN=kl||Js&&WD<63;function zN(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(kl&&i&&i.contentEditable=="false")return s1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return s1(i);if(s)return s1(s)}}function s1(t){return t.contentEditable="true",kl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function BN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function IU(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(()=>{(!QD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function _U(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,vl(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&lp&&YD<=11&&(n.disabled=!0,n.disabled=!1)}function LU(t,e){if(e instanceof be){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(VN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else VN(t)}function VN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ZD(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function zU(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 Zb(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&&Pe.findFrom(s,e)}function Da(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function FN(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 Da(t,new Oe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Zb(t.state,e);return i&&i instanceof be?Da(t,i):!1}else if(!(ti&&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?be.isSelectable(s)?Da(t,new be(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Zv?Da(t,new Oe(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof be&&r.node.isInline)return Da(t,new Oe(e>0?r.$to:r.$from));{let i=Zb(t.state,e);return i?Da(t,i):!1}}}function Wm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function lh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function fu(t,e){return e<0?BU(t):VU(t)}function BU(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Hg&&n.nodeType==1&&r<Wm(n)&&lh(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(lh(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(eI(n))break;{let u=n.previousSibling;for(;u&&lh(u,-1);)i=n.parentNode,s=vl(u),u=u.previousSibling;if(u)n=u,r=Wm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?eS(t,n,r):i&&eS(t,i,s)}function VU(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Wm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(lh(u,1))s=n,o=++r;else break}else{if(eI(n))break;{let u=n.nextSibling;for(;u&&lh(u,1);)s=u.parentNode,o=vl(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=Wm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&eS(t,s,o)}function eI(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function FU(t,e){for(;t&&e==t.childNodes.length&&!Xv(t);)e=vl(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 PU(t,e){for(;t&&!e&&!Xv(t);)e=vl(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 eS(t,e,n){if(e.nodeType!=3){let s,o;(o=FU(e,n))?(e=o,n=0):(s=PU(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(HD(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&&ek(t)},50)}function PN(t,e){let n=t.state.doc.resolve(e);if(!(Js||XD)&&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 jN(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||ti&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Zb(t.state,e);if(o&&o instanceof be)return Da(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof tr?Pe.near(o,e):Pe.findFrom(o,e);return u?Da(t,u):!1}return!1}function $N(t,e){if(!(t.state.selection instanceof Oe))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 jU(t){if(!kl||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 $U(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function UU(t,e){let n=e.keyCode,r=$U(e);if(n==8||ti&&n==72&&r=="c")return $N(t,-1)||fu(t,-1);if(n==46&&!e.shiftKey||ti&&n==68&&r=="c")return $N(t,1)||fu(t,1);if(n==13||n==27)return!0;if(n==37||ti&&n==66&&r=="c"){let i=n==37?PN(t,t.state.selection.from)=="ltr"?-1:1:-1;return FN(t,i,r)||fu(t,i)}else if(n==39||ti&&n==70&&r=="c"){let i=n==39?PN(t,t.state.selection.from)=="ltr"?1:-1:1;return FN(t,i,r)||fu(t,i)}else{if(n==38||ti&&n==80&&r=="c")return jN(t,-1,r)||fu(t,-1);if(n==40||ti&&n==78&&r=="c")return jU(t)||jN(t,1,r)||fu(t,1);if(r==(ti?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function tI(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")||Wi.fromSchema(t.state.schema),u=oI(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=aI[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 nI(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 G(W.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=Wi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(k.serializeNode(b.text(w,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=KU(n),Zv&&GU(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")||Ua.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!JU.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=YU(JN(u,+d[1],+d[2]),d[4]);else if(u=G.maxOpen(qU(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=JN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const JU=/^(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 qU(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&&iI(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=sI(o[o.length-1],s.length));let d=rI(u,c);o.push(d),i=i.matchType(d.type),s=c}}),o)return W.from(o)}return t}function rI(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,W.from(t));return t}function iI(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=iI(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(W.from(rI(n,t,i+1))))}}function sI(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,sI(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(W.empty,!0);return t.copy(n.append(r))}function tS(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=tS(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(W.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function JN(t,e,n){return e<t.openStart&&(t=new G(tS(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new G(tS(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const aI={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 qN=null;function oI(){return qN||(qN=document.implementation.createHTMLDocument("title"))}let a1=null;function HU(t){let e=window.trustedTypes;return e?(a1||(a1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),a1.createHTML(t)):t}function KU(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=oI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&aI[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=HU(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function GU(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 YU(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=W.from(c.create(r[u+1],i)),s++,o++}return new G(i,s,o)}const Di={},Lr={};function Ba(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Lr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!uI(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(up&&Js&&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,KD(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||UU(t,n)?n.preventDefault():Ba(t,"key")};Lr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Lr.keypress=(t,e)=>{let n=e;if(uI(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ti&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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 Kg(t){return{left:t.clientX,top:t.clientY}}function WU(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function tk(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 Du(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 XU(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&be.isSelectable(r)?(Du(t,new be(n)),!0):!1}function QU(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof be&&(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(be.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?(Du(t,be.create(t.state.doc,i)),!0):!1}function ZU(t,e,n,r,i){return tk(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?QU(t,n):XU(t,n))}function eJ(t,e,n,r){return tk(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function tJ(t,e,n,r){return tk(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||nJ(t,n,r)}function nJ(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Du(t,Oe.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)Du(t,Oe.create(r,u+1,u+1+o.content.size));else if(be.isSelectable(o))Du(t,be.create(r,u));else continue;return!0}}function nk(t){return Xm(t)}const lI=ti?"metaKey":"ctrlKey";Di.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=nk(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&WU(n,t.input.lastClick)&&!n[lI]&&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(Kg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new rJ(t,o,n,!!r)):(s=="doubleClick"?eJ:tJ)(t,o.pos,o.inside,n)?n.preventDefault():Ba(t,"pointer"))};class rJ{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[lI],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 be&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Hg&&!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(()=>ek(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(Kg(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ba(this.view,"pointer"):ZU(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||kl&&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)?(Du(this.view,Pe.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)}}Di.touchstart=t=>{t.input.lastTouch=Date.now(),nk(t),Ba(t,"pointer")};Di.touchmove=t=>{t.input.lastTouch=Date.now(),Ba(t,"pointer")};Di.contextmenu=t=>nk(t);function uI(t,e){return t.composing?!0:kl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const iJ=up?5e3:-1;Lr.compositionstart=Lr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Js&&XD&&sJ(t)))t.markCursor=t.state.storedMarks||n.marks(),Xm(t,!0),t.markCursor=null;else if(Xm(t,!e.selection.empty),Hg&&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}cI(t,iJ)};function sJ(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"}Lr.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++,cI(t,20))};function cI(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Xm(t),e))}function aJ(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=oJ());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function oJ(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Xm(t,e=!1){if(!(up&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),aJ(t),e||t.docView&&t.docView.dirty){let n=DU(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 lJ(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 _h=lp&&YD<15||Qv&&RU<604;Di.copy=Lr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=_h?null:n.clipboardData,o=r.content(),{dom:u,text:c}=tI(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):lJ(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function uJ(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function cJ(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?nS(t,r.value,null,i,e):nS(t,r.textContent,r.innerHTML,i,e)},50)}function nS(t,e,n,r,i){let s=nI(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||G.empty)))return!0;if(!s)return!1;let o=uJ(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 fI(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," "):""}Lr.paste=(t,e)=>{let n=e;if(t.composing&&!up)return;let r=_h?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&nS(t,fI(r),r.getData("text/html"),i,n)?n.preventDefault():cJ(t,n)};class fJ{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const hJ=ti?"altKey":"ctrlKey";function hI(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[hJ]}Di.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(Kg(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof be?i.to-1:i.to))){if(r&&r.mightDrag)o=be.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=be.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:d}=tI(t,u);(!n.dataTransfer.files.length||!Js||WD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(_h?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",_h||n.dataTransfer.setData("text/plain",h),t.dragging=new fJ(d,hI(t,n),o)};Di.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Lr.dragover=Lr.dragenter=(t,e)=>e.preventDefault();Lr.drop=(t,e)=>{try{pJ(t,e,t.dragging)}finally{t.dragging=null}};function pJ(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Kg(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=nI(t,fI(e.dataTransfer),_h?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&hI(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||G.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?TU(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&&be.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new be(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((k,w,N,T)=>b=T),c.setSelection(ZD(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Di.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())&&ek(t)},20))};Di.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)};Di.beforeinput=(t,e)=>{if(Js&&up&&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,KD(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 Lr)Di[t]=Lr[t];function Lh(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||Xo,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 Pi(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&&Lh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ja{constructor(e,n){this.attrs=e,this.spec=n||Xo}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 Pi(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ja&&Lh(this.attrs,e.attrs)&&Lh(this.spec,e.spec)}static is(e){return e.type instanceof ja}destroy(){}}class rk{constructor(e,n){this.attrs=e,this.spec=n||Xo}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 Pi(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 rk&&Lh(this.attrs,e.attrs)&&Lh(this.spec,e.spec)}destroy(){}}class Pi{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Pi(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 Pi(e,e,new Qm(n,r))}static inline(e,n,r,i){return new Pi(e,n,new ja(r,i))}static node(e,n,r,i){return new Pi(e,n,new rk(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ja}get widget(){return this.type instanceof Qm}}const Au=[],Xo={};class un{constructor(e,n){this.local=e.length?e:Au,this.children=n.length?n:Au}static create(e,n){return n.length?Zm(n,e,0,Xo):Hn}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==Hn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Xo)}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?dJ(this.children,o||[],e,n,r,i,s):o?new un(o.sort(Qo),Au):Hn}add(e,n){return n.length?this==Hn?un.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=dI(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,Zm(d,u,h+1,Xo)),s+=3}});let o=pI(s?mI(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new un(o.length?this.local.concat(o).sort(Qo):this.local,i||this.children)}remove(e){return e.length==0||this==Hn?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!=Hn?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 un(i,r):Hn}forChild(e,n){if(this==Hn)return this;if(n.isLeaf)return un.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 ja){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 un(i.sort(Qo),Au);return r?new _o([u,r]):u}return r||Hn}eq(e){if(this==e)return!0;if(!(e instanceof un)||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 ik(this.localsInner(e))}localsInner(e){if(this==Hn)return Au;if(e.inlineContent||!this.local.some(ja.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ja||n.push(this.local[r]);return n}forEachSet(e){e(this)}}un.empty=new un([],[]);un.removeOverlap=ik;const Hn=un.empty;class _o{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Xo));return _o.from(r)}forChild(e,n){if(n.isLeaf)return un.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Hn&&(s instanceof _o?r=r.concat(s.members):r.push(s))}return _o.from(r)}eq(e){if(!(e instanceof _o)||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?ik(r?n:n.sort(Qo)):Au}static from(e){switch(e.length){case 0:return Hn;case 1:return e[0];default:return new _o(e.every(n=>n instanceof un)?e:e.reduce((n,r)=>n.concat(r instanceof un?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function dJ(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,w)=>{let N=w-k-(b-y);for(let T=0;T<u.length;T+=3){let F=u[T+1];if(F<0||y>F+d-g)continue;let V=u[T]+d-g;b>=V?u[T+1]=y<=V?-2:-1:y>=d&&N&&(u[T]+=N,u[T+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:w}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&w==g&&w+N.nodeSize==b){let T=u[h+2].mapInner(n,N,d+1,t[h]+s+1,o);T!=Hn?(u[h]=g,u[h+1]=b,u[h+2]=T):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=mJ(u,t,e,n,i,s,o),d=Zm(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 un(e.sort(Qo),u)}function pI(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 Pi(i.from+e,i.to+e,i.type))}return n}function mJ(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 dI(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 mI(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Zm(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=dI(t,u,c+n);if(h){s=!0;let d=Zm(h,u,n+c+1,r);d!=Hn&&i.push(c,c+u.nodeSize,d)}});let o=pI(s?mI(t):t,-n).sort(Qo);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 un(o,i):Hn}function Qo(t,e){return t.from-e.from||t.to-e.to}function ik(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),HN(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),HN(e,i,r.copy(s.from,r.to)));break}}}return e}function HN(t,e,n){for(;e<t.length&&Qo(n,t[e])>0;)e++;t.splice(e,0,n)}var eg=typeof navigator<"u"?navigator:null,sk=eg&&eg.userAgent||"",gJ=/Edge\/(\d+)/.exec(sk),yJ=/MSIE \d/.exec(sk),xJ=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(sk),bJ=!!(yJ||xJ||gJ),SJ=!bJ&&!!eg&&/Apple Computer/.test(eg.vendor),gI=new kr("safari-ime-span"),rS=!1,vJ={key:gI,props:{decorations:kJ,handleDOMEvents:{compositionstart:()=>{rS=!0},compositionend:()=>{rS=!1}}}};function kJ(t){const{$from:e,$to:n,to:r}=t.selection;if(rS&&e.sameParent(n)){const i=Pi.widget(r,CJ,{ignoreSelection:!0,key:"safari-ime-span"});return un.create(t.doc,[i])}}function CJ(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var wJ=new vr(SJ?vJ:{key:gI});function tg(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 EJ(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function AJ(t,e,n){const i=wg((n||{}).ignore||[]),s=NJ(e);let o=-1;for(;++o<s.length;)Ju(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 T=!1,F=[];y.lastIndex=0;let V=y.exec(h.value);for(;V;){const H=V.index,z={index:V.index,input:V.input,stack:[...d,h]};let C=b(...V,z);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?y.lastIndex=H+1:(k!==H&&F.push({type:"text",value:h.value.slice(k,H)}),Array.isArray(C)?F.push(...C):C&&F.push(C),k=H+V[0].length,T=!0),!y.global)break;V=y.exec(h.value)}return T?(k<h.value.length&&F.push({type:"text",value:h.value.slice(k)}),g.children.splice(N,1,...F)):F=[h],N+F.length}}function NJ(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([TJ(i[0]),MJ(i[1])])}return e}function TJ(t){return typeof t=="string"?new RegExp(EJ(t),"g"):t}function MJ(t){return typeof t=="function"?t:function(){return t}}const o1="phrasing",l1=["autolink","link","image","label"];function OJ(){return{transforms:[BJ],enter:{literalAutolink:DJ,literalAutolinkEmail:u1,literalAutolinkHttp:u1,literalAutolinkWww:u1},exit:{literalAutolink:zJ,literalAutolinkEmail:LJ,literalAutolinkHttp:IJ,literalAutolinkWww:_J}}}function RJ(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:o1,notInConstruct:l1},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:o1,notInConstruct:l1},{character:":",before:"[ps]",after:"\\/",inConstruct:o1,notInConstruct:l1}]}}function DJ(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function u1(t){this.config.enter.autolinkProtocol.call(this,t)}function IJ(t){this.config.exit.autolinkProtocol.call(this,t)}function _J(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 LJ(t){this.config.exit.autolinkEmail.call(this,t)}function zJ(t){this.exit(t)}function BJ(t){AJ(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,VJ],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),FJ]],{ignore:["link","linkReference"]})}function VJ(t,e,n,r,i){let s="";if(!yI(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!PJ(n)))return!1;const o=jJ(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 FJ(t,e,n,r){return!yI(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function PJ(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 jJ(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=tg(t,"(");let s=tg(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 yI(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Kn(n)||kg(n))&&(!e||n!==47)}xI.peek=WJ;function $J(){this.buffer()}function UJ(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function JJ(){this.buffer()}function qJ(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function HJ(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ti(this.sliceSerialize(t)).toLowerCase(),n.label=e}function KJ(t){this.exit(t)}function GJ(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ti(this.sliceSerialize(t)).toLowerCase(),n.label=e}function YJ(t){this.exit(t)}function WJ(){return"["}function xI(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 XJ(){return{enter:{gfmFootnoteCallString:$J,gfmFootnoteCall:UJ,gfmFootnoteDefinitionLabelString:JJ,gfmFootnoteDefinition:qJ},exit:{gfmFootnoteCallString:HJ,gfmFootnoteCall:KJ,gfmFootnoteDefinitionLabelString:GJ,gfmFootnoteDefinition:YJ}}}function QJ(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:xI},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?bI:ZJ))),h(),c}}function ZJ(t,e,n){return e===0?t:bI(t,e,n)}function bI(t,e,n){return(n?"":" ")+t}const eq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];SI.peek=sq;function tq(){return{canContainEols:["delete"],enter:{strikethrough:rq},exit:{strikethrough:iq}}}function nq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:eq}],handlers:{delete:SI}}}function rq(t){this.enter({type:"delete",children:[]},t)}function iq(t){this.exit(t)}function SI(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 sq(){return"~"}function aq(t){return t.length}function oq(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||aq,s=[],o=[],u=[],c=[];let h=0,d=-1;for(;++d<t.length;){const w=[],N=[];let T=-1;for(t[d].length>h&&(h=t[d].length);++T<t[d].length;){const F=lq(t[d][T]);if(n.alignDelimiters!==!1){const V=i(F);N[T]=V,(c[T]===void 0||V>c[T])&&(c[T]=V)}w.push(F)}o[d]=w,u[d]=N}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<h;)s[g]=KN(r[g]);else{const w=KN(r);for(;++g<h;)s[g]=w}g=-1;const y=[],b=[];for(;++g<h;){const w=s[g];let N="",T="";w===99?(N=":",T=":"):w===108?N=":":w===114&&(T=":");let F=n.alignDelimiters===!1?1:Math.max(1,c[g]-N.length-T.length);const V=N+"-".repeat(F)+T;n.alignDelimiters!==!1&&(F=N.length+F+T.length,F>c[g]&&(c[g]=F),b[g]=F),y[g]=V}o.splice(1,0,y),u.splice(1,0,b),d=-1;const k=[];for(;++d<o.length;){const w=o[d],N=u[d];g=-1;const T=[];for(;++g<h;){const F=w[g]||"";let V="",H="";if(n.alignDelimiters!==!1){const z=c[g]-(N[g]||0),C=s[g];C===114?V=" ".repeat(z):C===99?z%2?(V=" ".repeat(z/2+.5),H=" ".repeat(z/2-.5)):(V=" ".repeat(z/2),H=V):H=" ".repeat(z)}n.delimiterStart!==!1&&!g&&T.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&F==="")&&(n.delimiterStart!==!1||g)&&T.push(" "),n.alignDelimiters!==!1&&T.push(V),T.push(F),n.alignDelimiters!==!1&&T.push(H),n.padding!==!1&&T.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&T.push("|")}k.push(n.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return k.join(`
|
|
55
|
-
`)}function lq(t){return t==null?"":String(t)}function KN(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 uq(){return{enter:{table:cq,tableData:GN,tableHeader:GN,tableRow:hq},exit:{codeText:pq,table:fq,tableData:c1,tableHeader:c1,tableRow:c1}}}function cq(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 fq(t){this.exit(t),this.data.inTable=void 0}function hq(t){this.enter({type:"tableRow",children:[]},t)}function c1(t){this.exit(t)}function GN(t){this.enter({type:"tableCell",children:[]},t)}function pq(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,dq));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function dq(t,e){return e==="|"?e:t}function mq(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,w,N){return h(d(b,w,N),b.align)}function u(b,k,w,N){const T=g(b,w,N),F=h([T]);return F.slice(0,F.indexOf(`
|
|
57
|
-
`))}function c(b,k,w,N){const T=w.enter("tableCell"),F=w.enter("phrasing"),V=w.containerPhrasing(b,{...N,before:s,after:s});return F(),T(),V}function h(b,k){return oq(b,{align:k,alignDelimiters:r,padding:n,stringLength:i})}function d(b,k,w){const N=b.children;let T=-1;const F=[],V=k.enter("table");for(;++T<N.length;)F[T]=g(N[T],k,w);return V(),F}function g(b,k,w){const N=b.children;let T=-1;const F=[],V=k.enter("tableRow");for(;++T<N.length;)F[T]=c(N[T],b,k,w);return V(),F}function y(b,k,w){let N=SS.inlineCode(b,k,w);return w.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function gq(){return{exit:{taskListCheckValueChecked:YN,taskListCheckValueUnchecked:YN,paragraph:xq}}}function yq(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:bq}}}function YN(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function xq(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 bq(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=SS.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 Sq(){return[OJ(),XJ(),tq(),uq(),gq()]}function vq(t){return{extensions:[RJ(),QJ(t),nq(),mq(t),yq()]}}const kq={tokenize:Tq,partial:!0},vI={tokenize:Mq,partial:!0},kI={tokenize:Oq,partial:!0},CI={tokenize:Rq,partial:!0},Cq={tokenize:Dq,partial:!0},wI={name:"wwwAutolink",tokenize:Aq,previous:AI},EI={name:"protocolAutolink",tokenize:Nq,previous:NI},qs={name:"emailAutolink",tokenize:Eq,previous:TI},Xi={};function wq(){return{text:Xi}}let Eo=48;for(;Eo<123;)Xi[Eo]=qs,Eo++,Eo===58?Eo=65:Eo===91&&(Eo=97);Xi[43]=qs;Xi[45]=qs;Xi[46]=qs;Xi[95]=qs;Xi[72]=[qs,EI];Xi[104]=[qs,EI];Xi[87]=[qs,wI];Xi[119]=[qs,wI];function Eq(t,e,n){const r=this;let i,s;return o;function o(g){return!iS(g)||!TI.call(r,r.previous)||ak(r.events)?n(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(g))}function u(g){return iS(g)?(t.consume(g),u):g===64?(t.consume(g),c):n(g)}function c(g){return g===46?t.check(Cq,d,h)(g):g===45||g===95||On(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&&cn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(g)):n(g)}}function Aq(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!AI.call(r,r.previous)||ak(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(kq,t.attempt(vI,t.attempt(kI,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function Nq(t,e,n){const r=this;let i="",s=!1;return o;function o(g){return(g===72||g===104)&&NI.call(r,r.previous)&&!ak(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),t.consume(g),u):n(g)}function u(g){if(cn(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||Em(g)||tt(g)||Kn(g)||kg(g)?n(g):t.attempt(vI,t.attempt(kI,d),n)(g)}function d(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(g)}}function Tq(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 Mq(t,e,n){let r,i,s;return o;function o(h){return h===46||h===95?t.check(CI,c,u)(h):h===null||tt(h)||Kn(h)||h!==45&&kg(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 Oq(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(CI,e,s)(o):o===null||tt(o)||Kn(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function Rq(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||tt(u)||Kn(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||tt(u)||Kn(u)?e(u):r(u)}function s(u){return cn(u)?o(u):n(u)}function o(u){return u===59?(t.consume(u),r):cn(u)?(t.consume(u),o):n(u)}}function Dq(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return On(s)?n(s):e(s)}}function AI(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||tt(t)}function NI(t){return!cn(t)}function TI(t){return!(t===47||iS(t))}function iS(t){return t===43||t===45||t===46||t===95||On(t)}function ak(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 Iq={tokenize:jq,partial:!0};function _q(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Vq,continuation:{tokenize:Fq},exit:Pq}},text:{91:{name:"gfmFootnoteCall",tokenize:Bq},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Lq,resolveTo:zq}}}}function Lq(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=Ti(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 zq(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 Bq(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||tt(g))return n(g);if(g===93){t.exit("chunkString");const y=t.exit("gfmFootnoteCallString");return i.includes(Ti(r.sliceSerialize(y)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(g)}return tt(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 Vq(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||tt(k))return n(k);if(k===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return s=Ti(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),y}return tt(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),We(t,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return e(k)}}function Fq(t,e,n){return t.check(Uu,e,t.attempt(Iq,e,n))}function Pq(t){t.exit("gfmFootnoteDefinition")}function jq(t,e,n){const r=this;return We(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 $q(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&&Ir(y,y.length,0,Cg(b,o.slice(h+1,c),u)),Ir(y,y.length,0,[["exit",g,u],["enter",o[c][1],u],["exit",o[c][1],u],["exit",d,u]]),Ir(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 w=Lu(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"),T=Lu(k);return N._open=!T||T===2&&!!w,N._close=!w||w===2&&!!T,u(k)}}}class Uq{constructor(){this.map=[]}add(e,n,r){Jq(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 Jq(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 qq(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 Hq(){return{flow:{null:{name:"table",tokenize:Kq,resolveAll:Gq}}}}function Kq(t,e,n){const r=this;let i=0,s=0,o;return u;function u(q){let ue=r.events.length-1;for(;ue>-1;){const Ee=r.events[ue][1].type;if(Ee==="lineEnding"||Ee==="linePrefix")ue--;else break}const ae=ue>-1?r.events[ue][1].type:null,Se=ae==="tableHead"||ae==="tableRow"?C:c;return Se===C&&r.parser.lazy[r.now().line]?n(q):Se(q)}function c(q){return t.enter("tableHead"),t.enter("tableRow"),h(q)}function h(q){return q===124||(o=!0,s+=1),d(q)}function d(q){return q===null?n(q):we(q)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(q),t.exit("lineEnding"),b):n(q):Ye(q)?We(t,d,"whitespace")(q):(s+=1,o&&(o=!1,i+=1),q===124?(t.enter("tableCellDivider"),t.consume(q),t.exit("tableCellDivider"),o=!0,d):(t.enter("data"),g(q)))}function g(q){return q===null||q===124||tt(q)?(t.exit("data"),d(q)):(t.consume(q),q===92?y:g)}function y(q){return q===92||q===124?(t.consume(q),g):g(q)}function b(q){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(q):(t.enter("tableDelimiterRow"),o=!1,Ye(q)?We(t,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):k(q))}function k(q){return q===45||q===58?N(q):q===124?(o=!0,t.enter("tableCellDivider"),t.consume(q),t.exit("tableCellDivider"),w):z(q)}function w(q){return Ye(q)?We(t,N,"whitespace")(q):N(q)}function N(q){return q===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(q),t.exit("tableDelimiterMarker"),T):q===45?(s+=1,T(q)):q===null||we(q)?H(q):z(q)}function T(q){return q===45?(t.enter("tableDelimiterFiller"),F(q)):z(q)}function F(q){return q===45?(t.consume(q),F):q===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(q),t.exit("tableDelimiterMarker"),V):(t.exit("tableDelimiterFiller"),V(q))}function V(q){return Ye(q)?We(t,H,"whitespace")(q):H(q)}function H(q){return q===124?k(q):q===null||we(q)?!o||i!==s?z(q):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(q)):z(q)}function z(q){return n(q)}function C(q){return t.enter("tableRow"),_(q)}function _(q){return q===124?(t.enter("tableCellDivider"),t.consume(q),t.exit("tableCellDivider"),_):q===null||we(q)?(t.exit("tableRow"),e(q)):Ye(q)?We(t,_,"whitespace")(q):(t.enter("data"),U(q))}function U(q){return q===null||q===124||tt(q)?(t.exit("data"),_(q)):(t.consume(q),q===92?$:U)}function $(q){return q===92||q===124?(t.consume(q),U):U(q)}}function Gq(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 Uq;for(;++n<t.length;){const b=t[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(u=!1,c!==0&&(WN(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=Fd(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=Fd(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=Fd(y,e,s,i,n,g)):o[1]!==0&&(g=Fd(y,e,o,i,n,g)),i=0):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&WN(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=qq(e.events,n))}return t}function Fd(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Nu(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=Nu(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=Nu(e.events,n[2]),d=Nu(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,w=n[3]-n[2]-1;t.add(k,w,[])}}t.add(n[3]+1,0,[["exit",g,e]])}return i!==void 0&&(s.end=Object.assign({},Nu(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function WN(t,e,n,r,i){const s=[],o=Nu(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 Nu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Yq={name:"tasklistCheck",tokenize:Xq};function Wq(){return{text:{91:Yq}}}function Xq(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 tt(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 we(c)?e(c):Ye(c)?t.check({tokenize:Qq},e,n)(c):n(c)}}function Qq(t,e,n){return We(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function Zq(t){return gS([wq(),_q(),$q(t),Hq(),Wq()])}const eH={};function tH(t){const e=this,n=t||eH,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Zq(n)),s.push(Sq()),o.push(vq(n))}function $e(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var ok=Zh("strike_through");$e(ok,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var cp=Ku("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(ok.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")}}}));$e(cp.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});$e(cp.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Gg=qe("ToggleStrikeThrough",t=>()=>Tg(cp.type(t)));$e(Gg,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var MI=Cr(t=>Yh(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),cp.type(t)));$e(MI,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var lk=Br("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(kt);return()=>e.call(Gg.key)}}});$e(lk.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});$e(lk.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var fp=O$({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),_s=an("table",()=>({...fp.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()}}}));$e(_s.node,{displayName:"NodeSchema<table>",group:"Table"});$e(_s.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var hp=an("table_header_row",()=>({...fp.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())}}}));$e(hp.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});$e(hp.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Xu=an("table_row",()=>({...fp.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())}}}));$e(Xu.node,{displayName:"NodeSchema<tableRow>",group:"Table"});$e(Xu.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var pp=an("table_cell",()=>({...fp.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()}}}));$e(pp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});$e(pp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var $u=an("table_header",()=>({...fp.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()}}}));$e($u.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});$e($u.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function OI(t,e=3,n=3){const r=Array(n).fill(0).map(()=>pp.type(t).createAndFill()),i=Array(n).fill(0).map(()=>$u.type(t).createAndFill()),s=Array(e).fill(0).map((o,u)=>u===0?hp.type(t).create(null,i):Xu.type(t).create(null,r));return _s.type(t).create(null,s)}function RI(t){return(e,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),s=Z7(c=>c.type.name==="table")(i),o=s?{node:s.node,from:s.start}:void 0,u=t==="row";if(o){const c=Ct.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?zt.rowSelection:zt.colSelection,y=c.positionAt(u?e:0,u?0:e,o.node),b=r.doc.resolve(o.from+y);return qO(r.setSelection(g(d,b)))}}return r}}var nH=RI("row"),rH=RI("col");function DI(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 pp.type(t).createAndFill({alignment:d?.attrs.alignment})});return e.insert(o,Xu.type(t).create(null,u)),e}function iH(t){const e=op(t.$from);if(!e)return;const n=Ct.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 sH(t){const e=iH(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 qO(t.setSelection(new zt(i,n)))}}return t}var uk=qe("GoToPrevTableCell",()=>()=>BD(-1));$e(uk,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var ck=qe("GoToNextTableCell",()=>()=>BD(1));$e(ck,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var fk=qe("ExitTable",t=>()=>(e,n)=>{if(!pi(e))return!1;const{$head:r}=e.selection,i=Q7(r,_s.type(t));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,Ji.type(t).createAndFill());return o.setSelection(Pe.near(o.doc.resolve(s),1)).scrollIntoView(),n?.(o),!0});$e(fk,{displayName:"Command<breakTableCommand>",group:"Table"});var hk=qe("InsertTable",t=>({row:e,col:n}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:u}=s,c=OI(t,e,n),h=o.replaceSelectionWith(c),d=Pe.findFrom(h.doc.resolve(u),1,!0);return d&&h.setSelection(d),i?.(h),!0});$e(hk,{displayName:"Command<insertTableCommand>",group:"Table"});var II=qe("MoveRow",()=>({from:t,to:e,pos:n}={})=>iU({from:t??0,to:e??0,pos:n}));$e(II,{displayName:"Command<moveRowCommand>",group:"Table"});var _I=qe("MoveCol",()=>({from:t,to:e,pos:n}={})=>sU({from:t??0,to:e??0,pos:n}));$e(_I,{displayName:"Command<moveColCommand>",group:"Table"});var LI=qe("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(nH(t.index,t.pos)(r))});$e(LI,{displayName:"Command<selectRowCommand>",group:"Table"});var zI=qe("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(rH(t.index,t.pos)(r))});$e(zI,{displayName:"Command<selectColCommand>",group:"Table"});var BI=qe("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!e?.(sH(n))});$e(BI,{displayName:"Command<selectTableCommand>",group:"Table"});var VI=qe("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof zt))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?rU(t,e):i?X$(t,e):Z$(t,e)});$e(VI,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var FI=qe("AddColBefore",()=>()=>G$);$e(FI,{displayName:"Command<addColBeforeCommand>",group:"Table"});var PI=qe("AddColAfter",()=>()=>Y$);$e(PI,{displayName:"Command<addColAfterCommand>",group:"Table"});var jI=qe("AddRowBefore",t=>()=>(e,n)=>{if(!pi(e))return!1;if(n){const r=to(e);n(DI(t,e.tr,r,r.top))}return!0});$e(jI,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var $I=qe("AddRowAfter",t=>()=>(e,n)=>{if(!pi(e))return!1;if(n){const r=to(e);n(DI(t,e.tr,r,r.bottom))}return!0});$e($I,{displayName:"Command<addRowAfterCommand>",group:"Table"});var UI=qe("SetAlign",()=>(t="left")=>eU("alignment",t));$e(UI,{displayName:"Command<setAlignCommand>",group:"Table"});var JI=Cr(t=>new zr(/^\|(?<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=OI(t,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),u=e.tr.replaceRangeWith(r,i,o);return u.setSelection(Oe.create(u.doc,r+3)).scrollIntoView()}));$e(JI,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var qI=dP(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 Ji.type(t).create();const y=h.firstChild;if(!(g>0&&y&&y.childCount===0))return h;if(d>=3){const N=h.child(1),T=[];for(let H=0;H<N.childCount;H++){const z=N.child(H);T.push($u.type(t).create(z.attrs,z.content,z.marks))}const F=y.type.create(y.attrs,T),V=[];for(let H=2;H<d;H++)V.push(h.child(H));return h.type.create(h.attrs,[F,...V])}const b=Array(g).fill(0).map(()=>$u.type(t).createAndFill()),k=new G(W.from(b),0,0),w=y.replace(0,0,k);return h.replace(0,y.nodeSize,new G(W.from(w),0,0))}function s(h){const d=Xu.type(t),g=[];let y=[],b=!1;function k(){if(y.length===0)return;const w=hp.type(t).createAndFill(),N=_s.type(t).create(null,[w,...y]);g.push(i(N)),y=[]}return h.forEach(w=>{w.type===d?(b=!0,y.push(w)):(k(),g.push(w))}),k(),b?W.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?W.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===Ji.type(t)&&b.content.size===0&&k&&k.type===_s.type(t)||d.push(b)}return d.length<g.length?W.from(d):h}let c=o(e.content);return c=u(c),new G(W.from(c),e.openStart,e.openEnd)}}));$e(qI,{displayName:"PasteRule<table>",group:"Table"});var pk=Br("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(kt);return()=>e.call(ck.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(kt);return()=>e.call(uk.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(kt);return()=>e.call(fk.key)}}});$e(pk.ctx,{displayName:"KeymapCtx<table>",group:"Table"});$e(pk.shortcuts,{displayName:"Keymap<table>",group:"Table"});var f1="footnote_definition",XN="footnoteDefinition",dk=an("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${f1}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Gi(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":f1},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===XN,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===f1,runner:(t,e)=>{t.openNode(XN,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));$e(dk.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});$e(dk.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var h1="footnote_reference",mk=an("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${h1}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Gi(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":h1},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===h1,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));$e(mk.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});$e(mk.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var gk=$s.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 Gi(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()}}}});$e(gk.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});$e(gk.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var HI=Cr(()=>new zr(/^\[(?<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}));$e(HI,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var aH=[lk,pk].flat(),oH=[JI,HI],lH=[MI],uH=[qI],KI=js(()=>wJ);$e(KI,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var cH=js(()=>mU({}));$e(cH,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var GI=js(()=>EU({allowTableNodeSelection:!0}));$e(GI,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var yk=hi("remarkGFM",()=>tH);$e(yk.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});$e(yk.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var fH=new kr("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function hH(t,e){let n=0;return e.forEach((r,i,s)=>{r===t&&(n=s)}),n}var YI=js(()=>new vr({key:fH,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=hH(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}}));$e(YI,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var pH=[YI,KI,yk,GI].flat(),dH=[gk,_s,hp,Xu,$u,pp,dk,mk,ok,cp].flat(),mH=[ck,uk,fk,hk,II,_I,LI,zI,BI,VI,jI,$I,FI,PI,UI,Gg],WI=[dH,oH,uH,lH,aH,mH,pH].flat();const xk={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},ng={flex:1,border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 8px",font:"inherit",outline:"none",minWidth:0},Iu={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},gH=xk,yH=ng,p1=Iu;function xH({initialUrl:t,isEdit:e,onApply:n,onRemove:r,onClose:i}){const[s,o]=ee.useState(t),u=()=>{const c=s.trim();c!==""&&n(c)};return O.jsxs("div",{style:gH,"data-mdx-action":"link",onMouseDown:c=>c.stopPropagation(),children:[O.jsx("input",{style:yH,autoFocus:!0,placeholder:"https://…",value:s,onChange:c=>o(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u()),c.key==="Escape"&&i()}}),O.jsx("button",{type:"button",style:{...p1,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:c=>c.preventDefault(),onClick:u,children:e?"Update":"Add"}),e&&r?O.jsx("button",{type:"button",style:{...p1,color:"#dc2626"},onMouseDown:c=>c.preventDefault(),onClick:r,children:"Remove"}):null,O.jsx("button",{type:"button",style:p1,onMouseDown:c=>c.preventDefault(),onClick:i,children:"Cancel"})]})}const bH={...xk,flexWrap:"wrap"},QN={display:"flex",alignItems:"center",gap:6,flex:"1 1 180px",minWidth:0},ZN={fontSize:11,color:"#71717a",whiteSpace:"nowrap"},SH={display:"flex",gap:6,marginLeft:"auto"},vH={width:48,height:48,objectFit:"contain",border:"1px solid #e4e4e7",borderRadius:4,background:"#fafafa",flexShrink:0};function eT({mode:t,initialAlt:e,initialCaption:n,previewSrc:r,onReplace:i,onApply:s,onClose:o}){const[u,c]=ee.useState(e),[h,d]=ee.useState(n),g=()=>s(u.trim(),h.trim()),y=b=>{b.key==="Enter"&&(b.preventDefault(),g()),b.key==="Escape"&&o()};return O.jsxs("div",{style:bH,"data-mdx-action":"image",onMouseDown:b=>b.stopPropagation(),children:[r!==""?O.jsx("img",{src:r,alt:"",style:vH,"data-mdx-image-preview":""}):null,i?O.jsx("button",{type:"button",style:Iu,onMouseDown:b=>b.preventDefault(),onClick:i,children:"Replace image"}):null,O.jsxs("label",{style:QN,children:[O.jsx("span",{style:ZN,children:"Alt"}),O.jsx("input",{style:ng,autoFocus:!0,placeholder:"Alt text for screen readers",value:u,onChange:b=>c(b.currentTarget.value),onKeyDown:y})]}),O.jsxs("label",{style:QN,children:[O.jsx("span",{style:ZN,children:"Caption"}),O.jsx("input",{style:ng,placeholder:"Caption / source (optional)",value:h,onChange:b=>d(b.currentTarget.value),onKeyDown:y})]}),O.jsxs("div",{style:SH,children:[O.jsx("button",{type:"button",style:{...Iu,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:b=>b.preventDefault(),onClick:g,children:t==="insert"?"Insert":"Save"}),O.jsx("button",{type:"button",style:Iu,onMouseDown:b=>b.preventDefault(),onClick:o,children:"Cancel"})]})]})}const kH={display:"flex",gap:16,padding:16,overflowY:"auto"},CH={width:220,height:220,flexShrink:0,objectFit:"contain",border:"1px solid #e4e4e7",borderRadius:8,background:"#fafafa"},wH={display:"flex",flexDirection:"column",gap:8,flex:1,minWidth:0},EH={border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},XI={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46"},AH={...XI,background:"#2563eb",border:"1px solid #2563eb",color:"#fff"};function NH({item:t,save:e,onSaved:n,onCancel:r}){const[i,s]=ee.useState(t.annotation??""),[o,u]=ee.useState(!1),[c,h]=ee.useState(null),d=async()=>{if(o)return;const g=i.trim();u(!0),h(null);try{const y=await e(g);if(y.success){n(g);return}h(y.error??"Failed to save the alt text")}catch(y){h(y instanceof Error?y.message:"Failed to save the alt text")}u(!1)};return O.jsxs("div",{style:kH,"data-cms-media-annotation":t.id,children:[O.jsx("img",{src:t.thumbnailUrl??t.url,alt:"",style:CH}),O.jsxs("div",{style:wH,children:[O.jsx("strong",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.filename,children:t.filename}),O.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,color:"#52525b"},children:["Default alt text",O.jsx("input",{style:EH,autoFocus:!0,placeholder:"Describe the image for screen readers",value:i,disabled:o,onChange:g=>s(g.currentTarget.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),d()),g.key==="Escape"&&r()}})]}),O.jsx("div",{style:{fontSize:12,color:"#71717a"},children:"Prefilled as the alt text when this image is inserted. Images already in the content keep their own."}),c?O.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:c}):null,O.jsxs("div",{style:{display:"flex",gap:8},children:[O.jsx("button",{type:"button",style:AH,disabled:o,onClick:()=>{d()},children:o?"Saving…":"Save"}),O.jsx("button",{type:"button",style:XI,disabled:o,onClick:r,children:"Cancel"})]})]})]})}function tT(t){return typeof t!="object"||t===null?!1:"status"in t&&t.status===501||"code"in t&&t.code==="unsupported"}const nT=60,TH=200,MH=200;function rT(t,e){return{folder:t,type:e,cursor:void 0,seen:new Set,pages:0,busy:!1,failed:!1}}function OH(t,e){if(!t.hasMore)return{cursor:void 0,stalled:!1};const n=t.cursor;return n===void 0||e.seen.has(n)||e.pages>=MH?{cursor:void 0,stalled:!0}:(e.seen.add(n),{cursor:n,stalled:!1})}function RH(t,e){if(e.length===0)return t;const n=new Map(t.map(i=>[i.path,i]));let r=!1;for(const i of e)n.has(i.path)||(n.set(i.path,i),r=!0);return r?[...n.values()].sort((i,s)=>i.name.localeCompare(s.name)):t}const DH=[{value:"all",label:"All"},{value:"photo",label:"Photos"},{value:"graphic",label:"Graphics"},{value:"video",label:"Videos"},{value:"document",label:"Documents"}],IH={position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100},_H={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"},LH={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #ececed"},zH={display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",borderBottom:"1px solid #ececed"},Zc={display:"flex",alignItems:"center",gap:8},iT={flex:1,border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},Do={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},sT={...Do,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},BH={display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gridAutoRows:"max-content",gap:10,padding:16,overflowY:"auto"},VH={position:"relative"},aT={position:"relative",width:"100%",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},FH={position:"absolute",top:6,right:6,border:"1px solid #d4d4d8",background:"rgba(255,255,255,0.92)",borderRadius:4,padding:"1px 6px",font:"inherit",fontSize:11,color:"#3f3f46",cursor:"pointer"},oT={padding:32,textAlign:"center",color:"#a1a1aa"},PH={display:"flex",alignItems:"center",justifyContent:"center",gap:8,padding:"8px 16px",borderTop:"1px solid #ececed",fontSize:12,color:"#71717a"},jH={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 QI({media:t,context:e,field:n,accept:r=`image/*,application/pdf,${QT}`,onSelect:i,onClose:s}){const[o,u]=ee.useState([]),[c,h]=ee.useState([]),[d,g]=ee.useState(""),[y,b]=ee.useState(""),[k,w]=ee.useState("all"),[N,T]=ee.useState(!1),[F,V]=ee.useState(!1),[H,z]=ee.useState(!1),[C,_]=ee.useState(!1),[U,$]=ee.useState(!1),[q,ue]=ee.useState(0),[ae,Se]=ee.useState(!1),[Ee,Y]=ee.useState(!1),[X,le]=ee.useState(null),[Ce,_e]=ee.useState(!1),[j,P]=ee.useState(""),[te,L]=ee.useState(null),xe=ee.useRef(null),Te=ee.useRef(rT("","all")),Ae=ee.useRef(!0);ee.useEffect(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const He=ee.useCallback(async(he,je=nT)=>{if(he.busy||Te.current!==he)return;const Dt=he.pages===0;he.busy=!0,he.failed=!1,Dt?T(!0):V(!0),le(null);try{const mt=await t.listMedia({folder:he.folder||void 0,limit:je,cursor:he.cursor,type:he.type});if(!Ae.current||Te.current!==he)return;he.pages+=1,ue(mn=>mn+1),_(mt.appliedType===he.type),$(mt.appliedType===he.type&&mt.items.length<je),h(mn=>RH(mn,mt.folders)),u(mn=>Dt?mt.items:[...mn,...mt.items]);const Be=OH(mt,he);he.cursor=Be.cursor,z(Be.cursor!==void 0),Be.stalled&&le("Stopped loading this folder early — some files are not shown.")}catch(mt){if(!Ae.current||Te.current!==he)return;he.failed=!0,tT(mt)?(Se(!0),z(!1)):le(mt instanceof Error?mt.message:"Failed to load media")}finally{he.busy=!1,Ae.current&&Te.current===he&&(T(!1),V(!1))}},[t]);ee.useEffect(()=>{const he=rT(d,k);Te.current=he,u([]),h([]),z(!1),_(!1),$(!1),He(he)},[d,k,He]);const pt=y.trim().toLowerCase(),Ke=pt!==""||k!=="all",Ot=Ke&&(pt!==""||k!=="all"&&!C);ee.useEffect(()=>{if(!Ot&&!U)return;const he=Te.current;he.busy||he.failed||he.cursor===void 0||He(he,Ot?TH:nT)},[Ot,U,q,He]);const ar=he=>{b(""),g(he)},or=async he=>{Y(!0),le(null);try{const je=await t.uploadMedia(he,{...e,field:n,folder:d||void 0});if(je.success&&je.url){if(je.url.startsWith("./")){i(je.url,je.annotation??"",je.annotation);return}const Dt={id:je.id??je.url,url:je.url,filename:je.filename??he.name,annotation:je.annotation,annotationEditable:je.annotationEditable,contentType:he.type||"application/octet-stream",folder:d||void 0};u(mt=>[Dt,...mt])}else le(je.error??"Upload failed")}catch(je){tT(je)?Se(!0):le(je instanceof Error?je.message:"Upload failed")}finally{Y(!1)}},fn=async()=>{const he=j.trim();if(!he||!t.createFolder)return;if(/[/\\:*?"<>|]/.test(he)){le("Invalid folder name");return}const je=d?`${d}/${he}`:he;try{const Dt=await t.createFolder(je);Dt.success?h(mt=>[...mt,{name:he,path:je}].sort((Be,mn)=>Be.name.localeCompare(mn.name))):le(Dt.error??"Failed to create folder")}catch(Dt){le(Dt instanceof Error?Dt.message:"Failed to create folder")}P(""),_e(!1)},hn=t.updateMediaAnnotation?.bind(t),lr=(he,je)=>{u(Dt=>Dt.map(mt=>mt.id===he?{...mt,annotation:je}:mt)),L(null)},pn=ee.useMemo(()=>{const he=AL(o,k);return pt===""?he:he.filter(je=>je.filename.toLowerCase().includes(pt))},[o,k,pt]),dn=ee.useMemo(()=>{if(!d)return[];const he=d.split("/");return he.map((je,Dt)=>({name:je,path:he.slice(0,Dt+1).join("/")}))},[d]),ur=Ke?[]:c;return O.jsx("div",{style:IH,onMouseDown:s,"data-cms-ui":"",children:O.jsxs("div",{style:_H,onMouseDown:he=>he.stopPropagation(),onDrop:he=>{he.preventDefault();const je=he.dataTransfer.files[0];je&&or(je)},onDragOver:he=>he.preventDefault(),children:[O.jsxs("div",{style:LH,children:[O.jsx("strong",{style:{fontSize:15},children:"Media Library"}),O.jsx("button",{type:"button",style:{...Do,border:"none",fontSize:18,lineHeight:1,padding:2},onClick:s,"aria-label":"Close",children:"×"})]}),O.jsxs("div",{style:zH,children:[dn.length>0?O.jsxs("div",{style:{...Zc,gap:4,fontSize:12,color:"#71717a"},children:[O.jsx("button",{type:"button",style:{...Do,border:"none",padding:"0 2px"},onClick:()=>ar(""),children:"root"}),dn.map((he,je)=>O.jsxs("span",{style:Zc,children:[O.jsx("span",{children:"/"}),je===dn.length-1?O.jsx("span",{style:{color:"#27272a",fontWeight:600},children:he.name}):O.jsx("button",{type:"button",style:{...Do,border:"none",padding:"0 2px"},onClick:()=>ar(he.path),children:he.name})]},he.path))]}):null,O.jsxs("div",{style:Zc,children:[O.jsx("input",{style:iT,placeholder:"Search files…",value:y,onChange:he=>b(he.target.value)}),t.createFolder?O.jsx("button",{type:"button",style:Do,onClick:()=>_e(he=>!he),children:"New folder"}):null,O.jsx("button",{type:"button",style:sT,disabled:ae||Ee,onClick:()=>xe.current?.click(),children:Ee?"Uploading…":"Upload"}),O.jsx("input",{ref:xe,type:"file",accept:r,style:{display:"none"},onChange:he=>{const je=he.target.files?.[0];je&&or(je),he.target.value=""}})]}),O.jsx("div",{style:{...Zc,gap:4},children:DH.map(he=>O.jsx("button",{type:"button",style:{...Do,padding:"3px 10px",fontSize:12,...k===he.value?{background:"#2563eb",border:"1px solid #2563eb",color:"#fff"}:{}},onClick:()=>w(he.value),children:he.label},he.value))}),Ce&&t.createFolder?O.jsxs("div",{style:Zc,children:[O.jsx("input",{style:iT,autoFocus:!0,placeholder:"Folder name…",value:j,onChange:he=>P(he.target.value),onKeyDown:he=>{he.key==="Enter"&&fn(),he.key==="Escape"&&(_e(!1),P(""))}}),O.jsx("button",{type:"button",style:sT,onClick:()=>{fn()},children:"Create"})]}):null,ae?O.jsx("div",{style:{fontSize:12,color:"#a16207"},children:"Media uploads are not configured for this project."}):null,X?O.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:X}):null]}),te&&hn?O.jsx(NH,{item:te,save:he=>hn(te.id,he),onSaved:he=>lr(te.id,he),onCancel:()=>L(null)}):N?O.jsx("div",{style:oT,children:"Loading…"}):ur.length===0&&pn.length===0?O.jsx("div",{style:oT,children:F?Ke?"Searching…":"Loading…":Ke&&H?"No matches loaded yet.":Ke?"No matching files.":"No files yet. Upload one to get started."}):O.jsxs("div",{style:BH,children:[ur.map(he=>O.jsxs("button",{type:"button",style:aT,onClick:()=>ar(he.path),title:he.name,"data-cms-media-folder":he.path,children:[O.jsx("span",{style:{fontSize:30},children:"📁"}),O.jsx("span",{style:{fontSize:12,color:"#52525b",maxWidth:"90%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:he.name})]},he.path)),pn.map(he=>O.jsxs("div",{style:VH,children:[O.jsxs("button",{type:"button",style:aT,title:he.filename,"data-cms-media-item":he.id,onClick:()=>i(he.url,he.annotation??(he.filename||"Image"),he.annotation),children:[he.contentType.startsWith("image/")?O.jsx("img",{src:he.thumbnailUrl??he.url,alt:he.annotation||he.filename,style:{width:"100%",height:"100%",objectFit:"contain"}}):he.contentType.startsWith("video/")?O.jsx("video",{src:he.thumbnailUrl??he.url,muted:!0,playsInline:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"contain",background:"#000"}}):O.jsx("span",{style:{fontSize:30},children:he.contentType==="application/pdf"?"📄":"📎"}),O.jsx("span",{style:jH,children:he.filename})]}),he.annotationEditable&&hn&&he.contentType.startsWith("image/")?O.jsx("button",{type:"button",style:FH,title:"Edit the default alt text","data-cms-media-alt":he.id,onClick:()=>L(he),children:"Alt"}):null]},he.id))]}),!N&&!te&&H?O.jsx("div",{style:PH,children:F?O.jsx("span",{children:Ot?`Searching the whole folder… ${o.length} files scanned`:Ke?"Searching…":"Loading…"}):O.jsx("button",{type:"button",style:Do,onClick:()=>{He(Te.current)},children:"Load more"})}):null,O.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 $H=/^(https?:)?\/\/|^data:/i;function sS(t,e,n){if(e==="")return"";if($H.test(e))return e;if(e.startsWith("/"))return t?.mediaAssetUrl?.(e)??e;const r=n?.collection,i=n?.entry;return r===void 0||i===void 0?"":t?.mediaFileUrl?.(r,i,e)??""}const aS={bold:!1,italic:!1,strikethrough:!1,link:!1,linkHref:null,bulletList:!1,orderedList:!1,listStyle:null,blockquote:!1,heading:null,image:null};function UH(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 T of N.marks)T.type.name==="strong"&&(s=!0),T.type.name==="emphasis"&&(o=!0),T.type.name==="strike_through"&&(u=!0),T.type.name==="link"&&(c=!0,h=typeof T.attrs.href=="string"?T.attrs.href:null)});let g=!1,y=!1,b=null,k=!1,w=null;for(let N=n.depth;N>0;N--){const T=n.node(N);(T.type.name==="bullet_list"||T.type.name==="ordered_list")&&(T.type.name==="bullet_list"&&(g=!0),T.type.name==="ordered_list"&&(y=!0),b===null&&(b=typeof T.attrs.listStyle=="string"?T.attrs.listStyle:null)),T.type.name==="blockquote"&&(k=!0)}if(n.parent.type.name==="heading"){const N=n.parent.attrs.level;w=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:w,image:JH(t)}}function JH(t){const{doc:e,selection:n}=t.state,r=e.nodeAt(n.from);return r===null||r.type.name!=="image"||n.to-n.from!==r.nodeSize?null:{pos:n.from,src:vm(r.attrs.src),alt:vm(r.attrs.alt),title:vm(r.attrs.title)}}function vm(t){return typeof t=="string"?t:""}function qH(t,e,n){const r=t.state.doc.nodeAt(e.pos);if(r===null||r.type.name!=="image"||vm(r.attrs.src)!==e.src)return!1;const i=t.state.tr.setNodeAttribute(e.pos,"src",n.src).setNodeAttribute(e.pos,"alt",n.alt).setNodeAttribute(e.pos,"title",n.title);return t.dispatch(i),!0}function HH(t,e){return t===null||e===null?t===e:t.pos===e.pos&&t.src===e.src&&t.alt===e.alt&&t.title===e.title}function KH(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 GH(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 YH(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 WH(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&&HH(t.image,e.image)}function XH(t,e){let n=0,r=aS;const i=()=>{const u=t.ctx.get(rn),c=UH(u);WH(c,r)||(r=c,e(c))},s=t.ctx.get(rn),o=s.dispatch.bind(s);return s.dispatch=u=>{o(u),(u.selectionSet||u.docChanged)&&(cancelAnimationFrame(n),n=requestAnimationFrame(i))},i(),()=>{cancelAnimationFrame(n)}}const QH=["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"],lT={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 ZH(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function eK(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function uT(t){return eK(t)||ZI(t)}const tK=["","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 Yg(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 T=t.charCodeAt(s+1);if(T===9||T===10||T===12||T===32||T===38||T===60||Number.isNaN(T)||r&&T===r){u+=String.fromCharCode(b),g++;continue}const F=s+1;let V=F,H=F,z;if(T===35){H=++V;const Se=t.charCodeAt(H);Se===88||Se===120?(z="hexadecimal",H=++V):z="decimal"}else z="named";let C="",_="",U="";const $=z==="named"?uT:z==="decimal"?ZI:ZH;for(H--;++H<=t.length;){const Se=t.charCodeAt(H);if(!$(Se))break;U+=String.fromCharCode(Se),z==="named"&&QH.includes(U)&&(C=U,_=ph(U))}let q=t.charCodeAt(H)===59;if(q){H++;const Se=z==="named"?ph(U):!1;Se&&(C=U,_=Se)}let ue=1+H-F,ae="";if(!(!q&&n.nonTerminated===!1))if(!U)z!=="named"&&w(4,ue);else if(z==="named"){if(q&&!_)w(5,1);else if(C!==U&&(H=V+C.length,ue=1+H-V,q=!1),!q){const Se=C?1:3;if(n.attribute){const Ee=t.charCodeAt(H);Ee===61?(w(Se,ue),_=""):uT(Ee)?_="":w(Se,ue)}else w(Se,ue)}ae=_}else{q||w(2,ue);let Se=Number.parseInt(U,z==="hexadecimal"?16:10);if(nK(Se))w(7,ue),ae="�";else if(Se in lT)w(6,ue),ae=lT[Se];else{let Ee="";rK(Se)&&w(6,ue),Se>65535&&(Se-=65536,Ee+=String.fromCharCode(Se>>>10|55296),Se=56320|Se&1023),ae=Ee+String.fromCharCode(Se)}}if(ae){N(),y=k(),s=H-1,g+=H-F+1,i.push(ae);const Se=k();Se.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,ae,{start:y,end:Se},t.slice(F-1,H)),y=Se}else U=t.slice(F-1,H),u+=U,g+=U.length,s=H-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 w(T,F){let V;n.warning&&(V=k(),V.column+=F,V.offset+=F,n.warning.call(n.warningContext||void 0,tK[T],V,T))}function N(){u&&(i.push(u),n.text&&n.text.call(n.textContext||void 0,u,{start:y,end:k()}),u="")}}function nK(t){return t>=55296&&t<=57343||t>1114111}function rK(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 iK=/["&'<>`]/g,sK=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,aK=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,oK=/[|\\{}()[\]^$+*?.]/g,cT=new WeakMap;function lK(t,e){if(t=t.replace(e.subset?uK(e.subset):iK,r),e.subset||e.escapeOnly)return t;return t.replace(sK,n).replace(aK,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 uK(t){let e=cT.get(t);return e||(e=cK(t),cT.set(t,e)),e}function cK(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(oK,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function fK(t){return"&#x"+t.toString(16).toUpperCase()+";"}function hK(t,e){return lK(t,Object.assign({format:fK},e))}function pK(){return{canContainEols:["textDirective"],enter:{directiveContainer:dK,directiveContainerAttributes:m1,directiveContainerLabel:yK,directiveLeaf:mK,directiveLeafAttributes:m1,directiveText:gK,directiveTextAttributes:m1},exit:{directiveContainer:v1,directiveContainerAttributeClassValue:y1,directiveContainerAttributeIdValue:g1,directiveContainerAttributeName:b1,directiveContainerAttributeValue:x1,directiveContainerAttributes:S1,directiveContainerLabel:xK,directiveContainerName:d1,directiveLeaf:v1,directiveLeafAttributeClassValue:y1,directiveLeafAttributeIdValue:g1,directiveLeafAttributeName:b1,directiveLeafAttributeValue:x1,directiveLeafAttributes:S1,directiveLeafName:d1,directiveText:v1,directiveTextAttributeClassValue:y1,directiveTextAttributeIdValue:g1,directiveTextAttributeName:b1,directiveTextAttributeValue:x1,directiveTextAttributes:S1,directiveTextName:d1}}}function dK(t){bk.call(this,"containerDirective",t)}function mK(t){bk.call(this,"leafDirective",t)}function gK(t){bk.call(this,"textDirective",t)}function bk(t,e){this.enter({type:t,name:"",attributes:{},children:[]},e)}function d1(t){const e=this.stack[this.stack.length-1];e.type==="containerDirective"||e.type==="leafDirective"||e.type,e.name=this.sliceSerialize(t)}function yK(t){this.enter({type:"paragraph",data:{directiveLabel:!0},children:[]},t)}function xK(t){this.exit(t)}function m1(){this.data.directiveAttributes=[],this.buffer()}function g1(t){this.data.directiveAttributes.push(["id",Yg(this.sliceSerialize(t),{attribute:!0})])}function y1(t){this.data.directiveAttributes.push(["class",Yg(this.sliceSerialize(t),{attribute:!0})])}function x1(t){const e=this.data.directiveAttributes;e[e.length-1][1]=Yg(this.sliceSerialize(t),{attribute:!0})}function b1(t){this.data.directiveAttributes.push([this.sliceSerialize(t),""])}function S1(){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 v1(t){this.exit(t)}function Sk(t,e,n,r,i,s,o,u,c,h,d,g,y,b,k){let w,N;return T;function T(Y){return t.enter(r),t.enter(i),t.consume(Y),t.exit(i),F}function F(Y){return Y===35?(w=o,V(Y)):Y===46?(w=u,V(Y)):Y===58||Y===95||cn(Y)?(t.enter(s),t.enter(c),t.consume(Y),C):k&&Ye(Y)?We(t,F,"whitespace")(Y):!k&&tt(Y)?Ts(t,F)(Y):Ee(Y)}function V(Y){const X=w+"Marker";return t.enter(s),t.enter(w),t.enter(X),t.consume(Y),t.exit(X),H}function H(Y){if(Y===null||Y===34||Y===35||Y===39||Y===46||Y===60||Y===61||Y===62||Y===96||Y===125||tt(Y))return n(Y);const X=w+"Value";return t.enter(X),t.consume(Y),z}function z(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||tt(Y)){const X=w+"Value";return t.exit(X),t.exit(w),t.exit(s),F(Y)}return t.consume(Y),z}function C(Y){return Y===45||Y===46||Y===58||Y===95||On(Y)?(t.consume(Y),C):(t.exit(c),k&&Ye(Y)?We(t,_,"whitespace")(Y):!k&&tt(Y)?Ts(t,_)(Y):_(Y))}function _(Y){return Y===61?(t.enter(h),t.consume(Y),t.exit(h),U):(t.exit(s),F(Y))}function U(Y){return Y===null||Y===60||Y===61||Y===62||Y===96||Y===125||k&&we(Y)?n(Y):Y===34||Y===39?(t.enter(d),t.enter(y),t.consume(Y),t.exit(y),N=Y,q):k&&Ye(Y)?We(t,U,"whitespace")(Y):!k&&tt(Y)?Ts(t,U)(Y):(t.enter(g),t.enter(b),t.consume(Y),N=void 0,$)}function $(Y){return Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96?n(Y):Y===125||tt(Y)?(t.exit(b),t.exit(g),t.exit(s),F(Y)):(t.consume(Y),$)}function q(Y){return Y===N?(t.enter(y),t.consume(Y),t.exit(y),t.exit(d),t.exit(s),Se):(t.enter(g),ue(Y))}function ue(Y){return Y===N?(t.exit(g),q(Y)):Y===null?n(Y):we(Y)?k?n(Y):Ts(t,ue)(Y):(t.enter(b),t.consume(Y),ae)}function ae(Y){return Y===N||Y===null||we(Y)?(t.exit(b),ue(Y)):(t.consume(Y),ae)}function Se(Y){return Y===125||tt(Y)?F(Y):Ee(Y)}function Ee(Y){return Y===125?(t.enter(i),t.consume(Y),t.exit(i),t.exit(r),e):n(Y)}}function vk(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 w(N);const T=t.enter("chunkText",{contentType:"text",previous:h});return h&&(h.next=T),h=T,b(N)}function b(N){return N===null||u>999||N===91&&++c>32?n(N):N===93&&!c--?(t.exit("chunkText"),w(N)):we(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 w(N){return t.exit(s),t.enter(i),t.consume(N),t.exit(i),t.exit(r),e}}function kk(t,e,n,r){const i=this;return s;function s(u){return cn(u)?(t.enter(r),t.consume(u),o):n(u)}function o(u){return u===45||u===95||On(u)?(t.consume(u),o):(t.exit(r),i.previous===45||i.previous===95?n(u):e(u))}}const bK={tokenize:kK,concrete:!0},SK={tokenize:CK,partial:!0},vK={tokenize:wK,partial:!0},Pd={tokenize:EK,partial:!0};function kK(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($){return t.enter("directiveContainer"),t.enter("directiveContainerFence"),t.enter("directiveContainerSequence"),h($)}function h($){return $===58?(t.consume($),o++,h):o<3?n($):(t.exit("directiveContainerSequence"),kk.call(r,t,d,n,"directiveContainerName")($))}function d($){return $===91?t.attempt(SK,g,g)($):g($)}function g($){return $===123?t.attempt(vK,y,y)($):y($)}function y($){return We(t,b,"whitespace")($)}function b($){return t.exit("directiveContainerFence"),$===null?_($):we($)?r.interrupt?e($):t.attempt(Pd,k,_)($):n($)}function k($){return $===null?_($):we($)?t.check(Pd,V,_)($):(t.enter("directiveContainerContent"),w($))}function w($){return t.attempt({tokenize:U,partial:!0},C,s?We(t,N,"linePrefix",s+1):N)($)}function N($){return $===null?C($):we($)?t.check(Pd,F,C)($):F($)}function T($){if($===null){const q=t.exit("chunkDocument");return r.parser.lazy[q.start.line]=!1,C($)}return we($)?t.check(Pd,H,z)($):(t.consume($),T)}function F($){const q=t.enter("chunkDocument",{contentType:"document",previous:u});return u&&(u.next=q),u=q,T($)}function V($){return t.enter("directiveContainerContent"),w($)}function H($){t.consume($);const q=t.exit("chunkDocument");return r.parser.lazy[q.start.line]=!1,w}function z($){const q=t.exit("chunkDocument");return r.parser.lazy[q.start.line]=!1,C($)}function C($){return t.exit("directiveContainerContent"),_($)}function _($){return t.exit("directiveContainer"),e($)}function U($,q,ue){let ae=0;return We($,Se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function Se(X){return $.enter("directiveContainerFence"),$.enter("directiveContainerSequence"),Ee(X)}function Ee(X){return X===58?($.consume(X),ae++,Ee):ae<o?ue(X):($.exit("directiveContainerSequence"),We($,Y,"whitespace")(X))}function Y(X){return X===null||we(X)?($.exit("directiveContainerFence"),q(X)):ue(X)}}}function CK(t,e,n){return vk(t,e,n,"directiveContainerLabel","directiveContainerLabelMarker","directiveContainerLabelString",!0)}function wK(t,e,n){return Sk(t,e,n,"directiveContainerAttributes","directiveContainerAttributesMarker","directiveContainerAttribute","directiveContainerAttributeId","directiveContainerAttributeClass","directiveContainerAttributeName","directiveContainerAttributeInitializerMarker","directiveContainerAttributeValueLiteral","directiveContainerAttributeValue","directiveContainerAttributeValueMarker","directiveContainerAttributeValueData",!0)}function EK(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 AK={tokenize:MK},NK={tokenize:OK,partial:!0},TK={tokenize:RK,partial:!0};function MK(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"),kk.call(r,t,o,n,"directiveLeafName")):n(d)}function o(d){return d===91?t.attempt(NK,u,u)(d):u(d)}function u(d){return d===123?t.attempt(TK,c,c)(d):c(d)}function c(d){return We(t,h,"whitespace")(d)}function h(d){return d===null||we(d)?(t.exit("directiveLeaf"),e(d)):n(d)}}function OK(t,e,n){return vk(t,e,n,"directiveLeafLabel","directiveLeafLabelMarker","directiveLeafLabelString",!0)}function RK(t,e,n){return Sk(t,e,n,"directiveLeafAttributes","directiveLeafAttributesMarker","directiveLeafAttribute","directiveLeafAttributeId","directiveLeafAttributeClass","directiveLeafAttributeName","directiveLeafAttributeInitializerMarker","directiveLeafAttributeValueLiteral","directiveLeafAttributeValue","directiveLeafAttributeValueMarker","directiveLeafAttributeValueData",!0)}const DK={tokenize:zK,previous:LK},IK={tokenize:BK,partial:!0},_K={tokenize:VK,partial:!0};function LK(t){return t!==58||this.events[this.events.length-1][1].type==="characterEscape"}function zK(t,e,n){const r=this;return i;function i(c){return t.enter("directiveText"),t.enter("directiveTextMarker"),t.consume(c),t.exit("directiveTextMarker"),kk.call(r,t,s,n,"directiveTextName")}function s(c){return c===58?n(c):c===91?t.attempt(IK,o,o)(c):o(c)}function o(c){return c===123?t.attempt(_K,u,u)(c):u(c)}function u(c){return t.exit("directiveText"),e(c)}}function BK(t,e,n){return vk(t,e,n,"directiveTextLabel","directiveTextLabelMarker","directiveTextLabelString")}function VK(t,e,n){return Sk(t,e,n,"directiveTextAttributes","directiveTextAttributesMarker","directiveTextAttribute","directiveTextAttributeId","directiveTextAttributeClass","directiveTextAttributeName","directiveTextAttributeInitializerMarker","directiveTextAttributeValueLiteral","directiveTextAttributeValue","directiveTextAttributeValueMarker","directiveTextAttributeValueData")}function FK(){return{text:{58:DK},flow:{58:[bK,AK]}}}const rg="youtube";function PK(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 e_=Hu("youtube",()=>({group:"block",atom:!0,isolating:!0,selectable:!0,draggable:!1,attrs:{videoId:{default:""}},toDOM:t=>["div",{"data-youtube":t.attrs.videoId,class:"youtube-block"}],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===rg,runner:(t,e,n)=>{const r=PK(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:rg,attributes:{id:e.attrs.videoId}})}}}));function jK(t){const e=t.attributes,n=e&&typeof e=="object"?String(e.id??""):"";return`::${rg}{#${n}}`}const $K=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{leafDirective:jK}};t.push(e),this.data("toMarkdownExtensions",t)},UK=hi("remarkYoutubeDirective",()=>$K),t_=qe("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}),oS="list",JK=/^[A-Za-z0-9_-]+$/,qK=new Set(["textDirective","leafDirective","containerDirective"]);function ji(t){if(typeof t!="string")return null;const[e]=t.trim().split(/\s+/);return!e||!JK.test(e)?null:e}function Ls(t){return Array.isArray(t?.children)?t.children:null}function k1(t){const e=Ls(t);return e&&e.length>0?e[e.length-1]:void 0}function n_(t){return!t.attributes||typeof t.attributes!="object"||Array.isArray(t.attributes)?null:t.attributes}function HK(t){return ji(n_(t)?.class)}function r_(t,e){const n=Ls(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 KK(t){if(!r_(t))return null;const e=Ls(t)?.[0];return typeof e?.value!="string"?null:/^:::list\{\.([A-Za-z0-9_-]+)\}$/.exec(e.value)?.[1]??null}function fT(t){return t?.type==="list"}function GK(t,e,n){if(r_(e[n],":::"))return e.splice(n,1),!0;const r=k1(t),i=k1(r);if(!i||i.type!=="paragraph")return!1;const s=Ls(i),o=k1(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&&Ls(r)?.pop(),!0}function YK(t){return t==="containerDirective"?":::":t==="leafDirective"?"::":":"}function WK(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 ef(t){return{type:"text",value:t}}function XK(t){const e=YK(t.type),n=typeof t.name=="string"?t.name:"",r=Ls(t)??[],i=WK(t.attributes);if(t.type==="textDirective"){const o=[ef(`${e}${n}`)];return r.length>0&&o.push(ef("["),...r,ef("]")),i&&o.push(ef(i)),o}return[{type:"paragraph",children:[ef(`${e}${n}${i}`)]},...r]}function i_(t){const e=Ls(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===oS?HK(o):null,c=Ls(o),h=c?.length===1?c[0]:void 0;if(u&&fT(h)){e[n]={...h,listStyle:u};continue}}const i=KK(r),s=e[n+1];if(i&&fT(s)&&GK(s,e,n+2)){e.splice(n,1),e[n]={...s,listStyle:i};continue}if(i_(r),qK.has(r.type)){if(r.name===rg)continue;const o=r.type==="containerDirective"&&r.name===oS?Ls(r)??[]:XK(r);e.splice(n,1,...o),n+=o.length-1}}}function QK(t){return!!(t&&typeof t=="object"&&"containerFlow"in t&&typeof t.containerFlow=="function")}const ZK=(t,e,n,r)=>{if(!QK(n))return"";const i=ji(n_(t)?.class),s=n.containerFlow(t,r);return`:::list${i?`{.${i}}`:""}
|
|
59
|
-
${s}
|
|
60
|
-
:::`},eG=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{containerDirective:ZK}};return t.push(e),this.data("toMarkdownExtensions",t),n=>{i_(n)}},tG=hi("remarkListDirective",()=>eG),nG=function(){const t=this.data("micromarkExtensions")??[];t.push(FK()),this.data("micromarkExtensions",t);const e=this.data("fromMarkdownExtensions")??[];e.push(pK()),this.data("fromMarkdownExtensions",e)},rG=hi("remarkDirective",()=>nG);function s_(t){return t&&typeof t=="object"?t:{}}function iG(t){if(t)return{name:oS,attributes:{class:t}}}function a_(t,e,n){const r=ji(e.attrs.listStyle),i=iG(r);i&&t.openNode("containerDirective",void 0,i),t.openNode("list",void 0,n).next(e.content).closeNode(),i&&t.closeNode()}const sG=yl.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=s_(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?ji(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=ji(r.attrs.listStyle);return["ul",{...e.get(Vg.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:ji(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="bullet_list",runner:(r,i)=>{a_(r,i,{ordered:!1,spread:i.attrs.spread===!0})}}}}),aG=xl.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=s_(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?ji(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=ji(r.attrs.listStyle);return["ol",{...e.get(Pg.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:ji(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="ordered_list",runner:(r,i)=>{a_(r,i,{ordered:!0,start:typeof i.attrs.order=="number"?i.attrs.order:1,spread:i.attrs.spread===!0})}}}}),o_=qe("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=ji(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}),oG=[rG,tG,sG,aG,o_].flat(),lG=/^[A-Za-z0-9_-]{11}$/,uG=/(?:youtu\.be\/|\/(?:embed|shorts|v)\/)([A-Za-z0-9_-]{11})/;function cG(t){const e=t.trim();if(!e)return null;if(lG.test(e))return e;const n=/[?&]v=([A-Za-z0-9_-]{11})/.exec(e);if(n)return n[1]??null;const r=uG.exec(e);return r?r[1]??null:null}const fG={fontSize:11,color:"#dc2626",whiteSpace:"nowrap"};function hG({onApply:t,onClose:e}){const[n,r]=ee.useState(""),[i,s]=ee.useState(!1),o=()=>{const u=cG(n);if(!u){s(!0);return}t(u)};return O.jsxs("div",{style:xk,"data-mdx-action":"youtube",onMouseDown:u=>u.stopPropagation(),children:[O.jsx("input",{style:ng,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?O.jsx("span",{style:fG,children:"No video id found"}):null,O.jsx("button",{type:"button",style:{...Iu,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:u=>u.preventDefault(),onClick:o,children:"Insert"}),O.jsx("button",{type:"button",style:Iu,onMouseDown:u=>u.preventDefault(),onClick:e,children:"Cancel"})]})}function pG(t){const[e,n]=ee.useState(aS);return ee.useEffect(()=>{if(!t){n(aS);return}return XH(t,n)},[t]),e}function C1(t,e){GH(t.ctx.get(rn),e)}function hT(t,e){const n=t.ctx.get(rn);KH(n,e==="bullet"?"bullet_list":"ordered_list")?t.action(Ai($g.key)):t.action(Ai(e==="bullet"?Fg.key:jg.key))}function dG(t,e){t.ctx.get(rn).focus(),t.action(Ai(o_.key,e))}function mG(t,e,n,r){t.action(i=>{const s=i.get(rn),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 gG(t,e){t.action(Ai(t_.key,e))}const yG={flexShrink:0,position:"sticky",top:0,zIndex:1},xG={display:"flex",flexWrap:"wrap",alignItems:"center",gap:3,padding:"4px 6px",borderBottom:"1px solid #ececed",background:"#fafafa"},w1={width:1,height:18,background:"#e4e4e7",margin:"0 3px"},l_={border:"1px solid transparent",background:"transparent",borderRadius:4,padding:"2px 7px",font:"inherit",fontSize:12,lineHeight:1.4,cursor:"pointer",color:"#52525b"},bG={...l_,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},SG={border:"1px solid #d4d4d8",borderRadius:4,background:"#fff",color:"#3f3f46",font:"inherit",fontSize:12,lineHeight:1.4,padding:"2px 6px",maxWidth:150};function Jn({active:t,title:e,onClick:n,style:r,children:i}){return O.jsx("button",{type:"button",title:e,"data-mdx-action":"format",onMouseDown:s=>s.preventDefault(),onClick:n,style:{...t?bG:l_,...r},children:i})}function u_({editor:t,listStyles:e,media:n,mediaContext:r,field:i,allowImageInsert:s=!0,onInsertComponent:o}){const u=pG(t),[c,h]=ee.useState(!1),[d,g]=ee.useState(null),[y,b]=ee.useState(!1),[k,w]=ee.useState(null),[N,T]=ee.useState(null),F=t===null,V=(e?.length??0)>0,H=u.bulletList||u.orderedList,z=u.listStyle&&e?.some(ae=>ae.class===u.listStyle)?u.listStyle:"",C=ae=>{if(h(!1),!t)return;t.ctx.get(rn).focus(),t.action(Ai(u.link?av.key:sv.key,{href:ae}))},_=u.image,U=N?.image??null;ee.useEffect(()=>{U!==null&&(_===null||_.pos!==U.pos||_.src!==U.src)&&T(null)},[U,_]);const $=(ae,Se)=>{const Ee=N;if(T(null),!t||!Ee)return;const Y=t.ctx.get(rn);qH(Y,Ee.image,{src:Ee.src,alt:ae,title:Se}),Y.focus()},q=()=>{T(null),t?.ctx.get(rn).focus()},ue=()=>{if(h(!1),!t)return;const ae=t.ctx.get(rn);ae.focus(),YH(ae)};return O.jsxs("div",{style:yG,children:[O.jsxs("div",{style:xG,children:[O.jsx(Jn,{active:u.bold,title:"Bold",onClick:()=>t?.action(Ai(_g.key)),style:{fontWeight:700},children:"B"}),O.jsx(Jn,{active:u.italic,title:"Italic",onClick:()=>t?.action(Ai(Ig.key)),style:{fontStyle:"italic"},children:"I"}),O.jsx(Jn,{active:u.strikethrough,title:"Strikethrough",onClick:()=>t?.action(Ai(Gg.key)),style:{textDecoration:"line-through"},children:"S"}),O.jsx("span",{style:w1}),O.jsx(Jn,{active:u.heading===2,title:"Heading 2",onClick:()=>t&&C1(t,2),children:"H2"}),O.jsx(Jn,{active:u.heading===3,title:"Heading 3",onClick:()=>t&&C1(t,3),children:"H3"}),O.jsx(Jn,{active:u.heading===4,title:"Heading 4",onClick:()=>t&&C1(t,4),children:"H4"}),O.jsx("span",{style:w1}),O.jsx(Jn,{active:u.bulletList,title:"Bullet list",onClick:()=>t&&hT(t,"bullet"),children:"• List"}),O.jsx(Jn,{active:u.orderedList,title:"Numbered list",onClick:()=>t&&hT(t,"ordered"),children:"1. List"}),V?O.jsxs("select",{title:"List style","aria-label":"List style",disabled:F||!H,value:z,onChange:ae=>{t&&dG(t,ae.currentTarget.value||null)},style:{...SG,opacity:F||!H?.55:1,cursor:F||!H?"not-allowed":"default"},children:[O.jsx("option",{value:"",children:"Default"}),e?.map(ae=>O.jsx("option",{value:ae.class,children:ae.label},ae.class))]}):null,O.jsx(Jn,{active:u.blockquote,title:"Quote",onClick:()=>t?.action(Ai(Bg.key)),children:"❝"}),O.jsx(Jn,{title:"Insert table",onClick:()=>t?.action(Ai(hk.key,{row:3,col:3})),children:"▦ Table"}),O.jsx(Jn,{active:y,title:"Insert YouTube",onClick:()=>!F&&b(ae=>!ae),children:"YouTube"}),O.jsx("span",{style:w1}),O.jsx(Jn,{active:u.link||c,title:"Link",onClick:()=>!F&&h(ae=>!ae),children:"🔗 Link"}),n&&s?O.jsx(Jn,{title:"Insert image",onClick:()=>!F&&g("insert"),children:"🖼 Image"}):null,_?O.jsx(Jn,{active:N!==null,title:"Edit the alt text, caption or file of the selected image",onClick:()=>T({image:_,src:_.src}),children:"Edit image"}):null,o?O.jsxs(O.Fragment,{children:[O.jsx("span",{style:{flex:1}}),O.jsx(Jn,{title:"Insert component block",onClick:()=>!F&&o(),style:{border:"1px solid #d4d4d8",color:"#3f3f46"},children:"+ Component"})]}):null]}),c?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(xH,{initialUrl:u.linkHref??"https://",isEdit:u.link,onApply:C,onRemove:u.link?ue:void 0,onClose:()=>h(!1)})}):null,y?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(hG,{onApply:ae=>{b(!1),t&&gG(t,ae)},onClose:()=>b(!1)})}):null,N?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(eT,{mode:"edit",initialAlt:N.image.alt,initialCaption:N.image.title,previewSrc:sS(n,N.src,r),onReplace:n?()=>g("replace"):void 0,onApply:$,onClose:q},N.image.pos)}):null,k?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(eT,{mode:"insert",initialAlt:k.alt,initialCaption:"",previewSrc:sS(n,k.url,r),onApply:(ae,Se)=>{const{url:Ee}=k;w(null),t&&mG(t,Ee,ae,Se)},onClose:()=>w(null)})}):null,d&&n?O.jsx(QI,{media:n,context:r,field:i,accept:"image/*",onSelect:(ae,Se)=>{g(null),d==="replace"?T(Ee=>Ee&&{...Ee,src:ae}):t&&w({url:ae,alt:Se??""})},onClose:()=>g(null)}):null]})}function vG(){return{enter:{mdxFlowExpression:CG,mdxTextExpression:wG},exit:{mdxFlowExpression:pT,mdxFlowExpressionChunk:dT,mdxTextExpression:pT,mdxTextExpressionChunk:dT}}}function kG(){return{handlers:{mdxFlowExpression:mT,mdxTextExpression:mT},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function CG(t){this.enter({type:"mdxFlowExpression",value:""},t),this.buffer()}function wG(t){this.enter({type:"mdxTextExpression",value:""},t),this.buffer()}function pT(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 dT(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function mT(t,e,n){const r=t.value||"";return"{"+n.indentLines(r,function(s,o,u){return(o===0||u?"":" ")+s})+"}"}const c_=" ";function EG(){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:w,mdxJsxFlowTagAttributeValueLiteral:N,mdxJsxFlowTagAttributeValueLiteralValue:n,mdxJsxFlowTagAttributeValueExpression:T,mdxJsxFlowTagAttributeValueExpressionValue:n,mdxJsxFlowTagSelfClosingMarker:F,mdxJsxFlowTag:V,mdxJsxTextTagClosingMarker:u,mdxJsxTextTagNamePrimary:c,mdxJsxTextTagNameMember:h,mdxJsxTextTagNameLocal:d,mdxJsxTextTagExpressionAttribute:b,mdxJsxTextTagExpressionAttributeValue:n,mdxJsxTextTagAttributeNamePrimary:k,mdxJsxTextTagAttributeNameLocal:w,mdxJsxTextTagAttributeValueLiteral:N,mdxJsxTextTagAttributeValueLiteralValue:n,mdxJsxTextTagAttributeValueExpression:T,mdxJsxTextTagAttributeValueExpressionValue:n,mdxJsxTextTagSelfClosingMarker:F,mdxJsxTextTag:V}};function t(){this.buffer()}function e(_){return{line:_.line,column:_.column,offset:_.offset}}function n(_){this.config.enter.data.call(this,_),this.config.exit.data.call(this,_)}function r(_){const U={name:void 0,attributes:[],close:!1,selfClosing:!1,start:_.start,end:_.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=U,this.buffer()}function i(_){if(this.data.mdxJsxTagStack.length===0)throw new bt("Unexpected closing slash `/` in tag, expected an open tag first",{start:_.start,end:_.end},"mdast-util-mdx-jsx:unexpected-closing-slash")}function s(_){if(this.data.mdxJsxTag.close)throw new bt("Unexpected attribute in closing tag, expected the end of the tag",{start:_.start,end:_.end},"mdast-util-mdx-jsx:unexpected-attribute")}function o(_){if(this.data.mdxJsxTag.close)throw new bt("Unexpected self-closing slash `/` in closing tag, expected the end of the tag",{start:_.start,end:_.end},"mdast-util-mdx-jsx:unexpected-self-closing-slash")}function u(){const _=this.data.mdxJsxTag;_.close=!0}function c(_){const U=this.data.mdxJsxTag;U.name=this.sliceSerialize(_)}function h(_){const U=this.data.mdxJsxTag;U.name+="."+this.sliceSerialize(_)}function d(_){const U=this.data.mdxJsxTag;U.name+=":"+this.sliceSerialize(_)}function g(_){const U=this.data.mdxJsxTag;s.call(this,_),U.attributes.push({type:"mdxJsxAttribute",name:"",value:null,position:{start:e(_.start),end:void 0}})}function y(_){const U=this.data.mdxJsxTag;s.call(this,_),U.attributes.push({type:"mdxJsxExpressionAttribute",value:"",position:{start:e(_.start),end:void 0}}),this.buffer()}function b(_){const U=this.data.mdxJsxTag,$=U.attributes[U.attributes.length-1];$.type;const q=_.estree;$.value=this.resume(),$.position,$.position.end=e(_.end),q&&($.data={estree:q})}function k(_){const U=this.data.mdxJsxTag,$=U.attributes[U.attributes.length-1];$.type,$.name=this.sliceSerialize(_),$.position,$.position.end=e(_.end)}function w(_){const U=this.data.mdxJsxTag,$=U.attributes[U.attributes.length-1];$.type,$.name+=":"+this.sliceSerialize(_),$.position,$.position.end=e(_.end)}function N(_){const U=this.data.mdxJsxTag,$=U.attributes[U.attributes.length-1];$.value=Yg(this.resume(),{nonTerminated:!1}),$.position,$.position.end=e(_.end)}function T(_){const U=this.data.mdxJsxTag,$=U.attributes[U.attributes.length-1];$.type;const q={type:"mdxJsxAttributeValueExpression",value:this.resume()},ue=_.estree;ue&&(q.data={estree:ue}),$.value=q,$.position,$.position.end=e(_.end)}function F(){const _=this.data.mdxJsxTag;_.selfClosing=!0}function V(_){const U=this.data.mdxJsxTag,$=this.data.mdxJsxTagStack,q=$[$.length-1];if(U.close&&q.name!==U.name)throw new bt("Unexpected closing tag `"+C(U)+"`, expected corresponding closing tag for `"+C(q)+"` ("+Ms(q)+")",{start:_.start,end:_.end},"mdast-util-mdx-jsx:end-tag-mismatch");this.resume(),U.close?$.pop():this.enter({type:_.type==="mdxJsxTextTag"?"mdxJsxTextElement":"mdxJsxFlowElement",name:U.name||null,attributes:U.attributes,children:[]},_,H),U.selfClosing||U.close?this.exit(_,z):$.push(U)}function H(_,U){const $=this.data.mdxJsxTagStack,q=$[$.length-1],ue=_?" before the end of `"+_.type+"`":"",ae=_?{start:_.start,end:_.end}:void 0;throw new bt("Expected a closing tag for `"+C(q)+"` ("+Ms({start:U.start,end:U.end})+")"+ue,ae,"mdast-util-mdx-jsx:end-tag-mismatch")}function z(_,U){const $=this.data.mdxJsxTag;throw new bt("Expected the closing tag `"+C($)+"` either after the end of `"+U.type+"` ("+Ms(U.end)+") or another opening tag after the start of `"+U.type+"` ("+Ms(U.start)+")",{start:_.start,end:_.end},"mdast-util-mdx-jsx:end-tag-mismatch")}function C(_){return"<"+(_.close?"/":"")+(_.name||"")+">"}}function AG(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=TG,{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=f_(d),w=h_(k),N=d.createTracker(g),T=d.createTracker(g),F=[],V=(y?w:"")+"<"+(c.name||""),H=d.enter(c.type);if(N.move(V),T.move(V),c.attributes&&c.attributes.length>0){if(!c.name)throw new Error("Cannot serialize fragment w/ attributes");let $=-1;for(;++$<c.attributes.length;){const q=c.attributes[$];let ue;if(q.type==="mdxJsxExpressionAttribute")ue="{"+(q.value||"")+"}";else{if(!q.name)throw new Error("Cannot serialize attribute w/o name");const ae=q.value,Se=q.name;let Ee="";if(ae!=null)if(typeof ae=="object")Ee="{"+(ae.value||"")+"}";else{const Y=r&&tg(ae,n)>tg(ae,o)?o:n;Ee=Y+hK(ae,{subset:[Y]})+Y}ue=Se+(Ee?"=":"")+Ee}F.push(ue)}}let z=!1;const C=F.join(" ");y&&(/\r?\n|\r/.test(C)||N.current().now.column+C.length+(b?i?2:3:1)>s)&&(z=!0);let _=N,U=V;if(z){_=T;let $=-1;for(;++$<F.length;)F[$]=w+c_+F[$];U+=_.move(`
|
|
61
|
-
`+F.join(`
|
|
62
|
-
`)+`
|
|
63
|
-
`+w)}else C&&(U+=_.move(" "+C));return b&&(U+=_.move((i||z?"":" ")+"/")),U+=_.move(">"),c.children&&c.children.length>0&&(c.type==="mdxJsxTextElement"?U+=_.move(d.containerPhrasing(c,{..._.current(),before:">",after:"<"})):(_.shift(2),U+=_.move(`
|
|
64
|
-
`),U+=_.move(NG(c,d,_.current())),U+=_.move(`
|
|
65
|
-
`))),b||(U+=_.move((y?w:"")+"</"+(c.name||"")+">")),H(),U}}function NG(t,e,n){const r=e.indexStack,i=t.children,s=e.createTracker(n),o=h_(f_(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,w){return(w?"":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 f_(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 h_(t){return c_.repeat(t)}function TG(){return"<"}function MG(){return{enter:{mdxjsEsm:RG},exit:{mdxjsEsm:DG,mdxjsEsmData:IG}}}function OG(){return{handlers:{mdxjsEsm:_G}}}function RG(t){this.enter({type:"mdxjsEsm",value:""},t),this.buffer()}function DG(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 IG(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function _G(t){return t.value||""}function LG(){return[vG(),EG(),MG()]}function zG(t){return{extensions:[kG(),AG(t),OG()]}}var BG=[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],p_=[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],VG="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",d_="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",E1={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"},A1="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",FG={5:A1,"5module":A1+" export import",6:A1+" const class extends export import super"},PG=/^in(stanceof)?$/,jG=new RegExp("["+d_+"]"),$G=new RegExp("["+d_+VG+"]");function lS(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 Ki(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&jG.test(String.fromCharCode(t)):e===!1?!1:lS(t,p_)}function Ga(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&&$G.test(String.fromCharCode(t)):e===!1?!1:lS(t,p_)||lS(t,BG)}var dt=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 Xr(t,e){return new dt(t,{beforeExpr:!0,binop:e})}var Qr={beforeExpr:!0},yr={startsExpr:!0},Ck={};function ft(t,e){return e===void 0&&(e={}),e.keyword=t,Ck[t]=new dt(t,e)}var R={num:new dt("num",yr),regexp:new dt("regexp",yr),string:new dt("string",yr),name:new dt("name",yr),privateId:new dt("privateId",yr),eof:new dt("eof"),bracketL:new dt("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new dt("]"),braceL:new dt("{",{beforeExpr:!0,startsExpr:!0}),braceR:new dt("}"),parenL:new dt("(",{beforeExpr:!0,startsExpr:!0}),parenR:new dt(")"),comma:new dt(",",Qr),semi:new dt(";",Qr),colon:new dt(":",Qr),dot:new dt("."),question:new dt("?",Qr),questionDot:new dt("?."),arrow:new dt("=>",Qr),template:new dt("template"),invalidTemplate:new dt("invalidTemplate"),ellipsis:new dt("...",Qr),backQuote:new dt("`",yr),dollarBraceL:new dt("${",{beforeExpr:!0,startsExpr:!0}),eq:new dt("=",{beforeExpr:!0,isAssign:!0}),assign:new dt("_=",{beforeExpr:!0,isAssign:!0}),incDec:new dt("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new dt("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Xr("||",1),logicalAND:Xr("&&",2),bitwiseOR:Xr("|",3),bitwiseXOR:Xr("^",4),bitwiseAND:Xr("&",5),equality:Xr("==/!=/===/!==",6),relational:Xr("</>/<=/>=",7),bitShift:Xr("<</>>/>>>",8),plusMin:new dt("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Xr("%",10),star:Xr("*",10),slash:Xr("/",10),starstar:new dt("**",{beforeExpr:!0}),coalesce:Xr("??",1),_break:ft("break"),_case:ft("case",Qr),_catch:ft("catch"),_continue:ft("continue"),_debugger:ft("debugger"),_default:ft("default",Qr),_do:ft("do",{isLoop:!0,beforeExpr:!0}),_else:ft("else",Qr),_finally:ft("finally"),_for:ft("for",{isLoop:!0}),_function:ft("function",yr),_if:ft("if"),_return:ft("return",Qr),_switch:ft("switch"),_throw:ft("throw",Qr),_try:ft("try"),_var:ft("var"),_const:ft("const"),_while:ft("while",{isLoop:!0}),_with:ft("with"),_new:ft("new",{beforeExpr:!0,startsExpr:!0}),_this:ft("this",yr),_super:ft("super",yr),_class:ft("class",yr),_extends:ft("extends",Qr),_export:ft("export"),_import:ft("import",yr),_null:ft("null",yr),_true:ft("true",yr),_false:ft("false",yr),_in:ft("in",{beforeExpr:!0,binop:7}),_instanceof:ft("instanceof",{beforeExpr:!0,binop:7}),_typeof:ft("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:ft("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:ft("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Sr=/\r\n?|\n|\u2028|\u2029/,UG=new RegExp(Sr.source,"g");function Qu(t){return t===10||t===13||t===8232||t===8233}function m_(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 g_=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Mn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,y_=Object.prototype,JG=y_.hasOwnProperty,qG=y_.toString,Zu=Object.hasOwn||(function(t,e){return JG.call(t,e)}),gT=Array.isArray||(function(t){return qG.call(t)==="[object Array]"}),yT=Object.create(null);function Va(t){return yT[t]||(yT[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 HG=/(?:[\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 Wg=function(e,n,r){this.start=n,this.end=r,e.sourceFile!==null&&(this.source=e.sourceFile)};function x_(t,e){for(var n=1,r=0;;){var i=m_(t,r,e);if(i<0)return new zh(n,e-r);++n,r=i}}var uS={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},xT=!1;function KG(t){var e={};for(var n in uS)e[n]=t&&Zu(t,n)?t[n]:uS[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!xT&&typeof console=="object"&&console.warn&&(xT=!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),gT(e.onToken)){var r=e.onToken;e.onToken=function(i){return r.push(i)}}return gT(e.onComment)&&(e.onComment=GG(e,e.onComment)),e}function GG(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 Wg(this,o,u)),t.ranges&&(c.range=[i,s]),e.push(c)}}var Bh=1,ec=2,wk=4,b_=8,Ek=16,S_=32,Xg=64,v_=128,Cl=256,dp=512,Qg=Bh|ec|Cl;function Ak(t,e){return ec|(t?wk:0)|(e?b_:0)}var ig=0,Nk=1,Hs=2,k_=3,C_=4,w_=5,sn=function(e,n,r){this.options=e=KG(e),this.sourceFile=e.sourceFile,this.keywords=Va(FG[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var i="";e.allowReserved!==!0&&(i=E1[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(i+=" await")),this.reservedWords=Va(i);var s=(i?i+" ":"")+E1.strict;this.reservedWordsStrict=Va(s),this.reservedWordsStrictBind=Va(s+" "+E1.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(Sr).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=R.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(Bh),this.regexpState=null,this.privateNameStack=[]},Qi={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}};sn.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};Qi.inFunction.get=function(){return(this.currentVarScope().flags&ec)>0};Qi.inGenerator.get=function(){return(this.currentVarScope().flags&b_)>0};Qi.inAsync.get=function(){return(this.currentVarScope().flags&wk)>0};Qi.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Cl|dp))return!1;if(n&ec)return(n&wk)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Qi.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&Xg)>0||this.options.allowSuperOutsideMethod};Qi.allowDirectSuper.get=function(){return(this.currentThisScope().flags&v_)>0};Qi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Qi.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Cl|dp)||n&ec&&!(n&Ek))return!0}return!1};Qi.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Cl)>0};sn.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};sn.parse=function(e,n){return new this(n,e).parse()};sn.parseExpressionAt=function(e,n,r){var i=new this(r,e,n);return i.nextToken(),i.parseExpression()};sn.tokenizer=function(e,n){return new this(n,e)};Object.defineProperties(sn.prototype,Qi);var sr=sn.prototype,YG=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;sr.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){Mn.lastIndex=t,t+=Mn.exec(this.input)[0].length;var e=YG.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){Mn.lastIndex=t+e[0].length;var n=Mn.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===";"||i==="}"||Sr.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i==="!"&&this.input.charAt(r+1)==="=")}t+=e[0].length,Mn.lastIndex=t,t+=Mn.exec(this.input)[0].length,this.input[t]===";"&&t++}};sr.eat=function(t){return this.type===t?(this.next(),!0):!1};sr.isContextual=function(t){return this.type===R.name&&this.value===t&&!this.containsEsc};sr.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};sr.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};sr.canInsertSemicolon=function(){return this.type===R.eof||this.type===R.braceR||Sr.test(this.input.slice(this.lastTokEnd,this.start))};sr.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};sr.semicolon=function(){!this.eat(R.semi)&&!this.insertSemicolon()&&this.unexpected()};sr.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};sr.expect=function(t){this.eat(t)||this.unexpected()};sr.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Zg=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};sr.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")}};sr.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")};sr.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")};sr.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var De=sn.prototype;De.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==R.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 Tk={kind:"loop"},WG={kind:"switch"};De.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Mn.lastIndex=this.pos;var e=Mn.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(Ki(r,!0)){for(var i=n+1;Ga(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var s=this.input.slice(n,i);if(!PG.test(s))return!0}return!1};De.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Mn.lastIndex=this.pos;var t=Mn.exec(this.input),e=this.pos+t[0].length,n;return!Sr.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(Ga(n=this.input.charCodeAt(e+8))||n>55295&&n<56320))};De.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;Mn.lastIndex=this.pos;var n=Mn.exec(this.input),r=this.pos+n[0].length;if(Sr.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||Ga(s=this.input.charCodeAt(i))||s>55295&&s<56320)return!1;Mn.lastIndex=i;var o=Mn.exec(this.input);if(o&&Sr.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||!Ga(c=this.input.charCodeAt(u))&&!(c>55295&&c<56320)))return!1}var h=this.input.charCodeAt(r);return Ki(h,!0)||h===92};De.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};De.isUsing=function(t){return this.isUsingKeyword(!1,t)};De.parseStatement=function(t,e,n){var r=this.type,i=this.startNode(),s;switch(this.isLet(t)&&(r=R._var,s="let"),r){case R._break:case R._continue:return this.parseBreakContinueStatement(i,r.keyword);case R._debugger:return this.parseDebuggerStatement(i);case R._do:return this.parseDoStatement(i);case R._for:return this.parseForStatement(i);case R._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!t);case R._class:return t&&this.unexpected(),this.parseClass(i,!0);case R._if:return this.parseIfStatement(i);case R._return:return this.parseReturnStatement(i);case R._switch:return this.parseSwitchStatement(i);case R._throw:return this.parseThrowStatement(i);case R._try:return this.parseTryStatement(i);case R._const:case R._var:return s=s||this.value,t&&s!=="var"&&this.unexpected(),this.parseVarStatement(i,s);case R._while:return this.parseWhileStatement(i);case R._with:return this.parseWithStatement(i);case R.braceL:return this.parseBlock(!0,i);case R.semi:return this.parseEmptyStatement(i);case R._export:case R._import:if(this.options.ecmaVersion>10&&r===R._import){Mn.lastIndex=this.pos;var o=Mn.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===R._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===R.name&&g.type==="Identifier"&&this.eat(R.colon)?this.parseLabeledStatement(i,d,g,t):this.parseExpressionStatement(i,g)}};De.parseBreakContinueStatement=function(t,e){var n=e==="break";this.next(),this.eat(R.semi)||this.insertSemicolon()?t.label=null:this.type!==R.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")};De.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};De.parseDoStatement=function(t){return this.next(),this.labels.push(Tk),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(R._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(R.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};De.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Tk),this.enterScope(0),this.expect(R.parenL),this.type===R.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===R._var||this.type===R._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 Zg,g=this.start,y=e>-1?this.parseExprSubscripts(d,"await"):this.parseExpression(!0,d);return this.type===R._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===R._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))};De.parseForAfterInit=function(t,e,n){return(this.type===R._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===R._in?n>-1&&this.unexpected(n):t.await=n>-1),this.parseForIn(t,e)):(n>-1&&this.unexpected(n),this.parseFor(t,e))};De.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,uh|(n?0:cS),!1,e)};De.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(R._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};De.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(R.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};De.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(R.braceL),this.labels.push(WG),this.enterScope(0);for(var e,n=!1;this.type!==R.braceR;)if(this.type===R._case||this.type===R._default){var r=this.type===R._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(R.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")};De.parseThrowStatement=function(t){return this.next(),Sr.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 XG=[];De.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?S_:0),this.checkLValPattern(t,e?C_:Hs),this.expect(R.parenR),t};De.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===R._catch){var e=this.startNode();this.next(),this.eat(R.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(R._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};De.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")};De.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(Tk),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};De.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")};De.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};De.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===R._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")};De.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};De.parseBlock=function(t,e,n){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(R.braceL),t&&this.enterScope(0);this.type!==R.braceR;){var r=this.parseStatement(null);e.body.push(r)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};De.parseFor=function(t,e){return t.init=e,this.expect(R.semi),t.test=this.type===R.semi?null:this.parseExpression(),this.expect(R.semi),t.update=this.type===R.parenR?null:this.parseExpression(),this.expect(R.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};De.parseForIn=function(t,e){var n=this.type===R._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(R.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,n?"ForInStatement":"ForOfStatement")};De.parseVar=function(t,e,n,r){for(t.declarations=[],t.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(R.eq)?i.init=this.parseMaybeAssign(e):!r&&n==="const"&&!(this.type===R._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(n==="using"||n==="await using")&&this.options.ecmaVersion>=17&&this.type!==R._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):!r&&i.id.type!=="Identifier"&&!(e&&(this.type===R._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(R.comma))break}return t};De.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?Nk:Hs,!1)};var uh=1,cS=2,E_=4;De.parseFunction=function(t,e,n,r,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===R.star&&e&cS&&this.unexpected(),t.generator=this.eat(R.star)),this.options.ecmaVersion>=8&&(t.async=!!r),e&uh&&(t.id=e&E_&&this.type!==R.name?null:this.parseIdent(),t.id&&!(e&cS)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?Nk:Hs:k_));var s=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ak(t.async,t.generator)),e&uh||(t.id=this.type===R.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&uh?"FunctionDeclaration":"FunctionExpression")};De.parseFunctionParams=function(t){this.expect(R.parenL),t.params=this.parseBindingList(R.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};De.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(R.braceL);this.type!==R.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"&&QG(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")};De.parseClassElement=function(t){if(this.eat(R.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(R.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===R.star?u=!0:r="static"}if(n.static=u,!r&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===R.star)&&!this.canInsertSemicolon()?s=!0:r="async"),!r&&(e>=9||!s)&&this.eat(R.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===R.parenL||o!=="method"||i||s){var h=!n.static&&sg(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};De.isClassElementNameStart=function(){return this.type===R.name||this.type===R.privateId||this.type===R.num||this.type===R.string||this.type===R.bracketL||this.type.keyword};De.parseClassElementName=function(t){this.type===R.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)};De.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&&sg(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")};De.parseClassField=function(t){return sg(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&sg(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(R.eq)?(this.enterScope(dp|Xg),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};De.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(Cl|Xg);this.type!==R.braceR;){var n=this.parseStatement(null);t.body.push(n)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};De.parseClassId=function(t,e){this.type===R.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Hs,!1)):(e===!0&&this.unexpected(),t.id=null)};De.parseClassSuper=function(t){t.superClass=this.eat(R._extends)?this.parseExprSubscripts(null,!1):null};De.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};De.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];Zu(e,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function QG(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 sg(t,e){var n=t.computed,r=t.key;return!n&&(r.type==="Identifier"&&r.name===e||r.type==="Literal"&&r.value===e)}De.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!==R.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};De.parseExport=function(t,e){if(this.next(),this.eat(R.star))return this.parseExportAllDeclaration(t,e);if(this.eat(R._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!==R.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")};De.parseExportDeclaration=function(t){return this.parseStatement(null)};De.parseExportDefaultDeclaration=function(){var t;if(this.type===R._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,uh|E_,!1,t)}else if(this.type===R._class){var n=this.startNode();return this.parseClass(n,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};De.checkExport=function(t,e,n){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Zu(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)};De.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)};De.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)}};De.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};De.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")};De.parseExportSpecifiers=function(t){var e=[],n=!0;for(this.expect(R.braceL);!this.eat(R.braceR);){if(n)n=!1;else if(this.expect(R.comma),this.afterTrailingComma(R.braceR))break;e.push(this.parseExportSpecifier(t))}return e};De.parseImport=function(t){return this.next(),this.type===R.string?(t.specifiers=XG,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===R.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};De.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,Hs),this.finishNode(t,"ImportSpecifier")};De.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Hs),this.finishNode(t,"ImportDefaultSpecifier")};De.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Hs),this.finishNode(t,"ImportNamespaceSpecifier")};De.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===R.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(R.comma)))return t;if(this.type===R.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(R.braceL);!this.eat(R.braceR);){if(e)e=!1;else if(this.expect(R.comma),this.afterTrailingComma(R.braceR))break;t.push(this.parseImportSpecifier())}return t};De.parseWithClause=function(){var t=[];if(!this.eat(R._with))return t;this.expect(R.braceL);for(var e={},n=!0;!this.eat(R.braceR);){if(n)n=!1;else if(this.expect(R.comma),this.afterTrailingComma(R.braceR))break;var r=this.parseImportAttribute(),i=r.key.type==="Identifier"?r.key.name:r.key.value;Zu(e,i)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+i+"'"),e[i]=!0,t.push(r)}return t};De.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===R.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(R.colon),this.type!==R.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};De.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===R.string){var t=this.parseLiteral(this.value);return HG.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};De.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)};De.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 di=sn.prototype;di.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};di.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};di.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};di.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==R.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};di.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case R.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(R.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case R.braceL:return this.parseObj(!0)}return this.parseIdent()};di.parseBindingList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);)if(s?s=!1:this.expect(R.comma),e&&this.type===R.comma)i.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===R.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===R.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};di.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};di.parseBindingListItem=function(t){return t};di.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(R.eq))return n;var r=this.startNodeAt(t,e);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};di.checkLValSimple=function(t,e,n){e===void 0&&(e=ig);var r=e!==ig;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===Hs&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(Zu(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==w_&&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")}};di.checkLValPattern=function(t,e,n){switch(e===void 0&&(e=ig),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)}};di.checkLValInnerPattern=function(t,e,n){switch(e===void 0&&(e=ig),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 Ei=function(e,n,r,i,s){this.token=e,this.isExpr=!!n,this.preserveSpace=!!r,this.override=i,this.generator=!!s},Vt={b_stat:new Ei("{",!1),b_expr:new Ei("{",!0),b_tmpl:new Ei("${",!1),p_stat:new Ei("(",!1),p_expr:new Ei("(",!0),q_tmpl:new Ei("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new Ei("function",!1),f_expr:new Ei("function",!0),f_expr_gen:new Ei("function",!0,!1,null,!0),f_gen:new Ei("function",!1,!1,null,!0)},tc=sn.prototype;tc.initialContext=function(){return[Vt.b_stat]};tc.curContext=function(){return this.context[this.context.length-1]};tc.braceIsBlock=function(t){var e=this.curContext();return e===Vt.f_expr||e===Vt.f_stat?!0:t===R.colon&&(e===Vt.b_stat||e===Vt.b_expr)?!e.isExpr:t===R._return||t===R.name&&this.exprAllowed?Sr.test(this.input.slice(this.lastTokEnd,this.start)):t===R._else||t===R.semi||t===R.eof||t===R.parenR||t===R.arrow?!0:t===R.braceL?e===Vt.b_stat:t===R._var||t===R._const||t===R.name?!1:!this.exprAllowed};tc.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};tc.updateContext=function(t){var e,n=this.type;n.keyword&&t===R.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr};tc.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};R.parenR.updateContext=R.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===Vt.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};R.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?Vt.b_stat:Vt.b_expr),this.exprAllowed=!0};R.dollarBraceL.updateContext=function(){this.context.push(Vt.b_tmpl),this.exprAllowed=!0};R.parenL.updateContext=function(t){var e=t===R._if||t===R._for||t===R._with||t===R._while;this.context.push(e?Vt.p_stat:Vt.p_expr),this.exprAllowed=!0};R.incDec.updateContext=function(){};R._function.updateContext=R._class.updateContext=function(t){t.beforeExpr&&t!==R._else&&!(t===R.semi&&this.curContext()!==Vt.p_stat)&&!(t===R._return&&Sr.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===R.colon||t===R.braceL)&&this.curContext()===Vt.b_stat)?this.context.push(Vt.f_expr):this.context.push(Vt.f_stat),this.exprAllowed=!1};R.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};R.backQuote.updateContext=function(){this.curContext()===Vt.q_tmpl?this.context.pop():this.context.push(Vt.q_tmpl),this.exprAllowed=!1};R.star.updateContext=function(t){if(t===R._function){var e=this.context.length-1;this.context[e]===Vt.f_expr?this.context[e]=Vt.f_expr_gen:this.context[e]=Vt.f_gen}this.exprAllowed=!0};R.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==R.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Ge=sn.prototype;Ge.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}};Ge.parseExpression=function(t,e){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(t,e);if(this.type===R.comma){var s=this.startNodeAt(n,r);for(s.expressions=[i];this.eat(R.comma);)s.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(s,"SequenceExpression")}return i};Ge.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 Zg,r=!0);var u=this.start,c=this.startLoc;(this.type===R.parenL||this.type===R.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===R.eq&&(h=this.toAssignable(h,!1,e)),r||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===R.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};Ge.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(R.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(R.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return i};Ge.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)};Ge.parseExprOp=function(t,e,n,r,i){var s=this.type.binop;if(s!=null&&(!i||this.type!==R._in)&&s>r){var o=this.type===R.logicalOR||this.type===R.logicalAND,u=this.type===R.coalesce;u&&(s=R.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===R.coalesce||u&&(this.type===R.logicalOR||this.type===R.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};Ge.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")};Ge.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===R.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"&&A_(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&fS(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===R.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==R._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(R.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 A_(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&A_(t.expression)}function fS(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&fS(t.expression)||t.type==="ParenthesizedExpression"&&fS(t.expression)}Ge.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};Ge.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}};Ge.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(R.arrow)};Ge.parseSubscriptAsyncArrow=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,r)};Ge.parseSubscript=function(t,e,n,r,i,s,o){var u=this.options.ecmaVersion>=11,c=u&&this.eat(R.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(R.bracketL);if(h||c&&this.type!==R.parenL&&this.type!==R.backQuote||this.eat(R.dot)){var d=this.startNodeAt(e,n);d.object=t,h?(d.property=this.parseExpression(),this.expect(R.bracketR)):this.type===R.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(R.parenL)){var g=new Zg,y=this.yieldPos,b=this.awaitPos,k=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var w=this.parseExprList(R.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,w,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=w,u&&(N.optional=c),t=this.finishNode(N,"CallExpression")}else if(this.type===R.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var T=this.startNodeAt(e,n);T.tag=t,T.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(T,"TaggedTemplateExpression")}return t};Ge.parseExprAtom=function(t,e,n){this.type===R.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case R._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===R.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==R.dot&&this.type!==R.bracketL&&this.type!==R.parenL&&this.unexpected(),this.finishNode(r,"Super");case R._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case R.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(R._function))return this.overrideContext(Vt.f_expr),this.parseFunction(this.startNodeAt(s,o),0,!1,!0,e);if(i&&!this.canInsertSemicolon()){if(this.eat(R.arrow))return this.parseArrowExpression(this.startNodeAt(s,o),[c],!1,e);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===R.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(R.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,o),[c],!0,e)}return c;case R.regexp:var h=this.value;return r=this.parseLiteral(h.value),r.regex={pattern:h.pattern,flags:h.flags},r;case R.num:case R.string:return this.parseLiteral(this.value);case R._null:case R._true:case R._false:return r=this.startNode(),r.value=this.type===R._null?null:this.type===R._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case R.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 R.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(R.bracketR,!0,!0,t),this.finishNode(r,"ArrayExpression");case R.braceL:return this.overrideContext(Vt.b_expr),this.parseObj(!1,t);case R._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case R._class:return this.parseClass(this.startNode(),!1);case R._new:return this.parseNew();case R.backQuote:return this.parseTemplate();case R._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}};Ge.parseExprAtomDefault=function(){this.unexpected()};Ge.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===R.parenL&&!t)return this.parseDynamicImport(e);if(this.type===R.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()};Ge.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(R.parenR)?t.options=null:(this.expect(R.comma),this.afterTrailingComma(R.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(R.parenR)||(this.expect(R.comma),this.afterTrailingComma(R.parenR)||this.unexpected())));else if(!this.eat(R.parenR)){var e=this.start;this.eat(R.comma)&&this.eat(R.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};Ge.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")};Ge.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")};Ge.parseParenExpression=function(){this.expect(R.parenL);var t=this.parseExpression();return this.expect(R.parenR),t};Ge.shouldParseArrow=function(t){return!this.canInsertSemicolon()};Ge.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 Zg,y=this.yieldPos,b=this.awaitPos,k;for(this.yieldPos=0,this.awaitPos=0;this.type!==R.parenR;)if(h?h=!1:this.expect(R.comma),s&&this.afterTrailingComma(R.parenR,!0)){d=!0;break}else if(this.type===R.ellipsis){k=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===R.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,g,this.parseParenItem));var w=this.lastTokEnd,N=this.lastTokEndLoc;if(this.expect(R.parenR),t&&this.shouldParseArrow(c)&&this.eat(R.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",w,N)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var T=this.startNodeAt(n,r);return T.expression=i,this.finishNode(T,"ParenthesizedExpression")}else return i};Ge.parseParenItem=function(t){return t};Ge.parseParenArrowList=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,r)};var ZG=[];Ge.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===R.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(R.parenL)?t.arguments=this.parseExprList(R.parenR,this.options.ecmaVersion>=8,!1):t.arguments=ZG,this.finishNode(t,"NewExpression")};Ge.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===R.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===R.backQuote,this.finishNode(n,"TemplateElement")};Ge.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===R.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(R.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(R.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")};Ge.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===R.name||this.type===R.num||this.type===R.string||this.type===R.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===R.star)&&!Sr.test(this.input.slice(this.lastTokEnd,this.start))};Ge.parseObj=function(t,e){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(R.braceR);){if(r)r=!1;else if(this.expect(R.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(R.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")};Ge.parseProperty=function(t,e){var n=this.startNode(),r,i,s,o;if(this.options.ecmaVersion>=9&&this.eat(R.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===R.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===R.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(R.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(R.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,t,r,i,s,o,e,u),this.finishNode(n,"Property")};Ge.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")};Ge.parsePropertyValue=function(t,e,n,r,i,s,o,u){(n||r)&&this.type===R.colon&&this.unexpected(),this.eat(R.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),t.kind="init"):this.options.ecmaVersion>=6&&this.type===R.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!==R.comma&&this.type!==R.braceR&&this.type!==R.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===R.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()};Ge.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(R.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(R.bracketR),t.key;t.computed=!1}return t.key=this.type===R.num||this.type===R.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Ge.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};Ge.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(Ak(e,r.generator)|Xg|(n?v_:0)),this.expect(R.parenL),r.params=this.parseBindingList(R.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")};Ge.parseArrowExpression=function(t,e,n,r){var i=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Ak(n,!1)|Ek),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")};Ge.parseFunctionBody=function(t,e,n,r){var i=e&&this.type!==R.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,w_),t.body=this.parseBlock(!1,void 0,o&&!s),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()};Ge.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};Ge.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,Nk,e?null:n)}};Ge.parseExprList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);){if(s)s=!1;else if(this.expect(R.comma),e&&this.afterTrailingComma(t))break;var o=void 0;n&&this.type===R.comma?o=null:this.type===R.ellipsis?(o=this.parseSpread(r),r&&this.type===R.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i};Ge.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"))}};Ge.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};Ge.parseIdentNode=function(){var t=this.startNode();return this.type===R.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=R.name):this.unexpected(),t};Ge.parsePrivateIdent=function(){var t=this.startNode();return this.type===R.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};Ge.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===R.semi||this.canInsertSemicolon()||this.type!==R.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(R.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};Ge.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 ag=sn.prototype;ag.raise=function(t,e){var n=x_(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};ag.raiseRecoverable=ag.raise;ag.curPosition=function(){if(this.options.locations)return new zh(this.curLine,this.pos-this.lineStart)};var ro=sn.prototype,eY=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ro.enterScope=function(t){this.scopeStack.push(new eY(t))};ro.exitScope=function(){this.scopeStack.pop()};ro.treatFunctionsAsVarInScope=function(t){return t.flags&ec||!this.inModule&&t.flags&Bh};ro.declareName=function(t,e,n){var r=!1;if(e===Hs){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&Bh&&delete this.undefinedExports[t]}else if(e===C_){var s=this.currentScope();s.lexical.push(t)}else if(e===k_){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&S_&&c.lexical[0]===t)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(t)>-1){r=!0;break}if(c.var.push(t),this.inModule&&c.flags&Bh&&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|dp|Cl))return e}};ro.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Qg|dp|Cl)&&!(e.flags&Ek))return e}};var e0=function(e,n,r){this.type="",this.start=n,this.end=0,e.options.locations&&(this.loc=new Wg(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[n,0])},mp=sn.prototype;mp.startNode=function(){return new e0(this,this.start,this.startLoc)};mp.startNodeAt=function(t,e){return new e0(this,t,e)};function N_(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}mp.finishNode=function(t,e){return N_.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};mp.finishNodeAt=function(t,e,n,r){return N_.call(this,t,e,n,r)};mp.copyNode=function(t){var e=new e0(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var tY="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",T_="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",M_=T_+" Extended_Pictographic",O_=M_,R_=O_+" EBase EComp EMod EPres ExtPict",D_=R_,nY=D_,rY={9:T_,10:M_,11:O_,12:R_,13:D_,14:nY},iY="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",sY={9:"",10:"",11:"",12:"",13:"",14:iY},bT="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",I_="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",__=I_+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",L_=__+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",z_=L_+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",B_=z_+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",aY=B_+" "+tY,oY={9:I_,10:__,11:L_,12:z_,13:B_,14:aY},V_={};function lY(t){var e=V_[t]={binary:Va(rY[t]+" "+bT),binaryOfStrings:Va(sY[t]),nonBinary:{General_Category:Va(bT),Script:Va(oY[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 N1=0,ST=[9,10,11,12,13,14];N1<ST.length;N1+=1){var uY=ST[N1];lY(uY)}var Re=sn.prototype,og=function(e,n){this.parent=e,this.base=n||this};og.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};og.prototype.sibling=function(){return new og(this.parent,this.base)};var Zi=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=V_[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};Zi.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)};Zi.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Zi.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};Zi.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};Zi.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};Zi.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};Zi.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};Zi.prototype.eat=function(e,n){return n===void 0&&(n=!1),this.current(n)===e?(this.advance(n),!0):!1};Zi.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};Re.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 cY(t){for(var e in t)return!0;return!1}Re.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&cY(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};Re.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")}};Re.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new og(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")};Re.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};Re.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};Re.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};Re.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};Re.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};Re.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};Re.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)};Re.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};Re.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};Re.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};Re.regexp_eatModifiers=function(t){for(var e="",n=0;(n=t.current())!==-1&&fY(n);)e+=Vs(n),t.advance();return e};function fY(t){return t===105||t===109||t===115}Re.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)};Re.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};Re.regexp_eatSyntaxCharacter=function(t){var e=t.current();return F_(e)?(t.lastIntValue=e,t.advance(),!0):!1};function F_(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}Re.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;(n=t.current())!==-1&&!F_(n);)t.advance();return t.pos!==e};Re.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};Re.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}};Re.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};Re.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};Re.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),hY(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function hY(t){return Ki(t,!0)||t===36||t===95}Re.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),pY(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function pY(t){return Ga(t,!0)||t===36||t===95||t===8204||t===8205}Re.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)};Re.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};Re.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};Re.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)};Re.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};Re.regexp_eatZero=function(t){return t.current()===48&&!t0(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};Re.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};Re.regexp_eatControlLetter=function(t){var e=t.current();return P_(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function P_(t){return t>=65&&t<=90||t>=97&&t<=122}Re.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)&&dY(t.lastIntValue))return!0;r&&t.raise("Invalid unicode escape"),t.pos=n}return!1};function dY(t){return t>=0&&t<=1114111}Re.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};Re.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 j_=0,Fs=1,ii=2;Re.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(mY(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===ii&&t.raise("Invalid property name"),r;t.raise("Invalid property name")}return j_};function mY(t){return t===100||t===68||t===115||t===83||t===119||t===87}Re.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 j_};Re.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){Zu(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(n)||t.raise("Invalid property value")};Re.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return Fs;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return ii;t.raise("Invalid property name")};Re.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";$_(e=t.current());)t.lastStringValue+=Vs(e),t.advance();return t.lastStringValue!==""};function $_(t){return P_(t)||t===95}Re.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";gY(e=t.current());)t.lastStringValue+=Vs(e),t.advance();return t.lastStringValue!==""};function gY(t){return $_(t)||t0(t)}Re.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};Re.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===ii&&t.raise("Negated character class may contain strings"),!0}return!1};Re.regexp_classContents=function(t){return t.current()===93?Fs:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),Fs)};Re.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")}}};Re.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||q_(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};Re.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)};Re.regexp_classSetExpression=function(t){var e=Fs,n;if(!this.regexp_eatClassSetRange(t))if(n=this.regexp_eatClassSetOperand(t)){n===ii&&(e=ii);for(var r=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(n=this.regexp_eatClassSetOperand(t))){n!==ii&&(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===ii&&(e=ii)}};Re.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};Re.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?Fs:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};Re.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===ii&&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};Re.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};Re.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===ii&&(e=ii);return e};Re.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?Fs:ii};Re.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()&&yY(n)||xY(n)?!1:(t.advance(),t.lastIntValue=n,!0)};function yY(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 xY(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}Re.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return bY(e)?(t.lastIntValue=e,t.advance(),!0):!1};function bY(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}Re.regexp_eatClassControlLetter=function(t){var e=t.current();return t0(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};Re.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};Re.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;t0(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e};function t0(t){return t>=48&&t<=57}Re.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;U_(n=t.current());)t.lastIntValue=16*t.lastIntValue+J_(n),t.advance();return t.pos!==e};function U_(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function J_(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}Re.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};Re.regexp_eatOctalDigit=function(t){var e=t.current();return q_(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function q_(t){return t>=48&&t<=55}Re.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var r=0;r<e;++r){var i=t.current();if(!U_(i))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+J_(i),t.advance()}return!0};var Mk=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Wg(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},ut=sn.prototype;ut.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 Mk(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};ut.getToken=function(){return this.next(),new Mk(this)};typeof Symbol<"u"&&(ut[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===R.eof,value:e}}}});ut.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(R.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};ut.readToken=function(t){return Ki(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};ut.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};ut.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=m_(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())};ut.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())};ut.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&&g_.test(String.fromCharCode(t)))++this.pos;else break e}}};ut.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)};ut.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(R.ellipsis)):(++this.pos,this.finishToken(R.dot))};ut.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(R.assign,2):this.finishOp(R.slash,1)};ut.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,r=t===42?R.star:R.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++n,r=R.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(R.assign,n+1):this.finishOp(r,n)};ut.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(R.assign,3)}return this.finishOp(t===124?R.logicalOR:R.logicalAND,2)}return e===61?this.finishOp(R.assign,2):this.finishOp(t===124?R.bitwiseOR:R.bitwiseAND,1)};ut.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(R.assign,2):this.finishOp(R.bitwiseXOR,1)};ut.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||Sr.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(R.incDec,2):e===61?this.finishOp(R.assign,2):this.finishOp(R.plusMin,1)};ut.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(R.assign,n+1):this.finishOp(R.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(R.relational,n))};ut.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(R.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(R.arrow)):this.finishOp(t===61?R.eq:R.prefix,1)};ut.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(R.questionDot,2)}if(e===63){if(t>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(R.assign,3)}return this.finishOp(R.coalesce,2)}}return this.finishOp(R.question,1)};ut.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Ki(e,!0)||e===92))return this.finishToken(R.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Vs(e)+"'")};ut.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(R.parenL);case 41:return++this.pos,this.finishToken(R.parenR);case 59:return++this.pos,this.finishToken(R.semi);case 44:return++this.pos,this.finishToken(R.comma);case 91:return++this.pos,this.finishToken(R.bracketL);case 93:return++this.pos,this.finishToken(R.bracketR);case 123:return++this.pos,this.finishToken(R.braceL);case 125:return++this.pos,this.finishToken(R.braceR);case 58:return++this.pos,this.finishToken(R.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(R.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(R.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Vs(t)+"'")};ut.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)};ut.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(Sr.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 Zi(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(R.regexp,{pattern:i,flags:o,value:c})};ut.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 SY(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function H_(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}ut.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=H_(this.input.slice(e,this.pos)),++this.pos):Ki(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(R.num,n)};ut.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=H_(this.input.slice(e,this.pos));return++this.pos,Ki(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(R.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")),Ki(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=SY(this.input.slice(e,this.pos),n);return this.finishToken(R.num,s)};ut.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};ut.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(R.string,e)};var K_={};ut.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===K_)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};ut.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw K_;this.raise(t,e)};ut.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===R.template||this.type===R.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(R.dollarBraceL)):(++this.pos,this.finishToken(R.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(R.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}};ut.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(R.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")};ut.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)}};ut.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n};ut.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(Ga(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?Ki:Ga)(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)};ut.readWord=function(){var t=this.readWord1(),e=R.name;return this.keywords.test(t)&&(e=Ck[t]),this.finishToken(e,t)};var vY="8.15.0";sn.acorn={Parser:sn,version:vY,defaultOptions:uS,Position:zh,SourceLocation:Wg,getLineInfo:x_,Node:e0,TokenType:dt,tokTypes:R,keywordTypes:Ck,TokContext:Ei,tokContexts:Vt,isIdentifierChar:Ga,isIdentifierStart:Ki,Token:Mk,isNewLine:Qu,lineBreak:Sr,lineBreakG:UG,nonASCIIwhitespace:g_};var T1={exports:{}},M1,vT;function kY(){return vT||(vT=1,M1={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:"♦"}),M1}var Uf={exports:{}},CY=Uf.exports,kT;function CT(){return kT||(kT=1,(function(t,e){(function(n,r){r(e)})(CY,(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 E=65536,M=0;M<S.length;M+=2){if(E+=S[M],E>p)return!1;if(E+=S[M+1],E>=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 w(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,E){E===void 0&&(E={}),this.label=S,this.keyword=E.keyword,this.beforeExpr=!!E.beforeExpr,this.startsExpr=!!E.startsExpr,this.isLoop=!!E.isLoop,this.isAssign=!!E.isAssign,this.prefix=!!E.prefix,this.postfix=!!E.postfix,this.binop=E.binop||null,this.updateContext=null};function T(p,S){return new N(p,{beforeExpr:!0,binop:S})}var F={beforeExpr:!0},V={startsExpr:!0},H={};function z(p,S){return S===void 0&&(S={}),S.keyword=p,H[p]=new N(p,S)}var C={num:new N("num",V),regexp:new N("regexp",V),string:new N("string",V),name:new N("name",V),privateId:new N("privateId",V),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(",",F),semi:new N(";",F),colon:new N(":",F),dot:new N("."),question:new N("?",F),questionDot:new N("?."),arrow:new N("=>",F),template:new N("template"),invalidTemplate:new N("invalidTemplate"),ellipsis:new N("...",F),backQuote:new N("`",V),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:T("||",1),logicalAND:T("&&",2),bitwiseOR:T("|",3),bitwiseXOR:T("^",4),bitwiseAND:T("&",5),equality:T("==/!=/===/!==",6),relational:T("</>/<=/>=",7),bitShift:T("<</>>/>>>",8),plusMin:new N("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:T("%",10),star:T("*",10),slash:T("/",10),starstar:new N("**",{beforeExpr:!0}),coalesce:T("??",1),_break:z("break"),_case:z("case",F),_catch:z("catch"),_continue:z("continue"),_debugger:z("debugger"),_default:z("default",F),_do:z("do",{isLoop:!0,beforeExpr:!0}),_else:z("else",F),_finally:z("finally"),_for:z("for",{isLoop:!0}),_function:z("function",V),_if:z("if"),_return:z("return",F),_switch:z("switch"),_throw:z("throw",F),_try:z("try"),_var:z("var"),_const:z("const"),_while:z("while",{isLoop:!0}),_with:z("with"),_new:z("new",{beforeExpr:!0,startsExpr:!0}),_this:z("this",V),_super:z("super",V),_class:z("class",V),_extends:z("extends",F),_export:z("export"),_import:z("import",V),_null:z("null",V),_true:z("true",V),_false:z("false",V),_in:z("in",{beforeExpr:!0,binop:7}),_instanceof:z("instanceof",{beforeExpr:!0,binop:7}),_typeof:z("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:z("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:z("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},_=/\r\n?|\n|\u2028|\u2029/,U=new RegExp(_.source,"g");function $(p){return p===10||p===13||p===8232||p===8233}function q(p,S,E){E===void 0&&(E=p.length);for(var M=S;M<E;M++){var B=p.charCodeAt(M);if($(B))return M<E-1&&B===13&&p.charCodeAt(M+1)===10?M+2:M+1}return-1}var ue=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ae=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Se=Object.prototype,Ee=Se.hasOwnProperty,Y=Se.toString,X=Object.hasOwn||(function(p,S){return Ee.call(p,S)}),le=Array.isArray||(function(p){return Y.call(p)==="[object Array]"}),Ce=Object.create(null);function _e(p){return Ce[p]||(Ce[p]=new RegExp("^(?:"+p.replace(/ /g,"|")+")$"))}function j(p){return p<=65535?String.fromCharCode(p):(p-=65536,String.fromCharCode((p>>10)+55296,(p&1023)+56320))}var P=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,te=function(S,E){this.line=S,this.column=E};te.prototype.offset=function(S){return new te(this.line,this.column+S)};var L=function(S,E,M){this.start=E,this.end=M,S.sourceFile!==null&&(this.source=S.sourceFile)};function xe(p,S){for(var E=1,M=0;;){var B=q(p,M,S);if(B<0)return new te(E,S-M);++E,M=B}}var Te={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},Ae=!1;function He(p){var S={};for(var E in Te)S[E]=p&&X(p,E)?p[E]:Te[E];if(S.ecmaVersion==="latest"?S.ecmaVersion=1e8:S.ecmaVersion==null?(!Ae&&typeof console=="object"&&console.warn&&(Ae=!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),le(S.onToken)){var M=S.onToken;S.onToken=function(B){return M.push(B)}}if(le(S.onComment)&&(S.onComment=pt(S,S.onComment)),S.sourceType==="commonjs"&&S.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return S}function pt(p,S){return function(E,M,B,Z,re,ye){var ve={type:E?"Block":"Line",value:M,start:B,end:Z};p.locations&&(ve.loc=new L(this,re,ye)),p.ranges&&(ve.range=[B,Z]),S.push(ve)}}var Ke=1,Ft=2,Ot=4,ar=8,or=16,fn=32,hn=64,lr=128,pn=256,dn=512,ur=1024,he=Ke|Ft|pn;function je(p,S){return Ft|(p?Ot:0)|(S?ar:0)}var Dt=0,mt=1,Be=2,mn=3,fe=4,ge=5,I=function(S,E,M){this.options=S=He(S),this.sourceFile=S.sourceFile,this.keywords=_e(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=_e(B);var Z=(B?B+" ":"")+u.strict;this.reservedWordsStrict=_e(Z),this.reservedWordsStrictBind=_e(Z+" "+u.strictBind),this.input=String(E),this.containsEsc=!1,M?(this.pos=M,this.lineStart=this.input.lastIndexOf(`
|
|
79
|
-
`,M-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(_).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"?Ft:Ke),this.regexpState=null,this.privateNameStack=[]},Le={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};I.prototype.parse=function(){var S=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(S)},Le.inFunction.get=function(){return(this.currentVarScope().flags&Ft)>0},Le.inGenerator.get=function(){return(this.currentVarScope().flags&ar)>0},Le.inAsync.get=function(){return(this.currentVarScope().flags&Ot)>0},Le.canAwait.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],E=S.flags;if(E&(pn|dn))return!1;if(E&Ft)return(E&Ot)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Le.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Ke)},Le.allowSuper.get=function(){var p=this.currentThisScope(),S=p.flags;return(S&hn)>0||this.options.allowSuperOutsideMethod},Le.allowDirectSuper.get=function(){return(this.currentThisScope().flags&lr)>0},Le.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Le.allowNewDotTarget.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],E=S.flags;if(E&(pn|dn)||E&Ft&&!(E&or))return!0}return!1},Le.allowUsing.get=function(){var p=this.currentScope(),S=p.flags;return!(S&ur||!this.inModule&&S&Ke)},Le.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&pn)>0},I.extend=function(){for(var S=[],E=arguments.length;E--;)S[E]=arguments[E];for(var M=this,B=0;B<S.length;B++)M=S[B](M);return M},I.parse=function(S,E){return new this(E,S).parse()},I.parseExpressionAt=function(S,E,M){var B=new this(M,S,E);return B.nextToken(),B.parseExpression()},I.tokenizer=function(S,E){return new this(E,S)},Object.defineProperties(I.prototype,Le);var Ue=I.prototype,on=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Ue.strictDirective=function(p){if(this.options.ecmaVersion<5)return!1;for(;;){ae.lastIndex=p,p+=ae.exec(this.input)[0].length;var S=on.exec(this.input.slice(p));if(!S)return!1;if((S[1]||S[2])==="use strict"){ae.lastIndex=p+S[0].length;var E=ae.exec(this.input),M=E.index+E[0].length,B=this.input.charAt(M);return B===";"||B==="}"||_.test(E[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(B)||B==="!"&&this.input.charAt(M+1)==="=")}p+=S[0].length,ae.lastIndex=p,p+=ae.exec(this.input)[0].length,this.input[p]===";"&&p++}},Ue.eat=function(p){return this.type===p?(this.next(),!0):!1},Ue.isContextual=function(p){return this.type===C.name&&this.value===p&&!this.containsEsc},Ue.eatContextual=function(p){return this.isContextual(p)?(this.next(),!0):!1},Ue.expectContextual=function(p){this.eatContextual(p)||this.unexpected()},Ue.canInsertSemicolon=function(){return this.type===C.eof||this.type===C.braceR||_.test(this.input.slice(this.lastTokEnd,this.start))},Ue.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Ue.semicolon=function(){!this.eat(C.semi)&&!this.insertSemicolon()&&this.unexpected()},Ue.afterTrailingComma=function(p,S){if(this.type===p)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),S||this.next(),!0},Ue.expect=function(p){this.eat(p)||this.unexpected()},Ue.unexpected=function(p){this.raise(p??this.start,"Unexpected token")};var cr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Ue.checkPatternErrors=function(p,S){if(p){p.trailingComma>-1&&this.raiseRecoverable(p.trailingComma,"Comma is not permitted after the rest element");var E=S?p.parenthesizedAssign:p.parenthesizedBind;E>-1&&this.raiseRecoverable(E,S?"Assigning to rvalue":"Parenthesized pattern")}},Ue.checkExpressionErrors=function(p,S){if(!p)return!1;var E=p.shorthandAssign,M=p.doubleProto;if(!S)return E>=0||M>=0;E>=0&&this.raise(E,"Shorthand property assignments are valid only in destructuring patterns"),M>=0&&this.raiseRecoverable(M,"Redefinition of __proto__ property")},Ue.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")},Ue.isSimpleAssignTarget=function(p){return p.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(p.expression):p.type==="Identifier"||p.type==="MemberExpression"};var ke=I.prototype;ke.parseTopLevel=function(p){var S=Object.create(null);for(p.body||(p.body=[]);this.type!==C.eof;){var E=this.parseStatement(null,!0,S);p.body.push(E)}if(this.inModule)for(var M=0,B=Object.keys(this.undefinedExports);M<B.length;M+=1){var Z=B[M];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 Pt={kind:"loop"},An={kind:"switch"};ke.isLet=function(p){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ae.lastIndex=this.pos;var S=ae.exec(this.input),E=this.pos+S[0].length,M=this.fullCharCodeAt(E);if(M===91||M===92)return!0;if(p)return!1;if(M===123)return!0;if(k(M)){var B=E;do E+=M<=65535?1:2;while(w(M=this.fullCharCodeAt(E)));if(M===92)return!0;var Z=this.input.slice(B,E);if(!d.test(Z))return!0}return!1},ke.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ae.lastIndex=this.pos;var p=ae.exec(this.input),S=this.pos+p[0].length,E;return!_.test(this.input.slice(this.pos,S))&&this.input.slice(S,S+8)==="function"&&(S+8===this.input.length||!(w(E=this.fullCharCodeAt(S+8))||E===92))},ke.isUsingKeyword=function(p,S){if(this.options.ecmaVersion<17||!this.isContextual(p?"await":"using"))return!1;ae.lastIndex=this.pos;var E=ae.exec(this.input),M=this.pos+E[0].length;if(_.test(this.input.slice(this.pos,M)))return!1;if(p){var B=M+5,Z;if(this.input.slice(M,B)!=="using"||B===this.input.length||w(Z=this.fullCharCodeAt(B))||Z===92)return!1;ae.lastIndex=B;var re=ae.exec(this.input);if(M=B+re[0].length,re&&_.test(this.input.slice(B,M)))return!1}var ye=this.fullCharCodeAt(M);if(!k(ye)&&ye!==92)return!1;var ve=M;do M+=ye<=65535?1:2;while(w(ye=this.fullCharCodeAt(M)));if(ye===92)return!0;var Ve=this.input.slice(ve,M);return!(d.test(Ve)||S&&Ve==="of")},ke.isAwaitUsing=function(p){return this.isUsingKeyword(!0,p)},ke.isUsing=function(p){return this.isUsingKeyword(!1,p)},ke.parseStatement=function(p,S,E){var M=this.type,B=this.startNode(),Z;switch(this.isLet(p)&&(M=C._var,Z="let"),M){case C._break:case C._continue:return this.parseBreakContinueStatement(B,M.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&&M===C._import){ae.lastIndex=this.pos;var re=ae.exec(this.input),ye=this.pos+re[0].length,ve=this.input.charCodeAt(ye);if(ve===40||ve===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'")),M===C._import?this.parseImport(B):this.parseExport(B,E);default:if(this.isAsyncFunction())return p&&this.unexpected(),this.next(),this.parseFunctionStatement(B,!0,!p);var Ve=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Ve)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"),Ve==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(B,!1,Ve),this.semicolon(),this.finishNode(B,"VariableDeclaration");var Qe=this.value,vt=this.parseExpression();return M===C.name&&vt.type==="Identifier"&&this.eat(C.colon)?this.parseLabeledStatement(B,Qe,vt,p):this.parseExpressionStatement(B,vt)}},ke.parseBreakContinueStatement=function(p,S){var E=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 M=0;M<this.labels.length;++M){var B=this.labels[M];if((p.label==null||B.name===p.label.name)&&(B.kind!=null&&(E||B.kind==="loop")||p.label&&E))break}return M===this.labels.length&&this.raise(p.start,"Unsyntactic "+S),this.finishNode(p,E?"BreakStatement":"ContinueStatement")},ke.parseDebuggerStatement=function(p){return this.next(),this.semicolon(),this.finishNode(p,"DebuggerStatement")},ke.parseDoStatement=function(p){return this.next(),this.labels.push(Pt),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")},ke.parseForStatement=function(p){this.next();var S=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Pt),this.enterScope(0),this.expect(C.parenL),this.type===C.semi)return S>-1&&this.unexpected(S),this.parseFor(p,null);var E=this.isLet();if(this.type===C._var||this.type===C._const||E){var M=this.startNode(),B=E?"let":this.value;return this.next(),this.parseVar(M,!0,B),this.finishNode(M,"VariableDeclaration"),this.parseForAfterInit(p,M,S)}var Z=this.isContextual("let"),re=!1,ye=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(ye){var ve=this.startNode();return this.next(),ye==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(ve,!0,ye),this.finishNode(ve,"VariableDeclaration"),this.parseForAfterInit(p,ve,S)}var Ve=this.containsEsc,Qe=new cr,vt=this.start,Ut=S>-1?this.parseExprSubscripts(Qe,"await"):this.parseExpression(!0,Qe);return this.type===C._in||(re=this.options.ecmaVersion>=6&&this.isContextual("of"))?(S>-1?(this.type===C._in&&this.unexpected(S),p.await=!0):re&&this.options.ecmaVersion>=8&&(Ut.start===vt&&!Ve&&Ut.type==="Identifier"&&Ut.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(p.await=!1)),Z&&re&&this.raise(Ut.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Ut,!1,Qe),this.checkLValPattern(Ut),this.parseForIn(p,Ut)):(this.checkExpressionErrors(Qe,!0),S>-1&&this.unexpected(S),this.parseFor(p,Ut))},ke.parseForAfterInit=function(p,S,E){return(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&S.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===C._in?E>-1&&this.unexpected(E):p.await=E>-1),this.parseForIn(p,S)):(E>-1&&this.unexpected(E),this.parseFor(p,S))},ke.parseFunctionStatement=function(p,S,E){return this.next(),this.parseFunction(p,fr|(E?0:Pn),!1,S)},ke.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")},ke.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")},ke.parseSwitchStatement=function(p){this.next(),p.discriminant=this.parseParenExpression(),p.cases=[],this.expect(C.braceL),this.labels.push(An),this.enterScope(ur);for(var S,E=!1;this.type!==C.braceR;)if(this.type===C._case||this.type===C._default){var M=this.type===C._case;S&&this.finishNode(S,"SwitchCase"),p.cases.push(S=this.startNode()),S.consequent=[],this.next(),M?S.test=this.parseExpression():(E&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),E=!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")},ke.parseThrowStatement=function(p){return this.next(),_.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 wt=[];ke.parseCatchClauseParam=function(){var p=this.parseBindingAtom(),S=p.type==="Identifier";return this.enterScope(S?fn:0),this.checkLValPattern(p,S?fe:Be),this.expect(C.parenR),p},ke.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")},ke.parseVarStatement=function(p,S,E){return this.next(),this.parseVar(p,!1,S,E),this.semicolon(),this.finishNode(p,"VariableDeclaration")},ke.parseWhileStatement=function(p){return this.next(),p.test=this.parseParenExpression(),this.labels.push(Pt),p.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(p,"WhileStatement")},ke.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")},ke.parseEmptyStatement=function(p){return this.next(),this.finishNode(p,"EmptyStatement")},ke.parseLabeledStatement=function(p,S,E,M){for(var B=0,Z=this.labels;B<Z.length;B+=1){var re=Z[B];re.name===S&&this.raise(E.start,"Label '"+S+"' is already declared")}for(var ye=this.type.isLoop?"loop":this.type===C._switch?"switch":null,ve=this.labels.length-1;ve>=0;ve--){var Ve=this.labels[ve];if(Ve.statementStart===p.start)Ve.statementStart=this.start,Ve.kind=ye;else break}return this.labels.push({name:S,kind:ye,statementStart:this.start}),p.body=this.parseStatement(M?M.indexOf("label")===-1?M+"label":M:"label"),this.labels.pop(),p.label=E,this.finishNode(p,"LabeledStatement")},ke.parseExpressionStatement=function(p,S){return p.expression=S,this.semicolon(),this.finishNode(p,"ExpressionStatement")},ke.parseBlock=function(p,S,E){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 M=this.parseStatement(null);S.body.push(M)}return E&&(this.strict=!1),this.next(),p&&this.exitScope(),this.finishNode(S,"BlockStatement")},ke.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")},ke.parseForIn=function(p,S){var E=this.type===C._in;return this.next(),S.type==="VariableDeclaration"&&S.declarations[0].init!=null&&(!E||this.options.ecmaVersion<8||this.strict||S.kind!=="var"||S.declarations[0].id.type!=="Identifier")&&this.raise(S.start,(E?"for-in":"for-of")+" loop variable declaration may not have an initializer"),p.left=S,p.right=E?this.parseExpression():this.parseMaybeAssign(),this.expect(C.parenR),p.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(p,E?"ForInStatement":"ForOfStatement")},ke.parseVar=function(p,S,E,M){for(p.declarations=[],p.kind=E;;){var B=this.startNode();if(this.parseVarId(B,E),this.eat(C.eq)?B.init=this.parseMaybeAssign(S):!M&&E==="const"&&!(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!M&&(E==="using"||E==="await using")&&this.options.ecmaVersion>=17&&this.type!==C._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+E+" declaration"):!M&&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},ke.parseVarId=function(p,S){p.id=S==="using"||S==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(p.id,S==="var"?mt:Be,!1)};var fr=1,Pn=2,gp=4;ke.parseFunction=function(p,S,E,M,B){this.initFunction(p),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!M)&&(this.type===C.star&&S&Pn&&this.unexpected(),p.generator=this.eat(C.star)),this.options.ecmaVersion>=8&&(p.async=!!M),S&fr&&(p.id=S&gp&&this.type!==C.name?null:this.parseIdent(),p.id&&!(S&Pn)&&this.checkLValSimple(p.id,this.strict||p.generator||p.async?this.treatFunctionsAsVar?mt:Be:mn));var Z=this.yieldPos,re=this.awaitPos,ye=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(p.async,p.generator)),S&fr||(p.id=this.type===C.name?this.parseIdent():null),this.parseFunctionParams(p),this.parseFunctionBody(p,E,!1,B),this.yieldPos=Z,this.awaitPos=re,this.awaitIdentPos=ye,this.finishNode(p,S&fr?"FunctionDeclaration":"FunctionExpression")},ke.parseFunctionParams=function(p){this.expect(C.parenL),p.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},ke.parseClass=function(p,S){this.next();var E=this.strict;this.strict=!0,this.parseClassId(p,S),this.parseClassSuper(p);var M=this.enterClassBody(),B=this.startNode(),Z=!1;for(B.body=[],this.expect(C.braceL);this.type!==C.braceR;){var re=this.parseClassElement(p.superClass!==null);re&&(B.body.push(re),re.type==="MethodDefinition"&&re.kind==="constructor"?(Z&&this.raiseRecoverable(re.start,"Duplicate constructor in the same class"),Z=!0):re.key&&re.key.type==="PrivateIdentifier"&&wl(M,re)&&this.raiseRecoverable(re.key.start,"Identifier '#"+re.key.name+"' has already been declared"))}return this.strict=E,this.next(),p.body=this.finishNode(B,"ClassBody"),this.exitClassBody(),this.finishNode(p,S?"ClassDeclaration":"ClassExpression")},ke.parseClassElement=function(p){if(this.eat(C.semi))return null;var S=this.options.ecmaVersion,E=this.startNode(),M="",B=!1,Z=!1,re="method",ye=!1;if(this.eatContextual("static")){if(S>=13&&this.eat(C.braceL))return this.parseClassStaticBlock(E),E;this.isClassElementNameStart()||this.type===C.star?ye=!0:M="static"}if(E.static=ye,!M&&S>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===C.star)&&!this.canInsertSemicolon()?Z=!0:M="async"),!M&&(S>=9||!Z)&&this.eat(C.star)&&(B=!0),!M&&!Z&&!B){var ve=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?re=ve:M=ve)}if(M?(E.computed=!1,E.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),E.key.name=M,this.finishNode(E.key,"Identifier")):this.parseClassElementName(E),S<13||this.type===C.parenL||re!=="method"||B||Z){var Ve=!E.static&&es(E,"constructor"),Qe=Ve&&p;Ve&&re!=="method"&&this.raise(E.key.start,"Constructor can't have get/set modifier"),E.kind=Ve?"constructor":re,this.parseClassMethod(E,B,Z,Qe)}else this.parseClassField(E);return E},ke.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},ke.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)},ke.parseClassMethod=function(p,S,E,M){var B=p.key;p.kind==="constructor"?(S&&this.raise(B.start,"Constructor can't be a generator"),E&&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,E,M);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")},ke.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(dn|hn),p.value=this.parseMaybeAssign(),this.exitScope()):p.value=null,this.semicolon(),this.finishNode(p,"PropertyDefinition")},ke.parseClassStaticBlock=function(p){p.body=[];var S=this.labels;for(this.labels=[],this.enterScope(pn|hn);this.type!==C.braceR;){var E=this.parseStatement(null);p.body.push(E)}return this.next(),this.exitScope(),this.labels=S,this.finishNode(p,"StaticBlock")},ke.parseClassId=function(p,S){this.type===C.name?(p.id=this.parseIdent(),S&&this.checkLValSimple(p.id,Be,!1)):(S===!0&&this.unexpected(),p.id=null)},ke.parseClassSuper=function(p){p.superClass=this.eat(C._extends)?this.parseExprSubscripts(null,!1):null},ke.enterClassBody=function(){var p={declared:Object.create(null),used:[]};return this.privateNameStack.push(p),p.declared},ke.exitClassBody=function(){var p=this.privateNameStack.pop(),S=p.declared,E=p.used;if(this.options.checkPrivateFields)for(var M=this.privateNameStack.length,B=M===0?null:this.privateNameStack[M-1],Z=0;Z<E.length;++Z){var re=E[Z];X(S,re.name)||(B?B.used.push(re):this.raiseRecoverable(re.start,"Private field '#"+re.name+"' must be declared in an enclosing class"))}};function wl(p,S){var E=S.key.name,M=p[E],B="true";return S.type==="MethodDefinition"&&(S.kind==="get"||S.kind==="set")&&(B=(S.static?"s":"i")+S.kind),M==="iget"&&B==="iset"||M==="iset"&&B==="iget"||M==="sget"&&B==="sset"||M==="sset"&&B==="sget"?(p[E]="true",!1):M?!0:(p[E]=B,!1)}function es(p,S){var E=p.computed,M=p.key;return!E&&(M.type==="Identifier"&&M.name===S||M.type==="Literal"&&M.value===S)}ke.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")},ke.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 E=0,M=p.specifiers;E<M.length;E+=1){var B=M[E];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")},ke.parseExportDeclaration=function(p){return this.parseStatement(null)},ke.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,fr|gp,!1,p)}else if(this.type===C._class){var E=this.startNode();return this.parseClass(E,"nullableID")}else{var M=this.parseMaybeAssign();return this.semicolon(),M}},ke.checkExport=function(p,S,E){p&&(typeof S!="string"&&(S=S.type==="Identifier"?S.name:S.value),X(p,S)&&this.raiseRecoverable(E,"Duplicate export '"+S+"'"),p[S]=!0)},ke.checkPatternExport=function(p,S){var E=S.type;if(E==="Identifier")this.checkExport(p,S,S.start);else if(E==="ObjectPattern")for(var M=0,B=S.properties;M<B.length;M+=1){var Z=B[M];this.checkPatternExport(p,Z)}else if(E==="ArrayPattern")for(var re=0,ye=S.elements;re<ye.length;re+=1){var ve=ye[re];ve&&this.checkPatternExport(p,ve)}else E==="Property"?this.checkPatternExport(p,S.value):E==="AssignmentPattern"?this.checkPatternExport(p,S.left):E==="RestElement"&&this.checkPatternExport(p,S.argument)},ke.checkVariableExport=function(p,S){if(p)for(var E=0,M=S;E<M.length;E+=1){var B=M[E];this.checkPatternExport(p,B.id)}},ke.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},ke.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")},ke.parseExportSpecifiers=function(p){var S=[],E=!0;for(this.expect(C.braceL);!this.eat(C.braceR);){if(E)E=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;S.push(this.parseExportSpecifier(p))}return S},ke.parseImport=function(p){return this.next(),this.type===C.string?(p.specifiers=wt,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")},ke.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,Be),this.finishNode(p,"ImportSpecifier")},ke.parseImportDefaultSpecifier=function(){var p=this.startNode();return p.local=this.parseIdent(),this.checkLValSimple(p.local,Be),this.finishNode(p,"ImportDefaultSpecifier")},ke.parseImportNamespaceSpecifier=function(){var p=this.startNode();return this.next(),this.expectContextual("as"),p.local=this.parseIdent(),this.checkLValSimple(p.local,Be),this.finishNode(p,"ImportNamespaceSpecifier")},ke.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},ke.parseWithClause=function(){var p=[];if(!this.eat(C._with))return p;this.expect(C.braceL);for(var S={},E=!0;!this.eat(C.braceR);){if(E)E=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;var M=this.parseImportAttribute(),B=M.key.type==="Identifier"?M.key.name:M.key.value;X(S,B)&&this.raiseRecoverable(M.key.start,"Duplicate attribute key '"+B+"'"),S[B]=!0,p.push(M)}return p},ke.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")},ke.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===C.string){var p=this.parseLiteral(this.value);return P.test(p.value)&&this.raise(p.start,"An export name cannot include a lone surrogate."),p}return this.parseIdent(!0)},ke.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)},ke.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 gn=I.prototype;gn.toAssignable=function(p,S,E){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",E&&this.checkPatternErrors(E,!0);for(var M=0,B=p.properties;M<B.length;M+=1){var Z=B[M];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",E&&this.checkPatternErrors(E,!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,E);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 E&&this.checkPatternErrors(E,!0);return p},gn.toAssignableList=function(p,S){for(var E=p.length,M=0;M<E;M++){var B=p[M];B&&this.toAssignable(B,S)}if(E){var Z=p[E-1];this.options.ecmaVersion===6&&S&&Z&&Z.type==="RestElement"&&Z.argument.type!=="Identifier"&&this.unexpected(Z.argument.start)}return p},gn.parseSpread=function(p){var S=this.startNode();return this.next(),S.argument=this.parseMaybeAssign(!1,p),this.finishNode(S,"SpreadElement")},gn.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")},gn.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()},gn.parseBindingList=function(p,S,E,M){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(E&&this.afterTrailingComma(p))break;if(this.type===C.ellipsis){var re=this.parseRestBinding();this.parseBindingListItem(re),B.push(re),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(M))}return B},gn.parseAssignableListItem=function(p){var S=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(S),S},gn.parseBindingListItem=function(p){return p},gn.parseMaybeDefault=function(p,S,E){if(E=E||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(C.eq))return E;var M=this.startNodeAt(p,S);return M.left=E,M.right=this.parseMaybeAssign(),this.finishNode(M,"AssignmentPattern")},gn.checkLValSimple=function(p,S,E){S===void 0&&(S=Dt);var M=S!==Dt;switch(p.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(p.name)&&this.raiseRecoverable(p.start,(M?"Binding ":"Assigning to ")+p.name+" in strict mode"),M&&(S===Be&&p.name==="let"&&this.raiseRecoverable(p.start,"let is disallowed as a lexically bound name"),E&&(X(E,p.name)&&this.raiseRecoverable(p.start,"Argument name clash"),E[p.name]=!0),S!==ge&&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":M&&this.raiseRecoverable(p.start,"Binding member expression");break;case"ParenthesizedExpression":return M&&this.raiseRecoverable(p.start,"Binding parenthesized expression"),this.checkLValSimple(p.expression,S,E);default:this.raise(p.start,(M?"Binding":"Assigning to")+" rvalue")}},gn.checkLValPattern=function(p,S,E){switch(S===void 0&&(S=Dt),p.type){case"ObjectPattern":for(var M=0,B=p.properties;M<B.length;M+=1){var Z=B[M];this.checkLValInnerPattern(Z,S,E)}break;case"ArrayPattern":for(var re=0,ye=p.elements;re<ye.length;re+=1){var ve=ye[re];ve&&this.checkLValInnerPattern(ve,S,E)}break;default:this.checkLValSimple(p,S,E)}},gn.checkLValInnerPattern=function(p,S,E){switch(S===void 0&&(S=Dt),p.type){case"Property":this.checkLValInnerPattern(p.value,S,E);break;case"AssignmentPattern":this.checkLValPattern(p.left,S,E);break;case"RestElement":this.checkLValPattern(p.argument,S,E);break;default:this.checkLValPattern(p,S,E)}};var Gt=function(S,E,M,B,Z){this.token=S,this.isExpr=!!E,this.preserveSpace=!!M,this.override=B,this.generator=!!Z},St={b_stat:new Gt("{",!1),b_expr:new Gt("{",!0),b_tmpl:new Gt("${",!1),p_stat:new Gt("(",!1),p_expr:new Gt("(",!0),q_tmpl:new Gt("`",!0,!0,function(p){return p.tryReadTemplateToken()}),f_stat:new Gt("function",!1),f_expr:new Gt("function",!0),f_expr_gen:new Gt("function",!0,!1,null,!0),f_gen:new Gt("function",!1,!1,null,!0)},Vr=I.prototype;Vr.initialContext=function(){return[St.b_stat]},Vr.curContext=function(){return this.context[this.context.length-1]},Vr.braceIsBlock=function(p){var S=this.curContext();return S===St.f_expr||S===St.f_stat?!0:p===C.colon&&(S===St.b_stat||S===St.b_expr)?!S.isExpr:p===C._return||p===C.name&&this.exprAllowed?_.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===St.b_stat:p===C._var||p===C._const||p===C.name?!1:!this.exprAllowed},Vr.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},Vr.updateContext=function(p){var S,E=this.type;E.keyword&&p===C.dot?this.exprAllowed=!1:(S=E.updateContext)?S.call(this,p):this.exprAllowed=E.beforeExpr},Vr.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===St.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)?St.b_stat:St.b_expr),this.exprAllowed=!0},C.dollarBraceL.updateContext=function(){this.context.push(St.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?St.p_stat:St.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()!==St.p_stat)&&!(p===C._return&&_.test(this.input.slice(this.lastTokEnd,this.start)))&&!((p===C.colon||p===C.braceL)&&this.curContext()===St.b_stat)?this.context.push(St.f_expr):this.context.push(St.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()===St.q_tmpl?this.context.pop():this.context.push(St.q_tmpl),this.exprAllowed=!1},C.star.updateContext=function(p){if(p===C._function){var S=this.context.length-1;this.context[S]===St.f_expr?this.context[S]=St.f_expr_gen:this.context[S]=St.f_gen}this.exprAllowed=!0},C.name.updateContext=function(p){var S=!1;this.options.ecmaVersion>=6&&p!==C.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(S=!0),this.exprAllowed=S};var Je=I.prototype;Je.checkPropClash=function(p,S,E){if(!(this.options.ecmaVersion>=9&&p.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(p.computed||p.method||p.shorthand))){var M=p.key,B;switch(M.type){case"Identifier":B=M.name;break;case"Literal":B=String(M.value);break;default:return}var Z=p.kind;if(this.options.ecmaVersion>=6){B==="__proto__"&&Z==="init"&&(S.proto&&(E?E.doubleProto<0&&(E.doubleProto=M.start):this.raiseRecoverable(M.start,"Redefinition of __proto__ property")),S.proto=!0);return}B="$"+B;var re=S[B];if(re){var ye;Z==="init"?ye=this.strict&&re.init||re.get||re.set:ye=re.init||re[Z],ye&&this.raiseRecoverable(M.start,"Redefinition of property")}else re=S[B]={init:!1,get:!1,set:!1};re[Z]=!0}},Je.parseExpression=function(p,S){var E=this.start,M=this.startLoc,B=this.parseMaybeAssign(p,S);if(this.type===C.comma){var Z=this.startNodeAt(E,M);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,E){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(p);this.exprAllowed=!1}var M=!1,B=-1,Z=-1,re=-1;S?(B=S.parenthesizedAssign,Z=S.trailingComma,re=S.doubleProto,S.parenthesizedAssign=S.trailingComma=-1):(S=new cr,M=!0);var ye=this.start,ve=this.startLoc;(this.type===C.parenL||this.type===C.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=p==="await");var Ve=this.parseMaybeConditional(p,S);if(E&&(Ve=E.call(this,Ve,ye,ve)),this.type.isAssign){var Qe=this.startNodeAt(ye,ve);return Qe.operator=this.value,this.type===C.eq&&(Ve=this.toAssignable(Ve,!1,S)),M||(S.parenthesizedAssign=S.trailingComma=S.doubleProto=-1),S.shorthandAssign>=Ve.start&&(S.shorthandAssign=-1),this.type===C.eq?this.checkLValPattern(Ve):this.checkLValSimple(Ve),Qe.left=Ve,this.next(),Qe.right=this.parseMaybeAssign(p),re>-1&&(S.doubleProto=re),this.finishNode(Qe,"AssignmentExpression")}else M&&this.checkExpressionErrors(S,!0);return B>-1&&(S.parenthesizedAssign=B),Z>-1&&(S.trailingComma=Z),Ve},Je.parseMaybeConditional=function(p,S){var E=this.start,M=this.startLoc,B=this.parseExprOps(p,S);if(this.checkExpressionErrors(S))return B;if(this.eat(C.question)){var Z=this.startNodeAt(E,M);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 E=this.start,M=this.startLoc,B=this.parseMaybeUnary(S,!1,!1,p);return this.checkExpressionErrors(S)||B.start===E&&B.type==="ArrowFunctionExpression"?B:this.parseExprOp(B,E,M,-1,p)},Je.parseExprOp=function(p,S,E,M,B){var Z=this.type.binop;if(Z!=null&&(!B||this.type!==C._in)&&Z>M){var re=this.type===C.logicalOR||this.type===C.logicalAND,ye=this.type===C.coalesce;ye&&(Z=C.logicalAND.binop);var ve=this.value;this.next();var Ve=this.start,Qe=this.startLoc,vt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,B),Ve,Qe,Z,B),Ut=this.buildBinary(S,E,p,vt,ve,re||ye);return(re&&this.type===C.coalesce||ye&&(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(Ut,S,E,M,B)}return p},Je.buildBinary=function(p,S,E,M,B,Z){M.type==="PrivateIdentifier"&&this.raise(M.start,"Private identifier can only be left side of binary expression");var re=this.startNodeAt(p,S);return re.left=E,re.operator=B,re.right=M,this.finishNode(re,Z?"LogicalExpression":"BinaryExpression")},Je.parseMaybeUnary=function(p,S,E,M){var B=this.start,Z=this.startLoc,re;if(this.isContextual("await")&&this.canAwait)re=this.parseAwait(M),S=!0;else if(this.type.prefix){var ye=this.startNode(),ve=this.type===C.incDec;ye.operator=this.value,ye.prefix=!0,this.next(),ye.argument=this.parseMaybeUnary(null,!0,ve,M),this.checkExpressionErrors(p,!0),ve?this.checkLValSimple(ye.argument):this.strict&&ye.operator==="delete"&&nc(ye.argument)?this.raiseRecoverable(ye.start,"Deleting local variable in strict mode"):ye.operator==="delete"&&io(ye.argument)?this.raiseRecoverable(ye.start,"Private fields can not be deleted"):S=!0,re=this.finishNode(ye,ve?"UpdateExpression":"UnaryExpression")}else if(!S&&this.type===C.privateId)(M||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),re=this.parsePrivateIdent(),this.type!==C._in&&this.unexpected();else{if(re=this.parseExprSubscripts(p,M),this.checkExpressionErrors(p))return re;for(;this.type.postfix&&!this.canInsertSemicolon();){var Ve=this.startNodeAt(B,Z);Ve.operator=this.value,Ve.prefix=!1,Ve.argument=re,this.checkLValSimple(re),this.next(),re=this.finishNode(Ve,"UpdateExpression")}}if(!E&&this.eat(C.starstar))if(S)this.unexpected(this.lastTokStart);else return this.buildBinary(B,Z,re,this.parseMaybeUnary(null,!1,!1,M),"**",!1);else return re};function nc(p){return p.type==="Identifier"||p.type==="ParenthesizedExpression"&&nc(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 E=this.start,M=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,E,M,!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,E,M,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,re=!1;;){var ye=this.parseSubscript(p,S,E,M,Z,re,B);if(ye.optional&&(re=!0),ye===p||ye.type==="ArrowFunctionExpression"){if(re){var ve=this.startNodeAt(S,E);ve.expression=ye,ye=this.finishNode(ve,"ChainExpression")}return ye}p=ye}},Je.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(C.arrow)},Je.parseSubscriptAsyncArrow=function(p,S,E,M){return this.parseArrowExpression(this.startNodeAt(p,S),E,!0,M)},Je.parseSubscript=function(p,S,E,M,B,Z,re){var ye=this.options.ecmaVersion>=11,ve=ye&&this.eat(C.questionDot);M&&ve&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Ve=this.eat(C.bracketL);if(Ve||ve&&this.type!==C.parenL&&this.type!==C.backQuote||this.eat(C.dot)){var Qe=this.startNodeAt(S,E);Qe.object=p,Ve?(Qe.property=this.parseExpression(),this.expect(C.bracketR)):this.type===C.privateId&&p.type!=="Super"?Qe.property=this.parsePrivateIdent():Qe.property=this.parseIdent(this.options.allowReserved!=="never"),Qe.computed=!!Ve,ye&&(Qe.optional=ve),p=this.finishNode(Qe,"MemberExpression")}else if(!M&&this.eat(C.parenL)){var vt=new cr,Ut=this.yieldPos,ea=this.awaitPos,Jt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Pr=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1,vt);if(B&&!ve&&this.shouldParseAsyncArrow())return this.checkPatternErrors(vt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=Ut,this.awaitPos=ea,this.awaitIdentPos=Jt,this.parseSubscriptAsyncArrow(S,E,Pr,re);this.checkExpressionErrors(vt,!0),this.yieldPos=Ut||this.yieldPos,this.awaitPos=ea||this.awaitPos,this.awaitIdentPos=Jt||this.awaitIdentPos;var Si=this.startNodeAt(S,E);Si.callee=p,Si.arguments=Pr,ye&&(Si.optional=ve),p=this.finishNode(Si,"CallExpression")}else if(this.type===C.backQuote){(ve||Z)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var jr=this.startNodeAt(S,E);jr.tag=p,jr.quasi=this.parseTemplate({isTagged:!0}),p=this.finishNode(jr,"TaggedTemplateExpression")}return p},Je.parseExprAtom=function(p,S,E){this.type===C.slash&&this.readRegexp();var M,B=this.potentialArrowAt===this.start;switch(this.type){case C._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),M=this.startNode(),this.next(),this.type===C.parenL&&!this.allowDirectSuper&&this.raise(M.start,"super() call outside constructor of a subclass"),this.type!==C.dot&&this.type!==C.bracketL&&this.type!==C.parenL&&this.unexpected(),this.finishNode(M,"Super");case C._this:return M=this.startNode(),this.next(),this.finishNode(M,"ThisExpression");case C.name:var Z=this.start,re=this.startLoc,ye=this.containsEsc,ve=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!ye&&ve.name==="async"&&!this.canInsertSemicolon()&&this.eat(C._function))return this.overrideContext(St.f_expr),this.parseFunction(this.startNodeAt(Z,re),0,!1,!0,S);if(B&&!this.canInsertSemicolon()){if(this.eat(C.arrow))return this.parseArrowExpression(this.startNodeAt(Z,re),[ve],!1,S);if(this.options.ecmaVersion>=8&&ve.name==="async"&&this.type===C.name&&!ye&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return ve=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(C.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(Z,re),[ve],!0,S)}return ve;case C.regexp:var Ve=this.value;return M=this.parseLiteral(Ve.value),M.regex={pattern:Ve.pattern,flags:Ve.flags},M;case C.num:case C.string:return this.parseLiteral(this.value);case C._null:case C._true:case C._false:return M=this.startNode(),M.value=this.type===C._null?null:this.type===C._true,M.raw=this.type.keyword,this.next(),this.finishNode(M,"Literal");case C.parenL:var Qe=this.start,vt=this.parseParenAndDistinguishExpression(B,S);return p&&(p.parenthesizedAssign<0&&!this.isSimpleAssignTarget(vt)&&(p.parenthesizedAssign=Qe),p.parenthesizedBind<0&&(p.parenthesizedBind=Qe)),vt;case C.bracketL:return M=this.startNode(),this.next(),M.elements=this.parseExprList(C.bracketR,!0,!0,p),this.finishNode(M,"ArrayExpression");case C.braceL:return this.overrideContext(St.b_expr),this.parseObj(!1,p);case C._function:return M=this.startNode(),this.next(),this.parseFunction(M,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(E):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 E=this.startNodeAt(S.start,S.loc&&S.loc.start);return E.name="import",S.meta=this.finishNode(E,"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 E=this.start,M=this.startLoc,B,Z=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var re=this.start,ye=this.startLoc,ve=[],Ve=!0,Qe=!1,vt=new cr,Ut=this.yieldPos,ea=this.awaitPos,Jt;for(this.yieldPos=0,this.awaitPos=0;this.type!==C.parenR;)if(Ve?Ve=!1:this.expect(C.comma),Z&&this.afterTrailingComma(C.parenR,!0)){Qe=!0;break}else if(this.type===C.ellipsis){Jt=this.start,ve.push(this.parseParenItem(this.parseRestBinding())),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else ve.push(this.parseMaybeAssign(!1,vt,this.parseParenItem));var Pr=this.lastTokEnd,Si=this.lastTokEndLoc;if(this.expect(C.parenR),p&&this.shouldParseArrow(ve)&&this.eat(C.arrow))return this.checkPatternErrors(vt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Ut,this.awaitPos=ea,this.parseParenArrowList(E,M,ve,S);(!ve.length||Qe)&&this.unexpected(this.lastTokStart),Jt&&this.unexpected(Jt),this.checkExpressionErrors(vt,!0),this.yieldPos=Ut||this.yieldPos,this.awaitPos=ea||this.awaitPos,ve.length>1?(B=this.startNodeAt(re,ye),B.expressions=ve,this.finishNodeAt(B,"SequenceExpression",Pr,Si)):B=ve[0]}else B=this.parseParenExpression();if(this.options.preserveParens){var jr=this.startNodeAt(E,M);return jr.expression=B,this.finishNode(jr,"ParenthesizedExpression")}else return B},Je.parseParenItem=function(p){return p},Je.parseParenArrowList=function(p,S,E,M){return this.parseArrowExpression(this.startNodeAt(p,S),E,!1,M)};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 E=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'"),E&&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 M=this.start,B=this.startLoc;return p.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),M,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,E=this.startNode();return this.type===C.invalidTemplate?(S||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),E.value={raw:this.value.replace(/\r\n?/g,`
|
|
80
|
-
`),cooked:null}):E.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
81
|
-
`),cooked:this.value},this.next(),E.tail=this.type===C.backQuote,this.finishNode(E,"TemplateElement")},Je.parseTemplate=function(p){p===void 0&&(p={});var S=p.isTagged;S===void 0&&(S=!1);var E=this.startNode();this.next(),E.expressions=[];var M=this.parseTemplateElement({isTagged:S});for(E.quasis=[M];!M.tail;)this.type===C.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(C.dollarBraceL),E.expressions.push(this.parseExpression()),this.expect(C.braceR),E.quasis.push(M=this.parseTemplateElement({isTagged:S}));return this.next(),this.finishNode(E,"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)&&!_.test(this.input.slice(this.lastTokEnd,this.start))},Je.parseObj=function(p,S){var E=this.startNode(),M=!0,B={};for(E.properties=[],this.next();!this.eat(C.braceR);){if(M)M=!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),E.properties.push(Z)}return this.finishNode(E,p?"ObjectPattern":"ObjectExpression")},Je.parseProperty=function(p,S){var E=this.startNode(),M,B,Z,re;if(this.options.ecmaVersion>=9&&this.eat(C.ellipsis))return p?(E.argument=this.parseIdent(!1),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(E,"RestElement")):(E.argument=this.parseMaybeAssign(!1,S),this.type===C.comma&&S&&S.trailingComma<0&&(S.trailingComma=this.start),this.finishNode(E,"SpreadElement"));this.options.ecmaVersion>=6&&(E.method=!1,E.shorthand=!1,(p||S)&&(Z=this.start,re=this.startLoc),p||(M=this.eat(C.star)));var ye=this.containsEsc;return this.parsePropertyName(E),!p&&!ye&&this.options.ecmaVersion>=8&&!M&&this.isAsyncProp(E)?(B=!0,M=this.options.ecmaVersion>=9&&this.eat(C.star),this.parsePropertyName(E)):B=!1,this.parsePropertyValue(E,p,M,B,Z,re,S,ye),this.finishNode(E,"Property")},Je.parseGetterSetter=function(p){var S=p.key.name;this.parsePropertyName(p),p.value=this.parseMethod(!1),p.kind=S;var E=p.kind==="get"?0:1;if(p.value.params.length!==E){var M=p.value.start;p.kind==="get"?this.raiseRecoverable(M,"getter should have no params"):this.raiseRecoverable(M,"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,E,M,B,Z,re,ye){(E||M)&&this.type===C.colon&&this.unexpected(),this.eat(C.colon)?(p.value=S?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,re),p.kind="init"):this.options.ecmaVersion>=6&&this.type===C.parenL?(S&&this.unexpected(),p.method=!0,p.value=this.parseMethod(E,M),p.kind="init"):!S&&!ye&&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?((E||M)&&this.unexpected(),this.parseGetterSetter(p)):this.options.ecmaVersion>=6&&!p.computed&&p.key.type==="Identifier"?((E||M)&&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&&re?(re.shorthandAssign<0&&(re.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,E){var M=this.startNode(),B=this.yieldPos,Z=this.awaitPos,re=this.awaitIdentPos;return this.initFunction(M),this.options.ecmaVersion>=6&&(M.generator=p),this.options.ecmaVersion>=8&&(M.async=!!S),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(S,M.generator)|hn|(E?lr:0)),this.expect(C.parenL),M.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(M,!1,!0,!1),this.yieldPos=B,this.awaitPos=Z,this.awaitIdentPos=re,this.finishNode(M,"FunctionExpression")},Je.parseArrowExpression=function(p,S,E,M){var B=this.yieldPos,Z=this.awaitPos,re=this.awaitIdentPos;return this.enterScope(je(E,!1)|or),this.initFunction(p),this.options.ecmaVersion>=8&&(p.async=!!E),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,p.params=this.toAssignableList(S,!0),this.parseFunctionBody(p,!0,!1,M),this.yieldPos=B,this.awaitPos=Z,this.awaitIdentPos=re,this.finishNode(p,"ArrowFunctionExpression")},Je.parseFunctionBody=function(p,S,E,M){var B=S&&this.type!==C.braceL,Z=this.strict,re=!1;if(B)p.body=this.parseMaybeAssign(M),p.expression=!0,this.checkParams(p,!1);else{var ye=this.options.ecmaVersion>=7&&!this.isSimpleParamList(p.params);(!Z||ye)&&(re=this.strictDirective(this.end),re&&ye&&this.raiseRecoverable(p.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var ve=this.labels;this.labels=[],re&&(this.strict=!0),this.checkParams(p,!Z&&!re&&!S&&!E&&this.isSimpleParamList(p.params)),this.strict&&p.id&&this.checkLValSimple(p.id,ge),p.body=this.parseBlock(!1,void 0,re&&!Z),p.expression=!1,this.adaptDirectivePrologue(p.body.body),this.labels=ve}this.exitScope()},Je.isSimpleParamList=function(p){for(var S=0,E=p;S<E.length;S+=1){var M=E[S];if(M.type!=="Identifier")return!1}return!0},Je.checkParams=function(p,S){for(var E=Object.create(null),M=0,B=p.params;M<B.length;M+=1){var Z=B[M];this.checkLValInnerPattern(Z,mt,S?null:E)}},Je.parseExprList=function(p,S,E,M){for(var B=[],Z=!0;!this.eat(p);){if(Z)Z=!1;else if(this.expect(C.comma),S&&this.afterTrailingComma(p))break;var re=void 0;E&&this.type===C.comma?re=null:this.type===C.ellipsis?(re=this.parseSpread(M),M&&this.type===C.comma&&M.trailingComma<0&&(M.trailingComma=this.start)):re=this.parseMaybeAssign(!1,M),B.push(re)}return B},Je.checkUnreserved=function(p){var S=p.start,E=p.end,M=p.name;if(this.inGenerator&&M==="yield"&&this.raiseRecoverable(S,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&M==="await"&&this.raiseRecoverable(S,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&he)&&M==="arguments"&&this.raiseRecoverable(S,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(M==="arguments"||M==="await")&&this.raise(S,"Cannot use "+M+" in class static initialization block"),this.keywords.test(M)&&this.raise(S,"Unexpected keyword '"+M+"'"),!(this.options.ecmaVersion<6&&this.input.slice(S,E).indexOf("\\")!==-1)){var B=this.strict?this.reservedWordsStrict:this.reservedWords;B.test(M)&&(!this.inAsync&&M==="await"&&this.raiseRecoverable(S,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(S,"The keyword '"+M+"' 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 El=I.prototype;El.raise=function(p,S){var E=xe(this.input,p);S+=" ("+E.line+":"+E.column+")",this.sourceFile&&(S+=" in "+this.sourceFile);var M=new SyntaxError(S);throw M.pos=p,M.loc=E,M.raisedAt=this.pos,M},El.raiseRecoverable=El.raise,El.curPosition=function(){if(this.options.locations)return new te(this.curLine,this.pos-this.lineStart)};var mi=I.prototype,yp=function(S){this.flags=S,this.var=[],this.lexical=[],this.functions=[]};mi.enterScope=function(p){this.scopeStack.push(new yp(p))},mi.exitScope=function(){this.scopeStack.pop()},mi.treatFunctionsAsVarInScope=function(p){return p.flags&Ft||!this.inModule&&p.flags&Ke},mi.declareName=function(p,S,E){var M=!1;if(S===Be){var B=this.currentScope();M=B.lexical.indexOf(p)>-1||B.functions.indexOf(p)>-1||B.var.indexOf(p)>-1,B.lexical.push(p),this.inModule&&B.flags&Ke&&delete this.undefinedExports[p]}else if(S===fe){var Z=this.currentScope();Z.lexical.push(p)}else if(S===mn){var re=this.currentScope();this.treatFunctionsAsVar?M=re.lexical.indexOf(p)>-1:M=re.lexical.indexOf(p)>-1||re.var.indexOf(p)>-1,re.functions.push(p)}else for(var ye=this.scopeStack.length-1;ye>=0;--ye){var ve=this.scopeStack[ye];if(ve.lexical.indexOf(p)>-1&&!(ve.flags&fn&&ve.lexical[0]===p)||!this.treatFunctionsAsVarInScope(ve)&&ve.functions.indexOf(p)>-1){M=!0;break}if(ve.var.push(p),this.inModule&&ve.flags&Ke&&delete this.undefinedExports[p],ve.flags&he)break}M&&this.raiseRecoverable(E,"Identifier '"+p+"' has already been declared")},mi.checkLocalExport=function(p){this.scopeStack[0].lexical.indexOf(p.name)===-1&&this.scopeStack[0].var.indexOf(p.name)===-1&&(this.undefinedExports[p.name]=p)},mi.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},mi.currentVarScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(he|dn|pn))return S}},mi.currentThisScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(he|dn|pn)&&!(S.flags&or))return S}};var Ks=function(S,E,M){this.type="",this.start=E,this.end=0,S.options.locations&&(this.loc=new L(S,M)),S.options.directSourceFile&&(this.sourceFile=S.options.directSourceFile),S.options.ranges&&(this.range=[E,0])},ts=I.prototype;ts.startNode=function(){return new Ks(this,this.start,this.startLoc)},ts.startNodeAt=function(p,S){return new Ks(this,p,S)};function Al(p,S,E,M){return p.type=S,p.end=E,this.options.locations&&(p.loc.end=M),this.options.ranges&&(p.range[1]=E),p}ts.finishNode=function(p,S){return Al.call(this,p,S,this.lastTokEnd,this.lastTokEndLoc)},ts.finishNodeAt=function(p,S,E,M){return Al.call(this,p,S,E,M)},ts.copyNode=function(p){var S=new Ks(this,p.start,this.startLoc);for(var E in p)S[E]=p[E];return S};var xp="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",rc="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",gi=rc+" Extended_Pictographic",Yt=gi,yn=Yt+" EBase EComp EMod EPres ExtPict",ns=yn,ic=ns,r0={9:rc,10:gi,11:Yt,12:yn,13:ns,14:ic},i0="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",bp={9:"",10:"",11:"",12:"",13:"",14:i0},Gs="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",Nl="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=Nl+" 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",Ys=is+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ss=Ys+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Wt=ss+" "+xp,Sp={9:Nl,10:rs,11:is,12:Ys,13:ss,14:Wt},sc={};function as(p){var S=sc[p]={binary:_e(r0[p]+" "+Gs),binaryOfStrings:_e(bp[p]),nonBinary:{General_Category:_e(Gs),Script:_e(Sp[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 Ii=0,vp=[9,10,11,12,13,14];Ii<vp.length;Ii+=1){var kp=vp[Ii];as(kp)}var Ne=I.prototype,Tl=function(S,E){this.parent=S,this.base=E||this};Tl.prototype.separatedFrom=function(S){for(var E=this;E;E=E.parent)for(var M=S;M;M=M.parent)if(E.base===M.base&&E!==M)return!0;return!1},Tl.prototype.sibling=function(){return new Tl(this.parent,this.base)};var jn=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=sc[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};jn.prototype.reset=function(S,E,M){var B=M.indexOf("v")!==-1,Z=M.indexOf("u")!==-1;this.start=S|0,this.source=E+"",this.flags=M,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)},jn.prototype.raise=function(S){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+S)},jn.prototype.at=function(S,E){E===void 0&&(E=!1);var M=this.source,B=M.length;if(S>=B)return-1;var Z=M.charCodeAt(S);if(!(E||this.switchU)||Z<=55295||Z>=57344||S+1>=B)return Z;var re=M.charCodeAt(S+1);return re>=56320&&re<=57343?(Z<<10)+re-56613888:Z},jn.prototype.nextIndex=function(S,E){E===void 0&&(E=!1);var M=this.source,B=M.length;if(S>=B)return B;var Z=M.charCodeAt(S),re;return!(E||this.switchU)||Z<=55295||Z>=57344||S+1>=B||(re=M.charCodeAt(S+1))<56320||re>57343?S+1:S+2},jn.prototype.current=function(S){return S===void 0&&(S=!1),this.at(this.pos,S)},jn.prototype.lookahead=function(S){return S===void 0&&(S=!1),this.at(this.nextIndex(this.pos,S),S)},jn.prototype.advance=function(S){S===void 0&&(S=!1),this.pos=this.nextIndex(this.pos,S)},jn.prototype.eat=function(S,E){return E===void 0&&(E=!1),this.current(E)===S?(this.advance(E),!0):!1},jn.prototype.eatChars=function(S,E){E===void 0&&(E=!1);for(var M=this.pos,B=0,Z=S;B<Z.length;B+=1){var re=Z[B],ye=this.at(M,E);if(ye===-1||ye!==re)return!1;M=this.nextIndex(M,E)}return this.pos=M,!0},Ne.validateRegExpFlags=function(p){for(var S=p.validFlags,E=p.flags,M=!1,B=!1,Z=0;Z<E.length;Z++){var re=E.charAt(Z);S.indexOf(re)===-1&&this.raise(p.start,"Invalid regular expression flag"),E.indexOf(re,Z+1)>-1&&this.raise(p.start,"Duplicate regular expression flag"),re==="u"&&(M=!0),re==="v"&&(B=!0)}this.options.ecmaVersion>=15&&M&&B&&this.raise(p.start,"Invalid regular expression flag")};function Ml(p){for(var S in p)return!0;return!1}Ne.validateRegExpPattern=function(p){this.regexp_pattern(p),!p.switchN&&this.options.ecmaVersion>=9&&Ml(p.groupNames)&&(p.switchN=!0,this.regexp_pattern(p))},Ne.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,E=p.backReferenceNames;S<E.length;S+=1){var M=E[S];p.groupNames[M]||p.raise("Invalid named capture referenced")}},Ne.regexp_disjunction=function(p){var S=this.options.ecmaVersion>=16;for(S&&(p.branchID=new Tl(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")},Ne.regexp_alternative=function(p){for(;p.pos<p.source.length&&this.regexp_eatTerm(p););},Ne.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},Ne.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 E=!1;if(this.options.ecmaVersion>=9&&(E=p.eat(60)),p.eat(61)||p.eat(33))return this.regexp_disjunction(p),p.eat(41)||p.raise("Unterminated group"),p.lastAssertionIsQuantifiable=!E,!0}return p.pos=S,!1},Ne.regexp_eatQuantifier=function(p,S){return S===void 0&&(S=!1),this.regexp_eatQuantifierPrefix(p,S)?(p.eat(63),!0):!1},Ne.regexp_eatQuantifierPrefix=function(p,S){return p.eat(42)||p.eat(43)||p.eat(63)||this.regexp_eatBracedQuantifier(p,S)},Ne.regexp_eatBracedQuantifier=function(p,S){var E=p.pos;if(p.eat(123)){var M=0,B=-1;if(this.regexp_eatDecimalDigits(p)&&(M=p.lastIntValue,p.eat(44)&&this.regexp_eatDecimalDigits(p)&&(B=p.lastIntValue),p.eat(125)))return B!==-1&&B<M&&!S&&p.raise("numbers out of order in {} quantifier"),!0;p.switchU&&!S&&p.raise("Incomplete quantifier"),p.pos=E}return!1},Ne.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)},Ne.regexp_eatReverseSolidusAtomEscape=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatAtomEscape(p))return!0;p.pos=S}return!1},Ne.regexp_eatUncapturingGroup=function(p){var S=p.pos;if(p.eat(40)){if(p.eat(63)){if(this.options.ecmaVersion>=16){var E=this.regexp_eatModifiers(p),M=p.eat(45);if(E||M){for(var B=0;B<E.length;B++){var Z=E.charAt(B);E.indexOf(Z,B+1)>-1&&p.raise("Duplicate regular expression modifiers")}if(M){var re=this.regexp_eatModifiers(p);!E&&!re&&p.current()===58&&p.raise("Invalid regular expression modifiers");for(var ye=0;ye<re.length;ye++){var ve=re.charAt(ye);(re.indexOf(ve,ye+1)>-1||E.indexOf(ve)>-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},Ne.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},Ne.regexp_eatModifiers=function(p){for(var S="",E=0;(E=p.current())!==-1&&yi(E);)S+=j(E),p.advance();return S};function yi(p){return p===105||p===109||p===115}Ne.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)},Ne.regexp_eatInvalidBracedQuantifier=function(p){return this.regexp_eatBracedQuantifier(p,!0)&&p.raise("Nothing to repeat"),!1},Ne.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}Ne.regexp_eatPatternCharacters=function(p){for(var S=p.pos,E=0;(E=p.current())!==-1&&!$n(E);)p.advance();return p.pos!==S},Ne.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},Ne.regexp_groupSpecifier=function(p){if(p.eat(63)){this.regexp_eatGroupName(p)||p.raise("Invalid group");var S=this.options.ecmaVersion>=16,E=p.groupNames[p.lastStringValue];if(E)if(S)for(var M=0,B=E;M<B.length;M+=1){var Z=B[M];Z.separatedFrom(p.branchID)||p.raise("Duplicate capture group name")}else p.raise("Duplicate capture group name");S?(E||(p.groupNames[p.lastStringValue]=[])).push(p.branchID):p.groupNames[p.lastStringValue]=!0}},Ne.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},Ne.regexp_eatRegExpIdentifierName=function(p){if(p.lastStringValue="",this.regexp_eatRegExpIdentifierStart(p)){for(p.lastStringValue+=j(p.lastIntValue);this.regexp_eatRegExpIdentifierPart(p);)p.lastStringValue+=j(p.lastIntValue);return!0}return!1},Ne.regexp_eatRegExpIdentifierStart=function(p){var S=p.pos,E=this.options.ecmaVersion>=11,M=p.current(E);return p.advance(E),M===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,E)&&(M=p.lastIntValue),Cp(M)?(p.lastIntValue=M,!0):(p.pos=S,!1)};function Cp(p){return k(p,!0)||p===36||p===95}Ne.regexp_eatRegExpIdentifierPart=function(p){var S=p.pos,E=this.options.ecmaVersion>=11,M=p.current(E);return p.advance(E),M===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,E)&&(M=p.lastIntValue),s0(M)?(p.lastIntValue=M,!0):(p.pos=S,!1)};function s0(p){return w(p,!0)||p===36||p===95||p===8204||p===8205}Ne.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)},Ne.regexp_eatBackReference=function(p){var S=p.pos;if(this.regexp_eatDecimalEscape(p)){var E=p.lastIntValue;if(p.switchU)return E>p.maxBackReference&&(p.maxBackReference=E),!0;if(E<=p.numCapturingParens)return!0;p.pos=S}return!1},Ne.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},Ne.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)},Ne.regexp_eatCControlLetter=function(p){var S=p.pos;if(p.eat(99)){if(this.regexp_eatControlLetter(p))return!0;p.pos=S}return!1},Ne.regexp_eatZero=function(p){return p.current()===48&&!bi(p.lookahead())?(p.lastIntValue=0,p.advance(),!0):!1},Ne.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},Ne.regexp_eatControlLetter=function(p){var S=p.current();return Ol(S)?(p.lastIntValue=S%32,p.advance(),!0):!1};function Ol(p){return p>=65&&p<=90||p>=97&&p<=122}Ne.regexp_eatRegExpUnicodeEscapeSequence=function(p,S){S===void 0&&(S=!1);var E=p.pos,M=S||p.switchU;if(p.eat(117)){if(this.regexp_eatFixedHexDigits(p,4)){var B=p.lastIntValue;if(M&&B>=55296&&B<=56319){var Z=p.pos;if(p.eat(92)&&p.eat(117)&&this.regexp_eatFixedHexDigits(p,4)){var re=p.lastIntValue;if(re>=56320&&re<=57343)return p.lastIntValue=(B-55296)*1024+(re-56320)+65536,!0}p.pos=Z,p.lastIntValue=B}return!0}if(M&&p.eat(123)&&this.regexp_eatHexDigits(p)&&p.eat(125)&&wp(p.lastIntValue))return!0;M&&p.raise("Invalid unicode escape"),p.pos=E}return!1};function wp(p){return p>=0&&p<=1114111}Ne.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},Ne.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,xi=1,It=2;Ne.regexp_eatCharacterClassEscape=function(p){var S=p.current();if(ac(S))return p.lastIntValue=-1,p.advance(),xi;var E=!1;if(p.switchU&&this.options.ecmaVersion>=9&&((E=S===80)||S===112)){p.lastIntValue=-1,p.advance();var M;if(p.eat(123)&&(M=this.regexp_eatUnicodePropertyValueExpression(p))&&p.eat(125))return E&&M===It&&p.raise("Invalid property name"),M;p.raise("Invalid property name")}return ao};function ac(p){return p===100||p===68||p===115||p===83||p===119||p===87}Ne.regexp_eatUnicodePropertyValueExpression=function(p){var S=p.pos;if(this.regexp_eatUnicodePropertyName(p)&&p.eat(61)){var E=p.lastStringValue;if(this.regexp_eatUnicodePropertyValue(p)){var M=p.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(p,E,M),xi}}if(p.pos=S,this.regexp_eatLoneUnicodePropertyNameOrValue(p)){var B=p.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(p,B)}return ao},Ne.regexp_validateUnicodePropertyNameAndValue=function(p,S,E){X(p.unicodeProperties.nonBinary,S)||p.raise("Invalid property name"),p.unicodeProperties.nonBinary[S].test(E)||p.raise("Invalid property value")},Ne.regexp_validateUnicodePropertyNameOrValue=function(p,S){if(p.unicodeProperties.binary.test(S))return xi;if(p.switchV&&p.unicodeProperties.binaryOfStrings.test(S))return It;p.raise("Invalid property name")},Ne.regexp_eatUnicodePropertyName=function(p){var S=0;for(p.lastStringValue="";oc(S=p.current());)p.lastStringValue+=j(S),p.advance();return p.lastStringValue!==""};function oc(p){return Ol(p)||p===95}Ne.regexp_eatUnicodePropertyValue=function(p){var S=0;for(p.lastStringValue="";lc(S=p.current());)p.lastStringValue+=j(S),p.advance();return p.lastStringValue!==""};function lc(p){return oc(p)||bi(p)}Ne.regexp_eatLoneUnicodePropertyNameOrValue=function(p){return this.regexp_eatUnicodePropertyValue(p)},Ne.regexp_eatCharacterClass=function(p){if(p.eat(91)){var S=p.eat(94),E=this.regexp_classContents(p);return p.eat(93)||p.raise("Unterminated character class"),S&&E===It&&p.raise("Negated character class may contain strings"),!0}return!1},Ne.regexp_classContents=function(p){return p.current()===93?xi:p.switchV?this.regexp_classSetExpression(p):(this.regexp_nonEmptyClassRanges(p),xi)},Ne.regexp_nonEmptyClassRanges=function(p){for(;this.regexp_eatClassAtom(p);){var S=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassAtom(p)){var E=p.lastIntValue;p.switchU&&(S===-1||E===-1)&&p.raise("Invalid character class"),S!==-1&&E!==-1&&S>E&&p.raise("Range out of order in character class")}}},Ne.regexp_eatClassAtom=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatClassEscape(p))return!0;if(p.switchU){var E=p.current();(E===99||cc(E))&&p.raise("Invalid class escape"),p.raise("Invalid escape")}p.pos=S}var M=p.current();return M!==93?(p.lastIntValue=M,p.advance(),!0):!1},Ne.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)},Ne.regexp_classSetExpression=function(p){var S=xi,E;if(!this.regexp_eatClassSetRange(p))if(E=this.regexp_eatClassSetOperand(p)){E===It&&(S=It);for(var M=p.pos;p.eatChars([38,38]);){if(p.current()!==38&&(E=this.regexp_eatClassSetOperand(p))){E!==It&&(S=xi);continue}p.raise("Invalid character in character class")}if(M!==p.pos)return S;for(;p.eatChars([45,45]);)this.regexp_eatClassSetOperand(p)||p.raise("Invalid character in character class");if(M!==p.pos)return S}else p.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(p)){if(E=this.regexp_eatClassSetOperand(p),!E)return S;E===It&&(S=It)}},Ne.regexp_eatClassSetRange=function(p){var S=p.pos;if(this.regexp_eatClassSetCharacter(p)){var E=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassSetCharacter(p)){var M=p.lastIntValue;return E!==-1&&M!==-1&&E>M&&p.raise("Range out of order in character class"),!0}p.pos=S}return!1},Ne.regexp_eatClassSetOperand=function(p){return this.regexp_eatClassSetCharacter(p)?xi:this.regexp_eatClassStringDisjunction(p)||this.regexp_eatNestedClass(p)},Ne.regexp_eatNestedClass=function(p){var S=p.pos;if(p.eat(91)){var E=p.eat(94),M=this.regexp_classContents(p);if(p.eat(93))return E&&M===It&&p.raise("Negated character class may contain strings"),M;p.pos=S}if(p.eat(92)){var B=this.regexp_eatCharacterClassEscape(p);if(B)return B;p.pos=S}return null},Ne.regexp_eatClassStringDisjunction=function(p){var S=p.pos;if(p.eatChars([92,113])){if(p.eat(123)){var E=this.regexp_classStringDisjunctionContents(p);if(p.eat(125))return E}else p.raise("Invalid escape");p.pos=S}return null},Ne.regexp_classStringDisjunctionContents=function(p){for(var S=this.regexp_classString(p);p.eat(124);)this.regexp_classString(p)===It&&(S=It);return S},Ne.regexp_classString=function(p){for(var S=0;this.regexp_eatClassSetCharacter(p);)S++;return S===1?xi:It},Ne.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 E=p.current();return E<0||E===p.lookahead()&&Ws(E)||Ep(E)?!1:(p.advance(),p.lastIntValue=E,!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 Ep(p){return p===40||p===41||p===45||p===47||p>=91&&p<=93||p>=123&&p<=125}Ne.regexp_eatClassSetReservedPunctuator=function(p){var S=p.current();return Ap(S)?(p.lastIntValue=S,p.advance(),!0):!1};function Ap(p){return p===33||p===35||p===37||p===38||p===44||p===45||p>=58&&p<=62||p===64||p===96||p===126}Ne.regexp_eatClassControlLetter=function(p){var S=p.current();return bi(S)||S===95?(p.lastIntValue=S%32,p.advance(),!0):!1},Ne.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},Ne.regexp_eatDecimalDigits=function(p){var S=p.pos,E=0;for(p.lastIntValue=0;bi(E=p.current());)p.lastIntValue=10*p.lastIntValue+(E-48),p.advance();return p.pos!==S};function bi(p){return p>=48&&p<=57}Ne.regexp_eatHexDigits=function(p){var S=p.pos,E=0;for(p.lastIntValue=0;Np(E=p.current());)p.lastIntValue=16*p.lastIntValue+uc(E),p.advance();return p.pos!==S};function Np(p){return p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102}function uc(p){return p>=65&&p<=70?10+(p-65):p>=97&&p<=102?10+(p-97):p-48}Ne.regexp_eatLegacyOctalEscapeSequence=function(p){if(this.regexp_eatOctalDigit(p)){var S=p.lastIntValue;if(this.regexp_eatOctalDigit(p)){var E=p.lastIntValue;S<=3&&this.regexp_eatOctalDigit(p)?p.lastIntValue=S*64+E*8+p.lastIntValue:p.lastIntValue=S*8+E}else p.lastIntValue=S;return!0}return!1},Ne.regexp_eatOctalDigit=function(p){var S=p.current();return cc(S)?(p.lastIntValue=S-48,p.advance(),!0):(p.lastIntValue=0,!1)};function cc(p){return p>=48&&p<=55}Ne.regexp_eatFixedHexDigits=function(p,S){var E=p.pos;p.lastIntValue=0;for(var M=0;M<S;++M){var B=p.current();if(!Np(B))return p.pos=E,!1;p.lastIntValue=16*p.lastIntValue+uc(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 L(S,S.startLoc,S.endLoc)),S.options.ranges&&(this.range=[S.start,S.end])},nt=I.prototype;nt.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()},nt.getToken=function(){return this.next(),new Xs(this)},typeof Symbol<"u"&&(nt[Symbol.iterator]=function(){var p=this;return{next:function(){var S=p.getToken();return{done:S.type===C.eof,value:S}}}}),nt.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())},nt.readToken=function(p){return k(p,this.options.ecmaVersion>=6)||p===92?this.readWord():this.getTokenFromCode(p)},nt.fullCharCodeAt=function(p){var S=this.input.charCodeAt(p);if(S<=55295||S>=56320)return S;var E=this.input.charCodeAt(p+1);return E<=56319||E>=57344?S:(S<<10)+E-56613888},nt.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},nt.skipBlockComment=function(){var p=this.options.onComment&&this.curPosition(),S=this.pos,E=this.input.indexOf("*/",this.pos+=2);if(E===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=E+2,this.options.locations)for(var M=void 0,B=S;(M=q(this.input,B,this.pos))>-1;)++this.curLine,B=this.lineStart=M;this.options.onComment&&this.options.onComment(!0,this.input.slice(S+2,E),S,this.pos,p,this.curPosition())},nt.skipLineComment=function(p){for(var S=this.pos,E=this.options.onComment&&this.curPosition(),M=this.input.charCodeAt(this.pos+=p);this.pos<this.input.length&&!$(M);)M=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(S+p,this.pos),S,this.pos,E,this.curPosition())},nt.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&&ue.test(String.fromCharCode(p)))++this.pos;else break e}}},nt.finishToken=function(p,S){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var E=this.type;this.type=p,this.value=S,this.updateContext(E)},nt.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))},nt.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)},nt.readToken_mult_modulo_exp=function(p){var S=this.input.charCodeAt(this.pos+1),E=1,M=p===42?C.star:C.modulo;return this.options.ecmaVersion>=7&&p===42&&S===42&&(++E,M=C.starstar,S=this.input.charCodeAt(this.pos+2)),S===61?this.finishOp(C.assign,E+1):this.finishOp(M,E)},nt.readToken_pipe_amp=function(p){var S=this.input.charCodeAt(this.pos+1);if(S===p){if(this.options.ecmaVersion>=12){var E=this.input.charCodeAt(this.pos+2);if(E===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)},nt.readToken_caret=function(){var p=this.input.charCodeAt(this.pos+1);return p===61?this.finishOp(C.assign,2):this.finishOp(C.bitwiseXOR,1)},nt.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||_.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)},nt.readToken_lt_gt=function(p){var S=this.input.charCodeAt(this.pos+1),E=1;return S===p?(E=p===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+E)===61?this.finishOp(C.assign,E+1):this.finishOp(C.bitShift,E)):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&&(E=2),this.finishOp(C.relational,E))},nt.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)},nt.readToken_question=function(){var p=this.options.ecmaVersion;if(p>=11){var S=this.input.charCodeAt(this.pos+1);if(S===46){var E=this.input.charCodeAt(this.pos+2);if(E<48||E>57)return this.finishOp(C.questionDot,2)}if(S===63){if(p>=12){var M=this.input.charCodeAt(this.pos+2);if(M===61)return this.finishOp(C.assign,3)}return this.finishOp(C.coalesce,2)}}return this.finishOp(C.question,1)},nt.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 '"+j(S)+"'")},nt.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 '"+j(p)+"'")},nt.finishOp=function(p,S){var E=this.input.slice(this.pos,this.pos+S);return this.pos+=S,this.finishToken(p,E)},nt.readRegexp=function(){for(var p,S,E=this.pos;;){this.pos>=this.input.length&&this.raise(E,"Unterminated regular expression");var M=this.input.charAt(this.pos);if(_.test(M)&&this.raise(E,"Unterminated regular expression"),p)p=!1;else{if(M==="[")S=!0;else if(M==="]"&&S)S=!1;else if(M==="/"&&!S)break;p=M==="\\"}++this.pos}var B=this.input.slice(E,this.pos);++this.pos;var Z=this.pos,re=this.readWord1();this.containsEsc&&this.unexpected(Z);var ye=this.regexpState||(this.regexpState=new jn(this));ye.reset(E,B,re),this.validateRegExpFlags(ye),this.validateRegExpPattern(ye);var ve=null;try{ve=new RegExp(B,re)}catch{}return this.finishToken(C.regexp,{pattern:B,flags:re,value:ve})},nt.readInt=function(p,S,E){for(var M=this.options.ecmaVersion>=12&&S===void 0,B=E&&this.input.charCodeAt(this.pos)===48,Z=this.pos,re=0,ye=0,ve=0,Ve=S??1/0;ve<Ve;++ve,++this.pos){var Qe=this.input.charCodeAt(this.pos),vt=void 0;if(M&&Qe===95){B&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),ye===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),ve===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),ye=Qe;continue}if(Qe>=97?vt=Qe-97+10:Qe>=65?vt=Qe-65+10:Qe>=48&&Qe<=57?vt=Qe-48:vt=1/0,vt>=p)break;ye=Qe,re=re*p+vt}return M&&ye===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:re};function a0(p,S){return S?parseInt(p,8):parseFloat(p.replace(/_/g,""))}function oo(p){return typeof BigInt!="function"?null:BigInt(p.replace(/_/g,""))}nt.readRadixNumber=function(p){var S=this.pos;this.pos+=2;var E=this.readInt(p);return E==null&&this.raise(this.start+2,"Expected number in radix "+p),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(E=oo(this.input.slice(S,this.pos)),++this.pos):k(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,E)},nt.readNumber=function(p){var S=this.pos;!p&&this.readInt(10,void 0,!0)===null&&this.raise(S,"Invalid number");var E=this.pos-S>=2&&this.input.charCodeAt(S)===48;E&&this.strict&&this.raise(S,"Invalid number");var M=this.input.charCodeAt(this.pos);if(!E&&!p&&this.options.ecmaVersion>=11&&M===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)}E&&/[89]/.test(this.input.slice(S,this.pos))&&(E=!1),M===46&&!E&&(++this.pos,this.readInt(10),M=this.input.charCodeAt(this.pos)),(M===69||M===101)&&!E&&(M=this.input.charCodeAt(++this.pos),(M===43||M===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=a0(this.input.slice(S,this.pos),E);return this.finishToken(C.num,Z)},nt.readCodePoint=function(){var p=this.input.charCodeAt(this.pos),S;if(p===123){this.options.ecmaVersion<6&&this.unexpected();var E=++this.pos;S=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,S>1114111&&this.invalidStringToken(E,"Code point out of bounds")}else S=this.readHexChar(4);return S},nt.readString=function(p){for(var S="",E=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var M=this.input.charCodeAt(this.pos);if(M===p)break;M===92?(S+=this.input.slice(E,this.pos),S+=this.readEscapedChar(!1),E=this.pos):M===8232||M===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):($(M)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return S+=this.input.slice(E,this.pos++),this.finishToken(C.string,S)};var Fr={};nt.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(p){if(p===Fr)this.readInvalidTemplateToken();else throw p}this.inTemplateElement=!1},nt.invalidStringToken=function(p,S){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Fr;this.raise(p,S)},nt.readTmplToken=function(){for(var p="",S=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var E=this.input.charCodeAt(this.pos);if(E===96||E===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===C.template||this.type===C.invalidTemplate)?E===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(E===92)p+=this.input.slice(S,this.pos),p+=this.readEscapedChar(!0),S=this.pos;else if($(E)){switch(p+=this.input.slice(S,this.pos),++this.pos,E){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:p+=`
|
|
82
|
-
`;break;default:p+=String.fromCharCode(E);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),S=this.pos}else++this.pos}},nt.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")},nt.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 j(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 E=this.pos-1;this.invalidStringToken(E,"Invalid escape sequence in template string")}default:if(S>=48&&S<=55){var M=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],B=parseInt(M,8);return B>255&&(M=M.slice(0,-1),B=parseInt(M,8)),this.pos+=M.length-1,S=this.input.charCodeAt(this.pos),(M!=="0"||S===56||S===57)&&(this.strict||p)&&this.invalidStringToken(this.pos-1-M.length,p?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(B)}return $(S)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(S)}},nt.readHexChar=function(p){var S=this.pos,E=this.readInt(16,p);return E===null&&this.invalidStringToken(S,"Bad character escape sequence"),E},nt.readWord1=function(){this.containsEsc=!1;for(var p="",S=!0,E=this.pos,M=this.options.ecmaVersion>=6;this.pos<this.input.length;){var B=this.fullCharCodeAtPos();if(w(B,M))this.pos+=B<=65535?1:2;else if(B===92){this.containsEsc=!0,p+=this.input.slice(E,this.pos);var Z=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var re=this.readCodePoint();(S?k:w)(re,M)||this.invalidStringToken(Z,"Invalid Unicode escape"),p+=j(re),E=this.pos}else break;S=!1}return p+this.input.slice(E,this.pos)},nt.readWord=function(){var p=this.readWord1(),S=C.name;return this.keywords.test(p)&&(S=H[p]),this.finishToken(S,p)};var Rl="8.16.0";I.acorn={Parser:I,version:Rl,defaultOptions:Te,Position:te,SourceLocation:L,getLineInfo:xe,Node:Ks,TokenType:N,tokTypes:C,keywordTypes:H,TokContext:Gt,tokContexts:St,isIdentifierChar:w,isIdentifierStart:k,Token:Xs,isNewLine:$,lineBreak:_,lineBreakG:U,nonASCIIwhitespace:ue};function fc(p,S){return I.parse(p,S)}function Qs(p,S,E){return I.parseExpressionAt(p,S,E)}function Zs(p,S){return I.tokenizer(p,S)}n.Node=Ks,n.Parser=I,n.Position=te,n.SourceLocation=L,n.TokContext=Gt,n.Token=Xs,n.TokenType=N,n.defaultOptions=Te,n.getLineInfo=xe,n.isIdentifierChar=w,n.isIdentifierStart=k,n.isNewLine=$,n.keywordTypes=H,n.lineBreak=_,n.lineBreakG=U,n.nonASCIIwhitespace=ue,n.parse=fc,n.parseExpressionAt=Qs,n.tokContexts=St,n.tokTypes=C,n.tokenizer=Zs,n.version=Rl}))})(Uf,Uf.exports)),Uf.exports}var wT;function wY(){return wT||(wT=1,(function(t){const e=kY(),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),w=new g("<tag>...</tag>",!0,!0),N={tc_oTag:b,tc_cTag:k,tc_expr:w},T={jsxName:new y("jsxName"),jsxText:new y("jsxText",{beforeExpr:!0}),jsxTagStart:new y("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new y("jsxTagEnd")};T.jsxTagStart.updateContext=function(){this.context.push(w),this.context.push(b),this.exprAllowed=!1},T.jsxTagEnd.updateContext=function(F){let V=this.context.pop();V===b&&F===d.slash||V===k?(this.context.pop(),this.exprAllowed=this.curContext()===w):this.exprAllowed=!0},h={tokContexts:N,tokTypes:T},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(CT()).tokTypes},configurable:!0,enumerable:!0});function u(c,h){const d=h.acorn||CT(),g=s(d),y=d.tokTypes,b=g.tokTypes,k=d.tokContexts,w=g.tokContexts.tc_oTag,N=g.tokContexts.tc_cTag,T=g.tokContexts.tc_expr,F=d.isNewLine,V=d.isIdentifierStart,H=d.isIdentifierChar;return class extends h{static get acornJsx(){return g}jsx_readToken(){let z="",C=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let _=this.input.charCodeAt(this.pos);switch(_){case 60:case 123:return this.pos===this.start?_===60&&this.exprAllowed?(++this.pos,this.finishToken(b.jsxTagStart)):this.getTokenFromCode(_):(z+=this.input.slice(C,this.pos),this.finishToken(b.jsxText,z));case 38:z+=this.input.slice(C,this.pos),z+=this.jsx_readEntity(),C=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(_===62?">":"}")+'` or `{"'+this.input[this.pos]+'"}`?');default:F(_)?(z+=this.input.slice(C,this.pos),z+=this.jsx_readNewLine(!0),C=this.pos):++this.pos}}}jsx_readNewLine(z){let C=this.input.charCodeAt(this.pos),_;return++this.pos,C===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,_=z?`
|
|
86
|
-
`:`\r
|
|
87
|
-
`):_=String.fromCharCode(C),this.options.locations&&(++this.curLine,this.lineStart=this.pos),_}jsx_readString(z){let C="",_=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let U=this.input.charCodeAt(this.pos);if(U===z)break;U===38?(C+=this.input.slice(_,this.pos),C+=this.jsx_readEntity(),_=this.pos):F(U)?(C+=this.input.slice(_,this.pos),C+=this.jsx_readNewLine(!1),_=this.pos):++this.pos}return C+=this.input.slice(_,this.pos++),this.finishToken(y.string,C)}jsx_readEntity(){let z="",C=0,_,U=this.input[this.pos];U!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let $=++this.pos;for(;this.pos<this.input.length&&C++<10;){if(U=this.input[this.pos++],U===";"){z[0]==="#"?z[1]==="x"?(z=z.substr(2),n.test(z)&&(_=String.fromCharCode(parseInt(z,16)))):(z=z.substr(1),r.test(z)&&(_=String.fromCharCode(parseInt(z,10)))):_=e[z];break}z+=U}return _||(this.pos=$,"&")}jsx_readWord(){let z,C=this.pos;do z=this.input.charCodeAt(++this.pos);while(H(z)||z===45);return this.finishToken(b.jsxName,this.input.slice(C,this.pos))}jsx_parseIdentifier(){let z=this.startNode();return this.type===b.jsxName?z.name=this.value:this.type.keyword?z.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(z,"JSXIdentifier")}jsx_parseNamespacedName(){let z=this.start,C=this.startLoc,_=this.jsx_parseIdentifier();if(!c.allowNamespaces||!this.eat(y.colon))return _;var U=this.startNodeAt(z,C);return U.namespace=_,U.name=this.jsx_parseIdentifier(),this.finishNode(U,"JSXNamespacedName")}jsx_parseElementName(){if(this.type===b.jsxTagEnd)return"";let z=this.start,C=this.startLoc,_=this.jsx_parseNamespacedName();for(this.type===y.dot&&_.type==="JSXNamespacedName"&&!c.allowNamespacedObjects&&this.unexpected();this.eat(y.dot);){let U=this.startNodeAt(z,C);U.object=_,U.property=this.jsx_parseIdentifier(),_=this.finishNode(U,"JSXMemberExpression")}return _}jsx_parseAttributeValue(){switch(this.type){case y.braceL:let z=this.jsx_parseExpressionContainer();return z.expression.type==="JSXEmptyExpression"&&this.raise(z.start,"JSX attributes must only be assigned a non-empty expression"),z;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 z=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(z,"JSXEmptyExpression",this.start,this.startLoc)}jsx_parseExpressionContainer(){let z=this.startNode();return this.next(),z.expression=this.type===y.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(y.braceR),this.finishNode(z,"JSXExpressionContainer")}jsx_parseAttribute(){let z=this.startNode();return this.eat(y.braceL)?(this.expect(y.ellipsis),z.argument=this.parseMaybeAssign(),this.expect(y.braceR),this.finishNode(z,"JSXSpreadAttribute")):(z.name=this.jsx_parseNamespacedName(),z.value=this.eat(y.eq)?this.jsx_parseAttributeValue():null,this.finishNode(z,"JSXAttribute"))}jsx_parseOpeningElementAt(z,C){let _=this.startNodeAt(z,C);_.attributes=[];let U=this.jsx_parseElementName();for(U&&(_.name=U);this.type!==y.slash&&this.type!==b.jsxTagEnd;)_.attributes.push(this.jsx_parseAttribute());return _.selfClosing=this.eat(y.slash),this.expect(b.jsxTagEnd),this.finishNode(_,U?"JSXOpeningElement":"JSXOpeningFragment")}jsx_parseClosingElementAt(z,C){let _=this.startNodeAt(z,C),U=this.jsx_parseElementName();return U&&(_.name=U),this.expect(b.jsxTagEnd),this.finishNode(_,U?"JSXClosingElement":"JSXClosingFragment")}jsx_parseElementAt(z,C){let _=this.startNodeAt(z,C),U=[],$=this.jsx_parseOpeningElementAt(z,C),q=null;if(!$.selfClosing){e:for(;;)switch(this.type){case b.jsxTagStart:if(z=this.start,C=this.startLoc,this.next(),this.eat(y.slash)){q=this.jsx_parseClosingElementAt(z,C);break e}U.push(this.jsx_parseElementAt(z,C));break;case b.jsxText:U.push(this.parseExprAtom());break;case y.braceL:U.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}o(q.name)!==o($.name)&&this.raise(q.start,"Expected corresponding JSX closing tag for <"+o($.name)+">")}let ue=$.name?"Element":"Fragment";return _["opening"+ue]=$,_["closing"+ue]=q,_.children=U,this.type===y.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(_,"JSX"+ue)}jsx_parseText(){let z=this.parseLiteral(this.value);return z.type="JSXText",z}jsx_parseElement(){let z=this.start,C=this.startLoc;return this.next(),this.jsx_parseElementAt(z,C)}parseExprAtom(z){return this.type===b.jsxText?this.jsx_parseText():this.type===b.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(z)}readToken(z){let C=this.curContext();if(C===T)return this.jsx_readToken();if(C===w||C===N){if(V(z))return this.jsx_readWord();if(z==62)return++this.pos,this.finishToken(b.jsxTagEnd);if((z===34||z===39)&&C==w)return this.jsx_readString(z)}return z===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(b.jsxTagStart)):super.readToken(z)}updateContext(z){if(this.type==y.braceL){var C=this.curContext();C==w?this.context.push(k.b_expr):C==T?this.context.push(k.b_tmpl):super.updateContext(z),this.exprAllowed=!0}else if(this.type===y.slash&&z===b.jsxTagStart)this.context.length-=2,this.context.push(N),this.exprAllowed=!1;else return super.updateContext(z)}}}})(T1)),T1.exports}var EY=wY();const AY=WT(EY);const NY={}.hasOwnProperty,TY=Symbol("continue"),O1=Symbol("exit"),MY=Symbol("skip");function OY(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 R1(s)&&(h.displayName="node ("+s.type+")"),h;function h(){const d=n?ET(n(s,o,u,c)):[];if(d[0]===O1)return d;if(d[0]!==MY){let g;for(g in s)if(NY.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 w=0;for(;w>-1&&w<k.length;){const N=k[w];if(R1(N)){const T=i(N,g,w,y)();if(T[0]===O1)return T;w=typeof T[1]=="number"?T[1]:w+1}else w++}}else if(R1(b)){const k=i(b,g,void 0,y)();if(k[0]===O1)return k}}}return r?ET(r(s,o,u,c)):d}}}function ET(t){return Array.isArray(t)?t:typeof t=="number"?[TY,t]:[t]}function R1(t){return!!(t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.length>0)}function G_(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=RY(t,e.tokenTypes),k=b.value,w=n+k+r,N=e.expression&&AT(k);if(N&&!e.allowEmpty)throw new bt("Unexpected empty expression",{place:F(0),ruleId:"unexpected-empty-expression",source:"micromark-extension-mdx-expression"});try{d=e.expression&&!N?e.acorn.parseExpressionAt(w,0,y):e.acorn.parse(w,y)}catch(V){const H=V,z=F(H.pos);H.message=String(H.message).replace(/ \(\d+:\d+\)$/,""),H.pos=z.offset,H.loc={line:z.line,column:z.column-1},g=H,h=H.raisedAt>=n.length+k.length||H.message==="Unterminated comment"}if(d&&e.expression&&!N)if(AT(w.slice(d.end,w.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 V=F(d.end),H=new Error("Unexpected content after expression");H.pos=V.offset,H.loc={line:V.line,column:V.column-1},g=H,d=void 0}if(d){if(d.comments=s,OY(d,function(V,H,z,C){let _=C[C.length-1],U=H;V.type==="ParenthesizedExpression"&&_&&U&&(typeof z=="number"&&(_=_[U],U=z),_[U]=V.expression),T(V)}),Array.isArray(u))u.push(...s);else if(typeof u=="function")for(const V of s)u(V.type==="Block",V.value,V.start,V.end,V.loc.start,V.loc.end);for(const V of o)V.end<=n.length||V.start-n.length>=k.length||(T(V),Array.isArray(c)?c.push(V):c(V))}return{estree:d,error:g,swallow:h};function T(V){const H=F(V.start),z=F(V.end);V.start=H.offset,V.end=z.offset,V.loc={start:{line:H.line,column:H.column-1,offset:H.offset},end:{line:z.line,column:z.column-1,offset:z.offset}},V.range=[V.start,V.end]}function F(V){let H=V-n.length;H<0?H=0:H>k.length&&(H=k.length);let z=DY(b.stops,H);return z||(z={line:e.start.line,column:e.start.column,offset:e.start.offset}),z}}function AT(t){return/^\s*$/.test(t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,""))}function RY(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=IY(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 DY(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 IY(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 km(t){const e=t||{},n=e.loc||{},r=e.range||[void 0,void 0],i=NT(n.start,r[0]||e.start),s=NT(n.end,r[1]||e.end);if(i&&s)return{start:i,end:s}}function NT(t,e){if(t&&typeof t=="object"){const n="line"in t?D1(t.line):void 0,r="column"in t?D1(t.column):void 0;if(n&&r!==void 0)return{line:n,column:r+1,offset:D1(e)}}}function D1(t){return typeof t=="number"&&t>-1?t:void 0}const _Y=2,Tu="https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression",LY="#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-",zY="#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed",TT="#unexpected-type-in-code-expected-an-object-spread-spread",BY="#unexpected-extra-content-in-spread-only-a-single-spread-is-supported",VY="#could-not-parse-expression-with-acorn";function lg(t,e,n,r,i,s,o,u,c,h,d){const g=this,y=this.events.length+3;let b=0,k,w;return N;function N(H){return t.enter(n),t.enter(r),t.consume(H),t.exit(r),k=g.now(),T}function T(H){if(H===null){if(w)throw w;const z=new bt("Unexpected end of file in expression, expected a corresponding closing brace for `{`",{place:g.now(),ruleId:"unexpected-eof",source:"micromark-extension-mdx-expression"});throw z.url=Tu+LY,z}if(we(H))return t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),V;if(H===125&&b===0){const z=s?FY.call(g,s,o,i,y,k,h||!1,c||!1):{type:"ok",estree:void 0};if(z.type==="ok"){t.enter(r),t.consume(H),t.exit(r);const C=t.exit(n);return u&&z.estree&&Object.assign(C,{estree:z.estree}),e}return w=z.message,t.enter(i),t.consume(H),F}return t.enter(i),F(H)}function F(H){return H===125&&b===0||H===null||we(H)?(t.exit(i),T(H)):(H===123&&!s?b+=1:H===125&&(b-=1),t.consume(H),F)}function V(H){const z=g.now();if(z.line!==k.line&&!d&&g.parser.lazy[z.line]){const C=new bt("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=Tu+zY,C}return Ye(H)?We(t,T,"linePrefix",_Y+1)(H):T(H)}}function FY(t,e,n,r,i,s,o){const u=G_(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=km(h),g=new bt("Unexpected `"+h.type+"` in code: expected an object spread (`{...spread}`)",{place:d.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=Tu+TT,g}if(h.expression.properties[1]){const d=km(h.expression.properties[1]),g=new bt("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=Tu+BY,g}if(h.expression.properties[0]&&h.expression.properties[0].type!=="SpreadElement"){const d=km(h.expression.properties[0]),g=new bt("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=Tu+TT,g}}if(u.error){const h=new bt("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=Tu+VY,{type:"nok",message:h}}return{type:"ok",estree:c}}function PY(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(T){return k(T)}function k(T){return lg.call(y,h,w,"mdxFlowExpression","mdxFlowExpressionMarker","mdxFlowExpressionChunk",r,o,n,i,s)(T)}function w(T){return Ye(T)?We(h,N,"whitespace")(T):N(T)}function N(T){const F=y.parser.constructs.flow[60],H=(Array.isArray(F)?F:F?[F]:[]).find(function(z){return z.name==="mdxJsxFlowTag"});return T===60&&H?h.attempt(H,N,g)(T):T===null||we(T)?d(T):g(T)}}function c(h,d){const g=this;return y;function y(b){return lg.call(g,h,d,"mdxTextExpression","mdxTextExpressionMarker","mdxTextExpressionChunk",r,o,n,i,s,!0)(b)}}}const jY=/[$_\p{ID_Start}]/u,$Y=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,UY=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,JY={};function wi(t){return t?jY.test(String.fromCodePoint(t)):!1}function tf(t,e){const r=(e||JY).jsx?UY:$Y;return t?r.test(String.fromCodePoint(t)):!1}const MT="https://github.com/micromark/micromark-extension-mdx-jsx";function Y_(t,e,n,r,i,s,o,u,c,h,d,g,y,b,k,w,N,T,F,V,H,z,C,_,U,$,q,ue,ae,Se,Ee,Y){const X=this;let le,Ce;return _e;function _e(I){return t.enter(u),t.enter(c),t.consume(I),t.exit(c),j}function j(I){return tt(I)?n(I):(le=P,Be(I))}function P(I){if(I===47)return t.enter(h),t.consume(I),t.exit(h),le=te,Be;if(I===62)return mt(I);if(I!==null&&I>=0&&wi(I))return t.enter(g),t.enter(y),t.consume(I),L;ge(I,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(I===33?" (note: to create a comment in MDX, use `{/* text */}`)":""))}function te(I){if(I===62)return mt(I);if(I!==null&&I>=0&&wi(I))return t.enter(g),t.enter(y),t.consume(I),L;ge(I,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(I===42||I===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function L(I){if(I!==null&&I>=0&&tf(I,{jsx:!0}))return t.consume(I),L;if(I===46||I===47||I===58||I===62||I===123||tt(I)||Kn(I))return t.exit(y),le=xe,Be(I);ge(I,"in name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(I===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function xe(I){if(I===46)return t.enter(b),t.consume(I),t.exit(b),le=Te,Be;if(I===58)return t.enter(w),t.consume(I),t.exit(w),le=pt,Be;if(I===47||I===62||I===123||I!==null&&I>=0&&wi(I))return t.exit(g),Ot(I);ge(I,"after name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Te(I){if(I!==null&&I>=0&&wi(I))return t.enter(k),t.consume(I),Ae;ge(I,"before member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Ae(I){if(I!==null&&I>=0&&tf(I,{jsx:!0}))return t.consume(I),Ae;if(I===46||I===47||I===62||I===123||tt(I)||Kn(I))return t.exit(k),le=He,Be(I);ge(I,"in member name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(I===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function He(I){if(I===46)return t.enter(b),t.consume(I),t.exit(b),le=Te,Be;if(I===47||I===62||I===123||I!==null&&I>=0&&wi(I))return t.exit(g),Ot(I);ge(I,"after member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function pt(I){if(I!==null&&I>=0&&wi(I))return t.enter(N),t.consume(I),Ke;ge(I,"before local name","a character that can start a name, such as a letter, `$`, or `_`"+(I===43||I!==null&&I>46&&I<58?" (note: to create a link in MDX, use `[text](url)`)":""))}function Ke(I){if(I!==null&&I>=0&&tf(I,{jsx:!0}))return t.consume(I),Ke;if(I===47||I===62||I===123||tt(I)||Kn(I))return t.exit(N),le=Ft,Be(I);ge(I,"in local name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Ft(I){if(I===47||I===62||I===123||I!==null&&I>=0&&wi(I))return t.exit(g),Ot(I);ge(I,"after local name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Ot(I){if(I===47)return t.enter(d),t.consume(I),t.exit(d),le=Dt,Be;if(I===62)return mt(I);if(I===123)return lg.call(X,t,ar,T,F,V,r,i,s,!0,!1,o)(I);if(I!==null&&I>=0&&wi(I))return t.enter(H),t.enter(z),t.enter(C),t.consume(I),or;ge(I,"before attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function ar(I){return le=Ot,Be(I)}function or(I){if(I!==null&&I>=0&&tf(I,{jsx:!0}))return t.consume(I),or;if(I===47||I===58||I===61||I===62||I===123||tt(I)||Kn(I))return t.exit(C),le=fn,Be(I);ge(I,"in attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function fn(I){if(I===58)return t.enter(_),t.consume(I),t.exit(_),le=hn,Be;if(I===61)return t.exit(z),t.enter($),t.consume(I),t.exit($),le=dn,Be;if(I===47||I===62||I===123||tt(I)||Kn(I)||I!==null&&I>=0&&wi(I))return t.exit(z),t.exit(H),le=Ot,Be(I);ge(I,"after attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function hn(I){if(I!==null&&I>=0&&wi(I))return t.enter(U),t.consume(I),lr;ge(I,"before local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function lr(I){if(I!==null&&I>=0&&tf(I,{jsx:!0}))return t.consume(I),lr;if(I===47||I===61||I===62||I===123||tt(I)||Kn(I))return t.exit(U),t.exit(z),le=pn,Be(I);ge(I,"in local attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function pn(I){if(I===61)return t.enter($),t.consume(I),t.exit($),le=dn,Be;if(I===47||I===62||I===123||I!==null&&I>=0&&wi(I))return t.exit(H),Ot(I);ge(I,"after local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function dn(I){if(I===34||I===39)return t.enter(q),t.enter(ue),t.consume(I),t.exit(ue),Ce=I,he;if(I===123)return lg.call(X,t,ur,Se,Ee,Y,r,i,s,!1,!1,o)(I);ge(I,"before attribute value","a character that can start an attribute value, such as `\"`, `'`, or `{`"+(I===60?" (note: to use an element or fragment as a prop value in MDX, use `{<element />}`)":""))}function ur(I){return t.exit(H),le=Ot,Be(I)}function he(I){return I===null&&ge(I,"in attribute value","a corresponding closing quote `"+String.fromCodePoint(Ce)+"`"),I===Ce?(t.enter(ue),t.consume(I),t.exit(ue),t.exit(q),t.exit(H),Ce=void 0,le=Ot,Be):we(I)?(le=he,Be(I)):(t.enter(ae),je(I))}function je(I){return I===null||I===Ce||we(I)?(t.exit(ae),he(I)):(t.consume(I),je)}function Dt(I){if(I===62)return mt(I);ge(I,"after self-closing slash","`>` to end the tag"+(I===42||I===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function mt(I){return t.enter(c),t.consume(I),t.exit(c),t.exit(u),e}function Be(I){return we(I)?(t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),fe):Ye(I)||Kn(I)?(t.enter("esWhitespace"),mn(I)):le(I)}function mn(I){return we(I)?(t.exit("esWhitespace"),Be(I)):Ye(I)||Kn(I)?(t.consume(I),mn):(t.exit("esWhitespace"),le(I))}function fe(I){if(!o&&X.parser.lazy[X.now().line]){const Le=new bt("Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",X.now(),"micromark-extension-mdx-jsx:unexpected-lazy");throw Le.url=MT+"#unexpected-lazy-line-in-container-expected-line-to-be",Le}return Be(I)}function ge(I,Le,Ue){const on=new bt("Unexpected "+(I===null?"end of file":"character `"+(I===96?"` ` `":String.fromCodePoint(I))+"` ("+qY(I)+")")+" "+Le+", expected "+Ue,X.now(),"micromark-extension-mdx-jsx:unexpected-"+(I===null?"eof":"character"));throw on.url=MT+(I===null?"#unexpected-end-of-file-at-expected-expect":"#unexpected-character-at-expected-expect"),on}}function qY(t){return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function HY(t,e){return{name:"mdxJsxTextTag",tokenize:n};function n(r,i,s){return Y_.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 KY(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 Y_.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 Ye(g)?We(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 w of b)if(w.name==="mdxFlowExpression"){k=w;break}return g===60?u(g):g===123&&k?r.attempt(k,d,s)(g):g===null||we(g)?i(g):s(g)}}}function GY(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:KY(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})},text:{60:HY(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})}}}function YY(){return{disable:{null:["autolink","codeIndented","htmlFlow","htmlText"]}}}const WY={tokenize:ZY,partial:!0},OT="https://github.com/micromark/micromark-extension-mdxjs-esm",XY=new Set(["ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ImportDeclaration"]);function QY(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(F){return c.now().column>1?u(F):(s.enter("mdxjsEsm"),s.enter("mdxjsEsmData"),s.consume(F),g+=String.fromCharCode(F),b)}function b(F){return cn(F)?(s.consume(F),g+=String.fromCharCode(F),b):(g==="import"||g==="export")&&F===32?(s.consume(F),k):u(F)}function k(F){return F===null||we(F)?(s.exit("mdxjsEsmData"),w(F)):(s.consume(F),k)}function w(F){return F===null?T(F):we(F)?s.check(WY,T,N)(F):(s.enter("mdxjsEsmData"),k(F))}function N(F){return s.enter("lineEnding"),s.consume(F),s.exit("lineEnding"),w}function T(F){const V=G_(c.events.slice(d),{acorn:n,acornOptions:r,tokenTypes:["mdxjsEsmData"],prefix:h.length>0?"var "+h.join(",")+`
|
|
90
|
-
`:""});if(V.error){if(F!==null&&V.swallow)return N(F);const z=new bt("Could not parse import/exports with acorn",{cause:V.error,place:{line:V.error.loc.line,column:V.error.loc.column+1,offset:V.error.pos},ruleId:"acorn",source:"micromark-extension-mdxjs-esm"});throw z.url=OT+"#could-not-parse-importexports-with-acorn",z}h.length>0&&V.estree.body.shift();let H=-1;for(;++H<V.estree.body.length;){const z=V.estree.body[H];if(!XY.has(z.type)){const C=new bt("Unexpected `"+z.type+"` in code: only import/exports are supported",{place:km(z),ruleId:"non-esm",source:"micromark-extension-mdxjs-esm"});throw C.url=OT+"#unexpected-type-in-code-only-importexports-are-supported",C}if(z.type==="ImportDeclaration"&&!c.interrupt){let C=-1;for(;++C<z.specifiers.length;){const _=z.specifiers[C];h.push(_.local.name)}}}return Object.assign(s.exit("mdxjsEsm"),t.addResult?{estree:V.estree}:void 0),o(F)}}}function ZY(t,e,n){return r;function r(i){return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),t.attempt(Uu,e,n)}}function eW(t){const e=Object.assign({acorn:sn.extend(AY()),acornOptions:{ecmaVersion:2024,sourceType:"module"},addResult:!0},t);return gS([QY(e),PY(e),GY(e),YY()])}const tW={};function nW(t){const e=this,n=t||tW,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(eW(n)),s.push(LG()),o.push(zG(n))}const Vh="__mdx_expr__:",rW=new Set(["br","hr","img","input","meta","link","area","base","col","embed","source","track","wbr"]),iW=Tm().use(Am),sW=hi("remarkMdx",()=>nW);function aW(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]=`${Vh}${r.value.value}`,n=!0)),r.type==="mdxJsxExpressionAttribute"&&(n=!0);return{props:e,hasExpressions:n}}function oW(t){const e=[];for(const[n,r]of Object.entries(t))r.startsWith(Vh)?e.push({type:"mdxJsxAttribute",name:n,value:{type:"mdxJsxAttributeValueExpression",value:r.slice(Vh.length)}}):e.push({type:"mdxJsxAttribute",name:n,value:r});return e}function W_(t){if(!t||t.length===0)return"";const e=[];for(const n of t)if(n.type==="paragraph"){const r=Cm(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=W_(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 Cm(t){return t.map(e=>e.type==="text"?e.value??"":e.type==="strong"?`**${Cm(e.children??[])}**`:e.type==="emphasis"?`*${Cm(e.children??[])}*`:e.type==="inlineCode"?`\`${e.value??""}\``:e.type==="link"?`[${Cm(e.children??[])}](${e.url??""})`:e.value??"").join("")}const X_=Hu("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||rW.has(r.toLowerCase()))return;const{props:i,hasExpressions:s}=aW(e.attributes),o=W_(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=oW(r);if(i.trim()){const o=iW.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:[]})}}})),RT=qe("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}),lW=Hu("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 uW=typeof global=="object"&&global&&global.Object===Object&&global,cW=typeof self=="object"&&self&&self.Object===Object&&self,Q_=uW||cW||Function("return this")(),ug=Q_.Symbol,Z_=Object.prototype,fW=Z_.hasOwnProperty,hW=Z_.toString,nf=ug?ug.toStringTag:void 0;function pW(t){var e=fW.call(t,nf),n=t[nf];try{t[nf]=void 0;var r=!0}catch{}var i=hW.call(t);return r&&(e?t[nf]=n:delete t[nf]),i}var dW=Object.prototype,mW=dW.toString;function gW(t){return mW.call(t)}var yW="[object Null]",xW="[object Undefined]",DT=ug?ug.toStringTag:void 0;function bW(t){return t==null?t===void 0?xW:yW:DT&&DT in Object(t)?pW(t):gW(t)}function SW(t){return t!=null&&typeof t=="object"}var vW="[object Symbol]";function kW(t){return typeof t=="symbol"||SW(t)&&bW(t)==vW}var CW=/\s/;function wW(t){for(var e=t.length;e--&&CW.test(t.charAt(e)););return e}var EW=/^\s+/;function AW(t){return t&&t.slice(0,wW(t)+1).replace(EW,"")}function hS(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var IT=NaN,NW=/^[-+]0x[0-9a-f]+$/i,TW=/^0b[01]+$/i,MW=/^0o[0-7]+$/i,OW=parseInt;function _T(t){if(typeof t=="number")return t;if(kW(t))return IT;if(hS(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=hS(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=AW(t);var n=TW.test(t);return n||MW.test(t)?OW(t.slice(2),n?2:8):NW.test(t)?IT:+t}var I1=function(){return Q_.Date.now()},RW="Expected a function",DW=Math.max,IW=Math.min;function _W(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(RW);e=_T(e)||0,hS(n)&&(d=!!n.leading,g="maxWait"in n,s=g?DW(_T(n.maxWait)||0,e):s,y="trailing"in n?!!n.trailing:y);function b(C){var _=r,U=i;return r=i=void 0,h=C,o=t.apply(U,_),o}function k(C){return h=C,u=setTimeout(T,e),d?b(C):o}function w(C){var _=C-c,U=C-h,$=e-_;return g?IW($,s-U):$}function N(C){var _=C-c,U=C-h;return c===void 0||_>=e||_<0||g&&U>=s}function T(){var C=I1();if(N(C))return F(C);u=setTimeout(T,w(C))}function F(C){return u=void 0,y&&r?b(C):(r=i=void 0,o)}function V(){u!==void 0&&clearTimeout(u),h=0,r=c=i=u=void 0}function H(){return u===void 0?o:F(I1())}function z(){var C=I1(),_=N(C);if(r=arguments,i=this,c=C,_){if(u===void 0)return k(c);if(g)return clearTimeout(u),u=setTimeout(T,e),b(c)}return u===void 0&&(u=setTimeout(T,e)),o}return z.cancel=V,z.flush=H,z}var e6=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}},cg=lt(new e6,"listener"),LW=new kr("MILKDOWN_LISTENER"),Ok=t=>(t.inject(cg,new e6),async()=>{await t.wait(Ko);const{listeners:e}=t.get(cg);e.beforeMount.forEach(h=>h(t)),await t.wait(th);const n=t.get(im);let r=null,i=null,s=null,o=null;const u=_W(()=>{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 vr({key:LW,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(lm),e.mounted.forEach(h=>h(t))});Ok.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const zW=new Set(["strong","emphasis","delete"]),BW=/^[^\S\r\n]+/,VW=/[^\S\r\n]+$/,FW=/^[ \t]+/;function LT(t,e){let n=t.children??[],r="";for(;;){const i=e==="start"?0:n.length-1,s=n[i];if(s?.type!=="text"||typeof s.value!="string")break;const o=s.value.match(e==="start"?BW:VW)?.[0]??"",u=e==="start"?s.value.slice(o.length):s.value.slice(0,s.value.length-o.length);if(u&&!o||(r=e==="start"?r+o:o+r,n=[...n.slice(0,i),...u?[{...s,value:u}]:[],...n.slice(i+1)],u))break}return n.length===0?[void 0,r]:[n===t.children?t:{...t,children:n},r]}const zT=t=>t?[{type:"text",value:t}]:[];function t6(t){if(!t.children)return t;const e=t.children.flatMap((n,r)=>{const i=t6(n);if(!zW.has(i.type))return[i];const[s,o]=LT(i,"start"),[u,c]=s?LT(s,"end"):[void 0,""],h=t.type==="paragraph"&&r===0;return[...zT(h?o.replace(FW,""):o),...u?[u]:[],...zT(c)]});return{...t,children:e}}const PW=function(){const t=this.compiler;t&&(this.compiler=(e,n)=>t(t6(e),n))},n6=hi("remarkMarkWhitespace",()=>PW),jW={border:"1px solid #e4e4e7",borderRadius:6,background:"#fff"},$W={padding:"6px 10px",minHeight:60,fontSize:13,lineHeight:1.5,outline:"none"};function UW({value:t,onChange:e,media:n,mediaContext:r}){const i=ee.useRef(null),s=ee.useRef(null),[o,u]=ee.useState(null),c=ee.useRef(t),h=ee.useRef(!1),d=ee.useRef(e);return d.current=e,ee.useEffect(()=>{const g=i.current;if(!g)return;let y=!1;return(async()=>{const k=await tR.make().config(w=>{w.set(rh,g),w.set(nh,c.current),w.get(cg).markdownUpdated((N,T)=>{c.current=T})}).use(UR).use(WI).use(n6).use(Ok).create();if(y){k.destroy();return}s.current=k,u(k)})(),()=>{y=!0,s.current?.destroy(),s.current=null,u(null)}},[]),ee.useEffect(()=>{!s.current||h.current||t!==c.current&&(s.current.action(iR(t)),c.current=t)},[t]),O.jsxs("div",{style:jW,children:[O.jsx(u_,{editor:o,media:n,mediaContext:r,field:"children",allowImageInsert:!1}),O.jsx("div",{ref:i,style:$W,onFocusCapture:()=>{h.current=!0},onBlurCapture:()=>{h.current=!1,c.current!==t&&d.current(c.current)}})]})}const JW={number:"number",url:"url",date:"date",datetime:"datetime-local",time:"time",email:"email",tel:"tel"},qW={border:"1px solid #d4d4d8",borderRadius:8,background:"#fafafa",margin:"8px 0",fontSize:13},HW={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"6px 10px",borderBottom:"1px solid #ececed",background:"#f1f1f3",borderTopLeftRadius:8,borderTopRightRadius:8},KW={fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},GW={padding:"8px 10px",display:"flex",flexDirection:"column",gap:8},BT={fontSize:11,color:"#71717a",marginBottom:2},wm={width:"100%",boxSizing:"border-box",border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 6px",font:"inherit",background:"#fff"},ch={...wm,background:"#f4f4f5",color:"#71717a"},VT={fontSize:10,color:"#a16207",background:"#fef9c3",borderRadius:3,padding:"0 4px",marginLeft:6},YW={border:"none",background:"transparent",color:"#a1a1aa",cursor:"pointer",fontSize:16,lineHeight:1,padding:2},WW={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"};function XW({name:t,value:e,propType:n,editable:r,hasMedia:i,previewSrc:s,onChange:o,onBrowse:u}){if(n==="boolean")return O.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[O.jsx("input",{type:"checkbox",checked:e==="true",disabled:!r,onChange:h=>o(h.target.checked?"true":"false")}),O.jsx("span",{style:{color:"#52525b"},children:e==="true"?"Yes":"No"})]});if(n==="image")return O.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[s!==""?O.jsx("img",{src:s,alt:"",style:{maxHeight:96,maxWidth:"100%",objectFit:"contain",borderRadius:4,alignSelf:"flex-start"}}):null,O.jsxs("div",{style:{display:"flex",gap:6},children:[O.jsx("input",{style:r?wm:ch,value:e,readOnly:!r,placeholder:"Image URL or path",onChange:r?h=>o(h.target.value):void 0}),r&&i?O.jsx("button",{type:"button",style:WW,"data-mdx-action":"props",onClick:u,children:"Browse"}):null]})]});if(n==="color")return O.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[O.jsx("input",{type:"color",value:e||"#000000",disabled:!r,onChange:h=>o(h.target.value),style:{width:30,height:28,padding:0,border:"1px solid #d4d4d8",borderRadius:4,background:"transparent",cursor:r?"pointer":"default"}}),O.jsx("input",{style:r?wm:ch,value:e,readOnly:!r,placeholder:"#000000",onChange:r?h=>o(h.target.value):void 0})]});const c=JW[n]??"text";return O.jsx("input",{type:c,style:r?wm:ch,value:e,readOnly:!r,placeholder:`Enter ${t}…`,onChange:r?h=>o(h.target.value):void 0})}function QW({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]=ee.useState(null),k=ee.useMemo(()=>{const N=new Map;for(const T of i?.props??[])N.set(T.name,T);return N},[i]),w=(N,T)=>{h&&h({...e,[N]:T})};return O.jsxs("div",{style:qW,"data-cms-ui":"",contentEditable:!1,children:[O.jsxs("div",{style:HW,children:[O.jsxs("span",{style:KW,children:[`<${t} />`,n?O.jsx("span",{style:VT,children:"expr · read-only"}):null]}),O.jsx("button",{type:"button",style:YW,title:"Remove block","data-mdx-action":"remove",onClick:u,children:"×"})]}),O.jsxs("div",{style:GW,children:[d?O.jsxs("div",{"data-mdx-action":"children",children:[O.jsx("div",{style:BT,children:"Content"}),c?O.jsx(UW,{value:r,onChange:c,media:s,mediaContext:o}):O.jsx("div",{style:{...ch,whiteSpace:"pre-wrap",minHeight:40},children:r})]}):null,g.length===0&&!d?O.jsx("div",{style:{color:"#a1a1aa",fontSize:12},children:"No props"}):null,g.map(([N,T])=>{const F=T.startsWith(Vh),V=!!h&&!F,H=k.get(N),z=(H?.type??"").toLowerCase();return O.jsxs("div",{style:{display:"block"},"data-mdx-action":"props",children:[O.jsxs("div",{style:BT,children:[N,H?.required?O.jsx("span",{style:{color:"#dc2626"},children:"*"}):null,F?O.jsx("span",{style:VT,children:"expression"}):null]}),F?O.jsx("input",{style:ch,value:`{${T.slice(Vh.length)}}`,readOnly:!0}):O.jsx(XW,{name:N,value:T,propType:z,editable:V,hasMedia:!!s,previewSrc:z==="image"?sS(s,T,o):"",onChange:C=>w(N,C),onBrowse:()=>b(N)})]},N)})]}),y!==null&&s?O.jsx(QI,{media:s,context:o,field:y,accept:"image/*",onSelect:N=>{w(y,N),b(null)},onClose:()=>b(null)}):null]})}var _1={exports:{}},rf={},L1={exports:{}},z1={};var FT;function ZW(){return FT||(FT=1,(function(t){function e(X,le){var Ce=X.length;X.push(le);e:for(;0<Ce;){var _e=Ce-1>>>1,j=X[_e];if(0<i(j,le))X[_e]=le,X[Ce]=j,Ce=_e;else break e}}function n(X){return X.length===0?null:X[0]}function r(X){if(X.length===0)return null;var le=X[0],Ce=X.pop();if(Ce!==le){X[0]=Ce;e:for(var _e=0,j=X.length,P=j>>>1;_e<P;){var te=2*(_e+1)-1,L=X[te],xe=te+1,Te=X[xe];if(0>i(L,Ce))xe<j&&0>i(Te,L)?(X[_e]=Te,X[xe]=Ce,_e=xe):(X[_e]=L,X[te]=Ce,_e=te);else if(xe<j&&0>i(Te,Ce))X[_e]=Te,X[xe]=Ce,_e=xe;else break e}}return le}function i(X,le){var Ce=X.sortIndex-le.sortIndex;return Ce!==0?Ce:X.id-le.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,w=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function H(X){for(var le=n(h);le!==null;){if(le.callback===null)r(h);else if(le.startTime<=X)r(h),le.sortIndex=le.expirationTime,e(c,le);else break;le=n(h)}}function z(X){if(w=!1,H(X),!k)if(n(c)!==null)k=!0,C||(C=!0,ae());else{var le=n(h);le!==null&&Y(z,le.startTime-X)}}var C=!1,_=-1,U=5,$=-1;function q(){return N?!0:!(t.unstable_now()-$<U)}function ue(){if(N=!1,C){var X=t.unstable_now();$=X;var le=!0;try{e:{k=!1,w&&(w=!1,F(_),_=-1),b=!0;var Ce=y;try{t:{for(H(X),g=n(c);g!==null&&!(g.expirationTime>X&&q());){var _e=g.callback;if(typeof _e=="function"){g.callback=null,y=g.priorityLevel;var j=_e(g.expirationTime<=X);if(X=t.unstable_now(),typeof j=="function"){g.callback=j,H(X),le=!0;break t}g===n(c)&&r(c),H(X)}else r(c);g=n(c)}if(g!==null)le=!0;else{var P=n(h);P!==null&&Y(z,P.startTime-X),le=!1}}break e}finally{g=null,y=Ce,b=!1}le=void 0}}finally{le?ae():C=!1}}}var ae;if(typeof V=="function")ae=function(){V(ue)};else if(typeof MessageChannel<"u"){var Se=new MessageChannel,Ee=Se.port2;Se.port1.onmessage=ue,ae=function(){Ee.postMessage(null)}}else ae=function(){T(ue,0)};function Y(X,le){_=T(function(){X(t.unstable_now())},le)}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(X){X.callback=null},t.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<X?Math.floor(1e3/X):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(X){switch(y){case 1:case 2:case 3:var le=3;break;default:le=y}var Ce=y;y=le;try{return X()}finally{y=Ce}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(X,le){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var Ce=y;y=X;try{return le()}finally{y=Ce}},t.unstable_scheduleCallback=function(X,le,Ce){var _e=t.unstable_now();switch(typeof Ce=="object"&&Ce!==null?(Ce=Ce.delay,Ce=typeof Ce=="number"&&0<Ce?_e+Ce:_e):Ce=_e,X){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=Ce+j,X={id:d++,callback:le,priorityLevel:X,startTime:Ce,expirationTime:j,sortIndex:-1},Ce>_e?(X.sortIndex=Ce,e(h,X),n(c)===null&&X===n(h)&&(w?(F(_),_=-1):w=!0,Y(z,Ce-_e))):(X.sortIndex=j,e(c,X),k||b||(k=!0,C||(C=!0,ae()))),X},t.unstable_shouldYield=q,t.unstable_wrapCallback=function(X){var le=y;return function(){var Ce=y;y=le;try{return X.apply(this,arguments)}finally{y=Ce}}}})(z1)),z1}var PT;function eX(){return PT||(PT=1,L1.exports=ZW()),L1.exports}var B1={exports:{}},Nn={};var jT;function tX(){if(jT)return Nn;jT=1;var t=dS();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 Nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Nn.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)},Nn.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()}},Nn.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))},Nn.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Nn.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})}},Nn.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)},Nn.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})}},Nn.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)},Nn.requestFormReset=function(c){r.d.r(c)},Nn.unstable_batchedUpdates=function(c,h){return c(h)},Nn.useFormState=function(c,h,d){return o.H.useFormState(c,h,d)},Nn.useFormStatus=function(){return o.H.useHostTransitionStatus()},Nn.version="19.2.7",Nn}var $T;function nX(){if($T)return B1.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(),B1.exports=tX(),B1.exports}var UT;function rX(){if(UT)return rf;UT=1;var t=eX(),e=dS(),n=nX();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,D=x.child;D;){if(D===f){A=!0,f=x,m=v;break}if(D===m){A=!0,m=x,f=v;break}D=D.sibling}if(!A){for(D=v.child;D;){if(D===f){A=!0,f=v,m=x;break}if(D===m){A=!0,m=v,f=x;break}D=D.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"),w=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),V=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function ae(a){return a===null||typeof a!="object"?null:(a=ue&&a[ue]||a["@@iterator"],typeof a=="function"?a:null)}var Se=Symbol.for("react.client.reference");function Ee(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 w:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case z:return"Suspense";case C:return"SuspenseList";case $:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case k:return"Portal";case V:return a.displayName||"Context";case F:return(a._context.displayName||"Context")+".Consumer";case H:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case _:return l=a.displayName||null,l!==null?l:Ee(a.type)||"Memo";case U:l=a._payload,a=a._init;try{return Ee(a(l))}catch{}}return null}var Y=Array.isArray,X=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ce={pending:!1,data:null,method:null,action:null},_e=[],j=-1;function P(a){return{current:a}}function te(a){0>j||(a.current=_e[j],_e[j]=null,j--)}function L(a,l){j++,_e[j]=a.current,a.current=l}var xe=P(null),Te=P(null),Ae=P(null),He=P(null);function pt(a,l){switch(L(Ae,l),L(Te,a),L(xe,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?M2(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=M2(l),a=O2(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}te(xe),L(xe,a)}function Ke(){te(xe),te(Te),te(Ae)}function Ft(a){a.memoizedState!==null&&L(He,a);var l=xe.current,f=O2(l,a.type);l!==f&&(L(Te,a),L(xe,f))}function Ot(a){Te.current===a&&(te(xe),te(Te)),He.current===a&&(te(He),Hc._currentValue=Ce)}var ar,or;function fn(a){if(ar===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);ar=l&&l[1]||"",or=-1<f.stack.indexOf(`
|
|
93
|
-
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
94
|
-
`+ar+a+or}var hn=!1;function lr(a,l){if(!a||hn)return"";hn=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(oe){var se=oe}Reflect.construct(a,[],me)}else{try{me.call()}catch(oe){se=oe}a.call(me.prototype)}}else{try{throw Error()}catch(oe){se=oe}(me=a())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.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],D=v[1];if(A&&D){var J=A.split(`
|
|
95
|
-
`),ie=D.split(`
|
|
96
|
-
`);for(x=m=0;m<J.length&&!J[m].includes("DetermineComponentFrameRoot");)m++;for(;x<ie.length&&!ie[x].includes("DetermineComponentFrameRoot");)x++;if(m===J.length||x===ie.length)for(m=J.length-1,x=ie.length-1;1<=m&&0<=x&&J[m]!==ie[x];)x--;for(;1<=m&&0<=x;m--,x--)if(J[m]!==ie[x]){if(m!==1||x!==1)do if(m--,x--,0>x||J[m]!==ie[x]){var ce=`
|
|
97
|
-
`+J[m].replace(" at new "," at ");return a.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",a.displayName)),ce}while(1<=m&&0<=x);break}}}finally{hn=!1,Error.prepareStackTrace=f}return(f=a?a.displayName||a.name:"")?fn(f):""}function pn(a,l){switch(a.tag){case 26:case 27:case 5:return fn(a.type);case 16:return fn("Lazy");case 13:return a.child!==l&&l!==null?fn("Suspense Fallback"):fn("Suspense");case 19:return fn("SuspenseList");case 0:case 15:return lr(a.type,!1);case 11:return lr(a.type.render,!1);case 1:return lr(a.type,!0);case 31:return fn("Activity");default:return""}}function dn(a){try{var l="",f=null;do l+=pn(a,f),f=a,a=a.return;while(a);return l}catch(m){return`
|
|
98
|
-
Error generating stack: `+m.message+`
|
|
99
|
-
`+m.stack}}var ur=Object.prototype.hasOwnProperty,he=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Dt=t.unstable_shouldYield,mt=t.unstable_requestPaint,Be=t.unstable_now,mn=t.unstable_getCurrentPriorityLevel,fe=t.unstable_ImmediatePriority,ge=t.unstable_UserBlockingPriority,I=t.unstable_NormalPriority,Le=t.unstable_LowPriority,Ue=t.unstable_IdlePriority,on=t.log,cr=t.unstable_setDisableYieldValue,ke=null,Pt=null;function An(a){if(typeof on=="function"&&cr(a),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(ke,a)}catch{}}var wt=Math.clz32?Math.clz32:gp,fr=Math.log,Pn=Math.LN2;function gp(a){return a>>>=0,a===0?32:31-(fr(a)/Pn|0)|0}var wl=256,es=262144,gn=4194304;function Gt(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 St(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 D=m&134217727;return D!==0?(m=D&~v,m!==0?x=Gt(m):(A&=D,A!==0?x=Gt(A):f||(f=D&~a,f!==0&&(x=Gt(f))))):(D=m&~v,D!==0?x=Gt(D):A!==0?x=Gt(A):f||(f=m&~a,f!==0&&(x=Gt(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 Vr(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 nc(){var a=gn;return gn<<=1,(gn&62914560)===0&&(gn=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 El(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 D=a.entanglements,J=a.expirationTimes,ie=a.hiddenUpdates;for(f=A&~f;0<f;){var ce=31-wt(f),me=1<<ce;D[ce]=0,J[ce]=-1;var se=ie[ce];if(se!==null)for(ie[ce]=null,ce=0;ce<se.length;ce++){var oe=se[ce];oe!==null&&(oe.lane&=-536870913)}f&=~me}m!==0&&mi(a,m,0),v!==0&&x===0&&a.tag!==0&&(a.suspendedLanes|=v&~(A&~l))}function mi(a,l,f){a.pendingLanes|=l,a.suspendedLanes&=~l;var m=31-wt(l);a.entangledLanes|=l,a.entanglements[m]=a.entanglements[m]|1073741824|f&261930}function yp(a,l){var f=a.entangledLanes|=l;for(a=a.entanglements;f;){var m=31-wt(f),x=1<<m;x&l|a[m]&l&&(a[m]|=l),f&=~x}}function Ks(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 Al(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function xp(){var a=le.p;return a!==0?a:(a=window.event,a===void 0?32:Z2(a.type))}function rc(a,l){var f=le.p;try{return le.p=a,l()}finally{le.p=f}}var gi=Math.random().toString(36).slice(2),Yt="__reactFiber$"+gi,yn="__reactProps$"+gi,ns="__reactContainer$"+gi,ic="__reactEvents$"+gi,r0="__reactListeners$"+gi,i0="__reactHandles$"+gi,bp="__reactResources$"+gi,Gs="__reactMarker$"+gi;function Nl(a){delete a[Yt],delete a[yn],delete a[ic],delete a[r0],delete a[i0]}function rs(a){var l=a[Yt];if(l)return l;for(var f=a.parentNode;f;){if(l=f[ns]||f[Yt]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(a=B2(a);a!==null;){if(f=a[Yt])return f;a=B2(a)}return l}a=f,f=a.parentNode}return null}function is(a){if(a=a[Yt]||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 Ys(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[bp];return l||(l=a[bp]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Wt(a){a[Gs]=!0}var Sp=new Set,sc={};function as(a,l){Ii(a,l),Ii(a+"Capture",l)}function Ii(a,l){for(sc[a]=l,a=0;a<l.length;a++)Sp.add(l[a])}var vp=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]*$"),kp={},Ne={};function Tl(a){return ur.call(Ne,a)?!0:ur.call(kp,a)?!1:vp.test(a)?Ne[a]=!0:(kp[a]=!0,!1)}function jn(a,l,f){if(Tl(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 Ml(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 yi(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 Cp(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function s0(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 Ol(a){if(!a._valueTracker){var l=Cp(a)?"checked":"value";a._valueTracker=s0(a,l,""+a[l])}}function wp(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var f=l.getValue(),m="";return a&&(m=Cp(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 xi=/[\n"\\]/g;function It(a){return a.replace(xi,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ac(a,l,f,m,x,v,A,D){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?lc(a,A,$n(l)):f!=null?lc(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"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?a.name=""+$n(D):a.removeAttribute("name")}function oc(a,l,f,m,x,v,A,D){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)){Ol(a);return}f=f!=null?""+$n(f):"",l=l!=null?""+$n(l):f,D||l===a.value||(a.value=l),a.defaultValue=l}m=m??x,m=typeof m!="function"&&typeof m!="symbol"&&!!m,a.checked=D?a.checked:!!m,a.defaultChecked=!!m,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(a.name=A),Ol(a)}function lc(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 Ep(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 Ap(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),Ol(a)}function bi(a,l){if(l){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=l;return}}a.textContent=l}var Np=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 uc(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||Np.has(l)?l==="float"?a.cssFloat=f:a[l]=(""+f).trim():a[l]=f+"px"}function cc(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&&uc(a,x,m)}else for(var v in l)l.hasOwnProperty(v)&&uc(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 nt=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"]]),a0=/^[\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 a0.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function Fr(){}var Rl=null;function fc(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Qs=null,Zs=null;function p(a){var l=is(a);if(l&&(a=l.stateNode)){var f=a[yn]||null;e:switch(a=l.stateNode,l.type){case"input":if(ac(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="'+It(""+l)+'"][type="radio"]'),l=0;l<f.length;l++){var m=f[l];if(m!==a&&m.form===a.form){var x=m[yn]||null;if(!x)throw Error(r(90));ac(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&&wp(m)}break e;case"textarea":Ep(a,f.value,f.defaultValue);break e;case"select":l=f.value,l!=null&&Ws(a,!!f.multiple,l,!1)}}}var S=!1;function E(a,l,f){if(S)return a(l,f);S=!0;try{var m=a(l);return m}finally{if(S=!1,(Qs!==null||Zs!==null)&&(cd(),Qs&&(l=Qs,a=Zs,Zs=Qs=null,p(l),a)))for(l=0;l<a.length;l++)p(a[l])}}function M(a,l){var f=a.stateNode;if(f===null)return null;var m=f[yn]||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 re={};Object.defineProperty(re,"passive",{get:function(){Z=!0}}),window.addEventListener("test",re,re),window.removeEventListener("test",re,re)}catch{Z=!1}var ye=null,ve=null,Ve=null;function Qe(){if(Ve)return Ve;var a,l=ve,f=l.length,m,x="value"in ye?ye.value:ye.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 Ve=x.slice(a,1<m?1-m:void 0)}function vt(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 Ut(){return!0}function ea(){return!1}function Jt(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 D in a)a.hasOwnProperty(D)&&(f=a[D],this[D]=f?f(v):v[D]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ut:ea,this.isPropagationStopped=ea,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=Ut)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=Ut)},persist:function(){},isPersistent:Ut}),l}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Si=Jt(Pr),jr=g({},Pr,{view:0,detail:0}),l6=Jt(jr),o0,l0,hc,Tp=g({},jr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:c0,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!==hc&&(hc&&a.type==="mousemove"?(o0=a.screenX-hc.screenX,l0=a.screenY-hc.screenY):l0=o0=0,hc=a),o0)},movementY:function(a){return"movementY"in a?a.movementY:l0}}),Dk=Jt(Tp),u6=g({},Tp,{dataTransfer:0}),c6=Jt(u6),f6=g({},jr,{relatedTarget:0}),u0=Jt(f6),h6=g({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),p6=Jt(h6),d6=g({},Pr,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),m6=Jt(d6),g6=g({},Pr,{data:0}),Ik=Jt(g6),y6={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},x6={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"},b6={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function S6(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=b6[a])?!!l[a]:!1}function c0(){return S6}var v6=g({},jr,{key:function(a){if(a.key){var l=y6[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=vt(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?x6[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:c0,charCode:function(a){return a.type==="keypress"?vt(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?vt(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),k6=Jt(v6),C6=g({},Tp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_k=Jt(C6),w6=g({},jr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:c0}),E6=Jt(w6),A6=g({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),N6=Jt(A6),T6=g({},Tp,{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}),M6=Jt(T6),O6=g({},Pr,{newState:0,oldState:0}),R6=Jt(O6),D6=[9,13,27,32],f0=B&&"CompositionEvent"in window,pc=null;B&&"documentMode"in document&&(pc=document.documentMode);var I6=B&&"TextEvent"in window&&!pc,Lk=B&&(!f0||pc&&8<pc&&11>=pc),zk=" ",Bk=!1;function Vk(a,l){switch(a){case"keyup":return D6.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fk(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Dl=!1;function _6(a,l){switch(a){case"compositionend":return Fk(l);case"keypress":return l.which!==32?null:(Bk=!0,zk);case"textInput":return a=l.data,a===zk&&Bk?null:a;default:return null}}function L6(a,l){if(Dl)return a==="compositionend"||!f0&&Vk(a,l)?(a=Qe(),Ve=ve=ye=null,Dl=!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 Lk&&l.locale!=="ko"?null:l.data;default:return null}}var z6={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 Pk(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!z6[a.type]:l==="textarea"}function jk(a,l,f,m){Qs?Zs?Zs.push(m):Zs=[m]:Qs=m,l=yd(l,"onChange"),0<l.length&&(f=new Si("onChange","change",null,f,m),a.push({event:f,listeners:l}))}var dc=null,mc=null;function B6(a){C2(a,0)}function Mp(a){var l=Ys(a);if(wp(l))return a}function $k(a,l){if(a==="change")return l}var Uk=!1;if(B){var h0;if(B){var p0="oninput"in document;if(!p0){var Jk=document.createElement("div");Jk.setAttribute("oninput","return;"),p0=typeof Jk.oninput=="function"}h0=p0}else h0=!1;Uk=h0&&(!document.documentMode||9<document.documentMode)}function qk(){dc&&(dc.detachEvent("onpropertychange",Hk),mc=dc=null)}function Hk(a){if(a.propertyName==="value"&&Mp(mc)){var l=[];jk(l,mc,a,fc(a)),E(B6,l)}}function V6(a,l,f){a==="focusin"?(qk(),dc=l,mc=f,dc.attachEvent("onpropertychange",Hk)):a==="focusout"&&qk()}function F6(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Mp(mc)}function P6(a,l){if(a==="click")return Mp(l)}function j6(a,l){if(a==="input"||a==="change")return Mp(l)}function $6(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var wr=typeof Object.is=="function"?Object.is:$6;function gc(a,l){if(wr(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(!ur.call(l,x)||!wr(a[x],l[x]))return!1}return!0}function Kk(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Gk(a,l){var f=Kk(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=Kk(f)}}function Yk(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?Yk(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function Wk(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 d0(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 U6=B&&"documentMode"in document&&11>=document.documentMode,Il=null,m0=null,yc=null,g0=!1;function Xk(a,l,f){var m=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;g0||Il==null||Il!==ao(m)||(m=Il,"selectionStart"in m&&d0(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}),yc&&gc(yc,m)||(yc=m,m=yd(m0,"onSelect"),0<m.length&&(l=new Si("onSelect","select",null,l,f),a.push({event:l,listeners:m}),l.target=Il)))}function lo(a,l){var f={};return f[a.toLowerCase()]=l.toLowerCase(),f["Webkit"+a]="webkit"+l,f["Moz"+a]="moz"+l,f}var _l={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")},y0={},Qk={};B&&(Qk=document.createElement("div").style,"AnimationEvent"in window||(delete _l.animationend.animation,delete _l.animationiteration.animation,delete _l.animationstart.animation),"TransitionEvent"in window||delete _l.transitionend.transition);function uo(a){if(y0[a])return y0[a];if(!_l[a])return a;var l=_l[a],f;for(f in l)if(l.hasOwnProperty(f)&&f in Qk)return y0[a]=l[f];return a}var Zk=uo("animationend"),eC=uo("animationiteration"),tC=uo("animationstart"),J6=uo("transitionrun"),q6=uo("transitionstart"),H6=uo("transitioncancel"),nC=uo("transitionend"),rC=new Map,x0="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(" ");x0.push("scrollEnd");function vi(a,l){rC.set(a,l),as(l,[a])}var Op=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)},$r=[],Ll=0,b0=0;function Rp(){for(var a=Ll,l=b0=Ll=0;l<a;){var f=$r[l];$r[l++]=null;var m=$r[l];$r[l++]=null;var x=$r[l];$r[l++]=null;var v=$r[l];if($r[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&&iC(f,x,v)}}function Dp(a,l,f,m){$r[Ll++]=a,$r[Ll++]=l,$r[Ll++]=f,$r[Ll++]=m,b0|=m,a.lanes|=m,a=a.alternate,a!==null&&(a.lanes|=m)}function S0(a,l,f,m){return Dp(a,l,f,m),Ip(a)}function co(a,l){return Dp(a,null,null,l),Ip(a)}function iC(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-wt(f),a=v.hiddenUpdates,m=a[x],m===null?a[x]=[l]:m.push(l),l.lane=f|536870912),v):null}function Ip(a){if(50<Fc)throw Fc=0,My=null,Error(r(185));for(var l=a.return;l!==null;)a=l,l=a.return;return a.tag===3?a.stateNode:null}var zl={};function K6(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 Er(a,l,f,m){return new K6(a,l,f,m)}function v0(a){return a=a.prototype,!(!a||!a.isReactComponent)}function ls(a,l){var f=a.alternate;return f===null?(f=Er(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 sC(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 _p(a,l,f,m,x,v){var A=0;if(m=a,typeof a=="function")v0(a)&&(A=1);else if(typeof a=="string")A=Q4(a,f,xe.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case $:return a=Er(31,f,l,x),a.elementType=$,a.lanes=v,a;case w:return fo(f.children,x,v,l);case N:A=8,x|=24;break;case T:return a=Er(12,f,l,x|2),a.elementType=T,a.lanes=v,a;case z:return a=Er(13,f,l,x),a.elementType=z,a.lanes=v,a;case C:return a=Er(19,f,l,x),a.elementType=C,a.lanes=v,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case V:A=10;break e;case F:A=9;break e;case H:A=11;break e;case _:A=14;break e;case U:A=16,m=null;break e}A=29,f=Error(r(130,a===null?"null":typeof a,"")),m=null}return l=Er(A,f,l,x),l.elementType=a,l.type=m,l.lanes=v,l}function fo(a,l,f,m){return a=Er(7,a,m,l),a.lanes=f,a}function k0(a,l,f){return a=Er(6,a,null,l),a.lanes=f,a}function aC(a){var l=Er(18,null,null,0);return l.stateNode=a,l}function C0(a,l,f){return l=Er(4,a.children!==null?a.children:[],a.key,l),l.lanes=f,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}var oC=new WeakMap;function Ur(a,l){if(typeof a=="object"&&a!==null){var f=oC.get(a);return f!==void 0?f:(l={value:a,source:l,stack:dn(l)},oC.set(a,l),l)}return{value:a,source:l,stack:dn(l)}}var Bl=[],Vl=0,Lp=null,xc=0,Jr=[],qr=0,ta=null,_i=1,Li="";function us(a,l){Bl[Vl++]=xc,Bl[Vl++]=Lp,Lp=a,xc=l}function lC(a,l,f){Jr[qr++]=_i,Jr[qr++]=Li,Jr[qr++]=ta,ta=a;var m=_i;a=Li;var x=32-wt(m)-1;m&=~(1<<x),f+=1;var v=32-wt(l)+x;if(30<v){var A=x-x%5;v=(m&(1<<A)-1).toString(32),m>>=A,x-=A,_i=1<<32-wt(l)+x|f<<x|m,Li=v+a}else _i=1<<v|f<<x|m,Li=a}function w0(a){a.return!==null&&(us(a,1),lC(a,1,0))}function E0(a){for(;a===Lp;)Lp=Bl[--Vl],Bl[Vl]=null,xc=Bl[--Vl],Bl[Vl]=null;for(;a===ta;)ta=Jr[--qr],Jr[qr]=null,Li=Jr[--qr],Jr[qr]=null,_i=Jr[--qr],Jr[qr]=null}function uC(a,l){Jr[qr++]=_i,Jr[qr++]=Li,Jr[qr++]=ta,_i=l.id,Li=l.overflow,ta=a}var xn=null,_t=null,ct=!1,na=null,Hr=!1,A0=Error(r(519));function ra(a){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw bc(Ur(l,a)),A0}function cC(a){var l=a.stateNode,f=a.type,m=a.memoizedProps;switch(l[Yt]=a,l[yn]=m,f){case"dialog":st("cancel",l),st("close",l);break;case"iframe":case"object":case"embed":st("load",l);break;case"video":case"audio":for(f=0;f<jc.length;f++)st(jc[f],l);break;case"source":st("error",l);break;case"img":case"image":case"link":st("error",l),st("load",l);break;case"details":st("toggle",l);break;case"input":st("invalid",l),oc(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":st("invalid",l);break;case"textarea":st("invalid",l),Ap(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||N2(l.textContent,f)?(m.popover!=null&&(st("beforetoggle",l),st("toggle",l)),m.onScroll!=null&&st("scroll",l),m.onScrollEnd!=null&&st("scrollend",l),m.onClick!=null&&(l.onclick=Fr),l=!0):l=!1,l||ra(a,!0)}function fC(a){for(xn=a.return;xn;)switch(xn.tag){case 5:case 31:case 13:Hr=!1;return;case 27:case 3:Hr=!0;return;default:xn=xn.return}}function Fl(a){if(a!==xn)return!1;if(!ct)return fC(a),ct=!0,!1;var l=a.tag,f;if((f=l!==3&&l!==27)&&((f=l===5)&&(f=a.type,f=!(f!=="form"&&f!=="button")||Jy(a.type,a.memoizedProps)),f=!f),f&&_t&&ra(a),fC(a),l===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));_t=z2(a)}else if(l===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));_t=z2(a)}else l===27?(l=_t,ya(a.type)?(a=Yy,Yy=null,_t=a):_t=l):_t=xn?Gr(a.stateNode.nextSibling):null;return!0}function ho(){_t=xn=null,ct=!1}function N0(){var a=na;return a!==null&&(mr===null?mr=a:mr.push.apply(mr,a),na=null),a}function bc(a){na===null?na=[a]:na.push(a)}var T0=P(null),po=null,cs=null;function ia(a,l,f){L(T0,l._currentValue),l._currentValue=f}function fs(a){a._currentValue=T0.current,te(T0)}function M0(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 O0(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 D=v;v=x;for(var J=0;J<l.length;J++)if(D.context===l[J]){v.lanes|=f,D=v.alternate,D!==null&&(D.lanes|=f),M0(v.return,f,a),m||(A=null);break e}v=D.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),M0(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 Pl(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 D=x.type;wr(x.pendingProps.value,A.value)||(a!==null?a.push(D):a=[D])}}else if(x===He.current){if(A=x.alternate,A===null)throw Error(r(387));A.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(a!==null?a.push(Hc):a=[Hc])}x=x.return}a!==null&&O0(l,a,f,m),l.flags|=262144}function zp(a){for(a=a.firstContext;a!==null;){if(!wr(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 bn(a){return hC(po,a)}function Bp(a,l){return po===null&&mo(a),hC(a,l)}function hC(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 G6=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()})}},Y6=t.unstable_scheduleCallback,W6=t.unstable_NormalPriority,Xt={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function R0(){return{controller:new G6,data:new Map,refCount:0}}function Sc(a){a.refCount--,a.refCount===0&&Y6(W6,function(){a.controller.abort()})}var vc=null,D0=0,jl=0,$l=null;function X6(a,l){if(vc===null){var f=vc=[];D0=0,jl=Ly(),$l={status:"pending",value:void 0,then:function(m){f.push(m)}}}return D0++,l.then(pC,pC),l}function pC(){if(--D0===0&&vc!==null){$l!==null&&($l.status="fulfilled");var a=vc;vc=null,jl=0,$l=null;for(var l=0;l<a.length;l++)(0,a[l])()}}function Q6(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 dC=X.S;X.S=function(a,l){Xw=Be(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&X6(a,l),dC!==null&&dC(a,l)};var go=P(null);function I0(){var a=go.current;return a!==null?a:Rt.pooledCache}function Vp(a,l){l===null?L(go,go.current):L(go,l.pool)}function mC(){var a=I0();return a===null?null:{parent:Xt._currentValue,pool:a}}var Ul=Error(r(460)),_0=Error(r(474)),Fp=Error(r(542)),Pp={then:function(){}};function gC(a){return a=a.status,a==="fulfilled"||a==="rejected"}function yC(a,l,f){switch(f=a[f],f===void 0?a.push(l):f!==l&&(l.then(Fr,Fr),l=f),l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,bC(a),a;default:if(typeof l.status=="string")l.then(Fr,Fr);else{if(a=Rt,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,bC(a),a}throw xo=l,Ul}}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,Ul):f}}var xo=null;function xC(){if(xo===null)throw Error(r(459));var a=xo;return xo=null,a}function bC(a){if(a===Ul||a===Fp)throw Error(r(483))}var Jl=null,kc=0;function jp(a){var l=kc;return kc+=1,Jl===null&&(Jl=[]),yC(Jl,a,l)}function Cc(a,l){l=l.props.ref,a.ref=l!==void 0?l:null}function $p(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 SC(a){function l(Q,K){if(a){var ne=Q.deletions;ne===null?(Q.deletions=[K],Q.flags|=16):ne.push(K)}}function f(Q,K){if(!a)return null;for(;K!==null;)l(Q,K),K=K.sibling;return null}function m(Q){for(var K=new Map;Q!==null;)Q.key!==null?K.set(Q.key,Q):K.set(Q.index,Q),Q=Q.sibling;return K}function x(Q,K){return Q=ls(Q,K),Q.index=0,Q.sibling=null,Q}function v(Q,K,ne){return Q.index=ne,a?(ne=Q.alternate,ne!==null?(ne=ne.index,ne<K?(Q.flags|=67108866,K):ne):(Q.flags|=67108866,K)):(Q.flags|=1048576,K)}function A(Q){return a&&Q.alternate===null&&(Q.flags|=67108866),Q}function D(Q,K,ne,pe){return K===null||K.tag!==6?(K=k0(ne,Q.mode,pe),K.return=Q,K):(K=x(K,ne),K.return=Q,K)}function J(Q,K,ne,pe){var ze=ne.type;return ze===w?ce(Q,K,ne.props.children,pe,ne.key):K!==null&&(K.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===U&&yo(ze)===K.type)?(K=x(K,ne.props),Cc(K,ne),K.return=Q,K):(K=_p(ne.type,ne.key,ne.props,null,Q.mode,pe),Cc(K,ne),K.return=Q,K)}function ie(Q,K,ne,pe){return K===null||K.tag!==4||K.stateNode.containerInfo!==ne.containerInfo||K.stateNode.implementation!==ne.implementation?(K=C0(ne,Q.mode,pe),K.return=Q,K):(K=x(K,ne.children||[]),K.return=Q,K)}function ce(Q,K,ne,pe,ze){return K===null||K.tag!==7?(K=fo(ne,Q.mode,pe,ze),K.return=Q,K):(K=x(K,ne),K.return=Q,K)}function me(Q,K,ne){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=k0(""+K,Q.mode,ne),K.return=Q,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case b:return ne=_p(K.type,K.key,K.props,null,Q.mode,ne),Cc(ne,K),ne.return=Q,ne;case k:return K=C0(K,Q.mode,ne),K.return=Q,K;case U:return K=yo(K),me(Q,K,ne)}if(Y(K)||ae(K))return K=fo(K,Q.mode,ne,null),K.return=Q,K;if(typeof K.then=="function")return me(Q,jp(K),ne);if(K.$$typeof===V)return me(Q,Bp(Q,K),ne);$p(Q,K)}return null}function se(Q,K,ne,pe){var ze=K!==null?K.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ze!==null?null:D(Q,K,""+ne,pe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case b:return ne.key===ze?J(Q,K,ne,pe):null;case k:return ne.key===ze?ie(Q,K,ne,pe):null;case U:return ne=yo(ne),se(Q,K,ne,pe)}if(Y(ne)||ae(ne))return ze!==null?null:ce(Q,K,ne,pe,null);if(typeof ne.then=="function")return se(Q,K,jp(ne),pe);if(ne.$$typeof===V)return se(Q,K,Bp(Q,ne),pe);$p(Q,ne)}return null}function oe(Q,K,ne,pe,ze){if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return Q=Q.get(ne)||null,D(K,Q,""+pe,ze);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case b:return Q=Q.get(pe.key===null?ne:pe.key)||null,J(K,Q,pe,ze);case k:return Q=Q.get(pe.key===null?ne:pe.key)||null,ie(K,Q,pe,ze);case U:return pe=yo(pe),oe(Q,K,ne,pe,ze)}if(Y(pe)||ae(pe))return Q=Q.get(ne)||null,ce(K,Q,pe,ze,null);if(typeof pe.then=="function")return oe(Q,K,ne,jp(pe),ze);if(pe.$$typeof===V)return oe(Q,K,ne,Bp(K,pe),ze);$p(K,pe)}return null}function Me(Q,K,ne,pe){for(var ze=null,gt=null,Ie=K,et=K=0,ot=null;Ie!==null&&et<ne.length;et++){Ie.index>et?(ot=Ie,Ie=null):ot=Ie.sibling;var yt=se(Q,Ie,ne[et],pe);if(yt===null){Ie===null&&(Ie=ot);break}a&&Ie&&yt.alternate===null&&l(Q,Ie),K=v(yt,K,et),gt===null?ze=yt:gt.sibling=yt,gt=yt,Ie=ot}if(et===ne.length)return f(Q,Ie),ct&&us(Q,et),ze;if(Ie===null){for(;et<ne.length;et++)Ie=me(Q,ne[et],pe),Ie!==null&&(K=v(Ie,K,et),gt===null?ze=Ie:gt.sibling=Ie,gt=Ie);return ct&&us(Q,et),ze}for(Ie=m(Ie);et<ne.length;et++)ot=oe(Ie,Q,et,ne[et],pe),ot!==null&&(a&&ot.alternate!==null&&Ie.delete(ot.key===null?et:ot.key),K=v(ot,K,et),gt===null?ze=ot:gt.sibling=ot,gt=ot);return a&&Ie.forEach(function(ka){return l(Q,ka)}),ct&&us(Q,et),ze}function Fe(Q,K,ne,pe){if(ne==null)throw Error(r(151));for(var ze=null,gt=null,Ie=K,et=K=0,ot=null,yt=ne.next();Ie!==null&&!yt.done;et++,yt=ne.next()){Ie.index>et?(ot=Ie,Ie=null):ot=Ie.sibling;var ka=se(Q,Ie,yt.value,pe);if(ka===null){Ie===null&&(Ie=ot);break}a&&Ie&&ka.alternate===null&&l(Q,Ie),K=v(ka,K,et),gt===null?ze=ka:gt.sibling=ka,gt=ka,Ie=ot}if(yt.done)return f(Q,Ie),ct&&us(Q,et),ze;if(Ie===null){for(;!yt.done;et++,yt=ne.next())yt=me(Q,yt.value,pe),yt!==null&&(K=v(yt,K,et),gt===null?ze=yt:gt.sibling=yt,gt=yt);return ct&&us(Q,et),ze}for(Ie=m(Ie);!yt.done;et++,yt=ne.next())yt=oe(Ie,Q,et,yt.value,pe),yt!==null&&(a&&yt.alternate!==null&&Ie.delete(yt.key===null?et:yt.key),K=v(yt,K,et),gt===null?ze=yt:gt.sibling=yt,gt=yt);return a&&Ie.forEach(function(uL){return l(Q,uL)}),ct&&us(Q,et),ze}function Mt(Q,K,ne,pe){if(typeof ne=="object"&&ne!==null&&ne.type===w&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case b:e:{for(var ze=ne.key;K!==null;){if(K.key===ze){if(ze=ne.type,ze===w){if(K.tag===7){f(Q,K.sibling),pe=x(K,ne.props.children),pe.return=Q,Q=pe;break e}}else if(K.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===U&&yo(ze)===K.type){f(Q,K.sibling),pe=x(K,ne.props),Cc(pe,ne),pe.return=Q,Q=pe;break e}f(Q,K);break}else l(Q,K);K=K.sibling}ne.type===w?(pe=fo(ne.props.children,Q.mode,pe,ne.key),pe.return=Q,Q=pe):(pe=_p(ne.type,ne.key,ne.props,null,Q.mode,pe),Cc(pe,ne),pe.return=Q,Q=pe)}return A(Q);case k:e:{for(ze=ne.key;K!==null;){if(K.key===ze)if(K.tag===4&&K.stateNode.containerInfo===ne.containerInfo&&K.stateNode.implementation===ne.implementation){f(Q,K.sibling),pe=x(K,ne.children||[]),pe.return=Q,Q=pe;break e}else{f(Q,K);break}else l(Q,K);K=K.sibling}pe=C0(ne,Q.mode,pe),pe.return=Q,Q=pe}return A(Q);case U:return ne=yo(ne),Mt(Q,K,ne,pe)}if(Y(ne))return Me(Q,K,ne,pe);if(ae(ne)){if(ze=ae(ne),typeof ze!="function")throw Error(r(150));return ne=ze.call(ne),Fe(Q,K,ne,pe)}if(typeof ne.then=="function")return Mt(Q,K,jp(ne),pe);if(ne.$$typeof===V)return Mt(Q,K,Bp(Q,ne),pe);$p(Q,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,K!==null&&K.tag===6?(f(Q,K.sibling),pe=x(K,ne),pe.return=Q,Q=pe):(f(Q,K),pe=k0(ne,Q.mode,pe),pe.return=Q,Q=pe),A(Q)):f(Q,K)}return function(Q,K,ne,pe){try{kc=0;var ze=Mt(Q,K,ne,pe);return Jl=null,ze}catch(Ie){if(Ie===Ul||Ie===Fp)throw Ie;var gt=Er(29,Ie,null,Q.mode);return gt.lanes=pe,gt.return=Q,gt}}}var bo=SC(!0),vC=SC(!1),sa=!1;function L0(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function z0(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 aa(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function oa(a,l,f){var m=a.updateQueue;if(m===null)return null;if(m=m.shared,(xt&2)!==0){var x=m.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),m.pending=l,l=Ip(a),iC(a,null,f),l}return Dp(a,m,l,f),Ip(a)}function wc(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,yp(a,f)}}function B0(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 V0=!1;function Ec(){if(V0){var a=$l;if(a!==null)throw a}}function Ac(a,l,f,m){V0=!1;var x=a.updateQueue;sa=!1;var v=x.firstBaseUpdate,A=x.lastBaseUpdate,D=x.shared.pending;if(D!==null){x.shared.pending=null;var J=D,ie=J.next;J.next=null,A===null?v=ie:A.next=ie,A=J;var ce=a.alternate;ce!==null&&(ce=ce.updateQueue,D=ce.lastBaseUpdate,D!==A&&(D===null?ce.firstBaseUpdate=ie:D.next=ie,ce.lastBaseUpdate=J))}if(v!==null){var me=x.baseState;A=0,ce=ie=J=null,D=v;do{var se=D.lane&-536870913,oe=se!==D.lane;if(oe?(at&se)===se:(m&se)===se){se!==0&&se===jl&&(V0=!0),ce!==null&&(ce=ce.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var Me=a,Fe=D;se=l;var Mt=f;switch(Fe.tag){case 1:if(Me=Fe.payload,typeof Me=="function"){me=Me.call(Mt,me,se);break e}me=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Fe.payload,se=typeof Me=="function"?Me.call(Mt,me,se):Me,se==null)break e;me=g({},me,se);break e;case 2:sa=!0}}se=D.callback,se!==null&&(a.flags|=64,oe&&(a.flags|=8192),oe=x.callbacks,oe===null?x.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:D.tag,payload:D.payload,callback:D.callback,next:null},ce===null?(ie=ce=oe,J=me):ce=ce.next=oe,A|=se;if(D=D.next,D===null){if(D=x.shared.pending,D===null)break;oe=D,D=oe.next,oe.next=null,x.lastBaseUpdate=oe,x.shared.pending=null}}while(!0);ce===null&&(J=me),x.baseState=J,x.firstBaseUpdate=ie,x.lastBaseUpdate=ce,v===null&&(x.shared.lanes=0),ha|=A,a.lanes=A,a.memoizedState=me}}function kC(a,l){if(typeof a!="function")throw Error(r(191,a));a.call(l)}function CC(a,l){var f=a.callbacks;if(f!==null)for(a.callbacks=null,a=0;a<f.length;a++)kC(f[a],l)}var ql=P(null),Up=P(0);function wC(a,l){a=Ss,L(Up,a),L(ql,l),Ss=a|l.baseLanes}function F0(){L(Up,Ss),L(ql,ql.current)}function P0(){Ss=Up.current,te(ql),te(Up)}var Ar=P(null),Kr=null;function la(a){var l=a.alternate;L(qt,qt.current&1),L(Ar,a),Kr===null&&(l===null||ql.current!==null||l.memoizedState!==null)&&(Kr=a)}function j0(a){L(qt,qt.current),L(Ar,a),Kr===null&&(Kr=a)}function EC(a){a.tag===22?(L(qt,qt.current),L(Ar,a),Kr===null&&(Kr=a)):ua()}function ua(){L(qt,qt.current),L(Ar,Ar.current)}function Nr(a){te(Ar),Kr===a&&(Kr=null),te(qt)}var qt=P(0);function Jp(a){for(var l=a;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||Ky(f)||Gy(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,Ze=null,Nt=null,Qt=null,qp=!1,Hl=!1,So=!1,Hp=0,Nc=0,Kl=null,Z6=0;function jt(){throw Error(r(321))}function $0(a,l){if(l===null)return!1;for(var f=0;f<l.length&&f<a.length;f++)if(!wr(a[f],l[f]))return!1;return!0}function U0(a,l,f,m,x,v){return hs=v,Ze=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,X.H=a===null||a.memoizedState===null?lw:iy,So=!1,v=f(m,x),So=!1,Hl&&(v=NC(l,f,m,x)),AC(a),v}function AC(a){X.H=Oc;var l=Nt!==null&&Nt.next!==null;if(hs=0,Qt=Nt=Ze=null,qp=!1,Nc=0,Kl=null,l)throw Error(r(300));a===null||Zt||(a=a.dependencies,a!==null&&zp(a)&&(Zt=!0))}function NC(a,l,f,m){Ze=a;var x=0;do{if(Hl&&(Kl=null),Nc=0,Hl=!1,25<=x)throw Error(r(301));if(x+=1,Qt=Nt=null,a.updateQueue!=null){var v=a.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}X.H=uw,v=l(f,m)}while(Hl);return v}function e4(){var a=X.H,l=a.useState()[0];return l=typeof l.then=="function"?Tc(l):l,a=a.useState()[0],(Nt!==null?Nt.memoizedState:null)!==a&&(Ze.flags|=1024),l}function J0(){var a=Hp!==0;return Hp=0,a}function q0(a,l,f){l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~f}function H0(a){if(qp){for(a=a.memoizedState;a!==null;){var l=a.queue;l!==null&&(l.pending=null),a=a.next}qp=!1}hs=0,Qt=Nt=Ze=null,Hl=!1,Nc=Hp=0,Kl=null}function Un(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?Ze.memoizedState=Qt=a:Qt=Qt.next=a,Qt}function Ht(){if(Nt===null){var a=Ze.alternate;a=a!==null?a.memoizedState:null}else a=Nt.next;var l=Qt===null?Ze.memoizedState:Qt.next;if(l!==null)Qt=l,Nt=a;else{if(a===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));Nt=a,a={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},Qt===null?Ze.memoizedState=Qt=a:Qt=Qt.next=a}return Qt}function Kp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tc(a){var l=Nc;return Nc+=1,Kl===null&&(Kl=[]),a=yC(Kl,a,l),l=Ze,(Qt===null?l.memoizedState:Qt.next)===null&&(l=l.alternate,X.H=l===null||l.memoizedState===null?lw:iy),a}function Gp(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Tc(a);if(a.$$typeof===V)return bn(a)}throw Error(r(438,String(a)))}function K0(a){var l=null,f=Ze.updateQueue;if(f!==null&&(l=f.memoCache),l==null){var m=Ze.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=Kp(),Ze.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]=q;return l.index++,f}function ps(a,l){return typeof l=="function"?l(a):l}function Yp(a){var l=Ht();return G0(l,Nt,a)}function G0(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 D=A=null,J=null,ie=l,ce=!1;do{var me=ie.lane&-536870913;if(me!==ie.lane?(at&me)===me:(hs&me)===me){var se=ie.revertLane;if(se===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),me===jl&&(ce=!0);else if((hs&se)===se){ie=ie.next,se===jl&&(ce=!0);continue}else me={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},J===null?(D=J=me,A=v):J=J.next=me,Ze.lanes|=se,ha|=se;me=ie.action,So&&f(v,me),v=ie.hasEagerState?ie.eagerState:f(v,me)}else se={lane:me,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},J===null?(D=J=se,A=v):J=J.next=se,Ze.lanes|=me,ha|=me;ie=ie.next}while(ie!==null&&ie!==l);if(J===null?A=v:J.next=D,!wr(v,a.memoizedState)&&(Zt=!0,ce&&(f=$l,f!==null)))throw f;a.memoizedState=v,a.baseState=A,a.baseQueue=J,m.lastRenderedState=v}return x===null&&(m.lanes=0),[a.memoizedState,m.dispatch]}function Y0(a){var l=Ht(),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);wr(v,l.memoizedState)||(Zt=!0),l.memoizedState=v,l.baseQueue===null&&(l.baseState=v),f.lastRenderedState=v}return[v,m]}function TC(a,l,f){var m=Ze,x=Ht(),v=ct;if(v){if(f===void 0)throw Error(r(407));f=f()}else f=l();var A=!wr((Nt||x).memoizedState,f);if(A&&(x.memoizedState=f,Zt=!0),x=x.queue,Q0(RC.bind(null,m,x,a),[a]),x.getSnapshot!==l||A||Qt!==null&&Qt.memoizedState.tag&1){if(m.flags|=2048,Gl(9,{destroy:void 0},OC.bind(null,m,x,f,l),null),Rt===null)throw Error(r(349));v||(hs&127)!==0||MC(m,l,f)}return f}function MC(a,l,f){a.flags|=16384,a={getSnapshot:l,value:f},l=Ze.updateQueue,l===null?(l=Kp(),Ze.updateQueue=l,l.stores=[a]):(f=l.stores,f===null?l.stores=[a]:f.push(a))}function OC(a,l,f,m){l.value=f,l.getSnapshot=m,DC(l)&&IC(a)}function RC(a,l,f){return f(function(){DC(l)&&IC(a)})}function DC(a){var l=a.getSnapshot;a=a.value;try{var f=l();return!wr(a,f)}catch{return!0}}function IC(a){var l=co(a,2);l!==null&&gr(l,a,2)}function W0(a){var l=Un();if(typeof a=="function"){var f=a;if(a=f(),So){An(!0);try{f()}finally{An(!1)}}}return l.memoizedState=l.baseState=a,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:a},l}function _C(a,l,f,m){return a.baseState=f,G0(a,Nt,typeof m=="function"?m:ps)}function t4(a,l,f,m,x){if(Qp(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)}};X.T!==null?f(!0):v.isTransition=!1,m(v),f=l.pending,f===null?(v.next=l.pending=v,LC(l,v)):(v.next=f.next,l.pending=f.next=v)}}function LC(a,l){var f=l.action,m=l.payload,x=a.state;if(l.isTransition){var v=X.T,A={};X.T=A;try{var D=f(x,m),J=X.S;J!==null&&J(A,D),zC(a,l,D)}catch(ie){X0(a,l,ie)}finally{v!==null&&A.types!==null&&(v.types=A.types),X.T=v}}else try{v=f(x,m),zC(a,l,v)}catch(ie){X0(a,l,ie)}}function zC(a,l,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(m){BC(a,l,m)},function(m){return X0(a,l,m)}):BC(a,l,f)}function BC(a,l,f){l.status="fulfilled",l.value=f,VC(l),a.state=f,l=a.pending,l!==null&&(f=l.next,f===l?a.pending=null:(f=f.next,l.next=f,LC(a,f)))}function X0(a,l,f){var m=a.pending;if(a.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=f,VC(l),l=l.next;while(l!==m)}a.action=null}function VC(a){a=a.listeners;for(var l=0;l<a.length;l++)(0,a[l])()}function FC(a,l){return l}function PC(a,l){if(ct){var f=Rt.formState;if(f!==null){e:{var m=Ze;if(ct){if(_t){t:{for(var x=_t,v=Hr;x.nodeType!==8;){if(!v){x=null;break t}if(x=Gr(x.nextSibling),x===null){x=null;break t}}v=x.data,x=v==="F!"||v==="F"?x:null}if(x){_t=Gr(x.nextSibling),m=x.data==="F!";break e}}ra(m)}m=!1}m&&(l=f[0])}}return f=Un(),f.memoizedState=f.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:FC,lastRenderedState:l},f.queue=m,f=sw.bind(null,Ze,m),m.dispatch=f,m=W0(!1),v=ry.bind(null,Ze,!1,m.queue),m=Un(),x={state:l,dispatch:null,action:a,pending:null},m.queue=x,f=t4.bind(null,Ze,x,v,f),x.dispatch=f,m.memoizedState=a,[l,f,!1]}function jC(a){var l=Ht();return $C(l,Nt,a)}function $C(a,l,f){if(l=G0(a,l,FC)[0],a=Yp(ps)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=Tc(l)}catch(A){throw A===Ul?Fp:A}else m=l;l=Ht();var x=l.queue,v=x.dispatch;return f!==l.memoizedState&&(Ze.flags|=2048,Gl(9,{destroy:void 0},n4.bind(null,x,f),null)),[m,v,a]}function n4(a,l){a.action=l}function UC(a){var l=Ht(),f=Nt;if(f!==null)return $C(l,f,a);Ht(),l=l.memoizedState,f=Ht();var m=f.queue.dispatch;return f.memoizedState=a,[l,m,!1]}function Gl(a,l,f,m){return a={tag:a,create:f,deps:m,inst:l,next:null},l=Ze.updateQueue,l===null&&(l=Kp(),Ze.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 JC(){return Ht().memoizedState}function Wp(a,l,f,m){var x=Un();Ze.flags|=a,x.memoizedState=Gl(1|l,{destroy:void 0},f,m===void 0?null:m)}function Xp(a,l,f,m){var x=Ht();m=m===void 0?null:m;var v=x.memoizedState.inst;Nt!==null&&m!==null&&$0(m,Nt.memoizedState.deps)?x.memoizedState=Gl(l,v,f,m):(Ze.flags|=a,x.memoizedState=Gl(1|l,v,f,m))}function qC(a,l){Wp(8390656,8,a,l)}function Q0(a,l){Xp(2048,8,a,l)}function r4(a){Ze.flags|=4;var l=Ze.updateQueue;if(l===null)l=Kp(),Ze.updateQueue=l,l.events=[a];else{var f=l.events;f===null?l.events=[a]:f.push(a)}}function HC(a){var l=Ht().memoizedState;return r4({ref:l,nextImpl:a}),function(){if((xt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function KC(a,l){return Xp(4,2,a,l)}function GC(a,l){return Xp(4,4,a,l)}function YC(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 WC(a,l,f){f=f!=null?f.concat([a]):null,Xp(4,4,YC.bind(null,l,a),f)}function Z0(){}function XC(a,l){var f=Ht();l=l===void 0?null:l;var m=f.memoizedState;return l!==null&&$0(l,m[1])?m[0]:(f.memoizedState=[a,l],a)}function QC(a,l){var f=Ht();l=l===void 0?null:l;var m=f.memoizedState;if(l!==null&&$0(l,m[1]))return m[0];if(m=a(),So){An(!0);try{a()}finally{An(!1)}}return f.memoizedState=[m,l],m}function ey(a,l,f){return f===void 0||(hs&1073741824)!==0&&(at&261930)===0?a.memoizedState=l:(a.memoizedState=f,a=Zw(),Ze.lanes|=a,ha|=a,f)}function ZC(a,l,f,m){return wr(f,l)?f:ql.current!==null?(a=ey(a,f,m),wr(a,l)||(Zt=!0),a):(hs&42)===0||(hs&1073741824)!==0&&(at&261930)===0?(Zt=!0,a.memoizedState=f):(a=Zw(),Ze.lanes|=a,ha|=a,l)}function ew(a,l,f,m,x){var v=le.p;le.p=v!==0&&8>v?v:8;var A=X.T,D={};X.T=D,ry(a,!1,l,f);try{var J=x(),ie=X.S;if(ie!==null&&ie(D,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var ce=Q6(J,m);Mc(a,l,ce,Or(a))}else Mc(a,l,m,Or(a))}catch(me){Mc(a,l,{then:function(){},status:"rejected",reason:me},Or())}finally{le.p=v,A!==null&&D.types!==null&&(A.types=D.types),X.T=A}}function i4(){}function ty(a,l,f,m){if(a.tag!==5)throw Error(r(476));var x=tw(a).queue;ew(a,x,l,Ce,f===null?i4:function(){return nw(a),f(m)})}function tw(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:Ce,baseState:Ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:Ce},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 nw(a){var l=tw(a);l.next===null&&(l=a.alternate.memoizedState),Mc(a,l.next.queue,{},Or())}function ny(){return bn(Hc)}function rw(){return Ht().memoizedState}function iw(){return Ht().memoizedState}function s4(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var f=Or();a=aa(f);var m=oa(l,a,f);m!==null&&(gr(m,l,f),wc(m,l,f)),l={cache:R0()},a.payload=l;return}l=l.return}}function a4(a,l,f){var m=Or();f={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Qp(a)?aw(l,f):(f=S0(a,l,f,m),f!==null&&(gr(f,a,m),ow(f,l,m)))}function sw(a,l,f){var m=Or();Mc(a,l,f,m)}function Mc(a,l,f,m){var x={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(Qp(a))aw(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,D=v(A,f);if(x.hasEagerState=!0,x.eagerState=D,wr(D,A))return Dp(a,l,x,0),Rt===null&&Rp(),!1}catch{}if(f=S0(a,l,x,m),f!==null)return gr(f,a,m),ow(f,l,m),!0}return!1}function ry(a,l,f,m){if(m={lane:2,revertLane:Ly(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Qp(a)){if(l)throw Error(r(479))}else l=S0(a,f,m,2),l!==null&&gr(l,a,2)}function Qp(a){var l=a.alternate;return a===Ze||l!==null&&l===Ze}function aw(a,l){Hl=qp=!0;var f=a.pending;f===null?l.next=l:(l.next=f.next,f.next=l),a.pending=l}function ow(a,l,f){if((f&4194048)!==0){var m=l.lanes;m&=a.pendingLanes,f|=m,l.lanes=f,yp(a,f)}}var Oc={readContext:bn,use:Gp,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};Oc.useEffectEvent=jt;var lw={readContext:bn,use:Gp,useCallback:function(a,l){return Un().memoizedState=[a,l===void 0?null:l],a},useContext:bn,useEffect:qC,useImperativeHandle:function(a,l,f){f=f!=null?f.concat([a]):null,Wp(4194308,4,YC.bind(null,l,a),f)},useLayoutEffect:function(a,l){return Wp(4194308,4,a,l)},useInsertionEffect:function(a,l){Wp(4,2,a,l)},useMemo:function(a,l){var f=Un();l=l===void 0?null:l;var m=a();if(So){An(!0);try{a()}finally{An(!1)}}return f.memoizedState=[m,l],m},useReducer:function(a,l,f){var m=Un();if(f!==void 0){var x=f(l);if(So){An(!0);try{f(l)}finally{An(!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=a4.bind(null,Ze,a),[m.memoizedState,a]},useRef:function(a){var l=Un();return a={current:a},l.memoizedState=a},useState:function(a){a=W0(a);var l=a.queue,f=sw.bind(null,Ze,l);return l.dispatch=f,[a.memoizedState,f]},useDebugValue:Z0,useDeferredValue:function(a,l){var f=Un();return ey(f,a,l)},useTransition:function(){var a=W0(!1);return a=ew.bind(null,Ze,a.queue,!0,!1),Un().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,f){var m=Ze,x=Un();if(ct){if(f===void 0)throw Error(r(407));f=f()}else{if(f=l(),Rt===null)throw Error(r(349));(at&127)!==0||MC(m,l,f)}x.memoizedState=f;var v={value:f,getSnapshot:l};return x.queue=v,qC(RC.bind(null,m,v,a),[a]),m.flags|=2048,Gl(9,{destroy:void 0},OC.bind(null,m,v,f,l),null),f},useId:function(){var a=Un(),l=Rt.identifierPrefix;if(ct){var f=Li,m=_i;f=(m&~(1<<32-wt(m)-1)).toString(32)+f,l="_"+l+"R_"+f,f=Hp++,0<f&&(l+="H"+f.toString(32)),l+="_"}else f=Z6++,l="_"+l+"r_"+f.toString(32)+"_";return a.memoizedState=l},useHostTransitionStatus:ny,useFormState:PC,useActionState:PC,useOptimistic:function(a){var l=Un();l.memoizedState=l.baseState=a;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=f,l=ry.bind(null,Ze,!0,f),f.dispatch=l,[a,l]},useMemoCache:K0,useCacheRefresh:function(){return Un().memoizedState=s4.bind(null,Ze)},useEffectEvent:function(a){var l=Un(),f={impl:a};return l.memoizedState=f,function(){if((xt&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}},iy={readContext:bn,use:Gp,useCallback:XC,useContext:bn,useEffect:Q0,useImperativeHandle:WC,useInsertionEffect:KC,useLayoutEffect:GC,useMemo:QC,useReducer:Yp,useRef:JC,useState:function(){return Yp(ps)},useDebugValue:Z0,useDeferredValue:function(a,l){var f=Ht();return ZC(f,Nt.memoizedState,a,l)},useTransition:function(){var a=Yp(ps)[0],l=Ht().memoizedState;return[typeof a=="boolean"?a:Tc(a),l]},useSyncExternalStore:TC,useId:rw,useHostTransitionStatus:ny,useFormState:jC,useActionState:jC,useOptimistic:function(a,l){var f=Ht();return _C(f,Nt,a,l)},useMemoCache:K0,useCacheRefresh:iw};iy.useEffectEvent=HC;var uw={readContext:bn,use:Gp,useCallback:XC,useContext:bn,useEffect:Q0,useImperativeHandle:WC,useInsertionEffect:KC,useLayoutEffect:GC,useMemo:QC,useReducer:Y0,useRef:JC,useState:function(){return Y0(ps)},useDebugValue:Z0,useDeferredValue:function(a,l){var f=Ht();return Nt===null?ey(f,a,l):ZC(f,Nt.memoizedState,a,l)},useTransition:function(){var a=Y0(ps)[0],l=Ht().memoizedState;return[typeof a=="boolean"?a:Tc(a),l]},useSyncExternalStore:TC,useId:rw,useHostTransitionStatus:ny,useFormState:UC,useActionState:UC,useOptimistic:function(a,l){var f=Ht();return Nt!==null?_C(f,Nt,a,l):(f.baseState=a,[a,f.queue.dispatch])},useMemoCache:K0,useCacheRefresh:iw};uw.useEffectEvent=HC;function sy(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 ay={enqueueSetState:function(a,l,f){a=a._reactInternals;var m=Or(),x=aa(m);x.payload=l,f!=null&&(x.callback=f),l=oa(a,x,m),l!==null&&(gr(l,a,m),wc(l,a,m))},enqueueReplaceState:function(a,l,f){a=a._reactInternals;var m=Or(),x=aa(m);x.tag=1,x.payload=l,f!=null&&(x.callback=f),l=oa(a,x,m),l!==null&&(gr(l,a,m),wc(l,a,m))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var f=Or(),m=aa(f);m.tag=2,l!=null&&(m.callback=l),l=oa(a,m,f),l!==null&&(gr(l,a,f),wc(l,a,f))}};function cw(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?!gc(f,m)||!gc(x,v):!0}function fw(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&&ay.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 hw(a){Op(a)}function pw(a){console.error(a)}function dw(a){Op(a)}function Zp(a,l){try{var f=a.onUncaughtError;f(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function mw(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 oy(a,l,f){return f=aa(f),f.tag=3,f.payload={element:null},f.callback=function(){Zp(a,l)},f}function gw(a){return a=aa(a),a.tag=3,a}function yw(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(){mw(l,f,m)}}var A=f.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(a.callback=function(){mw(l,f,m),typeof x!="function"&&(pa===null?pa=new Set([this]):pa.add(this));var D=m.stack;this.componentDidCatch(m.value,{componentStack:D!==null?D:""})})}function o4(a,l,f,m,x){if(f.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=f.alternate,l!==null&&Pl(l,f,x,!0),f=Ar.current,f!==null){switch(f.tag){case 31:case 13:return Kr===null?fd():f.alternate===null&&$t===0&&($t=3),f.flags&=-257,f.flags|=65536,f.lanes=x,m===Pp?f.flags|=16384:(l=f.updateQueue,l===null?f.updateQueue=new Set([m]):l.add(m),Dy(a,m,x)),!1;case 22:return f.flags|=65536,m===Pp?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)),Dy(a,m,x)),!1}throw Error(r(435,f.tag))}return Dy(a,m,x),fd(),!1}if(ct)return l=Ar.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=x,m!==A0&&(a=Error(r(422),{cause:m}),bc(Ur(a,f)))):(m!==A0&&(l=Error(r(423),{cause:m}),bc(Ur(l,f))),a=a.current.alternate,a.flags|=65536,x&=-x,a.lanes|=x,m=Ur(m,f),x=oy(a.stateNode,m,x),B0(a,x),$t!==4&&($t=2)),!1;var v=Error(r(520),{cause:m});if(v=Ur(v,f),Vc===null?Vc=[v]:Vc.push(v),$t!==4&&($t=2),l===null)return!0;m=Ur(m,f),f=l;do{switch(f.tag){case 3:return f.flags|=65536,a=x&-x,f.lanes|=a,a=oy(f.stateNode,m,a),B0(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"&&(pa===null||!pa.has(v))))return f.flags|=65536,x&=-x,f.lanes|=x,x=gw(x),yw(x,a,f,m),B0(f,x),!1}f=f.return}while(f!==null);return!1}var ly=Error(r(461)),Zt=!1;function Sn(a,l,f,m){l.child=a===null?vC(l,null,f,m):bo(l,a.child,f,m)}function xw(a,l,f,m,x){f=f.render;var v=l.ref;if("ref"in m){var A={};for(var D in m)D!=="ref"&&(A[D]=m[D])}else A=m;return mo(l),m=U0(a,l,f,A,v,x),D=J0(),a!==null&&!Zt?(q0(a,l,x),ds(a,l,x)):(ct&&D&&w0(l),l.flags|=1,Sn(a,l,m,x),l.child)}function bw(a,l,f,m,x){if(a===null){var v=f.type;return typeof v=="function"&&!v0(v)&&v.defaultProps===void 0&&f.compare===null?(l.tag=15,l.type=v,Sw(a,l,v,m,x)):(a=_p(f.type,null,m,l,l.mode,x),a.ref=l.ref,a.return=l,l.child=a)}if(v=a.child,!gy(a,x)){var A=v.memoizedProps;if(f=f.compare,f=f!==null?f:gc,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 Sw(a,l,f,m,x){if(a!==null){var v=a.memoizedProps;if(gc(v,m)&&a.ref===l.ref)if(Zt=!1,l.pendingProps=m=v,gy(a,x))(a.flags&131072)!==0&&(Zt=!0);else return l.lanes=a.lanes,ds(a,l,x)}return uy(a,l,f,m,x)}function vw(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 kw(a,l,v,f,m)}if((f&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},a!==null&&Vp(l,v!==null?v.cachePool:null),v!==null?wC(l,v):F0(),EC(l);else return m=l.lanes=536870912,kw(a,l,v!==null?v.baseLanes|f:f,f,m)}else v!==null?(Vp(l,v.cachePool),wC(l,v),ua(),l.memoizedState=null):(a!==null&&Vp(l,null),F0(),ua());return Sn(a,l,x,f),l.child}function Rc(a,l){return a!==null&&a.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function kw(a,l,f,m,x){var v=I0();return v=v===null?null:{parent:Xt._currentValue,pool:v},l.memoizedState={baseLanes:f,cachePool:v},a!==null&&Vp(l,null),F0(),EC(l),a!==null&&Pl(a,l,m,!0),l.childLanes=x,null}function ed(a,l){return l=nd({mode:l.mode,children:l.children},a.mode),l.ref=a.ref,a.child=l,l.return=a,l}function Cw(a,l,f){return bo(l,a.child,null,f),a=ed(l,l.pendingProps),a.flags|=2,Nr(l),l.memoizedState=null,a}function l4(a,l,f){var m=l.pendingProps,x=(l.flags&128)!==0;if(l.flags&=-129,a===null){if(ct){if(m.mode==="hidden")return a=ed(l,m),l.lanes=536870912,Rc(null,a);if(j0(l),(a=_t)?(a=L2(a,Hr),a=a!==null&&a.data==="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:ta!==null?{id:_i,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},f=aC(a),f.return=l,l.child=f,xn=l,_t=null)):a=null,a===null)throw ra(l);return l.lanes=536870912,null}return ed(l,m)}var v=a.memoizedState;if(v!==null){var A=v.dehydrated;if(j0(l),x)if(l.flags&256)l.flags&=-257,l=Cw(a,l,f);else if(l.memoizedState!==null)l.child=a.child,l.flags|=128,l=null;else throw Error(r(558));else if(Zt||Pl(a,l,f,!1),x=(f&a.childLanes)!==0,Zt||x){if(m=Rt,m!==null&&(A=Ks(m,f),A!==0&&A!==v.retryLane))throw v.retryLane=A,co(a,A),gr(m,a,A),ly;fd(),l=Cw(a,l,f)}else a=v.treeContext,_t=Gr(A.nextSibling),xn=l,ct=!0,na=null,Hr=!1,a!==null&&uC(l,a),l=ed(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 td(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 uy(a,l,f,m,x){return mo(l),f=U0(a,l,f,m,void 0,x),m=J0(),a!==null&&!Zt?(q0(a,l,x),ds(a,l,x)):(ct&&m&&w0(l),l.flags|=1,Sn(a,l,f,x),l.child)}function ww(a,l,f,m,x,v){return mo(l),l.updateQueue=null,f=NC(l,m,f,x),AC(a),m=J0(),a!==null&&!Zt?(q0(a,l,v),ds(a,l,v)):(ct&&m&&w0(l),l.flags|=1,Sn(a,l,f,v),l.child)}function Ew(a,l,f,m,x){if(mo(l),l.stateNode===null){var v=zl,A=f.contextType;typeof A=="object"&&A!==null&&(v=bn(A)),v=new f(m,v),l.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=ay,l.stateNode=v,v._reactInternals=l,v=l.stateNode,v.props=m,v.state=l.memoizedState,v.refs={},L0(l),A=f.contextType,v.context=typeof A=="object"&&A!==null?bn(A):zl,v.state=l.memoizedState,A=f.getDerivedStateFromProps,typeof A=="function"&&(sy(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&&ay.enqueueReplaceState(v,v.state,null),Ac(l,m,v,x),Ec(),v.state=l.memoizedState),typeof v.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(a===null){v=l.stateNode;var D=l.memoizedProps,J=vo(f,D);v.props=J;var ie=v.context,ce=f.contextType;A=zl,typeof ce=="object"&&ce!==null&&(A=bn(ce));var me=f.getDerivedStateFromProps;ce=typeof me=="function"||typeof v.getSnapshotBeforeUpdate=="function",D=l.pendingProps!==D,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(D||ie!==A)&&fw(l,v,m,A),sa=!1;var se=l.memoizedState;v.state=se,Ac(l,m,v,x),Ec(),ie=l.memoizedState,D||se!==ie||sa?(typeof me=="function"&&(sy(l,f,me,m),ie=l.memoizedState),(J=sa||cw(l,f,J,m,se,ie,A))?(ce||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=ie),v.props=m,v.state=ie,v.context=A,m=J):(typeof v.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{v=l.stateNode,z0(a,l),A=l.memoizedProps,ce=vo(f,A),v.props=ce,me=l.pendingProps,se=v.context,ie=f.contextType,J=zl,typeof ie=="object"&&ie!==null&&(J=bn(ie)),D=f.getDerivedStateFromProps,(ie=typeof D=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A!==me||se!==J)&&fw(l,v,m,J),sa=!1,se=l.memoizedState,v.state=se,Ac(l,m,v,x),Ec();var oe=l.memoizedState;A!==me||se!==oe||sa||a!==null&&a.dependencies!==null&&zp(a.dependencies)?(typeof D=="function"&&(sy(l,f,D,m),oe=l.memoizedState),(ce=sa||cw(l,f,ce,m,se,oe,J)||a!==null&&a.dependencies!==null&&zp(a.dependencies))?(ie||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(m,oe,J),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(m,oe,J)),typeof v.componentDidUpdate=="function"&&(l.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof v.componentDidUpdate!="function"||A===a.memoizedProps&&se===a.memoizedState||(l.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&se===a.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=oe),v.props=m,v.state=oe,v.context=J,m=ce):(typeof v.componentDidUpdate!="function"||A===a.memoizedProps&&se===a.memoizedState||(l.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&se===a.memoizedState||(l.flags|=1024),m=!1)}return v=m,td(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)):Sn(a,l,f,x),l.memoizedState=v.state,a=l.child):a=ds(a,l,x),a}function Aw(a,l,f,m){return ho(),l.flags|=256,Sn(a,l,f,m),l.child}var cy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fy(a){return{baseLanes:a,cachePool:mC()}}function hy(a,l,f){return a=a!==null?a.childLanes&~f:0,l&&(a|=Mr),a}function Nw(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:(qt.current&2)!==0),A&&(x=!0,l.flags&=-129),A=(l.flags&32)!==0,l.flags&=-33,a===null){if(ct){if(x?la(l):ua(),(a=_t)?(a=L2(a,Hr),a=a!==null&&a.data!=="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:ta!==null?{id:_i,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},f=aC(a),f.return=l,l.child=f,xn=l,_t=null)):a=null,a===null)throw ra(l);return Gy(a)?l.lanes=32:l.lanes=536870912,null}var D=m.children;return m=m.fallback,x?(ua(),x=l.mode,D=nd({mode:"hidden",children:D},x),m=fo(m,x,f,null),D.return=l,m.return=l,D.sibling=m,l.child=D,m=l.child,m.memoizedState=fy(f),m.childLanes=hy(a,A,f),l.memoizedState=cy,Rc(null,m)):(la(l),py(l,D))}var J=a.memoizedState;if(J!==null&&(D=J.dehydrated,D!==null)){if(v)l.flags&256?(la(l),l.flags&=-257,l=dy(a,l,f)):l.memoizedState!==null?(ua(),l.child=a.child,l.flags|=128,l=null):(ua(),D=m.fallback,x=l.mode,m=nd({mode:"visible",children:m.children},x),D=fo(D,x,f,null),D.flags|=2,m.return=l,D.return=l,m.sibling=D,l.child=m,bo(l,a.child,null,f),m=l.child,m.memoizedState=fy(f),m.childLanes=hy(a,A,f),l.memoizedState=cy,l=Rc(null,m));else if(la(l),Gy(D)){if(A=D.nextSibling&&D.nextSibling.dataset,A)var ie=A.dgst;A=ie,m=Error(r(419)),m.stack="",m.digest=A,bc({value:m,source:null,stack:null}),l=dy(a,l,f)}else if(Zt||Pl(a,l,f,!1),A=(f&a.childLanes)!==0,Zt||A){if(A=Rt,A!==null&&(m=Ks(A,f),m!==0&&m!==J.retryLane))throw J.retryLane=m,co(a,m),gr(A,a,m),ly;Ky(D)||fd(),l=dy(a,l,f)}else Ky(D)?(l.flags|=192,l.child=a.child,l=null):(a=J.treeContext,_t=Gr(D.nextSibling),xn=l,ct=!0,na=null,Hr=!1,a!==null&&uC(l,a),l=py(l,m.children),l.flags|=4096);return l}return x?(ua(),D=m.fallback,x=l.mode,J=a.child,ie=J.sibling,m=ls(J,{mode:"hidden",children:m.children}),m.subtreeFlags=J.subtreeFlags&65011712,ie!==null?D=ls(ie,D):(D=fo(D,x,f,null),D.flags|=2),D.return=l,m.return=l,m.sibling=D,l.child=m,Rc(null,m),m=l.child,D=a.child.memoizedState,D===null?D=fy(f):(x=D.cachePool,x!==null?(J=Xt._currentValue,x=x.parent!==J?{parent:J,pool:J}:x):x=mC(),D={baseLanes:D.baseLanes|f,cachePool:x}),m.memoizedState=D,m.childLanes=hy(a,A,f),l.memoizedState=cy,Rc(a.child,m)):(la(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 py(a,l){return l=nd({mode:"visible",children:l},a.mode),l.return=a,a.child=l}function nd(a,l){return a=Er(22,a,null,l),a.lanes=0,a}function dy(a,l,f){return bo(l,a.child,null,f),a=py(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function Tw(a,l,f){a.lanes|=l;var m=a.alternate;m!==null&&(m.lanes|=l),M0(a.return,l,f)}function my(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 Mw(a,l,f){var m=l.pendingProps,x=m.revealOrder,v=m.tail;m=m.children;var A=qt.current,D=(A&2)!==0;if(D?(A=A&1|2,l.flags|=128):A&=1,L(qt,A),Sn(a,l,m,f),m=ct?xc:0,!D&&a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Tw(a,f,l);else if(a.tag===19)Tw(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&&Jp(a)===null&&(x=f),f=f.sibling;f=x,f===null?(x=l.child,l.child=null):(x=f.sibling,f.sibling=null),my(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&&Jp(a)===null){l.child=x;break}a=x.sibling,x.sibling=f,f=x,x=a}my(l,!0,f,null,v,m);break;case"together":my(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),ha|=l.lanes,(f&l.childLanes)===0)if(a!==null){if(Pl(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 gy(a,l){return(a.lanes&l)!==0?!0:(a=a.dependencies,!!(a!==null&&zp(a)))}function u4(a,l,f){switch(l.tag){case 3:pt(l,l.stateNode.containerInfo),ia(l,Xt,a.memoizedState.cache),ho();break;case 27:case 5:Ft(l);break;case 4:pt(l,l.stateNode.containerInfo);break;case 10:ia(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,j0(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(la(l),l.flags|=128,null):(f&l.child.childLanes)!==0?Nw(a,l,f):(la(l),a=ds(a,l,f),a!==null?a.sibling:null);la(l);break;case 19:var x=(a.flags&128)!==0;if(m=(f&l.childLanes)!==0,m||(Pl(a,l,f,!1),m=(f&l.childLanes)!==0),x){if(m)return Mw(a,l,f);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),L(qt,qt.current),m)break;return null;case 22:return l.lanes=0,vw(a,l,f,l.pendingProps);case 24:ia(l,Xt,a.memoizedState.cache)}return ds(a,l,f)}function Ow(a,l,f){if(a!==null)if(a.memoizedProps!==l.pendingProps)Zt=!0;else{if(!gy(a,f)&&(l.flags&128)===0)return Zt=!1,u4(a,l,f);Zt=(a.flags&131072)!==0}else Zt=!1,ct&&(l.flags&1048576)!==0&&lC(l,xc,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")v0(a)?(m=vo(a,m),l.tag=1,l=Ew(null,l,a,m,f)):(l.tag=0,l=uy(null,l,a,m,f));else{if(a!=null){var x=a.$$typeof;if(x===H){l.tag=11,l=xw(null,l,a,m,f);break e}else if(x===_){l.tag=14,l=bw(null,l,a,m,f);break e}}throw l=Ee(a)||a,Error(r(306,l,""))}}return l;case 0:return uy(a,l,l.type,l.pendingProps,f);case 1:return m=l.type,x=vo(m,l.pendingProps),Ew(a,l,m,x,f);case 3:e:{if(pt(l,l.stateNode.containerInfo),a===null)throw Error(r(387));m=l.pendingProps;var v=l.memoizedState;x=v.element,z0(a,l),Ac(l,m,null,f);var A=l.memoizedState;if(m=A.cache,ia(l,Xt,m),m!==v.cache&&O0(l,[Xt],f,!0),Ec(),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=Aw(a,l,m,f);break e}else if(m!==x){x=Ur(Error(r(424)),l),bc(x),l=Aw(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,_t=Gr(a.firstChild),xn=l,ct=!0,na=null,Hr=!0,f=vC(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}Sn(a,l,m,f)}l=l.child}return l;case 26:return td(a,l),a===null?(f=j2(l.type,null,l.pendingProps,null))?l.memoizedState=f:ct||(f=l.type,a=l.pendingProps,m=xd(Ae.current).createElement(f),m[Yt]=l,m[yn]=a,vn(m,f,a),Wt(m),l.stateNode=m):l.memoizedState=j2(l.type,a.memoizedProps,l.pendingProps,a.memoizedState),null;case 27:return Ft(l),a===null&&ct&&(m=l.stateNode=V2(l.type,l.pendingProps,Ae.current),xn=l,Hr=!0,x=_t,ya(l.type)?(Yy=x,_t=Gr(m.firstChild)):_t=x),Sn(a,l,l.pendingProps.children,f),td(a,l),a===null&&(l.flags|=4194304),l.child;case 5:return a===null&&ct&&((x=m=_t)&&(m=F4(m,l.type,l.pendingProps,Hr),m!==null?(l.stateNode=m,xn=l,_t=Gr(m.firstChild),Hr=!1,x=!0):x=!1),x||ra(l)),Ft(l),x=l.type,v=l.pendingProps,A=a!==null?a.memoizedProps:null,m=v.children,Jy(x,v)?m=null:A!==null&&Jy(x,A)&&(l.flags|=32),l.memoizedState!==null&&(x=U0(a,l,e4,null,null,f),Hc._currentValue=x),td(a,l),Sn(a,l,m,f),l.child;case 6:return a===null&&ct&&((a=f=_t)&&(f=P4(f,l.pendingProps,Hr),f!==null?(l.stateNode=f,xn=l,_t=null,a=!0):a=!1),a||ra(l)),null;case 13:return Nw(a,l,f);case 4:return pt(l,l.stateNode.containerInfo),m=l.pendingProps,a===null?l.child=bo(l,null,m,f):Sn(a,l,m,f),l.child;case 11:return xw(a,l,l.type,l.pendingProps,f);case 7:return Sn(a,l,l.pendingProps,f),l.child;case 8:return Sn(a,l,l.pendingProps.children,f),l.child;case 12:return Sn(a,l,l.pendingProps.children,f),l.child;case 10:return m=l.pendingProps,ia(l,l.type,m.value),Sn(a,l,m.children,f),l.child;case 9:return x=l.type._context,m=l.pendingProps.children,mo(l),x=bn(x),m=m(x),l.flags|=1,Sn(a,l,m,f),l.child;case 14:return bw(a,l,l.type,l.pendingProps,f);case 15:return Sw(a,l,l.type,l.pendingProps,f);case 19:return Mw(a,l,f);case 31:return l4(a,l,f);case 22:return vw(a,l,f,l.pendingProps);case 24:return mo(l),m=bn(Xt),a===null?(x=I0(),x===null&&(x=Rt,v=R0(),x.pooledCache=v,v.refCount++,v!==null&&(x.pooledCacheLanes|=f),x=v),l.memoizedState={parent:m,cache:x},L0(l),ia(l,Xt,x)):((a.lanes&f)!==0&&(z0(a,l),Ac(l,null,null,f),Ec()),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),ia(l,Xt,m)):(m=v.cache,ia(l,Xt,m),m!==x.cache&&O0(l,[Xt],f,!0))),Sn(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 yy(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(r2())a.flags|=8192;else throw xo=Pp,_0}else a.flags&=-16777217}function Rw(a,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!H2(l))if(r2())a.flags|=8192;else throw xo=Pp,_0}function rd(a,l){l!==null&&(a.flags|=4),a.flags&16384&&(l=a.tag!==22?nc():536870912,a.lanes|=l,Ql|=l)}function Dc(a,l){if(!ct)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 Lt(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 c4(a,l,f){var m=l.pendingProps;switch(E0(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(l),null;case 1:return Lt(l),null;case 3:return f=l.stateNode,m=null,a!==null&&(m=a.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),fs(Xt),Ke(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(a===null||a.child===null)&&(Fl(l)?ms(l):a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,N0())),Lt(l),null;case 26:var x=l.type,v=l.memoizedState;return a===null?(ms(l),v!==null?(Lt(l),Rw(l,v)):(Lt(l),yy(l,x,null,m,f))):v?v!==a.memoizedState?(ms(l),Lt(l),Rw(l,v)):(Lt(l),l.flags&=-16777217):(a=a.memoizedProps,a!==m&&ms(l),Lt(l),yy(l,x,a,m,f)),null;case 27:if(Ot(l),f=Ae.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 Lt(l),null}a=xe.current,Fl(l)?cC(l):(a=V2(x,m,f),l.stateNode=a,ms(l))}return Lt(l),null;case 5:if(Ot(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 Lt(l),null}if(v=xe.current,Fl(l))cC(l);else{var A=xd(Ae.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[Yt]=l,v[yn]=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(vn(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 Lt(l),yy(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=Ae.current,Fl(l)){if(a=l.stateNode,f=l.memoizedProps,m=null,x=xn,x!==null)switch(x.tag){case 27:case 5:m=x.memoizedProps}a[Yt]=l,a=!!(a.nodeValue===f||m!==null&&m.suppressHydrationWarning===!0||N2(a.nodeValue,f)),a||ra(l,!0)}else a=xd(a).createTextNode(m),a[Yt]=l,l.stateNode=a}return Lt(l),null;case 31:if(f=l.memoizedState,a===null||a.memoizedState!==null){if(m=Fl(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[Yt]=l}else ho(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Lt(l),a=!1}else f=N0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=f),a=!0;if(!a)return l.flags&256?(Nr(l),l):(Nr(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Lt(l),null;case 13:if(m=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(x=Fl(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[Yt]=l}else ho(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Lt(l),x=!1}else x=N0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=x),x=!0;if(!x)return l.flags&256?(Nr(l),l):(Nr(l),null)}return Nr(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),rd(l,l.updateQueue),Lt(l),null);case 4:return Ke(),a===null&&Fy(l.stateNode.containerInfo),Lt(l),null;case 10:return fs(l.type),Lt(l),null;case 19:if(te(qt),m=l.memoizedState,m===null)return Lt(l),null;if(x=(l.flags&128)!==0,v=m.rendering,v===null)if(x)Dc(m,!1);else{if($t!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(v=Jp(a),v!==null){for(l.flags|=128,Dc(m,!1),a=v.updateQueue,l.updateQueue=a,rd(l,a),l.subtreeFlags=0,a=f,f=l.child;f!==null;)sC(f,a),f=f.sibling;return L(qt,qt.current&1|2),ct&&us(l,m.treeForkCount),l.child}a=a.sibling}m.tail!==null&&Be()>ld&&(l.flags|=128,x=!0,Dc(m,!1),l.lanes=4194304)}else{if(!x)if(a=Jp(v),a!==null){if(l.flags|=128,x=!0,a=a.updateQueue,l.updateQueue=a,rd(l,a),Dc(m,!0),m.tail===null&&m.tailMode==="hidden"&&!v.alternate&&!ct)return Lt(l),null}else 2*Be()-m.renderingStartTime>ld&&f!==536870912&&(l.flags|=128,x=!0,Dc(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=Be(),a.sibling=null,f=qt.current,L(qt,x?f&1|2:f&1),ct&&us(l,m.treeForkCount),a):(Lt(l),null);case 22:case 23:return Nr(l),P0(),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&&(Lt(l),l.subtreeFlags&6&&(l.flags|=8192)):Lt(l),f=l.updateQueue,f!==null&&rd(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&&te(go),null;case 24:return f=null,a!==null&&(f=a.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),fs(Xt),Lt(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function f4(a,l){switch(E0(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return fs(Xt),Ke(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 26:case 27:case 5:return Ot(l),null;case 31:if(l.memoizedState!==null){if(Nr(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(Nr(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 te(qt),null;case 4:return Ke(),null;case 10:return fs(l.type),null;case 22:case 23:return Nr(l),P0(),a!==null&&te(go),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return fs(Xt),null;case 25:return null;default:return null}}function Dw(a,l){switch(E0(l),l.tag){case 3:fs(Xt),Ke();break;case 26:case 27:case 5:Ot(l);break;case 4:Ke();break;case 31:l.memoizedState!==null&&Nr(l);break;case 13:Nr(l);break;case 19:te(qt);break;case 10:fs(l.type);break;case 22:case 23:Nr(l),P0(),a!==null&&te(go);break;case 24:fs(Xt)}}function Ic(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(D){At(l,l.return,D)}}function ca(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,D=A.destroy;if(D!==void 0){A.destroy=void 0,x=l;var J=f,ie=D;try{ie()}catch(ce){At(x,J,ce)}}}m=m.next}while(m!==v)}}catch(ce){At(l,l.return,ce)}}function Iw(a){var l=a.updateQueue;if(l!==null){var f=a.stateNode;try{CC(l,f)}catch(m){At(a,a.return,m)}}}function _w(a,l,f){f.props=vo(a.type,a.memoizedProps),f.state=a.memoizedState;try{f.componentWillUnmount()}catch(m){At(a,l,m)}}function _c(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){At(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){At(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){At(a,l,x)}else f.current=null}function Lw(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){At(a,a.return,x)}}function xy(a,l,f){try{var m=a.stateNode;I4(m,a.type,f,l),m[yn]=l}catch(x){At(a,a.return,x)}}function zw(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&ya(a.type)||a.tag===4}function by(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||zw(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&&ya(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 Sy(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=Fr));else if(m!==4&&(m===27&&ya(a.type)&&(f=a.stateNode,l=null),a=a.child,a!==null))for(Sy(a,l,f),a=a.sibling;a!==null;)Sy(a,l,f),a=a.sibling}function id(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&&ya(a.type)&&(f=a.stateNode),a=a.child,a!==null))for(id(a,l,f),a=a.sibling;a!==null;)id(a,l,f),a=a.sibling}function Bw(a){var l=a.stateNode,f=a.memoizedProps;try{for(var m=a.type,x=l.attributes;x.length;)l.removeAttributeNode(x[0]);vn(l,m,f),l[Yt]=a,l[yn]=f}catch(v){At(a,a.return,v)}}var gs=!1,en=!1,vy=!1,Vw=typeof WeakSet=="function"?WeakSet:Set,ln=null;function h4(a,l){if(a=a.containerInfo,$y=Ed,a=Wk(a),d0(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,D=-1,J=-1,ie=0,ce=0,me=a,se=null;t:for(;;){for(var oe;me!==f||x!==0&&me.nodeType!==3||(D=A+x),me!==v||m!==0&&me.nodeType!==3||(J=A+m),me.nodeType===3&&(A+=me.nodeValue.length),(oe=me.firstChild)!==null;)se=me,me=oe;for(;;){if(me===a)break t;if(se===f&&++ie===x&&(D=A),se===v&&++ce===m&&(J=A),(oe=me.nextSibling)!==null)break;me=se,se=me.parentNode}me=oe}f=D===-1||J===-1?null:{start:D,end:J}}else f=null}f=f||{start:0,end:0}}else f=null;for(Uy={focusedElem:a,selectionRange:f},Ed=!1,ln=l;ln!==null;)if(l=ln,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,ln=a;else for(;ln!==null;){switch(l=ln,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 Me=vo(f.type,x);a=m.getSnapshotBeforeUpdate(Me,v),m.__reactInternalSnapshotBeforeUpdate=a}catch(Fe){At(f,f.return,Fe)}}break;case 3:if((a&1024)!==0){if(a=l.stateNode.containerInfo,f=a.nodeType,f===9)Hy(a);else if(f===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Hy(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,ln=a;break}ln=l.return}}function Fw(a,l,f){var m=f.flags;switch(f.tag){case 0:case 11:case 15:xs(a,f),m&4&&Ic(5,f);break;case 1:if(xs(a,f),m&4)if(a=f.stateNode,l===null)try{a.componentDidMount()}catch(A){At(f,f.return,A)}else{var x=vo(f.type,l.memoizedProps);l=l.memoizedState;try{a.componentDidUpdate(x,l,a.__reactInternalSnapshotBeforeUpdate)}catch(A){At(f,f.return,A)}}m&64&&Iw(f),m&512&&_c(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{CC(a,l)}catch(A){At(f,f.return,A)}}break;case 27:l===null&&m&4&&Bw(f);case 26:case 5:xs(a,f),l===null&&m&4&&Lw(f),m&512&&_c(f,f.return);break;case 12:xs(a,f);break;case 31:xs(a,f),m&4&&$w(a,f);break;case 13:xs(a,f),m&4&&Uw(a,f),m&64&&(a=f.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(f=v4.bind(null,f),j4(a,f))));break;case 22:if(m=f.memoizedState!==null||gs,!m){l=l!==null&&l.memoizedState!==null||en,x=gs;var v=en;gs=m,(en=l)&&!v?bs(a,f,(f.subtreeFlags&8772)!==0):xs(a,f),gs=x,en=v}break;case 30:break;default:xs(a,f)}}function Pw(a){var l=a.alternate;l!==null&&(a.alternate=null,Pw(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&Nl(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 Bt=null,hr=!1;function ys(a,l,f){for(f=f.child;f!==null;)jw(a,l,f),f=f.sibling}function jw(a,l,f){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(ke,f)}catch{}switch(f.tag){case 26:en||zi(f,l),ys(a,l,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:en||zi(f,l);var m=Bt,x=hr;ya(f.type)&&(Bt=f.stateNode,hr=!1),ys(a,l,f),Uc(f.stateNode),Bt=m,hr=x;break;case 5:en||zi(f,l);case 6:if(m=Bt,x=hr,Bt=null,ys(a,l,f),Bt=m,hr=x,Bt!==null)if(hr)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(f.stateNode)}catch(v){At(f,l,v)}else try{Bt.removeChild(f.stateNode)}catch(v){At(f,l,v)}break;case 18:Bt!==null&&(hr?(a=Bt,I2(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,f.stateNode),au(a)):I2(Bt,f.stateNode));break;case 4:m=Bt,x=hr,Bt=f.stateNode.containerInfo,hr=!0,ys(a,l,f),Bt=m,hr=x;break;case 0:case 11:case 14:case 15:ca(2,f,l),en||ca(4,f,l),ys(a,l,f);break;case 1:en||(zi(f,l),m=f.stateNode,typeof m.componentWillUnmount=="function"&&_w(f,l,m)),ys(a,l,f);break;case 21:ys(a,l,f);break;case 22:en=(m=en)||f.memoizedState!==null,ys(a,l,f),en=m;break;default:ys(a,l,f)}}function $w(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{au(a)}catch(f){At(l,l.return,f)}}}function Uw(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{au(a)}catch(f){At(l,l.return,f)}}function p4(a){switch(a.tag){case 31:case 13:case 19:var l=a.stateNode;return l===null&&(l=a.stateNode=new Vw),l;case 22:return a=a.stateNode,l=a._retryCache,l===null&&(l=a._retryCache=new Vw),l;default:throw Error(r(435,a.tag))}}function sd(a,l){var f=p4(a);l.forEach(function(m){if(!f.has(m)){f.add(m);var x=k4.bind(null,a,m);m.then(x,x)}})}function pr(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,D=A;e:for(;D!==null;){switch(D.tag){case 27:if(ya(D.type)){Bt=D.stateNode,hr=!1;break e}break;case 5:Bt=D.stateNode,hr=!1;break e;case 3:case 4:Bt=D.stateNode.containerInfo,hr=!0;break e}D=D.return}if(Bt===null)throw Error(r(160));jw(v,A,x),Bt=null,hr=!1,v=x.alternate,v!==null&&(v.return=null),x.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Jw(l,a),l=l.sibling}var ki=null;function Jw(a,l){var f=a.alternate,m=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:pr(l,a),dr(a),m&4&&(ca(3,a,a.return),Ic(3,a),ca(5,a,a.return));break;case 1:pr(l,a),dr(a),m&512&&(en||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=ki;if(pr(l,a),dr(a),m&512&&(en||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[Gs]||v[Yt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=x.createElement(m),x.head.insertBefore(v,x.querySelector("head > title"))),vn(v,m,f),v[Yt]=a,Wt(v),m=v;break e;case"link":var A=J2("link","href",x).get(m+(f.href||""));if(A){for(var D=0;D<A.length;D++)if(v=A[D],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(D,1);break t}}v=x.createElement(m),vn(v,m,f),x.head.appendChild(v);break;case"meta":if(A=J2("meta","content",x).get(m+(f.content||""))){for(D=0;D<A.length;D++)if(v=A[D],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(D,1);break t}}v=x.createElement(m),vn(v,m,f),x.head.appendChild(v);break;default:throw Error(r(468,m))}v[Yt]=a,Wt(v),m=v}a.stateNode=m}else q2(x,a.type,a.stateNode);else a.stateNode=U2(x,m,a.memoizedProps);else v!==m?(v===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):v.count--,m===null?q2(x,a.type,a.stateNode):U2(x,m,a.memoizedProps)):m===null&&a.stateNode!==null&&xy(a,a.memoizedProps,f.memoizedProps)}break;case 27:pr(l,a),dr(a),m&512&&(en||f===null||zi(f,f.return)),f!==null&&m&4&&xy(a,a.memoizedProps,f.memoizedProps);break;case 5:if(pr(l,a),dr(a),m&512&&(en||f===null||zi(f,f.return)),a.flags&32){x=a.stateNode;try{bi(x,"")}catch(Me){At(a,a.return,Me)}}m&4&&a.stateNode!=null&&(x=a.memoizedProps,xy(a,x,f!==null?f.memoizedProps:x)),m&1024&&(vy=!0);break;case 6:if(pr(l,a),dr(a),m&4){if(a.stateNode===null)throw Error(r(162));m=a.memoizedProps,f=a.stateNode;try{f.nodeValue=m}catch(Me){At(a,a.return,Me)}}break;case 3:if(vd=null,x=ki,ki=bd(l.containerInfo),pr(l,a),ki=x,dr(a),m&4&&f!==null&&f.memoizedState.isDehydrated)try{au(l.containerInfo)}catch(Me){At(a,a.return,Me)}vy&&(vy=!1,qw(a));break;case 4:m=ki,ki=bd(a.stateNode.containerInfo),pr(l,a),dr(a),ki=m;break;case 12:pr(l,a),dr(a);break;case 31:pr(l,a),dr(a),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,sd(a,m)));break;case 13:pr(l,a),dr(a),a.child.flags&8192&&a.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(od=Be()),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,sd(a,m)));break;case 22:x=a.memoizedState!==null;var J=f!==null&&f.memoizedState!==null,ie=gs,ce=en;if(gs=ie||x,en=ce||J,pr(l,a),en=ce,gs=ie,dr(a),m&8192)e:for(l=a.stateNode,l._visibility=x?l._visibility&-2:l._visibility|1,x&&(f===null||J||gs||en||ko(a)),f=null,l=a;;){if(l.tag===5||l.tag===26){if(f===null){J=f=l;try{if(v=J.stateNode,x)A=v.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{D=J.stateNode;var me=J.memoizedProps.style,se=me!=null&&me.hasOwnProperty("display")?me.display:null;D.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Me){At(J,J.return,Me)}}}else if(l.tag===6){if(f===null){J=l;try{J.stateNode.nodeValue=x?"":J.memoizedProps}catch(Me){At(J,J.return,Me)}}}else if(l.tag===18){if(f===null){J=l;try{var oe=J.stateNode;x?_2(oe,!0):_2(J.stateNode,!1)}catch(Me){At(J,J.return,Me)}}}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,sd(a,f))));break;case 19:pr(l,a),dr(a),m&4&&(m=a.updateQueue,m!==null&&(a.updateQueue=null,sd(a,m)));break;case 30:break;case 21:break;default:pr(l,a),dr(a)}}function dr(a){var l=a.flags;if(l&2){try{for(var f,m=a.return;m!==null;){if(zw(m)){f=m;break}m=m.return}if(f==null)throw Error(r(160));switch(f.tag){case 27:var x=f.stateNode,v=by(a);id(a,v,x);break;case 5:var A=f.stateNode;f.flags&32&&(bi(A,""),f.flags&=-33);var D=by(a);id(a,D,A);break;case 3:case 4:var J=f.stateNode.containerInfo,ie=by(a);Sy(a,ie,J);break;default:throw Error(r(161))}}catch(ce){At(a,a.return,ce)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function qw(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var l=a;qw(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;)Fw(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:ca(4,l,l.return),ko(l);break;case 1:zi(l,l.return);var f=l.stateNode;typeof f.componentWillUnmount=="function"&&_w(l,l.return,f),ko(l);break;case 27:Uc(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),Ic(4,v);break;case 1:if(bs(x,v,f),m=v,x=m.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ie){At(m,m.return,ie)}if(m=v,x=m.updateQueue,x!==null){var D=m.stateNode;try{var J=x.shared.hiddenCallbacks;if(J!==null)for(x.shared.hiddenCallbacks=null,x=0;x<J.length;x++)kC(J[x],D)}catch(ie){At(m,m.return,ie)}}f&&A&64&&Iw(v),_c(v,v.return);break;case 27:Bw(v);case 26:case 5:bs(x,v,f),f&&m===null&&A&4&&Lw(v),_c(v,v.return);break;case 12:bs(x,v,f);break;case 31:bs(x,v,f),f&&A&4&&$w(x,v);break;case 13:bs(x,v,f),f&&A&4&&Uw(x,v);break;case 22:v.memoizedState===null&&bs(x,v,f),_c(v,v.return);break;case 30:break;default:bs(x,v,f)}l=l.sibling}}function ky(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&&Sc(f))}function Cy(a,l){a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&Sc(a))}function Ci(a,l,f,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Hw(a,l,f,m),l=l.sibling}function Hw(a,l,f,m){var x=l.flags;switch(l.tag){case 0:case 11:case 15:Ci(a,l,f,m),x&2048&&Ic(9,l);break;case 1:Ci(a,l,f,m);break;case 3:Ci(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&&Sc(a)));break;case 12:if(x&2048){Ci(a,l,f,m),a=l.stateNode;try{var v=l.memoizedProps,A=v.id,D=v.onPostCommit;typeof D=="function"&&D(A,l.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(J){At(l,l.return,J)}}else Ci(a,l,f,m);break;case 31:Ci(a,l,f,m);break;case 13:Ci(a,l,f,m);break;case 23:break;case 22:v=l.stateNode,A=l.alternate,l.memoizedState!==null?v._visibility&2?Ci(a,l,f,m):Lc(a,l):v._visibility&2?Ci(a,l,f,m):(v._visibility|=2,Yl(a,l,f,m,(l.subtreeFlags&10256)!==0||!1)),x&2048&&ky(A,l);break;case 24:Ci(a,l,f,m),x&2048&&Cy(l.alternate,l);break;default:Ci(a,l,f,m)}}function Yl(a,l,f,m,x){for(x=x&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var v=a,A=l,D=f,J=m,ie=A.flags;switch(A.tag){case 0:case 11:case 15:Yl(v,A,D,J,x),Ic(8,A);break;case 23:break;case 22:var ce=A.stateNode;A.memoizedState!==null?ce._visibility&2?Yl(v,A,D,J,x):Lc(v,A):(ce._visibility|=2,Yl(v,A,D,J,x)),x&&ie&2048&&ky(A.alternate,A);break;case 24:Yl(v,A,D,J,x),x&&ie&2048&&Cy(A.alternate,A);break;default:Yl(v,A,D,J,x)}l=l.sibling}}function Lc(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:Lc(f,m),x&2048&&ky(m.alternate,m);break;case 24:Lc(f,m),x&2048&&Cy(m.alternate,m);break;default:Lc(f,m)}l=l.sibling}}var zc=8192;function Wl(a,l,f){if(a.subtreeFlags&zc)for(a=a.child;a!==null;)Kw(a,l,f),a=a.sibling}function Kw(a,l,f){switch(a.tag){case 26:Wl(a,l,f),a.flags&zc&&a.memoizedState!==null&&Z4(f,ki,a.memoizedState,a.memoizedProps);break;case 5:Wl(a,l,f);break;case 3:case 4:var m=ki;ki=bd(a.stateNode.containerInfo),Wl(a,l,f),ki=m;break;case 22:a.memoizedState===null&&(m=a.alternate,m!==null&&m.memoizedState!==null?(m=zc,zc=16777216,Wl(a,l,f),zc=m):Wl(a,l,f));break;default:Wl(a,l,f)}}function Gw(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 Bc(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];ln=m,Ww(m,a)}Gw(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Yw(a),a=a.sibling}function Yw(a){switch(a.tag){case 0:case 11:case 15:Bc(a),a.flags&2048&&ca(9,a,a.return);break;case 3:Bc(a);break;case 12:Bc(a);break;case 22:var l=a.stateNode;a.memoizedState!==null&&l._visibility&2&&(a.return===null||a.return.tag!==13)?(l._visibility&=-3,ad(a)):Bc(a);break;default:Bc(a)}}function ad(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];ln=m,Ww(m,a)}Gw(a)}for(a=a.child;a!==null;){switch(l=a,l.tag){case 0:case 11:case 15:ca(8,l,l.return),ad(l);break;case 22:f=l.stateNode,f._visibility&2&&(f._visibility&=-3,ad(l));break;default:ad(l)}a=a.sibling}}function Ww(a,l){for(;ln!==null;){var f=ln;switch(f.tag){case 0:case 11:case 15:ca(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:Sc(f.memoizedState.cache)}if(m=f.child,m!==null)m.return=f,ln=m;else e:for(f=a;ln!==null;){m=ln;var x=m.sibling,v=m.return;if(Pw(m),m===f){ln=null;break e}if(x!==null){x.return=v,ln=x;break e}ln=v}}}var d4={getCacheForType:function(a){var l=bn(Xt),f=l.data.get(a);return f===void 0&&(f=a(),l.data.set(a,f)),f},cacheSignal:function(){return bn(Xt).controller.signal}},m4=typeof WeakMap=="function"?WeakMap:Map,xt=0,Rt=null,it=null,at=0,Et=0,Tr=null,fa=!1,Xl=!1,wy=!1,Ss=0,$t=0,ha=0,Co=0,Ey=0,Mr=0,Ql=0,Vc=null,mr=null,Ay=!1,od=0,Xw=0,ld=1/0,ud=null,pa=null,nn=0,da=null,Zl=null,vs=0,Ny=0,Ty=null,Qw=null,Fc=0,My=null;function Or(){return(xt&2)!==0&&at!==0?at&-at:X.T!==null?Ly():xp()}function Zw(){if(Mr===0)if((at&536870912)===0||ct){var a=es;es<<=1,(es&3932160)===0&&(es=262144),Mr=a}else Mr=536870912;return a=Ar.current,a!==null&&(a.flags|=32),Mr}function gr(a,l,f){(a===Rt&&(Et===2||Et===9)||a.cancelPendingCommit!==null)&&(eu(a,0),ma(a,at,Mr,!1)),so(a,f),((xt&2)===0||a!==Rt)&&(a===Rt&&((xt&2)===0&&(Co|=f),$t===4&&ma(a,at,Mr,!1)),Bi(a))}function e2(a,l,f){if((xt&6)!==0)throw Error(r(327));var m=!f&&(l&127)===0&&(l&a.expiredLanes)===0||Vr(a,l),x=m?x4(a,l):Ry(a,l,!0),v=m;do{if(x===0){Xl&&!m&&ma(a,l,0,!1);break}else{if(f=a.current.alternate,v&&!g4(f)){x=Ry(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 D=a;x=Vc;var J=D.current.memoizedState.isDehydrated;if(J&&(eu(D,A).flags|=256),A=Ry(D,A,!1),A!==2){if(wy&&!J){D.errorRecoveryDisabledLanes|=v,Co|=v,x=4;break e}v=mr,mr=x,v!==null&&(mr===null?mr=v:mr.push.apply(mr,v))}x=A}if(v=!1,x!==2)continue}}if(x===1){eu(a,0),ma(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:ma(m,l,Mr,!fa);break e;case 2:mr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(x=od+300-Be(),10<x)){if(ma(m,l,Mr,!fa),St(m,0,!0)!==0)break e;vs=l,m.timeoutHandle=R2(t2.bind(null,m,f,mr,ud,Ay,l,Mr,Co,Ql,fa,v,"Throttled",-0,0),x);break e}t2(m,f,mr,ud,Ay,l,Mr,Co,Ql,fa,v,null,-0,0)}}break}while(!0);Bi(a)}function t2(a,l,f,m,x,v,A,D,J,ie,ce,me,se,oe){if(a.timeoutHandle=-1,me=l.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fr},Kw(l,v,me);var Me=(v&62914560)===v?od-Be():(v&4194048)===v?Xw-Be():0;if(Me=eL(me,Me),Me!==null){vs=v,a.cancelPendingCommit=Me(u2.bind(null,a,l,v,f,m,x,A,D,J,ce,me,null,se,oe)),ma(a,v,A,!ie);return}}u2(a,l,v,f,m,x,A,D,J)}function g4(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(!wr(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 ma(a,l,f,m){l&=~Ey,l&=~Co,a.suspendedLanes|=l,a.pingedLanes&=~l,m&&(a.warmLanes|=l),m=a.expirationTimes;for(var x=l;0<x;){var v=31-wt(x),A=1<<v;m[v]=-1,x&=~A}f!==0&&mi(a,f,l)}function cd(){return(xt&6)===0?(Pc(0),!1):!0}function Oy(){if(it!==null){if(Et===0)var a=it.return;else a=it,cs=po=null,H0(a),Jl=null,kc=0,a=it;for(;a!==null;)Dw(a.alternate,a),a=a.return;it=null}}function eu(a,l){var f=a.timeoutHandle;f!==-1&&(a.timeoutHandle=-1,z4(f)),f=a.cancelPendingCommit,f!==null&&(a.cancelPendingCommit=null,f()),vs=0,Oy(),Rt=a,it=f=ls(a.current,null),at=l,Et=0,Tr=null,fa=!1,Xl=Vr(a,l),wy=!1,Ql=Mr=Ey=Co=ha=$t=0,mr=Vc=null,Ay=!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-wt(m),v=1<<x;l|=a[x],m&=~v}return Ss=l,Rp(),f}function n2(a,l){Ze=null,X.H=Oc,l===Ul||l===Fp?(l=xC(),Et=3):l===_0?(l=xC(),Et=4):Et=l===ly?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Tr=l,it===null&&($t=1,Zp(a,Ur(l,a.current)))}function r2(){var a=Ar.current;return a===null?!0:(at&4194048)===at?Kr===null:(at&62914560)===at||(at&536870912)!==0?a===Kr:!1}function i2(){var a=X.H;return X.H=Oc,a===null?Oc:a}function s2(){var a=X.A;return X.A=d4,a}function fd(){$t=4,fa||(at&4194048)!==at&&Ar.current!==null||(Xl=!0),(ha&134217727)===0&&(Co&134217727)===0||Rt===null||ma(Rt,at,Mr,!1)}function Ry(a,l,f){var m=xt;xt|=2;var x=i2(),v=s2();(Rt!==a||at!==l)&&(ud=null,eu(a,l)),l=!1;var A=$t;e:do try{if(Et!==0&&it!==null){var D=it,J=Tr;switch(Et){case 8:Oy(),A=6;break e;case 3:case 2:case 9:case 6:Ar.current===null&&(l=!0);var ie=Et;if(Et=0,Tr=null,tu(a,D,J,ie),f&&Xl){A=0;break e}break;default:ie=Et,Et=0,Tr=null,tu(a,D,J,ie)}}y4(),A=$t;break}catch(ce){n2(a,ce)}while(!0);return l&&a.shellSuspendCounter++,cs=po=null,xt=m,X.H=x,X.A=v,it===null&&(Rt=null,at=0,Rp()),A}function y4(){for(;it!==null;)a2(it)}function x4(a,l){var f=xt;xt|=2;var m=i2(),x=s2();Rt!==a||at!==l?(ud=null,ld=Be()+500,eu(a,l)):Xl=Vr(a,l);e:do try{if(Et!==0&&it!==null){l=it;var v=Tr;t:switch(Et){case 1:Et=0,Tr=null,tu(a,l,v,1);break;case 2:case 9:if(gC(v)){Et=0,Tr=null,o2(l);break}l=function(){Et!==2&&Et!==9||Rt!==a||(Et=7),Bi(a)},v.then(l,l);break e;case 3:Et=7;break e;case 4:Et=5;break e;case 7:gC(v)?(Et=0,Tr=null,o2(l)):(Et=0,Tr=null,tu(a,l,v,7));break;case 5:var A=null;switch(it.tag){case 26:A=it.memoizedState;case 5:case 27:var D=it;if(A?H2(A):D.stateNode.complete){Et=0,Tr=null;var J=D.sibling;if(J!==null)it=J;else{var ie=D.return;ie!==null?(it=ie,hd(ie)):it=null}break t}}Et=0,Tr=null,tu(a,l,v,5);break;case 6:Et=0,Tr=null,tu(a,l,v,6);break;case 8:Oy(),$t=6;break e;default:throw Error(r(462))}}b4();break}catch(ce){n2(a,ce)}while(!0);return cs=po=null,X.H=m,X.A=x,xt=f,it!==null?0:(Rt=null,at=0,Rp(),$t)}function b4(){for(;it!==null&&!Dt();)a2(it)}function a2(a){var l=Ow(a.alternate,a,Ss);a.memoizedProps=a.pendingProps,l===null?hd(a):it=l}function o2(a){var l=a,f=l.alternate;switch(l.tag){case 15:case 0:l=ww(f,l,l.pendingProps,l.type,void 0,at);break;case 11:l=ww(f,l,l.pendingProps,l.type.render,l.ref,at);break;case 5:H0(l);default:Dw(f,l),l=it=sC(l,Ss),l=Ow(f,l,Ss)}a.memoizedProps=a.pendingProps,l===null?hd(a):it=l}function tu(a,l,f,m){cs=po=null,H0(l),Jl=null,kc=0;var x=l.return;try{if(o4(a,x,l,f,at)){$t=1,Zp(a,Ur(f,a.current)),it=null;return}}catch(v){if(x!==null)throw it=x,v;$t=1,Zp(a,Ur(f,a.current)),it=null;return}l.flags&32768?(ct||m===1?a=!0:Xl||(at&536870912)!==0?a=!1:(fa=a=!0,(m===2||m===9||m===3||m===6)&&(m=Ar.current,m!==null&&m.tag===13&&(m.flags|=16384))),l2(l,a)):hd(l)}function hd(a){var l=a;do{if((l.flags&32768)!==0){l2(l,fa);return}a=l.return;var f=c4(l.alternate,l,Ss);if(f!==null){it=f;return}if(l=l.sibling,l!==null){it=l;return}it=l=a}while(l!==null);$t===0&&($t=5)}function l2(a,l){do{var f=f4(a.alternate,a);if(f!==null){f.flags&=32767,it=f;return}if(f=a.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!l&&(a=a.sibling,a!==null)){it=a;return}it=a=f}while(a!==null);$t=6,it=null}function u2(a,l,f,m,x,v,A,D,J){a.cancelPendingCommit=null;do pd();while(nn!==0);if((xt&6)!==0)throw Error(r(327));if(l!==null){if(l===a.current)throw Error(r(177));if(v=l.lanes|l.childLanes,v|=b0,El(a,f,v,A,D,J),a===Rt&&(it=Rt=null,at=0),Zl=l,da=a,vs=f,Ny=v,Ty=x,Qw=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,C4(I,function(){return d2(),null})):(a.callbackNode=null,a.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=X.T,X.T=null,x=le.p,le.p=2,A=xt,xt|=4;try{h4(a,l,f)}finally{xt=A,le.p=x,X.T=m}}nn=1,c2(),f2(),h2()}}function c2(){if(nn===1){nn=0;var a=da,l=Zl,f=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||f){f=X.T,X.T=null;var m=le.p;le.p=2;var x=xt;xt|=4;try{Jw(l,a);var v=Uy,A=Wk(a.containerInfo),D=v.focusedElem,J=v.selectionRange;if(A!==D&&D&&D.ownerDocument&&Yk(D.ownerDocument.documentElement,D)){if(J!==null&&d0(D)){var ie=J.start,ce=J.end;if(ce===void 0&&(ce=ie),"selectionStart"in D)D.selectionStart=ie,D.selectionEnd=Math.min(ce,D.value.length);else{var me=D.ownerDocument||document,se=me&&me.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Me=D.textContent.length,Fe=Math.min(J.start,Me),Mt=J.end===void 0?Fe:Math.min(J.end,Me);!oe.extend&&Fe>Mt&&(A=Mt,Mt=Fe,Fe=A);var Q=Gk(D,Fe),K=Gk(D,Mt);if(Q&&K&&(oe.rangeCount!==1||oe.anchorNode!==Q.node||oe.anchorOffset!==Q.offset||oe.focusNode!==K.node||oe.focusOffset!==K.offset)){var ne=me.createRange();ne.setStart(Q.node,Q.offset),oe.removeAllRanges(),Fe>Mt?(oe.addRange(ne),oe.extend(K.node,K.offset)):(ne.setEnd(K.node,K.offset),oe.addRange(ne))}}}}for(me=[],oe=D;oe=oe.parentNode;)oe.nodeType===1&&me.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;D<me.length;D++){var pe=me[D];pe.element.scrollLeft=pe.left,pe.element.scrollTop=pe.top}}Ed=!!$y,Uy=$y=null}finally{xt=x,le.p=m,X.T=f}}a.current=l,nn=2}}function f2(){if(nn===2){nn=0;var a=da,l=Zl,f=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||f){f=X.T,X.T=null;var m=le.p;le.p=2;var x=xt;xt|=4;try{Fw(a,l.alternate,l)}finally{xt=x,le.p=m,X.T=f}}nn=3}}function h2(){if(nn===4||nn===3){nn=0,mt();var a=da,l=Zl,f=vs,m=Qw;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?nn=5:(nn=0,Zl=da=null,p2(a,a.pendingLanes));var x=a.pendingLanes;if(x===0&&(pa=null),Al(f),l=l.stateNode,Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(ke,l,void 0,(l.current.flags&128)===128)}catch{}if(m!==null){l=X.T,x=le.p,le.p=2,X.T=null;try{for(var v=a.onRecoverableError,A=0;A<m.length;A++){var D=m[A];v(D.value,{componentStack:D.stack})}}finally{X.T=l,le.p=x}}(vs&3)!==0&&pd(),Bi(a),x=a.pendingLanes,(f&261930)!==0&&(x&42)!==0?a===My?Fc++:(Fc=0,My=a):Fc=0,Pc(0)}}function p2(a,l){(a.pooledCacheLanes&=l)===0&&(l=a.pooledCache,l!=null&&(a.pooledCache=null,Sc(l)))}function pd(){return c2(),f2(),h2(),d2()}function d2(){if(nn!==5)return!1;var a=da,l=Ny;Ny=0;var f=Al(vs),m=X.T,x=le.p;try{le.p=32>f?32:f,X.T=null,f=Ty,Ty=null;var v=da,A=vs;if(nn=0,Zl=da=null,vs=0,(xt&6)!==0)throw Error(r(331));var D=xt;if(xt|=4,Yw(v.current),Hw(v,v.current,A,f),xt=D,Pc(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(ke,v)}catch{}return!0}finally{le.p=x,X.T=m,p2(a,l)}}function m2(a,l,f){l=Ur(f,l),l=oy(a.stateNode,l,2),a=oa(a,l,2),a!==null&&(so(a,2),Bi(a))}function At(a,l,f){if(a.tag===3)m2(a,a,f);else for(;l!==null;){if(l.tag===3){m2(l,a,f);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(pa===null||!pa.has(m))){a=Ur(f,a),f=gw(2),m=oa(l,f,2),m!==null&&(yw(f,m,l,a),so(m,2),Bi(m));break}}l=l.return}}function Dy(a,l,f){var m=a.pingCache;if(m===null){m=a.pingCache=new m4;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)||(wy=!0,x.add(f),a=S4.bind(null,a,l,f),l.then(a,a))}function S4(a,l,f){var m=a.pingCache;m!==null&&m.delete(l),a.pingedLanes|=a.suspendedLanes&f,a.warmLanes&=~f,Rt===a&&(at&f)===f&&($t===4||$t===3&&(at&62914560)===at&&300>Be()-od?(xt&2)===0&&eu(a,0):Ey|=f,Ql===at&&(Ql=0)),Bi(a)}function g2(a,l){l===0&&(l=nc()),a=co(a,l),a!==null&&(so(a,l),Bi(a))}function v4(a){var l=a.memoizedState,f=0;l!==null&&(f=l.retryLane),g2(a,f)}function k4(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),g2(a,f)}function C4(a,l){return he(a,l)}var dd=null,nu=null,Iy=!1,md=!1,_y=!1,ga=0;function Bi(a){a!==nu&&a.next===null&&(nu===null?dd=nu=a:nu=nu.next=a),md=!0,Iy||(Iy=!0,E4())}function Pc(a,l){if(!_y&&md){_y=!0;do for(var f=!1,m=dd;m!==null;){if(a!==0){var x=m.pendingLanes;if(x===0)var v=0;else{var A=m.suspendedLanes,D=m.pingedLanes;v=(1<<31-wt(42|a)+1)-1,v&=x&~(A&~D),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(f=!0,S2(m,v))}else v=at,v=St(m,m===Rt?v:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(v&3)===0||Vr(m,v)||(f=!0,S2(m,v));m=m.next}while(f);_y=!1}}function w4(){y2()}function y2(){md=Iy=!1;var a=0;ga!==0&&L4()&&(a=ga);for(var l=Be(),f=null,m=dd;m!==null;){var x=m.next,v=x2(m,l);v===0?(m.next=null,f===null?dd=x:f.next=x,x===null&&(nu=f)):(f=m,(a!==0||(v&3)!==0)&&(md=!0)),m=x}nn!==0&&nn!==5||Pc(a),ga!==0&&(ga=0)}function x2(a,l){for(var f=a.suspendedLanes,m=a.pingedLanes,x=a.expirationTimes,v=a.pendingLanes&-62914561;0<v;){var A=31-wt(v),D=1<<A,J=x[A];J===-1?((D&f)===0||(D&m)!==0)&&(x[A]=Je(D,l)):J<=l&&(a.expiredLanes|=D),v&=~D}if(l=Rt,f=at,f=St(a,a===l?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),m=a.callbackNode,f===0||a===l&&(Et===2||Et===9)||a.cancelPendingCommit!==null)return m!==null&&m!==null&&je(m),a.callbackNode=null,a.callbackPriority=0;if((f&3)===0||Vr(a,f)){if(l=f&-f,l===a.callbackPriority)return l;switch(m!==null&&je(m),Al(f)){case 2:case 8:f=ge;break;case 32:f=I;break;case 268435456:f=Ue;break;default:f=I}return m=b2.bind(null,a),f=he(f,m),a.callbackPriority=l,a.callbackNode=f,l}return m!==null&&m!==null&&je(m),a.callbackPriority=2,a.callbackNode=null,2}function b2(a,l){if(nn!==0&&nn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var f=a.callbackNode;if(pd()&&a.callbackNode!==f)return null;var m=at;return m=St(a,a===Rt?m:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),m===0?null:(e2(a,m,l),x2(a,Be()),a.callbackNode!=null&&a.callbackNode===f?b2.bind(null,a):null)}function S2(a,l){if(pd())return null;e2(a,l,!0)}function E4(){B4(function(){(xt&6)!==0?he(fe,w4):y2()})}function Ly(){if(ga===0){var a=jl;a===0&&(a=wl,wl<<=1,(wl&261888)===0&&(wl=256)),ga=a}return ga}function v2(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:oo(""+a)}function k2(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 A4(a,l,f,m,x){if(l==="submit"&&f&&f.stateNode===x){var v=v2((x[yn]||null).action),A=m.submitter;A&&(l=(l=A[yn]||null)?v2(l.formAction):A.getAttribute("formAction"),l!==null&&(v=l,A=null));var D=new Si("action","action",null,m,x);a.push({event:D,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(ga!==0){var J=A?k2(x,A):new FormData(x);ty(f,{pending:!0,data:J,method:x.method,action:v},null,J)}}else typeof v=="function"&&(D.preventDefault(),J=A?k2(x,A):new FormData(x),ty(f,{pending:!0,data:J,method:x.method,action:v},v,J))},currentTarget:x}]})}}for(var zy=0;zy<x0.length;zy++){var By=x0[zy],N4=By.toLowerCase(),T4=By[0].toUpperCase()+By.slice(1);vi(N4,"on"+T4)}vi(Zk,"onAnimationEnd"),vi(eC,"onAnimationIteration"),vi(tC,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(J6,"onTransitionRun"),vi(q6,"onTransitionStart"),vi(H6,"onTransitionCancel"),vi(nC,"onTransitionEnd"),Ii("onMouseEnter",["mouseout","mouseover"]),Ii("onMouseLeave",["mouseout","mouseover"]),Ii("onPointerEnter",["pointerout","pointerover"]),Ii("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 jc="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(" "),M4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(jc));function C2(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 D=m[A],J=D.instance,ie=D.currentTarget;if(D=D.listener,J!==v&&x.isPropagationStopped())break e;v=D,x.currentTarget=ie;try{v(x)}catch(ce){Op(ce)}x.currentTarget=null,v=J}else for(A=0;A<m.length;A++){if(D=m[A],J=D.instance,ie=D.currentTarget,D=D.listener,J!==v&&x.isPropagationStopped())break e;v=D,x.currentTarget=ie;try{v(x)}catch(ce){Op(ce)}x.currentTarget=null,v=J}}}}function st(a,l){var f=l[ic];f===void 0&&(f=l[ic]=new Set);var m=a+"__bubble";f.has(m)||(w2(l,a,2,!1),f.add(m))}function Vy(a,l,f){var m=0;l&&(m|=4),w2(f,a,m,l)}var gd="_reactListening"+Math.random().toString(36).slice(2);function Fy(a){if(!a[gd]){a[gd]=!0,Sp.forEach(function(f){f!=="selectionchange"&&(M4.has(f)||Vy(f,!1,a),Vy(f,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[gd]||(l[gd]=!0,Vy("selectionchange",!1,l))}}function w2(a,l,f,m){switch(Z2(l)){case 2:var x=rL;break;case 8:x=iL;break;default:x=ex}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 Py(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 D=m.stateNode.containerInfo;if(D===x)break;if(A===4)for(A=m.return;A!==null;){var J=A.tag;if((J===3||J===4)&&A.stateNode.containerInfo===x)return;A=A.return}for(;D!==null;){if(A=rs(D),A===null)return;if(J=A.tag,J===5||J===6||J===26||J===27){m=v=A;continue e}D=D.parentNode}}m=m.return}E(function(){var ie=v,ce=fc(f),me=[];e:{var se=rC.get(a);if(se!==void 0){var oe=Si,Me=a;switch(a){case"keypress":if(vt(f)===0)break e;case"keydown":case"keyup":oe=k6;break;case"focusin":Me="focus",oe=u0;break;case"focusout":Me="blur",oe=u0;break;case"beforeblur":case"afterblur":oe=u0;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":oe=Dk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=c6;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=E6;break;case Zk:case eC:case tC:oe=p6;break;case nC:oe=N6;break;case"scroll":case"scrollend":oe=l6;break;case"wheel":oe=M6;break;case"copy":case"cut":case"paste":oe=m6;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=_k;break;case"toggle":case"beforetoggle":oe=R6}var Fe=(l&4)!==0,Mt=!Fe&&(a==="scroll"||a==="scrollend"),Q=Fe?se!==null?se+"Capture":null:se;Fe=[];for(var K=ie,ne;K!==null;){var pe=K;if(ne=pe.stateNode,pe=pe.tag,pe!==5&&pe!==26&&pe!==27||ne===null||Q===null||(pe=M(K,Q),pe!=null&&Fe.push($c(K,pe,ne))),Mt)break;K=K.return}0<Fe.length&&(se=new oe(se,Me,null,f,ce),me.push({event:se,listeners:Fe}))}}if((l&7)===0){e:{if(se=a==="mouseover"||a==="pointerover",oe=a==="mouseout"||a==="pointerout",se&&f!==Rl&&(Me=f.relatedTarget||f.fromElement)&&(rs(Me)||Me[ns]))break e;if((oe||se)&&(se=ce.window===ce?ce:(se=ce.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Me=f.relatedTarget||f.toElement,oe=ie,Me=Me?rs(Me):null,Me!==null&&(Mt=s(Me),Fe=Me.tag,Me!==Mt||Fe!==5&&Fe!==27&&Fe!==6)&&(Me=null)):(oe=null,Me=ie),oe!==Me)){if(Fe=Dk,pe="onMouseLeave",Q="onMouseEnter",K="mouse",(a==="pointerout"||a==="pointerover")&&(Fe=_k,pe="onPointerLeave",Q="onPointerEnter",K="pointer"),Mt=oe==null?se:Ys(oe),ne=Me==null?se:Ys(Me),se=new Fe(pe,K+"leave",oe,f,ce),se.target=Mt,se.relatedTarget=ne,pe=null,rs(ce)===ie&&(Fe=new Fe(Q,K+"enter",Me,f,ce),Fe.target=ne,Fe.relatedTarget=Mt,pe=Fe),Mt=pe,oe&&Me)t:{for(Fe=O4,Q=oe,K=Me,ne=0,pe=Q;pe;pe=Fe(pe))ne++;pe=0;for(var ze=K;ze;ze=Fe(ze))pe++;for(;0<ne-pe;)Q=Fe(Q),ne--;for(;0<pe-ne;)K=Fe(K),pe--;for(;ne--;){if(Q===K||K!==null&&Q===K.alternate){Fe=Q;break t}Q=Fe(Q),K=Fe(K)}Fe=null}else Fe=null;oe!==null&&E2(me,se,oe,Fe,!1),Me!==null&&Mt!==null&&E2(me,Mt,Me,Fe,!0)}}e:{if(se=ie?Ys(ie):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var gt=$k;else if(Pk(se))if(Uk)gt=j6;else{gt=F6;var Ie=V6}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ie&&Xs(ie.elementType)&&(gt=$k):gt=P6;if(gt&&(gt=gt(a,ie))){jk(me,gt,f,ce);break e}Ie&&Ie(a,se,ie),a==="focusout"&&ie&&se.type==="number"&&ie.memoizedProps.value!=null&&lc(se,"number",se.value)}switch(Ie=ie?Ys(ie):window,a){case"focusin":(Pk(Ie)||Ie.contentEditable==="true")&&(Il=Ie,m0=ie,yc=null);break;case"focusout":yc=m0=Il=null;break;case"mousedown":g0=!0;break;case"contextmenu":case"mouseup":case"dragend":g0=!1,Xk(me,f,ce);break;case"selectionchange":if(U6)break;case"keydown":case"keyup":Xk(me,f,ce)}var et;if(f0)e:{switch(a){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Dl?Vk(a,f)&&(ot="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(ot="onCompositionStart");ot&&(Lk&&f.locale!=="ko"&&(Dl||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Dl&&(et=Qe()):(ye=ce,ve="value"in ye?ye.value:ye.textContent,Dl=!0)),Ie=yd(ie,ot),0<Ie.length&&(ot=new Ik(ot,a,null,f,ce),me.push({event:ot,listeners:Ie}),et?ot.data=et:(et=Fk(f),et!==null&&(ot.data=et)))),(et=I6?_6(a,f):L6(a,f))&&(ot=yd(ie,"onBeforeInput"),0<ot.length&&(Ie=new Ik("onBeforeInput","beforeinput",null,f,ce),me.push({event:Ie,listeners:ot}),Ie.data=et)),A4(me,a,ie,f,ce)}C2(me,l)})}function $c(a,l,f){return{instance:a,listener:l,currentTarget:f}}function yd(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=M(a,f),x!=null&&m.unshift($c(a,x,v)),x=M(a,l),x!=null&&m.push($c(a,x,v))),a.tag===3)return m;a=a.return}return[]}function O4(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function E2(a,l,f,m,x){for(var v=l._reactName,A=[];f!==null&&f!==m;){var D=f,J=D.alternate,ie=D.stateNode;if(D=D.tag,J!==null&&J===m)break;D!==5&&D!==26&&D!==27||ie===null||(J=ie,x?(ie=M(f,v),ie!=null&&A.unshift($c(f,ie,J))):x||(ie=M(f,v),ie!=null&&A.push($c(f,ie,J)))),f=f.return}A.length!==0&&a.push({event:l,listeners:A})}var R4=/\r\n?/g,D4=/\u0000|\uFFFD/g;function A2(a){return(typeof a=="string"?a:""+a).replace(R4,`
|
|
100
|
-
`).replace(D4,"")}function N2(a,l){return l=A2(l),A2(a)===l}function Tt(a,l,f,m,x,v){switch(f){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||bi(a,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&bi(a,""+m);break;case"className":Ml(a,"class",m);break;case"tabIndex":Ml(a,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Ml(a,f,m);break;case"style":cc(a,m,v);break;case"data":if(l!=="object"){Ml(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"&&Tt(a,l,"name",x.name,x,null),Tt(a,l,"formEncType",x.formEncType,x,null),Tt(a,l,"formMethod",x.formMethod,x,null),Tt(a,l,"formTarget",x.formTarget,x,null)):(Tt(a,l,"encType",x.encType,x,null),Tt(a,l,"method",x.method,x,null),Tt(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=Fr);break;case"onScroll":m!=null&&st("scroll",a);break;case"onScrollEnd":m!=null&&st("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":st("beforetoggle",a),st("toggle",a),jn(a,"popover",m);break;case"xlinkActuate":yi(a,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":yi(a,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":yi(a,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":yi(a,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":yi(a,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":yi(a,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":yi(a,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":yi(a,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":yi(a,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":jn(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=nt.get(f)||f,jn(a,f,m))}}function jy(a,l,f,m,x,v){switch(f){case"style":cc(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"?bi(a,m):(typeof m=="number"||typeof m=="bigint")&&bi(a,""+m);break;case"onScroll":m!=null&&st("scroll",a);break;case"onScrollEnd":m!=null&&st("scrollend",a);break;case"onClick":m!=null&&(a.onclick=Fr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sc.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[yn]||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,""):jn(a,f,m)}}}function vn(a,l,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",a),st("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:Tt(a,l,v,A,f,null)}}x&&Tt(a,l,"srcSet",f.srcSet,f,null),m&&Tt(a,l,"src",f.src,f,null);return;case"input":st("invalid",a);var D=v=A=x=null,J=null,ie=null;for(m in f)if(f.hasOwnProperty(m)){var ce=f[m];if(ce!=null)switch(m){case"name":x=ce;break;case"type":A=ce;break;case"checked":J=ce;break;case"defaultChecked":ie=ce;break;case"value":v=ce;break;case"defaultValue":D=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,l));break;default:Tt(a,l,m,ce,f,null)}}oc(a,v,D,J,ie,A,x,!1);return;case"select":st("invalid",a),m=A=v=null;for(x in f)if(f.hasOwnProperty(x)&&(D=f[x],D!=null))switch(x){case"value":v=D;break;case"defaultValue":A=D;break;case"multiple":m=D;default:Tt(a,l,x,D,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":st("invalid",a),v=x=m=null;for(A in f)if(f.hasOwnProperty(A)&&(D=f[A],D!=null))switch(A){case"value":m=D;break;case"defaultValue":x=D;break;case"children":v=D;break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(r(91));break;default:Tt(a,l,A,D,f,null)}Ap(a,m,x,v);return;case"option":for(J in f)f.hasOwnProperty(J)&&(m=f[J],m!=null)&&(J==="selected"?a.selected=m&&typeof m!="function"&&typeof m!="symbol":Tt(a,l,J,m,f,null));return;case"dialog":st("beforetoggle",a),st("toggle",a),st("cancel",a),st("close",a);break;case"iframe":case"object":st("load",a);break;case"video":case"audio":for(m=0;m<jc.length;m++)st(jc[m],a);break;case"image":st("error",a),st("load",a);break;case"details":st("toggle",a);break;case"embed":case"source":case"link":st("error",a),st("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(ie in f)if(f.hasOwnProperty(ie)&&(m=f[ie],m!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Tt(a,l,ie,m,f,null)}return;default:if(Xs(l)){for(ce in f)f.hasOwnProperty(ce)&&(m=f[ce],m!==void 0&&jy(a,l,ce,m,f,void 0));return}}for(D in f)f.hasOwnProperty(D)&&(m=f[D],m!=null&&Tt(a,l,D,m,f,null))}function I4(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,D=null,J=null,ie=null,ce=null;for(oe in f){var me=f[oe];if(f.hasOwnProperty(oe)&&me!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":J=me;default:m.hasOwnProperty(oe)||Tt(a,l,oe,null,m,me)}}for(var se in m){var oe=m[se];if(me=f[se],m.hasOwnProperty(se)&&(oe!=null||me!=null))switch(se){case"type":v=oe;break;case"name":x=oe;break;case"checked":ie=oe;break;case"defaultChecked":ce=oe;break;case"value":A=oe;break;case"defaultValue":D=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,l));break;default:oe!==me&&Tt(a,l,se,oe,m,me)}}ac(a,A,D,J,ie,ce,v,x);return;case"select":oe=A=D=se=null;for(v in f)if(J=f[v],f.hasOwnProperty(v)&&J!=null)switch(v){case"value":break;case"multiple":oe=J;default:m.hasOwnProperty(v)||Tt(a,l,v,null,m,J)}for(x in m)if(v=m[x],J=f[x],m.hasOwnProperty(x)&&(v!=null||J!=null))switch(x){case"value":se=v;break;case"defaultValue":D=v;break;case"multiple":A=v;default:v!==J&&Tt(a,l,x,v,m,J)}l=D,f=A,m=oe,se!=null?Ws(a,!!f,se,!1):!!m!=!!f&&(l!=null?Ws(a,!!f,l,!0):Ws(a,!!f,f?[]:"",!1));return;case"textarea":oe=se=null;for(D in f)if(x=f[D],f.hasOwnProperty(D)&&x!=null&&!m.hasOwnProperty(D))switch(D){case"value":break;case"children":break;default:Tt(a,l,D,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":se=x;break;case"defaultValue":oe=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==v&&Tt(a,l,A,x,m,v)}Ep(a,se,oe);return;case"option":for(var Me in f)se=f[Me],f.hasOwnProperty(Me)&&se!=null&&!m.hasOwnProperty(Me)&&(Me==="selected"?a.selected=!1:Tt(a,l,Me,null,m,se));for(J in m)se=m[J],oe=f[J],m.hasOwnProperty(J)&&se!==oe&&(se!=null||oe!=null)&&(J==="selected"?a.selected=se&&typeof se!="function"&&typeof se!="symbol":Tt(a,l,J,se,m,oe));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 Fe in f)se=f[Fe],f.hasOwnProperty(Fe)&&se!=null&&!m.hasOwnProperty(Fe)&&Tt(a,l,Fe,null,m,se);for(ie in m)if(se=m[ie],oe=f[ie],m.hasOwnProperty(ie)&&se!==oe&&(se!=null||oe!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,l));break;default:Tt(a,l,ie,se,m,oe)}return;default:if(Xs(l)){for(var Mt in f)se=f[Mt],f.hasOwnProperty(Mt)&&se!==void 0&&!m.hasOwnProperty(Mt)&&jy(a,l,Mt,void 0,m,se);for(ce in m)se=m[ce],oe=f[ce],!m.hasOwnProperty(ce)||se===oe||se===void 0&&oe===void 0||jy(a,l,ce,se,m,oe);return}}for(var Q in f)se=f[Q],f.hasOwnProperty(Q)&&se!=null&&!m.hasOwnProperty(Q)&&Tt(a,l,Q,null,m,se);for(me in m)se=m[me],oe=f[me],!m.hasOwnProperty(me)||se===oe||se==null&&oe==null||Tt(a,l,me,se,m,oe)}function T2(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _4(){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,D=x.duration;if(v&&D&&T2(A)){for(A=0,D=x.responseEnd,m+=1;m<f.length;m++){var J=f[m],ie=J.startTime;if(ie>D)break;var ce=J.transferSize,me=J.initiatorType;ce&&T2(me)&&(J=J.responseEnd,A+=ce*(J<D?1:(D-ie)/(J-ie)))}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 $y=null,Uy=null;function xd(a){return a.nodeType===9?a:a.ownerDocument}function M2(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 O2(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 Jy(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 qy=null;function L4(){var a=window.event;return a&&a.type==="popstate"?a===qy?!1:(qy=a,!0):(qy=null,!1)}var R2=typeof setTimeout=="function"?setTimeout:void 0,z4=typeof clearTimeout=="function"?clearTimeout:void 0,D2=typeof Promise=="function"?Promise:void 0,B4=typeof queueMicrotask=="function"?queueMicrotask:typeof D2<"u"?function(a){return D2.resolve(null).then(a).catch(V4)}:R2;function V4(a){setTimeout(function(){throw a})}function ya(a){return a==="head"}function I2(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),au(l);return}m--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")m++;else if(f==="html")Uc(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,Uc(f);for(var v=f.firstChild;v;){var A=v.nextSibling,D=v.nodeName;v[Gs]||D==="SCRIPT"||D==="STYLE"||D==="LINK"&&v.rel.toLowerCase()==="stylesheet"||f.removeChild(v),v=A}}else f==="body"&&Uc(a.ownerDocument.body);f=x}while(f);au(l)}function _2(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 Hy(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":Hy(f),Nl(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function F4(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[Gs])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=Gr(a.nextSibling),a===null)break}return null}function P4(a,l,f){if(l==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=Gr(a.nextSibling),a===null))return null;return a}function L2(a,l){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=Gr(a.nextSibling),a===null))return null;return a}function Ky(a){return a.data==="$?"||a.data==="$~"}function Gy(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function j4(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 Gr(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 Yy=null;function z2(a){a=a.nextSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(l===0)return Gr(a.nextSibling);l--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||l++}a=a.nextSibling}return null}function B2(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 V2(a,l,f){switch(l=xd(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 Uc(a){for(var l=a.attributes;l.length;)a.removeAttributeNode(l[0]);Nl(a)}var Yr=new Map,F2=new Set;function bd(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var ks=le.d;le.d={f:$4,r:U4,D:J4,C:q4,L:H4,m:K4,X:Y4,S:G4,M:W4};function $4(){var a=ks.f(),l=cd();return a||l}function U4(a){var l=is(a);l!==null&&l.tag===5&&l.type==="form"?nw(l):ks.r(a)}var ru=typeof document>"u"?null:document;function P2(a,l,f){var m=ru;if(m&&typeof l=="string"&&l){var x=It(l);x='link[rel="'+a+'"][href="'+x+'"]',typeof f=="string"&&(x+='[crossorigin="'+f+'"]'),F2.has(x)||(F2.add(x),a={rel:a,crossOrigin:f,href:l},m.querySelector(x)===null&&(l=m.createElement("link"),vn(l,"link",a),Wt(l),m.head.appendChild(l)))}}function J4(a){ks.D(a),P2("dns-prefetch",a,null)}function q4(a,l){ks.C(a,l),P2("preconnect",a,l)}function H4(a,l,f){ks.L(a,l,f);var m=ru;if(m&&a&&l){var x='link[rel="preload"][as="'+It(l)+'"]';l==="image"&&f&&f.imageSrcSet?(x+='[imagesrcset="'+It(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(x+='[imagesizes="'+It(f.imageSizes)+'"]')):x+='[href="'+It(a)+'"]';var v=x;switch(l){case"style":v=iu(a);break;case"script":v=su(a)}Yr.has(v)||(a=g({rel:"preload",href:l==="image"&&f&&f.imageSrcSet?void 0:a,as:l},f),Yr.set(v,a),m.querySelector(x)!==null||l==="style"&&m.querySelector(Jc(v))||l==="script"&&m.querySelector(qc(v))||(l=m.createElement("link"),vn(l,"link",a),Wt(l),m.head.appendChild(l)))}}function K4(a,l){ks.m(a,l);var f=ru;if(f&&a){var m=l&&typeof l.as=="string"?l.as:"script",x='link[rel="modulepreload"][as="'+It(m)+'"][href="'+It(a)+'"]',v=x;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=su(a)}if(!Yr.has(v)&&(a=g({rel:"modulepreload",href:a},l),Yr.set(v,a),f.querySelector(x)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(qc(v)))return}m=f.createElement("link"),vn(m,"link",a),Wt(m),f.head.appendChild(m)}}}function G4(a,l,f){ks.S(a,l,f);var m=ru;if(m&&a){var x=ss(m).hoistableStyles,v=iu(a);l=l||"default";var A=x.get(v);if(!A){var D={loading:0,preload:null};if(A=m.querySelector(Jc(v)))D.loading=5;else{a=g({rel:"stylesheet",href:a,"data-precedence":l},f),(f=Yr.get(v))&&Wy(a,f);var J=A=m.createElement("link");Wt(J),vn(J,"link",a),J._p=new Promise(function(ie,ce){J.onload=ie,J.onerror=ce}),J.addEventListener("load",function(){D.loading|=1}),J.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Sd(A,l,m)}A={type:"stylesheet",instance:A,count:1,state:D},x.set(v,A)}}}function Y4(a,l){ks.X(a,l);var f=ru;if(f&&a){var m=ss(f).hoistableScripts,x=su(a),v=m.get(x);v||(v=f.querySelector(qc(x)),v||(a=g({src:a,async:!0},l),(l=Yr.get(x))&&Xy(a,l),v=f.createElement("script"),Wt(v),vn(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},m.set(x,v))}}function W4(a,l){ks.M(a,l);var f=ru;if(f&&a){var m=ss(f).hoistableScripts,x=su(a),v=m.get(x);v||(v=f.querySelector(qc(x)),v||(a=g({src:a,async:!0,type:"module"},l),(l=Yr.get(x))&&Xy(a,l),v=f.createElement("script"),Wt(v),vn(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},m.set(x,v))}}function j2(a,l,f,m){var x=(x=Ae.current)?bd(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=iu(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=iu(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(Jc(a)))&&!v._p&&(A.instance=v,A.state.loading=5),Yr.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},Yr.set(a,f),v||X4(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=su(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 iu(a){return'href="'+It(a)+'"'}function Jc(a){return'link[rel="stylesheet"]['+a+"]"}function $2(a){return g({},a,{"data-precedence":a.precedence,precedence:null})}function X4(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}),vn(l,"link",f),Wt(l),a.head.appendChild(l))}function su(a){return'[src="'+It(a)+'"]'}function qc(a){return"script[async]"+a}function U2(a,l,f){if(l.count++,l.instance===null)switch(l.type){case"style":var m=a.querySelector('style[data-href~="'+It(f.href)+'"]');if(m)return l.instance=m,Wt(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"),Wt(m),vn(m,"style",x),Sd(m,f.precedence,a),l.instance=m;case"stylesheet":x=iu(f.href);var v=a.querySelector(Jc(x));if(v)return l.state.loading|=4,l.instance=v,Wt(v),v;m=$2(f),(x=Yr.get(x))&&Wy(m,x),v=(a.ownerDocument||a).createElement("link"),Wt(v);var A=v;return A._p=new Promise(function(D,J){A.onload=D,A.onerror=J}),vn(v,"link",m),l.state.loading|=4,Sd(v,f.precedence,a),l.instance=v;case"script":return v=su(f.src),(x=a.querySelector(qc(v)))?(l.instance=x,Wt(x),x):(m=f,(x=Yr.get(v))&&(m=g({},f),Xy(m,x)),a=a.ownerDocument||a,x=a.createElement("script"),Wt(x),vn(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,Sd(m,f.precedence,a));return l.instance}function Sd(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 D=m[A];if(D.dataset.precedence===l)v=D;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 Wy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.title==null&&(a.title=l.title)}function Xy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.integrity==null&&(a.integrity=l.integrity)}var vd=null;function J2(a,l,f){if(vd===null){var m=new Map,x=vd=new Map;x.set(f,m)}else x=vd,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[Gs]||v[Yt]||a==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var A=v.getAttribute(l)||"";A=a+A;var D=m.get(A);D?D.push(v):m.set(A,[v])}}return m}function q2(a,l,f){a=a.ownerDocument||a,a.head.insertBefore(f,l==="title"?a.querySelector("head > title"):null)}function Q4(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 H2(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function Z4(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=iu(m.href),v=l.querySelector(Jc(x));if(v){l=v._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=kd.bind(a),l.then(a,a)),f.state.loading|=4,f.instance=v,Wt(v);return}v=l.ownerDocument||l,m=$2(m),(x=Yr.get(x))&&Wy(m,x),v=v.createElement("link"),Wt(v);var A=v;A._p=new Promise(function(D,J){A.onload=D,A.onerror=J}),vn(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=kd.bind(a),l.addEventListener("load",f),l.addEventListener("error",f))}}var Qy=0;function eL(a,l){return a.stylesheets&&a.count===0&&wd(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var m=setTimeout(function(){if(a.stylesheets&&wd(a,a.stylesheets),a.unsuspend){var v=a.unsuspend;a.unsuspend=null,v()}},6e4+l);0<a.imgBytes&&Qy===0&&(Qy=62500*_4());var x=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&wd(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 kd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wd(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Cd=null;function wd(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Cd=new Map,l.forEach(tL,a),Cd=null,kd.call(a))}function tL(a,l){if(!(l.state.loading&4)){var f=Cd.get(a);if(f)var m=f.get(null);else{f=new Map,Cd.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=kd.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 Hc={$$typeof:V,Provider:null,Consumer:null,_currentValue:Ce,_currentValue2:Ce,_threadCount:0};function nL(a,l,f,m,x,v,A,D,J){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=J,this.incompleteTransitions=new Map}function K2(a,l,f,m,x,v,A,D,J,ie,ce,me){return a=new nL(a,l,f,A,J,ie,ce,me,D),l=1,v===!0&&(l|=24),v=Er(3,null,null,l),a.current=v,v.stateNode=a,l=R0(),l.refCount++,a.pooledCache=l,l.refCount++,v.memoizedState={element:m,isDehydrated:f,cache:l},L0(v),a}function G2(a){return a?(a=zl,a):zl}function Y2(a,l,f,m,x,v){x=G2(x),m.context===null?m.context=x:m.pendingContext=x,m=aa(l),m.payload={element:f},v=v===void 0?null:v,v!==null&&(m.callback=v),f=oa(a,m,l),f!==null&&(gr(f,a,l),wc(f,a,l))}function W2(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<l?f:l}}function Zy(a,l){W2(a,l),(a=a.alternate)&&W2(a,l)}function X2(a){if(a.tag===13||a.tag===31){var l=co(a,67108864);l!==null&&gr(l,a,67108864),Zy(a,67108864)}}function Q2(a){if(a.tag===13||a.tag===31){var l=Or();l=ts(l);var f=co(a,l);f!==null&&gr(f,a,l),Zy(a,l)}}var Ed=!0;function rL(a,l,f,m){var x=X.T;X.T=null;var v=le.p;try{le.p=2,ex(a,l,f,m)}finally{le.p=v,X.T=x}}function iL(a,l,f,m){var x=X.T;X.T=null;var v=le.p;try{le.p=8,ex(a,l,f,m)}finally{le.p=v,X.T=x}}function ex(a,l,f,m){if(Ed){var x=tx(m);if(x===null)Py(a,l,m,Ad,f),eE(a,m);else if(aL(x,a,l,f,m))m.stopPropagation();else if(eE(a,m),l&4&&-1<sL.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=Gt(v.pendingLanes);if(A!==0){var D=v;for(D.pendingLanes|=2,D.entangledLanes|=2;A;){var J=1<<31-wt(A);D.entanglements[1]|=J,A&=~J}Bi(v),(xt&6)===0&&(ld=Be()+500,Pc(0))}}break;case 31:case 13:D=co(v,2),D!==null&&gr(D,v,2),cd(),Zy(v,2)}if(v=tx(m),v===null&&Py(a,l,m,Ad,f),v===x)break;x=v}x!==null&&m.stopPropagation()}else Py(a,l,m,null,f)}}function tx(a){return a=fc(a),nx(a)}var Ad=null;function nx(a){if(Ad=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 Ad=a,null}function Z2(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(mn()){case fe:return 2;case ge:return 8;case I:case Le:return 32;case Ue:return 268435456;default:return 32}default:return 32}}var rx=!1,xa=null,ba=null,Sa=null,Kc=new Map,Gc=new Map,va=[],sL="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 eE(a,l){switch(a){case"focusin":case"focusout":xa=null;break;case"dragenter":case"dragleave":ba=null;break;case"mouseover":case"mouseout":Sa=null;break;case"pointerover":case"pointerout":Kc.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gc.delete(l.pointerId)}}function Yc(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&&X2(l)),a):(a.eventSystemFlags|=m,l=a.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),a)}function aL(a,l,f,m,x){switch(l){case"focusin":return xa=Yc(xa,a,l,f,m,x),!0;case"dragenter":return ba=Yc(ba,a,l,f,m,x),!0;case"mouseover":return Sa=Yc(Sa,a,l,f,m,x),!0;case"pointerover":var v=x.pointerId;return Kc.set(v,Yc(Kc.get(v)||null,a,l,f,m,x)),!0;case"gotpointercapture":return v=x.pointerId,Gc.set(v,Yc(Gc.get(v)||null,a,l,f,m,x)),!0}return!1}function tE(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,rc(a.priority,function(){Q2(f)});return}}else if(l===31){if(l=u(f),l!==null){a.blockedOn=l,rc(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 Nd(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var f=tx(a.nativeEvent);if(f===null){f=a.nativeEvent;var m=new f.constructor(f.type,f);Rl=m,f.target.dispatchEvent(m),Rl=null}else return l=is(f),l!==null&&X2(l),a.blockedOn=f,!1;l.shift()}return!0}function nE(a,l,f){Nd(a)&&f.delete(l)}function oL(){rx=!1,xa!==null&&Nd(xa)&&(xa=null),ba!==null&&Nd(ba)&&(ba=null),Sa!==null&&Nd(Sa)&&(Sa=null),Kc.forEach(nE),Gc.forEach(nE)}function Td(a,l){a.blockedOn===l&&(a.blockedOn=null,rx||(rx=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,oL)))}var Md=null;function rE(a){Md!==a&&(Md=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Md===a&&(Md=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(nx(m||f)===null)continue;break}var v=is(f);v!==null&&(a.splice(l,3),l-=3,ty(v,{pending:!0,data:x,method:f.method,action:m},m,x))}}))}function au(a){function l(J){return Td(J,a)}xa!==null&&Td(xa,a),ba!==null&&Td(ba,a),Sa!==null&&Td(Sa,a),Kc.forEach(l),Gc.forEach(l);for(var f=0;f<va.length;f++){var m=va[f];m.blockedOn===a&&(m.blockedOn=null)}for(;0<va.length&&(f=va[0],f.blockedOn===null);)tE(f),f.blockedOn===null&&va.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[yn]||null;if(typeof v=="function")A||rE(f);else if(A){var D=null;if(v&&v.hasAttribute("formAction")){if(x=v,A=v[yn]||null)D=A.formAction;else if(nx(x)!==null)continue}else D=A.action;typeof D=="function"?f[m+1]=D:(f.splice(m,3),m-=3),rE(f)}}}function iE(){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 ix(a){this._internalRoot=a}Od.prototype.render=ix.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(r(409));var f=l.current,m=Or();Y2(f,m,a,l,null,null)},Od.prototype.unmount=ix.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;Y2(a.current,2,null,a,null,null),cd(),l[ns]=null}};function Od(a){this._internalRoot=a}Od.prototype.unstable_scheduleHydration=function(a){if(a){var l=xp();a={blockedOn:null,target:a,priority:l};for(var f=0;f<va.length&&l!==0&&l<va[f].priority;f++);va.splice(f,0,a),f===0&&tE(a)}};var sE=e.version;if(sE!=="19.2.7")throw Error(r(527,sE,"19.2.7"));le.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 lL={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rd.isDisabled&&Rd.supportsFiber)try{ke=Rd.inject(lL),Pt=Rd}catch{}}return rf.createRoot=function(a,l){if(!i(a))throw Error(r(299));var f=!1,m="",x=hw,v=pw,A=dw;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=K2(a,1,!1,null,null,f,m,null,x,v,A,iE),a[ns]=l.current,Fy(a),new ix(l)},rf.hydrateRoot=function(a,l,f){if(!i(a))throw Error(r(299));var m=!1,x="",v=hw,A=pw,D=dw,J=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&&(D=f.onRecoverableError),f.formState!==void 0&&(J=f.formState)),l=K2(a,1,!0,l,f??null,m,x,J,v,A,D,iE),l.context=G2(null),f=l.current,m=Or(),m=ts(m),x=aa(m),x.callback=null,oa(f,x,m),f=m,l.current.lanes=f,so(l,f),Bi(l),a[ns]=l.current,Fy(a),new Od(l)},rf.version="19.2.7",rf}var JT;function iX(){if(JT)return _1.exports;JT=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(),_1.exports=rX(),_1.exports}var Rk=iX();function sX(t,e,n){return rR(X_,()=>(r,i,s)=>{const o=document.createElement("div");o.className="mdx-block-card-wrapper",o.setAttribute("data-cms-ui",""),o.contentEditable="false";const u=Rk.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 w=i.state.tr.setNodeMarkup(b,void 0,{...k.attrs,...y});i.dispatch(w)},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,w=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 T=JSON.parse(k),F=t(b),V=(F?.slots?.includes("default")??!1)||N.trim()!=="";c={componentName:b,props:k,hasExpressions:w,children:N},u.render(ee.createElement(QW,{componentName:b,props:T,hasExpressions:w,slotContent:N,definition:F,media:e,mediaContext:n,onRemove:d,onSlotContentChange:V?H=>h({children:H}):void 0,onPropsChange:w?void 0:H=>h({props:JSON.stringify(H)})}))};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 pS={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)"},aX={position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",cursor:"pointer"},oX={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"},lX={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"},uX={position:"absolute",inset:0,width:"100%",height:"100%",border:"none"},cX={...pS,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:13};function fX({videoId:t,onRemove:e}){const[n,r]=ee.useState(!1);if(!t)return ee.createElement("div",{style:cX,"data-cms-ui":""},"YouTube: missing video id");const i=ee.createElement("button",{type:"button",style:lX,title:"Remove","data-mdx-action":"youtube-remove",onClick:e},"✕");return n?ee.createElement("div",{style:pS,"data-cms-ui":""},i,ee.createElement("iframe",{style:uX,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})):ee.createElement("div",{style:pS,"data-cms-ui":""},i,ee.createElement("img",{style:aX,src:`https://i.ytimg.com/vi/${t}/hqdefault.jpg`,alt:"YouTube thumbnail",loading:"lazy",onClick:()=>r(!0)}),ee.createElement("button",{type:"button",style:oX,title:"Play","data-mdx-action":"youtube-play",onClick:()=>r(!0)},"▶"))}function hX(){return rR(e_,()=>(t,e,n)=>{const r=document.createElement("div");r.setAttribute("data-cms-ui",""),r.contentEditable="false";const i=Rk.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(ee.createElement(fX,{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 pX={border:"1px solid #d4d4d8",borderRadius:6,background:"#fff",display:"flex",flexDirection:"column",minHeight:240,maxHeight:"max(70vh, 320px)",overflow:"hidden"},dX={padding:"8px 12px",flex:1,minHeight:0,overflowY:"auto",outline:"none"},qT="nua-mdx-editor-styles",mX=`
|
|
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 gX(){ee.useEffect(()=>{if(typeof document>"u"||document.getElementById(qT))return;const t=document.createElement("style");t.id=qT,t.textContent=mX,document.head.appendChild(t)},[])}function r6({value:t,onChange:e,components:n,listStyles:r,media:i,mediaContext:s,allowComponents:o=!0}){gX();const u=ee.useRef(null),c=ee.useRef(null),h=ee.useRef(t),d=ee.useRef(!1),g=ee.useRef(!1),y=ee.useRef(e);y.current=e;const b=ee.useRef(new Map);ee.useEffect(()=>{b.current=new Map((n??[]).map(z=>[z.name,z]))},[n]);const k=ee.useRef(i);k.current=i;const w=ee.useRef(s);w.current=s;const[N,T]=ee.useState(!1),[F,V]=ee.useState(null);ee.useEffect(()=>{const z=u.current;if(!z)return;let C=!1;const _=$=>b.current.get($);return(async()=>{const $=await tR.make().config(q=>{q.set(rh,z),q.set(nh,h.current),q.get(cg).markdownUpdated((ue,ae)=>{h.current=ae,d.current&&!g.current&&y.current(ae)})}).use(UR).use(oG).use(WI).use(n6).use(Ok).use(sW).use(lW).use(X_).use(sX(_,k.current,w.current)).use(RT).use(UK).use(e_).use(hX()).use(t_).create();if(C){$.destroy();return}c.current=$,V($),queueMicrotask(()=>{d.current=!0})})(),()=>{C=!0,d.current=!1,c.current?.destroy(),c.current=null,V(null)}},[]),ee.useEffect(()=>{!c.current||!d.current||t!==h.current&&(g.current=!0,c.current.action(iR(t)),h.current=t,queueMicrotask(()=>{g.current=!1}))},[t]);const H=(z,C,_)=>{c.current?.action(Ai(RT.key,{componentName:z,props:C,children:_}))};return O.jsxs("div",{className:"nua-mdx-editor",style:pX,children:[O.jsx(u_,{editor:F,listStyles:r,media:i,mediaContext:s,field:"body",onInsertComponent:o?()=>T(!0):void 0}),O.jsx("div",{ref:u,style:dX}),o?O.jsx(pz,{open:N,components:n??[],onInsert:H,onClose:()=>T(!1)}):null]})}const yX={image:"Image URL or path",file:"File URL or path",video:"Video URL or path"};function xX({client:t,value:e,collection:n,entry:r,field:i,fieldType:s,accept:o,onChange:u}){const[c,h]=ee.useState({kind:"probing"}),d=ee.useRef(null);ee.useEffect(()=>{let k=!0;return t.listMedia({limit:1}).then(()=>{k&&h({kind:"ready"})},w=>{k&&h(hE(w)?{kind:"unavailable"}:{kind:"ready"})}),()=>{k=!1}},[t]);const g=async k=>{h({kind:"uploading"});try{const w=await t.uploadMedia(k,{collection:n,entry:r,field:i});w.success&&w.url?(u(w.url),h({kind:"ready"})):h({kind:"error",message:w.error??"Upload failed"})}catch(w){if(hE(w)){h({kind:"unavailable"});return}h({kind:"error",message:w instanceof Error?w.message:"Upload failed"})}},y=c.kind==="ready"||c.kind==="error",b=iz(t,e,n,r);return O.jsxs("div",{className:"nua-cadmin-media",children:[O.jsx(bX,{src:b,value:e,fieldType:s}),O.jsxs("div",{className:"nua-cadmin-media-row",children:[O.jsx("input",{type:"text",className:"nua-cadmin-input",value:e,placeholder:yX[s],onChange:k=>u(k.target.value)}),e!==""?O.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Clear",onClick:()=>u(""),children:"×"}):null]}),c.kind==="uploading"?O.jsx("div",{className:"nua-cadmin-field-loading",children:"Uploading…"}):null,c.kind==="unavailable"?O.jsx("div",{className:"nua-cadmin-media-hint",children:"Media uploads unavailable — paste a URL or path instead."}):null,c.kind==="error"?O.jsx("div",{className:"nua-cadmin-media-error",children:c.message}):null,y||c.kind==="probing"?O.jsxs(O.Fragment,{children:[O.jsx("input",{ref:d,type:"file",accept:o??(s==="video"?QT:void 0),className:"nua-cadmin-file-input",disabled:!y,onChange:k=>{const w=k.target.files?.[0];w&&g(w),k.target.value=""}}),O.jsx("button",{type:"button",className:"nua-cadmin-add-btn",disabled:!y,onClick:()=>d.current?.click(),children:"Upload file"})]}):null]})}function bX({src:t,value:e,fieldType:n}){return t===""?null:n==="video"||az(e)?O.jsx("video",{className:"nua-cadmin-img",src:t,muted:!0,playsInline:!0,controls:!0,preload:"metadata"}):sz(e)?O.jsx("img",{className:"nua-cadmin-img",src:t,alt:""}):null}const SX=[],vX={url:"url",email:"email",tel:"tel"},kX={date:"date",datetime:"datetime-local",time:"time",month:"month"};function CX({field:t,value:e,onChange:n}){const r=t.hints;return O.jsx("input",{type:vX[t.type]??"text",className:"nua-cadmin-input",value:Ya(e),placeholder:r?.placeholder,maxLength:r?.maxLength,minLength:r?.minLength,onChange:i=>n(nl(t.type,i.target.value))})}function wX({value:t,rows:e,placeholder:n,maxLength:r,onChange:i}){const s=ee.useRef(null);return ee.useEffect(()=>{const o=s.current;o&&(o.style.height="auto",o.style.height=`${o.scrollHeight}px`)},[t]),O.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 EX({field:t,value:e,onChange:n}){return O.jsx(wX,{value:Ya(e),rows:t.hints?.rows??4,placeholder:t.hints?.placeholder,maxLength:t.hints?.maxLength,onChange:n})}function AX({value:t,onChange:e,ctx:n}){const r=ee.useMemo(()=>({collection:n.collection,entry:n.slug}),[n.collection,n.slug]),[i,s]=ee.useState([]);return ee.useEffect(()=>{let o=!0;return n.client.getConfig().then(u=>{o&&s(u.listStyles??[])},()=>{o&&s([])}),()=>{o=!1}},[n.client]),O.jsx(r6,{value:Ya(t),onChange:e,components:SX,listStyles:i,media:n.client,mediaContext:r})}function NX({field:t,value:e,onChange:n}){return O.jsx("input",{type:"number",className:"nua-cadmin-input",value:Ya(e),min:t.hints?.min,max:t.hints?.max,step:t.hints?.step,placeholder:t.hints?.placeholder,onChange:r=>n(nl("number",r.target.value))})}function TX({value:t,onChange:e}){return O.jsx("input",{type:"number",className:"nua-cadmin-input",value:Ya(t),min:1e3,max:9999,step:1,onChange:n=>e(nl("year",n.target.value))})}function MX({field:t,value:e,onChange:n}){return O.jsx("input",{type:kX[t.type]??"date",className:"nua-cadmin-input",value:FL(e,t.type),onChange:r=>n(nl(t.type,r.target.value))})}function OX({field:t,value:e,onChange:n}){const r=PL(e),i=t.role==="publish-toggle";return O.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:[O.jsx("span",{className:"nua-cadmin-toggle-knob"}),O.jsx("span",{className:"nua-cadmin-toggle-label",children:r?"On":"Off"})]})}function RX({field:t,value:e,onChange:n}){const r=t.options??[],i=Ya(e);return O.jsxs("select",{className:"nua-cadmin-input",value:i,onChange:s=>n(nl("select",s.target.value)),children:[t.required?i===""?O.jsx("option",{value:"",disabled:!0,children:"— select —"}):null:O.jsx("option",{value:"",children:"— none —"}),r.map(s=>O.jsx("option",{value:s,children:s},s)),i!==""&&!r.includes(i)?O.jsxs("option",{value:i,children:[i," (current)"]}):null]})}const DX=2e4,IX=100,i6={options:[],loading:!0,paging:!1,truncated:!1,failed:!1};function _X(t){const e={slug:t.slug,search:`${t.title??""} ${t.slug}`.toLowerCase()};return t.title!==void 0&&(e.title=t.title),e}function LX(t,e){let n=i6,r=!1;const i=new Set,s=u=>{n={...n,...u};for(const c of i)c()},o=async()=>{if(r)return;r=!0;const u=n.options.length>0,c=[];try{const h=await IL(t,e,"slug,title",DX,(d,g)=>{for(const y of d)c.push(_X(y));u||s({options:[...c],loading:!1,paging:g,truncated:!1,failed:!1})});s({options:c,loading:!1,paging:!1,truncated:h.truncated,failed:!1})}catch{s({loading:!1,paging:!1,truncated:!u&&c.length>0,failed:n.options.length===0})}finally{r=!1}};return{getSnapshot:()=>n,subscribe(u){const c=i.size===0;return i.add(u),c&&!r&&o(),()=>{i.delete(u)}}}}const HT=new WeakMap;function zX(t,e){let n=HT.get(t);n||(n=new Map,HT.set(t,n));const r=n.get(e);if(r)return r;const i=LX(t,e);return n.set(e,i),i}function BX(t,e){const n=e===void 0||e===""?null:zX(t,e),r=ee.useCallback(s=>n?.subscribe(s)??(()=>{}),[n]),i=ee.useCallback(()=>n?.getSnapshot()??i6,[n]);return ee.useSyncExternalStore(r,i,i)}function KT(t){const e=t.title?.trim();return e===void 0||e===""?t.slug:e}function VX(t,e){let n=0;for(const i of e){const s=t.search.indexOf(i);if(s<0)return null;n+=s}const r=e[0]??"";return t.slug.toLowerCase().startsWith(r)?n:n+1e3}function FX(t,e){const n=e.toLowerCase().split(/\s+/).filter(i=>i!=="");if(n.length===0)return t;const r=[];for(const i of t){const s=VX(i,n);s!==null&&r.push({option:i,score:s})}return r.sort((i,s)=>i.score-s.score),r.map(i=>i.option)}function PX({target:t,snapshot:e,value:n,onChange:r}){const{options:i,paging:s,truncated:o}=e,[u,c]=ee.useState(!1),[h,d]=ee.useState(""),[g,y]=ee.useState(0),b=ee.useRef(null),k=ee.useRef(null),w=ee.useId(),N=i.find(U=>U.slug===n),T=ee.useMemo(()=>{const U=FX(i,h);return N===void 0||h.trim()!==""?U:[N,...U.filter($=>$!==N)]},[i,h,N]),F=T.slice(0,IX),V=T.length-F.length;ee.useEffect(()=>{if(!u)return;const U=$=>{b.current?.contains($.target)||c(!1)};return document.addEventListener("pointerdown",U),()=>document.removeEventListener("pointerdown",U)},[u]),ee.useEffect(()=>{u&&k.current?.querySelector('[data-active="true"]')?.scrollIntoView({block:"nearest"})},[g,u]);const H=U=>{r(U),d(""),y(0),c(!1)},z=()=>{y(0),d(""),c(!0)},C=U=>{if(U.key==="ArrowDown"||U.key==="ArrowUp"){if(U.preventDefault(),!u){z();return}const $=F.length-1;y(q=>U.key==="ArrowDown"?Math.min(q+1,$):Math.max(q-1,0));return}if(U.key==="Enter"&&u){const $=F[g];$&&(U.preventDefault(),H($.slug));return}U.key==="Escape"&&u&&(U.stopPropagation(),d(""),c(!1))},_=n!==""&&N===void 0&&!s;return O.jsxs("div",{className:"nua-cadmin-combobox",ref:b,children:[O.jsxs("div",{className:"nua-cadmin-combobox-control",children:[O.jsx("input",{type:"text",className:"nua-cadmin-input nua-cadmin-combobox-input",role:"combobox","aria-expanded":u,"aria-controls":w,"aria-autocomplete":"list","aria-activedescendant":u&&F[g]!==void 0?`${w}-${g}`:void 0,autoComplete:"off",value:u?h:N?KT(N):n,placeholder:`Search ${t}…`,onFocus:z,onMouseDown:()=>{u||z()},onChange:U=>{d(U.target.value),y(0),c(!0)},onKeyDown:C}),n!==""?O.jsx("button",{type:"button",className:"nua-cadmin-combobox-clear",title:"Clear reference","aria-label":"Clear reference",onClick:()=>H(""),children:"×"}):null]}),u?O.jsxs("ul",{className:"nua-cadmin-combobox-list",id:w,role:"listbox",ref:k,children:[F.length===0&&!s?O.jsxs("li",{className:"nua-cadmin-combobox-empty",children:["No entry matches “",h,"”"]}):null,F.map((U,$)=>{const q=KT(U);return O.jsxs("li",{id:`${w}-${$}`,role:"option","aria-selected":U.slug===n,"data-active":$===g,className:`nua-cadmin-combobox-option${$===g?" is-active":""}`,onMouseDown:ue=>{ue.preventDefault(),H(U.slug)},onMouseEnter:()=>y($),children:[O.jsx("span",{className:"nua-cadmin-combobox-option-label",children:q}),q===U.slug?null:O.jsx("span",{className:"nua-cadmin-combobox-option-slug",children:U.slug})]},U.slug)}),V>0?O.jsxs("li",{className:"nua-cadmin-combobox-more",children:["+",V," more — keep typing to narrow"]}):null,s?O.jsx("li",{className:"nua-cadmin-combobox-more",children:"Loading more entries…"}):null]}):null,_?O.jsxs("div",{className:"nua-cadmin-combobox-hint",children:["“",n,"” is not an entry of ",t]}):null,o?O.jsxs("div",{className:"nua-cadmin-combobox-hint",children:["Showing the first ",i.length," ",i.length===1?"entry":"entries"," of ",t]}):null]})}function jX({field:t,value:e,onChange:n,ctx:r}){const i=t.collection,s=BX(r.client,i),o=Ya(e);return i===void 0||i===""||s.failed?O.jsx("input",{type:"text",className:"nua-cadmin-input",value:o,placeholder:"entry slug",onChange:u=>n(nl("reference",u.target.value))}):s.loading?O.jsxs("div",{className:"nua-cadmin-field-loading",children:["Loading ",i,"…"]}):O.jsx(PX,{target:i,snapshot:s,value:o,onChange:u=>n(nl("reference",u))})}function $X({field:t,value:e,onChange:n,ctx:r}){const i=jL(e),s=t.itemType??"text",o={name:t.name,type:s,required:!1,fields:t.fields,options:t.options,collection:t.collection},u=ee.useCallback((d,g)=>{const y=i.slice();y[d]=g,n(y)},[i,n]),c=ee.useCallback(d=>{n(i.filter((g,y)=>y!==d))},[i,n]),h=ee.useCallback(()=>{const d=s==="object"&&t.fields?dL(t.fields):BL(s);n([...i,d])},[i,s,t.fields,n]);return O.jsxs("div",{className:"nua-cadmin-array",children:[i.length===0?O.jsx("div",{className:"nua-cadmin-field-empty",children:"No items."}):null,i.map((d,g)=>O.jsxs("div",{className:"nua-cadmin-array-item",children:[O.jsx("div",{className:"nua-cadmin-array-item-body",children:O.jsx(n0,{field:o,value:d,onChange:y=>u(g,y),ctx:r})}),O.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Remove item",onClick:()=>c(g),children:"×"})]},g)),O.jsx("button",{type:"button",className:"nua-cadmin-add-btn",onClick:h,children:"+ Add item"})]})}function UX({field:t,value:e,onChange:n,ctx:r}){const i=$L(e),s=t.fields??[],o=ee.useCallback((u,c)=>{n({...i,[u]:c})},[i,n]);return s.length===0?O.jsx("div",{className:"nua-cadmin-field-empty",children:"No nested fields."}):O.jsx("div",{className:"nua-cadmin-object",children:s.map(u=>O.jsxs("div",{className:"nua-cadmin-object-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:u.name}),O.jsx("span",{className:"nua-cadmin-field-type",children:u.type})]}),O.jsx(n0,{field:u,value:i[u.name],onChange:c=>o(u.name,c),ctx:r})]},u.name))})}function n0({field:t,value:e,onChange:n,ctx:r}){switch(t.type){case"text":case"url":case"email":case"tel":case"color":return O.jsx(CX,{field:t,value:e,onChange:n});case"textarea":return O.jsx(EX,{field:t,value:e,onChange:n});case"markdown":return O.jsx(AX,{value:e,onChange:n,ctx:r});case"number":return O.jsx(NX,{field:t,value:e,onChange:n});case"year":return O.jsx(TX,{value:e,onChange:n});case"date":case"datetime":case"time":case"month":return O.jsx(MX,{field:t,value:e,onChange:n});case"boolean":return O.jsx(OX,{field:t,value:e,onChange:n});case"select":return O.jsx(RX,{field:t,value:e,onChange:n});case"image":case"file":case"video":return O.jsx(xX,{client:r.client,value:Ya(e),collection:r.collection,entry:r.slug,field:t.name,fieldType:t.type,accept:t.hints?.accept,onChange:i=>n(i)});case"reference":return O.jsx(jX,{field:t,value:e,onChange:n,ctx:r});case"array":return O.jsx($X,{field:t,value:e,onChange:n,ctx:r});case"object":return O.jsx(UX,{field:t,value:e,onChange:n,ctx:r})}}function JX({client:t,definition:e,collection:n,onCreated:r,onCancel:i}){const s=ee.useMemo(()=>e?.fields??[],[e]),[o,u]=ee.useState(""),[c,h]=ee.useState(()=>zL(s)),[d,g]=ee.useState(!1),[y,b]=ee.useState(null),{title:k,header:w,sidebar:N,sections:T}=ee.useMemo(()=>iM(s,e?.layout),[s,e?.layout]),F=ee.useMemo(()=>[...k?[{heading:void 0,fields:[k,...w]}]:w.length>0?[{heading:void 0,fields:w}]:[],...T.map($=>({heading:$.title,fields:$.fields})),...N.length>0?[{heading:void 0,fields:N}]:[]],[k,w,T,N]),V=ee.useMemo(()=>CL(o),[o]),H=ee.useMemo(()=>bL(s,c.frontmatter,V),[s,c.frontmatter,V]),z=ee.useMemo(()=>({client:t,collection:n}),[t,n]),C=ee.useCallback(($,q)=>{h(ue=>eM(ue,$,q))},[]),_=ee.useCallback(async()=>{if(V===""){b("A slug is required.");return}const $=tM(s,H);if($.length>0){b(nM($));return}g(!0),b(null);try{const q=await t.createEntry(n,{slug:V,frontmatter:H,body:c.body,fileExtension:e?.fileExtension});q.success?r(V):b(q.error??"Could not create the entry.")}catch(q){b(q instanceof Ni?q.message:"Could not create the entry.")}finally{g(!1)}},[t,n,e,c.body,H,s,V,r]),U=e?.type==="data";return O.jsxs("div",{className:"nua-cadmin-editor",children:[O.jsxs("div",{className:"nua-cadmin-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:"slug"}),O.jsx("span",{className:"nua-cadmin-field-type",children:"text · required"})]}),O.jsx("input",{type:"text",className:"nua-cadmin-input",value:o,placeholder:"my-new-entry",onChange:$=>u($.target.value)})]}),F.map(($,q)=>O.jsxs(ee.Fragment,{children:[$.heading?O.jsx("div",{className:"nua-cadmin-form-heading",children:$.heading}):null,$.fields.map(ue=>O.jsxs("div",{className:`nua-cadmin-field${ue.role?` nua-cadmin-field-${ue.role}`:""}`,children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:rM(ue)}),O.jsxs("span",{className:"nua-cadmin-field-type",children:[ue.type,ue.required?" · required":""]})]}),O.jsx(n0,{field:ue,value:c.frontmatter[ue.name],onChange:ae=>C(ue.name,ae),ctx:z})]},ue.name))]},`block-${q}`)),U?null:O.jsxs("div",{className:"nua-cadmin-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:"Body"}),O.jsx("span",{className:"nua-cadmin-field-type",children:"markdown"})]}),O.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:10,onChange:$=>h(q=>({...q,body:$.target.value}))})]}),y?O.jsx("div",{className:"nua-cadmin-media-error",children:y}):null,O.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",disabled:d,onClick:i,children:"Cancel"}),O.jsx("span",{className:"nua-cadmin-spacer"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",disabled:d,onClick:()=>{_()},children:d?"Creating…":"Create entry"})]})]})}const qX=700;function HX({field:t,draft:e,onField:n,ctx:r}){return O.jsxs("div",{className:`nua-cadmin-field${t.width==="half"?" nua-cadmin-field-half":""}${t.role?` nua-cadmin-field-${t.role}`:""}`,children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:rM(t)}),O.jsxs("span",{className:"nua-cadmin-field-type",children:[t.type,t.required?" · required":""]})]}),t.help?O.jsx("div",{className:"nua-cadmin-field-help",children:t.help}):null,O.jsx(n0,{field:t,value:e.frontmatter[t.name],onChange:i=>n(t.name,i),ctx:r})]})}function fh({fields:t,draft:e,onField:n,ctx:r}){return O.jsx("div",{className:"nua-cadmin-field-grid",children:t.map(i=>O.jsx(HX,{field:i,draft:e,onField:n,ctx:r},i.name))})}function KX({sections:t,display:e,draft:n,onField:r,ctx:i}){const[s,o]=ee.useState(0);if(e==="tabs"){const u=t[Math.min(s,t.length-1)];return O.jsxs("div",{className:"nua-cadmin-tabs",children:[O.jsx("div",{className:"nua-cadmin-tabbar",role:"tablist",children:t.map((c,h)=>O.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"},`section-${h}`))}),u?O.jsx(fh,{fields:u.fields,draft:n,onField:r,ctx:i}):null]})}return O.jsx(O.Fragment,{children:t.map((u,c)=>u.title===void 0?O.jsx(fh,{fields:u.fields,draft:n,onField:r,ctx:i},`section-${c}`):O.jsxs("details",{className:"nua-cadmin-section",open:!u.collapsed,children:[O.jsx("summary",{className:"nua-cadmin-section-summary",children:u.title}),O.jsx("div",{className:"nua-cadmin-section-body",children:O.jsx(fh,{fields:u.fields,draft:n,onField:r,ctx:i})})]},`section-${c}`))})}function GX({onUseServer:t,onUseOurs:e,onDismiss:n}){return O.jsx("div",{className:"nua-cadmin-dialog-backdrop",role:"dialog","aria-modal":"true","aria-label":"Edit conflict",children:O.jsxs("div",{className:"nua-cadmin-dialog",children:[O.jsx("div",{className:"nua-cadmin-dialog-title",children:"This entry changed elsewhere"}),O.jsx("div",{className:"nua-cadmin-dialog-body",children:"Someone (or the agent) edited this entry after you opened it. Choose which version to keep."}),O.jsxs("div",{className:"nua-cadmin-dialog-actions",children:[O.jsx("button",{type:"button",className:"nua-cadmin-btn",onClick:t,children:"Use server version"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:e,children:"Keep my changes"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:n,children:"Keep editing"})]})]})})}function YX({status:t}){switch(t.kind){case"saving":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saving",children:"Saving…"});case"saved":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saved",children:"Saved"});case"conflict":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-conflict",children:"Conflict"});case"error":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-error",children:t.message});default:return null}}function WX({client:t,definition:e,collection:n,slug:r,onDeleted:i,onRenamed:s}){const o=ee.useMemo(()=>e?.fields??[],[e]),u=e?.fileExtension==="mdx",[c,h]=ee.useState(null),[d,g]=ee.useState(null),[y,b]=ee.useState({kind:"idle"}),[k,w]=ee.useState([]),[N,T]=ee.useState([]),F=ee.useMemo(()=>JL(t,n,r),[t,n,r]),V=ee.useRef(null);V.current=c;const H=ee.useRef(null),z=ee.useMemo(()=>({client:t,collection:n,slug:r}),[t,n,r]),C=ee.useMemo(()=>({collection:n,entry:r}),[n,r]);ee.useEffect(()=>{let P=!0;return F.reset(),h(null),g(null),b({kind:"idle"}),t.getEntry(n,r).then(te=>{P&&h(LL(te,o))},te=>{P&&g(te instanceof Error?te:new Error(String(te)))}),()=>{P=!1,H.current&&clearTimeout(H.current)}},[t,n,r,o,F]),ee.useEffect(()=>{if(!u)return;let P=!0;return t.getComponents().then(te=>{P&&w(te)},()=>{P&&w([])}),()=>{P=!1}},[t,u]),ee.useEffect(()=>{if(!u)return;let P=!0;return t.getConfig().then(te=>{P&&T(te.listStyles??[])},()=>{P&&T([])}),()=>{P=!1}},[t,u]);const _=ee.useCallback(async(P,te)=>{const L=tM(o,P.frontmatter);if(L.length>0){b({kind:"error",message:`Not saved — ${nM(L)}`});return}b({kind:"saving"});const xe=await te(P);xe.status==="conflict"?b({kind:"conflict",conflict:xe.conflict}):xe.status==="error"?b({kind:"error",message:xe.message}):b({kind:"saved"})},[o]),U=ee.useCallback(P=>{H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{_(P,F.save)},qX)},[_,F]),$=ee.useCallback((P,te)=>{h(L=>{if(!L)return L;const xe=eM(L,P,te);return U(xe),xe})},[U]),q=ee.useCallback(P=>{h(te=>{if(!te)return te;const L={...te,body:P};return U(L),L})},[U]),ue=ee.useCallback(()=>{y.kind==="conflict"&&(h(F.adoptServer(y.conflict,o)),b({kind:"saved"}))},[y,o,F]),ae=ee.useCallback(()=>{if(y.kind!=="conflict")return;const P=V.current,{conflict:te}=y;P&&_(P,L=>F.overwrite(L,te))},[y,_,F]),Se=ee.useCallback(()=>{y.kind==="conflict"&&b({kind:"idle"})},[y]),Ee=ee.useCallback(async()=>{if(!(typeof window<"u"&&!window.confirm(`Delete entry "${r}"? This cannot be undone.`)))try{await t.deleteEntry(n,r),i()}catch(P){b({kind:"error",message:P instanceof Ni?P.message:"Delete failed"})}},[t,n,r,i]),Y=ee.useCallback(async()=>{if(typeof window>"u")return;const P=window.prompt("Rename entry to (new slug):",r);if(!(P===null||P.trim()===""||P===r))try{await t.renameEntry(n,r,P.trim()),s(P.trim())}catch(te){b({kind:"error",message:te instanceof Ni?te.message:"Rename failed"})}},[t,n,r,s]);if(d)return O.jsxs("div",{className:"nua-cadmin-error",children:[O.jsx("div",{className:"nua-cadmin-error-title",children:"Could not load entry"}),O.jsx("div",{children:d.message})]});if(!c)return O.jsxs("div",{className:"nua-cadmin-state",children:[O.jsx("div",{className:"nua-cadmin-spinner"}),O.jsx("div",{children:"Loading entry…"})]});const{title:X,header:le,sidebar:Ce,sections:_e,display:j}=iM(o,e?.layout);return O.jsxs("div",{className:"nua-cadmin-editor",children:[O.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[O.jsx(YX,{status:y}),O.jsx("span",{className:"nua-cadmin-spacer"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:()=>{Y()},children:"Rename"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-danger",onClick:()=>{Ee()},children:"Delete"})]}),X||le.length>0?O.jsx("div",{className:"nua-cadmin-editor-header-fields",children:O.jsx(fh,{fields:X?[X,...le]:le,draft:c,onField:$,ctx:z})}):null,O.jsxs("div",{className:"nua-cadmin-editor-grid",children:[O.jsxs("div",{className:"nua-cadmin-editor-main",children:[O.jsx(KX,{sections:_e,display:j,draft:c,onField:$,ctx:z}),e?.type!=="data"?O.jsxs("div",{className:"nua-cadmin-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:"Body"}),O.jsx("span",{className:"nua-cadmin-field-type",children:u?"mdx":"markdown"})]}),u?O.jsx(r6,{value:c.body,onChange:q,components:k,listStyles:N,media:t,mediaContext:C}):O.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:16,onChange:P=>q(P.target.value)})]}):null]}),Ce.length>0?O.jsx("div",{className:"nua-cadmin-editor-sidebar",children:O.jsx(fh,{fields:Ce,draft:c,onField:$,ctx:z})}):null]}),y.kind==="conflict"?O.jsx(GX,{onUseServer:ue,onUseOurs:ae,onDismiss:Se}):null]})}function GT(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 XX(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 YT(t,e){const[n,r]=ee.useState({data:null,error:null,loading:!0,settled:!1}),[i,s]=ee.useState(0),o=ee.useRef(t);o.current=t;const u=[...e,i],c=ee.useRef(null);ee.useEffect(()=>{let d=!0;const g=c.current,y=g!==null&&g.length===e.length&&g.every((b,k)=>Object.is(b,e[k]));return c.current=e,r(b=>({data:null,error:null,loading:!0,settled:y&&b.settled})),o.current().then(b=>{d&&r({data:b,error:null,loading:!1,settled:!0})},b=>{d&&r({data:null,error:b instanceof Error?b:new Error(String(b)),loading:!1,settled:!0})}),()=>{d=!1}},u);const h=ee.useCallback(()=>s(d=>d+1),[]);return{...n,reload:h}}function QX({label:t}){return O.jsxs("div",{className:"nua-cadmin-state",children:[O.jsx("div",{className:"nua-cadmin-spinner"}),O.jsx("div",{children:t})]})}function s6({error:t,onRetry:e}){const n=t instanceof Ni&&t.isUnauthorized?"Session expired":t instanceof Ni&&t.isForbidden?"No access":"Something went wrong";return O.jsxs("div",{className:"nua-cadmin-error",children:[O.jsx("div",{className:"nua-cadmin-error-title",children:n}),O.jsx("div",{children:t.message}),e?O.jsx("button",{type:"button",className:"nua-cadmin-retry",onClick:e,children:"Try again"}):null]})}function a6({label:t}){return O.jsx("div",{className:"nua-cadmin-state",children:t})}function ZX({collections:t,locale:e,loading:n,error:r,activeCollection:i,onSelect:s,onReload:o,onClose:u}){const c=kL(t,{locale:e}),h=(d,g)=>O.jsxs("button",{type:"button",className:`nua-cadmin-nav-item${d.name===i?" is-active":""}`,style:g>0?{paddingLeft:12+g*14}:void 0,onClick:()=>s(d.name),title:d.name,children:[O.jsx("span",{className:"nua-cadmin-nav-label",children:d.label||d.name}),O.jsx("span",{className:"nua-cadmin-nav-count",children:d.entryCount})]},d.name);return O.jsxs("aside",{className:"nua-cadmin-sidebar",children:[O.jsxs("div",{className:"nua-cadmin-sidebar-head",children:[O.jsx("span",{className:"nua-cadmin-brand",children:"Collections"}),u?O.jsx("button",{type:"button",className:"nua-cadmin-close","aria-label":"Close",onClick:u,children:"×"}):null]}),O.jsxs("nav",{className:"nua-cadmin-nav",children:[n?O.jsx("div",{className:"nua-cadmin-nav-state",children:"Loading…"}):null,r?O.jsx("button",{type:"button",className:"nua-cadmin-nav-state nua-cadmin-nav-error",onClick:o,children:"Failed to load — retry"}):null,!n&&!r&&c.length===0?O.jsx("div",{className:"nua-cadmin-nav-state",children:"No content types"}):null,!n&&!r?c.flatMap(d=>[d.group?O.jsx("div",{className:"nua-cadmin-nav-group",children:d.group},`group:${d.group}`):null,...d.items.flatMap(({collection:g,children:y})=>[h(g,0),...y.map(b=>h(b,1))])]):null]})]})}const eQ=50,tQ="slug,title,draft,pathname";function nQ({client:t,collection:e,onOpen:n,onCreate:r,onRetry:i}){const[s,o]=ee.useState([]),[u,c]=ee.useState(void 0),[h,d]=ee.useState(!1),[g,y]=ee.useState(null),[b,k]=ee.useState(!0),[w,N]=ee.useState(!1),T=ee.useCallback(async(V,H)=>{H?N(!0):k(!0),y(null);try{const z=await t.getEntries(e,{fields:tQ,draft:"all",limit:eQ,cursor:V});o(C=>H?[...C,...z.entries]:z.entries),c(z.cursor),d(z.hasMore)}catch(z){y(z instanceof Error?z:new Error(String(z)))}finally{k(!1),N(!1)}},[t,e]);if(ee.useEffect(()=>{o([]),c(void 0),d(!1),T(void 0,!1)},[T]),b)return O.jsx(QX,{label:"Loading entries…"});if(g)return O.jsx(s6,{error:g,onRetry:()=>{i(),T(void 0,!1)}});const F=O.jsx("div",{className:"nua-cadmin-entries-toolbar",children:O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:r,children:"+ New entry"})});return s.length===0?O.jsxs("div",{children:[F,O.jsx(a6,{label:"This collection has no entries."})]}):O.jsxs("div",{children:[F,O.jsxs("table",{className:"nua-cadmin-table",children:[O.jsx("thead",{children:O.jsxs("tr",{children:[O.jsx("th",{children:"Slug"}),O.jsx("th",{children:"Title"}),O.jsx("th",{children:"Draft"}),O.jsx("th",{children:"Pathname"})]})}),O.jsx("tbody",{children:s.map(V=>O.jsxs("tr",{className:"nua-cadmin-row",onClick:()=>n(V.slug),children:[O.jsx("td",{className:"nua-cadmin-cell-mono",children:V.slug}),O.jsx("td",{children:V.title??O.jsx("span",{className:"nua-cadmin-field-empty",children:"—"})}),O.jsx("td",{children:V.draft?O.jsx("span",{className:"nua-cadmin-badge nua-cadmin-badge-draft",children:"draft"}):""}),O.jsx("td",{className:"nua-cadmin-cell-mono",children:V.pathname??"—"})]},V.slug))})]}),h?O.jsx("button",{type:"button",className:"nua-cadmin-load-more",disabled:w,onClick:()=>{T(u,!0)},children:w?"Loading…":"Load more"}):null]})}function rQ({apiBase:t,onClose:e}){const n=ee.useMemo(()=>RL(t),[t]),[r,i]=ee.useState(()=>typeof window<"u"?GT(window.location.hash):{view:"list"});ee.useEffect(()=>{const T=()=>i(GT(window.location.hash));return window.addEventListener("hashchange",T),T(),()=>window.removeEventListener("hashchange",T)},[]);const s=ee.useCallback(T=>{const F=XX(T);typeof window<"u"&&window.location.hash!==F?window.location.hash=F:i(T)},[]),o=YT(()=>n.getCollections(),[n]),u=o.data??[],c=YT(()=>n.getConfig(),[n]),h=ee.useCallback(()=>{c.data||c.reload()},[c.data,c.reload]),d=ee.useCallback(()=>{o.reload(),h()},[o.reload,h]),g=r.view!=="list"?r.collection:void 0,y=g?u.find(T=>T.name===g):void 0,b=y?y.label||y.name:g??"",k=ee.useCallback(T=>s({view:"entries",collection:T}),[s]),w=ee.useCallback((T,F)=>s({view:"detail",collection:T,slug:F}),[s]),N=ee.useCallback(T=>s({view:"create",collection:T}),[s]);return O.jsxs("div",{className:"nua-cadmin",children:[O.jsx(ZX,{collections:u,locale:c.data?.locale,loading:o.loading||!c.settled,error:o.error,activeCollection:g,onSelect:k,onReload:d,onClose:e}),O.jsxs("main",{className:"nua-cadmin-main",children:[O.jsxs("div",{className:"nua-cadmin-header",children:[r.view==="detail"||r.view==="create"?O.jsxs("button",{type:"button",className:"nua-cadmin-back",onClick:()=>k(r.collection),children:["← ",b]}):null,O.jsxs("h2",{className:"nua-cadmin-title",children:[r.view==="list"?"Content":b,r.view==="detail"?O.jsxs("span",{className:"nua-cadmin-crumb",children:["/ ",r.slug]}):null,r.view==="create"?O.jsx("span",{className:"nua-cadmin-crumb",children:"/ new entry"}):null]}),O.jsx("span",{className:"nua-cadmin-spacer"})]}),O.jsxs("div",{className:"nua-cadmin-body",children:[r.view==="list"?o.error?O.jsx(s6,{error:o.error,onRetry:d}):O.jsx(a6,{label:"Pick a content type from the left to browse its entries."}):null,r.view==="entries"?O.jsx(nQ,{client:n,collection:r.collection,onOpen:T=>w(r.collection,T),onCreate:()=>N(r.collection),onRetry:h}):null,r.view==="detail"?O.jsx(WX,{client:n,definition:y,collection:r.collection,slug:r.slug,onDeleted:()=>k(r.collection),onRenamed:T=>w(r.collection,T)},`${r.collection}/${r.slug}`):null,r.view==="create"?O.jsx(JX,{client:n,definition:y,collection:r.collection,onCreated:T=>w(r.collection,T),onCancel:()=>k(r.collection)}):null]})]})]})}const o6=document.getElementById("nua-studio-root");if(!o6)throw new Error("[cms-studio] #nua-studio-root container is missing");Rk.createRoot(o6).render(O.jsx(ee.StrictMode,{children:O.jsx(rQ,{apiBase:"/cms/v1"})}));
|