showai-reader 0.10.0-reader.bq5ur7fq → 0.10.0-reader.bruh3fta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/chunks/{RichTextEditor-OKCGVTHB.js → RichTextEditor-FAC5TTMX.js} +1 -1
- package/chunks/chunk-UG6UQRP5.js +9 -0
- package/index.js +1 -1
- package/manifest.json +4 -4
- package/package.json +1 -1
- package/{reader-BQ5UR7FQ.js → reader-BRUH3FTA.js} +34 -34
- package/chunks/chunk-OEX4DPAT.js +0 -9
- /package/{reader-BQ5UR7FQ.js.LEGAL.txt → reader-BRUH3FTA.js.LEGAL.txt} +0 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The [ShowAI](https://showai.renaissancemind.ai) page reader, built from ShowAI 0.10.0 as code-split ES modules. Inline conversation pages written by `render-artifact --cdn` import it and load each component's code only when the page uses it.
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
|
-
const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.10.0-reader.
|
|
6
|
+
const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.10.0-reader.bruh3fta/index.js");
|
|
7
7
|
mount(document.getElementById("page"), { artifact });
|
|
8
8
|
```
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Hs,d as _s,eb as ku,jb as Bo,kb as He,lb as zo,mb as vu,nb as Eu,ob as Mu,ua as nn,va as Vs,wa as pu,ya as hu}from"./chunk-OEX4DPAT.js";import"./chunk-3RZMLHCB.js";import"./chunk-JXKAISUX.js";import"./chunk-C4JCEMQN.js";import{A as rn,B as _r,C as U,D as te,E as bu,G as yu,K as Ws,d as V,e as mu,f as ce,g as Do,h as js,i as Nn,j as Rn,k as Oo,l as gu,m as Dn,n as St,o as Pt,p as or,q as ht,r as kt,s as ir,t as Lo,u as Io,v as Po,w as X,x as Fs,y as O,z as j}from"./chunk-KQR52I3G.js";import"./chunk-SNEZ3O5V.js";import"./chunk-77DN5DLU.js";import"./chunk-AIBH6MTQ.js";import"./chunk-RKCLMBWU.js";import"./chunk-RQY45SXE.js";import"./chunk-UAOQCK47.js";import{a as Ks,b as Ho,c as Cu,e as xu}from"./chunk-7G6RMB6W.js";import{a as jg,b as Fg}from"./chunk-KK52BZYB.js";import"./chunk-GLP5VV7P.js";import{a as wu}from"./chunk-5AW2WUSZ.js";import{a as Au}from"./chunk-7MEMPQN4.js";import"./chunk-DG67SWQA.js";import"./chunk-KF47DKNH.js";import{$ as Uc,$a as Mn,A as zr,Ab as Le,B as Eo,Bb as Su,Da as tn,G as zc,Ga as Os,H as Hc,Ha as eu,J as _c,K as Vc,M as jc,O as Fc,Oa as Ls,P as Wc,Pa as Is,Qa as tu,Ta as nu,Va as Ps,Wa as ru,Xa as $s,Ya as ou,Z as Kc,Za as iu,_a as Bs,a as Oc,aa as qc,ab as An,ba as Gc,bb as su,c as en,ca as Jc,cb as Tn,da as Mo,db as No,eb as Ro,fa as Xc,fb as lu,gb as au,ib as cu,ja as Ao,ka as Rs,lb as Hr,m as Lc,ma as Ds,mb as Ze,nb as zs,o as Ic,q as Pc,r as Ns,ra as Yc,s as $c,sa as To,ta as Qc,tb as uu,ub as du,xb as fu,ya as Zc,z as Bc}from"./chunk-XBPILGCT.js";import{a as $o,f as sr}from"./chunk-J6IRWTF7.js";import{a as Vg,c as we}from"./chunk-DCANE7XH.js";var Zm=Vg((QT,Qm)=>{function _m(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&_m(n)}),e}var vs=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Vm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function bn(e,...t){let n=Object.create(null);for(let r in e)n[r]=e[r];return t.forEach(function(r){for(let o in r)n[o]=r[o]}),n}var qx="</span>",Im=e=>!!e.scope,Gx=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return`${t}${e}`},fc=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Vm(t)}openNode(t){if(!Im(t))return;let n=Gx(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Im(t)&&(this.buffer+=qx)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}},Pm=(e={})=>{let t={children:[]};return Object.assign(t,e),t},pc=class e{constructor(){this.rootNode=Pm(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=Pm({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},hc=class extends pc{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new fc(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Co(e){return e?typeof e=="string"?e:e.source:null}function jm(e){return nr("(?=",e,")")}function Jx(e){return nr("(?:",e,")*")}function Xx(e){return nr("(?:",e,")?")}function nr(...e){return e.map(n=>Co(n)).join("")}function Yx(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function xs(...e){return"("+(Yx(e).capture?"":"?:")+e.map(r=>Co(r)).join("|")+")"}function Fm(e){return new RegExp(e.toString()+"|").exec("").length-1}function Qx(e,t){let n=e&&e.exec(t);return n&&n.index===0}var Zx=new RegExp(xs(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function gc(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;let o=n,i=Co(r),s="";for(;i.length>0;){let l=Zx.exec(i);if(!l){s+=i;break}s+=i.substring(0,l.index),i=i.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+o):(s+=l[0],(l[0]==="("||/^\(\?[<']/.test(l[0]))&&n++)}return s}).map(r=>`(${r})`).join(t)}var eS=/\b\B/,Wm="[a-zA-Z]\\w*",bc="[a-zA-Z_]\\w*",Km="\\b\\d+(\\.\\d+)?",Um="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",qm="\\b(0b[01]+)",tS="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",nS=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=nr(t,/.*\b/,e.binary,/\b.*/)),bn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},xo={begin:"\\\\[\\s\\S]",relevance:0},rS={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[xo]},oS={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[xo]},iS={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Ss=function(e,t,n={}){let r=bn({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let o=xs("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:nr(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},sS=Ss("//","$"),lS=Ss("/\\*","\\*/"),aS=Ss("#","$"),cS={scope:"number",begin:Km,relevance:0},uS={scope:"number",begin:Um,relevance:0},dS={scope:"number",begin:qm,relevance:0},fS={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[xo,{begin:/\[/,end:/\]/,relevance:0,contains:[xo]}]},pS={scope:"title",begin:Wm,relevance:0},hS={scope:"title",begin:bc,relevance:0},mS={begin:"\\.\\s*"+bc,relevance:0},gS=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},ks=Object.freeze({__proto__:null,APOS_STRING_MODE:rS,BACKSLASH_ESCAPE:xo,BINARY_NUMBER_MODE:dS,BINARY_NUMBER_RE:qm,COMMENT:Ss,C_BLOCK_COMMENT_MODE:lS,C_LINE_COMMENT_MODE:sS,C_NUMBER_MODE:uS,C_NUMBER_RE:Um,END_SAME_AS_BEGIN:gS,HASH_COMMENT_MODE:aS,IDENT_RE:Wm,MATCH_NOTHING_RE:eS,METHOD_GUARD:mS,NUMBER_MODE:cS,NUMBER_RE:Km,PHRASAL_WORDS_MODE:iS,QUOTE_STRING_MODE:oS,REGEXP_MODE:fS,RE_STARTERS_RE:tS,SHEBANG:nS,TITLE_MODE:pS,UNDERSCORE_IDENT_RE:bc,UNDERSCORE_TITLE_MODE:hS});function bS(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function yS(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function wS(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=bS,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function kS(e,t){Array.isArray(e.illegal)&&(e.illegal=xs(...e.illegal))}function vS(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function CS(e,t){e.relevance===void 0&&(e.relevance=1)}var xS=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=nr(n.beforeMatch,jm(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},SS=["of","and","for","in","not","or","if","then","parent","list","value"],ES="keyword";function Gm(e,t,n=ES){let r=Object.create(null);return typeof e=="string"?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Gm(e[i],t,i))}),r;function o(i,s){t&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let a=l.split("|");r[a[0]]=[i,MS(a[0],a[1])]})}}function MS(e,t){return t?Number(t):AS(e)?0:1}function AS(e){return SS.includes(e.toLowerCase())}var $m={},tr=e=>{console.error(e)},Bm=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Or=(e,t)=>{$m[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),$m[`${e}/${t}`]=!0)},Cs=new Error;function Jm(e,t,{key:n}){let r=0,o=e[n],i={},s={};for(let l=1;l<=t.length;l++)s[l+r]=o[l],i[l+r]=!0,r+=Fm(t[l-1]);e[n]=s,e[n]._emit=i,e[n]._multi=!0}function TS(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw tr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Cs;if(typeof e.beginScope!="object"||e.beginScope===null)throw tr("beginScope must be object"),Cs;Jm(e,e.begin,{key:"beginScope"}),e.begin=gc(e.begin,{joinWith:""})}}function NS(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw tr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Cs;if(typeof e.endScope!="object"||e.endScope===null)throw tr("endScope must be object"),Cs;Jm(e,e.end,{key:"endScope"}),e.end=gc(e.end,{joinWith:""})}}function RS(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function DS(e){RS(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),TS(e),NS(e)}function OS(e){function t(s,l){return new RegExp(Co(s),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,a){a.position=this.position++,this.matchIndexes[this.matchAt]=a,this.regexes.push([a,l]),this.matchAt+=Fm(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(a=>a[1]);this.matcherRe=t(gc(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let a=this.matcherRe.exec(l);if(!a)return null;let u=a.findIndex((d,f)=>f>0&&d!==void 0),c=this.matchIndexes[u];return a.splice(0,u),Object.assign(a,c)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let a=new n;return this.rules.slice(l).forEach(([u,c])=>a.addRule(u,c)),a.compile(),this.multiRegexes[l]=a,a}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,a){this.rules.push([l,a]),a.type==="begin"&&this.count++}exec(l){let a=this.getMatcher(this.regexIndex);a.lastIndex=this.lastIndex;let u=a.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){let c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function o(s){let l=new r;return s.contains.forEach(a=>l.addRule(a.begin,{rule:a,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function i(s,l){let a=s;if(s.isCompiled)return a;[yS,vS,DS,xS].forEach(c=>c(s,l)),e.compilerExtensions.forEach(c=>c(s,l)),s.__beforeBegin=null,[wS,kS,CS].forEach(c=>c(s,l)),s.isCompiled=!0;let u=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),u=s.keywords.$pattern,delete s.keywords.$pattern),u=u||/\w+/,s.keywords&&(s.keywords=Gm(s.keywords,e.case_insensitive)),a.keywordPatternRe=t(u,!0),l&&(s.begin||(s.begin=/\B|\b/),a.beginRe=t(a.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(a.endRe=t(a.end)),a.terminatorEnd=Co(a.end)||"",s.endsWithParent&&l.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(a.illegalRe=t(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(c){return LS(c==="self"?s:c)})),s.contains.forEach(function(c){i(c,a)}),s.starts&&i(s.starts,l),a.matcher=o(a),a}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=bn(e.classNameAliases||{}),i(e)}function Xm(e){return e?e.endsWithParent||Xm(e.starts):!1}function LS(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return bn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Xm(e)?bn(e,{starts:e.starts?bn(e.starts):null}):Object.isFrozen(e)?bn(e):e}var IS="11.12.0",mc=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},dc=Vm,zm=bn,Hm=Symbol("nomatch"),PS=7,Ym=function(e){let t=Object.create(null),n=Object.create(null),r=[],o=!0,i="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:hc};function a(T){return l.noHighlightRe.test(T)}function u(T){let H=T.className+" ";H+=T.parentNode?T.parentNode.className:"";let I=l.languageDetectRe.exec(H);if(I){let ae=L(I[1]);return ae||(Bm(i.replace("{}",I[1])),Bm("Falling back to no-highlight mode for this block.",T)),ae?I[1]:"no-highlight"}return H.split(/\s+/).find(ae=>a(ae)||L(ae))}function c(T,H,I){let ae="",ye="";typeof H=="object"?(ae=T,I=H.ignoreIllegals,ye=H.language):(Or("10.7.0","highlight(lang, code, ...args) has been deprecated."),Or("10.7.0",`Please use highlight(code, options) instead.
|
|
1
|
+
import{c as Hs,d as _s,eb as ku,jb as Bo,kb as He,lb as zo,mb as vu,nb as Eu,ob as Mu,ua as nn,va as Vs,wa as pu,ya as hu}from"./chunk-UG6UQRP5.js";import"./chunk-3RZMLHCB.js";import"./chunk-JXKAISUX.js";import"./chunk-C4JCEMQN.js";import{A as rn,B as _r,C as U,D as te,E as bu,G as yu,K as Ws,d as V,e as mu,f as ce,g as Do,h as js,i as Nn,j as Rn,k as Oo,l as gu,m as Dn,n as St,o as Pt,p as or,q as ht,r as kt,s as ir,t as Lo,u as Io,v as Po,w as X,x as Fs,y as O,z as j}from"./chunk-KQR52I3G.js";import"./chunk-SNEZ3O5V.js";import"./chunk-77DN5DLU.js";import"./chunk-AIBH6MTQ.js";import"./chunk-RKCLMBWU.js";import"./chunk-RQY45SXE.js";import"./chunk-UAOQCK47.js";import{a as Ks,b as Ho,c as Cu,e as xu}from"./chunk-7G6RMB6W.js";import{a as jg,b as Fg}from"./chunk-KK52BZYB.js";import"./chunk-GLP5VV7P.js";import{a as wu}from"./chunk-5AW2WUSZ.js";import{a as Au}from"./chunk-7MEMPQN4.js";import"./chunk-DG67SWQA.js";import"./chunk-KF47DKNH.js";import{$ as Uc,$a as Mn,A as zr,Ab as Le,B as Eo,Bb as Su,Da as tn,G as zc,Ga as Os,H as Hc,Ha as eu,J as _c,K as Vc,M as jc,O as Fc,Oa as Ls,P as Wc,Pa as Is,Qa as tu,Ta as nu,Va as Ps,Wa as ru,Xa as $s,Ya as ou,Z as Kc,Za as iu,_a as Bs,a as Oc,aa as qc,ab as An,ba as Gc,bb as su,c as en,ca as Jc,cb as Tn,da as Mo,db as No,eb as Ro,fa as Xc,fb as lu,gb as au,ib as cu,ja as Ao,ka as Rs,lb as Hr,m as Lc,ma as Ds,mb as Ze,nb as zs,o as Ic,q as Pc,r as Ns,ra as Yc,s as $c,sa as To,ta as Qc,tb as uu,ub as du,xb as fu,ya as Zc,z as Bc}from"./chunk-XBPILGCT.js";import{a as $o,f as sr}from"./chunk-J6IRWTF7.js";import{a as Vg,c as we}from"./chunk-DCANE7XH.js";var Zm=Vg((QT,Qm)=>{function _m(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&_m(n)}),e}var vs=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Vm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function bn(e,...t){let n=Object.create(null);for(let r in e)n[r]=e[r];return t.forEach(function(r){for(let o in r)n[o]=r[o]}),n}var qx="</span>",Im=e=>!!e.scope,Gx=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return`${t}${e}`},fc=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Vm(t)}openNode(t){if(!Im(t))return;let n=Gx(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Im(t)&&(this.buffer+=qx)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}},Pm=(e={})=>{let t={children:[]};return Object.assign(t,e),t},pc=class e{constructor(){this.rootNode=Pm(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=Pm({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},hc=class extends pc{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new fc(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Co(e){return e?typeof e=="string"?e:e.source:null}function jm(e){return nr("(?=",e,")")}function Jx(e){return nr("(?:",e,")*")}function Xx(e){return nr("(?:",e,")?")}function nr(...e){return e.map(n=>Co(n)).join("")}function Yx(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function xs(...e){return"("+(Yx(e).capture?"":"?:")+e.map(r=>Co(r)).join("|")+")"}function Fm(e){return new RegExp(e.toString()+"|").exec("").length-1}function Qx(e,t){let n=e&&e.exec(t);return n&&n.index===0}var Zx=new RegExp(xs(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function gc(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;let o=n,i=Co(r),s="";for(;i.length>0;){let l=Zx.exec(i);if(!l){s+=i;break}s+=i.substring(0,l.index),i=i.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+o):(s+=l[0],(l[0]==="("||/^\(\?[<']/.test(l[0]))&&n++)}return s}).map(r=>`(${r})`).join(t)}var eS=/\b\B/,Wm="[a-zA-Z]\\w*",bc="[a-zA-Z_]\\w*",Km="\\b\\d+(\\.\\d+)?",Um="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",qm="\\b(0b[01]+)",tS="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",nS=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=nr(t,/.*\b/,e.binary,/\b.*/)),bn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},xo={begin:"\\\\[\\s\\S]",relevance:0},rS={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[xo]},oS={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[xo]},iS={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Ss=function(e,t,n={}){let r=bn({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let o=xs("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:nr(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},sS=Ss("//","$"),lS=Ss("/\\*","\\*/"),aS=Ss("#","$"),cS={scope:"number",begin:Km,relevance:0},uS={scope:"number",begin:Um,relevance:0},dS={scope:"number",begin:qm,relevance:0},fS={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[xo,{begin:/\[/,end:/\]/,relevance:0,contains:[xo]}]},pS={scope:"title",begin:Wm,relevance:0},hS={scope:"title",begin:bc,relevance:0},mS={begin:"\\.\\s*"+bc,relevance:0},gS=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},ks=Object.freeze({__proto__:null,APOS_STRING_MODE:rS,BACKSLASH_ESCAPE:xo,BINARY_NUMBER_MODE:dS,BINARY_NUMBER_RE:qm,COMMENT:Ss,C_BLOCK_COMMENT_MODE:lS,C_LINE_COMMENT_MODE:sS,C_NUMBER_MODE:uS,C_NUMBER_RE:Um,END_SAME_AS_BEGIN:gS,HASH_COMMENT_MODE:aS,IDENT_RE:Wm,MATCH_NOTHING_RE:eS,METHOD_GUARD:mS,NUMBER_MODE:cS,NUMBER_RE:Km,PHRASAL_WORDS_MODE:iS,QUOTE_STRING_MODE:oS,REGEXP_MODE:fS,RE_STARTERS_RE:tS,SHEBANG:nS,TITLE_MODE:pS,UNDERSCORE_IDENT_RE:bc,UNDERSCORE_TITLE_MODE:hS});function bS(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function yS(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function wS(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=bS,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function kS(e,t){Array.isArray(e.illegal)&&(e.illegal=xs(...e.illegal))}function vS(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function CS(e,t){e.relevance===void 0&&(e.relevance=1)}var xS=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=nr(n.beforeMatch,jm(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},SS=["of","and","for","in","not","or","if","then","parent","list","value"],ES="keyword";function Gm(e,t,n=ES){let r=Object.create(null);return typeof e=="string"?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Gm(e[i],t,i))}),r;function o(i,s){t&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let a=l.split("|");r[a[0]]=[i,MS(a[0],a[1])]})}}function MS(e,t){return t?Number(t):AS(e)?0:1}function AS(e){return SS.includes(e.toLowerCase())}var $m={},tr=e=>{console.error(e)},Bm=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Or=(e,t)=>{$m[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),$m[`${e}/${t}`]=!0)},Cs=new Error;function Jm(e,t,{key:n}){let r=0,o=e[n],i={},s={};for(let l=1;l<=t.length;l++)s[l+r]=o[l],i[l+r]=!0,r+=Fm(t[l-1]);e[n]=s,e[n]._emit=i,e[n]._multi=!0}function TS(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw tr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Cs;if(typeof e.beginScope!="object"||e.beginScope===null)throw tr("beginScope must be object"),Cs;Jm(e,e.begin,{key:"beginScope"}),e.begin=gc(e.begin,{joinWith:""})}}function NS(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw tr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Cs;if(typeof e.endScope!="object"||e.endScope===null)throw tr("endScope must be object"),Cs;Jm(e,e.end,{key:"endScope"}),e.end=gc(e.end,{joinWith:""})}}function RS(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function DS(e){RS(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),TS(e),NS(e)}function OS(e){function t(s,l){return new RegExp(Co(s),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,a){a.position=this.position++,this.matchIndexes[this.matchAt]=a,this.regexes.push([a,l]),this.matchAt+=Fm(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(a=>a[1]);this.matcherRe=t(gc(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let a=this.matcherRe.exec(l);if(!a)return null;let u=a.findIndex((d,f)=>f>0&&d!==void 0),c=this.matchIndexes[u];return a.splice(0,u),Object.assign(a,c)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let a=new n;return this.rules.slice(l).forEach(([u,c])=>a.addRule(u,c)),a.compile(),this.multiRegexes[l]=a,a}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,a){this.rules.push([l,a]),a.type==="begin"&&this.count++}exec(l){let a=this.getMatcher(this.regexIndex);a.lastIndex=this.lastIndex;let u=a.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){let c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function o(s){let l=new r;return s.contains.forEach(a=>l.addRule(a.begin,{rule:a,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function i(s,l){let a=s;if(s.isCompiled)return a;[yS,vS,DS,xS].forEach(c=>c(s,l)),e.compilerExtensions.forEach(c=>c(s,l)),s.__beforeBegin=null,[wS,kS,CS].forEach(c=>c(s,l)),s.isCompiled=!0;let u=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),u=s.keywords.$pattern,delete s.keywords.$pattern),u=u||/\w+/,s.keywords&&(s.keywords=Gm(s.keywords,e.case_insensitive)),a.keywordPatternRe=t(u,!0),l&&(s.begin||(s.begin=/\B|\b/),a.beginRe=t(a.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(a.endRe=t(a.end)),a.terminatorEnd=Co(a.end)||"",s.endsWithParent&&l.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(a.illegalRe=t(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(c){return LS(c==="self"?s:c)})),s.contains.forEach(function(c){i(c,a)}),s.starts&&i(s.starts,l),a.matcher=o(a),a}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=bn(e.classNameAliases||{}),i(e)}function Xm(e){return e?e.endsWithParent||Xm(e.starts):!1}function LS(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return bn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Xm(e)?bn(e,{starts:e.starts?bn(e.starts):null}):Object.isFrozen(e)?bn(e):e}var IS="11.12.0",mc=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},dc=Vm,zm=bn,Hm=Symbol("nomatch"),PS=7,Ym=function(e){let t=Object.create(null),n=Object.create(null),r=[],o=!0,i="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:hc};function a(T){return l.noHighlightRe.test(T)}function u(T){let H=T.className+" ";H+=T.parentNode?T.parentNode.className:"";let I=l.languageDetectRe.exec(H);if(I){let ae=L(I[1]);return ae||(Bm(i.replace("{}",I[1])),Bm("Falling back to no-highlight mode for this block.",T)),ae?I[1]:"no-highlight"}return H.split(/\s+/).find(ae=>a(ae)||L(ae))}function c(T,H,I){let ae="",ye="";typeof H=="object"?(ae=T,I=H.ignoreIllegals,ye=H.language):(Or("10.7.0","highlight(lang, code, ...args) has been deprecated."),Or("10.7.0",`Please use highlight(code, options) instead.
|
|
2
2
|
https://github.com/highlightjs/highlight.js/issues/2277`),ye=T,ae=H),I===void 0&&(I=!0);let ke={code:ae,language:ye};je("before:highlight",ke);let Ye=ke.result?ke.result:d(ke.language,ke.code,I);return Ye.code=ke.code,je("after:highlight",Ye),Ye}function d(T,H,I,ae){let ye=Object.create(null);function ke(D,B){return D.keywords[B]}function Ye(){if(!q.keywords){Se.addText(ie);return}let D=0;q.keywordPatternRe.lastIndex=0;let B=q.keywordPatternRe.exec(ie),J="";for(;B;){J+=ie.substring(D,B.index);let se=De.case_insensitive?B[0].toLowerCase():B[0],Oe=ke(q,se);if(Oe){let[ct,Br]=Oe;if(Se.addText(J),J="",ye[se]=(ye[se]||0)+1,ye[se]<=PS&&(vn+=Br),ct.startsWith("_"))J+=B[0];else{let It=De.classNameAliases[ct]||ct;lt(B[0],It)}}else J+=B[0];D=q.keywordPatternRe.lastIndex,B=q.keywordPatternRe.exec(ie)}J+=ie.substring(D),Se.addText(J)}function wn(){if(ie==="")return;let D=null;if(typeof q.subLanguage=="string"){if(!t[q.subLanguage]){Se.addText(ie);return}D=d(q.subLanguage,ie,!0,at[q.subLanguage]),at[q.subLanguage]=D._top}else D=p(ie,q.subLanguage.length?q.subLanguage:null);q.relevance>0&&(vn+=D.relevance),Se.__addSublanguage(D._emitter,D.language)}function Be(){q.subLanguage!=null?wn():Ye(),ie=""}function lt(D,B){D!==""&&(Se.startScope(B),Se.addText(D),Se.endScope())}function wt(D,B){let J=1,se=B.length-1;for(;J<=se;){if(!D._emit[J]){J++;continue}let Oe=De.classNameAliases[D[J]]||D[J],ct=B[J];Oe?lt(ct,Oe):(ie=ct,Ye(),ie=""),J++}}function Ir(D,B){return D.scope&&typeof D.scope=="string"&&Se.openNode(De.classNameAliases[D.scope]||D.scope),D.beginScope&&(D.beginScope._wrap?(lt(ie,De.classNameAliases[D.beginScope._wrap]||D.beginScope._wrap),ie=""):D.beginScope._multi&&(wt(D.beginScope,B),ie="")),q=Object.create(D,{parent:{value:q}}),q}function Yt(D,B,J){let se=Qx(D.endRe,J);if(se){if(D["on:end"]){let Oe=new vs(D);D["on:end"](B,Oe),Oe.isMatchIgnored&&(se=!1)}if(se){for(;D.endsParent&&D.parent;)D=D.parent;return D}}if(D.endsWithParent)return Yt(D.parent,B,J)}function Qt(D){return q.matcher.regexIndex===0?(ie+=D[0],1):(w=!0,0)}function kn(D){let B=D[0],J=D.rule,se=new vs(J),Oe=[J.__beforeBegin,J["on:begin"]];for(let ct of Oe)if(ct&&(ct(D,se),se.isMatchIgnored))return Qt(B);return J.skip?ie+=B:(J.excludeBegin&&(ie+=B),Be(),!J.returnBegin&&!J.excludeBegin&&(ie=B)),Ir(J,D),J.returnBegin?0:B.length}function pt(D){let B=D[0],J=H.substring(D.index),se=Yt(q,D,J);if(!se)return Hm;let Oe=q;q.endScope&&q.endScope._wrap?(Be(),lt(B,q.endScope._wrap)):q.endScope&&q.endScope._multi?(Be(),wt(q.endScope,D)):Oe.skip?ie+=B:(Oe.returnEnd||Oe.excludeEnd||(ie+=B),Be(),Oe.excludeEnd&&(ie=B));do q.scope&&Se.closeNode(),!q.skip&&!q.subLanguage&&(vn+=q.relevance),q=q.parent;while(q!==se.parent);return se.starts&&Ir(se.starts,D),Oe.returnEnd?0:B.length}function ee(){let D=[];for(let B=q;B!==De;B=B.parent)B.scope&&D.unshift(B.scope);D.forEach(B=>Se.openNode(B))}let Te={};function Pr(D,B){let J=B&&B[0];if(ie+=D,J==null)return Be(),0;if(Te.type==="begin"&&B.type==="end"&&Te.index===B.index&&J===""){if(ie+=H.slice(B.index,B.index+1),!o){let se=new Error(`0 width match regex (${T})`);throw se.languageName=T,se.badRule=Te.rule,se}return 1}if(Te=B,B.type==="begin")return kn(B);if(B.type==="illegal"&&!I){let se=new Error('Illegal lexeme "'+J+'" for mode "'+(q.scope||"<unnamed>")+'"');throw se.mode=q,se}else if(B.type==="end"){let se=pt(B);if(se!==Hm)return se}if(B.type==="illegal"&&J==="")return B.index===H.length||(ie+=`
|
|
3
3
|
`),1;if($r>1e5&&$r>B.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=J,J.length}let De=L(T);if(!De)throw tr(i.replace("{}",T)),new Error('Unknown language: "'+T+'"');let rr=OS(De),xt="",q=ae||rr,at={},Se=new l.__emitter(l);ee();let ie="",vn=0,Qe=0,$r=0,w=!1;try{if(De.__emitTokens)De.__emitTokens(H,Se);else{for(q.matcher.considerAll();;){$r++,w?w=!1:q.matcher.considerAll(),q.matcher.lastIndex=Qe;let D=q.matcher.exec(H);if(!D)break;let B=H.substring(Qe,D.index),J=Pr(B,D);Qe=D.index+J}Pr(H.substring(Qe))}return Se.finalize(),xt=Se.toHTML(),{language:T,value:xt,relevance:vn,illegal:!1,_emitter:Se,_top:q}}catch(D){if(D.message&&D.message.includes("Illegal"))return{language:T,value:dc(H),illegal:!0,relevance:0,_illegalBy:{message:D.message,index:Qe,context:H.slice(Qe-100,Qe+100),mode:D.mode,resultSoFar:xt},_emitter:Se};if(o)return{language:T,value:dc(H),illegal:!1,relevance:0,errorRaised:D,_emitter:Se,_top:q};throw D}}function f(T){let H={value:dc(T),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return H._emitter.addText(T),H}function p(T,H){H=H||l.languages||Object.keys(t);let I=f(T),ae=H.filter(L).filter(he).map(Be=>d(Be,T,!1));ae.unshift(I);let ye=ae.sort((Be,lt)=>{if(Be.relevance!==lt.relevance)return lt.relevance-Be.relevance;if(Be.language&<.language){if(L(Be.language).supersetOf===lt.language)return 1;if(L(lt.language).supersetOf===Be.language)return-1}return 0}),[ke,Ye]=ye,wn=ke;return wn.secondBest=Ye,wn}function h(T,H,I){let ae=H&&n[H]||I;T.classList.add("hljs"),T.classList.add(`language-${ae}`)}function g(T){let H=null,I=u(T);if(a(I))return;if(je("before:highlightElement",{el:T,language:I}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(T)),l.throwUnescapedHTML))throw new mc("One of your code blocks includes unescaped HTML.",T.innerHTML);H=T;let ae=H.textContent,ye=I?c(ae,{language:I,ignoreIllegals:!0}):p(ae);T.innerHTML=ye.value,T.dataset.highlighted="yes",h(T,I,ye.language),T.result={language:ye.language,re:ye.relevance,relevance:ye.relevance},ye.secondBest&&(T.secondBest={language:ye.secondBest.language,relevance:ye.secondBest.relevance}),je("after:highlightElement",{el:T,result:ye,text:ae})}function m(T){l=zm(l,T)}let b=()=>{S(),Or("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){S(),Or("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let C=!1;function S(){function T(){S()}if(document.readyState==="loading"){C||window.addEventListener("DOMContentLoaded",T,!1),C=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function A(T,H){let I=null;try{I=H(e)}catch(ae){if(tr("Language definition for '{}' could not be registered.".replace("{}",T)),o)tr(ae);else throw ae;I=s}I.name||(I.name=T),t[T]=I,I.rawDefinition=H.bind(null,e),I.aliases&&oe(I.aliases,{languageName:T})}function E(T){delete t[T];for(let H of Object.keys(n))n[H]===T&&delete n[H]}function M(){return Object.keys(t)}function L(T){return T=(T||"").toLowerCase(),t[T]||t[n[T]]}function oe(T,{languageName:H}){typeof T=="string"&&(T=[T]),T.forEach(I=>{n[I.toLowerCase()]=H})}function he(T){let H=L(T);return H&&!H.disableAutodetect}function Ce(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=H=>{T["before:highlightBlock"](Object.assign({block:H.el},H))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=H=>{T["after:highlightBlock"](Object.assign({block:H.el},H))})}function Ae(T){Ce(T),r.push(T)}function Ve(T){let H=r.indexOf(T);H!==-1&&r.splice(H,1)}function je(T,H){let I=T;r.forEach(function(ae){ae[I]&&ae[I](H)})}function $e(T){return Or("10.7.0","highlightBlock will be removed entirely in v12.0"),Or("10.7.0","Please use highlightElement now."),g(T)}Object.assign(e,{highlight:c,highlightAuto:p,highlightAll:S,highlightElement:g,highlightBlock:$e,configure:m,initHighlighting:b,initHighlightingOnLoad:k,registerLanguage:A,unregisterLanguage:E,listLanguages:M,getLanguage:L,registerAliases:oe,autoDetection:he,inherit:zm,addPlugin:Ae,removePlugin:Ve}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=IS,e.regex={concat:nr,lookahead:jm,either:xs,optional:Xx,anyNumberOfTimes:Jx};for(let T in ks)typeof ks[T]=="object"&&_m(ks[T]);return Object.assign(e,ks),e},Lr=Ym({});Lr.newInstance=()=>Ym({});Qm.exports=Lr;Lr.HighlightJS=Lr;Lr.default=Lr});var Nu=we(en(),1);var Tu=$o("primitives",{"zh-CN":{sharedData:"\u5171\u4EAB\u6570\u636E\u2026",imageFrame:"\u56FE\u7247",appearance:"\u5916\u89C2",color:"\u6587\u5B57\u989C\u8272",backgroundColor:"\u80CC\u666F\u989C\u8272",fontSize:"\u5B57\u53F7",padding:"\u5185\u8FB9\u8DDD",radius:"\u5706\u89D2",title:"\u6807\u9898",language:"\u8BED\u8A00",plainText:"\u7EAF\u6587\u672C",copy:"\u590D\u5236\u4EE3\u7801",copied:"\u5DF2\u590D\u5236",width:"\u5BBD\u5EA6",height:"\u9AD8\u5EA6",fit:"\u56FE\u7247\u9002\u914D",contain:"\u5B8C\u6574\u663E\u793A",cover:"\u88C1\u5207\u586B\u5145",addImage:"\u6DFB\u52A0\u56FE\u7247",editImage:"\u7F16\u8F91\u56FE\u7247",imageSrc:"\u56FE\u7247\u5730\u5740",imageAlt:"\u66FF\u4EE3\u6587\u5B57",imageCaption:"\u56FE\u6CE8",table:"\u57FA\u7840\u8868\u683C",scrollTable:"{title}\uFF1A\u5DE6\u53F3\u6EDA\u52A8\u67E5\u770B\u5168\u90E8\u5217",comparisonTable:"\u5BF9\u7167\u8868",columnName:"\u5217 {column} \u540D\u79F0",cell:"\u7B2C {row} \u884C\u7B2C {column} \u5217",addRow:"\u6DFB\u52A0\u884C",removeLastRow:"\u79FB\u9664\u672B\u884C",callout:"\u63D0\u793A\u6846",toggleSummary:"\u5C55\u5F00\u5185\u5BB9",code:"\u4EE3\u7801\u5757",codeContent:"\u4EE3\u7801\u5185\u5BB9"},en:{sharedData:"Shared data\u2026",imageFrame:"Image",appearance:"Appearance",color:"Text color",backgroundColor:"Background",fontSize:"Font size",padding:"Padding",radius:"Corner radius",title:"Title",language:"Language",plainText:"Plain text",copy:"Copy code",copied:"Copied",width:"Width",height:"Height",fit:"Image fit",contain:"Contain",cover:"Cover",addImage:"Add image",editImage:"Edit image",imageSrc:"Image URL",imageAlt:"Alt text",imageCaption:"Caption",table:"Basic table",scrollTable:"{title}: scroll sideways to see all columns",comparisonTable:"Comparison table",columnName:"Column {column} name",cell:"Row {row}, column {column}",addRow:"Add row",removeLastRow:"Remove last row",callout:"Callout",toggleSummary:"Show content",code:"Code block",codeContent:"Code"}});var me=we(Ze(),1),Ru="showai:shared-data";function Wg(){if(typeof window>"u")return!1;let e=new CustomEvent(Ru,{cancelable:!0,detail:null});return window.dispatchEvent(e),e.defaultPrevented}function Du({editor:e,position:t,onDone:n}){let r=Le(Tu),[o,i]=(0,Nu.useState)(""),s=e.state.doc.nodeAt(t);if(!s||!e.isEditable)return null;let l=s.type.name,a=(p,h)=>{e.view.dispatch(e.state.tr.setNodeAttribute(t,p,h))},u=(p,h)=>(0,me.jsxs)("label",{children:[h,(0,me.jsx)("input",{value:s.attrs[p]??"",onChange:g=>a(p,g.target.value)})]},p),c=["image","table","codeBlock","callout","toggle","stepper","horizontalRule"].includes(l),d=s.attrs.componentStyle??{},f=(p,h)=>{let g={...d};h===void 0?delete g[p]:g[p]=h,a("componentStyle",g)};if(l==="widget"&&s.attrs.kind!=="text"&&Wg()){let p=s.attrs.id,h=g=>{let m=-1;e.state.doc.descendants((b,k)=>(m<0&&b.attrs?.id===p&&(m=k),m<0)),m>=0&&e.view.dispatch(e.state.tr.setNodeAttribute(m,"data",g))};return(0,me.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent(Ru,{cancelable:!0,detail:{kind:s.attrs.kind,data:s.attrs.data,apply:h}})),n?.()},children:[(0,me.jsx)(Vc,{size:15}),r("sharedData")]})}return(0,me.jsxs)("div",{className:"content-node-fields",children:[l==="image"&&(0,me.jsxs)(me.Fragment,{children:[u("src",r("imageSrc")),u("alt",r("imageAlt")),u("caption",r("imageCaption")),["width","height"].map(p=>(0,me.jsxs)("label",{children:[r(p),(0,me.jsx)("input",{inputMode:"decimal",value:s.attrs[p]??"",onChange:h=>{let g=h.target.value;(!g||/^\d+(?:px|%)?$/.test(g)&&parseInt(g)>0&&parseInt(g)<=1e4)&&a(p,g?/^\d+$/.test(g)?Number(g):g:null)}})]},p)),(0,me.jsxs)("label",{children:[r("fit"),(0,me.jsxs)("select",{value:s.attrs.fit??"contain",onChange:p=>a("fit",p.target.value),children:[(0,me.jsx)("option",{value:"contain",children:r("contain")}),(0,me.jsx)("option",{value:"cover",children:r("cover")})]})]})]}),["table","callout","toggle"].includes(l)&&u("title",r("title")),l==="codeBlock"&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)("label",{children:[r("language"),(0,me.jsxs)("select",{value:Ho(s.attrs.language),onChange:p=>a("language",p.target.value),children:[(0,me.jsx)("option",{value:"plaintext",children:r("plainText")}),!Ks.includes(Ho(s.attrs.language))&&(0,me.jsxs)("option",{value:Ho(s.attrs.language),children:[s.attrs.language,Cu(s.attrs.language)?"":` (${r("plainText")})`]}),Ks.filter(p=>p!=="plaintext").map(p=>(0,me.jsx)("option",{value:p,children:p},p))]})]}),(0,me.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(s.textContent).then(()=>i(r("copied"))).catch(p=>i(p.message))},children:r("copy")}),o&&(0,me.jsx)("span",{role:"status",children:o})]}),c&&(0,me.jsxs)("details",{children:[(0,me.jsx)("summary",{children:r("appearance")}),["color","backgroundColor"].map(p=>(0,me.jsxs)("label",{children:[r(p),(0,me.jsx)("input",{value:d[p]??"",onChange:h=>f(p,h.target.value||void 0)})]},p)),["fontSize","padding","radius"].map(p=>(0,me.jsxs)("label",{children:[r(p),(0,me.jsx)("input",{type:"number",min:p==="fontSize"?8:0,max:"200",value:d[p]??"",onChange:h=>{let g=h.target.value;(!g||Number(g)>=(p==="fontSize"?8:0)&&Number(g)<=200)&&f(p,g?Number(g):void 0)}})]},p))]})]})}var _o=$o("richTextNotes",{"zh-CN":{"format.note":"\u6CE8\u91CA","dialog.addNote":"\u6DFB\u52A0\u6CE8\u91CA","dialog.editNote":"\u4FEE\u6539\u6CE8\u91CA","dialog.noteText":"\u6CE8\u91CA\u5185\u5BB9\uFF08\u8BFB\u8005\u628A\u9F20\u6807\u79FB\u5230\u6240\u9009\u6587\u5B57\u4E0A\u65F6\u663E\u793A\uFF09","dialog.noteFormula":"\u6CE8\u91CA\u5185\u5BB9\uFF08\u8BFB\u8005\u628A\u9F20\u6807\u79FB\u5230\u8FD9\u4E2A\u516C\u5F0F\u4E0A\u65F6\u663E\u793A\uFF09","dialog.notePlaceholder":"\u4F8B\u5982\uFF1A\u7B2C t \u6B65\u7684\u5E26\u566A\u6F5C\u53D8\u91CF\uFF0C\u5F62\u72B6\u4E0E\u56FE\u50CF\u6F5C\u53D8\u91CF\u76F8\u540C","dialog.noteHint":"\u53EF\u7528 $\u2026$ \u5199\u516C\u5F0F\uFF1B\u53EA\u6CE8\u91CA\u516C\u5F0F\u4E2D\u7684\u67D0\u4E2A\u53D8\u91CF\u65F6\uFF0C\u5728\u516C\u5F0F\u6E90\u7801\u91CC\u5199 \\note{x_t}{\u2026}\u3002\u2318\u21A9 \u4FDD\u5B58\u3002","dialog.removeNote":"\u5220\u9664\u6CE8\u91CA","dialog.noteNeedsSelection":"\u5148\u9009\u4E2D\u8981\u52A0\u6CE8\u91CA\u7684\u6587\u5B57\u6216\u516C\u5F0F\u3002","dialog.noteTargetMissing":"\u8981\u6CE8\u91CA\u7684\u516C\u5F0F\u5DF2\u7ECF\u4E0D\u5728\u539F\u4F4D\u7F6E\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002","dialog.noteTooLong":"\u6CE8\u91CA\u6700\u591A {max} \u4E2A\u5B57\u7B26\u3002"},en:{"format.note":"Note","dialog.addNote":"Add note","dialog.editNote":"Edit note","dialog.noteText":"Note (shown when readers hover the selected text)","dialog.noteFormula":"Note (shown when readers hover this formula)","dialog.notePlaceholder":"For example: the noisy latent at step t, shaped like the image latent","dialog.noteHint":"Use $\u2026$ for formulas. To annotate one variable inside a formula, write \\note{x_t}{\u2026} in its source. \u2318\u21A9 saves.","dialog.removeNote":"Remove note","dialog.noteNeedsSelection":"Select the text or formula to annotate first.","dialog.noteTargetMissing":"The formula moved. Select it again.","dialog.noteTooLong":"Notes can have at most {max} characters."}});function Ou(e,t){let n=e.cut(0,t).toJSON().content??[],r=e.cut(t).toJSON().content??[],o=l=>l?.type==="paragraph"&&!l.content?.length||l?.type==="richText"&&!Object.keys(l.attrs?.data??{}).length&&(l.content??[]).every(o);o(n.at(-1))&&n.pop(),o(r[0])&&r.shift();let i=new Set,s=l=>{let a=l.attrs?.id;a&&(i.has(a)&&(l.attrs={...l.attrs,id:crypto.randomUUID()}),i.add(l.attrs.id)),l.content?.forEach(s)};return n.forEach(s),r.forEach(s),{before:n,after:r}}var $=we(en(),1),Mc=we(zs(),1);var Z=we(en(),1);var bi=we(zs(),1),Ap=we(jg(),1);var Lu=Object.defineProperty,Iu=(e,t)=>{let n={};for(var r in e)Lu(n,r,{get:e[r],enumerable:!0});return t||Lu(n,Symbol.toStringTag,{value:"Module"}),n};var $u=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Bu(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}var qs=(e,t,n)=>{let r=Bu(e,n);if(!r)return!1;let o=Js(r);if(!o){let s=r.blockRange(),l=s&&Pt(s);return l==null?!1:(t&&t(e.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(Uu(e,o,t,-1))return!0;if(r.parent.content.size==0&&(lr(i,"end")||j.isSelectable(i)))for(let s=r.depth;;s--){let l=Io(e.doc,r.before(s),r.after(s),ce.empty);if(l&&l.slice.size<l.to-l.from){if(t){let a=e.tr.step(l);a.setSelection(lr(i,"end")?X.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):j.create(a.doc,o.pos-i.nodeSize)),t(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},zu=(e,t,n)=>{let r=Bu(e,n);if(!r)return!1;let o=Js(r);return o?_u(e,o,t):!1},Hu=(e,t,n)=>{let r=Vu(e,n);if(!r)return!1;let o=Qs(r);return o?_u(e,o,t):!1};function _u(e,t,n){let r=t.nodeBefore,o=r,i=t.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let c=o.lastChild;if(!c)return!1;o=c}let s=t.nodeAfter,l=s,a=t.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let c=l.firstChild;if(!c)return!1;l=c}let u=Io(e.doc,i,a,ce.empty);if(!u||u.from!=i||u instanceof Dn&&u.slice.size>=a-i)return!1;if(n){let c=e.tr.step(u);c.setSelection(O.create(c.doc,i)),n(c.scrollIntoView())}return!0}function lr(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Gs=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Js(r)}let s=i&&i.nodeBefore;return!s||!j.isSelectable(s)?!1:(t&&t(e.tr.setSelection(j.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Js(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Vu(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}var Xs=(e,t,n)=>{let r=Vu(e,n);if(!r)return!1;let o=Qs(r);if(!o)return!1;let i=o.nodeAfter;if(Uu(e,o,t,1))return!0;if(r.parent.content.size==0&&(lr(i,"start")||j.isSelectable(i))){let s=Io(e.doc,r.before(),r.after(),ce.empty);if(s&&s.slice.size<s.to-s.from){if(t){let l=e.tr.step(s);l.setSelection(lr(i,"start")?X.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):j.create(l.doc,l.mapping.map(o.pos))),t(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},Ys=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Qs(r)}let s=i&&i.nodeAfter;return!s||!j.isSelectable(s)?!1:(t&&t(e.tr.setSelection(j.create(e.doc,i.pos)).scrollIntoView()),!0)};function Qs(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var ju=(e,t)=>{let n=e.selection,r=n instanceof j,o;if(r){if(n.node.isTextblock||!kt(e.doc,n.from))return!1;o=n.from}else if(o=ir(e.doc,n.from,-1),o==null)return!1;if(t){let i=e.tr.join(o);r&&i.setSelection(j.create(i.doc,o-e.doc.resolve(o).nodeBefore.nodeSize)),t(i.scrollIntoView())}return!0},Fu=(e,t)=>{let n=e.selection,r;if(n instanceof j){if(n.node.isTextblock||!kt(e.doc,n.to))return!1;r=n.to}else if(r=ir(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Wu=(e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Pt(o);return i==null?!1:(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)},Zs=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
4
4
|
`).scrollIntoView()),!0)};function el(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var tl=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=el(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let l=n.after(),a=e.tr.replaceWith(l,l,s.createAndFill());a.setSelection(X.near(a.doc.resolve(l),1)),t(a.scrollIntoView())}return!0},nl=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof rn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=el(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(s,i.createAndFill());l.setSelection(O.create(l.doc,s+1)),t(l.scrollIntoView())}return!0},rl=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ht(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Pt(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function Kg(e){return(t,n)=>{if(t.selection instanceof j&&t.selection.node.isBlock){let{$from:p}=t.selection;return!p.parentOffset||!ht(t.doc,p.pos)?!1:(n&&n(t.tr.split(p.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof O||t.selection instanceof rn)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,s=[],l,a,u=!1,c=!1;for(let p=o.depth;;p--)if(o.node(p).isBlock){u=o.end(p)==o.pos+(o.depth-p),c=o.start(p)==o.pos-(o.depth-p),a=el(o.node(p-1).contentMatchAt(o.indexAfter(p-1)));let g=e&&e(o.parent,u,o);s.unshift(g||(u&&a?{type:a}:null)),l=p;break}else{if(p==1)return!1;s.unshift(null)}let d=o.pos,f=ht(r.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=ht(r.doc,d,s.length,s)),!f)return!1;if(r.split(d,s.length,s),!u&&c&&o.node(l).type!=a){let p=r.mapping.slice(i),h=p.map(o.before(l)),g=r.doc.resolve(h);a&&o.node(l-1).canReplaceWith(g.index(),g.index()+1,a)&&r.setNodeMarkup(p.map(o.before(l)),a)}return n&&n(r.scrollIntoView()),!0}}var Ug=Kg();var Ku=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(j.create(e.doc,o))),!0)},qg=(e,t)=>(t&&t(e.tr.setSelection(new rn(e.doc))),!0);function Gg(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||kt(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Uu(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Gg(e,t,n))return!0;let u=!a&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,h=V.empty;for(let b=s.length-1;b>=0;b--)h=V.from(s[b].create(null,h));h=V.from(o.copy(h));let g=e.tr.step(new St(t.pos-1,p,t.pos,p,new ce(h,1,0),s.length,!0)),m=g.doc.resolve(p+2*s.length);m.nodeAfter&&m.nodeAfter.type==o.type&&kt(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&a?null:X.findFrom(t,1),d=c&&c.$from.blockRange(c.$to),f=d&&Pt(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(u&&lr(i,"start",!0)&&lr(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let g=i,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let b=V.empty;for(let C=h.length-1;C>=0;C--)b=V.from(h[C].copy(b));let k=e.tr.step(new St(t.pos-h.length,t.pos+i.nodeSize,t.pos+m,t.pos+i.nodeSize-m,new ce(b,h.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function qu(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(O.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}var ol=qu(-1),il=qu(1);function Gu(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&or(s,e,t);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function sl(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,u)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(e,t)))if(a.type==e)o=!0;else{let c=n.doc.resolve(u),d=c.index();o=c.parent.canReplaceWith(d,d+1,e)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,e,t)}r(i.scrollIntoView())}return!0}}function ll(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}var Us=ll($u,qs,Gs),Pu=ll($u,Xs,Ys),on={Enter:ll(Zs,nl,rl,Ug),"Mod-Enter":tl,Backspace:Us,"Mod-Backspace":Us,"Shift-Backspace":Us,Delete:Pu,"Mod-Delete":Pu,"Mod-a":qg},Jg={"Ctrl-h":on.Backspace,"Alt-Backspace":on["Mod-Backspace"],"Ctrl-d":on.Delete,"Ctrl-Alt-Backspace":on["Mod-Delete"],"Alt-Delete":on["Mod-Delete"],"Alt-d":on["Mod-Delete"],"Ctrl-a":ol,"Ctrl-e":il};for(let e in on)Jg[e]=on[e];var V1=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function Ju(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return Xg(l,s,e,t)?(r&&r(l.scrollIntoView()),!0):!1}}function Xg(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let a=s.resolve(t.start-2);i=new Do(a,a,t.depth),t.endIndex<t.parent.childCount&&(t=new Do(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=or(i,n,r,t);return l?(e&&Yg(e,t,l,o,n),!0):!1}function Yg(e,t,n,r,o){let i=V.empty;for(let c=n.length-1;c>=0;c--)i=V.from(n[c].type.create(n[c].attrs,i));e.step(new St(t.start-(r?2:0),t.end,t.start,t.end,new ce(i,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==o&&(s=c+1);let l=n.length-s,a=t.start+n.length-(r?2:0),u=t.parent;for(let c=t.startIndex,d=t.endIndex,f=!0;c<d;c++,f=!1)!f&&ht(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return e}function Xu(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?Qg(t,n,e,i):Zg(t,n,i):!0:!1}}function Qg(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new St(i-1,s,i,s,new ce(V.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Do(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));let l=Pt(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return kt(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),t(o.scrollIntoView()),!0}function Zg(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,g=n.startIndex;h>g;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(l?0:1),c+1,s.content.append(a?V.empty:V.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new St(d-(l?1:0),f+(a?1:0),d+1,f-1,new ce((l?V.empty:V.from(o.copy(V.empty))).append(a?V.empty:V.from(o.copy(V.empty))),l?0:1,a?0:1),l?0:1)),t(r.scrollIntoView()),!0}function Yu(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,u=>u.childCount>0&&u.firstChild.type==e);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=e)return!1;if(n){let u=a.lastChild&&a.lastChild.type==l.type,c=V.from(u?e.create():null),d=new ce(V.from(e.create(null,V.from(l.type.create(null,c)))),u?3:1,0),f=i.start,p=i.end;n(t.tr.step(new St(f-(u?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}var Fe=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},dr=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},fl=null,Bt=function(e,t,n){let r=fl||(fl=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},eb=function(){fl=null},Hn=function(e,t,n,r){return n&&(Qu(e,t,n,r,-1)||Qu(e,t,n,r,1))},tb=/^(img|br|input|textarea|hr)$/i;function Qu(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:qe(e))){let s=e.parentNode;if(!s||!W(s)||Jr(e)||tb.test(e.nodeName)||e.contentEditable=="false")return!1;t=Fe(e)+(o<0?0:1),e=s}else if(W(e)){let s=e.childNodes[t+(o<0?-1:0)];if(W(s)&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)t+=o;else return!1;else e=s,t=o<0?qe(e):0}else return!1}}function qe(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function W(e){return e.nodeType==1}function Ie(e){return e.nodeType==3}function _n(e,t){return t?e.contains(W(t)?t:t.parentNode):!1}function nb(e,t){for(;;){if(Ie(e)&&t)return e;if(W(e)&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=qe(e)}else if(e.parentNode&&!Jr(e))t=Fe(e),e=e.parentNode;else return null}}function rb(e,t){for(;;){if(Ie(e)&&t<e.nodeValue.length)return e;if(W(e)&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Jr(e))t=Fe(e)+1,e=e.parentNode;else return null}}function ob(e,t,n){for(let r=t==0,o=t==qe(e);r||o;){if(e==n)return!0;let i=Fe(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==qe(e)}}function Jr(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Yo=function(e){return e.focusNode&&Hn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function On(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function ib(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function sb(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(qe(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(qe(r.startContainer),r.startOffset)}}}var Et=typeof navigator<"u"?navigator:null,Zu=typeof document<"u"?document:null,un=Et&&Et.userAgent||"",pl=/Edge\/(\d+)/.exec(un),Td=/MSIE \d/.exec(un),hl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(un),ot=!!(Td||hl||pl),an=Td?document.documentMode:hl?+hl[1]:pl?+pl[1]:0,ut=!ot&&/gecko\/(\d+)/i.test(un);ut&&+(/Firefox\/(\d+)/.exec(un)||[0,0])[1];var ml=!ot&&/Chrome\/(\d+)/.exec(un),We=!!ml,Nd=ml?+ml[1]:0,Ge=!ot&&!!Et&&/Apple Computer/.test(Et.vendor),fr=Ge&&(/Mobile\/\w+/.test(un)||!!Et&&Et.maxTouchPoints>2),mt=fr||(Et?/Mac/.test(Et.platform):!1),Rd=Et?/Win/.test(Et.platform):!1,zt=/Android \d/.test(un),Qo=!!Zu&&"webkitFontSmoothing"in Zu.documentElement.style,lb=Qo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ab(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function $t(e,t){return typeof e=="number"?e:e[t]}function cb(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function ed(e,t,n){if(!gl(t)&&t.left==0)return;let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(!W(s)){s=dr(s);continue}let l=s==i.body,a=l?ab(i):cb(s),u=0,c=0;if(t.top<a.top+$t(r,"top")?c=-(a.top-t.top+$t(o,"top")):t.bottom>a.bottom-$t(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+$t(o,"top")-a.top:t.bottom-a.bottom+$t(o,"bottom")),t.left<a.left+$t(r,"left")?u=-(a.left-t.left+$t(o,"left")):t.right>a.right-$t(r,"right")&&(u=t.right-a.right+$t(o,"right")),u||c)if(l)i.defaultView.scrollBy(u,c);else{let f=s.scrollLeft,p=s.scrollTop;c&&(s.scrollTop+=c),u&&(s.scrollLeft+=u);let h=s.scrollLeft-f,g=s.scrollTop-p;t={left:t.left-h,top:t.top-g,right:t.right-h,bottom:t.bottom-g}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:dr(s)}}function ub(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let i=(t.left+t.right)/2,s=n+1;s<Math.min(innerHeight,t.bottom);s+=5){let l=e.root.elementFromPoint(i,s);if(!l||l==e.dom||!e.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Dd(e.dom)}}function Dd(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=dr(r));return t}function db({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Od(n,r==0?0:r-t)}function Od(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}var ar=null;function fb(e){if(e.setActive)return e.setActive();if(ar)return e.focus(ar);let t=Dd(e);e.focus(ar==null?{get preventScroll(){return ar={preventScroll:!0},!0}}:void 0),ar||(ar=!1,Od(t,0))}function Ld(e,t){let n,r=2e8,o,i=0,s=t.top,l=t.top,a,u;for(let c=e.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(W(c))f=c.getClientRects();else if(Ie(c))f=Bt(c).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let g=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(g<r){n=c,r=g,o=g&&Ie(n)?{left:h.right<t.left?h.right:h.left,top:t.top}:t,W(c)&&g&&(i=d+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!a&&h.left<=t.left&&h.right>=t.left&&(a=c,u={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=u,r=0),n&&Ie(n)?pb(n,o):!n||r?{node:e,offset:i}:Ld(n,o)}function pb(e,t){let n=e.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let s=sn(r,1);if(s.top!=s.bottom&&Ol(t,s)){o={node:e,offset:i+(t.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:e,offset:0}}function Ol(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function hb(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function mb(e,t,n){let{node:r,offset:o}=Ld(t,n),i=-1;if(W(r)&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function gb(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let l=e.docView.nearestDesc(i,!0),a;if(!l)return null;if(W(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function Id(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=e.childNodes[i];if(W(s)){let l=s.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(Ol(t,u))return Id(s,t,u)}}if((i=(i+1)%r)==o)break}return e}function bb(e,t){let n=e.dom.ownerDocument,r,o=0,i=sb(n,t.left,t.top);i&&({node:r,offset:o}=i);let s=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),l;if(!s||!e.dom.contains(s)){let u=e.dom.getBoundingClientRect();if(!Ol(t,u)||(s=Id(e.dom,t,u),!s))return null}if(Ge)for(let u=s;r&&u;u=dr(u))u.draggable&&(r=void 0);if(s=hb(s,t),r){if(ut&&W(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let c=r.childNodes[o],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&o++}let u;Qo&&o&&W(r)&&W(u=r.childNodes[o-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&o--,r==e.dom&&o==r.childNodes.length-1&&W(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?l=e.state.doc.content.size:(o==0||!W(r)||r.childNodes[o-1].nodeName!="BR")&&(l=gb(e,r,o,t))}l==null&&(l=mb(e,s,t));let a=e.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function gl(e){return e.top<e.bottom||e.left<e.right}function sn(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(gl(r))return r}return Array.prototype.find.call(n,gl)||e.getBoundingClientRect()}var yb=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pd(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Qo||ut;if(Ie(r))if(s&&(yb.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=sn(Bt(r,o,o),n);if(ut&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let u=sn(Bt(r,o-1,o-1),-1);if(u.top==a.top){let c=sn(Bt(r,o,o+1),-1);if(c.top!=a.top)return Vr(c,c.left<u.left)}}return a}else{let a=o,u=o,c=n<0?1:-1;return n<0&&!o?(u++,c=-1):n>=0&&o==r.nodeValue.length?(a--,c=1):n<0?a--:u++,Vr(sn(Bt(r,a,u),c),c<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==qe(r))){let a=r.childNodes[o-1];if(W(a))return al(a.getBoundingClientRect(),!1)}if(i==null&&o<qe(r)){let a=r.childNodes[o];if(W(a))return al(a.getBoundingClientRect(),!0)}return al(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==qe(r))){let a=r.childNodes[o-1],u=Ie(a)?Bt(a,qe(a)-(s?0:1)):W(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Vr(sn(u,1),!1)}if(i==null&&o<qe(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?Ie(a)?Bt(a,0,s?0:1):W(a)?a:null:null;if(u)return Vr(sn(u,-1),!0)}return Vr(sn(Ie(r)?Bt(r):r,-n),n>=0)}function Vr(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function al(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function $d(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function wb(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return $d(e,t,()=>{let{node:i}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=e.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Pd(e,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(W(l))a=l.getClientRects();else if(Ie(l))a=Bt(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let c=a[u];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}var kb=/[\u0590-\u08ac]/;function vb(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=e.domSelection();return l?!kb.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:$d(e,t,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=e.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:g}=e.domSelectionRange(),m=h&&!_n(p,h)||a==h&&u==g;try{l.collapse(c,d),a&&(a!=c||u!=d)&&l.extend&&l.extend(a,u)}catch{}return f!=null&&(l.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}var td=null,nd=null,rd=!1;function Cb(e,t,n){return td==t&&nd==n?rd:(td=t,nd=n,rd=n=="up"||n=="down"?wb(e,t,n):vb(e,t,n))}var gt=0,od=1,Ln=2,vt=3,Vn=class{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=gt,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==t)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&_n(this.contentDOM,t))if(r<0){let i,s;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>Fe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=!!(t.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,o=t;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(W(s)?_n(s,t):s==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==t&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(t<i)return o.descAt(t-r-o.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>t){o=t-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof Fo||i instanceof Vo&&i.side>=0))break}if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Fe(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Fe(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],u=s+a.size;if(o==-1&&t<=u){let c=s+a.border;if(t>=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,n,c);t=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Fe(f.dom)+1;break}t-=f.size}o==-1&&(o=0)}if(o>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Fe(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(!W(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,o=!1){let i=Math.min(t,n),s=Math.max(t,n);for(let p=0,h=0;p<this.children.length;p++){let g=this.children[p],m=h+g.size;if(i>h&&s<m)return g.setSelection(t-h-g.border,n-h-g.border,r,o);h=m}let l=this.domFromPos(t,t?-1:1),a=n==t?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((ut||Ge)&&t==n){let{node:p,offset:h}=l;if(Ie(p)){if(d=!!(h&&p.nodeValue[h-1]==`
|