decklight 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/decklight.js CHANGED
@@ -1,10 +1,10 @@
1
- /*! Decklight v0.5.0 — Copyright 2026 Gilles Philippart — SPDX-License-Identifier: Apache-2.0 */
2
- var Decklight=(()=>{var Fa=Object.create;var nr=Object.defineProperty;var za=Object.getOwnPropertyDescriptor;var Ua=Object.getOwnPropertyNames;var Ha=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var Us=(r,a)=>()=>(r&&(a=r(r=0)),a);var ja=(r,a)=>()=>(a||r((a={exports:{}}).exports,a),a.exports),Ka=(r,a)=>{for(var l in a)nr(r,l,{get:a[l],enumerable:!0})},Hs=(r,a,l,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let u of Ua(a))!Ga.call(r,u)&&u!==l&&nr(r,u,{get:()=>a[u],enumerable:!(d=za(a,u))||d.enumerable});return r};var Wa=(r,a,l)=>(l=r!=null?Fa(Ha(r)):{},Hs(a||!r||!r.__esModule?nr(l,"default",{value:r,enumerable:!0}):l,r)),Va=r=>Hs(nr({},"__esModule",{value:!0}),r);var We,ae=Us(()=>{We={order:["default","classics"],labels:{default:"Default",classics:"Classics"},packs:{default:["aurora","eclipse","midnight","fjord","cosmos","ink","storm","carbon","synthwave","obsidian","graphite","ember","moss","velvet","porcelain","paper","linen","sepia","glacier","mint","latte","dune","coastal","harvest","meadow","orchid","peony","slate","berry","citrus","ibm-modern","yamabuki"],classics:["reveal-black","reveal-white","reveal-league","reveal-beige","reveal-sky","reveal-night","reveal-serif","reveal-simple","reveal-solarized","reveal-moon","reveal-blood","reveal-dracula","metropolis","seriph"]}}});var Ke,le=Us(()=>{Ke=["aurora","berry","carbon","citrus","coastal","cosmos","dune","eclipse","ember","fjord","glacier","graphite","harvest","ibm-modern","ink","latte","linen","meadow","metropolis","midnight","mint","moss","obsidian","orchid","paper","peony","porcelain","reveal-beige","reveal-black","reveal-blood","reveal-dracula","reveal-league","reveal-moon","reveal-night","reveal-serif","reveal-simple","reveal-sky","reveal-solarized","reveal-white","sepia","seriph","slate","storm","synthwave","velvet","yamabuki"]});var Mo=ja((du,Oo)=>{ae();le();function wo(r){return r instanceof Map?r.clear=r.delete=r.set=function(){throw new Error("map is read-only")}:r instanceof Set&&(r.add=r.clear=r.delete=function(){throw new Error("set is read-only")}),Object.freeze(r),Object.getOwnPropertyNames(r).forEach(a=>{let l=r[a],d=typeof l;(d==="object"||d==="function")&&!Object.isFrozen(l)&&wo(l)}),r}var ar=class{constructor(a){a.data===void 0&&(a.data={}),this.data=a.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function xo(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function dn(r,...a){let l=Object.create(null);for(let d in r)l[d]=r[d];return a.forEach(function(d){for(let u in d)l[u]=d[u]}),l}var Al="</span>",ho=r=>!!r.scope,_l=(r,{prefix:a})=>{if(r.startsWith("language:"))return r.replace("language:","language-");if(r.includes(".")){let l=r.split(".");return[`${a}${l.shift()}`,...l.map((d,u)=>`${d}${"_".repeat(u+1)}`)].join(" ")}return`${a}${r}`},Fr=class{constructor(a,l){this.buffer="",this.classPrefix=l.classPrefix,a.walk(this)}addText(a){this.buffer+=xo(a)}openNode(a){if(!ho(a))return;let l=_l(a.scope,{prefix:this.classPrefix});this.span(l)}closeNode(a){ho(a)&&(this.buffer+=Al)}value(){return this.buffer}span(a){this.buffer+=`<span class="${a}">`}},mo=(r={})=>{let a={children:[]};return Object.assign(a,r),a},zr=class r{constructor(){this.rootNode=mo(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(a){this.top.children.push(a)}openNode(a){let l=mo({scope:a});this.add(l),this.stack.push(l)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(a){return this.constructor._walk(a,this.rootNode)}static _walk(a,l){return typeof l=="string"?a.addText(l):l.children&&(a.openNode(l),l.children.forEach(d=>this._walk(a,d)),a.closeNode(l)),a}static _collapse(a){typeof a!="string"&&a.children&&(a.children.every(l=>typeof l=="string")?a.children=[a.children.join("")]:a.children.forEach(l=>{r._collapse(l)}))}},Ur=class extends zr{constructor(a){super(),this.options=a}addText(a){a!==""&&this.add(a)}startScope(a){this.openNode(a)}endScope(){this.closeNode()}__addSublanguage(a,l){let d=a.root;l&&(d.scope=`language:${l}`),this.add(d)}toHTML(){return new Fr(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Hn(r){return r?typeof r=="string"?r:r.source:null}function vo(r){return bn("(?=",r,")")}function Tl(r){return bn("(?:",r,")*")}function Cl(r){return bn("(?:",r,")?")}function bn(...r){return r.map(l=>Hn(l)).join("")}function Nl(r){let a=r[r.length-1];return typeof a=="object"&&a.constructor===Object?(r.splice(r.length-1,1),a):{}}function Gr(...r){return"("+(Nl(r).capture?"":"?:")+r.map(d=>Hn(d)).join("|")+")"}function ko(r){return new RegExp(r.toString()+"|").exec("").length-1}function $l(r,a){let l=r&&r.exec(a);return l&&l.index===0}var Ol=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function jr(r,{joinWith:a}){let l=0;return r.map(d=>{l+=1;let u=l,m=Hn(d),f="";for(;m.length>0;){let h=Ol.exec(m);if(!h){f+=m;break}f+=m.substring(0,h.index),m=m.substring(h.index+h[0].length),h[0][0]==="\\"&&h[1]?f+="\\"+String(Number(h[1])+u):(f+=h[0],h[0]==="("&&l++)}return f}).map(d=>`(${d})`).join(a)}var Ml=/\b\B/,Eo="[a-zA-Z]\\w*",Kr="[a-zA-Z_]\\w*",So="\\b\\d+(\\.\\d+)?",Ao="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",_o="\\b(0b[01]+)",Ll="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Rl=(r={})=>{let a=/^#![ ]*\//;return r.binary&&(r.begin=bn(a,/.*\b/,r.binary,/\b.*/)),dn({scope:"meta",begin:a,end:/$/,relevance:0,"on:begin":(l,d)=>{l.index!==0&&d.ignoreMatch()}},r)},Gn={begin:"\\\\[\\s\\S]",relevance:0},Il={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Gn]},Bl={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Gn]},Pl={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/},cr=function(r,a,l={}){let d=dn({scope:"comment",begin:r,end:a,contains:[]},l);d.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 u=Gr("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 d.contains.push({begin:bn(/[ ]+/,"(",u,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),d},Dl=cr("//","$"),ql=cr("/\\*","\\*/"),Fl=cr("#","$"),zl={scope:"number",begin:So,relevance:0},Ul={scope:"number",begin:Ao,relevance:0},Hl={scope:"number",begin:_o,relevance:0},Gl={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Gn,{begin:/\[/,end:/\]/,relevance:0,contains:[Gn]}]},jl={scope:"title",begin:Eo,relevance:0},Kl={scope:"title",begin:Kr,relevance:0},Wl={begin:"\\.\\s*"+Kr,relevance:0},Vl=function(r){return Object.assign(r,{"on:begin":(a,l)=>{l.data._beginMatch=a[1]},"on:end":(a,l)=>{l.data._beginMatch!==a[1]&&l.ignoreMatch()}})},ir=Object.freeze({__proto__:null,APOS_STRING_MODE:Il,BACKSLASH_ESCAPE:Gn,BINARY_NUMBER_MODE:Hl,BINARY_NUMBER_RE:_o,COMMENT:cr,C_BLOCK_COMMENT_MODE:ql,C_LINE_COMMENT_MODE:Dl,C_NUMBER_MODE:Ul,C_NUMBER_RE:Ao,END_SAME_AS_BEGIN:Vl,HASH_COMMENT_MODE:Fl,IDENT_RE:Eo,MATCH_NOTHING_RE:Ml,METHOD_GUARD:Wl,NUMBER_MODE:zl,NUMBER_RE:So,PHRASAL_WORDS_MODE:Pl,QUOTE_STRING_MODE:Bl,REGEXP_MODE:Gl,RE_STARTERS_RE:Ll,SHEBANG:Rl,TITLE_MODE:jl,UNDERSCORE_IDENT_RE:Kr,UNDERSCORE_TITLE_MODE:Kl});function Zl(r,a){r.input[r.index-1]==="."&&a.ignoreMatch()}function Xl(r,a){r.className!==void 0&&(r.scope=r.className,delete r.className)}function Yl(r,a){a&&r.beginKeywords&&(r.begin="\\b("+r.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",r.__beforeBegin=Zl,r.keywords=r.keywords||r.beginKeywords,delete r.beginKeywords,r.relevance===void 0&&(r.relevance=0))}function Jl(r,a){Array.isArray(r.illegal)&&(r.illegal=Gr(...r.illegal))}function Ql(r,a){if(r.match){if(r.begin||r.end)throw new Error("begin & end are not supported with match");r.begin=r.match,delete r.match}}function ec(r,a){r.relevance===void 0&&(r.relevance=1)}var tc=(r,a)=>{if(!r.beforeMatch)return;if(r.starts)throw new Error("beforeMatch cannot be used with starts");let l=Object.assign({},r);Object.keys(r).forEach(d=>{delete r[d]}),r.keywords=l.keywords,r.begin=bn(l.beforeMatch,vo(l.begin)),r.starts={relevance:0,contains:[Object.assign(l,{endsParent:!0})]},r.relevance=0,delete l.beforeMatch},nc=["of","and","for","in","not","or","if","then","parent","list","value"],rc="keyword";function To(r,a,l=rc){let d=Object.create(null);return typeof r=="string"?u(l,r.split(" ")):Array.isArray(r)?u(l,r):Object.keys(r).forEach(function(m){Object.assign(d,To(r[m],a,m))}),d;function u(m,f){a&&(f=f.map(h=>h.toLowerCase())),f.forEach(function(h){let w=h.split("|");d[w[0]]=[m,sc(w[0],w[1])]})}}function sc(r,a){return a?Number(a):oc(r)?0:1}function oc(r){return nc.includes(r.toLowerCase())}var fo={},gn=r=>{console.error(r)},go=(r,...a)=>{console.log(`WARN: ${r}`,...a)},Cn=(r,a)=>{fo[`${r}/${a}`]||(console.log(`Deprecated as of ${r}. ${a}`),fo[`${r}/${a}`]=!0)},lr=new Error;function Co(r,a,{key:l}){let d=0,u=r[l],m={},f={};for(let h=1;h<=a.length;h++)f[h+d]=u[h],m[h+d]=!0,d+=ko(a[h-1]);r[l]=f,r[l]._emit=m,r[l]._multi=!0}function ic(r){if(Array.isArray(r.begin)){if(r.skip||r.excludeBegin||r.returnBegin)throw gn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),lr;if(typeof r.beginScope!="object"||r.beginScope===null)throw gn("beginScope must be object"),lr;Co(r,r.begin,{key:"beginScope"}),r.begin=jr(r.begin,{joinWith:""})}}function ac(r){if(Array.isArray(r.end)){if(r.skip||r.excludeEnd||r.returnEnd)throw gn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),lr;if(typeof r.endScope!="object"||r.endScope===null)throw gn("endScope must be object"),lr;Co(r,r.end,{key:"endScope"}),r.end=jr(r.end,{joinWith:""})}}function lc(r){r.scope&&typeof r.scope=="object"&&r.scope!==null&&(r.beginScope=r.scope,delete r.scope)}function cc(r){lc(r),typeof r.beginScope=="string"&&(r.beginScope={_wrap:r.beginScope}),typeof r.endScope=="string"&&(r.endScope={_wrap:r.endScope}),ic(r),ac(r)}function dc(r){function a(f,h){return new RegExp(Hn(f),"m"+(r.case_insensitive?"i":"")+(r.unicodeRegex?"u":"")+(h?"g":""))}class l{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(h,w){w.position=this.position++,this.matchIndexes[this.matchAt]=w,this.regexes.push([w,h]),this.matchAt+=ko(h)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let h=this.regexes.map(w=>w[1]);this.matcherRe=a(jr(h,{joinWith:"|"}),!0),this.lastIndex=0}exec(h){this.matcherRe.lastIndex=this.lastIndex;let w=this.matcherRe.exec(h);if(!w)return null;let k=w.findIndex((I,M)=>M>0&&I!==void 0),A=this.matchIndexes[k];return w.splice(0,k),Object.assign(w,A)}}class d{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(h){if(this.multiRegexes[h])return this.multiRegexes[h];let w=new l;return this.rules.slice(h).forEach(([k,A])=>w.addRule(k,A)),w.compile(),this.multiRegexes[h]=w,w}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(h,w){this.rules.push([h,w]),w.type==="begin"&&this.count++}exec(h){let w=this.getMatcher(this.regexIndex);w.lastIndex=this.lastIndex;let k=w.exec(h);if(this.resumingScanAtSamePosition()&&!(k&&k.index===this.lastIndex)){let A=this.getMatcher(0);A.lastIndex=this.lastIndex+1,k=A.exec(h)}return k&&(this.regexIndex+=k.position+1,this.regexIndex===this.count&&this.considerAll()),k}}function u(f){let h=new d;return f.contains.forEach(w=>h.addRule(w.begin,{rule:w,type:"begin"})),f.terminatorEnd&&h.addRule(f.terminatorEnd,{type:"end"}),f.illegal&&h.addRule(f.illegal,{type:"illegal"}),h}function m(f,h){let w=f;if(f.isCompiled)return w;[Xl,Ql,cc,tc].forEach(A=>A(f,h)),r.compilerExtensions.forEach(A=>A(f,h)),f.__beforeBegin=null,[Yl,Jl,ec].forEach(A=>A(f,h)),f.isCompiled=!0;let k=null;return typeof f.keywords=="object"&&f.keywords.$pattern&&(f.keywords=Object.assign({},f.keywords),k=f.keywords.$pattern,delete f.keywords.$pattern),k=k||/\w+/,f.keywords&&(f.keywords=To(f.keywords,r.case_insensitive)),w.keywordPatternRe=a(k,!0),h&&(f.begin||(f.begin=/\B|\b/),w.beginRe=a(w.begin),!f.end&&!f.endsWithParent&&(f.end=/\B|\b/),f.end&&(w.endRe=a(w.end)),w.terminatorEnd=Hn(w.end)||"",f.endsWithParent&&h.terminatorEnd&&(w.terminatorEnd+=(f.end?"|":"")+h.terminatorEnd)),f.illegal&&(w.illegalRe=a(f.illegal)),f.contains||(f.contains=[]),f.contains=[].concat(...f.contains.map(function(A){return uc(A==="self"?f:A)})),f.contains.forEach(function(A){m(A,w)}),f.starts&&m(f.starts,h),w.matcher=u(w),w}if(r.compilerExtensions||(r.compilerExtensions=[]),r.contains&&r.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return r.classNameAliases=dn(r.classNameAliases||{}),m(r)}function No(r){return r?r.endsWithParent||No(r.starts):!1}function uc(r){return r.variants&&!r.cachedVariants&&(r.cachedVariants=r.variants.map(function(a){return dn(r,{variants:null},a)})),r.cachedVariants?r.cachedVariants:No(r)?dn(r,{starts:r.starts?dn(r.starts):null}):Object.isFrozen(r)?dn(r):r}var pc="11.11.1",Hr=class extends Error{constructor(a,l){super(a),this.name="HTMLInjectionError",this.html=l}},qr=xo,bo=dn,yo=Symbol("nomatch"),hc=7,$o=function(r){let a=Object.create(null),l=Object.create(null),d=[],u=!0,m="Could not find the language '{}', did you forget to load/include a language module?",f={disableAutodetect:!0,name:"Plain text",contains:[]},h={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Ur};function w(F){return h.noHighlightRe.test(F)}function k(F){let J=F.className+" ";J+=F.parentNode?F.parentNode.className:"";let U=h.languageDetectRe.exec(J);if(U){let fe=be(U[1]);return fe||(go(m.replace("{}",U[1])),go("Falling back to no-highlight mode for this block.",F)),fe?U[1]:"no-highlight"}return J.split(/\s+/).find(fe=>w(fe)||be(fe))}function A(F,J,U){let fe="",Ee="";typeof J=="object"?(fe=F,U=J.ignoreIllegals,Ee=J.language):(Cn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Cn("10.7.0",`Please use highlight(code, options) instead.
3
- https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),U===void 0&&(U=!0);let ze={code:fe,language:Ee};qe("before:highlight",ze);let Ne=ze.result?ze.result:I(ze.language,ze.code,U);return Ne.code=ze.code,qe("after:highlight",Ne),Ne}function I(F,J,U,fe){let Ee=Object.create(null);function ze(re,ke){return re.keywords[ke]}function Ne(){if(!B.keywords){Y.addText(ge);return}let re=0;B.keywordPatternRe.lastIndex=0;let ke=B.keywordPatternRe.exec(ge),He="";for(;ke;){He+=ge.substring(re,ke.index);let _e=we.case_insensitive?ke[0].toLowerCase():ke[0],Le=ze(B,_e);if(Le){let[Qe,Oe]=Le;if(Y.addText(He),He="",Ee[_e]=(Ee[_e]||0)+1,Ee[_e]<=hc&&(V+=Oe),Qe.startsWith("_"))He+=ke[0];else{let Ye=we.classNameAliases[Qe]||Qe;O(ke[0],Ye)}}else He+=ke[0];re=B.keywordPatternRe.lastIndex,ke=B.keywordPatternRe.exec(ge)}He+=ge.substring(re),Y.addText(He)}function s(){if(ge==="")return;let re=null;if(typeof B.subLanguage=="string"){if(!a[B.subLanguage]){Y.addText(ge);return}re=I(B.subLanguage,ge,!0,X[B.subLanguage]),X[B.subLanguage]=re._top}else re=C(ge,B.subLanguage.length?B.subLanguage:null);B.relevance>0&&(V+=re.relevance),Y.__addSublanguage(re._emitter,re.language)}function o(){B.subLanguage!=null?s():Ne(),ge=""}function O(re,ke){re!==""&&(Y.startScope(ke),Y.addText(re),Y.endScope())}function Be(re,ke){let He=1,_e=ke.length-1;for(;He<=_e;){if(!re._emit[He]){He++;continue}let Le=we.classNameAliases[re[He]]||re[He],Qe=ke[He];Le?O(Qe,Le):(ge=Qe,Ne(),ge=""),He++}}function P(re,ke){return re.scope&&typeof re.scope=="string"&&Y.openNode(we.classNameAliases[re.scope]||re.scope),re.beginScope&&(re.beginScope._wrap?(O(ge,we.classNameAliases[re.beginScope._wrap]||re.beginScope._wrap),ge=""):re.beginScope._multi&&(Be(re.beginScope,ke),ge="")),B=Object.create(re,{parent:{value:B}}),B}function Ue(re,ke,He){let _e=$l(re.endRe,He);if(_e){if(re["on:end"]){let Le=new ar(re);re["on:end"](ke,Le),Le.isMatchIgnored&&(_e=!1)}if(_e){for(;re.endsParent&&re.parent;)re=re.parent;return re}}if(re.endsWithParent)return Ue(re.parent,ke,He)}function nt(re){return B.matcher.regexIndex===0?(ge+=re[0],1):(Je=!0,0)}function W(re){let ke=re[0],He=re.rule,_e=new ar(He),Le=[He.__beforeBegin,He["on:begin"]];for(let Qe of Le)if(Qe&&(Qe(re,_e),_e.isMatchIgnored))return nt(ke);return He.skip?ge+=ke:(He.excludeBegin&&(ge+=ke),o(),!He.returnBegin&&!He.excludeBegin&&(ge=ke)),P(He,re),He.returnBegin?0:ke.length}function Ae(re){let ke=re[0],He=J.substring(re.index),_e=Ue(B,re,He);if(!_e)return yo;let Le=B;B.endScope&&B.endScope._wrap?(o(),O(ke,B.endScope._wrap)):B.endScope&&B.endScope._multi?(o(),Be(B.endScope,re)):Le.skip?ge+=ke:(Le.returnEnd||Le.excludeEnd||(ge+=ke),o(),Le.excludeEnd&&(ge=ke));do B.scope&&Y.closeNode(),!B.skip&&!B.subLanguage&&(V+=B.relevance),B=B.parent;while(B!==_e.parent);return _e.starts&&P(_e.starts,re),Le.returnEnd?0:ke.length}function Q(){let re=[];for(let ke=B;ke!==we;ke=ke.parent)ke.scope&&re.unshift(ke.scope);re.forEach(ke=>Y.openNode(ke))}let ye={};function x(re,ke){let He=ke&&ke[0];if(ge+=re,He==null)return o(),0;if(ye.type==="begin"&&ke.type==="end"&&ye.index===ke.index&&He===""){if(ge+=J.slice(ke.index,ke.index+1),!u){let _e=new Error(`0 width match regex (${F})`);throw _e.languageName=F,_e.badRule=ye.rule,_e}return 1}if(ye=ke,ke.type==="begin")return W(ke);if(ke.type==="illegal"&&!U){let _e=new Error('Illegal lexeme "'+He+'" for mode "'+(B.scope||"<unnamed>")+'"');throw _e.mode=B,_e}else if(ke.type==="end"){let _e=Ae(ke);if(_e!==yo)return _e}if(ke.type==="illegal"&&He==="")return ge+=`
4
- `,1;if(Fe>1e5&&Fe>ke.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ge+=He,He.length}let we=be(F);if(!we)throw gn(m.replace("{}",F)),new Error('Unknown language: "'+F+'"');let g=dc(we),G="",B=fe||g,X={},Y=new h.__emitter(h);Q();let ge="",V=0,ne=0,Fe=0,Je=!1;try{if(we.__emitTokens)we.__emitTokens(J,Y);else{for(B.matcher.considerAll();;){Fe++,Je?Je=!1:B.matcher.considerAll(),B.matcher.lastIndex=ne;let re=B.matcher.exec(J);if(!re)break;let ke=J.substring(ne,re.index),He=x(ke,re);ne=re.index+He}x(J.substring(ne))}return Y.finalize(),G=Y.toHTML(),{language:F,value:G,relevance:V,illegal:!1,_emitter:Y,_top:B}}catch(re){if(re.message&&re.message.includes("Illegal"))return{language:F,value:qr(J),illegal:!0,relevance:0,_illegalBy:{message:re.message,index:ne,context:J.slice(ne-100,ne+100),mode:re.mode,resultSoFar:G},_emitter:Y};if(u)return{language:F,value:qr(J),illegal:!1,relevance:0,errorRaised:re,_emitter:Y,_top:B};throw re}}function M(F){let J={value:qr(F),illegal:!1,relevance:0,_top:f,_emitter:new h.__emitter(h)};return J._emitter.addText(F),J}function C(F,J){J=J||h.languages||Object.keys(a);let U=M(F),fe=J.filter(be).filter(Xe).map(o=>I(o,F,!1));fe.unshift(U);let Ee=fe.sort((o,O)=>{if(o.relevance!==O.relevance)return O.relevance-o.relevance;if(o.language&&O.language){if(be(o.language).supersetOf===O.language)return 1;if(be(O.language).supersetOf===o.language)return-1}return 0}),[ze,Ne]=Ee,s=ze;return s.secondBest=Ne,s}function $(F,J,U){let fe=J&&l[J]||U;F.classList.add("hljs"),F.classList.add(`language-${fe}`)}function q(F){let J=null,U=k(F);if(w(U))return;if(qe("before:highlightElement",{el:F,language:U}),F.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",F);return}if(F.children.length>0&&(h.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(F)),h.throwUnescapedHTML))throw new Hr("One of your code blocks includes unescaped HTML.",F.innerHTML);J=F;let fe=J.textContent,Ee=U?A(fe,{language:U,ignoreIllegals:!0}):C(fe);F.innerHTML=Ee.value,F.dataset.highlighted="yes",$(F,U,Ee.language),F.result={language:Ee.language,re:Ee.relevance,relevance:Ee.relevance},Ee.secondBest&&(F.secondBest={language:Ee.secondBest.language,relevance:Ee.secondBest.relevance}),qe("after:highlightElement",{el:F,result:Ee,text:fe})}function he(F){h=bo(h,F)}let oe=()=>{me(),Cn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function de(){me(),Cn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let j=!1;function me(){function F(){me()}if(document.readyState==="loading"){j||window.addEventListener("DOMContentLoaded",F,!1),j=!0;return}document.querySelectorAll(h.cssSelector).forEach(q)}function Te(F,J){let U=null;try{U=J(r)}catch(fe){if(gn("Language definition for '{}' could not be registered.".replace("{}",F)),u)gn(fe);else throw fe;U=f}U.name||(U.name=F),a[F]=U,U.rawDefinition=J.bind(null,r),U.aliases&&Ce(U.aliases,{languageName:F})}function $e(F){delete a[F];for(let J of Object.keys(l))l[J]===F&&delete l[J]}function Re(){return Object.keys(a)}function be(F){return F=(F||"").toLowerCase(),a[F]||a[l[F]]}function Ce(F,{languageName:J}){typeof F=="string"&&(F=[F]),F.forEach(U=>{l[U.toLowerCase()]=J})}function Xe(F){let J=be(F);return J&&!J.disableAutodetect}function xe(F){F["before:highlightBlock"]&&!F["before:highlightElement"]&&(F["before:highlightElement"]=J=>{F["before:highlightBlock"](Object.assign({block:J.el},J))}),F["after:highlightBlock"]&&!F["after:highlightElement"]&&(F["after:highlightElement"]=J=>{F["after:highlightBlock"](Object.assign({block:J.el},J))})}function E(F){xe(F),d.push(F)}function Ie(F){let J=d.indexOf(F);J!==-1&&d.splice(J,1)}function qe(F,J){let U=F;d.forEach(function(fe){fe[U]&&fe[U](J)})}function De(F){return Cn("10.7.0","highlightBlock will be removed entirely in v12.0"),Cn("10.7.0","Please use highlightElement now."),q(F)}Object.assign(r,{highlight:A,highlightAuto:C,highlightAll:me,highlightElement:q,highlightBlock:De,configure:he,initHighlighting:oe,initHighlightingOnLoad:de,registerLanguage:Te,unregisterLanguage:$e,listLanguages:Re,getLanguage:be,registerAliases:Ce,autoDetection:Xe,inherit:bo,addPlugin:E,removePlugin:Ie}),r.debugMode=function(){u=!1},r.safeMode=function(){u=!0},r.versionString=pc,r.regex={concat:bn,lookahead:vo,either:Gr,optional:Cl,anyNumberOfTimes:Tl};for(let F in ir)typeof ir[F]=="object"&&wo(ir[F]);return Object.assign(r,ir),r},Nn=$o({});Nn.newInstance=()=>$o({});Oo.exports=Nn;Nn.HighlightJS=Nn;Nn.default=Nn});var Md={};Ka(Md,{init:()=>$d,initTerminals:()=>Od,registerBuildProvider:()=>Kn,version:()=>Nd});ae();le();ae();le();ae();le();var Ya=new Set(["UL","OL","TABLE","TBODY","DL","SVG"]),Ja=new Set(["defs","title","desc","style","metadata"]),Ks=new Map;function Ws(r,a){Ks.set(r,a)}function sr(r){return[...r.children].filter(a=>{let l=a.tagName.toLowerCase();return!(Ja.has(l)||l==="aside"&&a.classList.contains("notes")||a.hasAttribute("data-build-stay"))})}function Qa(r){if(r.hasAttribute("data-build-self"))return!1;let a=r.tagName.toUpperCase();return Ya.has(a)?!0:a==="DIV"||a==="G"?sr(r).length>=2:!1}function el(r){if(r.tagName.toUpperCase()==="TABLE"){let l=r.querySelector(":scope > tbody");return l?sr(l):sr(r).filter(d=>d.tagName==="TR")}return sr(r)}function tl(r){let a=r.map((f,h)=>({...f,i:h}));a.sort((f,h)=>f.key-h.key||f.i-h.i);let l=[],d=null,u=null,m=!1;for(let f of a){if(d&&f.explicit&&m&&f.key===u){d.push(f.i);continue}d=[f.i],u=f.key,m=f.explicit,l.push(d)}return l}function Gs(r,a){r.classList.add("build-step"),r.setAttribute("data-build-style",a),r.setAttribute("data-build-state","pending"),a==="draw"&&nl(r)}var js="path, line, polyline, polygon, circle, ellipse, rect";function nl(r){let a=r.matches?.(js)?[r]:[...r.querySelectorAll(js)],l=!1;for(let u of a){let m=u.getAttribute("stroke")??getComputedStyle(u).stroke;if(!m||m==="none")continue;let f=0;try{f=u.getTotalLength()}catch{continue}if(!f)continue;l=!0;let h=u.getAttribute("stroke-dasharray")||u.style.strokeDasharray;h&&(u.dataset.drawOrig=h);for(let[w,k]of Br){let A=u.getAttribute(w);A&&(u.dataset[k]=A)}u.classList.add("draw-stroke"),u.style.setProperty("--draw-len",String(Math.ceil(f)))}r.querySelectorAll("text, tspan").forEach(u=>u.classList.add("draw-fade")),l||r.setAttribute("data-build-style","fade")}var Br=[["marker-start","drawMarkerStart"],["marker-mid","drawMarkerMid"],["marker-end","drawMarkerEnd"]];function rr(r,a){for(let[l,d]of Br)d in r.dataset&&(a?r.setAttribute(l,r.dataset[d]):r.removeAttribute(l))}function rl(r,a){for(let l of r.querySelectorAll(".draw-stroke")){let d=l.dataset.drawOrig,u=Br.some(([,m])=>m in l.dataset);if(!(!d&&!u))if(a==="done")d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),rr(l,!0);else if(a==="pending")l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),rr(l,!1);else{l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),rr(l,!1);let m=()=>{r.getAttribute("data-build-state")!=="pending"&&(d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),rr(l,!0))},f=parseFloat(getComputedStyle(l).transitionDuration)||0;f===0?m():(l.addEventListener("transitionend",m,{once:!0}),setTimeout(m,f*1e3+150))}}}function Pr(r){let a=[],l=[],d=new Set,u=0,m=(A,I)=>{let M=I!=null&&I!=="",C=M?parseInt(I,10):u;a.push(A),l.push({key:Number.isFinite(C)?C:u,explicit:M}),u++},f=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT);for(let A=f.nextNode();A;A=f.nextNode()){if(d.has(A))continue;let I=Ks.get(A);if(I){for(let C=0;C<I.count;C++)m({kind:"provider",provider:I,el:A,sub:C},null);A.querySelectorAll("*").forEach(C=>d.add(C));continue}if(!A.hasAttribute("data-build"))continue;let M=A.getAttribute("data-build")||"fade";if(Qa(A)){for(let C of el(A)){d.add(C),C.querySelectorAll("[data-build]").forEach(q=>d.add(q));let $=C.getAttribute("data-build")||M;Gs(C,$),m({kind:"dom",el:C,container:A},C.getAttribute("data-build-order"))}A.setAttribute("data-build-container","")}else Gs(A,M),m({kind:"dom",el:A,container:null},A.getAttribute("data-build-order"))}let h=tl(l),w=[],k=new Map;return a.forEach((A,I)=>{if(A.kind==="provider"){if(!k.has(A.provider)){let M={el:A.el,provider:A.provider,stepIdxs:[]};k.set(A.provider,M),w.push(M)}k.get(A.provider).stepIdxs.push(I)}}),{steps:a,groups:h,providers:w}}function cn(r,a){let l=new Set;r.groups.forEach((f,h)=>{for(let w of f)h<a&&l.add(w)});let d=a>0?r.groups[a-1]??[]:[],u=new Set(d),m=new Set;r.steps.forEach((f,h)=>{if(f.kind!=="dom")return;let w=u.has(h)?"current":l.has(h)?"done":"pending";f.el.setAttribute("data-build-state",w),f.el.getAttribute("data-build-style")==="draw"&&rl(f.el,w),f.container&&m.add(f.container)});for(let f of m){let h=!!f.querySelector(':scope [data-build-style="highlight"][data-build-state="current"]');f.classList.toggle("has-current-highlight",h)}for(let f of r.providers){let h=f.stepIdxs.filter(w=>l.has(w)||u.has(w)).length;f._last!==h&&(f._last=h,f.provider.apply(h))}}function Vs(r){return r.groups.map(a=>{let l=r.steps[a[0]];if(l.kind==="provider"){let u=l.sub;return l.provider.label?l.provider.label(u+1):"step"}return l.el.textContent.trim().replace(/\s+/g," ").slice(0,60)||l.el.tagName.toLowerCase()})}ae();le();var Zs="rect, circle, ellipse, polygon, polyline, path";function sl(r){let a=5381;for(let l of String(r))a=(a*33^l.charCodeAt(0))>>>0;return 1+a%6}function ol(r,a={}){let l=a[r];return typeof l=="number"?`var(--d-fill-${l})`:typeof l=="string"?l:`var(--d-fill-${sl(r)})`}function Xs(r,a={}){let l=new Map;r.querySelectorAll("svg [data-concept]").forEach(d=>{let u=d.getAttribute("data-concept");if(!u)return;let m=ol(u,a),f=m.match(/--d-fill-(\d)/);if(f){let w=l.get(f[1]);w&&w!==u?console.warn(`Decklight: concepts "${w}" and "${u}" share fill slot ${f[1]} \u2014 pin one explicitly via init({ concepts: { ${u}: <1-6> } })`):l.set(f[1],u)}let h=d.matches(Zs)?[d]:[...d.children].filter(w=>w.matches(Zs));for(let w of h){let k=w.getAttribute("fill")==="none"||w.style.fill==="none";w.style.setProperty(k?"stroke":"fill",m)}})}var il=["fill","stroke","filter","clip-path","mask","marker-start","marker-mid","marker-end","style"];function Ys(r){r.querySelectorAll("svg").forEach((a,l)=>{let d=`svg${l}-`,u=new Map;if(a.querySelectorAll("[id]").forEach(f=>{let h=f.id;u.set(h,d+h),f.id=d+h}),u.size===0)return;let m=f=>f.replace(/url\(['"]?#([^'")]+)['"]?\)/g,(h,w)=>u.has(w)?`url(#${u.get(w)})`:h);a.querySelectorAll("*").forEach(f=>{for(let h of il){let w=f.getAttribute(h);w&&w.includes("url(#")&&f.setAttribute(h,m(w))}for(let h of["href","xlink:href"]){let w=f.getAttribute(h);w&&w.startsWith("#")&&u.has(w.slice(1))&&f.setAttribute(h,"#"+u.get(w.slice(1)))}})})}ae();le();ae();le();var vt=r=>String(r).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");var Js=640,al=360,Qs=["bar","line","area","pie","donut"],ve=r=>{let a=Math.round(r*100)/100;return Object.is(a,-0)?"0":String(a)},_n=r=>`var(--d-fill-${r%6+1})`;function ll(r,a={}){let l;if(typeof r=="string")try{l=JSON.parse(r)}catch(k){throw new Error(`invalid JSON \u2014 ${k.message}`)}else if(r&&typeof r=="object")l=r;else throw new Error('no data \u2014 expected a <script type="application/json"> child (or the fence body)');let d=String(a.type||l.type||"").toLowerCase();if(!Qs.includes(d))throw new Error(`unknown type "${d}" \u2014 use ${Qs.join(" | ")}`);if(!Array.isArray(l.labels)||l.labels.length===0)throw new Error('"labels" must be a non-empty array');if(!Array.isArray(l.series)||l.series.length===0)throw new Error('"series" must be a non-empty array');let u=l.labels.map(String),m=l.series.map((k,A)=>{if(!k||!Array.isArray(k.data))throw new Error(`series ${A+1}: "data" must be an array of numbers`);return{name:k.name!=null?String(k.name):`series ${A+1}`,concept:k.concept!=null?String(k.concept):null,data:u.map((I,M)=>{let C=Number(k.data[M]);return Number.isFinite(C)?C:null})}}),f=d==="pie"||d==="donut";if(f&&m.length>1)throw new Error("pie takes exactly one series (labels are the slices)");if(f&&!m[0].data.some(k=>k>0))throw new Error("pie needs at least one positive value");let h=al,w=a.aspect??l.aspect??null;if(w!=null){let k=String(w).match(/^\s*(\d+(?:\.\d+)?)\s*[:x]\s*(\d+(?:\.\d+)?)\s*$/i);if(!k||+k[1]==0)throw new Error(`bad aspect "${w}" \u2014 use "w:h", e.g. "4:3"`);h=Math.round(Js*+k[2]/+k[1])}return{type:f?"pie":d,donut:d==="donut"||l.donut===!0,title:a.title??(l.title!=null?String(l.title):null),labels:u,series:m,legend:l.legend,width:Js,height:h,build:l.build}}function cl(r,a,l=5){if(!Number.isFinite(r)||!Number.isFinite(a))throw new Error("niceTicks: non-finite range");if(r>a&&([r,a]=[a,r]),r===a){let I=r===0?1:Math.abs(r)/2;r-=r===0?0:I,a+=I}let d=(a-r)/Math.max(1,l-1),u=10**Math.floor(Math.log10(d)),m=d/u,f=(m<=1?1:m<=2?2:m<=2.5?2.5:m<=5?5:10)*u,h=Math.floor(r/f+1e-9)*f,w=Math.ceil(a/f-1e-9)*f,k=Math.max(1,Math.round((w-h)/f)),A=Array.from({length:k+1},(I,M)=>+(h+M*f).toPrecision(12));return{min:A[0],max:A[k],step:f,ticks:A}}function dl(r,a){let l=0;for(;l<6&&Math.abs(Math.round(a*10**l)-a*10**l)>1e-9;)l++;return r.toFixed(l)}function ul(r,a,l,d){let u=d.max-d.min||1,m=A=>l.y+l.h*(1-(A-d.min)/u),f=m(Math.max(d.min,Math.min(d.max,0))),h=l.w/a,w=h*.72,k=w/r.length;return r.map((A,I)=>Array.from({length:a},(M,C)=>{let $=A.data[C];if($==null||!Number.isFinite($))return null;let q=m($);return{x:l.x+C*h+(h-w)/2+I*k+1,y:Math.min(q,f),w:Math.max(1,k-2),h:Math.abs(f-q),value:$}}))}function pl(r){let a="",l=!1;for(let d of r){if(!d){l=!1;continue}a+=`${l?"L":"M"}${ve(d.x)} ${ve(d.y)}`,l=!0}return a}function hl(r,a){let l=r.filter(Boolean);if(!l.length)return"";let d=`M${ve(l[0].x)} ${ve(a)}`;for(let u of l)d+=`L${ve(u.x)} ${ve(u.y)}`;return d+=`L${ve(l[l.length-1].x)} ${ve(a)}Z`,d}function ml(r,a,l,d,u=0){let m=r.map(k=>Math.max(0,Number(k)||0)),f=m.reduce((k,A)=>k+A,0);if(f<=0)throw new Error("pie needs at least one positive value");let h=(k,A)=>[a+A*Math.cos(k),l+A*Math.sin(k)],w=-Math.PI/2;return m.map(k=>{let A=k/f,I=w,M=w+A*2*Math.PI;w=M;let C=(I+M)/2,$=u>0?(d+u)/2:d*.66,[q,he]=h(C,$),[oe,de]=h(C,d+14),j={value:k,frac:A,mid:C,labelX:q,labelY:he,outX:oe,outY:de,anchor:Math.cos(C)<-1e-6?"end":Math.cos(C)>1e-6?"start":"middle"};if(A===0)return{...j,d:""};let me;if(A>=.9999){let[Te,$e]=h(I,d),[Re,be]=h(I+Math.PI,d);if(me=`M${ve(Te)} ${ve($e)}A${ve(d)} ${ve(d)} 0 1 1 ${ve(Re)} ${ve(be)}A${ve(d)} ${ve(d)} 0 1 1 ${ve(Te)} ${ve($e)}Z`,u>0){let[Ce,Xe]=h(I,u),[xe,E]=h(I+Math.PI,u);me+=`M${ve(Ce)} ${ve(Xe)}A${ve(u)} ${ve(u)} 0 1 0 ${ve(xe)} ${ve(E)}A${ve(u)} ${ve(u)} 0 1 0 ${ve(Ce)} ${ve(Xe)}Z`}}else{let Te=M-I>Math.PI?1:0,[$e,Re]=h(I,d),[be,Ce]=h(M,d);if(u>0){let[Xe,xe]=h(M,u),[E,Ie]=h(I,u);me=`M${ve($e)} ${ve(Re)}A${ve(d)} ${ve(d)} 0 ${Te} 1 ${ve(be)} ${ve(Ce)}L${ve(Xe)} ${ve(xe)}A${ve(u)} ${ve(u)} 0 ${Te} 0 ${ve(E)} ${ve(Ie)}Z`}else me=`M${ve(a)} ${ve(l)}L${ve($e)} ${ve(Re)}A${ve(d)} ${ve(d)} 0 ${Te} 1 ${ve(be)} ${ve(Ce)}Z`}return{...j,d:me}})}var Tn='fill="var(--d-text)"';function Dr(r,a){return`<g class="chart-series" data-series="${a+1}" data-name="${vt(r.name)}"`+(r.concept?` data-concept="${vt(r.concept)}"`:"")+">"}function fl(r,a,l){let d=r.series.flatMap($=>$.data).filter($=>$!=null),u=Math.min(0,...d),m=Math.max(0,...d),f=cl(u,m===u?u+1:m,5),h=f.ticks.map($=>dl($,f.step)),w=14+Math.max(...h.map($=>$.length))*6.6+8,k={x:w,y:r.title||eo(r)?40:18,w:r.width-w-14,h:0};k.h=r.height-k.y-34;let A=f.max-f.min||1,I=$=>k.y+k.h*(1-($-f.min)/A);f.ticks.forEach(($,q)=>{let he=I($);a.push(`<line class="chart-grid" x1="${ve(k.x)}" y1="${ve(he)}" x2="${ve(k.x+k.w)}" y2="${ve(he)}" stroke="var(--d-muted)" stroke-opacity="0.35" stroke-width="1"/>`),a.push(`<text class="chart-tick" x="${ve(k.x-8)}" y="${ve(he+4)}" text-anchor="end" font-size="11" ${Tn}>${vt(h[q])}</text>`)}),a.push(`<line class="chart-axis" x1="${ve(k.x)}" y1="${ve(k.y)}" x2="${ve(k.x)}" y2="${ve(k.y+k.h)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let M=I(Math.max(f.min,Math.min(f.max,0)));a.push(`<line class="chart-axis" x1="${ve(k.x)}" y1="${ve(M)}" x2="${ve(k.x+k.w)}" y2="${ve(M)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let C=k.w/r.labels.length;if(r.labels.forEach(($,q)=>{a.push(`<text class="chart-cat" x="${ve(k.x+(q+.5)*C)}" y="${ve(k.y+k.h+20)}" text-anchor="middle" font-size="12" ${Tn}>${vt($)}</text>`)}),r.type==="bar"){let $=ul(r.series,r.labels.length,k,f);r.series.forEach((q,he)=>{l.push(Dr(q,he)),$[he].forEach(oe=>{oe&&l.push(`<rect class="chart-bar draw-fade" x="${ve(oe.x)}" y="${ve(oe.y)}" width="${ve(oe.w)}" height="${ve(oe.h)}" rx="2" fill="${_n(he)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`)}),l.push("</g>")})}else r.series.forEach(($,q)=>{let he=$.data.map((j,me)=>j==null?null:{x:k.x+(me+.5)*C,y:I(j)}),oe=pl(he),de='stroke-linejoin="round" stroke-linecap="round"';if(l.push(Dr($,q)),r.type==="area"&&l.push(`<path class="chart-area draw-fade" d="${hl(he,M)}" fill="${_n(q)}" fill-opacity="0.35"/>`),l.push(`<g class="chart-casing"><path d="${oe}" fill="none" stroke="var(--d-stroke)" stroke-width="4.5" ${de}/></g>`),l.push(`<path class="chart-line" d="${oe}" fill="none" stroke="${_n(q)}" stroke-width="2.5" ${de}/>`),r.type==="line")for(let j of he)j&&l.push(`<circle class="chart-dot draw-fade" cx="${ve(j.x)}" cy="${ve(j.y)}" r="4" fill="${_n(q)}" stroke="var(--d-stroke)" stroke-width="1"/>`);l.push("</g>")})}function gl(r,a){let l=r.title?40:16,d=r.width/2,u=l+(r.height-l-12)/2,m=Math.max(24,Math.min((r.height-l-12)/2-26,r.width/2-110)),f=ml(r.series[0].data.map(h=>h??0),d,u,m,r.donut?m*.55:0);a.push(Dr(r.series[0],0)),f.forEach((h,w)=>{h.d&&(a.push(`<path class="chart-slice draw-fade" d="${h.d}" fill="${_n(w)}" fill-rule="evenodd" stroke="var(--d-stroke)" stroke-width="1.5" stroke-linejoin="round"/>`),a.push(`<text class="chart-cat draw-fade" x="${ve(h.outX)}" y="${ve(h.outY+4)}" text-anchor="${h.anchor}" font-size="12" ${Tn}>${vt(r.labels[w])}</text>`),h.frac>=.05&&a.push(`<text class="chart-value draw-fade" x="${ve(h.labelX)}" y="${ve(h.labelY+4)}" text-anchor="middle" font-size="12" font-weight="600" ${Tn}>${Math.round(h.frac*100)}%</text>`))}),a.push("</g>")}function eo(r){return r.legend===!0?!0:r.legend===!1?!1:r.type!=="pie"&&r.series.length>1}function bl(r){let a=[],l=[];if(r.title&&a.push(`<text class="chart-title" x="14" y="24" font-size="15" font-weight="600" ${Tn}>${vt(r.title)}</text>`),eo(r)){let u=r.series.map(f=>({name:f.name,w:f.name.length*6.6+24})),m=r.width-14-u.reduce((f,h)=>f+h.w,0);r.series.forEach((f,h)=>{a.push(`<rect class="chart-swatch" x="${ve(m)}" y="14" width="11" height="11" rx="2" fill="${_n(h)}" stroke="var(--d-stroke)" stroke-width="1"/>`),a.push(`<text class="chart-legend" x="${ve(m+16)}" y="24" font-size="12" ${Tn}>${vt(f.name)}</text>`),m+=u[h].w})}r.type==="pie"?gl(r,l):fl(r,a,l);let d=r.title?`${r.title} \u2014 ${r.type} chart`:`${r.type} chart`;return`<svg class="chart-svg" viewBox="0 0 ${r.width} ${r.height}" role="img" aria-label="${vt(d)}" preserveAspectRatio="xMidYMid meet"><g class="chart-chrome" data-build-stay>${a.join("")}</g>`+l.join("")+"</svg>"}function to(r){r.querySelectorAll("[data-chart]").forEach(a=>{if(a.querySelector(":scope > svg.chart-svg, :scope > .chart-broken"))return;a.classList.add("chart");let l=a.querySelector('script[type="application/json"]');try{let d=ll(l?l.textContent:null,{type:a.getAttribute("data-chart")||void 0,title:a.getAttribute("data-title")||void 0,aspect:a.getAttribute("data-aspect")||void 0}),u=document.createElement("template");u.innerHTML=bl(d);let m=u.content.firstElementChild;a.hasAttribute("data-build")?(m.setAttribute("data-build",a.getAttribute("data-build")),a.removeAttribute("data-build")):d.build!=null&&d.build!==!1&&m.setAttribute("data-build",d.build===!0?"":String(d.build)),a.getAttribute("data-chart")||a.setAttribute("data-chart",d.donut?"donut":d.type),a.insertBefore(m,l)}catch(d){let u=document.createElement("div");u.className="chart-broken",u.textContent=`chart: ${d.message||d}`,a.insertBefore(u,l)}})}ae();le();ae();le();function or(r,a){let l=String(r??"").trim(),d=parseFloat(l);return!Number.isFinite(d)||d<=0?a:l.endsWith("ms")?d:l.endsWith("s")?d*1e3:d}var Un=["opacity","color","backgroundColor","borderRadius","fontSize"],no=(r=Un)=>["transform",...r.map(a=>a.replace(/[A-Z]/g,l=>`-${l.toLowerCase()}`))];function ro(r,a,l,d=!1){let u=l?.x||1,m=l?.y||1,f=(r.rect.left-a.rect.left)/u,h=(r.rect.top-a.rect.top)/m,w=d||!a.rect.width?1:r.rect.width/a.rect.width,k=d||!a.rect.height?1:r.rect.height/a.rect.height;return{dx:f,dy:h,sx:w,sy:k}}function so({dx:r,dy:a,sx:l,sy:d}){return!r&&!a&&l===1&&d===1?"":`translate(${r}px, ${a}px) scale(${l}, ${d})`}var oo=(r,a)=>r||a||"fade";function io(r,a){if(r==="none")return null;let l=`dir-${a}`;return{entering:["entering",`tr-${r}`,l],leaving:["leaving",`tr-${r}`,l,"active-out"]}}var yl=no();function ao(r){let a=getComputedStyle(r),l={rect:r.getBoundingClientRect()};for(let d of Un)l[d]=a[d];return l}function wl(r,a){if(r.ownerSVGElement){let l=r.getScreenCTM?.();if(l&&l.a&&l.d)return{x:l.a,y:l.d}}return{x:a,y:a}}function lo(r,a,l){let d=or(getComputedStyle(a).getPropertyValue("--auto-animate-duration"),500),u=new Map;r.querySelectorAll("[data-id]").forEach(h=>{u.set(h.getAttribute("data-id"),ao(h))});let m=[];a.querySelectorAll("[data-id]").forEach(h=>{let w=u.get(h.getAttribute("data-id"));w&&m.push({el:h,o:w})});for(let{el:h,o:w}of m){let k=ao(h),A=wl(h,l),I=h.children.length===0&&w.fontSize!==k.fontSize,M=ro(w,k,A,I),C=h.getAttribute("style")??"";h.style.transition="none",h.ownerSVGElement&&(h.style.transformBox="fill-box"),h.style.transformOrigin="0 0",h.style.transform=so(M);for(let q of Un)h.style[q]=w[q];h.offsetWidth,h.style.transition=yl.map(q=>`${q} ${d}ms ease`).join(", "),h.style.transform="";for(let q of Un)h.style[q]=k[q];let $=()=>{C?h.setAttribute("style",C):h.removeAttribute("style"),h.removeEventListener("transitionend",$)};h.addEventListener("transitionend",$),setTimeout($,d+80)}let f=new Set(m.map(h=>h.el));return[...a.children].forEach(h=>{h.matches("aside.notes")||f.has(h)||[...f].some(k=>h.contains(k))||(h.classList.add("aa-fresh"),requestAnimationFrame(()=>requestAnimationFrame(()=>h.classList.add("aa-in"))),setTimeout(()=>h.classList.remove("aa-fresh","aa-in"),d+120))}),d}ae();le();ae();le();var co=function(){"use strict";class r{constructor(t,n){let i,c=" "+t,p=n&&n.loc;if(p&&p.start<=p.end){let v=p.lexer.input;i=p.start;let D=p.end;i===v.length?c+=" at end of input: ":c+=" at position "+(i+1)+`:
5
- `;let z=v.slice(i,D).replace(/[^]/g,"$&\u0332"),se,ce;se=i>15?"\u2026"+v.slice(i-15,i):v.slice(0,i),ce=D+15<v.length?v.slice(D,D+15)+"\u2026":v.slice(D),c+=se+z+ce}let b=new Error(c);return b.name="ParseError",b.__proto__=r.prototype,b.position=i,b}}r.prototype.__proto__=Error.prototype;let a=function(e,t){return e===void 0?t:e},l=/([A-Z])/g,d=function(e){return e.replace(l,"-$1").toLowerCase()},u={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},m=/[&><"']/g;function f(e){return String(e).replace(m,t=>u[t])}let h=function(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?h(e.body[0]):e:e.type==="font"?h(e.body):e},w=function(e){let t=h(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},k=function(e){return+e.toFixed(4)},A="aceg\u0131\u0237mnopqrsuvwxyz\u03B1\u03B3\u03B5\u03B7\u03B9\u03BA\u03BC\u03BD\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C7\u03C9\u03D5\u{1D41A}\u{1D41C}\u{1D41E}\u{1D420}\u{1D426}\u{1D427}\u{1D428}\u{1D429}\u{1D42A}\u{1D42B}\u{1D42C}\u{1D42E}\u{1D42F}\u{1D430}\u{1D431}\u{1D432}\u{1D433}";class I{constructor(t){t=t||{},this.displayMode=a(t.displayMode,!1),this.annotate=a(t.annotate,!1),this.leqno=a(t.leqno,!1),this.throwOnError=a(t.throwOnError,!1),this.errorColor=a(t.errorColor,"#b22222"),this.macros=t.macros||{},this.wrap=a(t.wrap,"none"),this.xml=a(t.xml,!1),this.colorIsTextColor=a(t.colorIsTextColor,!1),this.strict=a(t.strict,!1),this.trust=a(t.trust,!1),this.maxSize=t.maxSize===void 0?[1/0,1/0]:Array.isArray(t.maxSize)?t.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,a(t.maxExpand,1e3)),this.wrapDelimiterPairs=!0}isTrusted(t){if(t.url&&!t.protocol){let i=function(c){let p=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(c);return p?p[2]!==":"?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(p[1])?p[1].toLowerCase():null:"_relative"}(t.url);if(i==null)return!1;t.protocol=i}return!!(typeof this.trust=="function"?this.trust(t):this.trust)}}let M={},C={};function $({type:e,names:t,props:n,handler:i,mathmlBuilder:c}){let p={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0||n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i};for(let b=0;b<t.length;++b)M[t[b]]=p;e&&c&&(C[e]=c)}function q({type:e,mathmlBuilder:t}){$({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}let he=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},oe=function(e){return e.type==="ordgroup"?e.body:[e]};class de{constructor(t){this.children=t,this.classes=[],this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createDocumentFragment();for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){return this.children.map(t=>t.toText()).join("")}}let j=function(e){return e.filter(t=>t).join(" ")},me=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},Te=function(e){let t=document.createElement(e);t.className=j(this.classes);for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t},$e=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${f(j(this.classes))}"`);let n="";for(let i in this.style)Object.prototype.hasOwnProperty.call(this.style,i)&&(n+=`${d(i)}:${this.style[i]};`);n&&(t+=` style="${n}"`);for(let i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&(t+=` ${i}="${f(this.attributes[i])}"`);t+=">";for(let i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+=`</${e}>`,t};class Re{constructor(t,n,i){me.call(this,t,i),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}toNode(){return Te.call(this,"span")}toMarkup(){return $e.call(this,"span")}}let be=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.text)}};class Ce{constructor(t,n,i){this.href=t,this.classes=n,this.children=i||[]}toNode(){let t=document.createElement("a");t.setAttribute("href",this.href),this.classes.length>0&&(t.className=j(this.classes));for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t=`<a href='${f(this.href)}'`;this.classes.length>0&&(t+=` class="${f(j(this.classes))}"`),t+=">";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</a>",t}}class Xe{constructor(t,n,i){this.alt=n,this.src=t,this.classes=["mord"],this.style=i}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);return t}toMarkup(){let t=`<img src='${this.src}' alt='${this.alt}'`,n="";for(let i in this.style)Object.prototype.hasOwnProperty.call(this.style,i)&&(n+=`${d(i)}:${this.style[i]};`);return n&&(t+=` style="${f(n)}"`),t+=">",t}}function xe(e){return new de(e)}class E{constructor(t,n,i,c){this.type=t,this.attributes={},this.children=n||[],this.classes=i||[],this.style=c||{},this.label=""}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}setLabel(t){this.label=t}toNode(){let t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=j(this.classes));for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="<"+this.type;for(let i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&(t+=" "+i+'="',t+=f(this.attributes[i]),t+='"');this.classes.length>0&&(t+=` class="${f(j(this.classes))}"`);let n="";for(let i in this.style)Object.prototype.hasOwnProperty.call(this.style,i)&&(n+=`${d(i)}:${this.style[i]};`);n&&(t+=` style="${n}"`),t+=">";for(let i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}class Ie{constructor(t){this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.toText())}toText(){return this.text}}let qe=e=>{let t;return e.length===1&&e[0].type==="mrow"?(t=e.pop(),t.type="mstyle"):t=new E("mstyle",e),t},De=e=>{let t=0;if(e.body&&Array.isArray(e.body))for(let n of e.body)t+=De(n);else if(e.body)t+=De(e.body);else if(e.type==="supsub")t+=De(e.base),e.sub&&(t+=.7*De(e.sub)),e.sup&&(t+=.7*De(e.sup));else if(e.type==="mathord"||e.type==="textord")for(let n of e.text.split("")){let i=n.codePointAt(0);t+=96<i&&i<123||944<i&&i<970?.56:47<i&&i<58?.5:.92}else t+=1;return t},F={widehat:"^",widecheck:"\u02C7",widetilde:"~",wideparen:"\u23DC",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overbracket:"\u23B4",underbracket:"\u23B5",overgroup:"\u23E0",overparen:"\u23DC",undergroup:"\u23E1",underparen:"\u23DD",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xrightleftarrows:"\u21C4",xtofrom:"\u21C4",xleftrightharpoons:"\u21CB",xrightleftharpoons:"\u21CC",yields:"\u2192",yieldsLeft:"\u2190",mesomerism:"\u2194",longrightharpoonup:"\u21C0",longleftharpoondown:"\u21BD",eqrightharpoonup:"\u21C0",eqleftharpoondown:"\u21BD","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"=",yieldsLeftRight:"\u21C4",chemequilibrium:"\u21CC"},J=function(e){let t=new Ie(F[e.slice(1)]),n=new E("mo",[t]);return n.setAttribute("stretchy","true"),n},U=["\\widetilde","\\widehat","\\widecheck","\\utilde"],fe=e=>{let t=J(e.label);if(U.includes(e.label)){let n=De(e.base);1<n&&n<1.6?t.classes.push("tml-crooked-2"):1.6<=n&&n<2.5?t.classes.push("tml-crooked-3"):2.5<=n&&t.classes.push("tml-crooked-4")}return t},Ee={bin:1,close:1,inner:1,open:1,punct:1,rel:1},ze={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ne={math:{},text:{}};function s(e,t,n,i,c){Ne[e][i]={group:t,replace:n},c&&n&&(Ne[e][n]=Ne[e][i])}let o="math",O="text",Be="accent-token",P="bin",Ue="close",nt="inner",W="mathord",Ae="op-token",Q="open",ye="punct",x="rel",we="spacing",g="textord";s(o,x,"\u2261","\\equiv",!0),s(o,x,"\u227A","\\prec",!0),s(o,x,"\u227B","\\succ",!0),s(o,x,"\u223C","\\sim",!0),s(o,x,"\u27C2","\\perp",!0),s(o,x,"\u2AAF","\\preceq",!0),s(o,x,"\u2AB0","\\succeq",!0),s(o,x,"\u2243","\\simeq",!0),s(o,x,"\u224C","\\backcong",!0),s(o,x,"|","\\mid",!0),s(o,x,"\u226A","\\ll",!0),s(o,x,"\u226B","\\gg",!0),s(o,x,"\u224D","\\asymp",!0),s(o,x,"\u2225","\\parallel"),s(o,x,"\u2323","\\smile",!0),s(o,x,"\u2291","\\sqsubseteq",!0),s(o,x,"\u2292","\\sqsupseteq",!0),s(o,x,"\u2250","\\doteq",!0),s(o,x,"\u2322","\\frown",!0),s(o,x,"\u220B","\\ni",!0),s(o,x,"\u220C","\\notni",!0),s(o,x,"\u221D","\\propto",!0),s(o,x,"\u22A2","\\vdash",!0),s(o,x,"\u22A3","\\dashv",!0),s(o,x,"\u220B","\\owns"),s(o,x,"\u2258","\\arceq",!0),s(o,x,"\u2259","\\wedgeq",!0),s(o,x,"\u225A","\\veeeq",!0),s(o,x,"\u225B","\\stareq",!0),s(o,x,"\u225D","\\eqdef",!0),s(o,x,"\u225E","\\measeq",!0),s(o,x,"\u225F","\\questeq",!0),s(o,x,"\u2260","\\ne",!0),s(o,x,"\u2260","\\neq"),s(o,x,"\u2A75","\\eqeq",!0),s(o,x,"\u2A76","\\eqeqeq",!0),s(o,x,"\u2237","\\dblcolon",!0),s(o,x,"\u2254","\\coloneqq",!0),s(o,x,"\u2255","\\eqqcolon",!0),s(o,x,"\u2239","\\eqcolon",!0),s(o,x,"\u2A74","\\Coloneqq",!0),s(o,ye,".","\\ldotp"),s(o,ye,"\xB7","\\cdotp"),s(o,g,"#","\\#"),s(O,g,"#","\\#"),s(o,g,"&","\\&"),s(O,g,"&","\\&"),s(o,g,"\u2135","\\aleph",!0),s(o,g,"\u2200","\\forall",!0),s(o,g,"\u210F","\\hbar",!0),s(o,g,"\u2203","\\exists",!0),s(o,Q,"\u2207","\\nabla",!0),s(o,g,"\u266D","\\flat",!0),s(o,g,"\u2113","\\ell",!0),s(o,g,"\u266E","\\natural",!0),s(o,g,"\u212B","\\Angstrom",!0),s(O,g,"\u212B","\\Angstrom",!0),s(o,g,"\u2663","\\clubsuit",!0),s(o,g,"\u2667","\\varclubsuit",!0),s(o,g,"\u2118","\\wp",!0),s(o,g,"\u266F","\\sharp",!0),s(o,g,"\u2662","\\diamondsuit",!0),s(o,g,"\u2666","\\vardiamondsuit",!0),s(o,g,"\u211C","\\Re",!0),s(o,g,"\u2661","\\heartsuit",!0),s(o,g,"\u2665","\\varheartsuit",!0),s(o,g,"\u2111","\\Im",!0),s(o,g,"\u2660","\\spadesuit",!0),s(o,g,"\u2664","\\varspadesuit",!0),s(o,g,"\u2640","\\female",!0),s(o,g,"\u2642","\\male",!0),s(o,g,"\xA7","\\S",!0),s(O,g,"\xA7","\\S"),s(o,g,"\xB6","\\P",!0),s(O,g,"\xB6","\\P"),s(O,g,"\u263A","\\smiley",!0),s(o,g,"\u263A","\\smiley",!0),s(o,g,"\u2020","\\dag"),s(O,g,"\u2020","\\dag"),s(O,g,"\u2020","\\textdagger"),s(o,g,"\u2021","\\ddag"),s(O,g,"\u2021","\\ddag"),s(O,g,"\u2021","\\textdaggerdbl"),s(o,Ue,"\u23B1","\\rmoustache",!0),s(o,Q,"\u23B0","\\lmoustache",!0),s(o,Ue,"\u27EF","\\rgroup",!0),s(o,Q,"\u27EE","\\lgroup",!0),s(o,P,"\u2213","\\mp",!0),s(o,P,"\u2296","\\ominus",!0),s(o,P,"\u228E","\\uplus",!0),s(o,P,"\u2293","\\sqcap",!0),s(o,P,"\u2217","\\ast"),s(o,P,"\u2294","\\sqcup",!0),s(o,P,"\u25EF","\\bigcirc",!0),s(o,P,"\u2219","\\bullet",!0),s(o,P,"\u2021","\\ddagger"),s(o,P,"\u2240","\\wr",!0),s(o,P,"\u2A3F","\\amalg"),s(o,P,"&","\\And"),s(o,P,"\u2AFD","\\sslash",!0),s(o,x,"\u27F5","\\longleftarrow",!0),s(o,x,"\u21D0","\\Leftarrow",!0),s(o,x,"\u27F8","\\Longleftarrow",!0),s(o,x,"\u27F6","\\longrightarrow",!0),s(o,x,"\u21D2","\\Rightarrow",!0),s(o,x,"\u27F9","\\Longrightarrow",!0),s(o,x,"\u2194","\\leftrightarrow",!0),s(o,x,"\u27F7","\\longleftrightarrow",!0),s(o,x,"\u21D4","\\Leftrightarrow",!0),s(o,x,"\u27FA","\\Longleftrightarrow",!0),s(o,x,"\u21A4","\\mapsfrom",!0),s(o,x,"\u21A6","\\mapsto",!0),s(o,x,"\u27FC","\\longmapsto",!0),s(o,x,"\u2197","\\nearrow",!0),s(o,x,"\u21A9","\\hookleftarrow",!0),s(o,x,"\u21AA","\\hookrightarrow",!0),s(o,x,"\u2198","\\searrow",!0),s(o,x,"\u21BC","\\leftharpoonup",!0),s(o,x,"\u21C0","\\rightharpoonup",!0),s(o,x,"\u2199","\\swarrow",!0),s(o,x,"\u21BD","\\leftharpoondown",!0),s(o,x,"\u21C1","\\rightharpoondown",!0),s(o,x,"\u2196","\\nwarrow",!0),s(o,x,"\u21CC","\\rightleftharpoons",!0),s(o,W,"\u21AF","\\lightning",!0),s(o,W,"\u220E","\\QED",!0),s(o,W,"\u2030","\\permil",!0),s(O,g,"\u2030","\\permil"),s(o,W,"\u2609","\\astrosun",!0),s(o,W,"\u263C","\\sun",!0),s(o,W,"\u263E","\\leftmoon",!0),s(o,W,"\u263D","\\rightmoon",!0),s(o,W,"\u2295","\\Earth"),s(o,x,"\u226E","\\nless",!0),s(o,x,"\u2A87","\\lneq",!0),s(o,x,"\u2268","\\lneqq",!0),s(o,x,"\u2268\uFE00","\\lvertneqq"),s(o,x,"\u22E6","\\lnsim",!0),s(o,x,"\u2A89","\\lnapprox",!0),s(o,x,"\u2280","\\nprec",!0),s(o,x,"\u22E0","\\npreceq",!0),s(o,x,"\u22E8","\\precnsim",!0),s(o,x,"\u2AB9","\\precnapprox",!0),s(o,x,"\u2241","\\nsim",!0),s(o,x,"\u2224","\\nmid",!0),s(o,x,"\u2224","\\nshortmid"),s(o,x,"\u22AC","\\nvdash",!0),s(o,x,"\u22AD","\\nvDash",!0),s(o,x,"\u22EA","\\ntriangleleft"),s(o,x,"\u22EC","\\ntrianglelefteq",!0),s(o,x,"\u2284","\\nsubset",!0),s(o,x,"\u2285","\\nsupset",!0),s(o,x,"\u228A","\\subsetneq",!0),s(o,x,"\u228A\uFE00","\\varsubsetneq"),s(o,x,"\u2ACB","\\subsetneqq",!0),s(o,x,"\u2ACB\uFE00","\\varsubsetneqq"),s(o,x,"\u226F","\\ngtr",!0),s(o,x,"\u2A88","\\gneq",!0),s(o,x,"\u2269","\\gneqq",!0),s(o,x,"\u2269\uFE00","\\gvertneqq"),s(o,x,"\u22E7","\\gnsim",!0),s(o,x,"\u2A8A","\\gnapprox",!0),s(o,x,"\u2281","\\nsucc",!0),s(o,x,"\u22E1","\\nsucceq",!0),s(o,x,"\u22E9","\\succnsim",!0),s(o,x,"\u2ABA","\\succnapprox",!0),s(o,x,"\u2246","\\ncong",!0),s(o,x,"\u2226","\\nparallel",!0),s(o,x,"\u2226","\\nshortparallel"),s(o,x,"\u22AF","\\nVDash",!0),s(o,x,"\u22EB","\\ntriangleright"),s(o,x,"\u22ED","\\ntrianglerighteq",!0),s(o,x,"\u228B","\\supsetneq",!0),s(o,x,"\u228B","\\varsupsetneq"),s(o,x,"\u2ACC","\\supsetneqq",!0),s(o,x,"\u2ACC\uFE00","\\varsupsetneqq"),s(o,x,"\u22AE","\\nVdash",!0),s(o,x,"\u2AB5","\\precneqq",!0),s(o,x,"\u2AB6","\\succneqq",!0),s(o,P,"\u22B4","\\unlhd"),s(o,P,"\u22B5","\\unrhd"),s(o,x,"\u219A","\\nleftarrow",!0),s(o,x,"\u219B","\\nrightarrow",!0),s(o,x,"\u21CD","\\nLeftarrow",!0),s(o,x,"\u21CF","\\nRightarrow",!0),s(o,x,"\u21AE","\\nleftrightarrow",!0),s(o,x,"\u21CE","\\nLeftrightarrow",!0),s(o,x,"\u25B3","\\vartriangle"),s(o,g,"\u210F","\\hslash"),s(o,g,"\u25BD","\\triangledown"),s(o,g,"\u25CA","\\lozenge"),s(o,g,"\u24C8","\\circledS"),s(o,g,"\xAE","\\circledR",!0),s(O,g,"\xAE","\\circledR"),s(O,g,"\xAE","\\textregistered"),s(o,g,"\u2221","\\measuredangle",!0),s(o,g,"\u2204","\\nexists"),s(o,g,"\u2127","\\mho"),s(o,g,"\u2132","\\Finv",!0),s(o,g,"\u2141","\\Game",!0),s(o,g,"\u2035","\\backprime"),s(o,g,"\u2036","\\backdprime"),s(o,g,"\u2037","\\backtrprime"),s(o,g,"\u25B2","\\blacktriangle"),s(o,g,"\u25BC","\\blacktriangledown"),s(o,g,"\u25A0","\\blacksquare"),s(o,g,"\u29EB","\\blacklozenge"),s(o,g,"\u2605","\\bigstar"),s(o,g,"\u2222","\\sphericalangle",!0),s(o,g,"\u2201","\\complement",!0),s(o,g,"\u2571","\\diagup"),s(o,g,"\u2572","\\diagdown"),s(o,g,"\u25A1","\\square"),s(o,g,"\u25A1","\\Box"),s(o,g,"\u25CA","\\Diamond"),s(o,g,"\xA5","\\yen",!0),s(O,g,"\xA5","\\yen",!0),s(o,g,"\u2713","\\checkmark",!0),s(O,g,"\u2713","\\checkmark"),s(o,g,"\u2717","\\ballotx",!0),s(O,g,"\u2717","\\ballotx"),s(O,g,"\u2022","\\textbullet"),s(o,g,"\u2136","\\beth",!0),s(o,g,"\u2138","\\daleth",!0),s(o,g,"\u2137","\\gimel",!0),s(o,g,"\u03DD","\\digamma",!0),s(o,g,"\u03F0","\\varkappa"),s(o,Q,"\u231C","\\ulcorner",!0),s(o,Ue,"\u231D","\\urcorner",!0),s(o,Q,"\u231E","\\llcorner",!0),s(o,Ue,"\u231F","\\lrcorner",!0),s(o,x,"\u2266","\\leqq",!0),s(o,x,"\u2A7D","\\leqslant",!0),s(o,x,"\u2A95","\\eqslantless",!0),s(o,x,"\u2272","\\lesssim",!0),s(o,x,"\u2A85","\\lessapprox",!0),s(o,x,"\u224A","\\approxeq",!0),s(o,P,"\u22D6","\\lessdot"),s(o,x,"\u22D8","\\lll",!0),s(o,x,"\u2276","\\lessgtr",!0),s(o,x,"\u22DA","\\lesseqgtr",!0),s(o,x,"\u2A8B","\\lesseqqgtr",!0),s(o,x,"\u2251","\\doteqdot"),s(o,x,"\u2253","\\risingdotseq",!0),s(o,x,"\u2252","\\fallingdotseq",!0),s(o,x,"\u223D","\\backsim",!0),s(o,x,"\u22CD","\\backsimeq",!0),s(o,x,"\u2AC5","\\subseteqq",!0),s(o,x,"\u22D0","\\Subset",!0),s(o,x,"\u228F","\\sqsubset",!0),s(o,x,"\u227C","\\preccurlyeq",!0),s(o,x,"\u22DE","\\curlyeqprec",!0),s(o,x,"\u227E","\\precsim",!0),s(o,x,"\u2AB7","\\precapprox",!0),s(o,x,"\u22B2","\\vartriangleleft"),s(o,x,"\u22B4","\\trianglelefteq"),s(o,x,"\u22A8","\\vDash",!0),s(o,x,"\u22AB","\\VDash",!0),s(o,x,"\u22AA","\\Vvdash",!0),s(o,x,"\u2323","\\smallsmile"),s(o,x,"\u2322","\\smallfrown"),s(o,x,"\u224F","\\bumpeq",!0),s(o,x,"\u224E","\\Bumpeq",!0),s(o,x,"\u2267","\\geqq",!0),s(o,x,"\u2A7E","\\geqslant",!0),s(o,x,"\u2A96","\\eqslantgtr",!0),s(o,x,"\u2273","\\gtrsim",!0),s(o,x,"\u2A86","\\gtrapprox",!0),s(o,P,"\u22D7","\\gtrdot"),s(o,x,"\u22D9","\\ggg",!0),s(o,x,"\u2277","\\gtrless",!0),s(o,x,"\u22DB","\\gtreqless",!0),s(o,x,"\u2A8C","\\gtreqqless",!0),s(o,x,"\u2256","\\eqcirc",!0),s(o,x,"\u2257","\\circeq",!0),s(o,x,"\u225C","\\triangleq",!0),s(o,x,"\u223C","\\thicksim"),s(o,x,"\u2248","\\thickapprox"),s(o,x,"\u2AC6","\\supseteqq",!0),s(o,x,"\u22D1","\\Supset",!0),s(o,x,"\u2290","\\sqsupset",!0),s(o,x,"\u227D","\\succcurlyeq",!0),s(o,x,"\u22DF","\\curlyeqsucc",!0),s(o,x,"\u227F","\\succsim",!0),s(o,x,"\u2AB8","\\succapprox",!0),s(o,x,"\u22B3","\\vartriangleright"),s(o,x,"\u22B5","\\trianglerighteq"),s(o,x,"\u22A9","\\Vdash",!0),s(o,x,"\u2223","\\shortmid"),s(o,x,"\u2225","\\shortparallel"),s(o,x,"\u226C","\\between",!0),s(o,x,"\u22D4","\\pitchfork",!0),s(o,x,"\u221D","\\varpropto"),s(o,x,"\u25C0","\\blacktriangleleft"),s(o,x,"\u2234","\\therefore",!0),s(o,x,"\u220D","\\backepsilon"),s(o,x,"\u25B6","\\blacktriangleright"),s(o,x,"\u2235","\\because",!0),s(o,x,"\u22D8","\\llless"),s(o,x,"\u22D9","\\gggtr"),s(o,P,"\u22B2","\\lhd"),s(o,P,"\u22B3","\\rhd"),s(o,x,"\u2242","\\eqsim",!0),s(o,x,"\u2251","\\Doteq",!0),s(o,x,"\u297D","\\strictif",!0),s(o,x,"\u297C","\\strictfi",!0),s(o,P,"\u2214","\\dotplus",!0),s(o,P,"\u2216","\\smallsetminus"),s(o,P,"\u22D2","\\Cap",!0),s(o,P,"\u22D3","\\Cup",!0),s(o,P,"\u2A5E","\\doublebarwedge",!0),s(o,P,"\u229F","\\boxminus",!0),s(o,P,"\u229E","\\boxplus",!0),s(o,P,"\u29C4","\\boxslash",!0),s(o,P,"\u22C7","\\divideontimes",!0),s(o,P,"\u22C9","\\ltimes",!0),s(o,P,"\u22CA","\\rtimes",!0),s(o,P,"\u22CB","\\leftthreetimes",!0),s(o,P,"\u22CC","\\rightthreetimes",!0),s(o,P,"\u22CF","\\curlywedge",!0),s(o,P,"\u22CE","\\curlyvee",!0),s(o,P,"\u229D","\\circleddash",!0),s(o,P,"\u229B","\\circledast",!0),s(o,P,"\u22BA","\\intercal",!0),s(o,P,"\u22D2","\\doublecap"),s(o,P,"\u22D3","\\doublecup"),s(o,P,"\u22A0","\\boxtimes",!0),s(o,P,"\u22C8","\\bowtie",!0),s(o,P,"\u22C8","\\Join"),s(o,P,"\u27D5","\\leftouterjoin",!0),s(o,P,"\u27D6","\\rightouterjoin",!0),s(o,P,"\u27D7","\\fullouterjoin",!0),s(o,P,"\u2238","\\dotminus",!0),s(o,P,"\u27D1","\\wedgedot",!0),s(o,P,"\u27C7","\\veedot",!0),s(o,P,"\u2A62","\\doublebarvee",!0),s(o,P,"\u2A63","\\veedoublebar",!0),s(o,P,"\u2A5F","\\wedgebar",!0),s(o,P,"\u2A60","\\wedgedoublebar",!0),s(o,P,"\u2A54","\\Vee",!0),s(o,P,"\u2A53","\\Wedge",!0),s(o,P,"\u2A43","\\barcap",!0),s(o,P,"\u2A42","\\barcup",!0),s(o,P,"\u2A48","\\capbarcup",!0),s(o,P,"\u2A40","\\capdot",!0),s(o,P,"\u2A47","\\capovercup",!0),s(o,P,"\u2A46","\\cupovercap",!0),s(o,P,"\u2A4D","\\closedvarcap",!0),s(o,P,"\u2A4C","\\closedvarcup",!0),s(o,P,"\u2A2A","\\minusdot",!0),s(o,P,"\u2A2B","\\minusfdots",!0),s(o,P,"\u2A2C","\\minusrdots",!0),s(o,P,"\u22BB","\\Xor",!0),s(o,P,"\u22BC","\\Nand",!0),s(o,P,"\u22BD","\\Nor",!0),s(o,P,"\u22BD","\\barvee"),s(o,P,"\u2AF4","\\interleave",!0),s(o,P,"\u29E2","\\shuffle",!0),s(o,P,"\u2AF6","\\threedotcolon",!0),s(o,P,"\u2982","\\typecolon",!0),s(o,P,"\u223E","\\invlazys",!0),s(o,P,"\u2A4B","\\twocaps",!0),s(o,P,"\u2A4A","\\twocups",!0),s(o,P,"\u2A4E","\\Sqcap",!0),s(o,P,"\u2A4F","\\Sqcup",!0),s(o,P,"\u2A56","\\veeonvee",!0),s(o,P,"\u2A55","\\wedgeonwedge",!0),s(o,P,"\u29D7","\\blackhourglass",!0),s(o,P,"\u29C6","\\boxast",!0),s(o,P,"\u29C8","\\boxbox",!0),s(o,P,"\u29C7","\\boxcircle",!0),s(o,P,"\u229C","\\circledequal",!0),s(o,P,"\u29B7","\\circledparallel",!0),s(o,P,"\u29B6","\\circledvert",!0),s(o,P,"\u29B5","\\circlehbar",!0),s(o,P,"\u27E1","\\concavediamond",!0),s(o,P,"\u27E2","\\concavediamondtickleft",!0),s(o,P,"\u27E3","\\concavediamondtickright",!0),s(o,P,"\u22C4","\\diamond",!0),s(o,P,"\u29D6","\\hourglass",!0),s(o,P,"\u27E0","\\lozengeminus",!0),s(o,P,"\u233D","\\obar",!0),s(o,P,"\u29B8","\\obslash",!0),s(o,P,"\u2A38","\\odiv",!0),s(o,P,"\u29C1","\\ogreaterthan",!0),s(o,P,"\u29C0","\\olessthan",!0),s(o,P,"\u29B9","\\operp",!0),s(o,P,"\u2A37","\\Otimes",!0),s(o,P,"\u2A36","\\otimeshat",!0),s(o,P,"\u22C6","\\star",!0),s(o,P,"\u25B3","\\triangle",!0),s(o,P,"\u2A3A","\\triangleminus",!0),s(o,P,"\u2A39","\\triangleplus",!0),s(o,P,"\u2A3B","\\triangletimes",!0),s(o,P,"\u27E4","\\whitesquaretickleft",!0),s(o,P,"\u27E5","\\whitesquaretickright",!0),s(o,P,"\u2A33","\\smashtimes",!0),s(o,x,"\u21E2","\\dashrightarrow",!0),s(o,x,"\u21E0","\\dashleftarrow",!0),s(o,x,"\u21C7","\\leftleftarrows",!0),s(o,x,"\u21C6","\\leftrightarrows",!0),s(o,x,"\u21DA","\\Lleftarrow",!0),s(o,x,"\u219E","\\twoheadleftarrow",!0),s(o,x,"\u21A2","\\leftarrowtail",!0),s(o,x,"\u21AB","\\looparrowleft",!0),s(o,x,"\u21CB","\\leftrightharpoons",!0),s(o,x,"\u21B6","\\curvearrowleft",!0),s(o,x,"\u21BA","\\circlearrowleft",!0),s(o,x,"\u21B0","\\Lsh",!0),s(o,x,"\u21C8","\\upuparrows",!0),s(o,x,"\u21BF","\\upharpoonleft",!0),s(o,x,"\u21C3","\\downharpoonleft",!0),s(o,x,"\u22B6","\\origof",!0),s(o,x,"\u22B7","\\imageof",!0),s(o,x,"\u22B8","\\multimap",!0),s(o,x,"\u21AD","\\leftrightsquigarrow",!0),s(o,x,"\u21C9","\\rightrightarrows",!0),s(o,x,"\u21C4","\\rightleftarrows",!0),s(o,x,"\u21A0","\\twoheadrightarrow",!0),s(o,x,"\u21A3","\\rightarrowtail",!0),s(o,x,"\u21AC","\\looparrowright",!0),s(o,x,"\u21B7","\\curvearrowright",!0),s(o,x,"\u21BB","\\circlearrowright",!0),s(o,x,"\u21B1","\\Rsh",!0),s(o,x,"\u21CA","\\downdownarrows",!0),s(o,x,"\u21BE","\\upharpoonright",!0),s(o,x,"\u21C2","\\downharpoonright",!0),s(o,x,"\u21DD","\\rightsquigarrow",!0),s(o,x,"\u21DD","\\leadsto"),s(o,x,"\u21DB","\\Rrightarrow",!0),s(o,x,"\u21BE","\\restriction"),s(o,g,"\u2018","`"),s(o,g,"$","\\$"),s(O,g,"$","\\$"),s(O,g,"$","\\textdollar"),s(o,g,"\xA2","\\cent"),s(O,g,"\xA2","\\cent"),s(o,g,"%","\\%"),s(O,g,"%","\\%"),s(o,g,"_","\\_"),s(O,g,"_","\\_"),s(O,g,"_","\\textunderscore"),s(O,g,"\u2423","\\textvisiblespace",!0),s(o,g,"\u2220","\\angle",!0),s(o,g,"\u221E","\\infty",!0),s(o,g,"\u2032","\\prime"),s(o,g,"\u2033","\\dprime"),s(o,g,"\u2034","\\trprime"),s(o,g,"\u2057","\\qprime"),s(o,g,"\u25B3","\\triangle"),s(O,g,"\u0391","\\Alpha",!0),s(O,g,"\u0392","\\Beta",!0),s(O,g,"\u0393","\\Gamma",!0),s(O,g,"\u0394","\\Delta",!0),s(O,g,"\u0395","\\Epsilon",!0),s(O,g,"\u0396","\\Zeta",!0),s(O,g,"\u0397","\\Eta",!0),s(O,g,"\u0398","\\Theta",!0),s(O,g,"\u0399","\\Iota",!0),s(O,g,"\u039A","\\Kappa",!0),s(O,g,"\u039B","\\Lambda",!0),s(O,g,"\u039C","\\Mu",!0),s(O,g,"\u039D","\\Nu",!0),s(O,g,"\u039E","\\Xi",!0),s(O,g,"\u039F","\\Omicron",!0),s(O,g,"\u03A0","\\Pi",!0),s(O,g,"\u03A1","\\Rho",!0),s(O,g,"\u03A3","\\Sigma",!0),s(O,g,"\u03A4","\\Tau",!0),s(O,g,"\u03A5","\\Upsilon",!0),s(O,g,"\u03A6","\\Phi",!0),s(O,g,"\u03A7","\\Chi",!0),s(O,g,"\u03A8","\\Psi",!0),s(O,g,"\u03A9","\\Omega",!0),s(o,W,"\u0391","\\Alpha",!0),s(o,W,"\u0392","\\Beta",!0),s(o,W,"\u0393","\\Gamma",!0),s(o,W,"\u0394","\\Delta",!0),s(o,W,"\u0395","\\Epsilon",!0),s(o,W,"\u0396","\\Zeta",!0),s(o,W,"\u0397","\\Eta",!0),s(o,W,"\u0398","\\Theta",!0),s(o,W,"\u0399","\\Iota",!0),s(o,W,"\u039A","\\Kappa",!0),s(o,W,"\u039B","\\Lambda",!0),s(o,W,"\u039C","\\Mu",!0),s(o,W,"\u039D","\\Nu",!0),s(o,W,"\u039E","\\Xi",!0),s(o,W,"\u039F","\\Omicron",!0),s(o,W,"\u03A0","\\Pi",!0),s(o,W,"\u03A1","\\Rho",!0),s(o,W,"\u03A3","\\Sigma",!0),s(o,W,"\u03A4","\\Tau",!0),s(o,W,"\u03A5","\\Upsilon",!0),s(o,W,"\u03A6","\\Phi",!0),s(o,W,"\u03A7","\\Chi",!0),s(o,W,"\u03A8","\\Psi",!0),s(o,W,"\u03A9","\\Omega",!0),s(o,Q,"\xAC","\\neg",!0),s(o,Q,"\xAC","\\lnot"),s(o,g,"\u22A4","\\top"),s(o,g,"\u22A5","\\bot"),s(o,g,"\u2205","\\emptyset"),s(o,g,"\u2300","\\varnothing"),s(o,W,"\u03B1","\\alpha",!0),s(o,W,"\u03B2","\\beta",!0),s(o,W,"\u03B3","\\gamma",!0),s(o,W,"\u03B4","\\delta",!0),s(o,W,"\u03F5","\\epsilon",!0),s(o,W,"\u03B6","\\zeta",!0),s(o,W,"\u03B7","\\eta",!0),s(o,W,"\u03B8","\\theta",!0),s(o,W,"\u03B9","\\iota",!0),s(o,W,"\u03BA","\\kappa",!0),s(o,W,"\u03BB","\\lambda",!0),s(o,W,"\u03BC","\\mu",!0),s(o,W,"\u03BD","\\nu",!0),s(o,W,"\u03BE","\\xi",!0),s(o,W,"\u03BF","\\omicron",!0),s(o,W,"\u03C0","\\pi",!0),s(o,W,"\u03C1","\\rho",!0),s(o,W,"\u03C3","\\sigma",!0),s(o,W,"\u03C4","\\tau",!0),s(o,W,"\u03C5","\\upsilon",!0),s(o,W,"\u03D5","\\phi",!0),s(o,W,"\u03C7","\\chi",!0),s(o,W,"\u03C8","\\psi",!0),s(o,W,"\u03C9","\\omega",!0),s(o,W,"\u03B5","\\varepsilon",!0),s(o,W,"\u03D1","\\vartheta",!0),s(o,W,"\u03D6","\\varpi",!0),s(o,W,"\u03F1","\\varrho",!0),s(o,W,"\u03C2","\\varsigma",!0),s(o,W,"\u03C6","\\varphi",!0),s(o,W,"\u03D8","\\Coppa",!0),s(o,W,"\u03D9","\\coppa",!0),s(o,W,"\u03D9","\\varcoppa",!0),s(o,W,"\u03DE","\\Koppa",!0),s(o,W,"\u03DF","\\koppa",!0),s(o,W,"\u03E0","\\Sampi",!0),s(o,W,"\u03E1","\\sampi",!0),s(o,W,"\u03DA","\\Stigma",!0),s(o,W,"\u03DB","\\stigma",!0),s(o,W,"\u2AEB","\\Bot"),s(o,g,"\xF0","\\eth",!0),s(O,g,"\xF0","\xF0"),s(o,g,"\xC5","\\AA"),s(O,g,"\xC5","\\AA",!0),s(o,g,"\xC6","\\AE",!0),s(O,g,"\xC6","\\AE",!0),s(o,g,"\xD0","\\DH",!0),s(O,g,"\xD0","\\DH",!0),s(o,g,"\xDE","\\TH",!0),s(O,g,"\xDE","\\TH",!0),s(o,g,"\xDF","\\ss",!0),s(O,g,"\xDF","\\ss",!0),s(o,g,"\xE5","\\aa"),s(O,g,"\xE5","\\aa",!0),s(o,g,"\xE6","\\ae",!0),s(O,g,"\xE6","\\ae",!0),s(o,g,"\xF0","\\dh"),s(O,g,"\xF0","\\dh",!0),s(o,g,"\xFE","\\th",!0),s(O,g,"\xFE","\\th",!0),s(o,g,"\u0110","\\DJ",!0),s(O,g,"\u0110","\\DJ",!0),s(o,g,"\u0111","\\dj",!0),s(O,g,"\u0111","\\dj",!0),s(o,g,"\u0141","\\L",!0),s(O,g,"\u0141","\\L",!0),s(o,g,"\u0141","\\l",!0),s(O,g,"\u0141","\\l",!0),s(o,g,"\u014A","\\NG",!0),s(O,g,"\u014A","\\NG",!0),s(o,g,"\u014B","\\ng",!0),s(O,g,"\u014B","\\ng",!0),s(o,g,"\u0152","\\OE",!0),s(O,g,"\u0152","\\OE",!0),s(o,g,"\u0153","\\oe",!0),s(O,g,"\u0153","\\oe",!0),s(o,P,"\u2217","\u2217",!0),s(o,P,"+","+"),s(o,P,"\u2217","*"),s(o,P,"\u2044","/",!0),s(o,P,"\u2044","\u2044"),s(o,P,"\u2212","-",!0),s(o,P,"\u22C5","\\cdot",!0),s(o,P,"\u2218","\\circ",!0),s(o,P,"\xF7","\\div",!0),s(o,P,"\xB1","\\pm",!0),s(o,P,"\xD7","\\times",!0),s(o,P,"\u2229","\\cap",!0),s(o,P,"\u222A","\\cup",!0),s(o,P,"\u2216","\\setminus",!0),s(o,P,"\u2227","\\land"),s(o,P,"\u2228","\\lor"),s(o,P,"\u2227","\\wedge",!0),s(o,P,"\u2228","\\vee",!0),s(o,Q,"\u27E6","\\llbracket",!0),s(o,Ue,"\u27E7","\\rrbracket",!0),s(o,Q,"\u27E8","\\langle",!0),s(o,Q,"\u27EA","\\lAngle",!0),s(o,Q,"\u2989","\\llangle",!0),s(o,Q,"|","\\lvert"),s(o,Q,"\u2016","\\lVert",!0),s(o,g,"!","\\oc"),s(o,g,"?","\\wn"),s(o,g,"\u2193","\\shpos"),s(o,g,"\u2195","\\shift"),s(o,g,"\u2191","\\shneg"),s(o,Ue,"?","?"),s(o,Ue,"!","!"),s(o,Ue,"\u203C","\u203C"),s(o,Ue,"\u27E9","\\rangle",!0),s(o,Ue,"\u27EB","\\rAngle",!0),s(o,Ue,"\u298A","\\rrangle",!0),s(o,Ue,"|","\\rvert"),s(o,Ue,"\u2016","\\rVert"),s(o,Q,"\u2983","\\lBrace",!0),s(o,Ue,"\u2984","\\rBrace",!0),s(o,x,"=","\\equal",!0),s(o,x,":",":"),s(o,x,"\u2248","\\approx",!0),s(o,x,"\u2245","\\cong",!0),s(o,x,"\u2265","\\ge"),s(o,x,"\u2265","\\geq",!0),s(o,x,"\u2190","\\gets"),s(o,x,">","\\gt",!0),s(o,x,"\u2208","\\in",!0),s(o,x,"\u2209","\\notin",!0),s(o,x,"\uE020","\\@not"),s(o,x,"\u2282","\\subset",!0),s(o,x,"\u2283","\\supset",!0),s(o,x,"\u2286","\\subseteq",!0),s(o,x,"\u2287","\\supseteq",!0),s(o,x,"\u2288","\\nsubseteq",!0),s(o,x,"\u2288","\\nsubseteqq"),s(o,x,"\u2289","\\nsupseteq",!0),s(o,x,"\u2289","\\nsupseteqq"),s(o,x,"\u22A8","\\models"),s(o,x,"\u2190","\\leftarrow",!0),s(o,x,"\u2264","\\le"),s(o,x,"\u2264","\\leq",!0),s(o,x,"<","\\lt",!0),s(o,x,"\u2192","\\rightarrow",!0),s(o,x,"\u2192","\\to"),s(o,x,"\u2271","\\ngeq",!0),s(o,x,"\u2271","\\ngeqq"),s(o,x,"\u2271","\\ngeqslant"),s(o,x,"\u2270","\\nleq",!0),s(o,x,"\u2270","\\nleqq"),s(o,x,"\u2270","\\nleqslant"),s(o,x,"\u2AEB","\\Perp",!0),s(o,we,"\xA0","\\ "),s(o,we,"\xA0","\\space"),s(o,we,"\xA0","\\nobreakspace"),s(O,we,"\xA0","\\ "),s(O,we,"\xA0"," "),s(O,we,"\xA0","\\space"),s(O,we,"\xA0","\\nobreakspace"),s(o,we,null,"\\nobreak"),s(o,we,null,"\\allowbreak"),s(o,ye,",",","),s(O,ye,":",":"),s(o,ye,";",";"),s(o,P,"\u22BC","\\barwedge"),s(o,P,"\u22BB","\\veebar"),s(o,P,"\u2299","\\odot",!0),s(o,P,"\u2295\uFE0E","\\oplus"),s(o,P,"\u2297","\\otimes",!0),s(o,g,"\u2202","\\partial",!0),s(o,P,"\u2298","\\oslash",!0),s(o,P,"\u229A","\\circledcirc",!0),s(o,P,"\u22A1","\\boxdot",!0),s(o,P,"\u25B3","\\bigtriangleup"),s(o,P,"\u25BD","\\bigtriangledown"),s(o,P,"\u2020","\\dagger"),s(o,P,"\u22C4","\\diamond"),s(o,P,"\u25C3","\\triangleleft"),s(o,P,"\u25B9","\\triangleright"),s(o,Q,"{","\\{"),s(O,g,"{","\\{"),s(O,g,"{","\\textbraceleft"),s(o,Ue,"}","\\}"),s(O,g,"}","\\}"),s(O,g,"}","\\textbraceright"),s(o,Q,"{","\\lbrace"),s(o,Ue,"}","\\rbrace"),s(o,Q,"[","\\lbrack",!0),s(O,g,"[","\\lbrack",!0),s(o,Ue,"]","\\rbrack",!0),s(O,g,"]","\\rbrack",!0),s(o,Q,"(","\\lparen",!0),s(o,Ue,")","\\rparen",!0),s(o,Q,"\u2987","\\llparenthesis",!0),s(o,Ue,"\u2988","\\rrparenthesis",!0),s(O,g,"<","\\textless",!0),s(O,g,">","\\textgreater",!0),s(o,Q,"\u230A","\\lfloor",!0),s(o,Ue,"\u230B","\\rfloor",!0),s(o,Q,"\u2308","\\lceil",!0),s(o,Ue,"\u2309","\\rceil",!0),s(o,g,"\\","\\backslash"),s(o,g,"|","|"),s(o,g,"|","\\vert"),s(O,g,"|","\\textbar",!0),s(o,g,"\u2016","\\|"),s(o,g,"\u2016","\\Vert"),s(O,g,"\u2016","\\textbardbl"),s(O,g,"~","\\textasciitilde"),s(O,g,"\\","\\textbackslash"),s(O,g,"^","\\textasciicircum"),s(o,x,"\u2191","\\uparrow",!0),s(o,x,"\u21D1","\\Uparrow",!0),s(o,x,"\u2193","\\downarrow",!0),s(o,x,"\u21D3","\\Downarrow",!0),s(o,x,"\u2195","\\updownarrow",!0),s(o,x,"\u21D5","\\Updownarrow",!0),s(o,Ae,"\u2210","\\coprod"),s(o,Ae,"\u22C1","\\bigvee"),s(o,Ae,"\u22C0","\\bigwedge"),s(o,Ae,"\u2A04","\\biguplus"),s(o,Ae,"\u2A04","\\bigcupplus"),s(o,Ae,"\u2A03","\\bigcupdot"),s(o,Ae,"\u2A07","\\bigdoublevee"),s(o,Ae,"\u2A08","\\bigdoublewedge"),s(o,Ae,"\u22C2","\\bigcap"),s(o,Ae,"\u22C3","\\bigcup"),s(o,Ae,"\u222B","\\int"),s(o,Ae,"\u222B","\\intop"),s(o,Ae,"\u222C","\\iint"),s(o,Ae,"\u222D","\\iiint"),s(o,Ae,"\u220F","\\prod"),s(o,Ae,"\u2211","\\sum"),s(o,Ae,"\u2A02","\\bigotimes"),s(o,Ae,"\u2A01","\\bigoplus"),s(o,Ae,"\u2A00","\\bigodot"),s(o,Ae,"\u2A09","\\bigtimes"),s(o,Ae,"\u222E","\\oint"),s(o,Ae,"\u222F","\\oiint"),s(o,Ae,"\u2230","\\oiiint"),s(o,Ae,"\u2231","\\intclockwise"),s(o,Ae,"\u2232","\\varointclockwise"),s(o,Ae,"\u2A0C","\\iiiint"),s(o,Ae,"\u2A0D","\\intbar"),s(o,Ae,"\u2A0E","\\intBar"),s(o,Ae,"\u2A0F","\\fint"),s(o,Ae,"\u2A12","\\rppolint"),s(o,Ae,"\u2A13","\\scpolint"),s(o,Ae,"\u2A15","\\pointint"),s(o,Ae,"\u2A16","\\sqint"),s(o,Ae,"\u2A17","\\intlarhk"),s(o,Ae,"\u2A18","\\intx"),s(o,Ae,"\u2A19","\\intcap"),s(o,Ae,"\u2A1A","\\intcup"),s(o,Ae,"\u2A05","\\bigsqcap"),s(o,Ae,"\u2A06","\\bigsqcup"),s(o,Ae,"\u222B","\\smallint"),s(O,nt,"\u2026","\\textellipsis"),s(o,nt,"\u2026","\\mathellipsis"),s(O,nt,"\u2026","\\ldots",!0),s(o,nt,"\u2026","\\ldots",!0),s(o,nt,"\u22F0","\\iddots",!0),s(o,nt,"\u22EF","\\@cdots",!0),s(o,nt,"\u22F1","\\ddots",!0),s(o,g,"\u22EE","\\varvdots"),s(O,g,"\u22EE","\\varvdots"),s(o,Be,"\xB4","\\acute"),s(o,Be,"`","\\grave"),s(o,Be,"\xA8","\\ddot"),s(o,Be,"\u2026","\\dddot"),s(o,Be,"\u2026.","\\ddddot"),s(o,Be,"~","\\tilde"),s(o,Be,"\u203E","\\bar"),s(o,Be,"\u02D8","\\breve"),s(o,Be,"\u02C7","\\check"),s(o,Be,"^","\\hat"),s(o,Be,"\u2192","\\vec"),s(o,Be,"\u02D9","\\dot"),s(o,Be,"\u02DA","\\mathring"),s(o,W,"\u0131","\\imath",!0),s(o,W,"\u0237","\\jmath",!0),s(o,g,"\u0131","\u0131"),s(o,g,"\u0237","\u0237"),s(O,g,"\u0131","\\i",!0),s(O,g,"\u0237","\\j",!0),s(O,g,"\xF8","\\o",!0),s(o,W,"\xF8","\\o",!0),s(O,g,"\xD8","\\O",!0),s(o,W,"\xD8","\\O",!0),s(O,Be,"\u02CA","\\'"),s(O,Be,"\u02CB","\\`"),s(O,Be,"\u02C6","\\^"),s(O,Be,"~","\\~"),s(O,Be,"\u02C9","\\="),s(O,Be,"\u02D8","\\u"),s(O,Be,"\u02D9","\\."),s(O,Be,"\xB8","\\c"),s(O,Be,"\u02DA","\\r"),s(O,Be,"\u02C7","\\v"),s(O,Be,"\xA8",'\\"'),s(O,Be,"\u02DD","\\H"),s(o,Be,"\u02CA","\\'"),s(o,Be,"\u02CB","\\`"),s(o,Be,"\u02C6","\\^"),s(o,Be,"~","\\~"),s(o,Be,"\u02C9","\\="),s(o,Be,"\u02D8","\\u"),s(o,Be,"\u02D9","\\."),s(o,Be,"\xB8","\\c"),s(o,Be,"\u02DA","\\r"),s(o,Be,"\u02C7","\\v"),s(o,Be,"\xA8",'\\"'),s(o,Be,"\u02DD","\\H");let G={"--":!0,"---":!0,"``":!0,"''":!0};s(O,g,"\u2013","--",!0),s(O,g,"\u2013","\\textendash"),s(O,g,"\u2014","---",!0),s(O,g,"\u2014","\\textemdash"),s(O,g,"\u2018","`",!0),s(O,g,"\u2018","\\textquoteleft"),s(O,g,"\u2019","'",!0),s(O,g,"\u2019","\\textquoteright"),s(O,g,"\u201C","``",!0),s(O,g,"\u201C","\\textquotedblleft"),s(O,g,"\u201D","''",!0),s(O,g,"\u201D","\\textquotedblright"),s(o,g,"\xB0","\\degree",!0),s(O,g,"\xB0","\\degree"),s(O,g,"\xB0","\\textdegree",!0),s(o,g,"\xA3","\\pounds"),s(o,g,"\xA3","\\mathsterling",!0),s(O,g,"\xA3","\\pounds"),s(O,g,"\xA3","\\textsterling",!0),s(o,g,"\u2720","\\maltese"),s(O,g,"\u2720","\\maltese"),s(o,g,"\u20AC","\\euro",!0),s(O,g,"\u20AC","\\euro",!0),s(O,g,"\u20AC","\\texteuro"),s(o,g,"\xA9","\\copyright",!0),s(O,g,"\xA9","\\textcopyright"),s(o,g,"\u2300","\\diameter",!0),s(O,g,"\u2300","\\diameter"),s(o,g,"\u{1D6E4}","\\varGamma"),s(o,g,"\u{1D6E5}","\\varDelta"),s(o,g,"\u{1D6E9}","\\varTheta"),s(o,g,"\u{1D6EC}","\\varLambda"),s(o,g,"\u{1D6EF}","\\varXi"),s(o,g,"\u{1D6F1}","\\varPi"),s(o,g,"\u{1D6F4}","\\varSigma"),s(o,g,"\u{1D6F6}","\\varUpsilon"),s(o,g,"\u{1D6F7}","\\varPhi"),s(o,g,"\u{1D6F9}","\\varPsi"),s(o,g,"\u{1D6FA}","\\varOmega"),s(O,g,"\u{1D6E4}","\\varGamma"),s(O,g,"\u{1D6E5}","\\varDelta"),s(O,g,"\u{1D6E9}","\\varTheta"),s(O,g,"\u{1D6EC}","\\varLambda"),s(O,g,"\u{1D6EF}","\\varXi"),s(O,g,"\u{1D6F1}","\\varPi"),s(O,g,"\u{1D6F4}","\\varSigma"),s(O,g,"\u{1D6F6}","\\varUpsilon"),s(O,g,"\u{1D6F7}","\\varPhi"),s(O,g,"\u{1D6F9}","\\varPsi"),s(O,g,"\u{1D6FA}","\\varOmega");let B='0123456789/@."';for(let e=0;e<14;e++){let t=B.charAt(e);s(o,g,t,t)}let X='0123456789!@*()-=+";:?/.,';for(let e=0;e<25;e++){let t=X.charAt(e);s(O,g,t,t)}let Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<52;e++){let t=Y.charAt(e);s(o,W,t,t),s(O,g,t,t)}let ge="\xC7\xD0\xDE\xE7\xFE\u2102\u210D\u2115\u2119\u211A\u211D\u2124\u210E\u210F\u210A\u210B\u210C\u2110\u2111\u2112\u2113\u2118\u211B\u211C\u212C\u2130\u2131\u2133\u212D\u2128";for(let e=0;e<30;e++){let t=ge.charAt(e);s(o,W,t,t),s(O,g,t,t)}let V="";for(let e=0;e<52;e++){V=String.fromCharCode(55349,56320+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56372+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56424+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56580+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56736+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56788+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56840+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56944+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56632+e),s(o,W,V,V),s(O,g,V,V);let t=Y.charAt(e);V=String.fromCharCode(55349,56476+e),s(o,W,t,V),s(O,g,t,V)}for(let e=0;e<10;e++)V=String.fromCharCode(55349,57294+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,57314+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,57324+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,57334+e),s(o,W,V,V),s(O,g,V,V);let ne=function(e,t,n){return!Ne[t][e]||!Ne[t][e].replace||e.charCodeAt(0)===55349||Object.prototype.hasOwnProperty.call(G,e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt")||(e=Ne[t][e].replace),new Ie(e)},Fe=(e,t)=>{if(e.children.length===0||e.children[e.children.length-1].type!=="mtext"){let n=new E("mtext",[new Ie(t.children[0].text)]);e.children.push(n)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},Je=e=>{if(e.type!=="mrow"&&e.type!=="mstyle"||e.children.length===0)return e;let t=new E("mrow");for(let n=0;n<e.children.length;n++){let i=e.children[n];if(i.type==="mtext"&&Object.keys(i.attributes).length===0)Fe(t,i);else if(i.type==="mrow"){let c=!0;for(let p=0;p<i.children.length;p++)if(i.children[p].type!=="mtext"||Object.keys(i.attributes).length!==0){c=!1;break}if(c)for(let p=0;p<i.children.length;p++){let b=i.children[p];Fe(t,b)}else t.children.push(i)}else t.children.push(i)}for(let n=0;n<t.children.length;n++)if(t.children[n].type==="mtext"){let i=t.children[n];i.children[0].text.charAt(0)===" "&&(i.children[0].text="\xA0"+i.children[0].text.slice(1));let c=i.children[0].text.length;c>0&&i.children[0].text.charAt(c-1)===" "&&(i.children[0].text=i.children[0].text.slice(0,-1)+"\xA0");for(let[p,b]of Object.entries(e.attributes))i.attributes[p]=b}return t.children.length===1&&t.children[0].type==="mtext"?t.children[0]:t},re=function(e,t=!1){if(!(e.length!==1||e[0]instanceof de))return e[0];if(!t){e[0]instanceof E&&e[0].type==="mo"&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");let n=e.length-1;e[n]instanceof E&&e[n].type==="mo"&&!e[n].attributes.fence&&(e[n].attributes.lspace="0em",e[n].attributes.rspace="0em")}return new E("mrow",e)};function ke(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){let t=e.children[0];return t instanceof Ie&&t.text==="."}if(e.type==="mtext"&&e.children.length===1){let t=e.children[0];return t instanceof Ie&&t.text==="\u2008"}if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){let t=e.children[0];return t instanceof Ie&&t.text===","}return!1}let He=(e,t)=>{let n=e[t],i=e[t+1];return n.type==="atom"&&n.text===","&&n.loc&&i.loc&&n.loc.end===i.loc.start},_e=e=>e.type==="atom"&&e.family==="rel"||e.type==="mclass"&&e.mclass==="mrel",Le=function(e,t,n=!1){if(!n&&e.length===1){let b=Oe(e[0],t);return b instanceof E&&b.type==="mo"&&(b.setAttribute("lspace","0em"),b.setAttribute("rspace","0em")),[b]}let i=[],c=[],p;for(let b=0;b<e.length;b++)c.push(Oe(e[b],t));for(let b=0;b<c.length;b++){let v=c[b];if(b<e.length-1&&_e(e[b])&&_e(e[b+1])&&v.setAttribute("rspace","0em"),b>0&&_e(e[b])&&_e(e[b-1])&&v.setAttribute("lspace","0em"),v.type==="mn"&&p&&p.type==="mn")p.children.push(...v.children);else if(ke(v)&&p&&p.type==="mn")p.children.push(...v.children);else if(p&&p.type==="mn"&&b<c.length-1&&c[b+1].type==="mn"&&He(e,b))p.children.push(...v.children);else{if(v.type==="mn"&&ke(p))v.children=[...p.children,...v.children],i.pop();else if((v.type==="msup"||v.type==="msub")&&v.children.length>=1&&p&&(p.type==="mn"||ke(p))){let D=v.children[0];D instanceof E&&D.type==="mn"&&p&&(D.children=[...p.children,...D.children],i.pop())}i.push(v),p=v}}return i},Qe=function(e,t,n=!1){return re(Le(e,t,n),n)},Oe=function(e,t){if(!e)return new E("mrow");if(C[e.type])return C[e.type](e,t);throw new r("Got group of unknown type: '"+e.type+"'")},Ye=e=>new E("mtd",[],[],{padding:"0",width:"50%"}),ct=["mrow","mtd","mtable","mtr"],_t=e=>{for(let t of e.children)if(t.type&&ct.includes(t.type)){if(t.classes&&t.classes[0]==="tml-label")return t.label;{let n=_t(t);if(n)return n}}else if(!t.type){let n=_t(t);if(n)return n}};function Pt(e,t,n,i){let c=null;e.length===1&&e[0].type==="tag"&&(c=e[0].tag,e=e[0].body);let p=Le(e,n);if(p.length===1&&p[0]instanceof Ce)return p[0];let b=i.displayMode||i.annotate?"none":i.wrap,v=p.length===0?null:p[0],D=p.length===1&&c===null&&v instanceof E?p[0]:function(se,ce,ee){let et=[],Ge=[],tt=[],lt=0,je=0;for(;je<se.length;){for(;se[je]instanceof de;)se.splice(je,1,...se[je].children);let Ze=se[je];if(Ze.attributes&&Ze.attributes.linebreak&&Ze.attributes.linebreak==="newline"){tt.length>0&&Ge.push(new E("mrow",tt)),Ge.push(Ze),tt=[];let Ut=new E("mtd",Ge);Ut.style.textAlign="left",et.push(new E("mtr",[Ut])),Ge=[],je+=1;continue}if(tt.push(Ze),Ze.type&&Ze.type==="mo"&&Ze.children.length===1&&(!Ze.attributes.form||Ze.attributes.form!=="prefix")&&!Object.prototype.hasOwnProperty.call(Ze.attributes,"movablelimits")){let Ut=Ze.children[0].text;if(ce==="="&&Ut==="="){if(lt+=1,lt>1){tt.pop();let Tt=new E("mrow",tt);Ge.push(Tt),tt=[Ze]}}else if(ce==="tex"){let Tt=je<se.length-1?se[je+1]:null,An=!0;if(!Tt||Tt.type!=="mtext"||!Tt.attributes.linebreak||Tt.attributes.linebreak!=="nobreak")for(let en=je+1;en<se.length;en++){let ln=se[en];if(!ln.type||ln.type!=="mspace"||ln.attributes.linebreak&&ln.attributes.linebreak==="newline")break;tt.push(ln),je+=1,ln.attributes&&ln.attributes.linebreak&&ln.attributes.linebreak==="nobreak"&&(An=!1)}if(An){let en=new E("mrow",tt);Ge.push(en),tt=[]}}}je+=1}if(tt.length>0){let Ze=new E("mrow",tt);Ge.push(Ze)}if(et.length>0){let Ze=new E("mtd",Ge);Ze.style.textAlign="left";let Ut=new E("mtr",[Ze]);et.push(Ut);let Tt=new E("mtable",et);return ee||(Tt.setAttribute("columnalign","left"),Tt.setAttribute("rowspacing","0em")),Tt}return xe(Ge)}(p,b,i.displayMode);if(c&&(D=((se,ce,ee,et)=>{ce=Qe(ce[0].body,ee),(ce=Je(ce)).classes.push("tml-tag");let Ge=_t(se);se=new E("mtd",[se]);let tt=[Ye(),se,Ye()];tt[et?0:2].children.push(ce);let lt=new E("mtr",tt,["tml-tageqn"]);Ge&&lt.setAttribute("id",Ge);let je=new E("mtable",[lt]);return je.style.width="100%",je.setAttribute("displaystyle","true"),je})(D,c,n,i.leqno)),i.annotate){let se=new E("annotation",[new Ie(t)]);se.setAttribute("encoding","application/x-tex"),D=new E("semantics",[D,se])}let z=new E("math",[D]);return i.xml&&z.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),i.displayMode&&(z.setAttribute("display","block"),z.style.display="block math",z.classes=["tml-display"]),z}let Kt=(e,t)=>{let n=e.isStretchy?fe(e):new E("mo",[ne(e.label,e.mode)]);e.isStretchy||n.setAttribute("stretchy","false"),e.label!=="\\vec"&&(n.style.mathDepth="0");let i=e.label==="\\c"?"munder":"mover",c=nn.has(e.label);if(i==="mover"&&e.mode==="math"&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let p=e.base.text,b=e.label==="\\vec",v=b==="\\vec"?"-vec":"";b&&n.classes.push("tml-vec");let D=b?"-vec":c?"-acc":"";"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(p)>-1?(n.classes.push(`chr-sml${v}`),n.classes.push(`wbk-sml${D}`)):"BCEGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(p)>-1?(n.classes.push(`chr-med${v}`),n.classes.push(`wbk-med${D}`)):"AFJdf\u0394\u039B".indexOf(p)>-1?(n.classes.push(`chr-lrg${v}`),n.classes.push(`wbk-lrg${D}`)):b?n.classes.push("wbk-vec"):c&&n.classes.push("wbk-acc")}else c&&n.classes.push("wbk-acc");return new E(i,[Oe(e.base,t),n])},te=new Set(["\\acute","\\check","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),nn=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\`","\\'","\\^","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),Dt={"\\`":"\u0300","\\'":"\u0301","\\^":"\u0302","\\~":"\u0303","\\=":"\u0304","\\u":"\u0306","\\.":"\u0307",'\\"':"\u0308","\\r":"\u030A","\\H":"\u030B","\\v":"\u030C","\\c":"\u0327"};$({type:"accent",names:["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\overparen","\\widecheck","\\widehat","\\wideparen","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{let n=he(t[0]),i=!te.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:i,base:n}},mathmlBuilder:Kt}),$({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{let n=he(t[0]),i=e.parser.mode;return i==="math"&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),i==="text"&&n.text&&n.text.length===1&&e.funcName in Dt&&A.indexOf(n.text)>-1?{type:"textord",mode:"text",text:n.text+Dt[e.funcName]}:e.funcName==="\\c"&&i==="text"&&n.text&&n.text.length===1?{type:"textord",mode:"text",text:n.text+"\u0327"}:{type:"accent",mode:i,label:e.funcName,isStretchy:!1,base:n}},mathmlBuilder:Kt}),$({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>{let i=n[0];return{type:"accentUnder",mode:e.mode,label:t,base:i}},mathmlBuilder:(e,t)=>{let n=fe(e);return n.style["math-depth"]=0,new E("munder",[Oe(e.base,t),n])}});let qt={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:12.792133216944668,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},Xt=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],Ct=function(e){return typeof e!="string"&&(e=e.unit),Xt.indexOf(e)>-1},gt=e=>[1,.7,.5][Math.max(e-1,0)],ot=function(e,t){let n=e.number;if(t.maxSize[0]<0&&n>0)return{number:0,unit:"em"};let i=e.unit;switch(i){case"mm":case"cm":case"in":case"px":return n*qt[i]>t.maxSize[1]?{number:t.maxSize[1],unit:"pt"}:{number:n,unit:i};case"em":case"ex":return i==="ex"&&(n*=.431),n=Math.min(n/gt(t.level),t.maxSize[0]),{number:k(n),unit:"em"};case"bp":return n>t.maxSize[1]&&(n=t.maxSize[1]),{number:n,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return n=Math.min(n*qt[i],t.maxSize[1]),{number:k(n),unit:"pt"};case"mu":return n=Math.min(n/18,t.maxSize[0]),{number:k(n),unit:"em"};default:throw new r("Invalid unit: '"+i+"'")}},st=e=>{let t=new E("mspace");return t.setAttribute("width",e+"em"),t},N=(e,t=.3,n=0,i=!1)=>{if(e==null&&n===0)return st(t);let c=e?[e]:[];if(t!==0&&c.unshift(st(t)),n>0&&c.push(st(n)),i){let p=new E("mpadded",c);return p.setAttribute("height","0.1px"),p}return new E("mrow",c)},H=(e,t)=>Number(e)/gt(t),ie=(e,t,n,i)=>{let c=J(e),p=e.slice(1,3)==="eq",b=e.charAt(1)==="x"?"1.75":e.slice(2,4)==="cd"?"3.0":p?"1.0":"2.0";c.setAttribute("lspace","0"),c.setAttribute("rspace",p?"0.5em":"0");let v=i.withLevel(i.level<2?2:3),D=H(b,v.level),z=H(b,3),se=N(null,D.toFixed(4),0),ce=N(null,z.toFixed(4),0),ee=H(p?0:.3,v.level).toFixed(4),et,Ge,tt=t&&t.body&&(t.body.body||t.body.length>0);if(tt){let Ze=Oe(t,v);Ze=N(Ze,ee,ee,e==="\\\\cdrightarrow"||e==="\\\\cdleftarrow"),et=new E("mover",[Ze,ce])}let lt=n&&n.body&&(n.body.body||n.body.length>0);if(lt){let Ze=Oe(n,v);Ze=N(Ze,ee,ee),Ge=new E("munder",[Ze,ce])}let je;return je=tt||lt?tt&&lt?new E("munderover",[c,Ge,et]):tt?new E("mover",[c,et]):new E("munder",[c,Ge]):new E("mover",[c,se]),b==="3.0"&&(je.style.height="1em"),je.setAttribute("accent","false"),je};$({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xleftrightharpoons","\\xrightleftharpoons","\\yields","\\yieldsLeft","\\mesomerism","\\longrightharpoonup","\\longleftharpoondown","\\yieldsLeftRight","\\chemequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:({parser:e,funcName:t},n,i)=>({type:"xArrow",mode:e.mode,name:t,body:n[0],below:i[0]}),mathmlBuilder(e,t){let n=[ie(e.name,e.body,e.below,t)];return n.unshift(st(.2778)),n.push(st(.2778)),new E("mrow",n)}});let pe={"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};$({type:"stackedArrow",names:["\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,i){let c=n[0]?{type:"hphantom",mode:e.mode,body:n[0]}:null,p=i[0]?{type:"hphantom",mode:e.mode,body:i[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:n[0],upperArrowBelow:p,lowerArrowBody:c,below:i[0]}},mathmlBuilder(e,t){let n=pe[e.name][0],i=pe[e.name][1],c=ie(n,e.body,e.upperArrowBelow,t),p=ie(i,e.lowerArrowBody,e.below,t),b,v=new E("mpadded",[c]);if(v.setAttribute("voffset","0.3em"),v.setAttribute("height","+0.3em"),v.setAttribute("depth","-0.3em"),e.name==="\\equilibriumLeft"){let D=new E("mpadded",[p]);D.setAttribute("width","0.5em"),b=new E("mpadded",[st(.2778),D,v,st(.2778)])}else v.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),b=new E("mpadded",[st(.2778),v,p,st(.2778)]);return b.setAttribute("voffset","-0.18em"),b.setAttribute("height","-0.18em"),b.setAttribute("depth","+0.18em"),b}});let Pe={};function Se({type:e,names:t,props:n,handler:i,mathmlBuilder:c}){let p={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i};for(let b=0;b<t.length;++b)Pe[t[b]]=p;c&&(C[e]=c)}function Me(e,t){if(!e||e.type!==t)throw new Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function rt(e){let t=at(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return t}function at(e){return e&&(e.type==="atom"||e.type==="delimiter"||Object.prototype.hasOwnProperty.call(ze,e.type))?e:null}let Et={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Nt=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),Yt=e=>e.type==="textord"&&e.text==="@",Rt=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function wn(e,t,n){let i=Et[e];switch(i){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(i,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{let c={type:"atom",text:i,mode:"math",family:"rel"},p={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[c],[]),n.callFunction("\\\\cdright",[t[1]],[])],semisimple:!0};return n.callFunction("\\\\cdparent",[p],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{let c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}$({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>({type:"cdlabel",mode:e.mode,side:t.slice(4),label:n[0]}),mathmlBuilder(e,t){if(e.label.body.length===0)return new E("mrow",t);let n=Oe(e.label,t);e.side==="left"&&n.classes.push("tml-shift-left");let i=new E("mtd",[n]);i.style.padding="0";let c=new E("mtr",[i]),p=new E("mtable",[c]),b=new E("mpadded",[p]);return b.setAttribute("width","0.1px"),b.setAttribute("displaystyle","false"),b.setAttribute("scriptlevel","1"),b}}),$({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},t)=>({type:"cdlabelparent",mode:e.mode,fragment:t[0]}),mathmlBuilder:(e,t)=>new E("mrow",[Oe(e.fragment,t)])});let Ht=e=>({type:"ordgroup",mode:"math",body:e,semisimple:!0}),It=(e,t)=>({type:t,mode:"math",body:Ht(e)});class dt{constructor(t,n,i){this.lexer=t,this.start=n,this.end=i}static range(t,n){return n?t&&t.loc&&n.loc&&t.loc.lexer===n.loc.lexer?new dt(t.loc.lexer,t.loc.start,n.loc.end):null:t&&t.loc}}class St{constructor(t,n){this.text=t,this.loc=n}range(t,n){return new St(n,dt.range(this,t))}}let ut=0,Ot=1,Gt=2,xn=3,Wt={};function L(e,t){Wt[e]=t}let vn=Wt;L("\\noexpand",function(e){let t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),L("\\expandafter",function(e){let t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),L("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),L("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),L("\\@ifnextchar",function(e){let t=e.consumeArgs(3);e.consumeSpaces();let n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),L("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),L("\\TextOrMath",function(e){let t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});let Vt=e=>{let t="";for(let n=e.length-1;n>-1;n--)t+=e[n].text;return t},pt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},At=e=>{let t=e.future().text;return t==="EOF"?[null,""]:[pt[t.charAt(0)],t]},rn=(e,t,n)=>{for(let i=1;i<t.length;i++)e*=n,e+=pt[t.charAt(i)];return e};function wt(e){let t=e.consumeArgs(1)[0],n="",i=t[t.length-1].loc.start;for(let c=t.length-1;c>=0;c--){let p=t[c].loc.start;p>i&&(n+=" ",i=p),n+=t[c].text,i+=t[c].text.length}return n}L("\\char",function(e){let t,n=e.popToken(),i="";if(n.text==="'")t=8,n=e.popToken();else if(n.text==='"')t=16,n=e.popToken();else if(n.text==="`")if(n=e.popToken(),n.text[0]==="\\")i=n.text.charCodeAt(1);else{if(n.text==="EOF")throw new r("\\char` missing argument");i=n.text.charCodeAt(0)}else t=10;if(t){let c,p=n.text;if(i=pt[p.charAt(0)],i==null||i>=t)throw new r(`Invalid base-${t} digit ${n.text}`);for(i=rn(i,p,t),[c,p]=At(e);c!=null&&c<t;)i*=t,i+=c,i=rn(i,p,t),e.popToken(),[c,p]=At(e)}return`\\@char{${i}}`}),L("\\surd","\\sqrt{\\vphantom{|}}"),L("\u2295","\\oplus"),L("\\long",""),L("\\bgroup","{"),L("\\egroup","}"),L("~","\\nobreakspace"),L("\\lq","`"),L("\\rq","'"),L("\\aa","\\r a"),L("\\Bbbk","\\Bbb{k}"),L("\\mathstrut","\\vphantom{(}"),L("\\underbar","\\underline{\\text{#1}}"),L("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),L("\u22EE","\\vdots"),L("\\arraystretch","1"),L("\\arraycolsep","6pt"),L("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),L("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),L("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),L("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");let $t={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcap":"\\dotsb","\\bigsqcup":"\\dotsb","\\bigtimes":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\DOTSX":"\\dotsx"};L("\\dots",function(e){let t="\\dotso",n=e.expandAfterFuture().text;return n in $t?t=$t[n]:(n.slice(0,4)==="\\not"||n in Ne.math&&["bin","rel"].includes(Ne.math[n].group))&&(t="\\dotsb"),t});let Ft={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};L("\\dotso",function(e){return e.future().text in Ft?"\\ldots\\,":"\\ldots"}),L("\\dotsc",function(e){let t=e.future().text;return t in Ft&&t!==","?"\\ldots\\,":"\\ldots"}),L("\\cdots",function(e){return e.future().text in Ft?"\\@cdots\\,":"\\@cdots"}),L("\\dotsb","\\cdots"),L("\\dotsm","\\cdots"),L("\\dotsi","\\!\\cdots"),L("\\idotsint","\\int\\!\\cdots\\!\\int"),L("\\dotsx","\\ldots\\,"),L("\\DOTSI","\\relax"),L("\\DOTSB","\\relax"),L("\\DOTSX","\\relax"),L("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),L("\\,","{\\tmspace+{3mu}{.1667em}}"),L("\\thinspace","\\,"),L("\\>","\\mskip{4mu}"),L("\\:","{\\tmspace+{4mu}{.2222em}}"),L("\\medspace","\\:"),L("\\;","{\\tmspace+{5mu}{.2777em}}"),L("\\thickspace","\\;"),L("\\!","{\\tmspace-{3mu}{.1667em}}"),L("\\negthinspace","\\!"),L("\\negmedspace","{\\tmspace-{4mu}{.2222em}}"),L("\\negthickspace","{\\tmspace-{5mu}{.277em}}"),L("\\enspace","\\kern.5em "),L("\\enskip","\\hskip.5em\\relax"),L("\\quad","\\hskip1em\\relax"),L("\\qquad","\\hskip2em\\relax"),L("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax"),L("\\tag","\\@ifstar\\tag@literal\\tag@paren"),L("\\tag@paren","\\tag@literal{({#1})}"),L("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new r("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),L("\\notag","\\nonumber"),L("\\nonumber","\\gdef\\@eqnsw{0}"),L("\\bmod","\\mathbin{\\text{mod}}"),L("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),L("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),L("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),L("\\newline","\\\\\\relax"),L("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}"),L("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX"),L("\\Temml","\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}"),L("\\hspace","\\@ifstar\\@hspacer\\@hspace"),L("\\@hspace","\\hskip #1\\relax"),L("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),L("\\colon",'\\mathpunct{\\char"3a}'),L("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}"),L("\\ordinarycolon",'\\char"3a'),L("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}"),L("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}'),L("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}'),L("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}'),L("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}'),L("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}'),L("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}'),L("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),L("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),L("\\ratio","\\vcentcolon"),L("\\coloncolon","\\dblcolon"),L("\\colonequals","\\coloneqq"),L("\\coloncolonequals","\\Coloneqq"),L("\\equalscolon","\\eqqcolon"),L("\\equalscoloncolon","\\Eqqcolon"),L("\\colonminus","\\coloneq"),L("\\coloncolonminus","\\Coloneq"),L("\\minuscolon","\\eqcolon"),L("\\minuscoloncolon","\\Eqcolon"),L("\\coloncolonapprox","\\Colonapprox"),L("\\coloncolonsim","\\Colonsim"),L("\\notni","\\mathrel{\\char`\u220C}"),L("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),L("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),L("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),L("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),L("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}"),L("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}"),L("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}"),L("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}"),L("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}"),L("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),L("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),L("\\plim","\\DOTSB\\operatorname*{plim}"),L("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}"),L("\\bra","\\mathinner{\\langle{#1}|}"),L("\\ket","\\mathinner{|{#1}\\rangle}"),L("\\braket","\\mathinner{\\langle{#1}\\rangle}"),L("\\Bra","\\left\\langle#1\\right|"),L("\\Ket","\\left|#1\\right\\rangle");let Mt=(e,t)=>{let n=`}\\,\\middle${t[0]==="|"?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+n+e.slice(t.index+t[0].length)};L("\\Braket",function(e){let t=wt(e),n=/\|\||\||\\\|/g,i;for(;(i=n.exec(t))!==null;)t=Mt(t,i);return"\\left\\langle{"+t+"}\\right\\rangle"}),L("\\Set",function(e){let t=wt(e),n=/\|\||\||\\\|/.exec(t);return n&&(t=Mt(t,n)),"\\left\\{\\:{"+t+"}\\:\\right\\}"}),L("\\set",function(e){return"\\{{"+wt(e).replace(/\|/,"}\\mid{")+"}\\}"}),L("\\angln","{\\angl n}"),L("\\odv","\\@ifstar\\odv@next\\odv@numerator"),L("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}"),L("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1"),L("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");let sn=e=>{let t=e[0][0].text,n=Vt(e[1]).split(","),i=String(n.length),c=i==="1"?"\\partial":`\\partial^${i}`,p="";return n.map(b=>{p+="\\partial "+b.trim()+"\\,"}),[t,c,p.replace(/\\,$/,"")]};function hn(e){let t=[];e.consumeSpaces();let n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}L("\\pdv@numerator",function(e){let[t,n,i]=sn(e.consumeArgs(2));return`\\frac{${n} ${t}}{${i}}`}),L("\\pdv@next",function(e){let[t,n,i]=sn(e.consumeArgs(2));return`\\frac{${n}}{${i}} ${t}`}),L("\\upalpha","\\up@greek{\\alpha}"),L("\\upbeta","\\up@greek{\\beta}"),L("\\upgamma","\\up@greek{\\gamma}"),L("\\updelta","\\up@greek{\\delta}"),L("\\upepsilon","\\up@greek{\\epsilon}"),L("\\upzeta","\\up@greek{\\zeta}"),L("\\upeta","\\up@greek{\\eta}"),L("\\uptheta","\\up@greek{\\theta}"),L("\\upiota","\\up@greek{\\iota}"),L("\\upkappa","\\up@greek{\\kappa}"),L("\\uplambda","\\up@greek{\\lambda}"),L("\\upmu","\\up@greek{\\mu}"),L("\\upnu","\\up@greek{\\nu}"),L("\\upxi","\\up@greek{\\xi}"),L("\\upomicron","\\up@greek{\\omicron}"),L("\\uppi","\\up@greek{\\pi}"),L("\\upalpha","\\up@greek{\\alpha}"),L("\\uprho","\\up@greek{\\rho}"),L("\\upsigma","\\up@greek{\\sigma}"),L("\\uptau","\\up@greek{\\tau}"),L("\\upupsilon","\\up@greek{\\upsilon}"),L("\\upphi","\\up@greek{\\phi}"),L("\\upchi","\\up@greek{\\chi}"),L("\\uppsi","\\up@greek{\\psi}"),L("\\upomega","\\up@greek{\\omega}"),L("\\invamp",'\\mathbin{\\char"214b}'),L("\\parr",'\\mathbin{\\char"214b}'),L("\\upand",'\\mathbin{\\char"214b}'),L("\\with",'\\mathbin{\\char"26}'),L("\\multimapinv",'\\mathrel{\\char"27dc}'),L("\\multimapboth",'\\mathrel{\\char"29df}'),L("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}'),L("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}'),L("\\coh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}
6
- {\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}`),L("\\incoh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}
7
- {\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`),L("\\standardstate","\\text{\\tiny\\char`\u29B5}");let Lt=e=>{if(!e.parser.settings.displayMode)throw new r(`{${e.envName}} can be used only in display mode.`)},zt=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Jt=e=>{let t=e.get("\\arraystretch");typeof t!="string"&&(t=Vt(t.tokens)),t=isNaN(t)?null:Number(t);let n=e.get("\\arraycolsep");typeof n!="string"&&(n=Vt(n.tokens));let i=zt.exec(n);return[t,i?{number:+(i[1]+i[2]),unit:i[3]}:null]},on=e=>{let t="";for(let n=0;n<e.length;n++)if(e[n].type==="label"){if(t)throw new r("Multiple \\labels in one row");t=e[n].string}return t};function Qt(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bt(e,{cols:t,envClasses:n,autoTag:i,singleRow:c,emptySingleRow:p,maxNumCols:b,leqno:v,arraystretch:D,arraycolsep:z},se){let ce=n&&n.includes("bordermatrix")?"}":"\\end";e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();let ee=[],et=[ee],Ge=[],tt=[],lt=[],je=i!=null?[]:void 0;function Ze(){i&&e.gullet.macros.set("\\@eqnsw","1",!0)}function Ut(){je&&(e.gullet.macros.get("\\df@tag")?(je.push(e.subparse([new St("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):je.push(!!i&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(Ze(),lt.push(hn(e));;){let Tt=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),Tt={type:"ordgroup",mode:e.mode,body:Tt,semisimple:!0},ee.push(Tt);let An=e.fetch().text;if(An==="&"){if(b&&ee.length===b){if(!n.includes("array"))throw new r(b===2?"The split environment accepts no more than two columns":"The equation environment accepts only one column",e.nextToken);if(e.settings.strict)throw new r("Too few columns specified in the {array} column argument.",e.nextToken)}e.consume()}else{if(An===ce){Ut(),ee.length===1&&Tt.body.length===0&&(et.length>1||!p)&&et.pop(),tt.push(on(Tt.body)),lt.length<et.length+1&&lt.push([]);break}if(An!=="\\\\")throw new r("Expected & or \\\\ or \\cr or "+ce,e.nextToken);{let en;e.consume(),e.gullet.future().text!==" "&&(en=e.parseSizeGroup(!0)),Ge.push(en?en.value:null),Ut(),tt.push(on(Tt.body)),lt.push(hn(e)),ee=[],et.push(ee),Ze()}}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,body:et,cols:t,rowGaps:Ge,hLinesBeforeRow:lt,envClasses:n,autoTag:i,scriptLevel:se,tags:je,labels:tt,leqno:v,arraystretch:D,arraycolsep:z}}function xt(e){return e.slice(0,1)==="d"?"display":"text"}let an={c:"center ",l:"left ",r:"right "},kn=e=>{let t=new E("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},bt=function(e,t){let n=[],i=e.body.length,c=e.hLinesBeforeRow,p=e.tags&&e.tags.some(z=>z);for(let z=0;z<i;z++){let se=e.body[z],ce=[],ee=e.scriptLevel==="text"?Ot:e.scriptLevel==="script"?Gt:ut;for(let je=0;je<se.length;je++){let Ze=new E("mtd",[Oe(se[je],t.withLevel(ee))]);if(e.envClasses.includes("multline")){let Ut=z===0?"left":z===i-1?"right":"center";Ut!=="center"&&Ze.classes.push("tml-"+Ut)}ce.push(Ze)}let et=e.body[0].length;for(let je=0;je<et-se.length;je++)ce.push(new E("mtd",[],[],t));if(p){let je=e.tags[z],Ze;je===!0?Ze=new E("mtext",[new Re(["tml-eqn"])]):je===!1?Ze=new E("mtext",[],[]):(Ze=Qe(je[0].body,t.withLevel(ee),!0),Ze=Je(Ze),Ze.classes=["tml-tag"]),Ze&&(ce.unshift(kn(e)),ce.push(kn(e)),e.leqno?ce[0].children.push(Ze):ce[ce.length-1].children.push(Ze))}let Ge=new E("mtr",ce,[]),tt=e.labels.shift();tt&&e.tags&&e.tags[z]&&(Ge.setAttribute("id",tt),Array.isArray(e.tags[z])&&Ge.classes.push("tml-tageqn")),z===0&&c[0].length>0&&(c[0].length===2?Ge.children.forEach(je=>{je.style.borderTop="0.15em double"}):Ge.children.forEach(je=>{je.style.borderTop=c[0][0]?"0.06em dashed":"0.06em solid"})),c[z+1].length>0&&(c[z+1].length===2?Ge.children.forEach(je=>{je.style.borderBottom="0.15em double"}):Ge.children.forEach(je=>{je.style.borderBottom=c[z+1][0]?"0.06em dashed":"0.06em solid"}));let lt=!0;for(let je=0;je<Ge.children.length;je++){let Ze=Ge.children[je].children[0];if(!Ze||Ze.type!=="mpadded"||Ze.attributes.height!=="0px"){lt=!1;break}}if(lt){Ge.classes.push("ff-squash");for(let je=0;je<Ge.children.length;je++)Ge.children[je].style.paddingTop="0",Ge.children[je].style.paddingBottom="0"}n.push(Ge)}if(e.arraystretch&&e.arraystretch!==1){let z=String(1.4*e.arraystretch-.8)+"ex";for(let se=0;se<n.length;se++)for(let ce=0;ce<n[se].children.length;ce++)n[se].children[ce].style.paddingTop=z,n[se].children[ce].style.paddingBottom=z}let b,v;if(e.envClasses.length>0&&(b=e.envClasses.includes("abut")||e.envClasses.includes("cases")?"0":e.envClasses.includes("small")?"0.1389":e.envClasses.includes("cd")?"0.25":"0.4",v="em"),e.arraycolsep){let z=ot(e.arraycolsep,t);b=z.number.toFixed(4),v=z.unit}if(b){let z=n.length===0?0:n[0].children.length,se=(ce,ee)=>ce===0&&ee===0||ce===z-1&&ee===1?"0":e.envClasses[0]!=="align"?b:ee===1?"0":p?ce%2?"1":"0":ce%2?"0":"1";for(let ce=0;ce<n.length;ce++)for(let ee=0;ee<n[ce].children.length;ee++)n[ce].children[ee].style.paddingLeft=`${se(ee,0)}${v}`,n[ce].children[ee].style.paddingRight=`${se(ee,1)}${v}`}if(e.envClasses.length===0)for(let z=0;z<n.length;z++)n[z].children[0].style.paddingLeft="0em",n[z].children.length===n[0].children.length&&(n[z].children[n[z].children.length-1].style.paddingRight="0em");if(e.envClasses.length>0){let z=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let se=0;se<n.length;se++){let ce=n[se];if(z){for(let ee=0;ee<ce.children.length;ee++)ce.children[ee].classes=["tml-"+(ee%2?"left":"right")];if(p){let ee=e.leqno?0:ce.children.length-1;ce.children[ee].classes=[]}}if(ce.children.length>1&&e.envClasses.includes("cases")&&(ce.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(let ee of ce.children)ee.classes.push("tml-left")}}let D=new E("mtable",n);if(e.envClasses.length>0&&(e.envClasses.includes("jot")?D.classes.push("tml-jot"):e.envClasses.includes("small")&&D.classes.push("tml-small")),e.scriptLevel==="display"&&D.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(D.style.width="100%"),e.cols&&e.cols.length>0){let z=e.cols,se=!1,ce=0,ee=z.length;for(;z[ce].type==="separator";)ce+=1;for(;z[ee-1].type==="separator";)ee-=1;if(z[0].type==="separator"){let Ge=z[1].type==="separator"?"0.15em double":z[0].separator==="|"?"0.06em solid ":"0.06em dashed ";for(let tt of D.children)tt.children[0].style.borderLeft=Ge}let et=p?0:-1;for(let Ge=ce;Ge<ee;Ge++)if(z[Ge].type==="align"){let tt=an[z[Ge].align];et+=1;for(let lt of D.children)tt.trim()!=="center"&&et<lt.children.length&&(lt.children[et].classes=["tml-"+tt.trim()]);se=!0}else if(z[Ge].type==="separator"){if(se){let tt=z[Ge+1].type==="separator"?"0.15em double":z[Ge].separator==="|"?"0.06em solid":"0.06em dashed";for(let lt of D.children)et<lt.children.length&&(lt.children[et].style.borderRight=tt)}se=!1}if(z[z.length-1].type==="separator"){let Ge=z[z.length-2].type==="separator"?"0.15em double":z[z.length-1].separator==="|"?"0.06em solid":"0.06em dashed";for(let tt of D.children)tt.children[tt.children.length-1].style.borderRight=Ge,tt.children[tt.children.length-1].style.paddingRight="0.4em"}}return e.envClasses.includes("small")&&(D=new E("mstyle",[D]),D.setAttribute("scriptlevel","1")),D},T=function(e,t){e.envName.indexOf("ed")===-1&&Lt(e);let n=e.envName==="split",i=[],c=Bt(e.parser,{cols:i,emptySingleRow:!0,autoTag:n?void 0:Qt(e.envName),envClasses:["abut","jot"],maxNumCols:e.envName==="split"?2:void 0,leqno:e.parser.settings.leqno},"display"),p,b=0,v=e.envName.indexOf("at")>-1;if(t[0]&&v){let D="";for(let z=0;z<t[0].body.length;z++)D+=Me(t[0].body[z],"textord").text;if(isNaN(D))throw new r("The alignat enviroment requires a numeric first argument.");p=Number(D),b=2*p}c.body.forEach(function(D){if(v){let z=D.length/2;if(p<z)throw new r(`Too many math in a row: expected ${p}, but got ${z}`,D[0])}else b<D.length&&(b=D.length)});for(let D=0;D<b;++D){let z="r";D%2==1&&(z="l"),i[D]={type:"align",align:z}}return e.envName==="split"||(v?c.envClasses.push("alignat"):c.envClasses[0]="align"),c};Se({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){let n=(at(t[0])?[t[0]]:Me(t[0],"ordgroup").body).map(function(b){let v=rt(b).text;if("lcr".indexOf(v)!==-1)return{type:"align",align:v};if(v==="|")return{type:"separator",separator:"|"};if(v===":")return{type:"separator",separator:":"};throw new r("Unknown column alignment: "+v,b)}),[i,c]=Jt(e.parser.gullet.macros),p={cols:n,envClasses:["array"],maxNumCols:n.length,arraystretch:i,arraycolsep:c};return Bt(e.parser,p,xt(e.envName))},mathmlBuilder:bt}),Se({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){let t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",i={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)==="*"){let v=e.parser;if(v.consumeSpaces(),v.fetch().text==="["){if(v.consume(),v.consumeSpaces(),n=v.fetch().text,"lcr".indexOf(n)===-1)throw new r("Expected l or c or r",v.nextToken);v.consume(),v.consumeSpaces(),v.expect("]"),v.consume(),i.cols=[]}}let c=Bt(e.parser,i,"text");c.cols=c.body.length>0?new Array(c.body[0].length).fill({type:"align",align:n}):[];let[p,b]=Jt(e.parser.gullet.macros);return c.arraystretch=p,!b||b===6&&b==="pt"||(c.arraycolsep=b),t?{type:"leftright",mode:e.mode,body:[c],left:t[0],right:t[1],rightColor:void 0}:c},mathmlBuilder:bt}),Se({type:"array",names:["bordermatrix"],props:{numArgs:0},handler(e){let t=Bt(e.parser,{cols:[],envClasses:["bordermatrix"]},"text");return t.cols=t.body.length>0?new Array(t.body[0].length).fill({type:"align",align:"c"}):[],t.envClasses=[],t.arraystretch=1,e.envName==="matrix"?t:((n,i)=>{let c=n.body;c[0].shift();let p=new Array(c.length-1).fill().map(()=>[]);for(let se=1;se<c.length;se++){p[se-1].push(c[se].shift());let ce=[];for(let ee=0;ee<c[se].length;ee++)ce.push(c[se][ee]);p[se-1].push(It(ce,"vphantom"))}let b=new Array(c.length).fill().map(()=>[]);for(let se=0;se<c[0].length;se++)b[0].push(c[0][se]);for(let se=1;se<c.length;se++)for(let ce=0;ce<c[0].length;ce++)b[se].push(It(c[se][ce].body,"hphantom"));for(let se=0;se<c[0].length;se++)c[0][se]=It(c[0][se].body,"hphantom");let v={type:"array",mode:"math",body:p,cols:[{type:"align",align:"c"}],rowGaps:new Array(p.length-1).fill(null),hLinesBeforeRow:new Array(p.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(p.length).fill(""),arraycolsep:{number:.04,unit:"em"}},D={type:"styling",mode:"math",scriptLevel:"text",body:[{type:"array",mode:"math",body:b,cols:new Array(b.length).fill({type:"align",align:"c"}),rowGaps:new Array(b.length-1).fill(null),hLinesBeforeRow:new Array(b.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(b.length).fill(""),arraycolsep:null}]},z={type:"leftright",mode:"math",body:[n],left:i?i[0]:"(",right:i?i[1]:")",rightColor:void 0};return Ht([v,{type:"supsub",mode:"math",stack:!0,base:{type:"op",mode:"math",limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[z]},sup:D,sub:null}])})(t,e.delimiters)},mathmlBuilder:bt}),Se({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:e=>Bt(e.parser,{envClasses:["small"]},"script"),mathmlBuilder:bt}),Se({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){let n=(at(t[0])?[t[0]]:Me(t[0],"ordgroup").body).map(function(c){let p=rt(c).text;if("lc".indexOf(p)!==-1)return{type:"align",align:p};throw new r("Unknown column alignment: "+p,c)});if(n.length>1)throw new r("{subarray} can contain only one column");let i={cols:n,envClasses:["small"]};if(i=Bt(e.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new r("{subarray} can contain only one column");return i},mathmlBuilder:bt}),Se({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){let t=Bt(e.parser,{cols:[],envClasses:["cases"]},xt(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:bt}),Se({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:T,mathmlBuilder:bt}),Se({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:T,mathmlBuilder:bt}),Se({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){e.envName!=="gathered"&&Lt(e);let t={cols:[],envClasses:["abut","jot"],autoTag:Qt(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},mathmlBuilder:bt}),Se({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Lt(e);let t={autoTag:Qt(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},mathmlBuilder:bt}),Se({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){Lt(e);let t={autoTag:e.envName==="multline",maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},mathmlBuilder:bt}),Se({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(Lt(e),function(t){let n=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){n.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();let p=t.fetch().text;if(p!=="&"&&p!=="\\\\"){if(p==="\\end"){n[n.length-1].length===0&&n.pop();break}throw new r("Expected \\\\ or \\cr or \\end",t.nextToken)}t.consume()}let i=[],c=[i];for(let p=0;p<n.length;p++){let b=n[p],v=Nt();for(let D=0;D<b.length;D++)if(Yt(b[D])){i.push(v),D+=1;let z=rt(b[D]).text,se=new Array(2);if(se[0]={type:"ordgroup",mode:"math",body:[]},se[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(z)>-1)){if(!("<>AV".indexOf(z)>-1))throw new r('Expected one of "<>AV=|." after @.');for(let ee=0;ee<2;ee++){let et=!0;for(let Ge=D+1;Ge<b.length;Ge++){if(Rt(b[Ge],z)){et=!1,D=Ge;break}if(Yt(b[Ge]))throw new r("Missing a "+z+" character to complete a CD arrow.",b[Ge]);se[ee].body.push(b[Ge])}if(et)throw new r("Missing a "+z+" character to complete a CD arrow.",b[D])}}let ce=wn(z,se,t);i.push(ce),v=Nt()}else v.body.push(b[D]);p%2==0?i.push(v):i.shift(),i=[],c.push(i)}return c.pop(),t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:"math",body:c,tags:null,labels:new Array(c.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(c.length+1).fill([])}}(e.parser)),mathmlBuilder:bt}),$({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new r(`${e.funcName} valid only within array environment`)}});let K=Pe;$({type:"bordermatrix",names:["\\bordermatrix","\\matrix"],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:t},n,i)=>{let c=["(",")"];if(t==="\\bordermatrix"&&i[0]&&i[0].body){let D=i[0].body;D.length===1&&D[0].type==="delimiter"&&(c=[D[0].left,D[0].right])}e.consumeSpaces(),e.consume();let p=K.bordermatrix,b={mode:e.mode,envName:t.slice(1),delimiters:c,parser:e},v=p.handler(b);return e.expect("}",!0),v}}),$({type:"cancelto",names:["\\cancelto"],props:{numArgs:2},handler({parser:e},t){let n=t[0],i=t[1];return{type:"cancelto",mode:e.mode,body:i,to:n,isCharacterBox:w(i)}},mathmlBuilder(e,t){let n=new E("mrow",[Oe(e.body,t)],["ff-narrow"]),i=new E("mphantom",[Oe(e.body,t)]),c=new E("mrow",[i],["tml-cancelto"]);c.style.color=t.color,e.isCharacterBox&&A.indexOf(e.body.body[0].text)>-1&&(c.style.left="0.1em",c.style.width="90%");let p=new E("mrow",[n,c],["menclose"]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))i.style.paddingRight="0.2em";else{i.style.padding="0.5ex 0.1em 0 0";let ce=new E("mspace",[]);ce.setAttribute("height","0.85em"),n.children.push(ce)}let b;if(e.isCharacterBox)b=new E("mspace",[]),b.setAttribute("height","1em");else{let ce=Oe(e.body,t),ee=new E("mpadded",[ce]);ee.setAttribute("width","0.1px"),b=new E("mphantom",[ee])}let v=Oe(e.to,t);v.style.color=t.color;let D=new E("mpadded",[v]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let ce=new E("mspace",[]);ce.setAttribute("width","0.2em"),D.children.unshift(ce)}D.setAttribute("width","0.1px");let z=new E("mover",[b,D]),se=new E("mrow",[],["ff-nudge-left"]);return xe([re([p,z]),se])}}),$({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:t},n){let i=Me(n[0],"ordgroup").body,c="";for(let b=0;b<i.length;b++)c+=Me(i[b],"textord").text;let p=parseInt(c);if(isNaN(p))throw new r(`\\@char has non-numeric argument ${c}`,t);return{type:"textord",mode:e.mode,text:String.fromCodePoint(p)}}});let y=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,_=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,S=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,R=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Z=/^[a-f0-9]{6}$/i,ue=e=>{let t=e.toString(16);return t.length===1&&(t="0"+t),t},Ve=JSON.parse(`{
1
+ /*! Decklight v0.6.0 — Copyright 2026 Gilles Philippart — SPDX-License-Identifier: Apache-2.0 */
2
+ var Decklight=(()=>{var Ga=Object.create;var pr=Object.defineProperty;var ja=Object.getOwnPropertyDescriptor;var Ka=Object.getOwnPropertyNames;var Wa=Object.getPrototypeOf,Va=Object.prototype.hasOwnProperty;var Ks=(r,i)=>()=>(r&&(i=r(r=0)),i);var Za=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports),Xa=(r,i)=>{for(var l in i)pr(r,l,{get:i[l],enumerable:!0})},Ws=(r,i,l,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let u of Ka(i))!Va.call(r,u)&&u!==l&&pr(r,u,{get:()=>i[u],enumerable:!(d=ja(i,u))||d.enumerable});return r};var Ya=(r,i,l)=>(l=r!=null?Ga(Wa(r)):{},Ws(i||!r||!r.__esModule?pr(l,"default",{value:r,enumerable:!0}):l,r)),Ja=r=>Ws(pr({},"__esModule",{value:!0}),r);var Ze,le=Ks(()=>{Ze={order:["default","classics"],labels:{default:"Default",classics:"Classics"},packs:{default:["aurora","eclipse","midnight","fjord","cosmos","ink","storm","carbon","synthwave","obsidian","graphite","ember","moss","velvet","porcelain","paper","linen","sepia","glacier","mint","latte","dune","coastal","harvest","meadow","orchid","peony","slate","berry","citrus","ibm-modern","yamabuki"],classics:["reveal-black","reveal-white","reveal-league","reveal-beige","reveal-sky","reveal-night","reveal-serif","reveal-simple","reveal-solarized","reveal-moon","reveal-blood","reveal-dracula","metropolis","seriph"]}}});var Ge,ce=Ks(()=>{Ge=["aurora","berry","carbon","citrus","coastal","cosmos","dune","eclipse","ember","fjord","glacier","graphite","harvest","ibm-modern","ink","latte","linen","meadow","metropolis","midnight","mint","moss","obsidian","orchid","paper","peony","porcelain","reveal-beige","reveal-black","reveal-blood","reveal-dracula","reveal-league","reveal-moon","reveal-night","reveal-serif","reveal-simple","reveal-sky","reveal-solarized","reveal-white","sepia","seriph","slate","storm","synthwave","velvet","yamabuki"]});var Bo=Za((xu,Io)=>{le();ce();function Eo(r){return r instanceof Map?r.clear=r.delete=r.set=function(){throw new Error("map is read-only")}:r instanceof Set&&(r.add=r.clear=r.delete=function(){throw new Error("set is read-only")}),Object.freeze(r),Object.getOwnPropertyNames(r).forEach(i=>{let l=r[i],d=typeof l;(d==="object"||d==="function")&&!Object.isFrozen(l)&&Eo(l)}),r}var br=class{constructor(i){i.data===void 0&&(i.data={}),this.data=i.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function So(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Sn(r,...i){let l=Object.create(null);for(let d in r)l[d]=r[d];return i.forEach(function(d){for(let u in d)l[u]=d[u]}),l}var Nl="</span>",bo=r=>!!r.scope,$l=(r,{prefix:i})=>{if(r.startsWith("language:"))return r.replace("language:","language-");if(r.includes(".")){let l=r.split(".");return[`${i}${l.shift()}`,...l.map((d,u)=>`${d}${"_".repeat(u+1)}`)].join(" ")}return`${i}${r}`},Vr=class{constructor(i,l){this.buffer="",this.classPrefix=l.classPrefix,i.walk(this)}addText(i){this.buffer+=So(i)}openNode(i){if(!bo(i))return;let l=$l(i.scope,{prefix:this.classPrefix});this.span(l)}closeNode(i){bo(i)&&(this.buffer+=Nl)}value(){return this.buffer}span(i){this.buffer+=`<span class="${i}">`}},yo=(r={})=>{let i={children:[]};return Object.assign(i,r),i},Zr=class r{constructor(){this.rootNode=yo(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(i){this.top.children.push(i)}openNode(i){let l=yo({scope:i});this.add(l),this.stack.push(l)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(i){return this.constructor._walk(i,this.rootNode)}static _walk(i,l){return typeof l=="string"?i.addText(l):l.children&&(i.openNode(l),l.children.forEach(d=>this._walk(i,d)),i.closeNode(l)),i}static _collapse(i){typeof i!="string"&&i.children&&(i.children.every(l=>typeof l=="string")?i.children=[i.children.join("")]:i.children.forEach(l=>{r._collapse(l)}))}},Xr=class extends Zr{constructor(i){super(),this.options=i}addText(i){i!==""&&this.add(i)}startScope(i){this.openNode(i)}endScope(){this.closeNode()}__addSublanguage(i,l){let d=i.root;l&&(d.scope=`language:${l}`),this.add(d)}toHTML(){return new Vr(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function tr(r){return r?typeof r=="string"?r:r.source:null}function Ao(r){return Rn("(?=",r,")")}function Ol(r){return Rn("(?:",r,")*")}function Ml(r){return Rn("(?:",r,")?")}function Rn(...r){return r.map(l=>tr(l)).join("")}function Ll(r){let i=r[r.length-1];return typeof i=="object"&&i.constructor===Object?(r.splice(r.length-1,1),i):{}}function Jr(...r){return"("+(Ll(r).capture?"":"?:")+r.map(d=>tr(d)).join("|")+")"}function _o(r){return new RegExp(r.toString()+"|").exec("").length-1}function Rl(r,i){let l=r&&r.exec(i);return l&&l.index===0}var Il=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Qr(r,{joinWith:i}){let l=0;return r.map(d=>{l+=1;let u=l,m=tr(d),f="";for(;m.length>0;){let h=Il.exec(m);if(!h){f+=m;break}f+=m.substring(0,h.index),m=m.substring(h.index+h[0].length),h[0][0]==="\\"&&h[1]?f+="\\"+String(Number(h[1])+u):(f+=h[0],h[0]==="("&&l++)}return f}).map(d=>`(${d})`).join(i)}var Bl=/\b\B/,To="[a-zA-Z]\\w*",es="[a-zA-Z_]\\w*",Co="\\b\\d+(\\.\\d+)?",No="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",$o="\\b(0b[01]+)",Pl="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Dl=(r={})=>{let i=/^#![ ]*\//;return r.binary&&(r.begin=Rn(i,/.*\b/,r.binary,/\b.*/)),Sn({scope:"meta",begin:i,end:/$/,relevance:0,"on:begin":(l,d)=>{l.index!==0&&d.ignoreMatch()}},r)},nr={begin:"\\\\[\\s\\S]",relevance:0},ql={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[nr]},Fl={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[nr]},zl={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/},wr=function(r,i,l={}){let d=Sn({scope:"comment",begin:r,end:i,contains:[]},l);d.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 u=Jr("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 d.contains.push({begin:Rn(/[ ]+/,"(",u,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),d},Ul=wr("//","$"),Hl=wr("/\\*","\\*/"),Gl=wr("#","$"),jl={scope:"number",begin:Co,relevance:0},Kl={scope:"number",begin:No,relevance:0},Wl={scope:"number",begin:$o,relevance:0},Vl={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[nr,{begin:/\[/,end:/\]/,relevance:0,contains:[nr]}]},Zl={scope:"title",begin:To,relevance:0},Xl={scope:"title",begin:es,relevance:0},Yl={begin:"\\.\\s*"+es,relevance:0},Jl=function(r){return Object.assign(r,{"on:begin":(i,l)=>{l.data._beginMatch=i[1]},"on:end":(i,l)=>{l.data._beginMatch!==i[1]&&l.ignoreMatch()}})},gr=Object.freeze({__proto__:null,APOS_STRING_MODE:ql,BACKSLASH_ESCAPE:nr,BINARY_NUMBER_MODE:Wl,BINARY_NUMBER_RE:$o,COMMENT:wr,C_BLOCK_COMMENT_MODE:Hl,C_LINE_COMMENT_MODE:Ul,C_NUMBER_MODE:Kl,C_NUMBER_RE:No,END_SAME_AS_BEGIN:Jl,HASH_COMMENT_MODE:Gl,IDENT_RE:To,MATCH_NOTHING_RE:Bl,METHOD_GUARD:Yl,NUMBER_MODE:jl,NUMBER_RE:Co,PHRASAL_WORDS_MODE:zl,QUOTE_STRING_MODE:Fl,REGEXP_MODE:Vl,RE_STARTERS_RE:Pl,SHEBANG:Dl,TITLE_MODE:Zl,UNDERSCORE_IDENT_RE:es,UNDERSCORE_TITLE_MODE:Xl});function Ql(r,i){r.input[r.index-1]==="."&&i.ignoreMatch()}function ec(r,i){r.className!==void 0&&(r.scope=r.className,delete r.className)}function tc(r,i){i&&r.beginKeywords&&(r.begin="\\b("+r.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",r.__beforeBegin=Ql,r.keywords=r.keywords||r.beginKeywords,delete r.beginKeywords,r.relevance===void 0&&(r.relevance=0))}function nc(r,i){Array.isArray(r.illegal)&&(r.illegal=Jr(...r.illegal))}function rc(r,i){if(r.match){if(r.begin||r.end)throw new Error("begin & end are not supported with match");r.begin=r.match,delete r.match}}function sc(r,i){r.relevance===void 0&&(r.relevance=1)}var oc=(r,i)=>{if(!r.beforeMatch)return;if(r.starts)throw new Error("beforeMatch cannot be used with starts");let l=Object.assign({},r);Object.keys(r).forEach(d=>{delete r[d]}),r.keywords=l.keywords,r.begin=Rn(l.beforeMatch,Ao(l.begin)),r.starts={relevance:0,contains:[Object.assign(l,{endsParent:!0})]},r.relevance=0,delete l.beforeMatch},ic=["of","and","for","in","not","or","if","then","parent","list","value"],ac="keyword";function Oo(r,i,l=ac){let d=Object.create(null);return typeof r=="string"?u(l,r.split(" ")):Array.isArray(r)?u(l,r):Object.keys(r).forEach(function(m){Object.assign(d,Oo(r[m],i,m))}),d;function u(m,f){i&&(f=f.map(h=>h.toLowerCase())),f.forEach(function(h){let b=h.split("|");d[b[0]]=[m,lc(b[0],b[1])]})}}function lc(r,i){return i?Number(i):cc(r)?0:1}function cc(r){return ic.includes(r.toLowerCase())}var wo={},Ln=r=>{console.error(r)},xo=(r,...i)=>{console.log(`WARN: ${r}`,...i)},Un=(r,i)=>{wo[`${r}/${i}`]||(console.log(`Deprecated as of ${r}. ${i}`),wo[`${r}/${i}`]=!0)},yr=new Error;function Mo(r,i,{key:l}){let d=0,u=r[l],m={},f={};for(let h=1;h<=i.length;h++)f[h+d]=u[h],m[h+d]=!0,d+=_o(i[h-1]);r[l]=f,r[l]._emit=m,r[l]._multi=!0}function dc(r){if(Array.isArray(r.begin)){if(r.skip||r.excludeBegin||r.returnBegin)throw Ln("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),yr;if(typeof r.beginScope!="object"||r.beginScope===null)throw Ln("beginScope must be object"),yr;Mo(r,r.begin,{key:"beginScope"}),r.begin=Qr(r.begin,{joinWith:""})}}function uc(r){if(Array.isArray(r.end)){if(r.skip||r.excludeEnd||r.returnEnd)throw Ln("skip, excludeEnd, returnEnd not compatible with endScope: {}"),yr;if(typeof r.endScope!="object"||r.endScope===null)throw Ln("endScope must be object"),yr;Mo(r,r.end,{key:"endScope"}),r.end=Qr(r.end,{joinWith:""})}}function pc(r){r.scope&&typeof r.scope=="object"&&r.scope!==null&&(r.beginScope=r.scope,delete r.scope)}function hc(r){pc(r),typeof r.beginScope=="string"&&(r.beginScope={_wrap:r.beginScope}),typeof r.endScope=="string"&&(r.endScope={_wrap:r.endScope}),dc(r),uc(r)}function mc(r){function i(f,h){return new RegExp(tr(f),"m"+(r.case_insensitive?"i":"")+(r.unicodeRegex?"u":"")+(h?"g":""))}class l{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(h,b){b.position=this.position++,this.matchIndexes[this.matchAt]=b,this.regexes.push([b,h]),this.matchAt+=_o(h)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let h=this.regexes.map(b=>b[1]);this.matcherRe=i(Qr(h,{joinWith:"|"}),!0),this.lastIndex=0}exec(h){this.matcherRe.lastIndex=this.lastIndex;let b=this.matcherRe.exec(h);if(!b)return null;let k=b.findIndex((P,M)=>M>0&&P!==void 0),A=this.matchIndexes[k];return b.splice(0,k),Object.assign(b,A)}}class d{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(h){if(this.multiRegexes[h])return this.multiRegexes[h];let b=new l;return this.rules.slice(h).forEach(([k,A])=>b.addRule(k,A)),b.compile(),this.multiRegexes[h]=b,b}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(h,b){this.rules.push([h,b]),b.type==="begin"&&this.count++}exec(h){let b=this.getMatcher(this.regexIndex);b.lastIndex=this.lastIndex;let k=b.exec(h);if(this.resumingScanAtSamePosition()&&!(k&&k.index===this.lastIndex)){let A=this.getMatcher(0);A.lastIndex=this.lastIndex+1,k=A.exec(h)}return k&&(this.regexIndex+=k.position+1,this.regexIndex===this.count&&this.considerAll()),k}}function u(f){let h=new d;return f.contains.forEach(b=>h.addRule(b.begin,{rule:b,type:"begin"})),f.terminatorEnd&&h.addRule(f.terminatorEnd,{type:"end"}),f.illegal&&h.addRule(f.illegal,{type:"illegal"}),h}function m(f,h){let b=f;if(f.isCompiled)return b;[ec,rc,hc,oc].forEach(A=>A(f,h)),r.compilerExtensions.forEach(A=>A(f,h)),f.__beforeBegin=null,[tc,nc,sc].forEach(A=>A(f,h)),f.isCompiled=!0;let k=null;return typeof f.keywords=="object"&&f.keywords.$pattern&&(f.keywords=Object.assign({},f.keywords),k=f.keywords.$pattern,delete f.keywords.$pattern),k=k||/\w+/,f.keywords&&(f.keywords=Oo(f.keywords,r.case_insensitive)),b.keywordPatternRe=i(k,!0),h&&(f.begin||(f.begin=/\B|\b/),b.beginRe=i(b.begin),!f.end&&!f.endsWithParent&&(f.end=/\B|\b/),f.end&&(b.endRe=i(b.end)),b.terminatorEnd=tr(b.end)||"",f.endsWithParent&&h.terminatorEnd&&(b.terminatorEnd+=(f.end?"|":"")+h.terminatorEnd)),f.illegal&&(b.illegalRe=i(f.illegal)),f.contains||(f.contains=[]),f.contains=[].concat(...f.contains.map(function(A){return fc(A==="self"?f:A)})),f.contains.forEach(function(A){m(A,b)}),f.starts&&m(f.starts,h),b.matcher=u(b),b}if(r.compilerExtensions||(r.compilerExtensions=[]),r.contains&&r.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return r.classNameAliases=Sn(r.classNameAliases||{}),m(r)}function Lo(r){return r?r.endsWithParent||Lo(r.starts):!1}function fc(r){return r.variants&&!r.cachedVariants&&(r.cachedVariants=r.variants.map(function(i){return Sn(r,{variants:null},i)})),r.cachedVariants?r.cachedVariants:Lo(r)?Sn(r,{starts:r.starts?Sn(r.starts):null}):Object.isFrozen(r)?Sn(r):r}var gc="11.11.1",Yr=class extends Error{constructor(i,l){super(i),this.name="HTMLInjectionError",this.html=l}},Wr=So,vo=Sn,ko=Symbol("nomatch"),bc=7,Ro=function(r){let i=Object.create(null),l=Object.create(null),d=[],u=!0,m="Could not find the language '{}', did you forget to load/include a language module?",f={disableAutodetect:!0,name:"Plain text",contains:[]},h={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Xr};function b(O){return h.noHighlightRe.test(O)}function k(O){let D=O.className+" ";D+=O.parentNode?O.parentNode.className:"";let V=h.languageDetectRe.exec(D);if(V){let re=xe(V[1]);return re||(xo(m.replace("{}",V[1])),xo("Falling back to no-highlight mode for this block.",O)),re?V[1]:"no-highlight"}return D.split(/\s+/).find(re=>b(re)||xe(re))}function A(O,D,V){let re="",Ae="";typeof D=="object"?(re=O,V=D.ignoreIllegals,Ae=D.language):(Un("10.7.0","highlight(lang, code, ...args) has been deprecated."),Un("10.7.0",`Please use highlight(code, options) instead.
3
+ https://github.com/highlightjs/highlight.js/issues/2277`),Ae=O,re=D),V===void 0&&(V=!0);let Ke={code:re,language:Ae};Je("before:highlight",Ke);let Ce=Ke.result?Ke.result:P(Ke.language,Ke.code,V);return Ce.code=Ke.code,Je("after:highlight",Ce),Ce}function P(O,D,V,re){let Ae=Object.create(null);function Ke(me,Ne){return me.keywords[Ne]}function Ce(){if(!Se.keywords){Ee.addText(ze);return}let me=0;Se.keywordPatternRe.lastIndex=0;let Ne=Se.keywordPatternRe.exec(ze),Ie="";for(;Ne;){Ie+=ze.substring(me,Ne.index);let et=Be.case_insensitive?Ne[0].toLowerCase():Ne[0],tt=Ke(Se,et);if(tt){let[bt,He]=tt;if(Ee.addText(Ie),Ie="",Ae[et]=(Ae[et]||0)+1,Ae[et]<=bc&&(oe+=He),bt.startsWith("_"))Ie+=Ne[0];else{let ft=Be.classNameAliases[bt]||bt;N(Ne[0],ft)}}else Ie+=Ne[0];me=Se.keywordPatternRe.lastIndex,Ne=Se.keywordPatternRe.exec(ze)}Ie+=ze.substring(me),Ee.addText(Ie)}function s(){if(ze==="")return;let me=null;if(typeof Se.subLanguage=="string"){if(!i[Se.subLanguage]){Ee.addText(ze);return}me=P(Se.subLanguage,ze,!0,it[Se.subLanguage]),it[Se.subLanguage]=me._top}else me=T(ze,Se.subLanguage.length?Se.subLanguage:null);Se.relevance>0&&(oe+=me.relevance),Ee.__addSublanguage(me._emitter,me.language)}function o(){Se.subLanguage!=null?s():Ce(),ze=""}function N(me,Ne){me!==""&&(Ee.startScope(Ne),Ee.addText(me),Ee.endScope())}function Fe(me,Ne){let Ie=1,et=Ne.length-1;for(;Ie<=et;){if(!me._emit[Ie]){Ie++;continue}let tt=Be.classNameAliases[me[Ie]]||me[Ie],bt=Ne[Ie];tt?N(bt,tt):(ze=bt,Ce(),ze=""),Ie++}}function B(me,Ne){return me.scope&&typeof me.scope=="string"&&Ee.openNode(Be.classNameAliases[me.scope]||me.scope),me.beginScope&&(me.beginScope._wrap?(N(ze,Be.classNameAliases[me.beginScope._wrap]||me.beginScope._wrap),ze=""):me.beginScope._multi&&(Fe(me.beginScope,Ne),ze="")),Se=Object.create(me,{parent:{value:Se}}),Se}function ot(me,Ne,Ie){let et=Rl(me.endRe,Ie);if(et){if(me["on:end"]){let tt=new br(me);me["on:end"](Ne,tt),tt.isMatchIgnored&&(et=!1)}if(et){for(;me.endsParent&&me.parent;)me=me.parent;return me}}if(me.endsWithParent)return ot(me.parent,Ne,Ie)}function mt(me){return Se.matcher.regexIndex===0?(ze+=me[0],1):(Et=!0,0)}function K(me){let Ne=me[0],Ie=me.rule,et=new br(Ie),tt=[Ie.__beforeBegin,Ie["on:begin"]];for(let bt of tt)if(bt&&(bt(me,et),et.isMatchIgnored))return mt(Ne);return Ie.skip?ze+=Ne:(Ie.excludeBegin&&(ze+=Ne),o(),!Ie.returnBegin&&!Ie.excludeBegin&&(ze=Ne)),B(Ie,me),Ie.returnBegin?0:Ne.length}function _e(me){let Ne=me[0],Ie=D.substring(me.index),et=ot(Se,me,Ie);if(!et)return ko;let tt=Se;Se.endScope&&Se.endScope._wrap?(o(),N(Ne,Se.endScope._wrap)):Se.endScope&&Se.endScope._multi?(o(),Fe(Se.endScope,me)):tt.skip?ze+=Ne:(tt.returnEnd||tt.excludeEnd||(ze+=Ne),o(),tt.excludeEnd&&(ze=Ne));do Se.scope&&Ee.closeNode(),!Se.skip&&!Se.subLanguage&&(oe+=Se.relevance),Se=Se.parent;while(Se!==et.parent);return et.starts&&B(et.starts,me),tt.returnEnd?0:Ne.length}function Y(){let me=[];for(let Ne=Se;Ne!==Be;Ne=Ne.parent)Ne.scope&&me.unshift(Ne.scope);me.forEach(Ne=>Ee.openNode(Ne))}let Re={};function y(me,Ne){let Ie=Ne&&Ne[0];if(ze+=me,Ie==null)return o(),0;if(Re.type==="begin"&&Ne.type==="end"&&Re.index===Ne.index&&Ie===""){if(ze+=D.slice(Ne.index,Ne.index+1),!u){let et=new Error(`0 width match regex (${O})`);throw et.languageName=O,et.badRule=Re.rule,et}return 1}if(Re=Ne,Ne.type==="begin")return K(Ne);if(Ne.type==="illegal"&&!V){let et=new Error('Illegal lexeme "'+Ie+'" for mode "'+(Se.scope||"<unnamed>")+'"');throw et.mode=Se,et}else if(Ne.type==="end"){let et=_e(Ne);if(et!==ko)return et}if(Ne.type==="illegal"&&Ie==="")return ze+=`
4
+ `,1;if(gt>1e5&&gt>Ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ze+=Ie,Ie.length}let Be=xe(O);if(!Be)throw Ln(m.replace("{}",O)),new Error('Unknown language: "'+O+'"');let w=mc(Be),pe="",Se=re||w,it={},Ee=new h.__emitter(h);Y();let ze="",oe=0,Xe=0,gt=0,Et=!1;try{if(Be.__emitTokens)Be.__emitTokens(D,Ee);else{for(Se.matcher.considerAll();;){gt++,Et?Et=!1:Se.matcher.considerAll(),Se.matcher.lastIndex=Xe;let me=Se.matcher.exec(D);if(!me)break;let Ne=D.substring(Xe,me.index),Ie=y(Ne,me);Xe=me.index+Ie}y(D.substring(Xe))}return Ee.finalize(),pe=Ee.toHTML(),{language:O,value:pe,relevance:oe,illegal:!1,_emitter:Ee,_top:Se}}catch(me){if(me.message&&me.message.includes("Illegal"))return{language:O,value:Wr(D),illegal:!0,relevance:0,_illegalBy:{message:me.message,index:Xe,context:D.slice(Xe-100,Xe+100),mode:me.mode,resultSoFar:pe},_emitter:Ee};if(u)return{language:O,value:Wr(D),illegal:!1,relevance:0,errorRaised:me,_emitter:Ee,_top:Se};throw me}}function M(O){let D={value:Wr(O),illegal:!1,relevance:0,_top:f,_emitter:new h.__emitter(h)};return D._emitter.addText(O),D}function T(O,D){D=D||h.languages||Object.keys(i);let V=M(O),re=D.filter(xe).filter(st).map(o=>P(o,O,!1));re.unshift(V);let Ae=re.sort((o,N)=>{if(o.relevance!==N.relevance)return N.relevance-o.relevance;if(o.language&&N.language){if(xe(o.language).supersetOf===N.language)return 1;if(xe(N.language).supersetOf===o.language)return-1}return 0}),[Ke,Ce]=Ae,s=Ke;return s.secondBest=Ce,s}function C(O,D,V){let re=D&&l[D]||V;O.classList.add("hljs"),O.classList.add(`language-${re}`)}function F(O){let D=null,V=k(O);if(b(V))return;if(Je("before:highlightElement",{el:O,language:V}),O.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",O);return}if(O.children.length>0&&(h.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(O)),h.throwUnescapedHTML))throw new Yr("One of your code blocks includes unescaped HTML.",O.innerHTML);D=O;let re=D.textContent,Ae=V?A(re,{language:V,ignoreIllegals:!0}):T(re);O.innerHTML=Ae.value,O.dataset.highlighted="yes",C(O,V,Ae.language),O.result={language:Ae.language,re:Ae.relevance,relevance:Ae.relevance},Ae.secondBest&&(O.secondBest={language:Ae.secondBest.language,relevance:Ae.secondBest.relevance}),Je("after:highlightElement",{el:O,result:Ae,text:re})}function ye(O){h=vo(h,O)}let ge=()=>{de(),Un("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function be(){de(),Un("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let J=!1;function de(){function O(){de()}if(document.readyState==="loading"){J||window.addEventListener("DOMContentLoaded",O,!1),J=!0;return}document.querySelectorAll(h.cssSelector).forEach(F)}function Oe(O,D){let V=null;try{V=D(r)}catch(re){if(Ln("Language definition for '{}' could not be registered.".replace("{}",O)),u)Ln(re);else throw re;V=f}V.name||(V.name=O),i[O]=V,V.rawDefinition=D.bind(null,r),V.aliases&&Le(V.aliases,{languageName:O})}function ke(O){delete i[O];for(let D of Object.keys(l))l[D]===O&&delete l[D]}function De(){return Object.keys(i)}function xe(O){return O=(O||"").toLowerCase(),i[O]||i[l[O]]}function Le(O,{languageName:D}){typeof O=="string"&&(O=[O]),O.forEach(V=>{l[V.toLowerCase()]=D})}function st(O){let D=xe(O);return D&&!D.disableAutodetect}function at(O){O["before:highlightBlock"]&&!O["before:highlightElement"]&&(O["before:highlightElement"]=D=>{O["before:highlightBlock"](Object.assign({block:D.el},D))}),O["after:highlightBlock"]&&!O["after:highlightElement"]&&(O["after:highlightElement"]=D=>{O["after:highlightBlock"](Object.assign({block:D.el},D))})}function _(O){at(O),d.push(O)}function qe(O){let D=d.indexOf(O);D!==-1&&d.splice(D,1)}function Je(O,D){let V=O;d.forEach(function(re){re[V]&&re[V](D)})}function je(O){return Un("10.7.0","highlightBlock will be removed entirely in v12.0"),Un("10.7.0","Please use highlightElement now."),F(O)}Object.assign(r,{highlight:A,highlightAuto:T,highlightAll:de,highlightElement:F,highlightBlock:je,configure:ye,initHighlighting:ge,initHighlightingOnLoad:be,registerLanguage:Oe,unregisterLanguage:ke,listLanguages:De,getLanguage:xe,registerAliases:Le,autoDetection:st,inherit:vo,addPlugin:_,removePlugin:qe}),r.debugMode=function(){u=!1},r.safeMode=function(){u=!0},r.versionString=gc,r.regex={concat:Rn,lookahead:Ao,either:Jr,optional:Ml,anyNumberOfTimes:Ol};for(let O in gr)typeof gr[O]=="object"&&Eo(gr[O]);return Object.assign(r,gr),r},Hn=Ro({});Hn.newInstance=()=>Ro({});Io.exports=Hn;Hn.HighlightJS=Hn;Hn.default=Hn});var Ud={};Xa(Ud,{init:()=>Fd,initTerminals:()=>zd,registerBuildProvider:()=>sr,version:()=>qd});le();ce();le();ce();le();ce();var tl=new Set(["UL","OL","TABLE","TBODY","DL","SVG"]),nl=new Set(["defs","title","desc","style","metadata"]),Xs=new Map;function Ys(r,i){Xs.set(r,i)}function mr(r){return[...r.children].filter(i=>{let l=i.tagName.toLowerCase();return!(nl.has(l)||l==="aside"&&i.classList.contains("notes")||i.hasAttribute("data-build-stay"))})}function rl(r){if(r.hasAttribute("data-build-self"))return!1;let i=r.tagName.toUpperCase();return tl.has(i)?!0:i==="DIV"||i==="G"?mr(r).length>=2:!1}function sl(r){if(r.tagName.toUpperCase()==="TABLE"){let l=r.querySelector(":scope > tbody");return l?mr(l):mr(r).filter(d=>d.tagName==="TR")}return mr(r)}function ol(r){let i=r.map((f,h)=>({...f,i:h}));i.sort((f,h)=>f.key-h.key||f.i-h.i);let l=[],d=null,u=null,m=!1;for(let f of i){if(d&&f.explicit&&m&&f.key===u){d.push(f.i);continue}d=[f.i],u=f.key,m=f.explicit,l.push(d)}return l}function Vs(r,i){r.classList.add("build-step"),r.setAttribute("data-build-style",i),r.setAttribute("data-build-state","pending"),i==="draw"&&il(r)}var Zs="path, line, polyline, polygon, circle, ellipse, rect";function il(r){let i=r.matches?.(Zs)?[r]:[...r.querySelectorAll(Zs)],l=!1;for(let u of i){let m=u.getAttribute("stroke")??getComputedStyle(u).stroke;if(!m||m==="none")continue;let f=0;try{f=u.getTotalLength()}catch{continue}if(!f)continue;l=!0;let h=u.getAttribute("stroke-dasharray")||u.style.strokeDasharray;h&&(u.dataset.drawOrig=h);for(let[b,k]of Gr){let A=u.getAttribute(b);A&&(u.dataset[k]=A)}u.classList.add("draw-stroke"),u.style.setProperty("--draw-len",String(Math.ceil(f)))}r.querySelectorAll("text, tspan").forEach(u=>u.classList.add("draw-fade")),l||r.setAttribute("data-build-style","fade")}var Gr=[["marker-start","drawMarkerStart"],["marker-mid","drawMarkerMid"],["marker-end","drawMarkerEnd"]];function hr(r,i){for(let[l,d]of Gr)d in r.dataset&&(i?r.setAttribute(l,r.dataset[d]):r.removeAttribute(l))}function al(r,i){for(let l of r.querySelectorAll(".draw-stroke")){let d=l.dataset.drawOrig,u=Gr.some(([,m])=>m in l.dataset);if(!(!d&&!u))if(i==="done")d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),hr(l,!0);else if(i==="pending")l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),hr(l,!1);else{l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),hr(l,!1);let m=()=>{r.getAttribute("data-build-state")!=="pending"&&(d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),hr(l,!0))},f=parseFloat(getComputedStyle(l).transitionDuration)||0;f===0?m():(l.addEventListener("transitionend",m,{once:!0}),setTimeout(m,f*1e3+150))}}}function jr(r){let i=[],l=[],d=new Set,u=0,m=(A,P)=>{let M=P!=null&&P!=="",T=M?parseInt(P,10):u;i.push(A),l.push({key:Number.isFinite(T)?T:u,explicit:M}),u++},f=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT);for(let A=f.nextNode();A;A=f.nextNode()){if(d.has(A))continue;let P=Xs.get(A);if(P){for(let T=0;T<P.count;T++)m({kind:"provider",provider:P,el:A,sub:T},null);A.querySelectorAll("*").forEach(T=>d.add(T));continue}if(!A.hasAttribute("data-build"))continue;let M=A.getAttribute("data-build")||"fade";if(rl(A)){for(let T of sl(A)){d.add(T),T.querySelectorAll("[data-build]").forEach(F=>d.add(F));let C=T.getAttribute("data-build")||M;Vs(T,C),m({kind:"dom",el:T,container:A},T.getAttribute("data-build-order"))}A.setAttribute("data-build-container","")}else Vs(A,M),m({kind:"dom",el:A,container:null},A.getAttribute("data-build-order"))}let h=ol(l),b=[],k=new Map;return i.forEach((A,P)=>{if(A.kind==="provider"){if(!k.has(A.provider)){let M={el:A.el,provider:A.provider,stepIdxs:[]};k.set(A.provider,M),b.push(M)}k.get(A.provider).stepIdxs.push(P)}}),{steps:i,groups:h,providers:b}}function En(r,i){let l=new Set;r.groups.forEach((f,h)=>{for(let b of f)h<i&&l.add(b)});let d=i>0?r.groups[i-1]??[]:[],u=new Set(d),m=new Set;r.steps.forEach((f,h)=>{if(f.kind!=="dom")return;let b=u.has(h)?"current":l.has(h)?"done":"pending";f.el.setAttribute("data-build-state",b),f.el.getAttribute("data-build-style")==="draw"&&al(f.el,b),f.container&&m.add(f.container)});for(let f of m){let h=!!f.querySelector(':scope [data-build-style="highlight"][data-build-state="current"]');f.classList.toggle("has-current-highlight",h)}for(let f of r.providers){let h=f.stepIdxs.filter(b=>l.has(b)||u.has(b)).length;f._last!==h&&(f._last=h,f.provider.apply(h))}}function Js(r){return r.groups.map(i=>{let l=r.steps[i[0]];if(l.kind==="provider"){let u=l.sub;return l.provider.label?l.provider.label(u+1):"step"}return l.el.textContent.trim().replace(/\s+/g," ").slice(0,60)||l.el.tagName.toLowerCase()})}le();ce();var Qs="rect, circle, ellipse, polygon, polyline, path";function ll(r){let i=5381;for(let l of String(r))i=(i*33^l.charCodeAt(0))>>>0;return 1+i%6}function cl(r,i={}){let l=i[r];return typeof l=="number"?`var(--d-fill-${l})`:typeof l=="string"?l:`var(--d-fill-${ll(r)})`}function eo(r,i={}){let l=new Map;r.querySelectorAll("svg [data-concept]").forEach(d=>{let u=d.getAttribute("data-concept");if(!u)return;let m=cl(u,i),f=m.match(/--d-fill-(\d)/);if(f){let b=l.get(f[1]);b&&b!==u?console.warn(`Decklight: concepts "${b}" and "${u}" share fill slot ${f[1]} \u2014 pin one explicitly via init({ concepts: { ${u}: <1-6> } })`):l.set(f[1],u)}let h=d.matches(Qs)?[d]:[...d.children].filter(b=>b.matches(Qs));for(let b of h){let k=b.getAttribute("fill")==="none"||b.style.fill==="none";b.style.setProperty(k?"stroke":"fill",m)}})}var dl=["fill","stroke","filter","clip-path","mask","marker-start","marker-mid","marker-end","style"];function to(r){r.querySelectorAll("svg").forEach((i,l)=>{let d=`svg${l}-`,u=new Map;if(i.querySelectorAll("[id]").forEach(f=>{let h=f.id;u.set(h,d+h),f.id=d+h}),u.size===0)return;let m=f=>f.replace(/url\(['"]?#([^'")]+)['"]?\)/g,(h,b)=>u.has(b)?`url(#${u.get(b)})`:h);i.querySelectorAll("*").forEach(f=>{for(let h of dl){let b=f.getAttribute(h);b&&b.includes("url(#")&&f.setAttribute(h,m(b))}for(let h of["href","xlink:href"]){let b=f.getAttribute(h);b&&b.startsWith("#")&&u.has(b.slice(1))&&f.setAttribute(h,"#"+u.get(b.slice(1)))}})})}le();ce();le();ce();var $t=r=>String(r).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");var no=640,ul=360,ro=["bar","line","area","pie","donut"],Te=r=>{let i=Math.round(r*100)/100;return Object.is(i,-0)?"0":String(i)},Fn=r=>`var(--d-fill-${r%6+1})`;function pl(r,i={}){let l;if(typeof r=="string")try{l=JSON.parse(r)}catch(k){throw new Error(`invalid JSON \u2014 ${k.message}`)}else if(r&&typeof r=="object")l=r;else throw new Error('no data \u2014 expected a <script type="application/json"> child (or the fence body)');let d=String(i.type||l.type||"").toLowerCase();if(!ro.includes(d))throw new Error(`unknown type "${d}" \u2014 use ${ro.join(" | ")}`);if(!Array.isArray(l.labels)||l.labels.length===0)throw new Error('"labels" must be a non-empty array');if(!Array.isArray(l.series)||l.series.length===0)throw new Error('"series" must be a non-empty array');let u=l.labels.map(String),m=l.series.map((k,A)=>{if(!k||!Array.isArray(k.data))throw new Error(`series ${A+1}: "data" must be an array of numbers`);return{name:k.name!=null?String(k.name):`series ${A+1}`,concept:k.concept!=null?String(k.concept):null,data:u.map((P,M)=>{let T=Number(k.data[M]);return Number.isFinite(T)?T:null})}}),f=d==="pie"||d==="donut";if(f&&m.length>1)throw new Error("pie takes exactly one series (labels are the slices)");if(f&&!m[0].data.some(k=>k>0))throw new Error("pie needs at least one positive value");let h=ul,b=i.aspect??l.aspect??null;if(b!=null){let k=String(b).match(/^\s*(\d+(?:\.\d+)?)\s*[:x]\s*(\d+(?:\.\d+)?)\s*$/i);if(!k||+k[1]==0)throw new Error(`bad aspect "${b}" \u2014 use "w:h", e.g. "4:3"`);h=Math.round(no*+k[2]/+k[1])}return{type:f?"pie":d,donut:d==="donut"||l.donut===!0,title:i.title??(l.title!=null?String(l.title):null),labels:u,series:m,legend:l.legend,width:no,height:h,build:l.build}}function hl(r,i,l=5){if(!Number.isFinite(r)||!Number.isFinite(i))throw new Error("niceTicks: non-finite range");if(r>i&&([r,i]=[i,r]),r===i){let P=r===0?1:Math.abs(r)/2;r-=r===0?0:P,i+=P}let d=(i-r)/Math.max(1,l-1),u=10**Math.floor(Math.log10(d)),m=d/u,f=(m<=1?1:m<=2?2:m<=2.5?2.5:m<=5?5:10)*u,h=Math.floor(r/f+1e-9)*f,b=Math.ceil(i/f-1e-9)*f,k=Math.max(1,Math.round((b-h)/f)),A=Array.from({length:k+1},(P,M)=>+(h+M*f).toPrecision(12));return{min:A[0],max:A[k],step:f,ticks:A}}function ml(r,i){let l=0;for(;l<6&&Math.abs(Math.round(i*10**l)-i*10**l)>1e-9;)l++;return r.toFixed(l)}function fl(r,i,l,d){let u=d.max-d.min||1,m=A=>l.y+l.h*(1-(A-d.min)/u),f=m(Math.max(d.min,Math.min(d.max,0))),h=l.w/i,b=h*.72,k=b/r.length;return r.map((A,P)=>Array.from({length:i},(M,T)=>{let C=A.data[T];if(C==null||!Number.isFinite(C))return null;let F=m(C);return{x:l.x+T*h+(h-b)/2+P*k+1,y:Math.min(F,f),w:Math.max(1,k-2),h:Math.abs(f-F),value:C}}))}function gl(r){let i="",l=!1;for(let d of r){if(!d){l=!1;continue}i+=`${l?"L":"M"}${Te(d.x)} ${Te(d.y)}`,l=!0}return i}function bl(r,i){let l=r.filter(Boolean);if(!l.length)return"";let d=`M${Te(l[0].x)} ${Te(i)}`;for(let u of l)d+=`L${Te(u.x)} ${Te(u.y)}`;return d+=`L${Te(l[l.length-1].x)} ${Te(i)}Z`,d}function yl(r,i,l,d,u=0){let m=r.map(k=>Math.max(0,Number(k)||0)),f=m.reduce((k,A)=>k+A,0);if(f<=0)throw new Error("pie needs at least one positive value");let h=(k,A)=>[i+A*Math.cos(k),l+A*Math.sin(k)],b=-Math.PI/2;return m.map(k=>{let A=k/f,P=b,M=b+A*2*Math.PI;b=M;let T=(P+M)/2,C=u>0?(d+u)/2:d*.66,[F,ye]=h(T,C),[ge,be]=h(T,d+14),J={value:k,frac:A,mid:T,labelX:F,labelY:ye,outX:ge,outY:be,anchor:Math.cos(T)<-1e-6?"end":Math.cos(T)>1e-6?"start":"middle"};if(A===0)return{...J,d:""};let de;if(A>=.9999){let[Oe,ke]=h(P,d),[De,xe]=h(P+Math.PI,d);if(de=`M${Te(Oe)} ${Te(ke)}A${Te(d)} ${Te(d)} 0 1 1 ${Te(De)} ${Te(xe)}A${Te(d)} ${Te(d)} 0 1 1 ${Te(Oe)} ${Te(ke)}Z`,u>0){let[Le,st]=h(P,u),[at,_]=h(P+Math.PI,u);de+=`M${Te(Le)} ${Te(st)}A${Te(u)} ${Te(u)} 0 1 0 ${Te(at)} ${Te(_)}A${Te(u)} ${Te(u)} 0 1 0 ${Te(Le)} ${Te(st)}Z`}}else{let Oe=M-P>Math.PI?1:0,[ke,De]=h(P,d),[xe,Le]=h(M,d);if(u>0){let[st,at]=h(M,u),[_,qe]=h(P,u);de=`M${Te(ke)} ${Te(De)}A${Te(d)} ${Te(d)} 0 ${Oe} 1 ${Te(xe)} ${Te(Le)}L${Te(st)} ${Te(at)}A${Te(u)} ${Te(u)} 0 ${Oe} 0 ${Te(_)} ${Te(qe)}Z`}else de=`M${Te(i)} ${Te(l)}L${Te(ke)} ${Te(De)}A${Te(d)} ${Te(d)} 0 ${Oe} 1 ${Te(xe)} ${Te(Le)}Z`}return{...J,d:de}})}var zn='fill="var(--d-text)"';function Kr(r,i){return`<g class="chart-series" data-series="${i+1}" data-name="${$t(r.name)}"`+(r.concept?` data-concept="${$t(r.concept)}"`:"")+">"}function wl(r,i,l){let d=r.series.flatMap(C=>C.data).filter(C=>C!=null),u=Math.min(0,...d),m=Math.max(0,...d),f=hl(u,m===u?u+1:m,5),h=f.ticks.map(C=>ml(C,f.step)),b=14+Math.max(...h.map(C=>C.length))*6.6+8,k={x:b,y:r.title||so(r)?40:18,w:r.width-b-14,h:0};k.h=r.height-k.y-34;let A=f.max-f.min||1,P=C=>k.y+k.h*(1-(C-f.min)/A);f.ticks.forEach((C,F)=>{let ye=P(C);i.push(`<line class="chart-grid" x1="${Te(k.x)}" y1="${Te(ye)}" x2="${Te(k.x+k.w)}" y2="${Te(ye)}" stroke="var(--d-muted)" stroke-opacity="0.35" stroke-width="1"/>`),i.push(`<text class="chart-tick" x="${Te(k.x-8)}" y="${Te(ye+4)}" text-anchor="end" font-size="11" ${zn}>${$t(h[F])}</text>`)}),i.push(`<line class="chart-axis" x1="${Te(k.x)}" y1="${Te(k.y)}" x2="${Te(k.x)}" y2="${Te(k.y+k.h)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let M=P(Math.max(f.min,Math.min(f.max,0)));i.push(`<line class="chart-axis" x1="${Te(k.x)}" y1="${Te(M)}" x2="${Te(k.x+k.w)}" y2="${Te(M)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let T=k.w/r.labels.length;if(r.labels.forEach((C,F)=>{i.push(`<text class="chart-cat" x="${Te(k.x+(F+.5)*T)}" y="${Te(k.y+k.h+20)}" text-anchor="middle" font-size="12" ${zn}>${$t(C)}</text>`)}),r.type==="bar"){let C=fl(r.series,r.labels.length,k,f);r.series.forEach((F,ye)=>{l.push(Kr(F,ye)),C[ye].forEach(ge=>{ge&&l.push(`<rect class="chart-bar draw-fade" x="${Te(ge.x)}" y="${Te(ge.y)}" width="${Te(ge.w)}" height="${Te(ge.h)}" rx="2" fill="${Fn(ye)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`)}),l.push("</g>")})}else r.series.forEach((C,F)=>{let ye=C.data.map((J,de)=>J==null?null:{x:k.x+(de+.5)*T,y:P(J)}),ge=gl(ye),be='stroke-linejoin="round" stroke-linecap="round"';if(l.push(Kr(C,F)),r.type==="area"&&l.push(`<path class="chart-area draw-fade" d="${bl(ye,M)}" fill="${Fn(F)}" fill-opacity="0.35"/>`),l.push(`<g class="chart-casing"><path d="${ge}" fill="none" stroke="var(--d-stroke)" stroke-width="4.5" ${be}/></g>`),l.push(`<path class="chart-line" d="${ge}" fill="none" stroke="${Fn(F)}" stroke-width="2.5" ${be}/>`),r.type==="line")for(let J of ye)J&&l.push(`<circle class="chart-dot draw-fade" cx="${Te(J.x)}" cy="${Te(J.y)}" r="4" fill="${Fn(F)}" stroke="var(--d-stroke)" stroke-width="1"/>`);l.push("</g>")})}function xl(r,i){let l=r.title?40:16,d=r.width/2,u=l+(r.height-l-12)/2,m=Math.max(24,Math.min((r.height-l-12)/2-26,r.width/2-110)),f=yl(r.series[0].data.map(h=>h??0),d,u,m,r.donut?m*.55:0);i.push(Kr(r.series[0],0)),f.forEach((h,b)=>{h.d&&(i.push(`<path class="chart-slice draw-fade" d="${h.d}" fill="${Fn(b)}" fill-rule="evenodd" stroke="var(--d-stroke)" stroke-width="1.5" stroke-linejoin="round"/>`),i.push(`<text class="chart-cat draw-fade" x="${Te(h.outX)}" y="${Te(h.outY+4)}" text-anchor="${h.anchor}" font-size="12" ${zn}>${$t(r.labels[b])}</text>`),h.frac>=.05&&i.push(`<text class="chart-value draw-fade" x="${Te(h.labelX)}" y="${Te(h.labelY+4)}" text-anchor="middle" font-size="12" font-weight="600" ${zn}>${Math.round(h.frac*100)}%</text>`))}),i.push("</g>")}function so(r){return r.legend===!0?!0:r.legend===!1?!1:r.type!=="pie"&&r.series.length>1}function vl(r){let i=[],l=[];if(r.title&&i.push(`<text class="chart-title" x="14" y="24" font-size="15" font-weight="600" ${zn}>${$t(r.title)}</text>`),so(r)){let u=r.series.map(f=>({name:f.name,w:f.name.length*6.6+24})),m=r.width-14-u.reduce((f,h)=>f+h.w,0);r.series.forEach((f,h)=>{i.push(`<rect class="chart-swatch" x="${Te(m)}" y="14" width="11" height="11" rx="2" fill="${Fn(h)}" stroke="var(--d-stroke)" stroke-width="1"/>`),i.push(`<text class="chart-legend" x="${Te(m+16)}" y="24" font-size="12" ${zn}>${$t(f.name)}</text>`),m+=u[h].w})}r.type==="pie"?xl(r,l):wl(r,i,l);let d=r.title?`${r.title} \u2014 ${r.type} chart`:`${r.type} chart`;return`<svg class="chart-svg" viewBox="0 0 ${r.width} ${r.height}" role="img" aria-label="${$t(d)}" preserveAspectRatio="xMidYMid meet"><g class="chart-chrome" data-build-stay>${i.join("")}</g>`+l.join("")+"</svg>"}function oo(r){r.querySelectorAll("[data-chart]").forEach(i=>{if(i.querySelector(":scope > svg.chart-svg, :scope > .chart-broken"))return;i.classList.add("chart");let l=i.querySelector('script[type="application/json"]');try{let d=pl(l?l.textContent:null,{type:i.getAttribute("data-chart")||void 0,title:i.getAttribute("data-title")||void 0,aspect:i.getAttribute("data-aspect")||void 0}),u=document.createElement("template");u.innerHTML=vl(d);let m=u.content.firstElementChild;i.hasAttribute("data-build")?(m.setAttribute("data-build",i.getAttribute("data-build")),i.removeAttribute("data-build")):d.build!=null&&d.build!==!1&&m.setAttribute("data-build",d.build===!0?"":String(d.build)),i.getAttribute("data-chart")||i.setAttribute("data-chart",d.donut?"donut":d.type),i.insertBefore(m,l)}catch(d){let u=document.createElement("div");u.className="chart-broken",u.textContent=`chart: ${d.message||d}`,i.insertBefore(u,l)}})}le();ce();le();ce();function fr(r,i){let l=String(r??"").trim(),d=parseFloat(l);return!Number.isFinite(d)||d<=0?i:l.endsWith("ms")?d:l.endsWith("s")?d*1e3:d}var er=["opacity","color","backgroundColor","borderRadius","fontSize"],io=(r=er)=>["transform",...r.map(i=>i.replace(/[A-Z]/g,l=>`-${l.toLowerCase()}`))];function ao(r,i,l,d=!1){let u=l?.x||1,m=l?.y||1,f=(r.rect.left-i.rect.left)/u,h=(r.rect.top-i.rect.top)/m,b=d||!i.rect.width?1:r.rect.width/i.rect.width,k=d||!i.rect.height?1:r.rect.height/i.rect.height;return{dx:f,dy:h,sx:b,sy:k}}function lo({dx:r,dy:i,sx:l,sy:d}){return!r&&!i&&l===1&&d===1?"":`translate(${r}px, ${i}px) scale(${l}, ${d})`}var co=(r,i)=>r||i||"fade";function uo(r,i){if(r==="none")return null;let l=`dir-${i}`;return{entering:["entering",`tr-${r}`,l],leaving:["leaving",`tr-${r}`,l,"active-out"]}}var kl=io();function po(r){let i=getComputedStyle(r),l={rect:r.getBoundingClientRect()};for(let d of er)l[d]=i[d];return l}function El(r,i){if(r.ownerSVGElement){let l=r.getScreenCTM?.();if(l&&l.a&&l.d)return{x:l.a,y:l.d}}return{x:i,y:i}}function ho(r,i,l){let d=fr(getComputedStyle(i).getPropertyValue("--auto-animate-duration"),500),u=new Map;r.querySelectorAll("[data-id]").forEach(h=>{u.set(h.getAttribute("data-id"),po(h))});let m=[];i.querySelectorAll("[data-id]").forEach(h=>{let b=u.get(h.getAttribute("data-id"));b&&m.push({el:h,o:b})});for(let{el:h,o:b}of m){let k=po(h),A=El(h,l),P=h.children.length===0&&b.fontSize!==k.fontSize,M=ao(b,k,A,P),T=h.getAttribute("style")??"";h.style.transition="none",h.ownerSVGElement&&(h.style.transformBox="fill-box"),h.style.transformOrigin="0 0",h.style.transform=lo(M);for(let F of er)h.style[F]=b[F];h.offsetWidth,h.style.transition=kl.map(F=>`${F} ${d}ms ease`).join(", "),h.style.transform="";for(let F of er)h.style[F]=k[F];let C=()=>{T?h.setAttribute("style",T):h.removeAttribute("style"),h.removeEventListener("transitionend",C)};h.addEventListener("transitionend",C),setTimeout(C,d+80)}let f=new Set(m.map(h=>h.el));return[...i.children].forEach(h=>{h.matches("aside.notes")||f.has(h)||[...f].some(k=>h.contains(k))||(h.classList.add("aa-fresh"),requestAnimationFrame(()=>requestAnimationFrame(()=>h.classList.add("aa-in"))),setTimeout(()=>h.classList.remove("aa-fresh","aa-in"),d+120))}),d}le();ce();le();ce();var mo=function(){"use strict";class r{constructor(t,n){let a,c=" "+t,p=n&&n.loc;if(p&&p.start<=p.end){let x=p.lexer.input;a=p.start;let q=p.end;a===x.length?c+=" at end of input: ":c+=" at position "+(a+1)+`:
5
+ `;let j=x.slice(a,q).replace(/[^]/g,"$&\u0332"),ie,he;ie=a>15?"\u2026"+x.slice(a-15,a):x.slice(0,a),he=q+15<x.length?x.slice(q,q+15)+"\u2026":x.slice(q),c+=ie+j+he}let g=new Error(c);return g.name="ParseError",g.__proto__=r.prototype,g.position=a,g}}r.prototype.__proto__=Error.prototype;let i=function(e,t){return e===void 0?t:e},l=/([A-Z])/g,d=function(e){return e.replace(l,"-$1").toLowerCase()},u={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},m=/[&><"']/g;function f(e){return String(e).replace(m,t=>u[t])}let h=function(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?h(e.body[0]):e:e.type==="font"?h(e.body):e},b=function(e){let t=h(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},k=function(e){return+e.toFixed(4)},A="aceg\u0131\u0237mnopqrsuvwxyz\u03B1\u03B3\u03B5\u03B7\u03B9\u03BA\u03BC\u03BD\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C7\u03C9\u03D5\u{1D41A}\u{1D41C}\u{1D41E}\u{1D420}\u{1D426}\u{1D427}\u{1D428}\u{1D429}\u{1D42A}\u{1D42B}\u{1D42C}\u{1D42E}\u{1D42F}\u{1D430}\u{1D431}\u{1D432}\u{1D433}";class P{constructor(t){t=t||{},this.displayMode=i(t.displayMode,!1),this.annotate=i(t.annotate,!1),this.leqno=i(t.leqno,!1),this.throwOnError=i(t.throwOnError,!1),this.errorColor=i(t.errorColor,"#b22222"),this.macros=t.macros||{},this.wrap=i(t.wrap,"none"),this.xml=i(t.xml,!1),this.colorIsTextColor=i(t.colorIsTextColor,!1),this.strict=i(t.strict,!1),this.trust=i(t.trust,!1),this.maxSize=t.maxSize===void 0?[1/0,1/0]:Array.isArray(t.maxSize)?t.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,i(t.maxExpand,1e3)),this.wrapDelimiterPairs=!0}isTrusted(t){if(t.url&&!t.protocol){let a=function(c){let p=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(c);return p?p[2]!==":"?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(p[1])?p[1].toLowerCase():null:"_relative"}(t.url);if(a==null)return!1;t.protocol=a}return!!(typeof this.trust=="function"?this.trust(t):this.trust)}}let M={},T={};function C({type:e,names:t,props:n,handler:a,mathmlBuilder:c}){let p={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0||n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:a};for(let g=0;g<t.length;++g)M[t[g]]=p;e&&c&&(T[e]=c)}function F({type:e,mathmlBuilder:t}){C({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}let ye=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},ge=function(e){return e.type==="ordgroup"?e.body:[e]};class be{constructor(t){this.children=t,this.classes=[],this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createDocumentFragment();for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){return this.children.map(t=>t.toText()).join("")}}let J=function(e){return e.filter(t=>t).join(" ")},de=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},Oe=function(e){let t=document.createElement(e);t.className=J(this.classes);for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t},ke=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${f(J(this.classes))}"`);let n="";for(let a in this.style)Object.prototype.hasOwnProperty.call(this.style,a)&&(n+=`${d(a)}:${this.style[a]};`);n&&(t+=` style="${n}"`);for(let a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&(t+=` ${a}="${f(this.attributes[a])}"`);t+=">";for(let a=0;a<this.children.length;a++)t+=this.children[a].toMarkup();return t+=`</${e}>`,t};class De{constructor(t,n,a){de.call(this,t,a),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}toNode(){return Oe.call(this,"span")}toMarkup(){return ke.call(this,"span")}}let xe=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.text)}};class Le{constructor(t,n,a){this.href=t,this.classes=n,this.children=a||[]}toNode(){let t=document.createElement("a");t.setAttribute("href",this.href),this.classes.length>0&&(t.className=J(this.classes));for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t=`<a href='${f(this.href)}'`;this.classes.length>0&&(t+=` class="${f(J(this.classes))}"`),t+=">";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</a>",t}}class st{constructor(t,n,a){this.alt=n,this.src=t,this.classes=["mord"],this.style=a}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);return t}toMarkup(){let t=`<img src='${this.src}' alt='${this.alt}'`,n="";for(let a in this.style)Object.prototype.hasOwnProperty.call(this.style,a)&&(n+=`${d(a)}:${this.style[a]};`);return n&&(t+=` style="${f(n)}"`),t+=">",t}}function at(e){return new be(e)}class _{constructor(t,n,a,c){this.type=t,this.attributes={},this.children=n||[],this.classes=a||[],this.style=c||{},this.label=""}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}setLabel(t){this.label=t}toNode(){let t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=J(this.classes));for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="<"+this.type;for(let a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&(t+=" "+a+'="',t+=f(this.attributes[a]),t+='"');this.classes.length>0&&(t+=` class="${f(J(this.classes))}"`);let n="";for(let a in this.style)Object.prototype.hasOwnProperty.call(this.style,a)&&(n+=`${d(a)}:${this.style[a]};`);n&&(t+=` style="${n}"`),t+=">";for(let a=0;a<this.children.length;a++)t+=this.children[a].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}class qe{constructor(t){this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.toText())}toText(){return this.text}}let Je=e=>{let t;return e.length===1&&e[0].type==="mrow"?(t=e.pop(),t.type="mstyle"):t=new _("mstyle",e),t},je=e=>{let t=0;if(e.body&&Array.isArray(e.body))for(let n of e.body)t+=je(n);else if(e.body)t+=je(e.body);else if(e.type==="supsub")t+=je(e.base),e.sub&&(t+=.7*je(e.sub)),e.sup&&(t+=.7*je(e.sup));else if(e.type==="mathord"||e.type==="textord")for(let n of e.text.split("")){let a=n.codePointAt(0);t+=96<a&&a<123||944<a&&a<970?.56:47<a&&a<58?.5:.92}else t+=1;return t},O={widehat:"^",widecheck:"\u02C7",widetilde:"~",wideparen:"\u23DC",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overbracket:"\u23B4",underbracket:"\u23B5",overgroup:"\u23E0",overparen:"\u23DC",undergroup:"\u23E1",underparen:"\u23DD",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xrightleftarrows:"\u21C4",xtofrom:"\u21C4",xleftrightharpoons:"\u21CB",xrightleftharpoons:"\u21CC",yields:"\u2192",yieldsLeft:"\u2190",mesomerism:"\u2194",longrightharpoonup:"\u21C0",longleftharpoondown:"\u21BD",eqrightharpoonup:"\u21C0",eqleftharpoondown:"\u21BD","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"=",yieldsLeftRight:"\u21C4",chemequilibrium:"\u21CC"},D=function(e){let t=new qe(O[e.slice(1)]),n=new _("mo",[t]);return n.setAttribute("stretchy","true"),n},V=["\\widetilde","\\widehat","\\widecheck","\\utilde"],re=e=>{let t=D(e.label);if(V.includes(e.label)){let n=je(e.base);1<n&&n<1.6?t.classes.push("tml-crooked-2"):1.6<=n&&n<2.5?t.classes.push("tml-crooked-3"):2.5<=n&&t.classes.push("tml-crooked-4")}return t},Ae={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Ke={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ce={math:{},text:{}};function s(e,t,n,a,c){Ce[e][a]={group:t,replace:n},c&&n&&(Ce[e][n]=Ce[e][a])}let o="math",N="text",Fe="accent-token",B="bin",ot="close",mt="inner",K="mathord",_e="op-token",Y="open",Re="punct",y="rel",Be="spacing",w="textord";s(o,y,"\u2261","\\equiv",!0),s(o,y,"\u227A","\\prec",!0),s(o,y,"\u227B","\\succ",!0),s(o,y,"\u223C","\\sim",!0),s(o,y,"\u27C2","\\perp",!0),s(o,y,"\u2AAF","\\preceq",!0),s(o,y,"\u2AB0","\\succeq",!0),s(o,y,"\u2243","\\simeq",!0),s(o,y,"\u224C","\\backcong",!0),s(o,y,"|","\\mid",!0),s(o,y,"\u226A","\\ll",!0),s(o,y,"\u226B","\\gg",!0),s(o,y,"\u224D","\\asymp",!0),s(o,y,"\u2225","\\parallel"),s(o,y,"\u2323","\\smile",!0),s(o,y,"\u2291","\\sqsubseteq",!0),s(o,y,"\u2292","\\sqsupseteq",!0),s(o,y,"\u2250","\\doteq",!0),s(o,y,"\u2322","\\frown",!0),s(o,y,"\u220B","\\ni",!0),s(o,y,"\u220C","\\notni",!0),s(o,y,"\u221D","\\propto",!0),s(o,y,"\u22A2","\\vdash",!0),s(o,y,"\u22A3","\\dashv",!0),s(o,y,"\u220B","\\owns"),s(o,y,"\u2258","\\arceq",!0),s(o,y,"\u2259","\\wedgeq",!0),s(o,y,"\u225A","\\veeeq",!0),s(o,y,"\u225B","\\stareq",!0),s(o,y,"\u225D","\\eqdef",!0),s(o,y,"\u225E","\\measeq",!0),s(o,y,"\u225F","\\questeq",!0),s(o,y,"\u2260","\\ne",!0),s(o,y,"\u2260","\\neq"),s(o,y,"\u2A75","\\eqeq",!0),s(o,y,"\u2A76","\\eqeqeq",!0),s(o,y,"\u2237","\\dblcolon",!0),s(o,y,"\u2254","\\coloneqq",!0),s(o,y,"\u2255","\\eqqcolon",!0),s(o,y,"\u2239","\\eqcolon",!0),s(o,y,"\u2A74","\\Coloneqq",!0),s(o,Re,".","\\ldotp"),s(o,Re,"\xB7","\\cdotp"),s(o,w,"#","\\#"),s(N,w,"#","\\#"),s(o,w,"&","\\&"),s(N,w,"&","\\&"),s(o,w,"\u2135","\\aleph",!0),s(o,w,"\u2200","\\forall",!0),s(o,w,"\u210F","\\hbar",!0),s(o,w,"\u2203","\\exists",!0),s(o,Y,"\u2207","\\nabla",!0),s(o,w,"\u266D","\\flat",!0),s(o,w,"\u2113","\\ell",!0),s(o,w,"\u266E","\\natural",!0),s(o,w,"\u212B","\\Angstrom",!0),s(N,w,"\u212B","\\Angstrom",!0),s(o,w,"\u2663","\\clubsuit",!0),s(o,w,"\u2667","\\varclubsuit",!0),s(o,w,"\u2118","\\wp",!0),s(o,w,"\u266F","\\sharp",!0),s(o,w,"\u2662","\\diamondsuit",!0),s(o,w,"\u2666","\\vardiamondsuit",!0),s(o,w,"\u211C","\\Re",!0),s(o,w,"\u2661","\\heartsuit",!0),s(o,w,"\u2665","\\varheartsuit",!0),s(o,w,"\u2111","\\Im",!0),s(o,w,"\u2660","\\spadesuit",!0),s(o,w,"\u2664","\\varspadesuit",!0),s(o,w,"\u2640","\\female",!0),s(o,w,"\u2642","\\male",!0),s(o,w,"\xA7","\\S",!0),s(N,w,"\xA7","\\S"),s(o,w,"\xB6","\\P",!0),s(N,w,"\xB6","\\P"),s(N,w,"\u263A","\\smiley",!0),s(o,w,"\u263A","\\smiley",!0),s(o,w,"\u2020","\\dag"),s(N,w,"\u2020","\\dag"),s(N,w,"\u2020","\\textdagger"),s(o,w,"\u2021","\\ddag"),s(N,w,"\u2021","\\ddag"),s(N,w,"\u2021","\\textdaggerdbl"),s(o,ot,"\u23B1","\\rmoustache",!0),s(o,Y,"\u23B0","\\lmoustache",!0),s(o,ot,"\u27EF","\\rgroup",!0),s(o,Y,"\u27EE","\\lgroup",!0),s(o,B,"\u2213","\\mp",!0),s(o,B,"\u2296","\\ominus",!0),s(o,B,"\u228E","\\uplus",!0),s(o,B,"\u2293","\\sqcap",!0),s(o,B,"\u2217","\\ast"),s(o,B,"\u2294","\\sqcup",!0),s(o,B,"\u25EF","\\bigcirc",!0),s(o,B,"\u2219","\\bullet",!0),s(o,B,"\u2021","\\ddagger"),s(o,B,"\u2240","\\wr",!0),s(o,B,"\u2A3F","\\amalg"),s(o,B,"&","\\And"),s(o,B,"\u2AFD","\\sslash",!0),s(o,y,"\u27F5","\\longleftarrow",!0),s(o,y,"\u21D0","\\Leftarrow",!0),s(o,y,"\u27F8","\\Longleftarrow",!0),s(o,y,"\u27F6","\\longrightarrow",!0),s(o,y,"\u21D2","\\Rightarrow",!0),s(o,y,"\u27F9","\\Longrightarrow",!0),s(o,y,"\u2194","\\leftrightarrow",!0),s(o,y,"\u27F7","\\longleftrightarrow",!0),s(o,y,"\u21D4","\\Leftrightarrow",!0),s(o,y,"\u27FA","\\Longleftrightarrow",!0),s(o,y,"\u21A4","\\mapsfrom",!0),s(o,y,"\u21A6","\\mapsto",!0),s(o,y,"\u27FC","\\longmapsto",!0),s(o,y,"\u2197","\\nearrow",!0),s(o,y,"\u21A9","\\hookleftarrow",!0),s(o,y,"\u21AA","\\hookrightarrow",!0),s(o,y,"\u2198","\\searrow",!0),s(o,y,"\u21BC","\\leftharpoonup",!0),s(o,y,"\u21C0","\\rightharpoonup",!0),s(o,y,"\u2199","\\swarrow",!0),s(o,y,"\u21BD","\\leftharpoondown",!0),s(o,y,"\u21C1","\\rightharpoondown",!0),s(o,y,"\u2196","\\nwarrow",!0),s(o,y,"\u21CC","\\rightleftharpoons",!0),s(o,K,"\u21AF","\\lightning",!0),s(o,K,"\u220E","\\QED",!0),s(o,K,"\u2030","\\permil",!0),s(N,w,"\u2030","\\permil"),s(o,K,"\u2609","\\astrosun",!0),s(o,K,"\u263C","\\sun",!0),s(o,K,"\u263E","\\leftmoon",!0),s(o,K,"\u263D","\\rightmoon",!0),s(o,K,"\u2295","\\Earth"),s(o,y,"\u226E","\\nless",!0),s(o,y,"\u2A87","\\lneq",!0),s(o,y,"\u2268","\\lneqq",!0),s(o,y,"\u2268\uFE00","\\lvertneqq"),s(o,y,"\u22E6","\\lnsim",!0),s(o,y,"\u2A89","\\lnapprox",!0),s(o,y,"\u2280","\\nprec",!0),s(o,y,"\u22E0","\\npreceq",!0),s(o,y,"\u22E8","\\precnsim",!0),s(o,y,"\u2AB9","\\precnapprox",!0),s(o,y,"\u2241","\\nsim",!0),s(o,y,"\u2224","\\nmid",!0),s(o,y,"\u2224","\\nshortmid"),s(o,y,"\u22AC","\\nvdash",!0),s(o,y,"\u22AD","\\nvDash",!0),s(o,y,"\u22EA","\\ntriangleleft"),s(o,y,"\u22EC","\\ntrianglelefteq",!0),s(o,y,"\u2284","\\nsubset",!0),s(o,y,"\u2285","\\nsupset",!0),s(o,y,"\u228A","\\subsetneq",!0),s(o,y,"\u228A\uFE00","\\varsubsetneq"),s(o,y,"\u2ACB","\\subsetneqq",!0),s(o,y,"\u2ACB\uFE00","\\varsubsetneqq"),s(o,y,"\u226F","\\ngtr",!0),s(o,y,"\u2A88","\\gneq",!0),s(o,y,"\u2269","\\gneqq",!0),s(o,y,"\u2269\uFE00","\\gvertneqq"),s(o,y,"\u22E7","\\gnsim",!0),s(o,y,"\u2A8A","\\gnapprox",!0),s(o,y,"\u2281","\\nsucc",!0),s(o,y,"\u22E1","\\nsucceq",!0),s(o,y,"\u22E9","\\succnsim",!0),s(o,y,"\u2ABA","\\succnapprox",!0),s(o,y,"\u2246","\\ncong",!0),s(o,y,"\u2226","\\nparallel",!0),s(o,y,"\u2226","\\nshortparallel"),s(o,y,"\u22AF","\\nVDash",!0),s(o,y,"\u22EB","\\ntriangleright"),s(o,y,"\u22ED","\\ntrianglerighteq",!0),s(o,y,"\u228B","\\supsetneq",!0),s(o,y,"\u228B","\\varsupsetneq"),s(o,y,"\u2ACC","\\supsetneqq",!0),s(o,y,"\u2ACC\uFE00","\\varsupsetneqq"),s(o,y,"\u22AE","\\nVdash",!0),s(o,y,"\u2AB5","\\precneqq",!0),s(o,y,"\u2AB6","\\succneqq",!0),s(o,B,"\u22B4","\\unlhd"),s(o,B,"\u22B5","\\unrhd"),s(o,y,"\u219A","\\nleftarrow",!0),s(o,y,"\u219B","\\nrightarrow",!0),s(o,y,"\u21CD","\\nLeftarrow",!0),s(o,y,"\u21CF","\\nRightarrow",!0),s(o,y,"\u21AE","\\nleftrightarrow",!0),s(o,y,"\u21CE","\\nLeftrightarrow",!0),s(o,y,"\u25B3","\\vartriangle"),s(o,w,"\u210F","\\hslash"),s(o,w,"\u25BD","\\triangledown"),s(o,w,"\u25CA","\\lozenge"),s(o,w,"\u24C8","\\circledS"),s(o,w,"\xAE","\\circledR",!0),s(N,w,"\xAE","\\circledR"),s(N,w,"\xAE","\\textregistered"),s(o,w,"\u2221","\\measuredangle",!0),s(o,w,"\u2204","\\nexists"),s(o,w,"\u2127","\\mho"),s(o,w,"\u2132","\\Finv",!0),s(o,w,"\u2141","\\Game",!0),s(o,w,"\u2035","\\backprime"),s(o,w,"\u2036","\\backdprime"),s(o,w,"\u2037","\\backtrprime"),s(o,w,"\u25B2","\\blacktriangle"),s(o,w,"\u25BC","\\blacktriangledown"),s(o,w,"\u25A0","\\blacksquare"),s(o,w,"\u29EB","\\blacklozenge"),s(o,w,"\u2605","\\bigstar"),s(o,w,"\u2222","\\sphericalangle",!0),s(o,w,"\u2201","\\complement",!0),s(o,w,"\u2571","\\diagup"),s(o,w,"\u2572","\\diagdown"),s(o,w,"\u25A1","\\square"),s(o,w,"\u25A1","\\Box"),s(o,w,"\u25CA","\\Diamond"),s(o,w,"\xA5","\\yen",!0),s(N,w,"\xA5","\\yen",!0),s(o,w,"\u2713","\\checkmark",!0),s(N,w,"\u2713","\\checkmark"),s(o,w,"\u2717","\\ballotx",!0),s(N,w,"\u2717","\\ballotx"),s(N,w,"\u2022","\\textbullet"),s(o,w,"\u2136","\\beth",!0),s(o,w,"\u2138","\\daleth",!0),s(o,w,"\u2137","\\gimel",!0),s(o,w,"\u03DD","\\digamma",!0),s(o,w,"\u03F0","\\varkappa"),s(o,Y,"\u231C","\\ulcorner",!0),s(o,ot,"\u231D","\\urcorner",!0),s(o,Y,"\u231E","\\llcorner",!0),s(o,ot,"\u231F","\\lrcorner",!0),s(o,y,"\u2266","\\leqq",!0),s(o,y,"\u2A7D","\\leqslant",!0),s(o,y,"\u2A95","\\eqslantless",!0),s(o,y,"\u2272","\\lesssim",!0),s(o,y,"\u2A85","\\lessapprox",!0),s(o,y,"\u224A","\\approxeq",!0),s(o,B,"\u22D6","\\lessdot"),s(o,y,"\u22D8","\\lll",!0),s(o,y,"\u2276","\\lessgtr",!0),s(o,y,"\u22DA","\\lesseqgtr",!0),s(o,y,"\u2A8B","\\lesseqqgtr",!0),s(o,y,"\u2251","\\doteqdot"),s(o,y,"\u2253","\\risingdotseq",!0),s(o,y,"\u2252","\\fallingdotseq",!0),s(o,y,"\u223D","\\backsim",!0),s(o,y,"\u22CD","\\backsimeq",!0),s(o,y,"\u2AC5","\\subseteqq",!0),s(o,y,"\u22D0","\\Subset",!0),s(o,y,"\u228F","\\sqsubset",!0),s(o,y,"\u227C","\\preccurlyeq",!0),s(o,y,"\u22DE","\\curlyeqprec",!0),s(o,y,"\u227E","\\precsim",!0),s(o,y,"\u2AB7","\\precapprox",!0),s(o,y,"\u22B2","\\vartriangleleft"),s(o,y,"\u22B4","\\trianglelefteq"),s(o,y,"\u22A8","\\vDash",!0),s(o,y,"\u22AB","\\VDash",!0),s(o,y,"\u22AA","\\Vvdash",!0),s(o,y,"\u2323","\\smallsmile"),s(o,y,"\u2322","\\smallfrown"),s(o,y,"\u224F","\\bumpeq",!0),s(o,y,"\u224E","\\Bumpeq",!0),s(o,y,"\u2267","\\geqq",!0),s(o,y,"\u2A7E","\\geqslant",!0),s(o,y,"\u2A96","\\eqslantgtr",!0),s(o,y,"\u2273","\\gtrsim",!0),s(o,y,"\u2A86","\\gtrapprox",!0),s(o,B,"\u22D7","\\gtrdot"),s(o,y,"\u22D9","\\ggg",!0),s(o,y,"\u2277","\\gtrless",!0),s(o,y,"\u22DB","\\gtreqless",!0),s(o,y,"\u2A8C","\\gtreqqless",!0),s(o,y,"\u2256","\\eqcirc",!0),s(o,y,"\u2257","\\circeq",!0),s(o,y,"\u225C","\\triangleq",!0),s(o,y,"\u223C","\\thicksim"),s(o,y,"\u2248","\\thickapprox"),s(o,y,"\u2AC6","\\supseteqq",!0),s(o,y,"\u22D1","\\Supset",!0),s(o,y,"\u2290","\\sqsupset",!0),s(o,y,"\u227D","\\succcurlyeq",!0),s(o,y,"\u22DF","\\curlyeqsucc",!0),s(o,y,"\u227F","\\succsim",!0),s(o,y,"\u2AB8","\\succapprox",!0),s(o,y,"\u22B3","\\vartriangleright"),s(o,y,"\u22B5","\\trianglerighteq"),s(o,y,"\u22A9","\\Vdash",!0),s(o,y,"\u2223","\\shortmid"),s(o,y,"\u2225","\\shortparallel"),s(o,y,"\u226C","\\between",!0),s(o,y,"\u22D4","\\pitchfork",!0),s(o,y,"\u221D","\\varpropto"),s(o,y,"\u25C0","\\blacktriangleleft"),s(o,y,"\u2234","\\therefore",!0),s(o,y,"\u220D","\\backepsilon"),s(o,y,"\u25B6","\\blacktriangleright"),s(o,y,"\u2235","\\because",!0),s(o,y,"\u22D8","\\llless"),s(o,y,"\u22D9","\\gggtr"),s(o,B,"\u22B2","\\lhd"),s(o,B,"\u22B3","\\rhd"),s(o,y,"\u2242","\\eqsim",!0),s(o,y,"\u2251","\\Doteq",!0),s(o,y,"\u297D","\\strictif",!0),s(o,y,"\u297C","\\strictfi",!0),s(o,B,"\u2214","\\dotplus",!0),s(o,B,"\u2216","\\smallsetminus"),s(o,B,"\u22D2","\\Cap",!0),s(o,B,"\u22D3","\\Cup",!0),s(o,B,"\u2A5E","\\doublebarwedge",!0),s(o,B,"\u229F","\\boxminus",!0),s(o,B,"\u229E","\\boxplus",!0),s(o,B,"\u29C4","\\boxslash",!0),s(o,B,"\u22C7","\\divideontimes",!0),s(o,B,"\u22C9","\\ltimes",!0),s(o,B,"\u22CA","\\rtimes",!0),s(o,B,"\u22CB","\\leftthreetimes",!0),s(o,B,"\u22CC","\\rightthreetimes",!0),s(o,B,"\u22CF","\\curlywedge",!0),s(o,B,"\u22CE","\\curlyvee",!0),s(o,B,"\u229D","\\circleddash",!0),s(o,B,"\u229B","\\circledast",!0),s(o,B,"\u22BA","\\intercal",!0),s(o,B,"\u22D2","\\doublecap"),s(o,B,"\u22D3","\\doublecup"),s(o,B,"\u22A0","\\boxtimes",!0),s(o,B,"\u22C8","\\bowtie",!0),s(o,B,"\u22C8","\\Join"),s(o,B,"\u27D5","\\leftouterjoin",!0),s(o,B,"\u27D6","\\rightouterjoin",!0),s(o,B,"\u27D7","\\fullouterjoin",!0),s(o,B,"\u2238","\\dotminus",!0),s(o,B,"\u27D1","\\wedgedot",!0),s(o,B,"\u27C7","\\veedot",!0),s(o,B,"\u2A62","\\doublebarvee",!0),s(o,B,"\u2A63","\\veedoublebar",!0),s(o,B,"\u2A5F","\\wedgebar",!0),s(o,B,"\u2A60","\\wedgedoublebar",!0),s(o,B,"\u2A54","\\Vee",!0),s(o,B,"\u2A53","\\Wedge",!0),s(o,B,"\u2A43","\\barcap",!0),s(o,B,"\u2A42","\\barcup",!0),s(o,B,"\u2A48","\\capbarcup",!0),s(o,B,"\u2A40","\\capdot",!0),s(o,B,"\u2A47","\\capovercup",!0),s(o,B,"\u2A46","\\cupovercap",!0),s(o,B,"\u2A4D","\\closedvarcap",!0),s(o,B,"\u2A4C","\\closedvarcup",!0),s(o,B,"\u2A2A","\\minusdot",!0),s(o,B,"\u2A2B","\\minusfdots",!0),s(o,B,"\u2A2C","\\minusrdots",!0),s(o,B,"\u22BB","\\Xor",!0),s(o,B,"\u22BC","\\Nand",!0),s(o,B,"\u22BD","\\Nor",!0),s(o,B,"\u22BD","\\barvee"),s(o,B,"\u2AF4","\\interleave",!0),s(o,B,"\u29E2","\\shuffle",!0),s(o,B,"\u2AF6","\\threedotcolon",!0),s(o,B,"\u2982","\\typecolon",!0),s(o,B,"\u223E","\\invlazys",!0),s(o,B,"\u2A4B","\\twocaps",!0),s(o,B,"\u2A4A","\\twocups",!0),s(o,B,"\u2A4E","\\Sqcap",!0),s(o,B,"\u2A4F","\\Sqcup",!0),s(o,B,"\u2A56","\\veeonvee",!0),s(o,B,"\u2A55","\\wedgeonwedge",!0),s(o,B,"\u29D7","\\blackhourglass",!0),s(o,B,"\u29C6","\\boxast",!0),s(o,B,"\u29C8","\\boxbox",!0),s(o,B,"\u29C7","\\boxcircle",!0),s(o,B,"\u229C","\\circledequal",!0),s(o,B,"\u29B7","\\circledparallel",!0),s(o,B,"\u29B6","\\circledvert",!0),s(o,B,"\u29B5","\\circlehbar",!0),s(o,B,"\u27E1","\\concavediamond",!0),s(o,B,"\u27E2","\\concavediamondtickleft",!0),s(o,B,"\u27E3","\\concavediamondtickright",!0),s(o,B,"\u22C4","\\diamond",!0),s(o,B,"\u29D6","\\hourglass",!0),s(o,B,"\u27E0","\\lozengeminus",!0),s(o,B,"\u233D","\\obar",!0),s(o,B,"\u29B8","\\obslash",!0),s(o,B,"\u2A38","\\odiv",!0),s(o,B,"\u29C1","\\ogreaterthan",!0),s(o,B,"\u29C0","\\olessthan",!0),s(o,B,"\u29B9","\\operp",!0),s(o,B,"\u2A37","\\Otimes",!0),s(o,B,"\u2A36","\\otimeshat",!0),s(o,B,"\u22C6","\\star",!0),s(o,B,"\u25B3","\\triangle",!0),s(o,B,"\u2A3A","\\triangleminus",!0),s(o,B,"\u2A39","\\triangleplus",!0),s(o,B,"\u2A3B","\\triangletimes",!0),s(o,B,"\u27E4","\\whitesquaretickleft",!0),s(o,B,"\u27E5","\\whitesquaretickright",!0),s(o,B,"\u2A33","\\smashtimes",!0),s(o,y,"\u21E2","\\dashrightarrow",!0),s(o,y,"\u21E0","\\dashleftarrow",!0),s(o,y,"\u21C7","\\leftleftarrows",!0),s(o,y,"\u21C6","\\leftrightarrows",!0),s(o,y,"\u21DA","\\Lleftarrow",!0),s(o,y,"\u219E","\\twoheadleftarrow",!0),s(o,y,"\u21A2","\\leftarrowtail",!0),s(o,y,"\u21AB","\\looparrowleft",!0),s(o,y,"\u21CB","\\leftrightharpoons",!0),s(o,y,"\u21B6","\\curvearrowleft",!0),s(o,y,"\u21BA","\\circlearrowleft",!0),s(o,y,"\u21B0","\\Lsh",!0),s(o,y,"\u21C8","\\upuparrows",!0),s(o,y,"\u21BF","\\upharpoonleft",!0),s(o,y,"\u21C3","\\downharpoonleft",!0),s(o,y,"\u22B6","\\origof",!0),s(o,y,"\u22B7","\\imageof",!0),s(o,y,"\u22B8","\\multimap",!0),s(o,y,"\u21AD","\\leftrightsquigarrow",!0),s(o,y,"\u21C9","\\rightrightarrows",!0),s(o,y,"\u21C4","\\rightleftarrows",!0),s(o,y,"\u21A0","\\twoheadrightarrow",!0),s(o,y,"\u21A3","\\rightarrowtail",!0),s(o,y,"\u21AC","\\looparrowright",!0),s(o,y,"\u21B7","\\curvearrowright",!0),s(o,y,"\u21BB","\\circlearrowright",!0),s(o,y,"\u21B1","\\Rsh",!0),s(o,y,"\u21CA","\\downdownarrows",!0),s(o,y,"\u21BE","\\upharpoonright",!0),s(o,y,"\u21C2","\\downharpoonright",!0),s(o,y,"\u21DD","\\rightsquigarrow",!0),s(o,y,"\u21DD","\\leadsto"),s(o,y,"\u21DB","\\Rrightarrow",!0),s(o,y,"\u21BE","\\restriction"),s(o,w,"\u2018","`"),s(o,w,"$","\\$"),s(N,w,"$","\\$"),s(N,w,"$","\\textdollar"),s(o,w,"\xA2","\\cent"),s(N,w,"\xA2","\\cent"),s(o,w,"%","\\%"),s(N,w,"%","\\%"),s(o,w,"_","\\_"),s(N,w,"_","\\_"),s(N,w,"_","\\textunderscore"),s(N,w,"\u2423","\\textvisiblespace",!0),s(o,w,"\u2220","\\angle",!0),s(o,w,"\u221E","\\infty",!0),s(o,w,"\u2032","\\prime"),s(o,w,"\u2033","\\dprime"),s(o,w,"\u2034","\\trprime"),s(o,w,"\u2057","\\qprime"),s(o,w,"\u25B3","\\triangle"),s(N,w,"\u0391","\\Alpha",!0),s(N,w,"\u0392","\\Beta",!0),s(N,w,"\u0393","\\Gamma",!0),s(N,w,"\u0394","\\Delta",!0),s(N,w,"\u0395","\\Epsilon",!0),s(N,w,"\u0396","\\Zeta",!0),s(N,w,"\u0397","\\Eta",!0),s(N,w,"\u0398","\\Theta",!0),s(N,w,"\u0399","\\Iota",!0),s(N,w,"\u039A","\\Kappa",!0),s(N,w,"\u039B","\\Lambda",!0),s(N,w,"\u039C","\\Mu",!0),s(N,w,"\u039D","\\Nu",!0),s(N,w,"\u039E","\\Xi",!0),s(N,w,"\u039F","\\Omicron",!0),s(N,w,"\u03A0","\\Pi",!0),s(N,w,"\u03A1","\\Rho",!0),s(N,w,"\u03A3","\\Sigma",!0),s(N,w,"\u03A4","\\Tau",!0),s(N,w,"\u03A5","\\Upsilon",!0),s(N,w,"\u03A6","\\Phi",!0),s(N,w,"\u03A7","\\Chi",!0),s(N,w,"\u03A8","\\Psi",!0),s(N,w,"\u03A9","\\Omega",!0),s(o,K,"\u0391","\\Alpha",!0),s(o,K,"\u0392","\\Beta",!0),s(o,K,"\u0393","\\Gamma",!0),s(o,K,"\u0394","\\Delta",!0),s(o,K,"\u0395","\\Epsilon",!0),s(o,K,"\u0396","\\Zeta",!0),s(o,K,"\u0397","\\Eta",!0),s(o,K,"\u0398","\\Theta",!0),s(o,K,"\u0399","\\Iota",!0),s(o,K,"\u039A","\\Kappa",!0),s(o,K,"\u039B","\\Lambda",!0),s(o,K,"\u039C","\\Mu",!0),s(o,K,"\u039D","\\Nu",!0),s(o,K,"\u039E","\\Xi",!0),s(o,K,"\u039F","\\Omicron",!0),s(o,K,"\u03A0","\\Pi",!0),s(o,K,"\u03A1","\\Rho",!0),s(o,K,"\u03A3","\\Sigma",!0),s(o,K,"\u03A4","\\Tau",!0),s(o,K,"\u03A5","\\Upsilon",!0),s(o,K,"\u03A6","\\Phi",!0),s(o,K,"\u03A7","\\Chi",!0),s(o,K,"\u03A8","\\Psi",!0),s(o,K,"\u03A9","\\Omega",!0),s(o,Y,"\xAC","\\neg",!0),s(o,Y,"\xAC","\\lnot"),s(o,w,"\u22A4","\\top"),s(o,w,"\u22A5","\\bot"),s(o,w,"\u2205","\\emptyset"),s(o,w,"\u2300","\\varnothing"),s(o,K,"\u03B1","\\alpha",!0),s(o,K,"\u03B2","\\beta",!0),s(o,K,"\u03B3","\\gamma",!0),s(o,K,"\u03B4","\\delta",!0),s(o,K,"\u03F5","\\epsilon",!0),s(o,K,"\u03B6","\\zeta",!0),s(o,K,"\u03B7","\\eta",!0),s(o,K,"\u03B8","\\theta",!0),s(o,K,"\u03B9","\\iota",!0),s(o,K,"\u03BA","\\kappa",!0),s(o,K,"\u03BB","\\lambda",!0),s(o,K,"\u03BC","\\mu",!0),s(o,K,"\u03BD","\\nu",!0),s(o,K,"\u03BE","\\xi",!0),s(o,K,"\u03BF","\\omicron",!0),s(o,K,"\u03C0","\\pi",!0),s(o,K,"\u03C1","\\rho",!0),s(o,K,"\u03C3","\\sigma",!0),s(o,K,"\u03C4","\\tau",!0),s(o,K,"\u03C5","\\upsilon",!0),s(o,K,"\u03D5","\\phi",!0),s(o,K,"\u03C7","\\chi",!0),s(o,K,"\u03C8","\\psi",!0),s(o,K,"\u03C9","\\omega",!0),s(o,K,"\u03B5","\\varepsilon",!0),s(o,K,"\u03D1","\\vartheta",!0),s(o,K,"\u03D6","\\varpi",!0),s(o,K,"\u03F1","\\varrho",!0),s(o,K,"\u03C2","\\varsigma",!0),s(o,K,"\u03C6","\\varphi",!0),s(o,K,"\u03D8","\\Coppa",!0),s(o,K,"\u03D9","\\coppa",!0),s(o,K,"\u03D9","\\varcoppa",!0),s(o,K,"\u03DE","\\Koppa",!0),s(o,K,"\u03DF","\\koppa",!0),s(o,K,"\u03E0","\\Sampi",!0),s(o,K,"\u03E1","\\sampi",!0),s(o,K,"\u03DA","\\Stigma",!0),s(o,K,"\u03DB","\\stigma",!0),s(o,K,"\u2AEB","\\Bot"),s(o,w,"\xF0","\\eth",!0),s(N,w,"\xF0","\xF0"),s(o,w,"\xC5","\\AA"),s(N,w,"\xC5","\\AA",!0),s(o,w,"\xC6","\\AE",!0),s(N,w,"\xC6","\\AE",!0),s(o,w,"\xD0","\\DH",!0),s(N,w,"\xD0","\\DH",!0),s(o,w,"\xDE","\\TH",!0),s(N,w,"\xDE","\\TH",!0),s(o,w,"\xDF","\\ss",!0),s(N,w,"\xDF","\\ss",!0),s(o,w,"\xE5","\\aa"),s(N,w,"\xE5","\\aa",!0),s(o,w,"\xE6","\\ae",!0),s(N,w,"\xE6","\\ae",!0),s(o,w,"\xF0","\\dh"),s(N,w,"\xF0","\\dh",!0),s(o,w,"\xFE","\\th",!0),s(N,w,"\xFE","\\th",!0),s(o,w,"\u0110","\\DJ",!0),s(N,w,"\u0110","\\DJ",!0),s(o,w,"\u0111","\\dj",!0),s(N,w,"\u0111","\\dj",!0),s(o,w,"\u0141","\\L",!0),s(N,w,"\u0141","\\L",!0),s(o,w,"\u0141","\\l",!0),s(N,w,"\u0141","\\l",!0),s(o,w,"\u014A","\\NG",!0),s(N,w,"\u014A","\\NG",!0),s(o,w,"\u014B","\\ng",!0),s(N,w,"\u014B","\\ng",!0),s(o,w,"\u0152","\\OE",!0),s(N,w,"\u0152","\\OE",!0),s(o,w,"\u0153","\\oe",!0),s(N,w,"\u0153","\\oe",!0),s(o,B,"\u2217","\u2217",!0),s(o,B,"+","+"),s(o,B,"\u2217","*"),s(o,B,"\u2044","/",!0),s(o,B,"\u2044","\u2044"),s(o,B,"\u2212","-",!0),s(o,B,"\u22C5","\\cdot",!0),s(o,B,"\u2218","\\circ",!0),s(o,B,"\xF7","\\div",!0),s(o,B,"\xB1","\\pm",!0),s(o,B,"\xD7","\\times",!0),s(o,B,"\u2229","\\cap",!0),s(o,B,"\u222A","\\cup",!0),s(o,B,"\u2216","\\setminus",!0),s(o,B,"\u2227","\\land"),s(o,B,"\u2228","\\lor"),s(o,B,"\u2227","\\wedge",!0),s(o,B,"\u2228","\\vee",!0),s(o,Y,"\u27E6","\\llbracket",!0),s(o,ot,"\u27E7","\\rrbracket",!0),s(o,Y,"\u27E8","\\langle",!0),s(o,Y,"\u27EA","\\lAngle",!0),s(o,Y,"\u2989","\\llangle",!0),s(o,Y,"|","\\lvert"),s(o,Y,"\u2016","\\lVert",!0),s(o,w,"!","\\oc"),s(o,w,"?","\\wn"),s(o,w,"\u2193","\\shpos"),s(o,w,"\u2195","\\shift"),s(o,w,"\u2191","\\shneg"),s(o,ot,"?","?"),s(o,ot,"!","!"),s(o,ot,"\u203C","\u203C"),s(o,ot,"\u27E9","\\rangle",!0),s(o,ot,"\u27EB","\\rAngle",!0),s(o,ot,"\u298A","\\rrangle",!0),s(o,ot,"|","\\rvert"),s(o,ot,"\u2016","\\rVert"),s(o,Y,"\u2983","\\lBrace",!0),s(o,ot,"\u2984","\\rBrace",!0),s(o,y,"=","\\equal",!0),s(o,y,":",":"),s(o,y,"\u2248","\\approx",!0),s(o,y,"\u2245","\\cong",!0),s(o,y,"\u2265","\\ge"),s(o,y,"\u2265","\\geq",!0),s(o,y,"\u2190","\\gets"),s(o,y,">","\\gt",!0),s(o,y,"\u2208","\\in",!0),s(o,y,"\u2209","\\notin",!0),s(o,y,"\uE020","\\@not"),s(o,y,"\u2282","\\subset",!0),s(o,y,"\u2283","\\supset",!0),s(o,y,"\u2286","\\subseteq",!0),s(o,y,"\u2287","\\supseteq",!0),s(o,y,"\u2288","\\nsubseteq",!0),s(o,y,"\u2288","\\nsubseteqq"),s(o,y,"\u2289","\\nsupseteq",!0),s(o,y,"\u2289","\\nsupseteqq"),s(o,y,"\u22A8","\\models"),s(o,y,"\u2190","\\leftarrow",!0),s(o,y,"\u2264","\\le"),s(o,y,"\u2264","\\leq",!0),s(o,y,"<","\\lt",!0),s(o,y,"\u2192","\\rightarrow",!0),s(o,y,"\u2192","\\to"),s(o,y,"\u2271","\\ngeq",!0),s(o,y,"\u2271","\\ngeqq"),s(o,y,"\u2271","\\ngeqslant"),s(o,y,"\u2270","\\nleq",!0),s(o,y,"\u2270","\\nleqq"),s(o,y,"\u2270","\\nleqslant"),s(o,y,"\u2AEB","\\Perp",!0),s(o,Be,"\xA0","\\ "),s(o,Be,"\xA0","\\space"),s(o,Be,"\xA0","\\nobreakspace"),s(N,Be,"\xA0","\\ "),s(N,Be,"\xA0"," "),s(N,Be,"\xA0","\\space"),s(N,Be,"\xA0","\\nobreakspace"),s(o,Be,null,"\\nobreak"),s(o,Be,null,"\\allowbreak"),s(o,Re,",",","),s(N,Re,":",":"),s(o,Re,";",";"),s(o,B,"\u22BC","\\barwedge"),s(o,B,"\u22BB","\\veebar"),s(o,B,"\u2299","\\odot",!0),s(o,B,"\u2295\uFE0E","\\oplus"),s(o,B,"\u2297","\\otimes",!0),s(o,w,"\u2202","\\partial",!0),s(o,B,"\u2298","\\oslash",!0),s(o,B,"\u229A","\\circledcirc",!0),s(o,B,"\u22A1","\\boxdot",!0),s(o,B,"\u25B3","\\bigtriangleup"),s(o,B,"\u25BD","\\bigtriangledown"),s(o,B,"\u2020","\\dagger"),s(o,B,"\u22C4","\\diamond"),s(o,B,"\u25C3","\\triangleleft"),s(o,B,"\u25B9","\\triangleright"),s(o,Y,"{","\\{"),s(N,w,"{","\\{"),s(N,w,"{","\\textbraceleft"),s(o,ot,"}","\\}"),s(N,w,"}","\\}"),s(N,w,"}","\\textbraceright"),s(o,Y,"{","\\lbrace"),s(o,ot,"}","\\rbrace"),s(o,Y,"[","\\lbrack",!0),s(N,w,"[","\\lbrack",!0),s(o,ot,"]","\\rbrack",!0),s(N,w,"]","\\rbrack",!0),s(o,Y,"(","\\lparen",!0),s(o,ot,")","\\rparen",!0),s(o,Y,"\u2987","\\llparenthesis",!0),s(o,ot,"\u2988","\\rrparenthesis",!0),s(N,w,"<","\\textless",!0),s(N,w,">","\\textgreater",!0),s(o,Y,"\u230A","\\lfloor",!0),s(o,ot,"\u230B","\\rfloor",!0),s(o,Y,"\u2308","\\lceil",!0),s(o,ot,"\u2309","\\rceil",!0),s(o,w,"\\","\\backslash"),s(o,w,"|","|"),s(o,w,"|","\\vert"),s(N,w,"|","\\textbar",!0),s(o,w,"\u2016","\\|"),s(o,w,"\u2016","\\Vert"),s(N,w,"\u2016","\\textbardbl"),s(N,w,"~","\\textasciitilde"),s(N,w,"\\","\\textbackslash"),s(N,w,"^","\\textasciicircum"),s(o,y,"\u2191","\\uparrow",!0),s(o,y,"\u21D1","\\Uparrow",!0),s(o,y,"\u2193","\\downarrow",!0),s(o,y,"\u21D3","\\Downarrow",!0),s(o,y,"\u2195","\\updownarrow",!0),s(o,y,"\u21D5","\\Updownarrow",!0),s(o,_e,"\u2210","\\coprod"),s(o,_e,"\u22C1","\\bigvee"),s(o,_e,"\u22C0","\\bigwedge"),s(o,_e,"\u2A04","\\biguplus"),s(o,_e,"\u2A04","\\bigcupplus"),s(o,_e,"\u2A03","\\bigcupdot"),s(o,_e,"\u2A07","\\bigdoublevee"),s(o,_e,"\u2A08","\\bigdoublewedge"),s(o,_e,"\u22C2","\\bigcap"),s(o,_e,"\u22C3","\\bigcup"),s(o,_e,"\u222B","\\int"),s(o,_e,"\u222B","\\intop"),s(o,_e,"\u222C","\\iint"),s(o,_e,"\u222D","\\iiint"),s(o,_e,"\u220F","\\prod"),s(o,_e,"\u2211","\\sum"),s(o,_e,"\u2A02","\\bigotimes"),s(o,_e,"\u2A01","\\bigoplus"),s(o,_e,"\u2A00","\\bigodot"),s(o,_e,"\u2A09","\\bigtimes"),s(o,_e,"\u222E","\\oint"),s(o,_e,"\u222F","\\oiint"),s(o,_e,"\u2230","\\oiiint"),s(o,_e,"\u2231","\\intclockwise"),s(o,_e,"\u2232","\\varointclockwise"),s(o,_e,"\u2A0C","\\iiiint"),s(o,_e,"\u2A0D","\\intbar"),s(o,_e,"\u2A0E","\\intBar"),s(o,_e,"\u2A0F","\\fint"),s(o,_e,"\u2A12","\\rppolint"),s(o,_e,"\u2A13","\\scpolint"),s(o,_e,"\u2A15","\\pointint"),s(o,_e,"\u2A16","\\sqint"),s(o,_e,"\u2A17","\\intlarhk"),s(o,_e,"\u2A18","\\intx"),s(o,_e,"\u2A19","\\intcap"),s(o,_e,"\u2A1A","\\intcup"),s(o,_e,"\u2A05","\\bigsqcap"),s(o,_e,"\u2A06","\\bigsqcup"),s(o,_e,"\u222B","\\smallint"),s(N,mt,"\u2026","\\textellipsis"),s(o,mt,"\u2026","\\mathellipsis"),s(N,mt,"\u2026","\\ldots",!0),s(o,mt,"\u2026","\\ldots",!0),s(o,mt,"\u22F0","\\iddots",!0),s(o,mt,"\u22EF","\\@cdots",!0),s(o,mt,"\u22F1","\\ddots",!0),s(o,w,"\u22EE","\\varvdots"),s(N,w,"\u22EE","\\varvdots"),s(o,Fe,"\xB4","\\acute"),s(o,Fe,"`","\\grave"),s(o,Fe,"\xA8","\\ddot"),s(o,Fe,"\u2026","\\dddot"),s(o,Fe,"\u2026.","\\ddddot"),s(o,Fe,"~","\\tilde"),s(o,Fe,"\u203E","\\bar"),s(o,Fe,"\u02D8","\\breve"),s(o,Fe,"\u02C7","\\check"),s(o,Fe,"^","\\hat"),s(o,Fe,"\u2192","\\vec"),s(o,Fe,"\u02D9","\\dot"),s(o,Fe,"\u02DA","\\mathring"),s(o,K,"\u0131","\\imath",!0),s(o,K,"\u0237","\\jmath",!0),s(o,w,"\u0131","\u0131"),s(o,w,"\u0237","\u0237"),s(N,w,"\u0131","\\i",!0),s(N,w,"\u0237","\\j",!0),s(N,w,"\xF8","\\o",!0),s(o,K,"\xF8","\\o",!0),s(N,w,"\xD8","\\O",!0),s(o,K,"\xD8","\\O",!0),s(N,Fe,"\u02CA","\\'"),s(N,Fe,"\u02CB","\\`"),s(N,Fe,"\u02C6","\\^"),s(N,Fe,"~","\\~"),s(N,Fe,"\u02C9","\\="),s(N,Fe,"\u02D8","\\u"),s(N,Fe,"\u02D9","\\."),s(N,Fe,"\xB8","\\c"),s(N,Fe,"\u02DA","\\r"),s(N,Fe,"\u02C7","\\v"),s(N,Fe,"\xA8",'\\"'),s(N,Fe,"\u02DD","\\H"),s(o,Fe,"\u02CA","\\'"),s(o,Fe,"\u02CB","\\`"),s(o,Fe,"\u02C6","\\^"),s(o,Fe,"~","\\~"),s(o,Fe,"\u02C9","\\="),s(o,Fe,"\u02D8","\\u"),s(o,Fe,"\u02D9","\\."),s(o,Fe,"\xB8","\\c"),s(o,Fe,"\u02DA","\\r"),s(o,Fe,"\u02C7","\\v"),s(o,Fe,"\xA8",'\\"'),s(o,Fe,"\u02DD","\\H");let pe={"--":!0,"---":!0,"``":!0,"''":!0};s(N,w,"\u2013","--",!0),s(N,w,"\u2013","\\textendash"),s(N,w,"\u2014","---",!0),s(N,w,"\u2014","\\textemdash"),s(N,w,"\u2018","`",!0),s(N,w,"\u2018","\\textquoteleft"),s(N,w,"\u2019","'",!0),s(N,w,"\u2019","\\textquoteright"),s(N,w,"\u201C","``",!0),s(N,w,"\u201C","\\textquotedblleft"),s(N,w,"\u201D","''",!0),s(N,w,"\u201D","\\textquotedblright"),s(o,w,"\xB0","\\degree",!0),s(N,w,"\xB0","\\degree"),s(N,w,"\xB0","\\textdegree",!0),s(o,w,"\xA3","\\pounds"),s(o,w,"\xA3","\\mathsterling",!0),s(N,w,"\xA3","\\pounds"),s(N,w,"\xA3","\\textsterling",!0),s(o,w,"\u2720","\\maltese"),s(N,w,"\u2720","\\maltese"),s(o,w,"\u20AC","\\euro",!0),s(N,w,"\u20AC","\\euro",!0),s(N,w,"\u20AC","\\texteuro"),s(o,w,"\xA9","\\copyright",!0),s(N,w,"\xA9","\\textcopyright"),s(o,w,"\u2300","\\diameter",!0),s(N,w,"\u2300","\\diameter"),s(o,w,"\u{1D6E4}","\\varGamma"),s(o,w,"\u{1D6E5}","\\varDelta"),s(o,w,"\u{1D6E9}","\\varTheta"),s(o,w,"\u{1D6EC}","\\varLambda"),s(o,w,"\u{1D6EF}","\\varXi"),s(o,w,"\u{1D6F1}","\\varPi"),s(o,w,"\u{1D6F4}","\\varSigma"),s(o,w,"\u{1D6F6}","\\varUpsilon"),s(o,w,"\u{1D6F7}","\\varPhi"),s(o,w,"\u{1D6F9}","\\varPsi"),s(o,w,"\u{1D6FA}","\\varOmega"),s(N,w,"\u{1D6E4}","\\varGamma"),s(N,w,"\u{1D6E5}","\\varDelta"),s(N,w,"\u{1D6E9}","\\varTheta"),s(N,w,"\u{1D6EC}","\\varLambda"),s(N,w,"\u{1D6EF}","\\varXi"),s(N,w,"\u{1D6F1}","\\varPi"),s(N,w,"\u{1D6F4}","\\varSigma"),s(N,w,"\u{1D6F6}","\\varUpsilon"),s(N,w,"\u{1D6F7}","\\varPhi"),s(N,w,"\u{1D6F9}","\\varPsi"),s(N,w,"\u{1D6FA}","\\varOmega");let Se='0123456789/@."';for(let e=0;e<14;e++){let t=Se.charAt(e);s(o,w,t,t)}let it='0123456789!@*()-=+";:?/.,';for(let e=0;e<25;e++){let t=it.charAt(e);s(N,w,t,t)}let Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<52;e++){let t=Ee.charAt(e);s(o,K,t,t),s(N,w,t,t)}let ze="\xC7\xD0\xDE\xE7\xFE\u2102\u210D\u2115\u2119\u211A\u211D\u2124\u210E\u210F\u210A\u210B\u210C\u2110\u2111\u2112\u2113\u2118\u211B\u211C\u212C\u2130\u2131\u2133\u212D\u2128";for(let e=0;e<30;e++){let t=ze.charAt(e);s(o,K,t,t),s(N,w,t,t)}let oe="";for(let e=0;e<52;e++){oe=String.fromCharCode(55349,56320+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56372+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56424+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56580+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56736+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56788+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56840+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56944+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,56632+e),s(o,K,oe,oe),s(N,w,oe,oe);let t=Ee.charAt(e);oe=String.fromCharCode(55349,56476+e),s(o,K,t,oe),s(N,w,t,oe)}for(let e=0;e<10;e++)oe=String.fromCharCode(55349,57294+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,57314+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,57324+e),s(o,K,oe,oe),s(N,w,oe,oe),oe=String.fromCharCode(55349,57334+e),s(o,K,oe,oe),s(N,w,oe,oe);let Xe=function(e,t,n){return!Ce[t][e]||!Ce[t][e].replace||e.charCodeAt(0)===55349||Object.prototype.hasOwnProperty.call(pe,e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt")||(e=Ce[t][e].replace),new qe(e)},gt=(e,t)=>{if(e.children.length===0||e.children[e.children.length-1].type!=="mtext"){let n=new _("mtext",[new qe(t.children[0].text)]);e.children.push(n)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},Et=e=>{if(e.type!=="mrow"&&e.type!=="mstyle"||e.children.length===0)return e;let t=new _("mrow");for(let n=0;n<e.children.length;n++){let a=e.children[n];if(a.type==="mtext"&&Object.keys(a.attributes).length===0)gt(t,a);else if(a.type==="mrow"){let c=!0;for(let p=0;p<a.children.length;p++)if(a.children[p].type!=="mtext"||Object.keys(a.attributes).length!==0){c=!1;break}if(c)for(let p=0;p<a.children.length;p++){let g=a.children[p];gt(t,g)}else t.children.push(a)}else t.children.push(a)}for(let n=0;n<t.children.length;n++)if(t.children[n].type==="mtext"){let a=t.children[n];a.children[0].text.charAt(0)===" "&&(a.children[0].text="\xA0"+a.children[0].text.slice(1));let c=a.children[0].text.length;c>0&&a.children[0].text.charAt(c-1)===" "&&(a.children[0].text=a.children[0].text.slice(0,-1)+"\xA0");for(let[p,g]of Object.entries(e.attributes))a.attributes[p]=g}return t.children.length===1&&t.children[0].type==="mtext"?t.children[0]:t},me=function(e,t=!1){if(!(e.length!==1||e[0]instanceof be))return e[0];if(!t){e[0]instanceof _&&e[0].type==="mo"&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");let n=e.length-1;e[n]instanceof _&&e[n].type==="mo"&&!e[n].attributes.fence&&(e[n].attributes.lspace="0em",e[n].attributes.rspace="0em")}return new _("mrow",e)};function Ne(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){let t=e.children[0];return t instanceof qe&&t.text==="."}if(e.type==="mtext"&&e.children.length===1){let t=e.children[0];return t instanceof qe&&t.text==="\u2008"}if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){let t=e.children[0];return t instanceof qe&&t.text===","}return!1}let Ie=(e,t)=>{let n=e[t],a=e[t+1];return n.type==="atom"&&n.text===","&&n.loc&&a.loc&&n.loc.end===a.loc.start},et=e=>e.type==="atom"&&e.family==="rel"||e.type==="mclass"&&e.mclass==="mrel",tt=function(e,t,n=!1){if(!n&&e.length===1){let g=He(e[0],t);return g instanceof _&&g.type==="mo"&&(g.setAttribute("lspace","0em"),g.setAttribute("rspace","0em")),[g]}let a=[],c=[],p;for(let g=0;g<e.length;g++)c.push(He(e[g],t));for(let g=0;g<c.length;g++){let x=c[g];if(g<e.length-1&&et(e[g])&&et(e[g+1])&&x.setAttribute("rspace","0em"),g>0&&et(e[g])&&et(e[g-1])&&x.setAttribute("lspace","0em"),x.type==="mn"&&p&&p.type==="mn")p.children.push(...x.children);else if(Ne(x)&&p&&p.type==="mn")p.children.push(...x.children);else if(p&&p.type==="mn"&&g<c.length-1&&c[g+1].type==="mn"&&Ie(e,g))p.children.push(...x.children);else{if(x.type==="mn"&&Ne(p))x.children=[...p.children,...x.children],a.pop();else if((x.type==="msup"||x.type==="msub")&&x.children.length>=1&&p&&(p.type==="mn"||Ne(p))){let q=x.children[0];q instanceof _&&q.type==="mn"&&p&&(q.children=[...p.children,...q.children],a.pop())}a.push(x),p=x}}return a},bt=function(e,t,n=!1){return me(tt(e,t,n),n)},He=function(e,t){if(!e)return new _("mrow");if(T[e.type])return T[e.type](e,t);throw new r("Got group of unknown type: '"+e.type+"'")},ft=e=>new _("mtd",[],[],{padding:"0",width:"50%"}),Dt=["mrow","mtd","mtable","mtr"],Kt=e=>{for(let t of e.children)if(t.type&&Dt.includes(t.type)){if(t.classes&&t.classes[0]==="tml-label")return t.label;{let n=Kt(t);if(n)return n}}else if(!t.type){let n=Kt(t);if(n)return n}};function Vt(e,t,n,a){let c=null;e.length===1&&e[0].type==="tag"&&(c=e[0].tag,e=e[0].body);let p=tt(e,n);if(p.length===1&&p[0]instanceof Le)return p[0];let g=a.displayMode||a.annotate?"none":a.wrap,x=p.length===0?null:p[0],q=p.length===1&&c===null&&x instanceof _?p[0]:function(ie,he,ee){let lt=[],We=[],ct=[],At=0,Ve=0;for(;Ve<ie.length;){for(;ie[Ve]instanceof be;)ie.splice(Ve,1,...ie[Ve].children);let rt=ie[Ve];if(rt.attributes&&rt.attributes.linebreak&&rt.attributes.linebreak==="newline"){ct.length>0&&We.push(new _("mrow",ct)),We.push(rt),ct=[];let en=new _("mtd",We);en.style.textAlign="left",lt.push(new _("mtr",[en])),We=[],Ve+=1;continue}if(ct.push(rt),rt.type&&rt.type==="mo"&&rt.children.length===1&&(!rt.attributes.form||rt.attributes.form!=="prefix")&&!Object.prototype.hasOwnProperty.call(rt.attributes,"movablelimits")){let en=rt.children[0].text;if(he==="="&&en==="="){if(At+=1,At>1){ct.pop();let Ut=new _("mrow",ct);We.push(Ut),ct=[rt]}}else if(he==="tex"){let Ut=Ve<ie.length-1?ie[Ve+1]:null,qn=!0;if(!Ut||Ut.type!=="mtext"||!Ut.attributes.linebreak||Ut.attributes.linebreak!=="nobreak")for(let mn=Ve+1;mn<ie.length;mn++){let kn=ie[mn];if(!kn.type||kn.type!=="mspace"||kn.attributes.linebreak&&kn.attributes.linebreak==="newline")break;ct.push(kn),Ve+=1,kn.attributes&&kn.attributes.linebreak&&kn.attributes.linebreak==="nobreak"&&(qn=!1)}if(qn){let mn=new _("mrow",ct);We.push(mn),ct=[]}}}Ve+=1}if(ct.length>0){let rt=new _("mrow",ct);We.push(rt)}if(lt.length>0){let rt=new _("mtd",We);rt.style.textAlign="left";let en=new _("mtr",[rt]);lt.push(en);let Ut=new _("mtable",lt);return ee||(Ut.setAttribute("columnalign","left"),Ut.setAttribute("rowspacing","0em")),Ut}return at(We)}(p,g,a.displayMode);if(c&&(q=((ie,he,ee,lt)=>{he=bt(he[0].body,ee),(he=Et(he)).classes.push("tml-tag");let We=Kt(ie);ie=new _("mtd",[ie]);let ct=[ft(),ie,ft()];ct[lt?0:2].children.push(he);let At=new _("mtr",ct,["tml-tageqn"]);We&&At.setAttribute("id",We);let Ve=new _("mtable",[At]);return Ve.style.width="100%",Ve.setAttribute("displaystyle","true"),Ve})(q,c,n,a.leqno)),a.annotate){let ie=new _("annotation",[new qe(t)]);ie.setAttribute("encoding","application/x-tex"),q=new _("semantics",[q,ie])}let j=new _("math",[q]);return a.xml&&j.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),a.displayMode&&(j.setAttribute("display","block"),j.style.display="block math",j.classes=["tml-display"]),j}let Ot=(e,t)=>{let n=e.isStretchy?re(e):new _("mo",[Xe(e.label,e.mode)]);e.isStretchy||n.setAttribute("stretchy","false"),e.label!=="\\vec"&&(n.style.mathDepth="0");let a=e.label==="\\c"?"munder":"mover",c=Zt.has(e.label);if(a==="mover"&&e.mode==="math"&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let p=e.base.text,g=e.label==="\\vec",x=g==="\\vec"?"-vec":"";g&&n.classes.push("tml-vec");let q=g?"-vec":c?"-acc":"";"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(p)>-1?(n.classes.push(`chr-sml${x}`),n.classes.push(`wbk-sml${q}`)):"BCEGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(p)>-1?(n.classes.push(`chr-med${x}`),n.classes.push(`wbk-med${q}`)):"AFJdf\u0394\u039B".indexOf(p)>-1?(n.classes.push(`chr-lrg${x}`),n.classes.push(`wbk-lrg${q}`)):g?n.classes.push("wbk-vec"):c&&n.classes.push("wbk-acc")}else c&&n.classes.push("wbk-acc");return new _(a,[He(e.base,t),n])},Q=new Set(["\\acute","\\check","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),Zt=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\`","\\'","\\^","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),_t={"\\`":"\u0300","\\'":"\u0301","\\^":"\u0302","\\~":"\u0303","\\=":"\u0304","\\u":"\u0306","\\.":"\u0307",'\\"':"\u0308","\\r":"\u030A","\\H":"\u030B","\\v":"\u030C","\\c":"\u0327"};C({type:"accent",names:["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\overparen","\\widecheck","\\widehat","\\wideparen","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{let n=ye(t[0]),a=!Q.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:a,base:n}},mathmlBuilder:Ot}),C({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{let n=ye(t[0]),a=e.parser.mode;return a==="math"&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),a==="text"&&n.text&&n.text.length===1&&e.funcName in _t&&A.indexOf(n.text)>-1?{type:"textord",mode:"text",text:n.text+_t[e.funcName]}:e.funcName==="\\c"&&a==="text"&&n.text&&n.text.length===1?{type:"textord",mode:"text",text:n.text+"\u0327"}:{type:"accent",mode:a,label:e.funcName,isStretchy:!1,base:n}},mathmlBuilder:Ot}),C({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>{let a=n[0];return{type:"accentUnder",mode:e.mode,label:t,base:a}},mathmlBuilder:(e,t)=>{let n=re(e);return n.style["math-depth"]=0,new _("munder",[He(e.base,t),n])}});let vt={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:12.792133216944668,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},Wt=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],Ht=function(e){return typeof e!="string"&&(e=e.unit),Wt.indexOf(e)>-1},R=e=>[1,.7,.5][Math.max(e-1,0)],W=function(e,t){let n=e.number;if(t.maxSize[0]<0&&n>0)return{number:0,unit:"em"};let a=e.unit;switch(a){case"mm":case"cm":case"in":case"px":return n*vt[a]>t.maxSize[1]?{number:t.maxSize[1],unit:"pt"}:{number:n,unit:a};case"em":case"ex":return a==="ex"&&(n*=.431),n=Math.min(n/R(t.level),t.maxSize[0]),{number:k(n),unit:"em"};case"bp":return n>t.maxSize[1]&&(n=t.maxSize[1]),{number:n,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return n=Math.min(n*vt[a],t.maxSize[1]),{number:k(n),unit:"pt"};case"mu":return n=Math.min(n/18,t.maxSize[0]),{number:k(n),unit:"em"};default:throw new r("Invalid unit: '"+a+"'")}},U=e=>{let t=new _("mspace");return t.setAttribute("width",e+"em"),t},se=(e,t=.3,n=0,a=!1)=>{if(e==null&&n===0)return U(t);let c=e?[e]:[];if(t!==0&&c.unshift(U(t)),n>0&&c.push(U(n)),a){let p=new _("mpadded",c);return p.setAttribute("height","0.1px"),p}return new _("mrow",c)},$e=(e,t)=>Number(e)/R(t),S=(e,t,n,a)=>{let c=D(e),p=e.slice(1,3)==="eq",g=e.charAt(1)==="x"?"1.75":e.slice(2,4)==="cd"?"3.0":p?"1.0":"2.0";c.setAttribute("lspace","0"),c.setAttribute("rspace",p?"0.5em":"0");let x=a.withLevel(a.level<2?2:3),q=$e(g,x.level),j=$e(g,3),ie=se(null,q.toFixed(4),0),he=se(null,j.toFixed(4),0),ee=$e(p?0:.3,x.level).toFixed(4),lt,We,ct=t&&t.body&&(t.body.body||t.body.length>0);if(ct){let rt=He(t,x);rt=se(rt,ee,ee,e==="\\\\cdrightarrow"||e==="\\\\cdleftarrow"),lt=new _("mover",[rt,he])}let At=n&&n.body&&(n.body.body||n.body.length>0);if(At){let rt=He(n,x);rt=se(rt,ee,ee),We=new _("munder",[rt,he])}let Ve;return Ve=ct||At?ct&&At?new _("munderover",[c,We,lt]):ct?new _("mover",[c,lt]):new _("munder",[c,We]):new _("mover",[c,ie]),g==="3.0"&&(Ve.style.height="1em"),Ve.setAttribute("accent","false"),Ve};C({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xleftrightharpoons","\\xrightleftharpoons","\\yields","\\yieldsLeft","\\mesomerism","\\longrightharpoonup","\\longleftharpoondown","\\yieldsLeftRight","\\chemequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:({parser:e,funcName:t},n,a)=>({type:"xArrow",mode:e.mode,name:t,body:n[0],below:a[0]}),mathmlBuilder(e,t){let n=[S(e.name,e.body,e.below,t)];return n.unshift(U(.2778)),n.push(U(.2778)),new _("mrow",n)}});let L={"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};C({type:"stackedArrow",names:["\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,a){let c=n[0]?{type:"hphantom",mode:e.mode,body:n[0]}:null,p=a[0]?{type:"hphantom",mode:e.mode,body:a[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:n[0],upperArrowBelow:p,lowerArrowBody:c,below:a[0]}},mathmlBuilder(e,t){let n=L[e.name][0],a=L[e.name][1],c=S(n,e.body,e.upperArrowBelow,t),p=S(a,e.lowerArrowBody,e.below,t),g,x=new _("mpadded",[c]);if(x.setAttribute("voffset","0.3em"),x.setAttribute("height","+0.3em"),x.setAttribute("depth","-0.3em"),e.name==="\\equilibriumLeft"){let q=new _("mpadded",[p]);q.setAttribute("width","0.5em"),g=new _("mpadded",[U(.2778),q,x,U(.2778)])}else x.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),g=new _("mpadded",[U(.2778),x,p,U(.2778)]);return g.setAttribute("voffset","-0.18em"),g.setAttribute("height","-0.18em"),g.setAttribute("depth","+0.18em"),g}});let $={};function Z({type:e,names:t,props:n,handler:a,mathmlBuilder:c}){let p={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:a};for(let g=0;g<t.length;++g)$[t[g]]=p;c&&(T[e]=c)}function te(e,t){if(!e||e.type!==t)throw new Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function fe(e){let t=Qe(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return t}function Qe(e){return e&&(e.type==="atom"||e.type==="delimiter"||Object.prototype.hasOwnProperty.call(Ke,e.type))?e:null}let Pe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Ye=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),ut=e=>e.type==="textord"&&e.text==="@",dt=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function pt(e,t,n){let a=Pe[e];switch(a){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(a,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{let c={type:"atom",text:a,mode:"math",family:"rel"},p={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[c],[]),n.callFunction("\\\\cdright",[t[1]],[])],semisimple:!0};return n.callFunction("\\\\cdparent",[p],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{let c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}C({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>({type:"cdlabel",mode:e.mode,side:t.slice(4),label:n[0]}),mathmlBuilder(e,t){if(e.label.body.length===0)return new _("mrow",t);let n=He(e.label,t);e.side==="left"&&n.classes.push("tml-shift-left");let a=new _("mtd",[n]);a.style.padding="0";let c=new _("mtr",[a]),p=new _("mtable",[c]),g=new _("mpadded",[p]);return g.setAttribute("width","0.1px"),g.setAttribute("displaystyle","false"),g.setAttribute("scriptlevel","1"),g}}),C({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},t)=>({type:"cdlabelparent",mode:e.mode,fragment:t[0]}),mathmlBuilder:(e,t)=>new _("mrow",[He(e.fragment,t)])});let xt=e=>({type:"ordgroup",mode:"math",body:e,semisimple:!0}),ht=(e,t)=>({type:t,mode:"math",body:xt(e)});class yt{constructor(t,n,a){this.lexer=t,this.start=n,this.end=a}static range(t,n){return n?t&&t.loc&&n.loc&&t.loc.lexer===n.loc.lexer?new yt(t.loc.lexer,t.loc.start,n.loc.end):null:t&&t.loc}}class qt{constructor(t,n){this.text=t,this.loc=n}range(t,n){return new qt(n,yt.range(this,t))}}let Ft=0,Pt=1,an=2,ln=3,tn={};function I(e,t){tn[e]=t}let Tn=tn;I("\\noexpand",function(e){let t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),I("\\expandafter",function(e){let t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),I("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),I("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),I("\\@ifnextchar",function(e){let t=e.consumeArgs(3);e.consumeSpaces();let n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),I("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),I("\\TextOrMath",function(e){let t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});let nn=e=>{let t="";for(let n=e.length-1;n>-1;n--)t+=e[n].text;return t},Xt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},hn=e=>{let t=e.future().text;return t==="EOF"?[null,""]:[Xt[t.charAt(0)],t]},Cn=(e,t,n)=>{for(let a=1;a<t.length;a++)e*=n,e+=Xt[t.charAt(a)];return e};function Qt(e){let t=e.consumeArgs(1)[0],n="",a=t[t.length-1].loc.start;for(let c=t.length-1;c>=0;c--){let p=t[c].loc.start;p>a&&(n+=" ",a=p),n+=t[c].text,a+=t[c].text.length}return n}I("\\char",function(e){let t,n=e.popToken(),a="";if(n.text==="'")t=8,n=e.popToken();else if(n.text==='"')t=16,n=e.popToken();else if(n.text==="`")if(n=e.popToken(),n.text[0]==="\\")a=n.text.charCodeAt(1);else{if(n.text==="EOF")throw new r("\\char` missing argument");a=n.text.charCodeAt(0)}else t=10;if(t){let c,p=n.text;if(a=Xt[p.charAt(0)],a==null||a>=t)throw new r(`Invalid base-${t} digit ${n.text}`);for(a=Cn(a,p,t),[c,p]=hn(e);c!=null&&c<t;)a*=t,a+=c,a=Cn(a,p,t),e.popToken(),[c,p]=hn(e)}return`\\@char{${a}}`}),I("\\surd","\\sqrt{\\vphantom{|}}"),I("\u2295","\\oplus"),I("\\long",""),I("\\bgroup","{"),I("\\egroup","}"),I("~","\\nobreakspace"),I("\\lq","`"),I("\\rq","'"),I("\\aa","\\r a"),I("\\Bbbk","\\Bbb{k}"),I("\\mathstrut","\\vphantom{(}"),I("\\underbar","\\underline{\\text{#1}}"),I("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),I("\u22EE","\\vdots"),I("\\arraystretch","1"),I("\\arraycolsep","6pt"),I("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),I("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),I("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),I("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");let cn={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcap":"\\dotsb","\\bigsqcup":"\\dotsb","\\bigtimes":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\DOTSX":"\\dotsx"};I("\\dots",function(e){let t="\\dotso",n=e.expandAfterFuture().text;return n in cn?t=cn[n]:(n.slice(0,4)==="\\not"||n in Ce.math&&["bin","rel"].includes(Ce.math[n].group))&&(t="\\dotsb"),t});let Rt={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};I("\\dotso",function(e){return e.future().text in Rt?"\\ldots\\,":"\\ldots"}),I("\\dotsc",function(e){let t=e.future().text;return t in Rt&&t!==","?"\\ldots\\,":"\\ldots"}),I("\\cdots",function(e){return e.future().text in Rt?"\\@cdots\\,":"\\@cdots"}),I("\\dotsb","\\cdots"),I("\\dotsm","\\cdots"),I("\\dotsi","\\!\\cdots"),I("\\idotsint","\\int\\!\\cdots\\!\\int"),I("\\dotsx","\\ldots\\,"),I("\\DOTSI","\\relax"),I("\\DOTSB","\\relax"),I("\\DOTSX","\\relax"),I("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),I("\\,","{\\tmspace+{3mu}{.1667em}}"),I("\\thinspace","\\,"),I("\\>","\\mskip{4mu}"),I("\\:","{\\tmspace+{4mu}{.2222em}}"),I("\\medspace","\\:"),I("\\;","{\\tmspace+{5mu}{.2777em}}"),I("\\thickspace","\\;"),I("\\!","{\\tmspace-{3mu}{.1667em}}"),I("\\negthinspace","\\!"),I("\\negmedspace","{\\tmspace-{4mu}{.2222em}}"),I("\\negthickspace","{\\tmspace-{5mu}{.277em}}"),I("\\enspace","\\kern.5em "),I("\\enskip","\\hskip.5em\\relax"),I("\\quad","\\hskip1em\\relax"),I("\\qquad","\\hskip2em\\relax"),I("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax"),I("\\tag","\\@ifstar\\tag@literal\\tag@paren"),I("\\tag@paren","\\tag@literal{({#1})}"),I("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new r("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),I("\\notag","\\nonumber"),I("\\nonumber","\\gdef\\@eqnsw{0}"),I("\\bmod","\\mathbin{\\text{mod}}"),I("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),I("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),I("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),I("\\newline","\\\\\\relax"),I("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}"),I("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX"),I("\\Temml","\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}"),I("\\hspace","\\@ifstar\\@hspacer\\@hspace"),I("\\@hspace","\\hskip #1\\relax"),I("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),I("\\colon",'\\mathpunct{\\char"3a}'),I("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}"),I("\\ordinarycolon",'\\char"3a'),I("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}"),I("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}'),I("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}'),I("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}'),I("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}'),I("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}'),I("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}'),I("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),I("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),I("\\ratio","\\vcentcolon"),I("\\coloncolon","\\dblcolon"),I("\\colonequals","\\coloneqq"),I("\\coloncolonequals","\\Coloneqq"),I("\\equalscolon","\\eqqcolon"),I("\\equalscoloncolon","\\Eqqcolon"),I("\\colonminus","\\coloneq"),I("\\coloncolonminus","\\Coloneq"),I("\\minuscolon","\\eqcolon"),I("\\minuscoloncolon","\\Eqcolon"),I("\\coloncolonapprox","\\Colonapprox"),I("\\coloncolonsim","\\Colonsim"),I("\\notni","\\mathrel{\\char`\u220C}"),I("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),I("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),I("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),I("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),I("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}"),I("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}"),I("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}"),I("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}"),I("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}"),I("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),I("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),I("\\plim","\\DOTSB\\operatorname*{plim}"),I("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}"),I("\\bra","\\mathinner{\\langle{#1}|}"),I("\\ket","\\mathinner{|{#1}\\rangle}"),I("\\braket","\\mathinner{\\langle{#1}\\rangle}"),I("\\Bra","\\left\\langle#1\\right|"),I("\\Ket","\\left|#1\\right\\rangle");let Nn=(e,t)=>{let n=`}\\,\\middle${t[0]==="|"?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+n+e.slice(t.index+t[0].length)};I("\\Braket",function(e){let t=Qt(e),n=/\|\||\||\\\|/g,a;for(;(a=n.exec(t))!==null;)t=Nn(t,a);return"\\left\\langle{"+t+"}\\right\\rangle"}),I("\\Set",function(e){let t=Qt(e),n=/\|\||\||\\\|/.exec(t);return n&&(t=Nn(t,n)),"\\left\\{\\:{"+t+"}\\:\\right\\}"}),I("\\set",function(e){return"\\{{"+Qt(e).replace(/\|/,"}\\mid{")+"}\\}"}),I("\\angln","{\\angl n}"),I("\\odv","\\@ifstar\\odv@next\\odv@numerator"),I("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}"),I("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1"),I("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");let rn=e=>{let t=e[0][0].text,n=nn(e[1]).split(","),a=String(n.length),c=a==="1"?"\\partial":`\\partial^${a}`,p="";return n.map(g=>{p+="\\partial "+g.trim()+"\\,"}),[t,c,p.replace(/\\,$/,"")]};function gn(e){let t=[];e.consumeSpaces();let n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}I("\\pdv@numerator",function(e){let[t,n,a]=rn(e.consumeArgs(2));return`\\frac{${n} ${t}}{${a}}`}),I("\\pdv@next",function(e){let[t,n,a]=rn(e.consumeArgs(2));return`\\frac{${n}}{${a}} ${t}`}),I("\\upalpha","\\up@greek{\\alpha}"),I("\\upbeta","\\up@greek{\\beta}"),I("\\upgamma","\\up@greek{\\gamma}"),I("\\updelta","\\up@greek{\\delta}"),I("\\upepsilon","\\up@greek{\\epsilon}"),I("\\upzeta","\\up@greek{\\zeta}"),I("\\upeta","\\up@greek{\\eta}"),I("\\uptheta","\\up@greek{\\theta}"),I("\\upiota","\\up@greek{\\iota}"),I("\\upkappa","\\up@greek{\\kappa}"),I("\\uplambda","\\up@greek{\\lambda}"),I("\\upmu","\\up@greek{\\mu}"),I("\\upnu","\\up@greek{\\nu}"),I("\\upxi","\\up@greek{\\xi}"),I("\\upomicron","\\up@greek{\\omicron}"),I("\\uppi","\\up@greek{\\pi}"),I("\\upalpha","\\up@greek{\\alpha}"),I("\\uprho","\\up@greek{\\rho}"),I("\\upsigma","\\up@greek{\\sigma}"),I("\\uptau","\\up@greek{\\tau}"),I("\\upupsilon","\\up@greek{\\upsilon}"),I("\\upphi","\\up@greek{\\phi}"),I("\\upchi","\\up@greek{\\chi}"),I("\\uppsi","\\up@greek{\\psi}"),I("\\upomega","\\up@greek{\\omega}"),I("\\invamp",'\\mathbin{\\char"214b}'),I("\\parr",'\\mathbin{\\char"214b}'),I("\\upand",'\\mathbin{\\char"214b}'),I("\\with",'\\mathbin{\\char"26}'),I("\\multimapinv",'\\mathrel{\\char"27dc}'),I("\\multimapboth",'\\mathrel{\\char"29df}'),I("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}'),I("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}'),I("\\coh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}
6
+ {\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}`),I("\\incoh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}
7
+ {\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`),I("\\standardstate","\\text{\\tiny\\char`\u29B5}");let Yt=e=>{if(!e.parser.settings.displayMode)throw new r(`{${e.envName}} can be used only in display mode.`)},$n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,St=e=>{let t=e.get("\\arraystretch");typeof t!="string"&&(t=nn(t.tokens)),t=isNaN(t)?null:Number(t);let n=e.get("\\arraycolsep");typeof n!="string"&&(n=nn(n.tokens));let a=$n.exec(n);return[t,a?{number:+(a[1]+a[2]),unit:a[3]}:null]},Bn=e=>{let t="";for(let n=0;n<e.length;n++)if(e[n].type==="label"){if(t)throw new r("Multiple \\labels in one row");t=e[n].string}return t};function sn(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Mt(e,{cols:t,envClasses:n,autoTag:a,singleRow:c,emptySingleRow:p,maxNumCols:g,leqno:x,arraystretch:q,arraycolsep:j},ie){let he=n&&n.includes("bordermatrix")?"}":"\\end";e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();let ee=[],lt=[ee],We=[],ct=[],At=[],Ve=a!=null?[]:void 0;function rt(){a&&e.gullet.macros.set("\\@eqnsw","1",!0)}function en(){Ve&&(e.gullet.macros.get("\\df@tag")?(Ve.push(e.subparse([new qt("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):Ve.push(!!a&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(rt(),At.push(gn(e));;){let Ut=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),Ut={type:"ordgroup",mode:e.mode,body:Ut,semisimple:!0},ee.push(Ut);let qn=e.fetch().text;if(qn==="&"){if(g&&ee.length===g){if(!n.includes("array"))throw new r(g===2?"The split environment accepts no more than two columns":"The equation environment accepts only one column",e.nextToken);if(e.settings.strict)throw new r("Too few columns specified in the {array} column argument.",e.nextToken)}e.consume()}else{if(qn===he){en(),ee.length===1&&Ut.body.length===0&&(lt.length>1||!p)&&lt.pop(),ct.push(Bn(Ut.body)),At.length<lt.length+1&&At.push([]);break}if(qn!=="\\\\")throw new r("Expected & or \\\\ or \\cr or "+he,e.nextToken);{let mn;e.consume(),e.gullet.future().text!==" "&&(mn=e.parseSizeGroup(!0)),We.push(mn?mn.value:null),en(),ct.push(Bn(Ut.body)),At.push(gn(e)),ee=[],lt.push(ee),rt()}}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,body:lt,cols:t,rowGaps:We,hLinesBeforeRow:At,envClasses:n,autoTag:a,scriptLevel:ie,tags:Ve,labels:ct,leqno:x,arraystretch:q,arraycolsep:j}}function Gt(e){return e.slice(0,1)==="d"?"display":"text"}let jt={c:"center ",l:"left ",r:"right "},dn=e=>{let t=new _("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},kt=function(e,t){let n=[],a=e.body.length,c=e.hLinesBeforeRow,p=e.tags&&e.tags.some(j=>j);for(let j=0;j<a;j++){let ie=e.body[j],he=[],ee=e.scriptLevel==="text"?Pt:e.scriptLevel==="script"?an:Ft;for(let Ve=0;Ve<ie.length;Ve++){let rt=new _("mtd",[He(ie[Ve],t.withLevel(ee))]);if(e.envClasses.includes("multline")){let en=j===0?"left":j===a-1?"right":"center";en!=="center"&&rt.classes.push("tml-"+en)}he.push(rt)}let lt=e.body[0].length;for(let Ve=0;Ve<lt-ie.length;Ve++)he.push(new _("mtd",[],[],t));if(p){let Ve=e.tags[j],rt;Ve===!0?rt=new _("mtext",[new De(["tml-eqn"])]):Ve===!1?rt=new _("mtext",[],[]):(rt=bt(Ve[0].body,t.withLevel(ee),!0),rt=Et(rt),rt.classes=["tml-tag"]),rt&&(he.unshift(dn(e)),he.push(dn(e)),e.leqno?he[0].children.push(rt):he[he.length-1].children.push(rt))}let We=new _("mtr",he,[]),ct=e.labels.shift();ct&&e.tags&&e.tags[j]&&(We.setAttribute("id",ct),Array.isArray(e.tags[j])&&We.classes.push("tml-tageqn")),j===0&&c[0].length>0&&(c[0].length===2?We.children.forEach(Ve=>{Ve.style.borderTop="0.15em double"}):We.children.forEach(Ve=>{Ve.style.borderTop=c[0][0]?"0.06em dashed":"0.06em solid"})),c[j+1].length>0&&(c[j+1].length===2?We.children.forEach(Ve=>{Ve.style.borderBottom="0.15em double"}):We.children.forEach(Ve=>{Ve.style.borderBottom=c[j+1][0]?"0.06em dashed":"0.06em solid"}));let At=!0;for(let Ve=0;Ve<We.children.length;Ve++){let rt=We.children[Ve].children[0];if(!rt||rt.type!=="mpadded"||rt.attributes.height!=="0px"){At=!1;break}}if(At){We.classes.push("ff-squash");for(let Ve=0;Ve<We.children.length;Ve++)We.children[Ve].style.paddingTop="0",We.children[Ve].style.paddingBottom="0"}n.push(We)}if(e.arraystretch&&e.arraystretch!==1){let j=String(1.4*e.arraystretch-.8)+"ex";for(let ie=0;ie<n.length;ie++)for(let he=0;he<n[ie].children.length;he++)n[ie].children[he].style.paddingTop=j,n[ie].children[he].style.paddingBottom=j}let g,x;if(e.envClasses.length>0&&(g=e.envClasses.includes("abut")||e.envClasses.includes("cases")?"0":e.envClasses.includes("small")?"0.1389":e.envClasses.includes("cd")?"0.25":"0.4",x="em"),e.arraycolsep){let j=W(e.arraycolsep,t);g=j.number.toFixed(4),x=j.unit}if(g){let j=n.length===0?0:n[0].children.length,ie=(he,ee)=>he===0&&ee===0||he===j-1&&ee===1?"0":e.envClasses[0]!=="align"?g:ee===1?"0":p?he%2?"1":"0":he%2?"0":"1";for(let he=0;he<n.length;he++)for(let ee=0;ee<n[he].children.length;ee++)n[he].children[ee].style.paddingLeft=`${ie(ee,0)}${x}`,n[he].children[ee].style.paddingRight=`${ie(ee,1)}${x}`}if(e.envClasses.length===0)for(let j=0;j<n.length;j++)n[j].children[0].style.paddingLeft="0em",n[j].children.length===n[0].children.length&&(n[j].children[n[j].children.length-1].style.paddingRight="0em");if(e.envClasses.length>0){let j=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let ie=0;ie<n.length;ie++){let he=n[ie];if(j){for(let ee=0;ee<he.children.length;ee++)he.children[ee].classes=["tml-"+(ee%2?"left":"right")];if(p){let ee=e.leqno?0:he.children.length-1;he.children[ee].classes=[]}}if(he.children.length>1&&e.envClasses.includes("cases")&&(he.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(let ee of he.children)ee.classes.push("tml-left")}}let q=new _("mtable",n);if(e.envClasses.length>0&&(e.envClasses.includes("jot")?q.classes.push("tml-jot"):e.envClasses.includes("small")&&q.classes.push("tml-small")),e.scriptLevel==="display"&&q.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(q.style.width="100%"),e.cols&&e.cols.length>0){let j=e.cols,ie=!1,he=0,ee=j.length;for(;j[he].type==="separator";)he+=1;for(;j[ee-1].type==="separator";)ee-=1;if(j[0].type==="separator"){let We=j[1].type==="separator"?"0.15em double":j[0].separator==="|"?"0.06em solid ":"0.06em dashed ";for(let ct of q.children)ct.children[0].style.borderLeft=We}let lt=p?0:-1;for(let We=he;We<ee;We++)if(j[We].type==="align"){let ct=jt[j[We].align];lt+=1;for(let At of q.children)ct.trim()!=="center"&&lt<At.children.length&&(At.children[lt].classes=["tml-"+ct.trim()]);ie=!0}else if(j[We].type==="separator"){if(ie){let ct=j[We+1].type==="separator"?"0.15em double":j[We].separator==="|"?"0.06em solid":"0.06em dashed";for(let At of q.children)lt<At.children.length&&(At.children[lt].style.borderRight=ct)}ie=!1}if(j[j.length-1].type==="separator"){let We=j[j.length-2].type==="separator"?"0.15em double":j[j.length-1].separator==="|"?"0.06em solid":"0.06em dashed";for(let ct of q.children)ct.children[ct.children.length-1].style.borderRight=We,ct.children[ct.children.length-1].style.paddingRight="0.4em"}}return e.envClasses.includes("small")&&(q=new _("mstyle",[q]),q.setAttribute("scriptlevel","1")),q},Tt=function(e,t){e.envName.indexOf("ed")===-1&&Yt(e);let n=e.envName==="split",a=[],c=Mt(e.parser,{cols:a,emptySingleRow:!0,autoTag:n?void 0:sn(e.envName),envClasses:["abut","jot"],maxNumCols:e.envName==="split"?2:void 0,leqno:e.parser.settings.leqno},"display"),p,g=0,x=e.envName.indexOf("at")>-1;if(t[0]&&x){let q="";for(let j=0;j<t[0].body.length;j++)q+=te(t[0].body[j],"textord").text;if(isNaN(q))throw new r("The alignat enviroment requires a numeric first argument.");p=Number(q),g=2*p}c.body.forEach(function(q){if(x){let j=q.length/2;if(p<j)throw new r(`Too many math in a row: expected ${p}, but got ${j}`,q[0])}else g<q.length&&(g=q.length)});for(let q=0;q<g;++q){let j="r";q%2==1&&(j="l"),a[q]={type:"align",align:j}}return e.envName==="split"||(x?c.envClasses.push("alignat"):c.envClasses[0]="align"),c};Z({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){let n=(Qe(t[0])?[t[0]]:te(t[0],"ordgroup").body).map(function(g){let x=fe(g).text;if("lcr".indexOf(x)!==-1)return{type:"align",align:x};if(x==="|")return{type:"separator",separator:"|"};if(x===":")return{type:"separator",separator:":"};throw new r("Unknown column alignment: "+x,g)}),[a,c]=St(e.parser.gullet.macros),p={cols:n,envClasses:["array"],maxNumCols:n.length,arraystretch:a,arraycolsep:c};return Mt(e.parser,p,Gt(e.envName))},mathmlBuilder:kt}),Z({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){let t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",a={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)==="*"){let x=e.parser;if(x.consumeSpaces(),x.fetch().text==="["){if(x.consume(),x.consumeSpaces(),n=x.fetch().text,"lcr".indexOf(n)===-1)throw new r("Expected l or c or r",x.nextToken);x.consume(),x.consumeSpaces(),x.expect("]"),x.consume(),a.cols=[]}}let c=Mt(e.parser,a,"text");c.cols=c.body.length>0?new Array(c.body[0].length).fill({type:"align",align:n}):[];let[p,g]=St(e.parser.gullet.macros);return c.arraystretch=p,!g||g===6&&g==="pt"||(c.arraycolsep=g),t?{type:"leftright",mode:e.mode,body:[c],left:t[0],right:t[1],rightColor:void 0}:c},mathmlBuilder:kt}),Z({type:"array",names:["bordermatrix"],props:{numArgs:0},handler(e){let t=Mt(e.parser,{cols:[],envClasses:["bordermatrix"]},"text");return t.cols=t.body.length>0?new Array(t.body[0].length).fill({type:"align",align:"c"}):[],t.envClasses=[],t.arraystretch=1,e.envName==="matrix"?t:((n,a)=>{let c=n.body;c[0].shift();let p=new Array(c.length-1).fill().map(()=>[]);for(let ie=1;ie<c.length;ie++){p[ie-1].push(c[ie].shift());let he=[];for(let ee=0;ee<c[ie].length;ee++)he.push(c[ie][ee]);p[ie-1].push(ht(he,"vphantom"))}let g=new Array(c.length).fill().map(()=>[]);for(let ie=0;ie<c[0].length;ie++)g[0].push(c[0][ie]);for(let ie=1;ie<c.length;ie++)for(let he=0;he<c[0].length;he++)g[ie].push(ht(c[ie][he].body,"hphantom"));for(let ie=0;ie<c[0].length;ie++)c[0][ie]=ht(c[0][ie].body,"hphantom");let x={type:"array",mode:"math",body:p,cols:[{type:"align",align:"c"}],rowGaps:new Array(p.length-1).fill(null),hLinesBeforeRow:new Array(p.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(p.length).fill(""),arraycolsep:{number:.04,unit:"em"}},q={type:"styling",mode:"math",scriptLevel:"text",body:[{type:"array",mode:"math",body:g,cols:new Array(g.length).fill({type:"align",align:"c"}),rowGaps:new Array(g.length-1).fill(null),hLinesBeforeRow:new Array(g.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(g.length).fill(""),arraycolsep:null}]},j={type:"leftright",mode:"math",body:[n],left:a?a[0]:"(",right:a?a[1]:")",rightColor:void 0};return xt([x,{type:"supsub",mode:"math",stack:!0,base:{type:"op",mode:"math",limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[j]},sup:q,sub:null}])})(t,e.delimiters)},mathmlBuilder:kt}),Z({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:e=>Mt(e.parser,{envClasses:["small"]},"script"),mathmlBuilder:kt}),Z({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){let n=(Qe(t[0])?[t[0]]:te(t[0],"ordgroup").body).map(function(c){let p=fe(c).text;if("lc".indexOf(p)!==-1)return{type:"align",align:p};throw new r("Unknown column alignment: "+p,c)});if(n.length>1)throw new r("{subarray} can contain only one column");let a={cols:n,envClasses:["small"]};if(a=Mt(e.parser,a,"script"),a.body.length>0&&a.body[0].length>1)throw new r("{subarray} can contain only one column");return a},mathmlBuilder:kt}),Z({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){let t=Mt(e.parser,{cols:[],envClasses:["cases"]},Gt(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:kt}),Z({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Tt,mathmlBuilder:kt}),Z({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Tt,mathmlBuilder:kt}),Z({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){e.envName!=="gathered"&&Yt(e);let t={cols:[],envClasses:["abut","jot"],autoTag:sn(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Mt(e.parser,t,"display")},mathmlBuilder:kt}),Z({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Yt(e);let t={autoTag:sn(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return Mt(e.parser,t,"display")},mathmlBuilder:kt}),Z({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){Yt(e);let t={autoTag:e.envName==="multline",maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return Mt(e.parser,t,"display")},mathmlBuilder:kt}),Z({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(Yt(e),function(t){let n=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){n.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();let p=t.fetch().text;if(p!=="&"&&p!=="\\\\"){if(p==="\\end"){n[n.length-1].length===0&&n.pop();break}throw new r("Expected \\\\ or \\cr or \\end",t.nextToken)}t.consume()}let a=[],c=[a];for(let p=0;p<n.length;p++){let g=n[p],x=Ye();for(let q=0;q<g.length;q++)if(ut(g[q])){a.push(x),q+=1;let j=fe(g[q]).text,ie=new Array(2);if(ie[0]={type:"ordgroup",mode:"math",body:[]},ie[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(j)>-1)){if(!("<>AV".indexOf(j)>-1))throw new r('Expected one of "<>AV=|." after @.');for(let ee=0;ee<2;ee++){let lt=!0;for(let We=q+1;We<g.length;We++){if(dt(g[We],j)){lt=!1,q=We;break}if(ut(g[We]))throw new r("Missing a "+j+" character to complete a CD arrow.",g[We]);ie[ee].body.push(g[We])}if(lt)throw new r("Missing a "+j+" character to complete a CD arrow.",g[q])}}let he=pt(j,ie,t);a.push(he),x=Ye()}else x.body.push(g[q]);p%2==0?a.push(x):a.shift(),a=[],c.push(a)}return c.pop(),t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:"math",body:c,tags:null,labels:new Array(c.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(c.length+1).fill([])}}(e.parser)),mathmlBuilder:kt}),C({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new r(`${e.funcName} valid only within array environment`)}});let un=$;C({type:"bordermatrix",names:["\\bordermatrix","\\matrix"],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:t},n,a)=>{let c=["(",")"];if(t==="\\bordermatrix"&&a[0]&&a[0].body){let q=a[0].body;q.length===1&&q[0].type==="delimiter"&&(c=[q[0].left,q[0].right])}e.consumeSpaces(),e.consume();let p=un.bordermatrix,g={mode:e.mode,envName:t.slice(1),delimiters:c,parser:e},x=p.handler(g);return e.expect("}",!0),x}}),C({type:"cancelto",names:["\\cancelto"],props:{numArgs:2},handler({parser:e},t){let n=t[0],a=t[1];return{type:"cancelto",mode:e.mode,body:a,to:n,isCharacterBox:b(a)}},mathmlBuilder(e,t){let n=new _("mrow",[He(e.body,t)],["ff-narrow"]),a=new _("mphantom",[He(e.body,t)]),c=new _("mrow",[a],["tml-cancelto"]);c.style.color=t.color,e.isCharacterBox&&A.indexOf(e.body.body[0].text)>-1&&(c.style.left="0.1em",c.style.width="90%");let p=new _("mrow",[n,c],["menclose"]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))a.style.paddingRight="0.2em";else{a.style.padding="0.5ex 0.1em 0 0";let he=new _("mspace",[]);he.setAttribute("height","0.85em"),n.children.push(he)}let g;if(e.isCharacterBox)g=new _("mspace",[]),g.setAttribute("height","1em");else{let he=He(e.body,t),ee=new _("mpadded",[he]);ee.setAttribute("width","0.1px"),g=new _("mphantom",[ee])}let x=He(e.to,t);x.style.color=t.color;let q=new _("mpadded",[x]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let he=new _("mspace",[]);he.setAttribute("width","0.2em"),q.children.unshift(he)}q.setAttribute("width","0.1px");let j=new _("mover",[g,q]),ie=new _("mrow",[],["ff-nudge-left"]);return at([me([p,j]),ie])}}),C({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:t},n){let a=te(n[0],"ordgroup").body,c="";for(let g=0;g<a.length;g++)c+=te(a[g],"textord").text;let p=parseInt(c);if(isNaN(p))throw new r(`\\@char has non-numeric argument ${c}`,t);return{type:"textord",mode:e.mode,text:String.fromCodePoint(p)}}});let bn=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,On=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,yn=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,wn=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,v=/^[a-f0-9]{6}$/i,H=e=>{let t=e.toString(16);return t.length===1&&(t="0"+t),t},G=JSON.parse(`{
8
8
  "Apricot": "#ffb484",
9
9
  "Aquamarine": "#08b4bc",
10
10
  "Bittersweet": "#c84c14",
@@ -88,16 +88,16 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),U===void 0&
88
88
  "Yellow": "#fff404",
89
89
  "YellowGreen": "#98cc6c",
90
90
  "YellowOrange": "#ffa41c"
91
- }`),it=(e,t)=>{let n="";if(e==="HTML"){if(!y.test(t))throw new r("Invalid HTML input.");n=t}else if(e==="RGB"){if(!S.test(t))throw new r("Invalid RGB input.");t.split(",").map(i=>{n+=ue(Number(i.trim()))})}else{if(!R.test(t))throw new r("Invalid rbg input.");t.split(",").map(i=>{let c=Number(i.trim());if(c>1)throw new r("Color rgb input must be < 1.");n+=ue(Number((255*c).toFixed(0)))})}return n.charAt(0)!=="#"&&(n="#"+n),n},ht=(e,t,n)=>{let i=`\\\\color@${e}`;if(!_.exec(e))throw new r("Invalid color: '"+e+"'",n);return Z.test(e)?"#"+e:(e.charAt(0)==="#"||(t.has(i)?e=t.get(i).tokens[0].text:Ve[e]&&(e=Ve[e])),e)},mn=(e,t)=>{let n=Le(e.body,t.withColor(e.color));return n.length===0&&n.push(new E("mrow")),n=n.map(i=>(i.style.color=e.color,i)),xe(n)};$({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},n,i){let c=i[0]&&Me(i[0],"raw").string,p="";if(c){let v=Me(n[0],"raw").string;p=it(c,v)}else p=ht(Me(n[0],"raw").string,e.gullet.macros,t);let b=n[1];return{type:"color",mode:e.mode,color:p,isTextColor:!0,body:oe(b)}},mathmlBuilder:mn}),$({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:n},i,c){let p=c[0]&&Me(c[0],"raw").string,b="";if(p){let D=Me(i[0],"raw").string;b=it(p,D)}else b=ht(Me(i[0],"raw").string,e.gullet.macros,n);let v=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:b,isTextColor:!1,body:v}},mathmlBuilder:mn}),$({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:e,funcName:t,token:n},i){let c=Me(i[0],"raw").string;if(!/^[A-Za-z]+$/.test(c))throw new r("Color name must be latin letters.",n);let p=Me(i[1],"raw").string;if(!["HTML","RGB","rgb"].includes(p))throw new r("Color model must be HTML, RGB, or rgb.",n);let b=Me(i[2],"raw").string,v=it(p,b);return e.gullet.macros.set(`\\\\color@${c}`,{tokens:[{text:v}],numArgs:0}),{type:"internal",mode:e.mode}}}),$({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,n){let i=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,c=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:c,size:i&&Me(i,"size").value}},mathmlBuilder(e,t){let n=new E("mo");if(e.newLine&&(n.setAttribute("linebreak","newline"),e.size)){let i=ot(e.size,t);n.setAttribute("height",i.number+i.unit)}return n}});let Dn={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Xn=e=>{let t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new r("Expected a control sequence",e);return t},as=(e,t,n,i)=>{let c=e.gullet.macros.get(n.text);c==null&&(n.noexpand=!0,c={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,c,i)};$({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:t}){e.consumeSpaces();let n=e.fetch();if(Dn[n.text])return t!=="\\global"&&t!=="\\\\globallong"||(n.text=Dn[n.text]),Me(e.parseFunction(),"internal");throw new r("Invalid token after macro prefix",n)}}),$({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=e.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new r("Expected a control sequence",n);let c,p=0,b=[[]];for(;e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){c=e.gullet.future(),b[p].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new r(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==p+1)throw new r(`Argument number "${n.text}" out of order`);p++,b.push([])}else{if(n.text==="EOF")throw new r("Expected a macro definition");b[p].push(n.text)}let{tokens:v}=e.gullet.consumeArg();if(c&&v.unshift(c),t==="\\edef"||t==="\\xdef"){if(v=e.gullet.expandTokens(v),v.length>e.gullet.settings.maxExpand)throw new r("Too many expansions in an "+t);v.reverse()}return e.gullet.macros.set(i,{tokens:v,numArgs:p,delimiters:b},t===Dn[t]),{type:"internal",mode:e.mode}}}),$({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=Xn(e.gullet.popToken());e.gullet.consumeSpaces();let i=(c=>{let p=c.gullet.popToken();return p.text==="="&&(p=c.gullet.popToken(),p.text===" "&&(p=c.gullet.popToken())),p})(e);return as(e,n,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}}),$({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=Xn(e.gullet.popToken()),i=e.gullet.popToken(),c=e.gullet.popToken();return as(e,n,c,t==="\\\\globalfuture"),e.gullet.pushToken(c),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}}),$({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n="",i=e.gullet.popToken();i.text==="{"?(n=Xn(e.gullet.popToken()),e.gullet.popToken()):n=Xn(i);let c=e.gullet.isDefined(n);if(c&&t==="\\newcommand")throw new r(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!c&&t==="\\renewcommand")throw new r(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let p=0;if(e.gullet.future().text==="["){let v=e.gullet.popToken();if(v=e.gullet.popToken(),!/^[0-9]$/.test(v.text))throw new r(`Invalid number of arguments: "${v.text}"`);if(p=parseInt(v.text),v=e.gullet.popToken(),v.text!=="]")throw new r(`Invalid argument "${v.text}"`)}let{tokens:b}=e.gullet.consumeArg();return t==="\\providecommand"&&e.gullet.macros.has(n)||e.gullet.macros.set(n,{tokens:b,numArgs:p}),{type:"internal",mode:e.mode}}});let _r={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Tr={"(":")","\\lparen":"\\rparen","[":"]","\\lbrack":"\\rbrack","\\{":"\\}","\\lbrace":"\\rbrace","\u2987":"\u2988","\\llparenthesis":"\\rrparenthesis","\\lfloor":"\\rfloor","\u230A":"\u230B","\\lceil":"\\rceil","\u2308":"\u2309","\\langle":"\\rangle","\u27E8":"\u27E9","\\lAngle":"\\rAngle","\u27EA":"\u27EB","\\llangle":"\\rrangle","\u2989":"\u298A","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lgroup":"\\rgroup","\u27EE":"\u27EF","\\lmoustache":"\\rmoustache","\u23B0":"\u23B1","\\llbracket":"\\rrbracket","\u27E6":"\u27E7","\\lBrace":"\\rBrace","\u2983":"\u2984"},Xi=new Set(Object.keys(Tr));new Set(Object.values(Tr));let ls=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\u2987","\\llparenthesis","\u2988","\\rrparenthesis","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lAngle","\u27EA","\\rAngle","\u27EB","\\llangle","\u2989","\\rrangle","\u298A","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","\\llbracket","\\rrbracket","\u27E6","\u27E7","\\lBrace","\\rBrace","\u2983","\u2984","/","\\backslash","|","\\vert","\\|","\\Vert","\u2016","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]),Yi=new Set(["}","\\left","\\middle","\\right"]),Yn=e=>e.length>0&&(ls.has(e)||_r[e]||Yi.has(e)),cs=[0,1.2,1.8,2.4,3];function qn(e,t){e.type==="ordgroup"&&e.body.length===1&&(e=e.body[0]);let n=at(e);if(n&&ls.has(n.text))return n.text!=="<"&&n.text!=="\\lt"||(n.text="\u27E8"),n.text!==">"&&n.text!=="\\gt"||(n.text="\u27E9"),n;throw new r(n?`Invalid delimiter '${n.text}' after '${t.funcName}'`:`Invalid delimiter type '${e.type}'`,e)}let Ji=new Set(["/","\\","\\backslash","\u2216","\\vert","|"]),Jn=(e,t,n,i)=>{let c=new E("mo",[ne(e==="."?"":e,t)]);return c.setAttribute("fence","true"),c.setAttribute("form",n),c.setAttribute("stretchy",i?"true":"false"),c};function ds(e){if(!e.body)throw new Error("Bug: The delim ParseNode wasn't fully parsed.")}$({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qn(t[0],e),i={type:"delimsizing",mode:e.parser.mode,size:_r[e.funcName].size,mclass:_r[e.funcName].mclass,delim:n.text},c=e.parser.fetch().text;return c!=="^"&&c!=="_"?i:{type:"ordgroup",mode:"math",body:[i,{type:"ordgroup",mode:"math",body:[]}]}},mathmlBuilder:e=>{let t=[],n=e.delim==="."?"":e.delim;t.push(ne(n,e.mode));let i=new E("mo",t);return e.mclass==="mopen"||e.mclass==="mclose"?i.setAttribute("fence","true"):i.setAttribute("fence","false"),(Ji.has(n)||n.indexOf("arrow")>-1)&&i.setAttribute("stretchy","true"),i.setAttribute("symmetric","true"),i.setAttribute("minsize",cs[e.size]+"em"),i.setAttribute("maxsize",cs[e.size]+"em"),i}}),$({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:qn(t[0],e).text})}),$({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qn(t[0],e),i=e.parser;++i.leftrightDepth;let c=i.parseExpression(!1,"\\right",!0),p=i.fetch();for(;p.text==="\\middle";){i.consume();let v=i.fetch().text;if(!Ne.math[v])throw new r(`Invalid delimiter '${v}' after '\\middle'`);qn({type:"atom",mode:"math",text:v},{funcName:"\\middle"}),c.push({type:"middle",mode:"math",delim:v}),i.consume(),c=c.concat(i.parseExpression(!1,"\\right",!0)),p=i.fetch()}--i.leftrightDepth,i.expect("\\right",!1);let b=Me(i.parseFunction(),"leftright-right");return{type:"leftright",mode:i.mode,body:c,left:n.text,right:b.delim,isStretchy:!0}},mathmlBuilder:(e,t)=>{ds(e);let n=Le(e.body,t),i=Jn(e.left,e.mode,"prefix",!0);n.unshift(i);let c=Jn(e.right,e.mode,"postfix",!0);if(e.body.length>0){let p=e.body[e.body.length-1];p.type!=="color"||p.isTextColor||c.setAttribute("mathcolor",p.color)}return n.push(c),re(n)}}),$({type:"delimiter",names:Array.from(Xi),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:t,token:n})=>{if(e.mode==="text")return{type:"textord",mode:"text",text:t,loc:n.loc};if(!e.settings.wrapDelimiterPairs)return{type:"atom",mode:"math",family:"open",loc:n.loc,text:t};let i=Tr[t],c=e.parseExpression(!1,i,!1);if(e.fetch().text!==i)throw new r("Unmatched delimiter");return e.consume(),{type:"delimiter",mode:e.mode,body:c,left:t,right:i}},mathmlBuilder:(e,t)=>{ds(e);let n=Le(e.body,t),i=Jn(e.left,e.mode,"prefix",!1);n.unshift(i);let c=Jn(e.right,e.mode,"postfix",!1);if(e.body.length>0){let p=e.body[e.body.length-1];p.type!=="color"||p.isTextColor||c.setAttribute("mathcolor",p.color)}return n.push(c),re(n)}}),$({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qn(t[0],e);if(!e.parser.leftrightDepth)throw new r("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},mathmlBuilder:e=>{let t=ne(e.delim,e.mode),n=new E("mo",[t]);return n.setAttribute("stretchy","true"),n.setAttribute("form","infix"),t.text!=="/"&&(n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em")),n}});let Qi=["\\boxed","\\fcolorbox","\\colorbox"],En=(e,t)=>{let n=Qi.includes(e.label)?"mrow":"menclose",i=new E(n,[Oe(e.body,t)]);switch(e.label){case"\\overline":i.setAttribute("notation","top"),i.classes.push("tml-overline");break;case"\\underline":i.setAttribute("notation","bottom"),i.classes.push("tml-underline");break;case"\\cancel":i.setAttribute("notation","updiagonalstrike"),i.children.push(new E("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":i.setAttribute("notation","downdiagonalstrike"),i.children.push(new E("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":i.setAttribute("notation","horizontalstrike"),i.children.push(new E("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":i.setAttribute("notation","updiagonalstrike downdiagonalstrike"),i.children.push(new E("mrow",[],["tml-cancel","tml-xcancel"]));break;case"\\longdiv":i.setAttribute("notation","longdiv"),i.classes.push("longdiv-top"),i.children.push(new E("mrow",[],["longdiv-arc"]));break;case"\\phase":i.setAttribute("notation","phasorangle"),i.classes.push("phasor-bottom"),i.children.push(new E("mrow",[],["phasor-angle"]));break;case"\\textcircled":i.setAttribute("notation","circle"),i.classes.push("circle-pad"),i.children.push(new E("mrow",[],["textcircle"]));break;case"\\angl":i.setAttribute("notation","actuarial"),i.classes.push("actuarial");break;case"\\boxed":i.style.padding="3pt",i.style.border="1px solid",i.setAttribute("scriptlevel","0"),i.setAttribute("displaystyle","true");break;case"\\fbox":i.setAttribute("notation","box"),i.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":i.style.padding="0.3em",e.label==="\\fcolorbox"&&(i.style.border="0.0667em solid "+String(e.borderColor))}return e.backgroundColor&&i.setAttribute("mathbackground",e.backgroundColor),i};$({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},n,i){let c=i[0]&&Me(i[0],"raw").string,p="";if(c){let v=Me(n[0],"raw").string;p=it(c,v)}else p=ht(Me(n[0],"raw").string,e.gullet.macros);let b=n[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,body:b}},mathmlBuilder:En}),$({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},n,i){let c=i[0]&&Me(i[0],"raw").string,p,b="";if(c){let D=Me(n[0],"raw").string,z=Me(n[0],"raw").string;b=it(c,D),p=it(c,z)}else b=ht(Me(n[0],"raw").string,e.gullet.macros),p=ht(Me(n[1],"raw").string,e.gullet.macros);let v=n[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,borderColor:b,body:v}},mathmlBuilder:En}),$({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:t[0]})}),$({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:e,funcName:t},n){let i=n[0];if(i.type!=="ordgroup")throw new r("Invalid environment name",i);let c="";for(let p=0;p<i.body.length;++p)c+=Me(i.body[p],"textord").text;if(t==="\\begin"){if(!Object.prototype.hasOwnProperty.call(K,c))throw new r("No such environment: "+c,i);let p=K[c],{args:b,optArgs:v}=e.parseArguments("\\begin{"+c+"}",p),D={mode:e.mode,envName:c,parser:e},z=p.handler(D,b,v);e.expect("\\end",!1);let se=e.nextToken,ce=Me(e.parseFunction(),"environment");if(ce.name!==c)throw new r(`Mismatch: \\begin{${c}} matched by \\end{${ce.name}}`,se);return z}return{type:"environment",mode:e.mode,name:c,nameGroup:i}}}),$({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},t)=>({type:"envTag",mode:e.mode,body:t[0]}),mathmlBuilder:(e,t)=>new E("mrow")}),$({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,t)=>new E("mrow")});let us=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),ea=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),ta=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),ps=Object.freeze({"\u03F5":119527,\u03D1:119564,\u03F0:119534,\u03C6:119577,\u03F1:119535,\u03D6:119563}),na=Object.freeze({"\u03F5":119643,\u03D1:119680,\u03F0:119650,\u03C6:119693,\u03F1:119651,\u03D6:119679}),hs=Object.freeze({"\u03F5":119701,\u03D1:119738,\u03F0:119708,\u03C6:119751,\u03F1:119709,\u03D6:119737}),ra=Object.freeze({"\u03F5":119759,\u03D1:119796,\u03F0:119766,\u03C6:119809,\u03F1:119767,\u03D6:119795}),sa=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>us[e]||119899,"script-bold":e=>119951,fraktur:e=>ea[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>ta[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>e==="h"?8358:119789,"bold-italic":e=>119841,script:e=>us[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>e==="\u03D5"?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>ps[e]||-51,italic:e=>0,"bold-italic":e=>na[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>hs[e]||116,"sans-serif-bold":e=>hs[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>ra[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),Sn=(e,t)=>{let n=e.codePointAt(0),i=64<n&&n<91?"upperCaseLatin":96<n&&n<123?"lowerCaseLatin":912<n&&n<938?"upperCaseGreek":944<n&&n<970||e==="\u03D5"?"lowerCaseGreek":120545<n&&n<120572||ps[e]?"varGreek":47<n&&n<58?"numeral":"other";return i==="other"?e:String.fromCodePoint(n+sa[i][t](e))},oa=Object.freeze({a:"\u1D00",b:"\u0299",c:"\u1D04",d:"\u1D05",e:"\u1D07",f:"\uA730",g:"\u0262",h:"\u029C",i:"\u026A",j:"\u1D0A",k:"\u1D0B",l:"\u029F",m:"\u1D0D",n:"\u0274",o:"\u1D0F",p:"\u1D18",q:"\u01EB",r:"\u0280",s:"s",t:"\u1D1B",u:"\u1D1C",v:"\u1D20",w:"\u1D21",x:"x",y:"\u028F",z:"\u1D22"}),ia=["mathrm","mathit"],ms=(e,t)=>{let n=e.font,i=t.withFont(n),c=Oe(e.body,i);if(c.children.length===0)return c;if(n==="boldsymbol"&&["mo","mpadded","mrow"].includes(c.type))return c.style.fontWeight="bold",c;if(((v,D)=>{if(!ia.includes(D)||!v.body||v.body.type!=="ordgroup"||v.body.body.length===1||v.body.body[0].type!=="mathord")return!1;for(let z=1;z<v.body.body.length;z++){let se=v.body.body[z].type;if(se!=="mathord"&&(se!=="textord"||isNaN(v.body.body[z].text)))return!1}return!0})(e,n)){let v=c.children[0].children[0].children?c.children[0].children[0]:c.children[0];delete v.attributes.mathvariant;for(let z=1;z<c.children.length;z++)v.children[0].text+=c.children[z].children[0].children?c.children[z].children[0].children[0].text:c.children[z].children[0].text;if(n==="mathit")return v.children[0].text=v.children[0].text.split("").map(z=>Sn(z,"italic")).join(""),v;let D=new E("mpadded",[v]);return D.setAttribute("lspace","0"),D}let p=c.children[0].type==="mo";for(let v=1;v<c.children.length;v++)c.children[v].type==="mo"&&n==="boldsymbol"&&(c.children[v].style.fontWeight="bold"),c.children[v].type!=="mi"&&(p=!1),(c.children[v].attributes&&c.children[v].attributes.mathvariant||"")!=="normal"&&(p=!1);if(!p)return c;let b=c.children[0];for(let v=1;v<c.children.length;v++)b.children.push(c.children[v].children[0]);if(b.attributes.mathvariant&&b.attributes.mathvariant==="normal"){let v=new E("mtext",new Ie("\u200B"));return new E("mrow",[v,b])}return b},fs={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};$({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\up@greek","\\boldsymbol","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathsfit","\\mathtt","\\Bbb","\\bm","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let i=he(n[0]),c=t;return c in fs&&(c=fs[c]),{type:"font",mode:e.mode,font:c.slice(1),body:i}},mathmlBuilder:ms}),$({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:n},i)=>{let{mode:c}=e,p=e.parseExpression(!0,n,!0);return{type:"font",mode:c,font:`math${t.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:p}}},mathmlBuilder:ms});let gs=["display","text","script","scriptscript"],aa={auto:-1,display:0,text:0,script:1,scriptscript:2},Cr=(e,t)=>{t=((p,b)=>{let v=b;if(p==="display"){let D=v.level>=Gt?Ot:ut;v=v.withLevel(D)}else p==="text"&&v.level===ut?v=v.withLevel(Ot):p==="auto"?v=v.incrementLevel():p==="script"?v=v.withLevel(Gt):p==="scriptscript"&&(v=v.withLevel(xn));return v})(e.scriptLevel,t);let n=Oe(e.numer,t),i=Oe(e.denom,t);t.level===3&&(n.style.mathDepth="2",n.setAttribute("scriptlevel","2"),i.style.mathDepth="2",i.setAttribute("scriptlevel","2"));let c=new E("mfrac",[n,i]);if(e.hasBarLine){if(e.barSize){let p=ot(e.barSize,t);c.setAttribute("linethickness",p.number+p.unit)}}else c.setAttribute("linethickness","0px");if(e.leftDelim!=null||e.rightDelim!=null){let p=[];if(e.leftDelim!=null){let b=new E("mo",[new Ie(e.leftDelim.replace("\\",""))]);b.setAttribute("fence","true"),p.push(b)}if(p.push(c),e.rightDelim!=null){let b=new E("mo",[new Ie(e.rightDelim.replace("\\",""))]);b.setAttribute("fence","true"),p.push(b)}c=re(p)}return e.scriptLevel!=="auto"&&(c=new E("mstyle",[c]),c.setAttribute("displaystyle",String(e.scriptLevel==="display")),c.setAttribute("scriptlevel",aa[e.scriptLevel])),c};$({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let i=n[0],c=n[1],p=!1,b=null,v=null,D="auto";switch(t){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":p=!0;break;case"\\\\atopfrac":p=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":b="(",v=")";break;case"\\\\bracefrac":b="\\{",v="\\}";break;case"\\\\brackfrac":b="[",v="]";break;default:throw new Error("Unrecognized genfrac command")}return t==="\\cfrac"||t.startsWith("\\d")?D="display":t.startsWith("\\t")&&(D="text"),{type:"genfrac",mode:e.mode,continued:!1,numer:i,denom:c,hasBarLine:p,leftDelim:b,rightDelim:v,scriptLevel:D,barSize:null}},mathmlBuilder:Cr}),$({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:n}){let i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:n}}});let bs=function(e){let t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};$({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){let n=t[4],i=t[5],c=he(t[0]),p=c.type==="atom"&&c.family==="open"?bs(c.text):null,b=he(t[1]),v=b.type==="atom"&&b.family==="close"?bs(b.text):null,D=Me(t[2],"size"),z,se=null;D.isBlank?z=!0:(se=D.value,z=se.number>0);let ce="auto",ee=t[3];if(ee.type==="ordgroup"){if(ee.body.length>0){let et=Me(ee.body[0],"textord");ce=gs[Number(et.text)]}}else ee=Me(ee,"textord"),ce=gs[Number(ee.text)];return{type:"genfrac",mode:e.mode,numer:n,denom:i,continued:!1,hasBarLine:z,barSize:se,leftDelim:p,rightDelim:v,scriptLevel:ce}},mathmlBuilder:Cr}),$({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:t,token:n},i)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:Me(i[0],"size").value,token:n})}),$({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},n)=>{let i=n[0],c=function(v){if(!v)throw new Error("Expected non-null, but got "+String(v));return v}(Me(n[1],"infix").barSize),p=n[2],b=c.number>0;return{type:"genfrac",mode:e.mode,numer:i,denom:p,continued:!1,hasBarLine:b,barSize:c,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Cr}),$({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},t)=>({type:"hbox",mode:e.mode,body:oe(t[0])}),mathmlBuilder(e,t){let n=t.withLevel(Ot),i=Qe(e.body,n);return Je(i)}}),$({type:"horizBracket",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>({type:"horizBracket",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:n[0]}),mathmlBuilder:(e,t)=>{let n=J(e.label);return n.style["math-depth"]=0,new E(e.isOver?"mover":"munder",[Oe(e.base,t),n])}}),$({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:e,funcName:t,token:n},i)=>{let c=Me(i[0],"raw").string,p=i[1];if(e.settings.strict)throw new r(`Function "${t}" is disabled in strict mode`,n);let b,v={};switch(t){case"\\class":v.class=c,b={command:"\\class",class:c};break;case"\\id":v.id=c,b={command:"\\id",id:c};break;case"\\style":v.style=c,b={command:"\\style",style:c};break;case"\\data":{let D=c.split(",");for(let z=0;z<D.length;z++){let se=D[z].split("=");if(se.length!==2)throw new r("Error parsing key-value for \\data");v["data-"+se[0].trim()]=se[1].trim()}b={command:"\\data",attributes:v};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(b))throw new r(`Function "${t}" is not trusted`,n);return{type:"html",mode:e.mode,attributes:v,body:oe(p)}},mathmlBuilder:(e,t)=>{let n=Qe(e.body,t),i=[];e.attributes.class&&i.push(...e.attributes.class.trim().split(/\s+/)),n.classes=i;for(let c in e.attributes)c!=="class"&&Object.prototype.hasOwnProperty.call(e.attributes,c)&&n.setAttribute(c,e.attributes[c]);return n}});let Nr=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};{let t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new r("Invalid size: '"+e+"' in \\includegraphics");let n={number:+(t[1]+t[2]),unit:t[3]};if(!Ct(n))throw new r("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n}};$({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:e,token:t},n,i)=>{let c={number:0,unit:"em"},p={number:.9,unit:"em"},b={number:0,unit:"em"},v="";if(i[0]){let z=Me(i[0],"raw").string.split(",");for(let se=0;se<z.length;se++){let ce=z[se].split("=");if(ce.length===2){let ee=ce[1].trim();switch(ce[0].trim()){case"alt":v=ee;break;case"width":c=Nr(ee);break;case"height":p=Nr(ee);break;case"totalheight":b=Nr(ee);break;default:throw new r("Invalid key: '"+ce[0]+"' in \\includegraphics.")}}}}let D=Me(n[0],"url").url;if(v===""&&(v=D,v=v.replace(/^.*[\\/]/,""),v=v.substring(0,v.lastIndexOf("."))),!e.settings.isTrusted({command:"\\includegraphics",url:D}))throw new r('Function "\\includegraphics" is not trusted',t);return{type:"includegraphics",mode:e.mode,alt:v,width:c,height:p,totalheight:b,src:D}},mathmlBuilder:(e,t)=>{let n=ot(e.height,t),i={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===n.unit&&e.totalheight.number>n.number&&(i.number=e.totalheight.number-n.number,i.unit=n.unit);let c=0;e.width.number>0&&(c=ot(e.width,t));let p={height:n.number+i.number+"em"};c.number>0&&(p.width=c.number+c.unit),i.number>0&&(p.verticalAlign=-i.number+i.unit);let b=new Xe(e.src,e.alt,p);return b.height=n,b.depth=i,new E("mtext",[b])}}),$({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:e,funcName:t,token:n},i){let c=Me(i[0],"size");if(e.settings.strict){let p=t[1]==="m",b=c.value.unit==="mu";if(p){if(!b)throw new r(`LaTeX's ${t} supports only mu units, not ${c.value.unit} units`,n);if(e.mode!=="math")throw new r(`LaTeX's ${t} works only in math mode`,n)}else if(b)throw new r(`LaTeX's ${t} doesn't support mu units`,n)}return{type:"kern",mode:e.mode,dimension:c.value}},mathmlBuilder(e,t){let n=ot(e.dimension,t),i=n.number>0&&n.unit==="em"?ys(n.number):"";if(e.mode==="text"&&i.length>0){let c=new Ie(i);return new E("mtext",[c])}if(n.number>=0){let c=new E("mspace");return c.setAttribute("width",n.number+n.unit),c}{let c=new E("mrow");return c.style.marginLeft=n.number+n.unit,c}}});let ys=function(e){return e>=.05555&&e<=.05556?"\u200A":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200A":""},ws=/[^A-Za-z_0-9-]/g;$({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},t)=>({type:"label",mode:e.mode,string:t[0].string.replace(ws,"")}),mathmlBuilder(e,t){let n=new E("mrow",[],["tml-label"]);return e.string.length>0&&n.setLabel(e.string),n}});let la=["\\clap","\\llap","\\rlap"];$({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:t,token:n},i)=>{if(la.includes(t)){if(e.settings.strict&&e.mode!=="text")throw new r(`{${t}} can be used only in text mode.
92
- Try \\math${t.slice(1)}`,n);t=t.slice(1)}else t=t.slice(5);let c=i[0];return{type:"lap",mode:e.mode,alignment:t,body:c}},mathmlBuilder:(e,t)=>{let n;if(e.alignment==="llap"){let p=Le(oe(e.body),t),b=new E("mphantom",p);n=new E("mpadded",[b]),n.setAttribute("width","0.1px")}let i=Oe(e.body,t),c;if(e.alignment==="llap"?(i.style.position="absolute",i.style.right="0",i.style.bottom="0",c=new E("mpadded",[n,i])):c=new E("mpadded",[i]),e.alignment==="rlap")e.body.body.length>0&&e.body.body[0].type==="genfrac"&&c.setAttribute("lspace","0.16667em");else{let p=e.alignment==="llap"?"-1":"-0.5";c.setAttribute("lspace",p+"width"),e.alignment==="llap"?c.style.position="relative":(c.style.display="flex",c.style.justifyContent="center")}return c.setAttribute("width","0.1px"),c}}),$({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},n){let i=t.mode;t.switchMode("math");let c=e==="\\("?"\\)":"$",p=t.parseExpression(!1,c);return t.expect(c),t.switchMode(i),{type:"ordgroup",mode:t.mode,body:p}}}),$({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new r(`Mismatched ${e.funcName}`,t)}}),$({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:oe(t[0]),text:oe(t[1]),script:oe(t[2]),scriptscript:oe(t[3])}),mathmlBuilder:(e,t)=>{let n=((i,c)=>{switch(c.level){case ut:return i.display;case Ot:return i.text;case Gt:return i.script;case xn:return i.scriptscript;default:return i.text}})(e,t);return Qe(n,t)}});let ca=["text","textord","mathord","atom"];function xs(e,t){let n,i=Le(e.body,t);if(e.mclass==="minner")n=new E("mpadded",i);else if(e.mclass==="mord")e.isCharacterBox||i[0].type==="mathord"?(n=i[0],n.type="mi",n.children.length===1&&n.children[0].text&&n.children[0].text==="\u2207"&&n.setAttribute("mathvariant","normal")):n=new E("mi",i);else{n=new E("mrow",i),e.mustPromote?(n=i[0],n.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&n.setAttribute("mathvariant","italic")):n=new E("mrow",i);let c=t.level<2;n.type==="mrow"?c&&(e.mclass==="mbin"?(n.children.unshift(st(.2222)),n.children.push(st(.2222))):e.mclass==="mrel"?(n.children.unshift(st(.2778)),n.children.push(st(.2778))):e.mclass==="mpunct"?n.children.push(st(.1667)):e.mclass==="minner"&&(n.children.unshift(st(.0556)),n.children.push(st(.0556)))):e.mclass==="mbin"?(n.attributes.lspace=c?"0.2222em":"0",n.attributes.rspace=c?"0.2222em":"0"):e.mclass==="mrel"?(n.attributes.lspace=c?"0.2778em":"0",n.attributes.rspace=c?"0.2778em":"0"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace=c?"0.1667em":"0"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&c&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em"),e.mclass!=="mopen"&&e.mclass!=="mclose"&&(delete n.attributes.stretchy,delete n.attributes.form)}return n}$({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},n){let i=n[0],c=w(i),p=!0,b={type:"mathord",text:"",mode:e.mode},v=i.body?i.body:[i];for(let D of v){if(!ca.includes(D.type)){p=!1;break}Ne[e.mode][D.text]?b.text+=Ne[e.mode][D.text].replace:D.text?b.text+=D.text:D.body&&D.body.map(z=>{b.text+=z.text})}return p&&t==="\\mathord"&&b.type==="mathord"&&b.text.length>1?b:{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:oe(p?b:i),isCharacterBox:c,mustPromote:p}},mathmlBuilder:xs});let vs=e=>{let t=e.type==="ordgroup"&&e.body.length&&e.body.length===1?e.body[0]:e;if(t.type==="atom"){let n=e.body.length>0&&e.body[0].text&&Ne.math[e.body[0].text]?Ne.math[e.body[0].text].group:t.family;return n==="bin"||n==="rel"?"m"+n:"mord"}return"mord"};$({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},t)=>({type:"mclass",mode:e.mode,mclass:vs(t[0]),body:oe(t[1]),isCharacterBox:w(t[1])})}),$({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},n){let i=n[1],c=n[0],p;p=t!=="\\stackrel"?vs(i):"mrel";let b={type:p==="mrel"||p==="mbin"?"op":"ordgroup",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!=="\\stackrel",body:oe(i)};return{type:"supsub",mode:c.mode,stack:!0,base:b,sup:t==="\\underset"?null:c,sub:t==="\\underset"?c:null}},mathmlBuilder:xs});let Qn=(e,t,n)=>{if(!e)return n;let i=Oe(e,t);return i.type==="mrow"&&i.children.length===0?n:i};$({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:e,funcName:t,token:n},i){if(i[2].body.length===0)throw new r(t+"cannot parse an empty base.");let c=i[2].body[0];if(e.settings.strict&&t==="\\sideset"&&!c.symbol)throw new r("The base of \\sideset must be a big operator. Try \\prescript.");if(i[0].body.length>0&&i[0].body[0].type!=="supsub"||i[1].body.length>0&&i[1].body[0].type!=="supsub")throw new r("\\sideset can parse only subscripts and superscripts in its first two arguments",n);let p=i[0].body.length>0?i[0].body[0]:null,b=i[1].body.length>0?i[1].body[0]:null;return p||b?p?{type:"multiscript",mode:e.mode,isSideset:t==="\\sideset",prescripts:p,postscripts:b,base:c}:{type:"styling",mode:e.mode,scriptLevel:"text",body:[{type:"supsub",mode:e.mode,base:c,sup:b.sup,sub:b.sub}]}:c},mathmlBuilder(e,t){let n=Oe(e.base,t),i=new E("mprescripts"),c=new E("none"),p=[],b=Qn(e.prescripts.sub,t,c),v=Qn(e.prescripts.sup,t,c);return e.isSideset&&(b.setAttribute("style","text-align: left;"),v.setAttribute("style","text-align: left;")),e.postscripts?p=[n,Qn(e.postscripts.sub,t,c),Qn(e.postscripts.sup,t,c),i,b,v]:p=[n,i,b,v],new E("mmultiscripts",p)}}),$({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){let n=w(t[0]),i;return n?(i=oe(t[0]),i[0].text.charAt(0)==="\\"&&(i[0].text=Ne.math[i[0].text].replace),i[0].text=i[0].text.slice(0,1)+"\u0338"+i[0].text.slice(1)):i=[{type:"textord",mode:"math",text:"\u0338"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]],{type:"not",mode:e.mode,body:i,isCharacterBox:n}},mathmlBuilder(e,t){return e.isCharacterBox?Le(e.body,t,!0)[0]:Qe(e.body,t)}});let da=["textord","mathord","atom"],ua=["\\smallint"],$r=["textord","mathord","ordgroup","close","leftright","font"],ks=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},Fn=(e,t)=>{let n;if(e.symbol)n=new E("mo",[ne(e.name,e.mode)]),ua.includes(e.name)?n.setAttribute("largeop","false"):n.setAttribute("movablelimits","false"),e.fromMathOp&&ks(n);else if(e.body)n=new E("mo",Le(e.body,t)),e.fromMathOp&&ks(n);else if(n=new E("mi",[new Ie(e.name.slice(1))]),!e.parentIsSupSub){let i=[n,new E("mo",[ne("\u2061","text")])];if(e.needsLeadingSpace){let c=new E("mspace");c.setAttribute("width","0.1667em"),i.unshift(c)}if(!e.isFollowedByDelimiter){let c=new E("mspace");c.setAttribute("width","0.1667em"),i.push(c)}n=new E("mrow",i)}return n},pa={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A05":"\\bigsqcap","\u2A06":"\\bigsqcup","\u2A03":"\\bigcupdot","\u2A07":"\\bigdoublevee","\u2A08":"\\bigdoublewedge","\u2A09":"\\bigtimes"};$({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcupplus","\\bigcupdot","\\bigcap","\\bigcup","\\bigdoublevee","\\bigdoublewedge","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcap","\\bigsqcup","\\bigtimes","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A03","\u2A04","\u2A05","\u2A06","\u2A07","\u2A08","\u2A09"],props:{numArgs:0},handler:({parser:e,funcName:t},n)=>{let i=t;return i.length===1&&(i=pa[i]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:i}},mathmlBuilder:Fn}),$({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{let n=t[0],i=n.body?n.body:[n],c=i.length===1&&da.includes(i[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:c,fromMathOp:!0,stack:!1,name:c?i[0].text:null,body:c?null:oe(n)}},mathmlBuilder:Fn});let ha={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint","\u2231":"\\intclockwise","\u2232":"\\varointclockwise","\u2A0C":"\\iiiint","\u2A0D":"\\intbar","\u2A0E":"\\intBar","\u2A0F":"\\fint","\u2A12":"\\rppolint","\u2A13":"\\scpolint","\u2A15":"\\pointint","\u2A16":"\\sqint","\u2A17":"\\intlarhk","\u2A18":"\\intx","\u2A19":"\\intcap","\u2A1A":"\\intcup"};$({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\sgn","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,i=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Yn(i),needsLeadingSpace:n.length>0&&$r.includes(n),name:t}},mathmlBuilder:Fn}),$({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,i=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Yn(i),needsLeadingSpace:n.length>0&&$r.includes(n),name:t}},mathmlBuilder:Fn}),$({type:"op",names:["\\int","\\iint","\\iiint","\\iiiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\intbar","\\intBar","\\fint","\\rppolint","\\scpolint","\\pointint","\\sqint","\\intlarhk","\\intx","\\intcap","\\intcup","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230","\u2231","\u2232","\u2A0C","\u2A0D","\u2A0E","\u2A0F","\u2A12","\u2A13","\u2A15","\u2A16","\u2A17","\u2A18","\u2A19","\u2A1A"],props:{numArgs:0,allowedInArgument:!0},handler({parser:e,funcName:t}){let n=t;return n.length===1&&(n=ha[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:Fn}),$({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let i=n[0],c=e.prevAtomType,p=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:oe(i),alwaysHandleSupSub:t==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:Yn(p),needsLeadingSpace:c.length>0&&$r.includes(c)}},mathmlBuilder:(e,t)=>{let n,i=Le(e.body,t.withFont("mathrm")),c=!0;for(let p=0;p<i.length;p++){let b=i[p];if(b instanceof E)switch(((b.type==="mrow"||b.type==="mpadded")&&b.children.length===1&&b.children[0]instanceof E||b.type==="mrow"&&b.children.length===2&&b.children[0]instanceof E&&b.children[1]instanceof E&&b.children[1].type==="mspace"&&!b.children[1].attributes.width&&b.children[1].children.length===0)&&(b=b.children[0]),b.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(b.attributes.width){let v=b.attributes.width.replace("em",""),D=ys(Number(v));D===""?c=!1:i[p]=new E("mtext",[new Ie(D)])}break;case"mo":{let v=b.children[0];b.children.length===1&&v instanceof Ie?v.text=v.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):c=!1;break}default:c=!1}else c=!1}if(c){let p=i.map(b=>b.toText()).join("");i=[new Ie(p)]}else if(i.length===1&&["mover","munder"].includes(i[0].type)&&(i[0].children[0].type==="mi"||i[0].children[0].type==="mtext")){if(i[0].children[0].type="mi",e.parentIsSupSub)return new E("mrow",i);{let p=new E("mo",[ne("\u2061","text")]);return xe([i[0],p])}}if(c?(n=new E("mi",i),i[0].text.length===1&&n.setAttribute("mathvariant","normal")):n=new E("mrow",i),!e.parentIsSupSub){let p=[n,new E("mo",[ne("\u2061","text")])];if(e.needsLeadingSpace){let b=new E("mspace");b.setAttribute("width","0.1667em"),p.unshift(b)}if(!e.isFollowedByDelimiter){let b=new E("mspace");b.setAttribute("width","0.1667em"),p.push(b)}return xe(p)}return n}}),L("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),q({type:"ordgroup",mathmlBuilder:(e,t)=>Qe(e.body,t,e.semisimple)}),$({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"phantom",mode:e.mode,body:oe(n)}},mathmlBuilder:(e,t)=>{let n=Le(e.body,t);return new E("mphantom",n)}}),$({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"hphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=Le(oe(e.body),t),i=new E("mphantom",n),c=new E("mpadded",[i]);return c.setAttribute("height","0px"),c.setAttribute("depth","0px"),c}}),$({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"vphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=Le(oe(e.body),t),i=new E("mphantom",n),c=new E("mpadded",[i]);return c.setAttribute("width","0.1px"),c}}),$({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>({type:"pmb",mode:e.mode,body:oe(t[0])}),mathmlBuilder(e,t){let n=Le(e.body,t),i=qe(n);return i.setAttribute("style","font-weight:bold"),i}});let Es=(e,t)=>{let n=t.withLevel(Ot),i=new E("mpadded",[Oe(e.body,n)]),c=ot(e.dy,t);return i.setAttribute("voffset",c.number+c.unit),c.number>0?i.style.padding=c.number+c.unit+" 0 0 0":i.style.padding="0 0 "+Math.abs(c.number)+c.unit+" 0",i};$({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},n){let i=Me(n[0],"size").value;t==="\\lower"&&(i.number*=-1);let c=n[1];return{type:"raise",mode:e.mode,dy:i,body:c}},mathmlBuilder:Es}),$({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},n){let i=Me(n[0],"size").value,c=n[1];return{type:"raise",mode:e.mode,dy:i,body:c}},mathmlBuilder:Es}),$({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:t},n)=>({type:"ref",mode:e.mode,funcName:t,string:n[0].string.replace(ws,"")}),mathmlBuilder(e,t){let n=e.funcName==="\\ref"?["tml-ref"]:["tml-ref","tml-eqref"];return new Ce("#"+e.string,n,null)}}),$({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"reflect",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){let n=Oe(e.body,t);return n.style.transform="scaleX(-1)",n}}),$({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),$({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,n){let i=n[0],c=Me(t[0],"size"),p=Me(t[1],"size");return{type:"rule",mode:e.mode,shift:i&&Me(i,"size").value,width:c.value,height:p.value}},mathmlBuilder(e,t){let n=ot(e.width,t),i=ot(e.height,t),c=e.shift?ot(e.shift,t):{number:0,unit:"em"},p=t.color&&t.getColor()||"black",b=new E("mspace");if(n.number>0&&i.number>0&&b.setAttribute("mathbackground",p),b.setAttribute("width",n.number+n.unit),b.setAttribute("height",i.number+i.unit),c.number===0)return b;let v=new E("mpadded",[b]);return c.number>=0?v.setAttribute("height","+"+c.number+c.unit):(v.setAttribute("height",c.number+c.unit),v.setAttribute("depth","+"+-c.number+c.unit)),v.setAttribute("voffset",c.number+c.unit),v}});let Ss=/^[0-9]$/,ma={0:"\u2080",1:"\u2081",2:"\u2082",3:"\u2083",4:"\u2084",5:"\u2085",6:"\u2086",7:"\u2087",8:"\u2088",9:"\u2089"},fa={0:"\u2070",1:"\xB9",2:"\xB2",3:"\xB3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079"};$({type:"sfrac",names:["\\sfrac"],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},t){let n="";for(let c of t[0].body){if(c.type!=="textord"||!Ss.test(c.text))throw new r("Numerator must be an integer.",c);n+=c.text}let i="";for(let c of t[1].body){if(c.type!=="textord"||!Ss.test(c.text))throw new r("Denominator must be an integer.",c);i+=c.text}return{type:"sfrac",mode:e.mode,numerator:n,denominator:i}},mathmlBuilder(e,t){let n=e.numerator.split("").map(p=>fa[p]).join(""),i=e.denominator.split("").map(p=>ma[p]).join(""),c=new Ie(n+"\u2044"+i,e.mode,t);return new E("mn",[c],["special-fraction"])}});let As={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};$({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:n},i)=>{n.settings.strict&&n.mode==="math"&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);let c=n.parseExpression(!1,e,!0);return{type:"sizing",mode:n.mode,funcName:t,body:c}},mathmlBuilder:(e,t)=>{let n=t.withFontSize(As[e.funcName]),i=Le(e.body,n),c=qe(i),p=(As[e.funcName]/t.fontSize).toFixed(4);return c.setAttribute("mathsize",p+"em"),c}}),$({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,n)=>{let i=!1,c=!1,p=n[0]&&Me(n[0],"ordgroup");if(p){let v="";for(let D=0;D<p.body.length;++D)if(v=p.body[D].text,v==="t")i=!0;else{if(v!=="b"){i=!1,c=!1;break}c=!0}}else i=!0,c=!0;let b=t[0];return{type:"smash",mode:e.mode,body:b,smashHeight:i,smashDepth:c}},mathmlBuilder:(e,t)=>{let n=new E("mpadded",[Oe(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});let ga=["a","c","e","\u0131","m","n","o","r","s","u","v","w","x","z","\u03B1","\u03B5","\u03B9","\u03BA","\u03BD","\u03BF","\u03C0","\u03C3","\u03C4","\u03C5","\u03C9","\\alpha","\\epsilon","\\iota","\\kappa","\\nu","\\omega","\\pi","\\tau","\\omega"];$({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,n){let i=n[0],c=t[0];return c.body&&c.body.length===1&&c.body[0].text&&ga.includes(c.body[0].text)&&c.body.push({type:"rule",mode:"math",shift:null,width:{number:0,unit:"pt"},height:{number:.5,unit:"em"}}),{type:"sqrt",mode:e.mode,body:c,index:i}},mathmlBuilder(e,t){let{body:n,index:i}=e;return i?new E("mroot",[Oe(n,t),Oe(i,t.incrementLevel())]):new E("msqrt",[Oe(n,t)])}});let ba={display:0,text:1,script:2,scriptscript:3},ya={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};$({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:n},i){let c=n.parseExpression(!0,e,!0),p=t.slice(1,t.length-5);return{type:"styling",mode:n.mode,scriptLevel:p,body:c}},mathmlBuilder(e,t){let n=t.withLevel(ba[e.scriptLevel]),i=Le(e.body,n),c=qe(i),p=ya[e.scriptLevel];return c.setAttribute("scriptlevel",p[0]),c.setAttribute("displaystyle",p[1]),c}});let wa=/^m(over|under|underover)$/;q({type:"supsub",mathmlBuilder(e,t){let n,i,c=!1,p=!1,b=!1,v=!1;e.base&&e.base.type==="horizBracket"&&(i=!!e.sup,i===e.base.isOver&&(c=!0,n=e.base.isOver)),!e.base||e.stack||e.base.type!=="op"&&e.base.type!=="operatorname"||(e.base.parentIsSupSub=!0,p=!e.base.symbol,b=p&&!e.isFollowedByDelimiter,v=e.base.needsLeadingSpace);let D=e.stack&&e.base.body.length===1?[Oe(e.base.body[0],t)]:[Oe(e.base,t)],z=t.inSubOrSup();if(e.sub){let ee=Oe(e.sub,z);t.level===3&&ee.setAttribute("scriptlevel","2"),D.push(ee)}if(e.sup){let ee=Oe(e.sup,z);if(t.level===3&&ee.setAttribute("scriptlevel","2"),e.base&&e.base.text&&e.base.text.length===1){let et=e.base.text;"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(et)>-1?ee.classes.push("tml-sml-pad"):"BCEFGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(et)>-1?ee.classes.push("tml-med-pad"):"AJdf\u0394\u039B".indexOf(et)>-1&&ee.classes.push("tml-lrg-pad")}D.push(ee)}let se;if(c)se=n?"mover":"munder";else if(e.sub)if(e.sup){let ee=e.base;se=ee&&(ee.type==="op"&&ee.limits||ee.type==="multiscript")&&(t.level===ut||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(t.level===ut||ee.limits)?"munderover":"msubsup"}else{let ee=e.base;se=e.stack||ee&&ee.type==="op"&&ee.limits&&(t.level===ut||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(ee.limits||t.level===ut)?"munder":"msub"}else{let ee=e.base;se=ee&&ee.type==="op"&&ee.limits&&(t.level===ut||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(ee.limits||t.level===ut)?"mover":"msup"}let ce=new E(se,D);if(p){let ee=new E("mo",[ne("\u2061","text")]);if(v){let et=new E("mspace");et.setAttribute("width","0.1667em"),ce=xe([et,ce,ee])}else ce=xe([ce,ee]);if(b){let et=new E("mspace");et.setAttribute("width","0.1667em"),ce.children.push(et)}}else wa.test(se)&&(ce=new E("mrow",[ce]));return ce}});let xa=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],va=["\\Rsh","\\Lsh","\\restriction"];q({type:"atom",mathmlBuilder(e,t){let n=new E("mo",[ne(e.text,e.mode)]);if(e.family==="punct")n.setAttribute("separator","true");else if(e.family==="open"||e.family==="close")e.family==="open"?(n.setAttribute("form","prefix"),n.setAttribute("stretchy","false")):e.family==="close"&&(n.setAttribute("form","postfix"),n.setAttribute("stretchy","false"));else if(e.text==="\\mid")n.setAttribute("lspace","0.22em"),n.setAttribute("rspace","0.22em"),n.setAttribute("stretchy","false");else if(e.family==="rel"&&(i=>{if(i.length===1){let c=i.codePointAt(0);return 8591<c&&c<8704}return i.indexOf("arrow")>-1||i.indexOf("harpoon")>-1||va.includes(i)})(e.text))n.setAttribute("stretchy","false");else if(xa.includes(e.text))n.setAttribute("mathsize","70%");else if(e.text===":")n.attributes.lspace="0.2222em",n.attributes.rspace="0.2222em";else if(e.needsSpacing)return e.family==="bin"?new E("mrow",[st(.222),n,st(.222)]):new E("mrow",[st(.2778),n,st(.2778)]);return n}});let _s={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},Ts=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsc")return"normal";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"sans-serif-bold":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";let n=t.font;if(!n||n==="mathnormal")return null;let i=e.mode;switch(n){case"mathit":case"greekItalic":return"italic";case"mathrm":{let p=e.text.codePointAt(0);return 939<p&&p<975?"italic":"normal"}case"up@greek":return"normal";case"boldsymbol":case"mathboldsymbol":return"bold-italic";case"mathbf":return"bold";case"mathbb":return"double-struck";case"mathfrak":return"fraktur";case"mathscr":case"mathcal":return"script";case"mathsf":return"sans-serif";case"mathsfit":return"sans-serif-italic";case"mathtt":return"monospace"}let c=e.text;return Ne[i][c]&&Ne[i][c].replace&&(c=Ne[i][c].replace),Object.prototype.hasOwnProperty.call(_s,n)?_s[n]:null},ka=/^\d(?:[\d,.]*\d)?$/,Ea=/[A-Ba-z]/,Sa=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);q({type:"mathord",mathmlBuilder(e,t){let n=ne(e.text,e.mode,t),i=n.text.codePointAt(0),c=912<i&&i<938?"normal":"italic",p=Ts(e,t)||c;if(p==="script")return n.text=Sn(n.text,p),new E("mi",[n],[t.font]);p!=="italic"&&(n.text=Sn(n.text,p));let b=new E("mi",[n]);if(p==="normal"&&(b.setAttribute("mathvariant","normal"),n.text.length===1)){let v=new E("mspace",[]);b=new E("mrow",[b,v])}return b}}),q({type:"textord",mathmlBuilder(e,t){let n=e.text,i=n.codePointAt(0);t.fontFamily==="textsc"&&96<i&&i<123&&(n=oa[n]);let c=ne(n,e.mode,t),p=Ts(e,t)||"normal",b;if(ka.test(e.text)){let v=e.mode==="text"?"mtext":"mn";if(p==="italic"||p==="bold-italic")return((D,z,se)=>{let ce=new E(se,[D]),ee=new E("mstyle",[ce]);return ee.style["font-style"]="italic",ee.style["font-family"]="Cambria, 'Times New Roman', serif",z==="bold-italic"&&(ee.style["font-weight"]="bold"),ee})(c,p,v);p!=="normal"&&(c.text=c.text.split("").map(D=>Sn(D,p)).join("")),b=new E(v,[c])}else if(e.mode==="text")p!=="normal"&&(c.text=Sn(c.text,p)),b=new E("mtext",[c]);else if(Sa.has(e.text))b=new E("mo",[c]),b.classes.push("tml-prime");else{let v=c.text;p!=="italic"&&(c.text=Sn(c.text,p)),b=new E("mi",[c]),c.text===v&&Ea.test(v)&&b.setAttribute("mathvariant","italic")}return b}});let Aa={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},_a={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};q({type:"spacing",mathmlBuilder(e,t){let n;if(Object.prototype.hasOwnProperty.call(_a,e.text))n=new E("mtext",[new Ie("\xA0")]);else{if(!Object.prototype.hasOwnProperty.call(Aa,e.text))throw new r(`Unknown type of space "${e.text}"`);n=new E("mo"),e.text==="\\nobreak"&&n.setAttribute("linebreak","nobreak")}return n}}),q({type:"tag"});let Cs={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Ns={"\\textbf":"textbf","\\textmd":"textmd"},Ta={"\\textit":"textit","\\textup":"textup"};$({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textsc","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"text",mode:e.mode,body:oe(i),font:t}},mathmlBuilder(e,t){let n=((c,p)=>{let b=c.font;return b?Cs[b]?p.withTextFontFamily(Cs[b]):Ns[b]?p.withTextFontWeight(Ns[b]):b==="\\emph"?p.fontShape==="textit"?p.withTextFontShape("textup"):p.withTextFontShape("textit"):p.withTextFontShape(Ta[b]):p})(e,t),i=Qe(e.body,n);return Je(i)}}),$({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},t)=>({type:"vcenter",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){let n=new E("mtd",[Oe(e.body,t)]);n.style.padding="0";let i=new E("mtr",[n]);return new E("mtable",[i])}}),$({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new r("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){let n=new Ie(Ca(e)),i=new E("mtext",[n]);return i.setAttribute("mathvariant","monospace"),i}});let Ca=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),fn=M,$s=`[ \r
93
- ]`,Na=`(\\\\[a-zA-Z@]+)${$s}*`,Or="[\u0300-\u036F]",Os=new RegExp(`${Or}+$`),$a=`(${$s}+)|\\\\(
91
+ }`),ve=(e,t)=>{let n="";if(e==="HTML"){if(!bn.test(t))throw new r("Invalid HTML input.");n=t}else if(e==="RGB"){if(!yn.test(t))throw new r("Invalid RGB input.");t.split(",").map(a=>{n+=H(Number(a.trim()))})}else{if(!wn.test(t))throw new r("Invalid rbg input.");t.split(",").map(a=>{let c=Number(a.trim());if(c>1)throw new r("Color rgb input must be < 1.");n+=H(Number((255*c).toFixed(0)))})}return n.charAt(0)!=="#"&&(n="#"+n),n},Ue=(e,t,n)=>{let a=`\\\\color@${e}`;if(!On.exec(e))throw new r("Invalid color: '"+e+"'",n);return v.test(e)?"#"+e:(e.charAt(0)==="#"||(t.has(a)?e=t.get(a).tokens[0].text:G[e]&&(e=G[e])),e)},Ct=(e,t)=>{let n=tt(e.body,t.withColor(e.color));return n.length===0&&n.push(new _("mrow")),n=n.map(a=>(a.style.color=e.color,a)),at(n)};C({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},n,a){let c=a[0]&&te(a[0],"raw").string,p="";if(c){let x=te(n[0],"raw").string;p=ve(c,x)}else p=Ue(te(n[0],"raw").string,e.gullet.macros,t);let g=n[1];return{type:"color",mode:e.mode,color:p,isTextColor:!0,body:ge(g)}},mathmlBuilder:Ct}),C({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:n},a,c){let p=c[0]&&te(c[0],"raw").string,g="";if(p){let q=te(a[0],"raw").string;g=ve(p,q)}else g=Ue(te(a[0],"raw").string,e.gullet.macros,n);let x=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:g,isTextColor:!1,body:x}},mathmlBuilder:Ct}),C({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:e,funcName:t,token:n},a){let c=te(a[0],"raw").string;if(!/^[A-Za-z]+$/.test(c))throw new r("Color name must be latin letters.",n);let p=te(a[1],"raw").string;if(!["HTML","RGB","rgb"].includes(p))throw new r("Color model must be HTML, RGB, or rgb.",n);let g=te(a[2],"raw").string,x=ve(p,g);return e.gullet.macros.set(`\\\\color@${c}`,{tokens:[{text:x}],numArgs:0}),{type:"internal",mode:e.mode}}}),C({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,n){let a=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,c=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:c,size:a&&te(a,"size").value}},mathmlBuilder(e,t){let n=new _("mo");if(e.newLine&&(n.setAttribute("linebreak","newline"),e.size)){let a=W(e.size,t);n.setAttribute("height",a.number+a.unit)}return n}});let zt={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},xn=e=>{let t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new r("Expected a control sequence",e);return t},Jt=(e,t,n,a)=>{let c=e.gullet.macros.get(n.text);c==null&&(n.noexpand=!0,c={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,c,a)};C({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:t}){e.consumeSpaces();let n=e.fetch();if(zt[n.text])return t!=="\\global"&&t!=="\\\\globallong"||(n.text=zt[n.text]),te(e.parseFunction(),"internal");throw new r("Invalid token after macro prefix",n)}}),C({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=e.gullet.popToken(),a=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(a))throw new r("Expected a control sequence",n);let c,p=0,g=[[]];for(;e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){c=e.gullet.future(),g[p].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new r(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==p+1)throw new r(`Argument number "${n.text}" out of order`);p++,g.push([])}else{if(n.text==="EOF")throw new r("Expected a macro definition");g[p].push(n.text)}let{tokens:x}=e.gullet.consumeArg();if(c&&x.unshift(c),t==="\\edef"||t==="\\xdef"){if(x=e.gullet.expandTokens(x),x.length>e.gullet.settings.maxExpand)throw new r("Too many expansions in an "+t);x.reverse()}return e.gullet.macros.set(a,{tokens:x,numArgs:p,delimiters:g},t===zt[t]),{type:"internal",mode:e.mode}}}),C({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=xn(e.gullet.popToken());e.gullet.consumeSpaces();let a=(c=>{let p=c.gullet.popToken();return p.text==="="&&(p=c.gullet.popToken(),p.text===" "&&(p=c.gullet.popToken())),p})(e);return Jt(e,n,a,t==="\\\\globallet"),{type:"internal",mode:e.mode}}}),C({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=xn(e.gullet.popToken()),a=e.gullet.popToken(),c=e.gullet.popToken();return Jt(e,n,c,t==="\\\\globalfuture"),e.gullet.pushToken(c),e.gullet.pushToken(a),{type:"internal",mode:e.mode}}}),C({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n="",a=e.gullet.popToken();a.text==="{"?(n=xn(e.gullet.popToken()),e.gullet.popToken()):n=xn(a);let c=e.gullet.isDefined(n);if(c&&t==="\\newcommand")throw new r(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!c&&t==="\\renewcommand")throw new r(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let p=0;if(e.gullet.future().text==="["){let x=e.gullet.popToken();if(x=e.gullet.popToken(),!/^[0-9]$/.test(x.text))throw new r(`Invalid number of arguments: "${x.text}"`);if(p=parseInt(x.text),x=e.gullet.popToken(),x.text!=="]")throw new r(`Invalid argument "${x.text}"`)}let{tokens:g}=e.gullet.consumeArg();return t==="\\providecommand"&&e.gullet.macros.has(n)||e.gullet.macros.set(n,{tokens:g,numArgs:p}),{type:"internal",mode:e.mode}}});let E={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},z={"(":")","\\lparen":"\\rparen","[":"]","\\lbrack":"\\rbrack","\\{":"\\}","\\lbrace":"\\rbrace","\u2987":"\u2988","\\llparenthesis":"\\rrparenthesis","\\lfloor":"\\rfloor","\u230A":"\u230B","\\lceil":"\\rceil","\u2308":"\u2309","\\langle":"\\rangle","\u27E8":"\u27E9","\\lAngle":"\\rAngle","\u27EA":"\u27EB","\\llangle":"\\rrangle","\u2989":"\u298A","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lgroup":"\\rgroup","\u27EE":"\u27EF","\\lmoustache":"\\rmoustache","\u23B0":"\u23B1","\\llbracket":"\\rrbracket","\u27E6":"\u27E7","\\lBrace":"\\rBrace","\u2983":"\u2984"},ne=new Set(Object.keys(z));new Set(Object.values(z));let ae=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\u2987","\\llparenthesis","\u2988","\\rrparenthesis","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lAngle","\u27EA","\\rAngle","\u27EB","\\llangle","\u2989","\\rrangle","\u298A","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","\\llbracket","\\rrbracket","\u27E6","\u27E7","\\lBrace","\\rBrace","\u2983","\u2984","/","\\backslash","|","\\vert","\\|","\\Vert","\u2016","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]),X=new Set(["}","\\left","\\middle","\\right"]),ue=e=>e.length>0&&(ae.has(e)||E[e]||X.has(e)),we=[0,1.2,1.8,2.4,3];function Me(e,t){e.type==="ordgroup"&&e.body.length===1&&(e=e.body[0]);let n=Qe(e);if(n&&ae.has(n.text))return n.text!=="<"&&n.text!=="\\lt"||(n.text="\u27E8"),n.text!==">"&&n.text!=="\\gt"||(n.text="\u27E9"),n;throw new r(n?`Invalid delimiter '${n.text}' after '${t.funcName}'`:`Invalid delimiter type '${e.type}'`,e)}let nt=new Set(["/","\\","\\backslash","\u2216","\\vert","|"]),wt=(e,t,n,a)=>{let c=new _("mo",[Xe(e==="."?"":e,t)]);return c.setAttribute("fence","true"),c.setAttribute("form",n),c.setAttribute("stretchy",a?"true":"false"),c};function vn(e){if(!e.body)throw new Error("Bug: The delim ParseNode wasn't fully parsed.")}C({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=Me(t[0],e),a={type:"delimsizing",mode:e.parser.mode,size:E[e.funcName].size,mclass:E[e.funcName].mclass,delim:n.text},c=e.parser.fetch().text;return c!=="^"&&c!=="_"?a:{type:"ordgroup",mode:"math",body:[a,{type:"ordgroup",mode:"math",body:[]}]}},mathmlBuilder:e=>{let t=[],n=e.delim==="."?"":e.delim;t.push(Xe(n,e.mode));let a=new _("mo",t);return e.mclass==="mopen"||e.mclass==="mclose"?a.setAttribute("fence","true"):a.setAttribute("fence","false"),(nt.has(n)||n.indexOf("arrow")>-1)&&a.setAttribute("stretchy","true"),a.setAttribute("symmetric","true"),a.setAttribute("minsize",we[e.size]+"em"),a.setAttribute("maxsize",we[e.size]+"em"),a}}),C({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:Me(t[0],e).text})}),C({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=Me(t[0],e),a=e.parser;++a.leftrightDepth;let c=a.parseExpression(!1,"\\right",!0),p=a.fetch();for(;p.text==="\\middle";){a.consume();let x=a.fetch().text;if(!Ce.math[x])throw new r(`Invalid delimiter '${x}' after '\\middle'`);Me({type:"atom",mode:"math",text:x},{funcName:"\\middle"}),c.push({type:"middle",mode:"math",delim:x}),a.consume(),c=c.concat(a.parseExpression(!1,"\\right",!0)),p=a.fetch()}--a.leftrightDepth,a.expect("\\right",!1);let g=te(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:c,left:n.text,right:g.delim,isStretchy:!0}},mathmlBuilder:(e,t)=>{vn(e);let n=tt(e.body,t),a=wt(e.left,e.mode,"prefix",!0);n.unshift(a);let c=wt(e.right,e.mode,"postfix",!0);if(e.body.length>0){let p=e.body[e.body.length-1];p.type!=="color"||p.isTextColor||c.setAttribute("mathcolor",p.color)}return n.push(c),me(n)}}),C({type:"delimiter",names:Array.from(ne),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:t,token:n})=>{if(e.mode==="text")return{type:"textord",mode:"text",text:t,loc:n.loc};if(!e.settings.wrapDelimiterPairs)return{type:"atom",mode:"math",family:"open",loc:n.loc,text:t};let a=z[t],c=e.parseExpression(!1,a,!1);if(e.fetch().text!==a)throw new r("Unmatched delimiter");return e.consume(),{type:"delimiter",mode:e.mode,body:c,left:t,right:a}},mathmlBuilder:(e,t)=>{vn(e);let n=tt(e.body,t),a=wt(e.left,e.mode,"prefix",!1);n.unshift(a);let c=wt(e.right,e.mode,"postfix",!1);if(e.body.length>0){let p=e.body[e.body.length-1];p.type!=="color"||p.isTextColor||c.setAttribute("mathcolor",p.color)}return n.push(c),me(n)}}),C({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=Me(t[0],e);if(!e.parser.leftrightDepth)throw new r("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},mathmlBuilder:e=>{let t=Xe(e.delim,e.mode),n=new _("mo",[t]);return n.setAttribute("stretchy","true"),n.setAttribute("form","infix"),t.text!=="/"&&(n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em")),n}});let lr=["\\boxed","\\fcolorbox","\\colorbox"],Pn=(e,t)=>{let n=lr.includes(e.label)?"mrow":"menclose",a=new _(n,[He(e.body,t)]);switch(e.label){case"\\overline":a.setAttribute("notation","top"),a.classes.push("tml-overline");break;case"\\underline":a.setAttribute("notation","bottom"),a.classes.push("tml-underline");break;case"\\cancel":a.setAttribute("notation","updiagonalstrike"),a.children.push(new _("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike"),a.children.push(new _("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":a.setAttribute("notation","horizontalstrike"),a.children.push(new _("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike"),a.children.push(new _("mrow",[],["tml-cancel","tml-xcancel"]));break;case"\\longdiv":a.setAttribute("notation","longdiv"),a.classes.push("longdiv-top"),a.children.push(new _("mrow",[],["longdiv-arc"]));break;case"\\phase":a.setAttribute("notation","phasorangle"),a.classes.push("phasor-bottom"),a.children.push(new _("mrow",[],["phasor-angle"]));break;case"\\textcircled":a.setAttribute("notation","circle"),a.classes.push("circle-pad"),a.children.push(new _("mrow",[],["textcircle"]));break;case"\\angl":a.setAttribute("notation","actuarial"),a.classes.push("actuarial");break;case"\\boxed":a.style.padding="3pt",a.style.border="1px solid",a.setAttribute("scriptlevel","0"),a.setAttribute("displaystyle","true");break;case"\\fbox":a.setAttribute("notation","box"),a.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":a.style.padding="0.3em",e.label==="\\fcolorbox"&&(a.style.border="0.0667em solid "+String(e.borderColor))}return e.backgroundColor&&a.setAttribute("mathbackground",e.backgroundColor),a};C({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},n,a){let c=a[0]&&te(a[0],"raw").string,p="";if(c){let x=te(n[0],"raw").string;p=ve(c,x)}else p=Ue(te(n[0],"raw").string,e.gullet.macros);let g=n[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,body:g}},mathmlBuilder:Pn}),C({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},n,a){let c=a[0]&&te(a[0],"raw").string,p,g="";if(c){let q=te(n[0],"raw").string,j=te(n[0],"raw").string;g=ve(c,q),p=ve(c,j)}else g=Ue(te(n[0],"raw").string,e.gullet.macros),p=Ue(te(n[1],"raw").string,e.gullet.macros);let x=n[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,borderColor:g,body:x}},mathmlBuilder:Pn}),C({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:t[0]})}),C({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},n){let a=n[0];return{type:"enclose",mode:e.mode,label:t,body:a}},mathmlBuilder:Pn}),C({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let a=n[0];return{type:"enclose",mode:e.mode,label:t,body:a}},mathmlBuilder:Pn}),C({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let a=n[0];return{type:"enclose",mode:e.mode,label:t,body:a}},mathmlBuilder:Pn}),C({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let a=n[0];return{type:"enclose",mode:e.mode,label:t,body:a}},mathmlBuilder:Pn}),C({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:e,funcName:t},n){let a=n[0];if(a.type!=="ordgroup")throw new r("Invalid environment name",a);let c="";for(let p=0;p<a.body.length;++p)c+=te(a.body[p],"textord").text;if(t==="\\begin"){if(!Object.prototype.hasOwnProperty.call(un,c))throw new r("No such environment: "+c,a);let p=un[c],{args:g,optArgs:x}=e.parseArguments("\\begin{"+c+"}",p),q={mode:e.mode,envName:c,parser:e},j=p.handler(q,g,x);e.expect("\\end",!1);let ie=e.nextToken,he=te(e.parseFunction(),"environment");if(he.name!==c)throw new r(`Mismatch: \\begin{${c}} matched by \\end{${he.name}}`,ie);return j}return{type:"environment",mode:e.mode,name:c,nameGroup:a}}}),C({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},t)=>({type:"envTag",mode:e.mode,body:t[0]}),mathmlBuilder:(e,t)=>new _("mrow")}),C({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,t)=>new _("mrow")});let fs=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),sa=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),oa=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),gs=Object.freeze({"\u03F5":119527,\u03D1:119564,\u03F0:119534,\u03C6:119577,\u03F1:119535,\u03D6:119563}),ia=Object.freeze({"\u03F5":119643,\u03D1:119680,\u03F0:119650,\u03C6:119693,\u03F1:119651,\u03D6:119679}),bs=Object.freeze({"\u03F5":119701,\u03D1:119738,\u03F0:119708,\u03C6:119751,\u03F1:119709,\u03D6:119737}),aa=Object.freeze({"\u03F5":119759,\u03D1:119796,\u03F0:119766,\u03C6:119809,\u03F1:119767,\u03D6:119795}),la=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>fs[e]||119899,"script-bold":e=>119951,fraktur:e=>sa[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>oa[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>e==="h"?8358:119789,"bold-italic":e=>119841,script:e=>fs[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>e==="\u03D5"?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>gs[e]||-51,italic:e=>0,"bold-italic":e=>ia[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>bs[e]||116,"sans-serif-bold":e=>bs[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>aa[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),Dn=(e,t)=>{let n=e.codePointAt(0),a=64<n&&n<91?"upperCaseLatin":96<n&&n<123?"lowerCaseLatin":912<n&&n<938?"upperCaseGreek":944<n&&n<970||e==="\u03D5"?"lowerCaseGreek":120545<n&&n<120572||gs[e]?"varGreek":47<n&&n<58?"numeral":"other";return a==="other"?e:String.fromCodePoint(n+la[a][t](e))},ca=Object.freeze({a:"\u1D00",b:"\u0299",c:"\u1D04",d:"\u1D05",e:"\u1D07",f:"\uA730",g:"\u0262",h:"\u029C",i:"\u026A",j:"\u1D0A",k:"\u1D0B",l:"\u029F",m:"\u1D0D",n:"\u0274",o:"\u1D0F",p:"\u1D18",q:"\u01EB",r:"\u0280",s:"s",t:"\u1D1B",u:"\u1D1C",v:"\u1D20",w:"\u1D21",x:"x",y:"\u028F",z:"\u1D22"}),da=["mathrm","mathit"],ys=(e,t)=>{let n=e.font,a=t.withFont(n),c=He(e.body,a);if(c.children.length===0)return c;if(n==="boldsymbol"&&["mo","mpadded","mrow"].includes(c.type))return c.style.fontWeight="bold",c;if(((x,q)=>{if(!da.includes(q)||!x.body||x.body.type!=="ordgroup"||x.body.body.length===1||x.body.body[0].type!=="mathord")return!1;for(let j=1;j<x.body.body.length;j++){let ie=x.body.body[j].type;if(ie!=="mathord"&&(ie!=="textord"||isNaN(x.body.body[j].text)))return!1}return!0})(e,n)){let x=c.children[0].children[0].children?c.children[0].children[0]:c.children[0];delete x.attributes.mathvariant;for(let j=1;j<c.children.length;j++)x.children[0].text+=c.children[j].children[0].children?c.children[j].children[0].children[0].text:c.children[j].children[0].text;if(n==="mathit")return x.children[0].text=x.children[0].text.split("").map(j=>Dn(j,"italic")).join(""),x;let q=new _("mpadded",[x]);return q.setAttribute("lspace","0"),q}let p=c.children[0].type==="mo";for(let x=1;x<c.children.length;x++)c.children[x].type==="mo"&&n==="boldsymbol"&&(c.children[x].style.fontWeight="bold"),c.children[x].type!=="mi"&&(p=!1),(c.children[x].attributes&&c.children[x].attributes.mathvariant||"")!=="normal"&&(p=!1);if(!p)return c;let g=c.children[0];for(let x=1;x<c.children.length;x++)g.children.push(c.children[x].children[0]);if(g.attributes.mathvariant&&g.attributes.mathvariant==="normal"){let x=new _("mtext",new qe("\u200B"));return new _("mrow",[x,g])}return g},ws={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};C({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\up@greek","\\boldsymbol","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathsfit","\\mathtt","\\Bbb","\\bm","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let a=ye(n[0]),c=t;return c in ws&&(c=ws[c]),{type:"font",mode:e.mode,font:c.slice(1),body:a}},mathmlBuilder:ys}),C({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:n},a)=>{let{mode:c}=e,p=e.parseExpression(!0,n,!0);return{type:"font",mode:c,font:`math${t.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:p}}},mathmlBuilder:ys});let xs=["display","text","script","scriptscript"],ua={auto:-1,display:0,text:0,script:1,scriptscript:2},Br=(e,t)=>{t=((p,g)=>{let x=g;if(p==="display"){let q=x.level>=an?Pt:Ft;x=x.withLevel(q)}else p==="text"&&x.level===Ft?x=x.withLevel(Pt):p==="auto"?x=x.incrementLevel():p==="script"?x=x.withLevel(an):p==="scriptscript"&&(x=x.withLevel(ln));return x})(e.scriptLevel,t);let n=He(e.numer,t),a=He(e.denom,t);t.level===3&&(n.style.mathDepth="2",n.setAttribute("scriptlevel","2"),a.style.mathDepth="2",a.setAttribute("scriptlevel","2"));let c=new _("mfrac",[n,a]);if(e.hasBarLine){if(e.barSize){let p=W(e.barSize,t);c.setAttribute("linethickness",p.number+p.unit)}}else c.setAttribute("linethickness","0px");if(e.leftDelim!=null||e.rightDelim!=null){let p=[];if(e.leftDelim!=null){let g=new _("mo",[new qe(e.leftDelim.replace("\\",""))]);g.setAttribute("fence","true"),p.push(g)}if(p.push(c),e.rightDelim!=null){let g=new _("mo",[new qe(e.rightDelim.replace("\\",""))]);g.setAttribute("fence","true"),p.push(g)}c=me(p)}return e.scriptLevel!=="auto"&&(c=new _("mstyle",[c]),c.setAttribute("displaystyle",String(e.scriptLevel==="display")),c.setAttribute("scriptlevel",ua[e.scriptLevel])),c};C({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let a=n[0],c=n[1],p=!1,g=null,x=null,q="auto";switch(t){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":p=!0;break;case"\\\\atopfrac":p=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":g="(",x=")";break;case"\\\\bracefrac":g="\\{",x="\\}";break;case"\\\\brackfrac":g="[",x="]";break;default:throw new Error("Unrecognized genfrac command")}return t==="\\cfrac"||t.startsWith("\\d")?q="display":t.startsWith("\\t")&&(q="text"),{type:"genfrac",mode:e.mode,continued:!1,numer:a,denom:c,hasBarLine:p,leftDelim:g,rightDelim:x,scriptLevel:q,barSize:null}},mathmlBuilder:Br}),C({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:n}){let a;switch(t){case"\\over":a="\\frac";break;case"\\choose":a="\\binom";break;case"\\atop":a="\\\\atopfrac";break;case"\\brace":a="\\\\bracefrac";break;case"\\brack":a="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:a,token:n}}});let vs=function(e){let t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};C({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){let n=t[4],a=t[5],c=ye(t[0]),p=c.type==="atom"&&c.family==="open"?vs(c.text):null,g=ye(t[1]),x=g.type==="atom"&&g.family==="close"?vs(g.text):null,q=te(t[2],"size"),j,ie=null;q.isBlank?j=!0:(ie=q.value,j=ie.number>0);let he="auto",ee=t[3];if(ee.type==="ordgroup"){if(ee.body.length>0){let lt=te(ee.body[0],"textord");he=xs[Number(lt.text)]}}else ee=te(ee,"textord"),he=xs[Number(ee.text)];return{type:"genfrac",mode:e.mode,numer:n,denom:a,continued:!1,hasBarLine:j,barSize:ie,leftDelim:p,rightDelim:x,scriptLevel:he}},mathmlBuilder:Br}),C({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:t,token:n},a)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:te(a[0],"size").value,token:n})}),C({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},n)=>{let a=n[0],c=function(x){if(!x)throw new Error("Expected non-null, but got "+String(x));return x}(te(n[1],"infix").barSize),p=n[2],g=c.number>0;return{type:"genfrac",mode:e.mode,numer:a,denom:p,continued:!1,hasBarLine:g,barSize:c,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Br}),C({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},t)=>({type:"hbox",mode:e.mode,body:ge(t[0])}),mathmlBuilder(e,t){let n=t.withLevel(Pt),a=bt(e.body,n);return Et(a)}}),C({type:"horizBracket",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>({type:"horizBracket",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:n[0]}),mathmlBuilder:(e,t)=>{let n=D(e.label);return n.style["math-depth"]=0,new _(e.isOver?"mover":"munder",[He(e.base,t),n])}}),C({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:e,funcName:t,token:n},a)=>{let c=te(a[0],"raw").string,p=a[1];if(e.settings.strict)throw new r(`Function "${t}" is disabled in strict mode`,n);let g,x={};switch(t){case"\\class":x.class=c,g={command:"\\class",class:c};break;case"\\id":x.id=c,g={command:"\\id",id:c};break;case"\\style":x.style=c,g={command:"\\style",style:c};break;case"\\data":{let q=c.split(",");for(let j=0;j<q.length;j++){let ie=q[j].split("=");if(ie.length!==2)throw new r("Error parsing key-value for \\data");x["data-"+ie[0].trim()]=ie[1].trim()}g={command:"\\data",attributes:x};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(g))throw new r(`Function "${t}" is not trusted`,n);return{type:"html",mode:e.mode,attributes:x,body:ge(p)}},mathmlBuilder:(e,t)=>{let n=bt(e.body,t),a=[];e.attributes.class&&a.push(...e.attributes.class.trim().split(/\s+/)),n.classes=a;for(let c in e.attributes)c!=="class"&&Object.prototype.hasOwnProperty.call(e.attributes,c)&&n.setAttribute(c,e.attributes[c]);return n}});let Pr=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};{let t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new r("Invalid size: '"+e+"' in \\includegraphics");let n={number:+(t[1]+t[2]),unit:t[3]};if(!Ht(n))throw new r("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n}};C({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:e,token:t},n,a)=>{let c={number:0,unit:"em"},p={number:.9,unit:"em"},g={number:0,unit:"em"},x="";if(a[0]){let j=te(a[0],"raw").string.split(",");for(let ie=0;ie<j.length;ie++){let he=j[ie].split("=");if(he.length===2){let ee=he[1].trim();switch(he[0].trim()){case"alt":x=ee;break;case"width":c=Pr(ee);break;case"height":p=Pr(ee);break;case"totalheight":g=Pr(ee);break;default:throw new r("Invalid key: '"+he[0]+"' in \\includegraphics.")}}}}let q=te(n[0],"url").url;if(x===""&&(x=q,x=x.replace(/^.*[\\/]/,""),x=x.substring(0,x.lastIndexOf("."))),!e.settings.isTrusted({command:"\\includegraphics",url:q}))throw new r('Function "\\includegraphics" is not trusted',t);return{type:"includegraphics",mode:e.mode,alt:x,width:c,height:p,totalheight:g,src:q}},mathmlBuilder:(e,t)=>{let n=W(e.height,t),a={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===n.unit&&e.totalheight.number>n.number&&(a.number=e.totalheight.number-n.number,a.unit=n.unit);let c=0;e.width.number>0&&(c=W(e.width,t));let p={height:n.number+a.number+"em"};c.number>0&&(p.width=c.number+c.unit),a.number>0&&(p.verticalAlign=-a.number+a.unit);let g=new st(e.src,e.alt,p);return g.height=n,g.depth=a,new _("mtext",[g])}}),C({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:e,funcName:t,token:n},a){let c=te(a[0],"size");if(e.settings.strict){let p=t[1]==="m",g=c.value.unit==="mu";if(p){if(!g)throw new r(`LaTeX's ${t} supports only mu units, not ${c.value.unit} units`,n);if(e.mode!=="math")throw new r(`LaTeX's ${t} works only in math mode`,n)}else if(g)throw new r(`LaTeX's ${t} doesn't support mu units`,n)}return{type:"kern",mode:e.mode,dimension:c.value}},mathmlBuilder(e,t){let n=W(e.dimension,t),a=n.number>0&&n.unit==="em"?ks(n.number):"";if(e.mode==="text"&&a.length>0){let c=new qe(a);return new _("mtext",[c])}if(n.number>=0){let c=new _("mspace");return c.setAttribute("width",n.number+n.unit),c}{let c=new _("mrow");return c.style.marginLeft=n.number+n.unit,c}}});let ks=function(e){return e>=.05555&&e<=.05556?"\u200A":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200A":""},Es=/[^A-Za-z_0-9-]/g;C({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},t)=>({type:"label",mode:e.mode,string:t[0].string.replace(Es,"")}),mathmlBuilder(e,t){let n=new _("mrow",[],["tml-label"]);return e.string.length>0&&n.setLabel(e.string),n}});let pa=["\\clap","\\llap","\\rlap"];C({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:t,token:n},a)=>{if(pa.includes(t)){if(e.settings.strict&&e.mode!=="text")throw new r(`{${t}} can be used only in text mode.
92
+ Try \\math${t.slice(1)}`,n);t=t.slice(1)}else t=t.slice(5);let c=a[0];return{type:"lap",mode:e.mode,alignment:t,body:c}},mathmlBuilder:(e,t)=>{let n;if(e.alignment==="llap"){let p=tt(ge(e.body),t),g=new _("mphantom",p);n=new _("mpadded",[g]),n.setAttribute("width","0.1px")}let a=He(e.body,t),c;if(e.alignment==="llap"?(a.style.position="absolute",a.style.right="0",a.style.bottom="0",c=new _("mpadded",[n,a])):c=new _("mpadded",[a]),e.alignment==="rlap")e.body.body.length>0&&e.body.body[0].type==="genfrac"&&c.setAttribute("lspace","0.16667em");else{let p=e.alignment==="llap"?"-1":"-0.5";c.setAttribute("lspace",p+"width"),e.alignment==="llap"?c.style.position="relative":(c.style.display="flex",c.style.justifyContent="center")}return c.setAttribute("width","0.1px"),c}}),C({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},n){let a=t.mode;t.switchMode("math");let c=e==="\\("?"\\)":"$",p=t.parseExpression(!1,c);return t.expect(c),t.switchMode(a),{type:"ordgroup",mode:t.mode,body:p}}}),C({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new r(`Mismatched ${e.funcName}`,t)}}),C({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:ge(t[0]),text:ge(t[1]),script:ge(t[2]),scriptscript:ge(t[3])}),mathmlBuilder:(e,t)=>{let n=((a,c)=>{switch(c.level){case Ft:return a.display;case Pt:return a.text;case an:return a.script;case ln:return a.scriptscript;default:return a.text}})(e,t);return bt(n,t)}});let ha=["text","textord","mathord","atom"];function Ss(e,t){let n,a=tt(e.body,t);if(e.mclass==="minner")n=new _("mpadded",a);else if(e.mclass==="mord")e.isCharacterBox||a[0].type==="mathord"?(n=a[0],n.type="mi",n.children.length===1&&n.children[0].text&&n.children[0].text==="\u2207"&&n.setAttribute("mathvariant","normal")):n=new _("mi",a);else{n=new _("mrow",a),e.mustPromote?(n=a[0],n.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&n.setAttribute("mathvariant","italic")):n=new _("mrow",a);let c=t.level<2;n.type==="mrow"?c&&(e.mclass==="mbin"?(n.children.unshift(U(.2222)),n.children.push(U(.2222))):e.mclass==="mrel"?(n.children.unshift(U(.2778)),n.children.push(U(.2778))):e.mclass==="mpunct"?n.children.push(U(.1667)):e.mclass==="minner"&&(n.children.unshift(U(.0556)),n.children.push(U(.0556)))):e.mclass==="mbin"?(n.attributes.lspace=c?"0.2222em":"0",n.attributes.rspace=c?"0.2222em":"0"):e.mclass==="mrel"?(n.attributes.lspace=c?"0.2778em":"0",n.attributes.rspace=c?"0.2778em":"0"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace=c?"0.1667em":"0"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&c&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em"),e.mclass!=="mopen"&&e.mclass!=="mclose"&&(delete n.attributes.stretchy,delete n.attributes.form)}return n}C({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},n){let a=n[0],c=b(a),p=!0,g={type:"mathord",text:"",mode:e.mode},x=a.body?a.body:[a];for(let q of x){if(!ha.includes(q.type)){p=!1;break}Ce[e.mode][q.text]?g.text+=Ce[e.mode][q.text].replace:q.text?g.text+=q.text:q.body&&q.body.map(j=>{g.text+=j.text})}return p&&t==="\\mathord"&&g.type==="mathord"&&g.text.length>1?g:{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:ge(p?g:a),isCharacterBox:c,mustPromote:p}},mathmlBuilder:Ss});let As=e=>{let t=e.type==="ordgroup"&&e.body.length&&e.body.length===1?e.body[0]:e;if(t.type==="atom"){let n=e.body.length>0&&e.body[0].text&&Ce.math[e.body[0].text]?Ce.math[e.body[0].text].group:t.family;return n==="bin"||n==="rel"?"m"+n:"mord"}return"mord"};C({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},t)=>({type:"mclass",mode:e.mode,mclass:As(t[0]),body:ge(t[1]),isCharacterBox:b(t[1])})}),C({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},n){let a=n[1],c=n[0],p;p=t!=="\\stackrel"?As(a):"mrel";let g={type:p==="mrel"||p==="mbin"?"op":"ordgroup",mode:a.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!=="\\stackrel",body:ge(a)};return{type:"supsub",mode:c.mode,stack:!0,base:g,sup:t==="\\underset"?null:c,sub:t==="\\underset"?c:null}},mathmlBuilder:Ss});let cr=(e,t,n)=>{if(!e)return n;let a=He(e,t);return a.type==="mrow"&&a.children.length===0?n:a};C({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:e,funcName:t,token:n},a){if(a[2].body.length===0)throw new r(t+"cannot parse an empty base.");let c=a[2].body[0];if(e.settings.strict&&t==="\\sideset"&&!c.symbol)throw new r("The base of \\sideset must be a big operator. Try \\prescript.");if(a[0].body.length>0&&a[0].body[0].type!=="supsub"||a[1].body.length>0&&a[1].body[0].type!=="supsub")throw new r("\\sideset can parse only subscripts and superscripts in its first two arguments",n);let p=a[0].body.length>0?a[0].body[0]:null,g=a[1].body.length>0?a[1].body[0]:null;return p||g?p?{type:"multiscript",mode:e.mode,isSideset:t==="\\sideset",prescripts:p,postscripts:g,base:c}:{type:"styling",mode:e.mode,scriptLevel:"text",body:[{type:"supsub",mode:e.mode,base:c,sup:g.sup,sub:g.sub}]}:c},mathmlBuilder(e,t){let n=He(e.base,t),a=new _("mprescripts"),c=new _("none"),p=[],g=cr(e.prescripts.sub,t,c),x=cr(e.prescripts.sup,t,c);return e.isSideset&&(g.setAttribute("style","text-align: left;"),x.setAttribute("style","text-align: left;")),e.postscripts?p=[n,cr(e.postscripts.sub,t,c),cr(e.postscripts.sup,t,c),a,g,x]:p=[n,a,g,x],new _("mmultiscripts",p)}}),C({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){let n=b(t[0]),a;return n?(a=ge(t[0]),a[0].text.charAt(0)==="\\"&&(a[0].text=Ce.math[a[0].text].replace),a[0].text=a[0].text.slice(0,1)+"\u0338"+a[0].text.slice(1)):a=[{type:"textord",mode:"math",text:"\u0338"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]],{type:"not",mode:e.mode,body:a,isCharacterBox:n}},mathmlBuilder(e,t){return e.isCharacterBox?tt(e.body,t,!0)[0]:bt(e.body,t)}});let ma=["textord","mathord","atom"],fa=["\\smallint"],Dr=["textord","mathord","ordgroup","close","leftright","font"],_s=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},Jn=(e,t)=>{let n;if(e.symbol)n=new _("mo",[Xe(e.name,e.mode)]),fa.includes(e.name)?n.setAttribute("largeop","false"):n.setAttribute("movablelimits","false"),e.fromMathOp&&_s(n);else if(e.body)n=new _("mo",tt(e.body,t)),e.fromMathOp&&_s(n);else if(n=new _("mi",[new qe(e.name.slice(1))]),!e.parentIsSupSub){let a=[n,new _("mo",[Xe("\u2061","text")])];if(e.needsLeadingSpace){let c=new _("mspace");c.setAttribute("width","0.1667em"),a.unshift(c)}if(!e.isFollowedByDelimiter){let c=new _("mspace");c.setAttribute("width","0.1667em"),a.push(c)}n=new _("mrow",a)}return n},ga={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A05":"\\bigsqcap","\u2A06":"\\bigsqcup","\u2A03":"\\bigcupdot","\u2A07":"\\bigdoublevee","\u2A08":"\\bigdoublewedge","\u2A09":"\\bigtimes"};C({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcupplus","\\bigcupdot","\\bigcap","\\bigcup","\\bigdoublevee","\\bigdoublewedge","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcap","\\bigsqcup","\\bigtimes","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A03","\u2A04","\u2A05","\u2A06","\u2A07","\u2A08","\u2A09"],props:{numArgs:0},handler:({parser:e,funcName:t},n)=>{let a=t;return a.length===1&&(a=ga[a]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:a}},mathmlBuilder:Jn}),C({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{let n=t[0],a=n.body?n.body:[n],c=a.length===1&&ma.includes(a[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:c,fromMathOp:!0,stack:!1,name:c?a[0].text:null,body:c?null:ge(n)}},mathmlBuilder:Jn});let ba={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint","\u2231":"\\intclockwise","\u2232":"\\varointclockwise","\u2A0C":"\\iiiint","\u2A0D":"\\intbar","\u2A0E":"\\intBar","\u2A0F":"\\fint","\u2A12":"\\rppolint","\u2A13":"\\scpolint","\u2A15":"\\pointint","\u2A16":"\\sqint","\u2A17":"\\intlarhk","\u2A18":"\\intx","\u2A19":"\\intcap","\u2A1A":"\\intcup"};C({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\sgn","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,a=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:ue(a),needsLeadingSpace:n.length>0&&Dr.includes(n),name:t}},mathmlBuilder:Jn}),C({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,a=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:ue(a),needsLeadingSpace:n.length>0&&Dr.includes(n),name:t}},mathmlBuilder:Jn}),C({type:"op",names:["\\int","\\iint","\\iiint","\\iiiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\intbar","\\intBar","\\fint","\\rppolint","\\scpolint","\\pointint","\\sqint","\\intlarhk","\\intx","\\intcap","\\intcup","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230","\u2231","\u2232","\u2A0C","\u2A0D","\u2A0E","\u2A0F","\u2A12","\u2A13","\u2A15","\u2A16","\u2A17","\u2A18","\u2A19","\u2A1A"],props:{numArgs:0,allowedInArgument:!0},handler({parser:e,funcName:t}){let n=t;return n.length===1&&(n=ba[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:Jn}),C({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let a=n[0],c=e.prevAtomType,p=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:ge(a),alwaysHandleSupSub:t==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:ue(p),needsLeadingSpace:c.length>0&&Dr.includes(c)}},mathmlBuilder:(e,t)=>{let n,a=tt(e.body,t.withFont("mathrm")),c=!0;for(let p=0;p<a.length;p++){let g=a[p];if(g instanceof _)switch(((g.type==="mrow"||g.type==="mpadded")&&g.children.length===1&&g.children[0]instanceof _||g.type==="mrow"&&g.children.length===2&&g.children[0]instanceof _&&g.children[1]instanceof _&&g.children[1].type==="mspace"&&!g.children[1].attributes.width&&g.children[1].children.length===0)&&(g=g.children[0]),g.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(g.attributes.width){let x=g.attributes.width.replace("em",""),q=ks(Number(x));q===""?c=!1:a[p]=new _("mtext",[new qe(q)])}break;case"mo":{let x=g.children[0];g.children.length===1&&x instanceof qe?x.text=x.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):c=!1;break}default:c=!1}else c=!1}if(c){let p=a.map(g=>g.toText()).join("");a=[new qe(p)]}else if(a.length===1&&["mover","munder"].includes(a[0].type)&&(a[0].children[0].type==="mi"||a[0].children[0].type==="mtext")){if(a[0].children[0].type="mi",e.parentIsSupSub)return new _("mrow",a);{let p=new _("mo",[Xe("\u2061","text")]);return at([a[0],p])}}if(c?(n=new _("mi",a),a[0].text.length===1&&n.setAttribute("mathvariant","normal")):n=new _("mrow",a),!e.parentIsSupSub){let p=[n,new _("mo",[Xe("\u2061","text")])];if(e.needsLeadingSpace){let g=new _("mspace");g.setAttribute("width","0.1667em"),p.unshift(g)}if(!e.isFollowedByDelimiter){let g=new _("mspace");g.setAttribute("width","0.1667em"),p.push(g)}return at(p)}return n}}),I("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),F({type:"ordgroup",mathmlBuilder:(e,t)=>bt(e.body,t,e.semisimple)}),C({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"phantom",mode:e.mode,body:ge(n)}},mathmlBuilder:(e,t)=>{let n=tt(e.body,t);return new _("mphantom",n)}}),C({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"hphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=tt(ge(e.body),t),a=new _("mphantom",n),c=new _("mpadded",[a]);return c.setAttribute("height","0px"),c.setAttribute("depth","0px"),c}}),C({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"vphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=tt(ge(e.body),t),a=new _("mphantom",n),c=new _("mpadded",[a]);return c.setAttribute("width","0.1px"),c}}),C({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>({type:"pmb",mode:e.mode,body:ge(t[0])}),mathmlBuilder(e,t){let n=tt(e.body,t),a=Je(n);return a.setAttribute("style","font-weight:bold"),a}});let Ts=(e,t)=>{let n=t.withLevel(Pt),a=new _("mpadded",[He(e.body,n)]),c=W(e.dy,t);return a.setAttribute("voffset",c.number+c.unit),c.number>0?a.style.padding=c.number+c.unit+" 0 0 0":a.style.padding="0 0 "+Math.abs(c.number)+c.unit+" 0",a};C({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},n){let a=te(n[0],"size").value;t==="\\lower"&&(a.number*=-1);let c=n[1];return{type:"raise",mode:e.mode,dy:a,body:c}},mathmlBuilder:Ts}),C({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},n){let a=te(n[0],"size").value,c=n[1];return{type:"raise",mode:e.mode,dy:a,body:c}},mathmlBuilder:Ts}),C({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:t},n)=>({type:"ref",mode:e.mode,funcName:t,string:n[0].string.replace(Es,"")}),mathmlBuilder(e,t){let n=e.funcName==="\\ref"?["tml-ref"]:["tml-ref","tml-eqref"];return new Le("#"+e.string,n,null)}}),C({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"reflect",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){let n=He(e.body,t);return n.style.transform="scaleX(-1)",n}}),C({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),C({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,n){let a=n[0],c=te(t[0],"size"),p=te(t[1],"size");return{type:"rule",mode:e.mode,shift:a&&te(a,"size").value,width:c.value,height:p.value}},mathmlBuilder(e,t){let n=W(e.width,t),a=W(e.height,t),c=e.shift?W(e.shift,t):{number:0,unit:"em"},p=t.color&&t.getColor()||"black",g=new _("mspace");if(n.number>0&&a.number>0&&g.setAttribute("mathbackground",p),g.setAttribute("width",n.number+n.unit),g.setAttribute("height",a.number+a.unit),c.number===0)return g;let x=new _("mpadded",[g]);return c.number>=0?x.setAttribute("height","+"+c.number+c.unit):(x.setAttribute("height",c.number+c.unit),x.setAttribute("depth","+"+-c.number+c.unit)),x.setAttribute("voffset",c.number+c.unit),x}});let Cs=/^[0-9]$/,ya={0:"\u2080",1:"\u2081",2:"\u2082",3:"\u2083",4:"\u2084",5:"\u2085",6:"\u2086",7:"\u2087",8:"\u2088",9:"\u2089"},wa={0:"\u2070",1:"\xB9",2:"\xB2",3:"\xB3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079"};C({type:"sfrac",names:["\\sfrac"],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},t){let n="";for(let c of t[0].body){if(c.type!=="textord"||!Cs.test(c.text))throw new r("Numerator must be an integer.",c);n+=c.text}let a="";for(let c of t[1].body){if(c.type!=="textord"||!Cs.test(c.text))throw new r("Denominator must be an integer.",c);a+=c.text}return{type:"sfrac",mode:e.mode,numerator:n,denominator:a}},mathmlBuilder(e,t){let n=e.numerator.split("").map(p=>wa[p]).join(""),a=e.denominator.split("").map(p=>ya[p]).join(""),c=new qe(n+"\u2044"+a,e.mode,t);return new _("mn",[c],["special-fraction"])}});let Ns={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};C({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:n},a)=>{n.settings.strict&&n.mode==="math"&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);let c=n.parseExpression(!1,e,!0);return{type:"sizing",mode:n.mode,funcName:t,body:c}},mathmlBuilder:(e,t)=>{let n=t.withFontSize(Ns[e.funcName]),a=tt(e.body,n),c=Je(a),p=(Ns[e.funcName]/t.fontSize).toFixed(4);return c.setAttribute("mathsize",p+"em"),c}}),C({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,n)=>{let a=!1,c=!1,p=n[0]&&te(n[0],"ordgroup");if(p){let x="";for(let q=0;q<p.body.length;++q)if(x=p.body[q].text,x==="t")a=!0;else{if(x!=="b"){a=!1,c=!1;break}c=!0}}else a=!0,c=!0;let g=t[0];return{type:"smash",mode:e.mode,body:g,smashHeight:a,smashDepth:c}},mathmlBuilder:(e,t)=>{let n=new _("mpadded",[He(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});let xa=["a","c","e","\u0131","m","n","o","r","s","u","v","w","x","z","\u03B1","\u03B5","\u03B9","\u03BA","\u03BD","\u03BF","\u03C0","\u03C3","\u03C4","\u03C5","\u03C9","\\alpha","\\epsilon","\\iota","\\kappa","\\nu","\\omega","\\pi","\\tau","\\omega"];C({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,n){let a=n[0],c=t[0];return c.body&&c.body.length===1&&c.body[0].text&&xa.includes(c.body[0].text)&&c.body.push({type:"rule",mode:"math",shift:null,width:{number:0,unit:"pt"},height:{number:.5,unit:"em"}}),{type:"sqrt",mode:e.mode,body:c,index:a}},mathmlBuilder(e,t){let{body:n,index:a}=e;return a?new _("mroot",[He(n,t),He(a,t.incrementLevel())]):new _("msqrt",[He(n,t)])}});let va={display:0,text:1,script:2,scriptscript:3},ka={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};C({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:n},a){let c=n.parseExpression(!0,e,!0),p=t.slice(1,t.length-5);return{type:"styling",mode:n.mode,scriptLevel:p,body:c}},mathmlBuilder(e,t){let n=t.withLevel(va[e.scriptLevel]),a=tt(e.body,n),c=Je(a),p=ka[e.scriptLevel];return c.setAttribute("scriptlevel",p[0]),c.setAttribute("displaystyle",p[1]),c}});let Ea=/^m(over|under|underover)$/;F({type:"supsub",mathmlBuilder(e,t){let n,a,c=!1,p=!1,g=!1,x=!1;e.base&&e.base.type==="horizBracket"&&(a=!!e.sup,a===e.base.isOver&&(c=!0,n=e.base.isOver)),!e.base||e.stack||e.base.type!=="op"&&e.base.type!=="operatorname"||(e.base.parentIsSupSub=!0,p=!e.base.symbol,g=p&&!e.isFollowedByDelimiter,x=e.base.needsLeadingSpace);let q=e.stack&&e.base.body.length===1?[He(e.base.body[0],t)]:[He(e.base,t)],j=t.inSubOrSup();if(e.sub){let ee=He(e.sub,j);t.level===3&&ee.setAttribute("scriptlevel","2"),q.push(ee)}if(e.sup){let ee=He(e.sup,j);if(t.level===3&&ee.setAttribute("scriptlevel","2"),e.base&&e.base.text&&e.base.text.length===1){let lt=e.base.text;"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(lt)>-1?ee.classes.push("tml-sml-pad"):"BCEFGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(lt)>-1?ee.classes.push("tml-med-pad"):"AJdf\u0394\u039B".indexOf(lt)>-1&&ee.classes.push("tml-lrg-pad")}q.push(ee)}let ie;if(c)ie=n?"mover":"munder";else if(e.sub)if(e.sup){let ee=e.base;ie=ee&&(ee.type==="op"&&ee.limits||ee.type==="multiscript")&&(t.level===Ft||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(t.level===Ft||ee.limits)?"munderover":"msubsup"}else{let ee=e.base;ie=e.stack||ee&&ee.type==="op"&&ee.limits&&(t.level===Ft||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(ee.limits||t.level===Ft)?"munder":"msub"}else{let ee=e.base;ie=ee&&ee.type==="op"&&ee.limits&&(t.level===Ft||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(ee.limits||t.level===Ft)?"mover":"msup"}let he=new _(ie,q);if(p){let ee=new _("mo",[Xe("\u2061","text")]);if(x){let lt=new _("mspace");lt.setAttribute("width","0.1667em"),he=at([lt,he,ee])}else he=at([he,ee]);if(g){let lt=new _("mspace");lt.setAttribute("width","0.1667em"),he.children.push(lt)}}else Ea.test(ie)&&(he=new _("mrow",[he]));return he}});let Sa=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],Aa=["\\Rsh","\\Lsh","\\restriction"];F({type:"atom",mathmlBuilder(e,t){let n=new _("mo",[Xe(e.text,e.mode)]);if(e.family==="punct")n.setAttribute("separator","true");else if(e.family==="open"||e.family==="close")e.family==="open"?(n.setAttribute("form","prefix"),n.setAttribute("stretchy","false")):e.family==="close"&&(n.setAttribute("form","postfix"),n.setAttribute("stretchy","false"));else if(e.text==="\\mid")n.setAttribute("lspace","0.22em"),n.setAttribute("rspace","0.22em"),n.setAttribute("stretchy","false");else if(e.family==="rel"&&(a=>{if(a.length===1){let c=a.codePointAt(0);return 8591<c&&c<8704}return a.indexOf("arrow")>-1||a.indexOf("harpoon")>-1||Aa.includes(a)})(e.text))n.setAttribute("stretchy","false");else if(Sa.includes(e.text))n.setAttribute("mathsize","70%");else if(e.text===":")n.attributes.lspace="0.2222em",n.attributes.rspace="0.2222em";else if(e.needsSpacing)return e.family==="bin"?new _("mrow",[U(.222),n,U(.222)]):new _("mrow",[U(.2778),n,U(.2778)]);return n}});let $s={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},Os=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsc")return"normal";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"sans-serif-bold":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";let n=t.font;if(!n||n==="mathnormal")return null;let a=e.mode;switch(n){case"mathit":case"greekItalic":return"italic";case"mathrm":{let p=e.text.codePointAt(0);return 939<p&&p<975?"italic":"normal"}case"up@greek":return"normal";case"boldsymbol":case"mathboldsymbol":return"bold-italic";case"mathbf":return"bold";case"mathbb":return"double-struck";case"mathfrak":return"fraktur";case"mathscr":case"mathcal":return"script";case"mathsf":return"sans-serif";case"mathsfit":return"sans-serif-italic";case"mathtt":return"monospace"}let c=e.text;return Ce[a][c]&&Ce[a][c].replace&&(c=Ce[a][c].replace),Object.prototype.hasOwnProperty.call($s,n)?$s[n]:null},_a=/^\d(?:[\d,.]*\d)?$/,Ta=/[A-Ba-z]/,Ca=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);F({type:"mathord",mathmlBuilder(e,t){let n=Xe(e.text,e.mode,t),a=n.text.codePointAt(0),c=912<a&&a<938?"normal":"italic",p=Os(e,t)||c;if(p==="script")return n.text=Dn(n.text,p),new _("mi",[n],[t.font]);p!=="italic"&&(n.text=Dn(n.text,p));let g=new _("mi",[n]);if(p==="normal"&&(g.setAttribute("mathvariant","normal"),n.text.length===1)){let x=new _("mspace",[]);g=new _("mrow",[g,x])}return g}}),F({type:"textord",mathmlBuilder(e,t){let n=e.text,a=n.codePointAt(0);t.fontFamily==="textsc"&&96<a&&a<123&&(n=ca[n]);let c=Xe(n,e.mode,t),p=Os(e,t)||"normal",g;if(_a.test(e.text)){let x=e.mode==="text"?"mtext":"mn";if(p==="italic"||p==="bold-italic")return((q,j,ie)=>{let he=new _(ie,[q]),ee=new _("mstyle",[he]);return ee.style["font-style"]="italic",ee.style["font-family"]="Cambria, 'Times New Roman', serif",j==="bold-italic"&&(ee.style["font-weight"]="bold"),ee})(c,p,x);p!=="normal"&&(c.text=c.text.split("").map(q=>Dn(q,p)).join("")),g=new _(x,[c])}else if(e.mode==="text")p!=="normal"&&(c.text=Dn(c.text,p)),g=new _("mtext",[c]);else if(Ca.has(e.text))g=new _("mo",[c]),g.classes.push("tml-prime");else{let x=c.text;p!=="italic"&&(c.text=Dn(c.text,p)),g=new _("mi",[c]),c.text===x&&Ta.test(x)&&g.setAttribute("mathvariant","italic")}return g}});let Na={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},$a={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};F({type:"spacing",mathmlBuilder(e,t){let n;if(Object.prototype.hasOwnProperty.call($a,e.text))n=new _("mtext",[new qe("\xA0")]);else{if(!Object.prototype.hasOwnProperty.call(Na,e.text))throw new r(`Unknown type of space "${e.text}"`);n=new _("mo"),e.text==="\\nobreak"&&n.setAttribute("linebreak","nobreak")}return n}}),F({type:"tag"});let Ms={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Ls={"\\textbf":"textbf","\\textmd":"textmd"},Oa={"\\textit":"textit","\\textup":"textup"};C({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textsc","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let a=n[0];return{type:"text",mode:e.mode,body:ge(a),font:t}},mathmlBuilder(e,t){let n=((c,p)=>{let g=c.font;return g?Ms[g]?p.withTextFontFamily(Ms[g]):Ls[g]?p.withTextFontWeight(Ls[g]):g==="\\emph"?p.fontShape==="textit"?p.withTextFontShape("textup"):p.withTextFontShape("textit"):p.withTextFontShape(Oa[g]):p})(e,t),a=bt(e.body,n);return Et(a)}}),C({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},t)=>({type:"vcenter",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){let n=new _("mtd",[He(e.body,t)]);n.style.padding="0";let a=new _("mtr",[n]);return new _("mtable",[a])}}),C({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new r("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){let n=new qe(Ma(e)),a=new _("mtext",[n]);return a.setAttribute("mathvariant","monospace"),a}});let Ma=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),Mn=M,Rs=`[ \r
93
+ ]`,La=`(\\\\[a-zA-Z@]+)${Rs}*`,qr="[\u0300-\u036F]",Is=new RegExp(`${qr}+$`),Ra=`(${Rs}+)|\\\\(
94
94
  |[ \r ]+
95
- ?)[ \r ]*|([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]${Or}*|[\uD800-\uDBFF][\uDC00-\uDFFF]${Or}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Na}|\\\\[^\uD800-\uDFFF])`;class Ms{constructor(t,n){this.input=t,this.settings=n,this.tokenRegex=new RegExp($a,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){let t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new St("EOF",new dt(this,n,n));let i=this.tokenRegex.exec(t);if(i===null||i.index!==n)throw new r(`Unexpected character: '${t[n]}'`,new St(t[n],new dt(this,n,n+1)));let c=i[6]||i[3]||(i[2]?"\\ ":" ");if(this.catcodes[c]===14){let p=t.indexOf(`
96
- `,this.tokenRegex.lastIndex);if(p===-1){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new r("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=p+1;return this.lex()}return new St(c,new dt(this,n,this.tokenRegex.lastIndex))}}class Oa{constructor(t={},n={}){this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new r("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");let t=this.undefStack.pop();for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]===void 0?delete this.current[n]:this.current[n]=t[n])}has(t){return Object.prototype.hasOwnProperty.call(this.current,t)||Object.prototype.hasOwnProperty.call(this.builtins,t)}get(t){return Object.prototype.hasOwnProperty.call(this.current,t)?this.current[t]:this.builtins[t]}set(t,n,i=!1){if(i){for(let c=0;c<this.undefStack.length;c++)delete this.undefStack[c][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{let c=this.undefStack[this.undefStack.length-1];c&&!Object.prototype.hasOwnProperty.call(c,t)&&(c[t]=this.current[t])}this.current[t]=n}}let Ls={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Ma{constructor(t,n,i){this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new Oa(vn,n.macros),this.mode=i,this.stack=[]}feed(t){this.lexer=new Ms(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){let n,i,c;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:c,end:i}=this.consumeArg(["]"])}else({tokens:c,start:n,end:i}=this.consumeArg());return this.pushToken(new St("EOF",i.loc)),this.pushTokens(c),new St("",dt.range(n,i))}consumeSpaces(){for(;this.future().text===" ";)this.stack.pop()}consumeArg(t){let n=[],i=t&&t.length>0;i||this.consumeSpaces();let c=this.future(),p,b=0,v=0;do{if(p=this.popToken(),n.push(p),p.text==="{")++b;else if(p.text==="}"){if(--b,b===-1)throw new r("Extra }",p)}else if(p.text==="EOF")throw new r("Unexpected end of input in a macro argument, expected '"+(t&&i?t[v]:"}")+"'",p);if(t&&i)if((b===0||b===1&&t[v]==="{")&&p.text===t[v]){if(++v,v===t.length){n.splice(-v,v);break}}else v=0}while(b!==0||i);return c.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:c,end:p}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new r("The length of delimiters doesn't match the number of args!");let c=n[0];for(let p=0;p<c.length;p++){let b=this.popToken();if(c[p]!==b.text)throw new r("Use of the macro doesn't match its definition",b)}}let i=[];for(let c=0;c<t;c++)i.push(this.consumeArg(n&&n[c+1]).tokens);return i}expandOnce(t){let n=this.popToken(),i=n.text,c=n.noexpand?null:this._getExpansion(i);if(c==null||t&&c.unexpandable){if(t&&c==null&&i[0]==="\\"&&!this.isDefined(i))throw new r("Undefined control sequence: "+i);return this.pushToken(n),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new r("Too many expansions: infinite loop or need to increase maxExpand setting");let p=c.tokens,b=this.consumeArgs(c.numArgs,c.delimiters);if(c.numArgs){p=p.slice();for(let v=p.length-1;v>=0;--v){let D=p[v];if(D.text==="#"){if(v===0)throw new r("Incomplete placeholder at end of macro body",D);if(D=p[--v],D.text==="#")p.splice(v+1,1);else{if(!/^[1-9]$/.test(D.text))throw new r("Not a valid argument number",D);p.splice(v,2,...b[+D.text-1])}}}}return this.pushTokens(p),p.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new St(t)]):void 0}expandTokens(t){let n=[],i=this.stack.length;for(this.pushTokens(t);this.stack.length>i;)if(this.expandOnce(!0)===!1){let c=this.stack.pop();c.treatAsRelax&&(c.noexpand=!1,c.treatAsRelax=!1),n.push(c)}return n}expandMacroAsText(t){let n=this.expandMacro(t);return n&&n.map(i=>i.text).join("")}_getExpansion(t){let n=this.macros.get(t);if(n==null)return n;if(t.length===1){let c=this.lexer.catcodes[t];if(c!=null&&c!==13)return}let i=typeof n=="function"?n(this):n;if(typeof i=="string"){let c=0;if(i.indexOf("#")!==-1){let D=i.replace(/##/g,"");for(;D.indexOf("#"+(c+1))!==-1;)++c}let p=new Ms(i,this.settings),b=[],v=p.lex();for(;v.text!=="EOF";)b.push(v),v=p.lex();return b.reverse(),{tokens:b,numArgs:c}}return i}isDefined(t){return this.macros.has(t)||Object.prototype.hasOwnProperty.call(fn,t)||Object.prototype.hasOwnProperty.call(Ne.math,t)||Object.prototype.hasOwnProperty.call(Ne.text,t)||Object.prototype.hasOwnProperty.call(Ls,t)}isExpandable(t){let n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Object.prototype.hasOwnProperty.call(fn,t)&&!fn[t].primitive}}let Rs=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,er=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),Is=Object.freeze({"\u{1D49C}":"A",\u212C:"B","\u{1D49E}":"C","\u{1D49F}":"D",\u2130:"E",\u2131:"F","\u{1D4A2}":"G",\u210B:"H",\u2110:"I","\u{1D4A5}":"J","\u{1D4A6}":"K",\u2112:"L",\u2133:"M","\u{1D4A9}":"N","\u{1D4AA}":"O","\u{1D4AB}":"P","\u{1D4AC}":"Q",\u211B:"R","\u{1D4AE}":"S","\u{1D4AF}":"T","\u{1D4B0}":"U","\u{1D4B1}":"V","\u{1D4B2}":"W","\u{1D4B3}":"X","\u{1D4B4}":"Y","\u{1D4B5}":"Z"});var Mr={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Bs={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u010F:"d\u030C",\u1E0B:"d\u0307",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u013A:"l\u0301",\u013E:"l\u030C",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u010E:"D\u030C",\u1E0A:"D\u0307",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0139:"L\u0301",\u013D:"L\u030C",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u0164:"T\u030C",\u1E6A:"T\u0307",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"};let La=["bin","op","open","punct","rel"],Ra=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Ia=/^ *\\text/;class zn{constructor(t,n,i=!1){this.mode="math",this.gullet=new Ma(t,n,this.mode),this.settings=n,this.isPreamble=i,this.leftrightDepth=0,this.prevAtomType=""}expect(t,n=!0){if(this.fetch().text!==t)throw new r(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");let t=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){let i=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([c,p])=>{i[c]=p}),this.gullet.endGroup(),i}let n=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),n&&(this.gullet.macros.current["\\df@tag"]=n),t}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(t){let n=this.nextToken;this.consume(),this.gullet.pushToken(new St("}")),this.gullet.pushTokens(t);let i=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,i}parseExpression(t,n,i){let c=[];for(this.prevAtomType="";;){this.mode==="math"&&this.consumeSpaces();let p=this.fetch();if(zn.endOfExpression.indexOf(p.text)!==-1||n&&p.text===n||i&&p.text==="\\middle"||t&&fn[p.text]&&fn[p.text].infix)break;let b=this.parseAtom(n);if(!b)break;b.type!=="internal"&&(c.push(b),this.prevAtomType=b.type==="atom"?b.family:b.type)}return this.mode==="text"&&this.formLigatures(c),this.handleInfixNodes(c)}handleInfixNodes(t){let n,i=-1;for(let c=0;c<t.length;c++)if(t[c].type==="infix"){if(i!==-1)throw new r("only one infix operator per group",t[c].token);i=c,n=t[c].replaceWith}if(i!==-1&&n){let c,p,b=t.slice(0,i),v=t.slice(i+1),D;return c=b.length===1&&b[0].type==="ordgroup"?b[0]:{type:"ordgroup",mode:this.mode,body:b},p=v.length===1&&v[0].type==="ordgroup"?v[0]:{type:"ordgroup",mode:this.mode,body:v},D=n==="\\\\abovefrac"?this.callFunction(n,[c,t[i],p],[]):this.callFunction(n,[c,p],[]),[D]}return t}handleSupSubscript(t){let n=this.fetch(),i=n.text,c;this.consume(),this.consumeSpaces();do c=this.parseGroup(t);while(c.type&&c.type==="internal");if(!c)throw new r("Expected group after '"+i+"'",n);return c}formatUnsupportedCmd(t){let n=[];for(let c=0;c<t.length;c++)n.push({type:"textord",mode:"text",text:t[c]});let i={type:"text",mode:this.mode,body:n};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]}}parseAtom(t){let n=this.parseGroup("atom",t);if(n&&n.type==="internal"||this.mode==="text")return n;let i,c;for(;;){this.consumeSpaces();let p=this.fetch();if(p.text==="\\limits"||p.text==="\\nolimits"){if(n&&n.type==="op"){let b=p.text==="\\limits";n.limits=b,n.alwaysHandleSupSub=!0}else{if(!n||n.type!=="operatorname")throw new r("Limit controls must follow a math operator",p);n.alwaysHandleSupSub&&(n.limits=p.text==="\\limits")}this.consume()}else if(p.text==="^"){if(i)throw new r("Double superscript",p);i=this.handleSupSubscript("superscript")}else if(p.text==="_"){if(c)throw new r("Double subscript",p);c=this.handleSupSubscript("subscript")}else if(p.text==="'"){if(i)throw new r("Double superscript",p);let b={type:"textord",mode:this.mode,text:"\\prime"},v=[b];for(this.consume();this.fetch().text==="'";)v.push(b),this.consume();this.fetch().text==="^"&&v.push(this.handleSupSubscript("superscript")),i={type:"ordgroup",mode:this.mode,body:v}}else{if(!er[p.text])break;{let b=Rs.test(p.text),v=[];for(v.push(new St(er[p.text])),this.consume();;){let z=this.fetch().text;if(!er[z]||Rs.test(z)!==b)break;v.unshift(new St(er[z])),this.consume()}let D=this.subparse(v);b?c={type:"ordgroup",mode:"math",body:D}:i={type:"ordgroup",mode:"math",body:D}}}}if(i||c){if(n&&n.type==="multiscript"&&!n.postscripts)return n.postscripts={sup:i,sub:c},n;{let p=!n||n.type!=="op"&&n.type!=="operatorname"?void 0:Yn(this.nextToken.text);return{type:"supsub",mode:this.mode,base:n,sup:i,sub:c,isFollowedByDelimiter:p}}}return n}parseFunction(t,n){let i=this.fetch(),c=i.text,p=fn[c];if(!p)return null;if(this.consume(),n&&n!=="atom"&&!p.allowedInArgument)throw new r("Got function '"+c+"' with no arguments"+(n?" as "+n:""),i);if(this.mode==="text"&&!p.allowedInText)throw new r("Can't use function '"+c+"' in text mode",i);if(this.mode==="math"&&p.allowedInMath===!1)throw new r("Can't use function '"+c+"' in math mode",i);let b=this.prevAtomType,{args:v,optArgs:D}=this.parseArguments(c,p);return this.prevAtomType=b,this.callFunction(c,v,D,i,t)}callFunction(t,n,i,c,p){let b={funcName:t,parser:this,token:c,breakOnTokenText:p},v=fn[t];if(v&&v.handler)return v.handler(b,n,i);throw new r(`No function handler for ${t}`)}parseArguments(t,n){let i=n.numArgs+n.numOptionalArgs;if(i===0)return{args:[],optArgs:[]};let c=[],p=[];for(let b=0;b<i;b++){let v=n.argTypes&&n.argTypes[b],D=b<n.numOptionalArgs;(n.primitive&&v==null||n.type==="sqrt"&&b===1&&p[0]==null)&&(v="primitive");let z=this.parseGroupOfType(`argument to '${t}'`,v,D);if(D)p.push(z);else{if(z==null)throw new r("Null argument, please report this as a bug");c.push(z)}}return{args:c,optArgs:p}}parseGroupOfType(t,n,i){switch(n){case"size":return this.parseSizeGroup(i);case"url":return this.parseUrlGroup(i);case"math":case"text":return this.parseArgumentGroup(i,n);case"hbox":{let c=this.parseArgumentGroup(i,"text");return c!=null?{type:"styling",mode:c.mode,body:[c],scriptLevel:"text"}:null}case"raw":{let c=this.parseStringGroup("raw",i);return c!=null?{type:"raw",mode:"text",string:c.text}:null}case"primitive":{if(i)throw new r("A primitive argument cannot be optional");let c=this.parseGroup(t);if(c==null)throw new r("Expected group as "+t,this.fetch());return c}case"original":case null:case void 0:return this.parseArgumentGroup(i);default:throw new r("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){let t=this.fetch().text;if(t!==" "&&t!=="\xA0"&&t!=="\uFE0E")break;this.consume()}}parseStringGroup(t,n){let i=this.gullet.scanArgument(n);if(i==null)return null;let c,p="";for(;(c=this.fetch()).text!=="EOF";)p+=c.text,this.consume();return this.consume(),i.text=p,i}parseRegexGroup(t,n){let i=this.fetch(),c,p=i,b="";for(;(c=this.fetch()).text!=="EOF"&&t.test(b+c.text);)p=c,b+=p.text,this.consume();if(b==="")throw new r("Invalid "+n+": '"+i.text+"'",i);return i.range(p,b)}parseSizeGroup(t){let n,i=!1;if(this.gullet.consumeSpaces(),n=t||this.gullet.future().text==="{"?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!n)return null;t||n.text.length!==0||(n.text="0pt",i=!0);let c=Ra.exec(n.text);if(!c)throw new r("Invalid size: '"+n.text+"'",n);let p={number:+(c[1]+c[2]),unit:c[3]};if(!Ct(p))throw new r("Invalid unit: '"+p.unit+"'",n);return{type:"size",mode:this.mode,value:p,isBlank:i}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);let n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;let i=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return i=n.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:i}}parseArgumentGroup(t,n){let i=this.gullet.scanArgument(t);if(i==null)return null;let c=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();let p=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();let b={type:"ordgroup",mode:this.mode,loc:i.loc,body:p};return n&&this.switchMode(c),b}parseGroup(t,n){let i=this.fetch(),c=i.text;if(t==="argument to '\\left'")return this.parseSymbol();let p;if(c==="{"||c==="\\begingroup"||c==="\\toggle"){this.consume();let b=c==="{"?"}":c==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();let v=this.parseExpression(!1,b),D=this.fetch();this.expect(b),this.gullet.endGroup(),p={type:D.text==="\\endtoggle"?"toggle":"ordgroup",mode:this.mode,loc:dt.range(i,D),body:v,semisimple:c==="\\begingroup"||void 0}}else if(p=this.parseFunction(n,t)||this.parseSymbol(),p==null&&c[0]==="\\"&&!Object.prototype.hasOwnProperty.call(Ls,c)){if(this.settings.throwOnError)throw new r("Unsupported function name: "+c,i);p=this.formatUnsupportedCmd(c),this.consume()}return p}formLigatures(t){let n=t.length-1;for(let i=0;i<n;++i){let c=t[i],p=c.text;p==="-"&&t[i+1].text==="-"&&(i+1<n&&t[i+2].text==="-"?(t.splice(i,3,{type:"textord",mode:"text",loc:dt.range(c,t[i+2]),text:"---"}),n-=2):(t.splice(i,2,{type:"textord",mode:"text",loc:dt.range(c,t[i+1]),text:"--"}),n-=1)),p!=="'"&&p!=="`"||t[i+1].text!==p||(t.splice(i,2,{type:"textord",mode:"text",loc:dt.range(c,t[i+1]),text:p+p}),n-=1)}}parseSymbol(){let t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();let p=n.slice(5),b=p.charAt(0)==="*";if(b&&(p=p.slice(1)),p.length<2||p.charAt(0)!==p.slice(-1))throw new r(`\\verb assertion failed --
97
- please report what input caused this bug`);return p=p.slice(1,-1),{type:"verb",mode:"text",body:p,star:b}}if(Object.prototype.hasOwnProperty.call(Bs,n[0])&&this.mode==="math"&&!Ne[this.mode][n[0]]){if(this.settings.strict&&this.mode==="math")throw new r(`Accented Unicode text character "${n[0]}" used in math mode`,t);n=Bs[n[0]]+n.slice(1)}let i=this.mode==="math"?Os.exec(n):null,c;if(i&&(n=n.substring(0,i.index),n==="i"?n="\u0131":n==="j"&&(n="\u0237")),Ne[this.mode][n]){let p=Ne[this.mode][n].group;p!=="bin"||!La.includes(this.prevAtomType)&&this.prevAtomType!==""||(p="open");let b=dt.range(t),v;if(Object.prototype.hasOwnProperty.call(Ee,p)){let D=p;v={type:"atom",mode:this.mode,family:D,loc:b,text:n},D!=="rel"&&D!=="bin"||this.prevAtomType!=="text"||Ia.test(b.lexer.input.slice(b.end))&&(v.needsSpacing=!0)}else{if(Is[n]){this.consume();let D=this.fetch().text.charCodeAt(0),z=D===65025?"mathscr":"mathcal";return D!==65024&&D!==65025||this.consume(),{type:"font",mode:"math",font:z,body:{type:"mathord",mode:"math",loc:b,text:Is[n]}}}v={type:p,mode:this.mode,loc:b,text:n}}c=v}else{if(!(n.charCodeAt(0)>=128||Os.exec(n)))return null;if(this.settings.strict&&this.mode==="math")throw new r(`Unicode text character "${n[0]}" used in math mode`,t);c={type:"textord",mode:"text",loc:dt.range(t),text:n}}if(this.consume(),i)for(let p=0;p<i[0].length;p++){let b=i[0][p];if(!Mr[b])throw new r(`Unknown accent ' ${b}'`,t);let v=Mr[b][this.mode]||Mr[b].text;if(!v)throw new r(`Accent ${b} unsupported in ${this.mode} mode`,t);c={type:"accent",mode:this.mode,loc:dt.range(t),label:v,isStretchy:!1,base:c}}return c}}let Ps=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let n,i;try{i=new zn(e,t),delete i.gullet.macros.current["\\df@tag"],n=i.parse()}catch(c){if(c.toString()!=="ParseError: Unmatched delimiter")throw c;t.wrapDelimiterPairs=!1,i=new zn(e,t),delete i.gullet.macros.current["\\df@tag"],n=i.parse()}if(!(n.length>0&&n[0].type&&n[0].type==="array"&&n[0].addEqnNum)&&i.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new r("\\tag works only in display mode");i.gullet.feed("\\df@tag"),n=[{type:"tag",mode:"text",body:n,tag:i.parse()}]}return n},Ba=[2,2,3,3];class Lr{constructor(t){this.level=t.level,this.color=t.color,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontSize=t.fontSize||1,this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.maxSize=t.maxSize}extend(t){let n={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return new Lr(n)}withLevel(t){return this.extend({level:t})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:Ba[this.level]})}withColor(t){return this.extend({color:t})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withFontSize(t){return this.extend({fontSize:t})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}getColor(){return this.color}}function Ds(e){let t={},n=0,i=document.getElementsByClassName("tml-eqn");for(let p of i)for(n+=1,p.setAttribute("id","tml-eqn-"+String(n));p.tagName!=="mtable";){if(p.getElementsByClassName("tml-label").length>0){let b=p.attributes.id.value;t[b]=String(n);break}p=p.parentElement}let c=document.getElementsByClassName("tml-tageqn");for(let p of c)if(p.getElementsByClassName("tml-label").length>0){let b=p.getElementsByClassName("tml-tag");if(b.length>0){let v=p.attributes.id.value;t[v]=b[0].textContent}}[...e.getElementsByClassName("tml-ref")].forEach(p=>{let b=p.getAttribute("href"),v=t[b.slice(1)];p.className.indexOf("tml-eqref")===-1?(v=v.replace(/^\(/,""),v=v.replace(/\)$/,"")):(v.charAt(0)!=="("&&(v="("+v),v.slice(-1)!==")"&&(v+=")"));let D=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");D.appendChild(document.createTextNode(v));let z=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");z.appendChild(D),p.textContent="",p.appendChild(z)})}let Pa=function(e,t,n){let i=n,c=0,p=e.length;for(;i<t.length;){let b=t[i];if(c<=0&&t.slice(i,i+p)===e)return i;b==="\\"?i++:b==="{"?c++:b==="}"&&c--,i++}return-1},Da=/^\\(?:begin|(?:eq)?ref){/,qs=[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1},{left:"\\[",right:"\\]",display:!0}],tr={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},Rr=[{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1}],qa=function(e,t){let n=function(c,p){let b,v=[],D=new RegExp("("+p.map(z=>z.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")+")");for(;b=c.search(D),b!==-1;){b>0&&(v.push({type:"text",data:c.slice(0,b)}),c=c.slice(b));let z=p.findIndex(ee=>c.startsWith(ee.left));if(b=Pa(p[z].right,c,p[z].left.length),b===-1)break;let se=c.slice(0,b+p[z].right.length),ce=Da.test(se)?se:c.slice(p[z].left.length,b);v.push({type:"math",data:ce,rawData:se,display:p[z].display}),c=c.slice(b+p[z].right.length)}return c!==""&&v.push({type:"text",data:c}),v}(e,t.delimiters);if(n.length===1&&n[0].type==="text")return null;let i=document.createDocumentFragment();for(let c=0;c<n.length;c++)if(n[c].type==="text")i.appendChild(document.createTextNode(n[c].data));else{let p=document.createElement("span"),b=n[c].data;t.displayMode=n[c].display;try{t.preProcess&&(b=t.preProcess(b)),co.render(b,p,t)}catch(v){if(!(v instanceof r))throw v;t.errorCallback("Temml auto-render: Failed to parse `"+n[c].data+"` with ",v),i.appendChild(document.createTextNode(n[c].rawData));continue}i.appendChild(p)}return i},Fs=function(e,t){for(let n=0;n<e.childNodes.length;n++){let i=e.childNodes[n];if(i.nodeType===3){let c=qa(i.textContent,t);c&&(n+=c.childNodes.length-1,e.replaceChild(c,i))}else if(i.nodeType===1){let c=" "+i.className+" ";t.ignoredTags.indexOf(i.nodeName.toLowerCase())===-1&&t.ignoredClasses.every(p=>c.indexOf(" "+p+" ")===-1)&&Fs(i,t)}}},zs=function(e,t,n={}){t.textContent="";let i=t.tagName.toLowerCase()==="math";i&&(n.wrap="none");let c=Ir(e,n);i||c.children.length>1?(t.textContent="",c.children.forEach(p=>{t.appendChild(p.toNode())})):t.appendChild(c.toNode())};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype."),zs=function(){throw new r("Temml doesn't work in quirks mode.")});let Ir=function(e,t){let n=new I(t);try{let i=Ps(e,n);return Pt(i,e,new Lr({level:n.displayMode?ut:Ot,maxSize:n.maxSize}),n)}catch(i){return function(c,p,b){if(b.throwOnError||!(c instanceof r))throw c;let v=new Re(["temml-error"],[new be(p+`
95
+ ?)[ \r ]*|([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]${qr}*|[\uD800-\uDBFF][\uDC00-\uDFFF]${qr}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${La}|\\\\[^\uD800-\uDFFF])`;class Bs{constructor(t,n){this.input=t,this.settings=n,this.tokenRegex=new RegExp(Ra,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){let t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new qt("EOF",new yt(this,n,n));let a=this.tokenRegex.exec(t);if(a===null||a.index!==n)throw new r(`Unexpected character: '${t[n]}'`,new qt(t[n],new yt(this,n,n+1)));let c=a[6]||a[3]||(a[2]?"\\ ":" ");if(this.catcodes[c]===14){let p=t.indexOf(`
96
+ `,this.tokenRegex.lastIndex);if(p===-1){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new r("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=p+1;return this.lex()}return new qt(c,new yt(this,n,this.tokenRegex.lastIndex))}}class Ia{constructor(t={},n={}){this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new r("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");let t=this.undefStack.pop();for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]===void 0?delete this.current[n]:this.current[n]=t[n])}has(t){return Object.prototype.hasOwnProperty.call(this.current,t)||Object.prototype.hasOwnProperty.call(this.builtins,t)}get(t){return Object.prototype.hasOwnProperty.call(this.current,t)?this.current[t]:this.builtins[t]}set(t,n,a=!1){if(a){for(let c=0;c<this.undefStack.length;c++)delete this.undefStack[c][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{let c=this.undefStack[this.undefStack.length-1];c&&!Object.prototype.hasOwnProperty.call(c,t)&&(c[t]=this.current[t])}this.current[t]=n}}let Ps={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Ba{constructor(t,n,a){this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new Ia(Tn,n.macros),this.mode=a,this.stack=[]}feed(t){this.lexer=new Bs(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){let n,a,c;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:c,end:a}=this.consumeArg(["]"])}else({tokens:c,start:n,end:a}=this.consumeArg());return this.pushToken(new qt("EOF",a.loc)),this.pushTokens(c),new qt("",yt.range(n,a))}consumeSpaces(){for(;this.future().text===" ";)this.stack.pop()}consumeArg(t){let n=[],a=t&&t.length>0;a||this.consumeSpaces();let c=this.future(),p,g=0,x=0;do{if(p=this.popToken(),n.push(p),p.text==="{")++g;else if(p.text==="}"){if(--g,g===-1)throw new r("Extra }",p)}else if(p.text==="EOF")throw new r("Unexpected end of input in a macro argument, expected '"+(t&&a?t[x]:"}")+"'",p);if(t&&a)if((g===0||g===1&&t[x]==="{")&&p.text===t[x]){if(++x,x===t.length){n.splice(-x,x);break}}else x=0}while(g!==0||a);return c.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:c,end:p}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new r("The length of delimiters doesn't match the number of args!");let c=n[0];for(let p=0;p<c.length;p++){let g=this.popToken();if(c[p]!==g.text)throw new r("Use of the macro doesn't match its definition",g)}}let a=[];for(let c=0;c<t;c++)a.push(this.consumeArg(n&&n[c+1]).tokens);return a}expandOnce(t){let n=this.popToken(),a=n.text,c=n.noexpand?null:this._getExpansion(a);if(c==null||t&&c.unexpandable){if(t&&c==null&&a[0]==="\\"&&!this.isDefined(a))throw new r("Undefined control sequence: "+a);return this.pushToken(n),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new r("Too many expansions: infinite loop or need to increase maxExpand setting");let p=c.tokens,g=this.consumeArgs(c.numArgs,c.delimiters);if(c.numArgs){p=p.slice();for(let x=p.length-1;x>=0;--x){let q=p[x];if(q.text==="#"){if(x===0)throw new r("Incomplete placeholder at end of macro body",q);if(q=p[--x],q.text==="#")p.splice(x+1,1);else{if(!/^[1-9]$/.test(q.text))throw new r("Not a valid argument number",q);p.splice(x,2,...g[+q.text-1])}}}}return this.pushTokens(p),p.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new qt(t)]):void 0}expandTokens(t){let n=[],a=this.stack.length;for(this.pushTokens(t);this.stack.length>a;)if(this.expandOnce(!0)===!1){let c=this.stack.pop();c.treatAsRelax&&(c.noexpand=!1,c.treatAsRelax=!1),n.push(c)}return n}expandMacroAsText(t){let n=this.expandMacro(t);return n&&n.map(a=>a.text).join("")}_getExpansion(t){let n=this.macros.get(t);if(n==null)return n;if(t.length===1){let c=this.lexer.catcodes[t];if(c!=null&&c!==13)return}let a=typeof n=="function"?n(this):n;if(typeof a=="string"){let c=0;if(a.indexOf("#")!==-1){let q=a.replace(/##/g,"");for(;q.indexOf("#"+(c+1))!==-1;)++c}let p=new Bs(a,this.settings),g=[],x=p.lex();for(;x.text!=="EOF";)g.push(x),x=p.lex();return g.reverse(),{tokens:g,numArgs:c}}return a}isDefined(t){return this.macros.has(t)||Object.prototype.hasOwnProperty.call(Mn,t)||Object.prototype.hasOwnProperty.call(Ce.math,t)||Object.prototype.hasOwnProperty.call(Ce.text,t)||Object.prototype.hasOwnProperty.call(Ps,t)}isExpandable(t){let n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Object.prototype.hasOwnProperty.call(Mn,t)&&!Mn[t].primitive}}let Ds=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,dr=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),qs=Object.freeze({"\u{1D49C}":"A",\u212C:"B","\u{1D49E}":"C","\u{1D49F}":"D",\u2130:"E",\u2131:"F","\u{1D4A2}":"G",\u210B:"H",\u2110:"I","\u{1D4A5}":"J","\u{1D4A6}":"K",\u2112:"L",\u2133:"M","\u{1D4A9}":"N","\u{1D4AA}":"O","\u{1D4AB}":"P","\u{1D4AC}":"Q",\u211B:"R","\u{1D4AE}":"S","\u{1D4AF}":"T","\u{1D4B0}":"U","\u{1D4B1}":"V","\u{1D4B2}":"W","\u{1D4B3}":"X","\u{1D4B4}":"Y","\u{1D4B5}":"Z"});var Fr={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Fs={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u010F:"d\u030C",\u1E0B:"d\u0307",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u013A:"l\u0301",\u013E:"l\u030C",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u010E:"D\u030C",\u1E0A:"D\u0307",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0139:"L\u0301",\u013D:"L\u030C",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u0164:"T\u030C",\u1E6A:"T\u0307",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"};let Pa=["bin","op","open","punct","rel"],Da=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,qa=/^ *\\text/;class Qn{constructor(t,n,a=!1){this.mode="math",this.gullet=new Ba(t,n,this.mode),this.settings=n,this.isPreamble=a,this.leftrightDepth=0,this.prevAtomType=""}expect(t,n=!0){if(this.fetch().text!==t)throw new r(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");let t=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){let a=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([c,p])=>{a[c]=p}),this.gullet.endGroup(),a}let n=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),n&&(this.gullet.macros.current["\\df@tag"]=n),t}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(t){let n=this.nextToken;this.consume(),this.gullet.pushToken(new qt("}")),this.gullet.pushTokens(t);let a=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,a}parseExpression(t,n,a){let c=[];for(this.prevAtomType="";;){this.mode==="math"&&this.consumeSpaces();let p=this.fetch();if(Qn.endOfExpression.indexOf(p.text)!==-1||n&&p.text===n||a&&p.text==="\\middle"||t&&Mn[p.text]&&Mn[p.text].infix)break;let g=this.parseAtom(n);if(!g)break;g.type!=="internal"&&(c.push(g),this.prevAtomType=g.type==="atom"?g.family:g.type)}return this.mode==="text"&&this.formLigatures(c),this.handleInfixNodes(c)}handleInfixNodes(t){let n,a=-1;for(let c=0;c<t.length;c++)if(t[c].type==="infix"){if(a!==-1)throw new r("only one infix operator per group",t[c].token);a=c,n=t[c].replaceWith}if(a!==-1&&n){let c,p,g=t.slice(0,a),x=t.slice(a+1),q;return c=g.length===1&&g[0].type==="ordgroup"?g[0]:{type:"ordgroup",mode:this.mode,body:g},p=x.length===1&&x[0].type==="ordgroup"?x[0]:{type:"ordgroup",mode:this.mode,body:x},q=n==="\\\\abovefrac"?this.callFunction(n,[c,t[a],p],[]):this.callFunction(n,[c,p],[]),[q]}return t}handleSupSubscript(t){let n=this.fetch(),a=n.text,c;this.consume(),this.consumeSpaces();do c=this.parseGroup(t);while(c.type&&c.type==="internal");if(!c)throw new r("Expected group after '"+a+"'",n);return c}formatUnsupportedCmd(t){let n=[];for(let c=0;c<t.length;c++)n.push({type:"textord",mode:"text",text:t[c]});let a={type:"text",mode:this.mode,body:n};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[a]}}parseAtom(t){let n=this.parseGroup("atom",t);if(n&&n.type==="internal"||this.mode==="text")return n;let a,c;for(;;){this.consumeSpaces();let p=this.fetch();if(p.text==="\\limits"||p.text==="\\nolimits"){if(n&&n.type==="op"){let g=p.text==="\\limits";n.limits=g,n.alwaysHandleSupSub=!0}else{if(!n||n.type!=="operatorname")throw new r("Limit controls must follow a math operator",p);n.alwaysHandleSupSub&&(n.limits=p.text==="\\limits")}this.consume()}else if(p.text==="^"){if(a)throw new r("Double superscript",p);a=this.handleSupSubscript("superscript")}else if(p.text==="_"){if(c)throw new r("Double subscript",p);c=this.handleSupSubscript("subscript")}else if(p.text==="'"){if(a)throw new r("Double superscript",p);let g={type:"textord",mode:this.mode,text:"\\prime"},x=[g];for(this.consume();this.fetch().text==="'";)x.push(g),this.consume();this.fetch().text==="^"&&x.push(this.handleSupSubscript("superscript")),a={type:"ordgroup",mode:this.mode,body:x}}else{if(!dr[p.text])break;{let g=Ds.test(p.text),x=[];for(x.push(new qt(dr[p.text])),this.consume();;){let j=this.fetch().text;if(!dr[j]||Ds.test(j)!==g)break;x.unshift(new qt(dr[j])),this.consume()}let q=this.subparse(x);g?c={type:"ordgroup",mode:"math",body:q}:a={type:"ordgroup",mode:"math",body:q}}}}if(a||c){if(n&&n.type==="multiscript"&&!n.postscripts)return n.postscripts={sup:a,sub:c},n;{let p=!n||n.type!=="op"&&n.type!=="operatorname"?void 0:ue(this.nextToken.text);return{type:"supsub",mode:this.mode,base:n,sup:a,sub:c,isFollowedByDelimiter:p}}}return n}parseFunction(t,n){let a=this.fetch(),c=a.text,p=Mn[c];if(!p)return null;if(this.consume(),n&&n!=="atom"&&!p.allowedInArgument)throw new r("Got function '"+c+"' with no arguments"+(n?" as "+n:""),a);if(this.mode==="text"&&!p.allowedInText)throw new r("Can't use function '"+c+"' in text mode",a);if(this.mode==="math"&&p.allowedInMath===!1)throw new r("Can't use function '"+c+"' in math mode",a);let g=this.prevAtomType,{args:x,optArgs:q}=this.parseArguments(c,p);return this.prevAtomType=g,this.callFunction(c,x,q,a,t)}callFunction(t,n,a,c,p){let g={funcName:t,parser:this,token:c,breakOnTokenText:p},x=Mn[t];if(x&&x.handler)return x.handler(g,n,a);throw new r(`No function handler for ${t}`)}parseArguments(t,n){let a=n.numArgs+n.numOptionalArgs;if(a===0)return{args:[],optArgs:[]};let c=[],p=[];for(let g=0;g<a;g++){let x=n.argTypes&&n.argTypes[g],q=g<n.numOptionalArgs;(n.primitive&&x==null||n.type==="sqrt"&&g===1&&p[0]==null)&&(x="primitive");let j=this.parseGroupOfType(`argument to '${t}'`,x,q);if(q)p.push(j);else{if(j==null)throw new r("Null argument, please report this as a bug");c.push(j)}}return{args:c,optArgs:p}}parseGroupOfType(t,n,a){switch(n){case"size":return this.parseSizeGroup(a);case"url":return this.parseUrlGroup(a);case"math":case"text":return this.parseArgumentGroup(a,n);case"hbox":{let c=this.parseArgumentGroup(a,"text");return c!=null?{type:"styling",mode:c.mode,body:[c],scriptLevel:"text"}:null}case"raw":{let c=this.parseStringGroup("raw",a);return c!=null?{type:"raw",mode:"text",string:c.text}:null}case"primitive":{if(a)throw new r("A primitive argument cannot be optional");let c=this.parseGroup(t);if(c==null)throw new r("Expected group as "+t,this.fetch());return c}case"original":case null:case void 0:return this.parseArgumentGroup(a);default:throw new r("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){let t=this.fetch().text;if(t!==" "&&t!=="\xA0"&&t!=="\uFE0E")break;this.consume()}}parseStringGroup(t,n){let a=this.gullet.scanArgument(n);if(a==null)return null;let c,p="";for(;(c=this.fetch()).text!=="EOF";)p+=c.text,this.consume();return this.consume(),a.text=p,a}parseRegexGroup(t,n){let a=this.fetch(),c,p=a,g="";for(;(c=this.fetch()).text!=="EOF"&&t.test(g+c.text);)p=c,g+=p.text,this.consume();if(g==="")throw new r("Invalid "+n+": '"+a.text+"'",a);return a.range(p,g)}parseSizeGroup(t){let n,a=!1;if(this.gullet.consumeSpaces(),n=t||this.gullet.future().text==="{"?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!n)return null;t||n.text.length!==0||(n.text="0pt",a=!0);let c=Da.exec(n.text);if(!c)throw new r("Invalid size: '"+n.text+"'",n);let p={number:+(c[1]+c[2]),unit:c[3]};if(!Ht(p))throw new r("Invalid unit: '"+p.unit+"'",n);return{type:"size",mode:this.mode,value:p,isBlank:a}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);let n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;let a=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return a=n.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:a}}parseArgumentGroup(t,n){let a=this.gullet.scanArgument(t);if(a==null)return null;let c=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();let p=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();let g={type:"ordgroup",mode:this.mode,loc:a.loc,body:p};return n&&this.switchMode(c),g}parseGroup(t,n){let a=this.fetch(),c=a.text;if(t==="argument to '\\left'")return this.parseSymbol();let p;if(c==="{"||c==="\\begingroup"||c==="\\toggle"){this.consume();let g=c==="{"?"}":c==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();let x=this.parseExpression(!1,g),q=this.fetch();this.expect(g),this.gullet.endGroup(),p={type:q.text==="\\endtoggle"?"toggle":"ordgroup",mode:this.mode,loc:yt.range(a,q),body:x,semisimple:c==="\\begingroup"||void 0}}else if(p=this.parseFunction(n,t)||this.parseSymbol(),p==null&&c[0]==="\\"&&!Object.prototype.hasOwnProperty.call(Ps,c)){if(this.settings.throwOnError)throw new r("Unsupported function name: "+c,a);p=this.formatUnsupportedCmd(c),this.consume()}return p}formLigatures(t){let n=t.length-1;for(let a=0;a<n;++a){let c=t[a],p=c.text;p==="-"&&t[a+1].text==="-"&&(a+1<n&&t[a+2].text==="-"?(t.splice(a,3,{type:"textord",mode:"text",loc:yt.range(c,t[a+2]),text:"---"}),n-=2):(t.splice(a,2,{type:"textord",mode:"text",loc:yt.range(c,t[a+1]),text:"--"}),n-=1)),p!=="'"&&p!=="`"||t[a+1].text!==p||(t.splice(a,2,{type:"textord",mode:"text",loc:yt.range(c,t[a+1]),text:p+p}),n-=1)}}parseSymbol(){let t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();let p=n.slice(5),g=p.charAt(0)==="*";if(g&&(p=p.slice(1)),p.length<2||p.charAt(0)!==p.slice(-1))throw new r(`\\verb assertion failed --
97
+ please report what input caused this bug`);return p=p.slice(1,-1),{type:"verb",mode:"text",body:p,star:g}}if(Object.prototype.hasOwnProperty.call(Fs,n[0])&&this.mode==="math"&&!Ce[this.mode][n[0]]){if(this.settings.strict&&this.mode==="math")throw new r(`Accented Unicode text character "${n[0]}" used in math mode`,t);n=Fs[n[0]]+n.slice(1)}let a=this.mode==="math"?Is.exec(n):null,c;if(a&&(n=n.substring(0,a.index),n==="i"?n="\u0131":n==="j"&&(n="\u0237")),Ce[this.mode][n]){let p=Ce[this.mode][n].group;p!=="bin"||!Pa.includes(this.prevAtomType)&&this.prevAtomType!==""||(p="open");let g=yt.range(t),x;if(Object.prototype.hasOwnProperty.call(Ae,p)){let q=p;x={type:"atom",mode:this.mode,family:q,loc:g,text:n},q!=="rel"&&q!=="bin"||this.prevAtomType!=="text"||qa.test(g.lexer.input.slice(g.end))&&(x.needsSpacing=!0)}else{if(qs[n]){this.consume();let q=this.fetch().text.charCodeAt(0),j=q===65025?"mathscr":"mathcal";return q!==65024&&q!==65025||this.consume(),{type:"font",mode:"math",font:j,body:{type:"mathord",mode:"math",loc:g,text:qs[n]}}}x={type:p,mode:this.mode,loc:g,text:n}}c=x}else{if(!(n.charCodeAt(0)>=128||Is.exec(n)))return null;if(this.settings.strict&&this.mode==="math")throw new r(`Unicode text character "${n[0]}" used in math mode`,t);c={type:"textord",mode:"text",loc:yt.range(t),text:n}}if(this.consume(),a)for(let p=0;p<a[0].length;p++){let g=a[0][p];if(!Fr[g])throw new r(`Unknown accent ' ${g}'`,t);let x=Fr[g][this.mode]||Fr[g].text;if(!x)throw new r(`Accent ${g} unsupported in ${this.mode} mode`,t);c={type:"accent",mode:this.mode,loc:yt.range(t),label:x,isStretchy:!1,base:c}}return c}}let zs=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let n,a;try{a=new Qn(e,t),delete a.gullet.macros.current["\\df@tag"],n=a.parse()}catch(c){if(c.toString()!=="ParseError: Unmatched delimiter")throw c;t.wrapDelimiterPairs=!1,a=new Qn(e,t),delete a.gullet.macros.current["\\df@tag"],n=a.parse()}if(!(n.length>0&&n[0].type&&n[0].type==="array"&&n[0].addEqnNum)&&a.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new r("\\tag works only in display mode");a.gullet.feed("\\df@tag"),n=[{type:"tag",mode:"text",body:n,tag:a.parse()}]}return n},Fa=[2,2,3,3];class zr{constructor(t){this.level=t.level,this.color=t.color,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontSize=t.fontSize||1,this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.maxSize=t.maxSize}extend(t){let n={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a]);return new zr(n)}withLevel(t){return this.extend({level:t})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:Fa[this.level]})}withColor(t){return this.extend({color:t})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withFontSize(t){return this.extend({fontSize:t})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}getColor(){return this.color}}function Us(e){let t={},n=0,a=document.getElementsByClassName("tml-eqn");for(let p of a)for(n+=1,p.setAttribute("id","tml-eqn-"+String(n));p.tagName!=="mtable";){if(p.getElementsByClassName("tml-label").length>0){let g=p.attributes.id.value;t[g]=String(n);break}p=p.parentElement}let c=document.getElementsByClassName("tml-tageqn");for(let p of c)if(p.getElementsByClassName("tml-label").length>0){let g=p.getElementsByClassName("tml-tag");if(g.length>0){let x=p.attributes.id.value;t[x]=g[0].textContent}}[...e.getElementsByClassName("tml-ref")].forEach(p=>{let g=p.getAttribute("href"),x=t[g.slice(1)];p.className.indexOf("tml-eqref")===-1?(x=x.replace(/^\(/,""),x=x.replace(/\)$/,"")):(x.charAt(0)!=="("&&(x="("+x),x.slice(-1)!==")"&&(x+=")"));let q=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");q.appendChild(document.createTextNode(x));let j=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");j.appendChild(q),p.textContent="",p.appendChild(j)})}let za=function(e,t,n){let a=n,c=0,p=e.length;for(;a<t.length;){let g=t[a];if(c<=0&&t.slice(a,a+p)===e)return a;g==="\\"?a++:g==="{"?c++:g==="}"&&c--,a++}return-1},Ua=/^\\(?:begin|(?:eq)?ref){/,Hs=[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1},{left:"\\[",right:"\\]",display:!0}],ur={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},Ur=[{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1}],Ha=function(e,t){let n=function(c,p){let g,x=[],q=new RegExp("("+p.map(j=>j.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")+")");for(;g=c.search(q),g!==-1;){g>0&&(x.push({type:"text",data:c.slice(0,g)}),c=c.slice(g));let j=p.findIndex(ee=>c.startsWith(ee.left));if(g=za(p[j].right,c,p[j].left.length),g===-1)break;let ie=c.slice(0,g+p[j].right.length),he=Ua.test(ie)?ie:c.slice(p[j].left.length,g);x.push({type:"math",data:he,rawData:ie,display:p[j].display}),c=c.slice(g+p[j].right.length)}return c!==""&&x.push({type:"text",data:c}),x}(e,t.delimiters);if(n.length===1&&n[0].type==="text")return null;let a=document.createDocumentFragment();for(let c=0;c<n.length;c++)if(n[c].type==="text")a.appendChild(document.createTextNode(n[c].data));else{let p=document.createElement("span"),g=n[c].data;t.displayMode=n[c].display;try{t.preProcess&&(g=t.preProcess(g)),mo.render(g,p,t)}catch(x){if(!(x instanceof r))throw x;t.errorCallback("Temml auto-render: Failed to parse `"+n[c].data+"` with ",x),a.appendChild(document.createTextNode(n[c].rawData));continue}a.appendChild(p)}return a},Gs=function(e,t){for(let n=0;n<e.childNodes.length;n++){let a=e.childNodes[n];if(a.nodeType===3){let c=Ha(a.textContent,t);c&&(n+=c.childNodes.length-1,e.replaceChild(c,a))}else if(a.nodeType===1){let c=" "+a.className+" ";t.ignoredTags.indexOf(a.nodeName.toLowerCase())===-1&&t.ignoredClasses.every(p=>c.indexOf(" "+p+" ")===-1)&&Gs(a,t)}}},js=function(e,t,n={}){t.textContent="";let a=t.tagName.toLowerCase()==="math";a&&(n.wrap="none");let c=Hr(e,n);a||c.children.length>1?(t.textContent="",c.children.forEach(p=>{t.appendChild(p.toNode())})):t.appendChild(c.toNode())};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype."),js=function(){throw new r("Temml doesn't work in quirks mode.")});let Hr=function(e,t){let n=new P(t);try{let a=zs(e,n);return Vt(a,e,new zr({level:n.displayMode?Ft:Pt,maxSize:n.maxSize}),n)}catch(a){return function(c,p,g){if(g.throwOnError||!(c instanceof r))throw c;let x=new De(["temml-error"],[new xe(p+`
98
98
 
99
- `+c.toString())]);return v.style.color=b.errorColor,v.style.whiteSpace="pre-line",v}(i,e,n)}};return{version:"0.13.3",render:zs,renderToString:function(e,t){return Ir(e,t).toMarkup()},renderMathInElement:function(e,t){if(!e)throw new Error("No element provided to render");let n={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);n.fences?n.delimiters=(i=>i==="$"||i==="("?tr[i]:i==="$+"||i==="(+"?tr[i.slice(0,1)].concat(Rr):i==="ams"?Rr:i==="all"?tr["("].concat(tr.$).concat(Rr):qs)(n.fences):n.delimiters=n.delimiters||qs,n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},Fs(e,n),Ds(e)},postProcess:Ds,ParseError:r,definePreamble:function(e,t){let n=new I(t);if(n.macros={},!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let i=new zn(e,n,!0);return delete i.gullet.macros.current["\\df@tag"],i.parse()},__parse:function(e,t){let n=new I(t);return Ps(e,n)},__renderToMathMLTree:Ir,__defineSymbol:s,__defineMacro:L}}(),uo=co;function xl(r,a){return uo.renderToString(r,{displayMode:a,throwOnError:!1})}function vl(r,a){let l=a;for(;(l=r.indexOf("$$",l))!==-1;){if(r[l-1]!=="\\")return l;l+=1}return-1}function kl(r){let a=[],l="",d=()=>{l&&(a.push({type:"text",value:l}),l="")},u=0;for(;u<r.length;){let m=r[u];if(m==="\\"){let f=r[u+1];if(f==="$"){l+="$",u+=2;continue}if(f==="("){let h=r.indexOf("\\)",u+2);if(h!==-1){d(),a.push({type:"math",tex:r.slice(u+2,h),display:!1}),u=h+2;continue}}l+=f===void 0?m:m+f,u+=f===void 0?1:2;continue}if(m==="$"&&r[u+1]==="$"){let f=vl(r,u+2);if(f!==-1){d(),a.push({type:"math",tex:r.slice(u+2,f),display:!0}),u=f+2;continue}}l+=m,u+=1}return d(),a}var El="code, pre, script, style, svg, aside, math";function Sl(r){let a=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:d=>d.parentElement&&d.parentElement.closest(El)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),l=[];for(let d=a.nextNode();d;d=a.nextNode())(d.nodeValue.includes("$")||d.nodeValue.includes("\\("))&&l.push(d);for(let d of l){let u=kl(d.nodeValue);if(u.length===1&&u[0].type==="text"&&u[0].value===d.nodeValue)continue;let m=document.createDocumentFragment();for(let f of u)if(f.type==="text")m.appendChild(document.createTextNode(f.value));else{let h=document.createElement("span");h.innerHTML=xl(f.tex,f.display),m.appendChild(h.firstElementChild??document.createTextNode(""))}d.parentNode.replaceChild(m,d)}}function po(r){r.querySelectorAll("section[data-math]").forEach(a=>Sl(a))}ae();le();ae();le();var Lo=Wa(Mo(),1);var mt=Lo.default;ae();le();function Ro(r){let a=r.regex,l=r.COMMENT("--","$"),d={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},u={begin:/"/,end:/"/,contains:[{match:/""/}]},m=["true","false","unknown"],f=["double precision","large object","with timezone","without timezone"],h=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],w=["add","asc","collation","desc","final","first","last","view"],k=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],A=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],I=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],M=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],C=A,$=[...k,...w].filter(Te=>!A.includes(Te)),q={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},he={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},oe={match:a.concat(/\b/,a.either(...C),/\s*\(/),relevance:0,keywords:{built_in:C}};function de(Te){return a.concat(/\b/,a.either(...Te.map($e=>$e.replace(/\s+/,"\\s+"))),/\b/)}let j={scope:"keyword",match:de(M),relevance:0};function me(Te,{exceptions:$e,when:Re}={}){let be=Re;return $e=$e||[],Te.map(Ce=>Ce.match(/\|\d+$/)||$e.includes(Ce)?Ce:be(Ce)?`${Ce}|0`:Ce)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:me($,{when:Te=>Te.length<3}),literal:m,type:h,built_in:I},contains:[{scope:"type",match:de(f)},j,oe,q,d,u,r.C_NUMBER_MODE,r.C_BLOCK_COMMENT_MODE,l,he]}}ae();le();var Io="[A-Za-z$_][0-9A-Za-z$_]*",mc=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],fc=["true","false","null","undefined","NaN","Infinity"],Bo=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Po=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Do=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],gc=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],bc=[].concat(Do,Bo,Po);function qo(r){let a=r.regex,l=(U,{after:fe})=>{let Ee="</"+U[0].slice(1);return U.input.indexOf(Ee,fe)!==-1},d=Io,u={begin:"<>",end:"</>"},m=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(U,fe)=>{let Ee=U[0].length+U.index,ze=U.input[Ee];if(ze==="<"||ze===","){fe.ignoreMatch();return}ze===">"&&(l(U,{after:Ee})||fe.ignoreMatch());let Ne,s=U.input.substring(Ee);if(Ne=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Ne=s.match(/^\s+extends\s+/))&&Ne.index===0){fe.ignoreMatch();return}}},h={$pattern:Io,keyword:mc,literal:fc,built_in:bc,"variable.language":gc},w="[0-9](_?[0-9])*",k=`\\.(${w})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",I={className:"number",variants:[{begin:`(\\b(${A})((${k})|\\.)?|(${k}))[eE][+-]?(${w})\\b`},{begin:`\\b(${A})\\b((${k})\\b|\\.)?|(${k})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},$={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"css"}},q={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},he={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,M]},de={className:"comment",variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:d+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},j=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,{match:/\$\d+/},I];M.contains=j.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(j)});let me=[].concat(de,M.contains),Te=me.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(me)}]),$e={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Te},Re={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,a.concat(d,"(",a.concat(/\./,d),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,d],scope:{1:"keyword",3:"title.class"}}]},be={relevance:0,match:a.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Bo,...Po]}},Ce={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Xe={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[$e],illegal:/%/},xe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function E(U){return a.concat("(?!",U.join("|"),")")}let Ie={match:a.concat(/\b/,E([...Do,"super","import"].map(U=>`${U}\\s*\\(`)),d,a.lookahead(/\s*\(/)),className:"title.function",relevance:0},qe={begin:a.concat(/\./,a.lookahead(a.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},De={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},$e]},F="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,a.lookahead(F)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[$e]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:Te,CLASS_REFERENCE:be},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),Ce,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,de,{match:/\$\d+/},I,be,{scope:"attr",match:d+a.lookahead(":"),relevance:0},J,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[de,r.REGEXP_MODE,{className:"function",begin:F,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Te}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:m},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},Xe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[$e,r.inherit(r.TITLE_MODE,{begin:d,className:"title.function"})]},{match:/\.\.\./,relevance:0},qe,{match:"\\$"+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[$e]},Ie,xe,Re,De,{match:/\$[(.]/}]}}ae();le();var dr="[A-Za-z$_][0-9A-Za-z$_]*",Fo=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],zo=["true","false","null","undefined","NaN","Infinity"],Uo=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ho=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Go=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],jo=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ko=[].concat(Go,Uo,Ho);function yc(r){let a=r.regex,l=(U,{after:fe})=>{let Ee="</"+U[0].slice(1);return U.input.indexOf(Ee,fe)!==-1},d=dr,u={begin:"<>",end:"</>"},m=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(U,fe)=>{let Ee=U[0].length+U.index,ze=U.input[Ee];if(ze==="<"||ze===","){fe.ignoreMatch();return}ze===">"&&(l(U,{after:Ee})||fe.ignoreMatch());let Ne,s=U.input.substring(Ee);if(Ne=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Ne=s.match(/^\s+extends\s+/))&&Ne.index===0){fe.ignoreMatch();return}}},h={$pattern:dr,keyword:Fo,literal:zo,built_in:Ko,"variable.language":jo},w="[0-9](_?[0-9])*",k=`\\.(${w})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",I={className:"number",variants:[{begin:`(\\b(${A})((${k})|\\.)?|(${k}))[eE][+-]?(${w})\\b`},{begin:`\\b(${A})\\b((${k})\\b|\\.)?|(${k})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},$={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"css"}},q={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},he={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,M]},de={className:"comment",variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:d+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},j=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,{match:/\$\d+/},I];M.contains=j.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(j)});let me=[].concat(de,M.contains),Te=me.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(me)}]),$e={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Te},Re={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,a.concat(d,"(",a.concat(/\./,d),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,d],scope:{1:"keyword",3:"title.class"}}]},be={relevance:0,match:a.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Uo,...Ho]}},Ce={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Xe={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[$e],illegal:/%/},xe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function E(U){return a.concat("(?!",U.join("|"),")")}let Ie={match:a.concat(/\b/,E([...Go,"super","import"].map(U=>`${U}\\s*\\(`)),d,a.lookahead(/\s*\(/)),className:"title.function",relevance:0},qe={begin:a.concat(/\./,a.lookahead(a.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},De={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},$e]},F="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,a.lookahead(F)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[$e]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:Te,CLASS_REFERENCE:be},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),Ce,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,de,{match:/\$\d+/},I,be,{scope:"attr",match:d+a.lookahead(":"),relevance:0},J,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[de,r.REGEXP_MODE,{className:"function",begin:F,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Te}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:m},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},Xe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[$e,r.inherit(r.TITLE_MODE,{begin:d,className:"title.function"})]},{match:/\.\.\./,relevance:0},qe,{match:"\\$"+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[$e]},Ie,xe,Re,De,{match:/\$[(.]/}]}}function Wo(r){let a=r.regex,l=yc(r),d=dr,u=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],m={begin:[/namespace/,/\s+/,r.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},f={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:u},contains:[l.exports.CLASS_REFERENCE]},h={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},w=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],k={$pattern:dr,keyword:Fo.concat(w),literal:zo,built_in:Ko.concat(u),"variable.language":jo},A={className:"meta",begin:"@"+d},I=(q,he,oe)=>{let de=q.contains.findIndex(j=>j.label===he);if(de===-1)throw new Error("can not find mode to replace");q.contains.splice(de,1,oe)};Object.assign(l.keywords,k),l.exports.PARAMS_CONTAINS.push(A);let M=l.contains.find(q=>q.scope==="attr"),C=Object.assign({},M,{match:a.concat(d,a.lookahead(/\s*\?:/))});l.exports.PARAMS_CONTAINS.push([l.exports.CLASS_REFERENCE,M,C]),l.contains=l.contains.concat([A,m,f,C]),I(l,"shebang",r.SHEBANG()),I(l,"use_strict",h);let $=l.contains.find(q=>q.label==="func.def");return $.relevance=0,Object.assign(l,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),l}ae();le();function Vo(r){let a=r.regex,l=/[\p{XID_Start}_]\p{XID_Continue}*/u,d=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],h={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:d,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},w={className:"meta",begin:/^(>>>|\.\.\.) /},k={className:"subst",begin:/\{/,end:/\}/,keywords:h,illegal:/#/},A={begin:/\{\{/,relevance:0},I={className:"string",contains:[r.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[r.BACKSLASH_ESCAPE,w],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[r.BACKSLASH_ESCAPE,w],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[r.BACKSLASH_ESCAPE,w,A,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[r.BACKSLASH_ESCAPE,w,A,k]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[r.BACKSLASH_ESCAPE,A,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,A,k]},r.APOS_STRING_MODE,r.QUOTE_STRING_MODE]},M="[0-9](_?[0-9])*",C=`(\\b(${M}))?\\.(${M})|\\b(${M})\\.`,$=`\\b|${d.join("|")}`,q={className:"number",relevance:0,variants:[{begin:`(\\b(${M})|(${C}))[eE][+-]?(${M})[jJ]?(?=${$})`},{begin:`(${C})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${$})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${$})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${$})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${$})`},{begin:`\\b(${M})[jJ](?=${$})`}]},he={className:"comment",begin:a.lookahead(/# type:/),end:/$/,keywords:h,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},oe={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:["self",w,q,I,r.HASH_COMMENT_MODE]}]};return k.contains=[I,q,w],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:h,illegal:/(<\/|\?)|=>/,contains:[w,q,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},I,he,r.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,l],scope:{1:"keyword",3:"title.function"},contains:[oe]},{variants:[{match:[/\bclass/,/\s+/,l,/\s*/,/\(\s*/,l,/\s*\)/]},{match:[/\bclass/,/\s+/,l]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[q,oe,I]}]}}ae();le();function Zo(r){let a=r.regex,l={},d={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[l]}]};Object.assign(l,{className:"variable",variants:[{begin:a.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},d]});let u={className:"subst",begin:/\$\(/,end:/\)/,contains:[r.BACKSLASH_ESCAPE]},m=r.inherit(r.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),f={begin:/<<-?\s*(?=\w+)/,starts:{contains:[r.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},h={className:"string",begin:/"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,l,u]};u.contains.push(h);let w={match:/\\"/},k={className:"string",begin:/'/,end:/'/},A={match:/\\'/},I={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},r.NUMBER_MODE,l]},M=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],C=r.SHEBANG({binary:`(${M.join("|")})`,relevance:10}),$={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[r.inherit(r.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},q=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],he=["true","false"],oe={match:/(\/[a-z._-]+)+/},de=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],j=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],me=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],Te=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:q,literal:he,built_in:[...de,...j,"set","shopt",...me,...Te]},contains:[C,r.SHEBANG(),$,I,m,f,oe,h,w,k,A,l]}}ae();le();function Xo(r){let a="true false yes no null",l="[\\w#;/?:@&=+$,.~*'()[\\]]+",d={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},u={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},m={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},f={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[r.BACKSLASH_ESCAPE,u]},h=r.inherit(f,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),M={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},C={end:",",endsWithParent:!0,excludeEnd:!0,keywords:a,relevance:0},$={begin:/\{/,end:/\}/,contains:[C],illegal:"\\n",relevance:0},q={begin:"\\[",end:"\\]",contains:[C],illegal:"\\n",relevance:0},he=[d,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+l},{className:"type",begin:"!<"+l+">"},{className:"type",begin:"!"+l},{className:"type",begin:"!!"+l},{className:"meta",begin:"&"+r.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+r.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},r.HASH_COMMENT_MODE,{beginKeywords:a,keywords:{literal:a}},M,{className:"number",begin:r.C_NUMBER_RE+"\\b",relevance:0},$,q,m,f],oe=[...he];return oe.pop(),oe.push(h),C.contains=oe,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:he}}ae();le();function Yo(r){let a={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},l={match:/[{}[\],:]/,className:"punctuation",relevance:0},d=["true","false","null"],u={scope:"literal",beginKeywords:d.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:d},contains:[a,l,r.QUOTE_STRING_MODE,u,r.C_NUMBER_MODE,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}ae();le();var $n="[0-9](_*[0-9])*",ur=`\\.(${$n})`,pr="[0-9a-fA-F](_*[0-9a-fA-F])*",Jo={className:"number",variants:[{begin:`(\\b(${$n})((${ur})|\\.)?|(${ur}))[eE][+-]?(${$n})[fFdD]?\\b`},{begin:`\\b(${$n})((${ur})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ur})[fFdD]?\\b`},{begin:`\\b(${$n})[fFdD]\\b`},{begin:`\\b0[xX]((${pr})\\.?|(${pr})?\\.(${pr}))[pP][+-]?(${$n})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${pr})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Qo(r,a,l){return l===-1?"":r.replace(a,d=>Qo(r,a,l-1))}function ei(r){let a=r.regex,l="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",d=l+Qo("(?:<"+l+"~~~(?:\\s*,\\s*"+l+"~~~)*>)?",/~~~/g,2),w={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},k={className:"meta",begin:"@"+l,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},A={className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[r.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:w,illegal:/<\/|#/,contains:[r.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[r.BACKSLASH_ESCAPE]},r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,l],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[a.concat(/(?!else)/,l),/\s+/,l,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,l],className:{1:"keyword",3:"title.class"},contains:[A,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+d+"\\s+)",r.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:w,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[k,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,Jo,r.C_BLOCK_COMMENT_MODE]},r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE]},Jo,k]}}ae();le();function ti(r){let m={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:m,illegal:"</",contains:[r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE,{className:"string",variants:[r.QUOTE_STRING_MODE,r.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[r.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:m,illegal:/["']/}]}]}}ae();le();function ni(r){let a=r.regex,l=/(r#)?/,d=a.concat(l,r.UNDERSCORE_IDENT_RE),u=a.concat(l,r.IDENT_RE),m={className:"title.function.invoke",relevance:0,begin:a.concat(/\b/,/(?!let|for|while|if|else|match\b)/,u,a.lookahead(/\s*\(/))},f="([ui](8|16|32|64|128|size)|f(32|64))?",h=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],w=["true","false","Some","None","Ok","Err"],k=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],A=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:r.IDENT_RE+"!?",type:A,keyword:h,literal:w,built_in:k},illegal:"</",contains:[r.C_LINE_COMMENT_MODE,r.COMMENT("/\\*","\\*/",{contains:["self"]}),r.inherit(r.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+f},{begin:"\\b0o([0-7_]+)"+f},{begin:"\\b0x([A-Fa-f0-9_]+)"+f},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+f}],relevance:0},{begin:[/fn/,/\s+/,d],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[r.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,d],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,d,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,d],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,d],className:{1:"keyword",3:"title.class"}},{begin:r.IDENT_RE+"::",keywords:{keyword:"Self",built_in:k,type:A}},{className:"punctuation",begin:"->"},m]}}ae();le();function ri(r){let a=r.regex,l=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),d=/[\p{L}0-9._:-]+/u,u={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},m={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},f=r.inherit(m,{begin:/\(/,end:/\)/}),h=r.inherit(r.APOS_STRING_MODE,{className:"string"}),w=r.inherit(r.QUOTE_STRING_MODE,{className:"string"}),k={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:d,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[u]},{begin:/'/,end:/'/,contains:[u]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[m,w,h,f,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[m,f,w,h]}]}]},r.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},u,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[w]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[k],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[k],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:a.concat(/</,a.lookahead(a.concat(l,a.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:l,relevance:0,starts:k}]},{className:"tag",begin:a.concat(/<\//,a.lookahead(a.concat(l,/>/))),contains:[{className:"name",begin:l,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}ae();le();var wc=r=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:r.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:r.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),xc=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],vc=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],kc=[...xc,...vc],Ec=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Sc=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Ac=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_c=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function si(r){let a=r.regex,l=wc(r),d={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},u="and or not only",m=/@-?\w[\w]*(-\w+)*/,f="[a-zA-Z-][a-zA-Z0-9_-]*",h=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[l.BLOCK_COMMENT,d,l.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+f,relevance:0},l.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Sc.join("|")+")"},{begin:":(:)?("+Ac.join("|")+")"}]},l.CSS_VARIABLE,{className:"attribute",begin:"\\b("+_c.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[l.BLOCK_COMMENT,l.HEXCOLOR,l.IMPORTANT,l.CSS_NUMBER_MODE,...h,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...h,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},l.FUNCTION_DISPATCH]},{begin:a.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:m},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:u,attribute:Ec.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...h,l.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+kc.join("|")+")\\b"}]}}ae();le();function oi(r){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}mt.registerLanguage("sql",Ro);mt.registerLanguage("javascript",qo);mt.registerLanguage("typescript",Wo);mt.registerLanguage("python",Vo);mt.registerLanguage("bash",Zo);mt.registerLanguage("yaml",Xo);mt.registerLanguage("json",Yo);mt.registerLanguage("java",ei);mt.registerLanguage("go",ti);mt.registerLanguage("rust",ni);mt.registerLanguage("xml",ri);mt.registerLanguage("css",si);mt.registerLanguage("plaintext",oi);mt.registerAliases(["js"],{languageName:"javascript"});mt.registerAliases(["ts"],{languageName:"typescript"});mt.registerAliases(["shell","sh","zsh"],{languageName:"bash"});mt.registerAliases(["html"],{languageName:"xml"});mt.registerAliases(["text","plain"],{languageName:"plaintext"});function Tc(r,a){return r.split("|").map(l=>{if(l=l.trim(),l===""||l==="all")return Array.from({length:a},(u,m)=>m+1);let d=[];for(let u of l.split(",")){let m=u.trim().match(/^(\d+)(?:-(\d+))?$/);if(!m)continue;let f=parseInt(m[1],10),h=m[2]?parseInt(m[2],10):f;for(let w=f;w<=Math.min(h,a);w++)d.push(w)}return d})}function Cc(r){let a=[[]];for(function l(d,u){for(let m of d.childNodes)m.nodeType===Node.TEXT_NODE?m.nodeValue.split(`
100
- `).forEach((h,w)=>{w>0&&a.push([]),h&&a[a.length-1].push({path:u,text:h})}):m.nodeType===Node.ELEMENT_NODE&&l(m,[...u,m])}(r,[]);a.length&&a[a.length-1].length===0;)a.pop();r.textContent="";for(let l of a){let d=document.createElement("span");d.className="code-line";for(let{path:u,text:m}of l){let f=d;for(let h of u){let w=f.lastChild;w&&w.__orig===h||(w=h.cloneNode(!1),w.__orig=h,f.appendChild(w)),f=w}f.appendChild(document.createTextNode(m))}r.appendChild(d)}return r.querySelectorAll(":scope > .code-line")}function Nc(r,a){if(r.length===a)return"all lines";let l=[...r],d=[],u=l[0],m=l[0];for(let f of l.slice(1)){if(f===m+1){m=f;continue}d.push(u===m?`${u}`:`${u}-${m}`),u=m=f}return d.push(u===m?`${u}`:`${u}-${m}`),`lines ${d.join(",")}`}function ii(r,a){r.querySelectorAll("pre > code").forEach(l=>{let d=[...l.classList].find(A=>A.startsWith("language-")),u=d?d.slice(9):null,m=l.textContent.replace(/^\n/,"").replace(/\s+$/,"");u&&mt.getLanguage(u)?l.innerHTML=mt.highlight(m,{language:u}).value:l.textContent=m,l.classList.add("hljs");let f=l.parentElement,h=Cc(l);f.hasAttribute("data-lines-numbers")&&f.classList.add("line-numbers");let w=f.getAttribute("data-lines");if(!w)return;let k=Tc(w,h.length);f.classList.add("stepping"),a(f,{count:k.length,label:A=>A===0?"code":Nc(k[A-1],h.length),apply(A){if(h.forEach(C=>C.classList.remove("line-hl","line-dim")),A===0)return;let I=new Set(k[A-1]),M=I.size===h.length;h.forEach((C,$)=>{I.has($+1)?C.classList.add("line-hl"):M||C.classList.add("line-dim")})}})})}ae();le();var $c=/⟨CLICK⟩|&lt;CLICK&gt;|<click(?:\s[^>]*)?>(?:<\/click>)?/gi;function ai(r){return(r||"").split($c)}function Wr(r){let a="width=1100,height=700",l=window.open("","decklight-speaker",a);if(!l)return null;let d=!1;try{d=l.document.body?l.document.body.childNodes.length>0:!1}catch{d=!0}if(d){try{l.close()}catch{}if(l=window.open("","decklight-speaker",a),!l)return null;try{l.document}catch{return null}}let u=()=>{let f=new URL(location.href);return f.searchParams.set("embedded",""),f.hash="",f.href};window.__decklightBridge={subscribe(f){r.__speakerCb=f},getState:()=>li(r,u()),next:()=>r.next(),prev:()=>r.prev()},r.__notifySpeaker=()=>{r.__speakerCb&&!l.closed&&r.__speakerCb(li(r,u()))};let m=`${r.config.width} / ${r.config.height}`;return l.document.write(`<!doctype html><html><head><meta charset="utf-8">
99
+ `+c.toString())]);return x.style.color=g.errorColor,x.style.whiteSpace="pre-line",x}(a,e,n)}};return{version:"0.13.3",render:js,renderToString:function(e,t){return Hr(e,t).toMarkup()},renderMathInElement:function(e,t){if(!e)throw new Error("No element provided to render");let n={};for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a]);n.fences?n.delimiters=(a=>a==="$"||a==="("?ur[a]:a==="$+"||a==="(+"?ur[a.slice(0,1)].concat(Ur):a==="ams"?Ur:a==="all"?ur["("].concat(ur.$).concat(Ur):Hs)(n.fences):n.delimiters=n.delimiters||Hs,n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},Gs(e,n),Us(e)},postProcess:Us,ParseError:r,definePreamble:function(e,t){let n=new P(t);if(n.macros={},!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let a=new Qn(e,n,!0);return delete a.gullet.macros.current["\\df@tag"],a.parse()},__parse:function(e,t){let n=new P(t);return zs(e,n)},__renderToMathMLTree:Hr,__defineSymbol:s,__defineMacro:I}}(),fo=mo;function Sl(r,i){return fo.renderToString(r,{displayMode:i,throwOnError:!1})}function Al(r,i){let l=i;for(;(l=r.indexOf("$$",l))!==-1;){if(r[l-1]!=="\\")return l;l+=1}return-1}function _l(r){let i=[],l="",d=()=>{l&&(i.push({type:"text",value:l}),l="")},u=0;for(;u<r.length;){let m=r[u];if(m==="\\"){let f=r[u+1];if(f==="$"){l+="$",u+=2;continue}if(f==="("){let h=r.indexOf("\\)",u+2);if(h!==-1){d(),i.push({type:"math",tex:r.slice(u+2,h),display:!1}),u=h+2;continue}}l+=f===void 0?m:m+f,u+=f===void 0?1:2;continue}if(m==="$"&&r[u+1]==="$"){let f=Al(r,u+2);if(f!==-1){d(),i.push({type:"math",tex:r.slice(u+2,f),display:!0}),u=f+2;continue}}l+=m,u+=1}return d(),i}var Tl="code, pre, script, style, svg, aside, math";function Cl(r){let i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:d=>d.parentElement&&d.parentElement.closest(Tl)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),l=[];for(let d=i.nextNode();d;d=i.nextNode())(d.nodeValue.includes("$")||d.nodeValue.includes("\\("))&&l.push(d);for(let d of l){let u=_l(d.nodeValue);if(u.length===1&&u[0].type==="text"&&u[0].value===d.nodeValue)continue;let m=document.createDocumentFragment();for(let f of u)if(f.type==="text")m.appendChild(document.createTextNode(f.value));else{let h=document.createElement("span");h.innerHTML=Sl(f.tex,f.display),m.appendChild(h.firstElementChild??document.createTextNode(""))}d.parentNode.replaceChild(m,d)}}function go(r){r.querySelectorAll("section[data-math]").forEach(i=>Cl(i))}le();ce();le();ce();var Po=Ya(Bo(),1);var Nt=Po.default;le();ce();function Do(r){let i=r.regex,l=r.COMMENT("--","$"),d={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},u={begin:/"/,end:/"/,contains:[{match:/""/}]},m=["true","false","unknown"],f=["double precision","large object","with timezone","without timezone"],h=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],b=["add","asc","collation","desc","final","first","last","view"],k=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],A=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],P=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],M=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],T=A,C=[...k,...b].filter(Oe=>!A.includes(Oe)),F={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},ye={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},ge={match:i.concat(/\b/,i.either(...T),/\s*\(/),relevance:0,keywords:{built_in:T}};function be(Oe){return i.concat(/\b/,i.either(...Oe.map(ke=>ke.replace(/\s+/,"\\s+"))),/\b/)}let J={scope:"keyword",match:be(M),relevance:0};function de(Oe,{exceptions:ke,when:De}={}){let xe=De;return ke=ke||[],Oe.map(Le=>Le.match(/\|\d+$/)||ke.includes(Le)?Le:xe(Le)?`${Le}|0`:Le)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:de(C,{when:Oe=>Oe.length<3}),literal:m,type:h,built_in:P},contains:[{scope:"type",match:be(f)},J,ge,F,d,u,r.C_NUMBER_MODE,r.C_BLOCK_COMMENT_MODE,l,ye]}}le();ce();var qo="[A-Za-z$_][0-9A-Za-z$_]*",yc=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],wc=["true","false","null","undefined","NaN","Infinity"],Fo=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],zo=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Uo=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],xc=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],vc=[].concat(Uo,Fo,zo);function Ho(r){let i=r.regex,l=(V,{after:re})=>{let Ae="</"+V[0].slice(1);return V.input.indexOf(Ae,re)!==-1},d=qo,u={begin:"<>",end:"</>"},m=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(V,re)=>{let Ae=V[0].length+V.index,Ke=V.input[Ae];if(Ke==="<"||Ke===","){re.ignoreMatch();return}Ke===">"&&(l(V,{after:Ae})||re.ignoreMatch());let Ce,s=V.input.substring(Ae);if(Ce=s.match(/^\s*=/)){re.ignoreMatch();return}if((Ce=s.match(/^\s+extends\s+/))&&Ce.index===0){re.ignoreMatch();return}}},h={$pattern:qo,keyword:yc,literal:wc,built_in:vc,"variable.language":xc},b="[0-9](_?[0-9])*",k=`\\.(${b})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",P={className:"number",variants:[{begin:`(\\b(${A})((${k})|\\.)?|(${k}))[eE][+-]?(${b})\\b`},{begin:`\\b(${A})\\b((${k})\\b|\\.)?|(${k})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},T={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},C={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"css"}},F={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},ye={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,M]},be={className:"comment",variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:d+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},J=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,T,C,F,ye,{match:/\$\d+/},P];M.contains=J.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(J)});let de=[].concat(be,M.contains),Oe=de.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(de)}]),ke={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Oe},De={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,i.concat(d,"(",i.concat(/\./,d),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,d],scope:{1:"keyword",3:"title.class"}}]},xe={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Fo,...zo]}},Le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},st={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[ke],illegal:/%/},at={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function _(V){return i.concat("(?!",V.join("|"),")")}let qe={match:i.concat(/\b/,_([...Uo,"super","import"].map(V=>`${V}\\s*\\(`)),d,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},Je={begin:i.concat(/\./,i.lookahead(i.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},je={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},ke]},O="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(O)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[ke]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:Oe,CLASS_REFERENCE:xe},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),Le,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,T,C,F,ye,be,{match:/\$\d+/},P,xe,{scope:"attr",match:d+i.lookahead(":"),relevance:0},D,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[be,r.REGEXP_MODE,{className:"function",begin:O,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Oe}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:m},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},st,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[ke,r.inherit(r.TITLE_MODE,{begin:d,className:"title.function"})]},{match:/\.\.\./,relevance:0},Je,{match:"\\$"+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[ke]},qe,at,De,je,{match:/\$[(.]/}]}}le();ce();var xr="[A-Za-z$_][0-9A-Za-z$_]*",Go=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],jo=["true","false","null","undefined","NaN","Infinity"],Ko=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Wo=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Vo=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Zo=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Xo=[].concat(Vo,Ko,Wo);function kc(r){let i=r.regex,l=(V,{after:re})=>{let Ae="</"+V[0].slice(1);return V.input.indexOf(Ae,re)!==-1},d=xr,u={begin:"<>",end:"</>"},m=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(V,re)=>{let Ae=V[0].length+V.index,Ke=V.input[Ae];if(Ke==="<"||Ke===","){re.ignoreMatch();return}Ke===">"&&(l(V,{after:Ae})||re.ignoreMatch());let Ce,s=V.input.substring(Ae);if(Ce=s.match(/^\s*=/)){re.ignoreMatch();return}if((Ce=s.match(/^\s+extends\s+/))&&Ce.index===0){re.ignoreMatch();return}}},h={$pattern:xr,keyword:Go,literal:jo,built_in:Xo,"variable.language":Zo},b="[0-9](_?[0-9])*",k=`\\.(${b})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",P={className:"number",variants:[{begin:`(\\b(${A})((${k})|\\.)?|(${k}))[eE][+-]?(${b})\\b`},{begin:`\\b(${A})\\b((${k})\\b|\\.)?|(${k})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},T={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},C={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"css"}},F={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},ye={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,M]},be={className:"comment",variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:d+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},J=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,T,C,F,ye,{match:/\$\d+/},P];M.contains=J.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(J)});let de=[].concat(be,M.contains),Oe=de.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(de)}]),ke={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Oe},De={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,i.concat(d,"(",i.concat(/\./,d),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,d],scope:{1:"keyword",3:"title.class"}}]},xe={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ko,...Wo]}},Le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},st={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[ke],illegal:/%/},at={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function _(V){return i.concat("(?!",V.join("|"),")")}let qe={match:i.concat(/\b/,_([...Vo,"super","import"].map(V=>`${V}\\s*\\(`)),d,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},Je={begin:i.concat(/\./,i.lookahead(i.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},je={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},ke]},O="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(O)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[ke]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:Oe,CLASS_REFERENCE:xe},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),Le,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,T,C,F,ye,be,{match:/\$\d+/},P,xe,{scope:"attr",match:d+i.lookahead(":"),relevance:0},D,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[be,r.REGEXP_MODE,{className:"function",begin:O,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:Oe}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:m},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},st,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[ke,r.inherit(r.TITLE_MODE,{begin:d,className:"title.function"})]},{match:/\.\.\./,relevance:0},Je,{match:"\\$"+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[ke]},qe,at,De,je,{match:/\$[(.]/}]}}function Yo(r){let i=r.regex,l=kc(r),d=xr,u=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],m={begin:[/namespace/,/\s+/,r.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},f={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:u},contains:[l.exports.CLASS_REFERENCE]},h={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},b=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],k={$pattern:xr,keyword:Go.concat(b),literal:jo,built_in:Xo.concat(u),"variable.language":Zo},A={className:"meta",begin:"@"+d},P=(F,ye,ge)=>{let be=F.contains.findIndex(J=>J.label===ye);if(be===-1)throw new Error("can not find mode to replace");F.contains.splice(be,1,ge)};Object.assign(l.keywords,k),l.exports.PARAMS_CONTAINS.push(A);let M=l.contains.find(F=>F.scope==="attr"),T=Object.assign({},M,{match:i.concat(d,i.lookahead(/\s*\?:/))});l.exports.PARAMS_CONTAINS.push([l.exports.CLASS_REFERENCE,M,T]),l.contains=l.contains.concat([A,m,f,T]),P(l,"shebang",r.SHEBANG()),P(l,"use_strict",h);let C=l.contains.find(F=>F.label==="func.def");return C.relevance=0,Object.assign(l,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),l}le();ce();function Jo(r){let i=r.regex,l=/[\p{XID_Start}_]\p{XID_Continue}*/u,d=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],h={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:d,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},b={className:"meta",begin:/^(>>>|\.\.\.) /},k={className:"subst",begin:/\{/,end:/\}/,keywords:h,illegal:/#/},A={begin:/\{\{/,relevance:0},P={className:"string",contains:[r.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[r.BACKSLASH_ESCAPE,b],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[r.BACKSLASH_ESCAPE,b],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[r.BACKSLASH_ESCAPE,b,A,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[r.BACKSLASH_ESCAPE,b,A,k]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[r.BACKSLASH_ESCAPE,A,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,A,k]},r.APOS_STRING_MODE,r.QUOTE_STRING_MODE]},M="[0-9](_?[0-9])*",T=`(\\b(${M}))?\\.(${M})|\\b(${M})\\.`,C=`\\b|${d.join("|")}`,F={className:"number",relevance:0,variants:[{begin:`(\\b(${M})|(${T}))[eE][+-]?(${M})[jJ]?(?=${C})`},{begin:`(${T})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${C})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${C})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${C})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${C})`},{begin:`\\b(${M})[jJ](?=${C})`}]},ye={className:"comment",begin:i.lookahead(/# type:/),end:/$/,keywords:h,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},ge={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:["self",b,F,P,r.HASH_COMMENT_MODE]}]};return k.contains=[P,F,b],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:h,illegal:/(<\/|\?)|=>/,contains:[b,F,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},P,ye,r.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,l],scope:{1:"keyword",3:"title.function"},contains:[ge]},{variants:[{match:[/\bclass/,/\s+/,l,/\s*/,/\(\s*/,l,/\s*\)/]},{match:[/\bclass/,/\s+/,l]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[F,ge,P]}]}}le();ce();function Qo(r){let i=r.regex,l={},d={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[l]}]};Object.assign(l,{className:"variable",variants:[{begin:i.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},d]});let u={className:"subst",begin:/\$\(/,end:/\)/,contains:[r.BACKSLASH_ESCAPE]},m=r.inherit(r.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),f={begin:/<<-?\s*(?=\w+)/,starts:{contains:[r.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},h={className:"string",begin:/"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,l,u]};u.contains.push(h);let b={match:/\\"/},k={className:"string",begin:/'/,end:/'/},A={match:/\\'/},P={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},r.NUMBER_MODE,l]},M=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],T=r.SHEBANG({binary:`(${M.join("|")})`,relevance:10}),C={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[r.inherit(r.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},F=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],ye=["true","false"],ge={match:/(\/[a-z._-]+)+/},be=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],J=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],de=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],Oe=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:F,literal:ye,built_in:[...be,...J,"set","shopt",...de,...Oe]},contains:[T,r.SHEBANG(),C,P,m,f,ge,h,b,k,A,l]}}le();ce();function ei(r){let i="true false yes no null",l="[\\w#;/?:@&=+$,.~*'()[\\]]+",d={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},u={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},m={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},f={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[r.BACKSLASH_ESCAPE,u]},h=r.inherit(f,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),M={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},T={end:",",endsWithParent:!0,excludeEnd:!0,keywords:i,relevance:0},C={begin:/\{/,end:/\}/,contains:[T],illegal:"\\n",relevance:0},F={begin:"\\[",end:"\\]",contains:[T],illegal:"\\n",relevance:0},ye=[d,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+l},{className:"type",begin:"!<"+l+">"},{className:"type",begin:"!"+l},{className:"type",begin:"!!"+l},{className:"meta",begin:"&"+r.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+r.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},r.HASH_COMMENT_MODE,{beginKeywords:i,keywords:{literal:i}},M,{className:"number",begin:r.C_NUMBER_RE+"\\b",relevance:0},C,F,m,f],ge=[...ye];return ge.pop(),ge.push(h),T.contains=ge,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:ye}}le();ce();function ti(r){let i={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},l={match:/[{}[\],:]/,className:"punctuation",relevance:0},d=["true","false","null"],u={scope:"literal",beginKeywords:d.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:d},contains:[i,l,r.QUOTE_STRING_MODE,u,r.C_NUMBER_MODE,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}le();ce();var Gn="[0-9](_*[0-9])*",vr=`\\.(${Gn})`,kr="[0-9a-fA-F](_*[0-9a-fA-F])*",ni={className:"number",variants:[{begin:`(\\b(${Gn})((${vr})|\\.)?|(${vr}))[eE][+-]?(${Gn})[fFdD]?\\b`},{begin:`\\b(${Gn})((${vr})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${vr})[fFdD]?\\b`},{begin:`\\b(${Gn})[fFdD]\\b`},{begin:`\\b0[xX]((${kr})\\.?|(${kr})?\\.(${kr}))[pP][+-]?(${Gn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${kr})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function ri(r,i,l){return l===-1?"":r.replace(i,d=>ri(r,i,l-1))}function si(r){let i=r.regex,l="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",d=l+ri("(?:<"+l+"~~~(?:\\s*,\\s*"+l+"~~~)*>)?",/~~~/g,2),b={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},k={className:"meta",begin:"@"+l,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},A={className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[r.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:b,illegal:/<\/|#/,contains:[r.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[r.BACKSLASH_ESCAPE]},r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,l],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[i.concat(/(?!else)/,l),/\s+/,l,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,l],className:{1:"keyword",3:"title.class"},contains:[A,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+d+"\\s+)",r.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:b,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[k,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,ni,r.C_BLOCK_COMMENT_MODE]},r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE]},ni,k]}}le();ce();function oi(r){let m={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:m,illegal:"</",contains:[r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE,{className:"string",variants:[r.QUOTE_STRING_MODE,r.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[r.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:m,illegal:/["']/}]}]}}le();ce();function ii(r){let i=r.regex,l=/(r#)?/,d=i.concat(l,r.UNDERSCORE_IDENT_RE),u=i.concat(l,r.IDENT_RE),m={className:"title.function.invoke",relevance:0,begin:i.concat(/\b/,/(?!let|for|while|if|else|match\b)/,u,i.lookahead(/\s*\(/))},f="([ui](8|16|32|64|128|size)|f(32|64))?",h=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],b=["true","false","Some","None","Ok","Err"],k=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],A=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:r.IDENT_RE+"!?",type:A,keyword:h,literal:b,built_in:k},illegal:"</",contains:[r.C_LINE_COMMENT_MODE,r.COMMENT("/\\*","\\*/",{contains:["self"]}),r.inherit(r.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+f},{begin:"\\b0o([0-7_]+)"+f},{begin:"\\b0x([A-Fa-f0-9_]+)"+f},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+f}],relevance:0},{begin:[/fn/,/\s+/,d],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[r.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,d],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,d,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,d],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,d],className:{1:"keyword",3:"title.class"}},{begin:r.IDENT_RE+"::",keywords:{keyword:"Self",built_in:k,type:A}},{className:"punctuation",begin:"->"},m]}}le();ce();function ai(r){let i=r.regex,l=i.concat(/[\p{L}_]/u,i.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),d=/[\p{L}0-9._:-]+/u,u={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},m={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},f=r.inherit(m,{begin:/\(/,end:/\)/}),h=r.inherit(r.APOS_STRING_MODE,{className:"string"}),b=r.inherit(r.QUOTE_STRING_MODE,{className:"string"}),k={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:d,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[u]},{begin:/'/,end:/'/,contains:[u]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[m,b,h,f,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[m,f,b,h]}]}]},r.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},u,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[b]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[k],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[k],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:i.concat(/</,i.lookahead(i.concat(l,i.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:l,relevance:0,starts:k}]},{className:"tag",begin:i.concat(/<\//,i.lookahead(i.concat(l,/>/))),contains:[{className:"name",begin:l,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}le();ce();var Ec=r=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:r.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:r.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Sc=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Ac=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],_c=[...Sc,...Ac],Tc=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Cc=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Nc=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),$c=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function li(r){let i=r.regex,l=Ec(r),d={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},u="and or not only",m=/@-?\w[\w]*(-\w+)*/,f="[a-zA-Z-][a-zA-Z0-9_-]*",h=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[l.BLOCK_COMMENT,d,l.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+f,relevance:0},l.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Cc.join("|")+")"},{begin:":(:)?("+Nc.join("|")+")"}]},l.CSS_VARIABLE,{className:"attribute",begin:"\\b("+$c.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[l.BLOCK_COMMENT,l.HEXCOLOR,l.IMPORTANT,l.CSS_NUMBER_MODE,...h,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...h,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},l.FUNCTION_DISPATCH]},{begin:i.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:m},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:u,attribute:Tc.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...h,l.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+_c.join("|")+")\\b"}]}}le();ce();function ci(r){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}Nt.registerLanguage("sql",Do);Nt.registerLanguage("javascript",Ho);Nt.registerLanguage("typescript",Yo);Nt.registerLanguage("python",Jo);Nt.registerLanguage("bash",Qo);Nt.registerLanguage("yaml",ei);Nt.registerLanguage("json",ti);Nt.registerLanguage("java",si);Nt.registerLanguage("go",oi);Nt.registerLanguage("rust",ii);Nt.registerLanguage("xml",ai);Nt.registerLanguage("css",li);Nt.registerLanguage("plaintext",ci);Nt.registerAliases(["js"],{languageName:"javascript"});Nt.registerAliases(["ts"],{languageName:"typescript"});Nt.registerAliases(["shell","sh","zsh"],{languageName:"bash"});Nt.registerAliases(["html"],{languageName:"xml"});Nt.registerAliases(["text","plain"],{languageName:"plaintext"});function Oc(r,i){return r.split("|").map(l=>{if(l=l.trim(),l===""||l==="all")return Array.from({length:i},(u,m)=>m+1);let d=[];for(let u of l.split(",")){let m=u.trim().match(/^(\d+)(?:-(\d+))?$/);if(!m)continue;let f=parseInt(m[1],10),h=m[2]?parseInt(m[2],10):f;for(let b=f;b<=Math.min(h,i);b++)d.push(b)}return d})}function Mc(r){let i=[[]];for(function l(d,u){for(let m of d.childNodes)m.nodeType===Node.TEXT_NODE?m.nodeValue.split(`
100
+ `).forEach((h,b)=>{b>0&&i.push([]),h&&i[i.length-1].push({path:u,text:h})}):m.nodeType===Node.ELEMENT_NODE&&l(m,[...u,m])}(r,[]);i.length&&i[i.length-1].length===0;)i.pop();r.textContent="";for(let l of i){let d=document.createElement("span");d.className="code-line";for(let{path:u,text:m}of l){let f=d;for(let h of u){let b=f.lastChild;b&&b.__orig===h||(b=h.cloneNode(!1),b.__orig=h,f.appendChild(b)),f=b}f.appendChild(document.createTextNode(m))}r.appendChild(d)}return r.querySelectorAll(":scope > .code-line")}function Lc(r,i){if(r.length===i)return"all lines";let l=[...r],d=[],u=l[0],m=l[0];for(let f of l.slice(1)){if(f===m+1){m=f;continue}d.push(u===m?`${u}`:`${u}-${m}`),u=m=f}return d.push(u===m?`${u}`:`${u}-${m}`),`lines ${d.join(",")}`}function di(r,i){r.querySelectorAll("pre > code").forEach(l=>{let d=[...l.classList].find(A=>A.startsWith("language-")),u=d?d.slice(9):null,m=l.textContent.replace(/^\n/,"").replace(/\s+$/,"");u&&Nt.getLanguage(u)?l.innerHTML=Nt.highlight(m,{language:u}).value:l.textContent=m,l.classList.add("hljs");let f=l.parentElement,h=Mc(l);f.hasAttribute("data-lines-numbers")&&f.classList.add("line-numbers");let b=f.getAttribute("data-lines");if(!b)return;let k=Oc(b,h.length);f.classList.add("stepping"),i(f,{count:k.length,label:A=>A===0?"code":Lc(k[A-1],h.length),apply(A){if(h.forEach(T=>T.classList.remove("line-hl","line-dim")),A===0)return;let P=new Set(k[A-1]),M=P.size===h.length;h.forEach((T,C)=>{P.has(C+1)?T.classList.add("line-hl"):M||T.classList.add("line-dim")})}})})}le();ce();var Rc=/⟨CLICK⟩|&lt;CLICK&gt;|<click(?:\s[^>]*)?>(?:<\/click>)?/gi;function ui(r){return(r||"").split(Rc)}function ts(r){let i="width=1100,height=700",l=window.open("","decklight-speaker",i);if(!l)return null;let d=!1;try{d=l.document.body?l.document.body.childNodes.length>0:!1}catch{d=!0}if(d){try{l.close()}catch{}if(l=window.open("","decklight-speaker",i),!l)return null;try{l.document}catch{return null}}let u=()=>{let f=new URL(location.href);return f.searchParams.set("embedded",""),f.hash="",f.href};window.__decklightBridge={subscribe(f){r.__speakerCb=f},getState:()=>pi(r,u()),next:()=>r.next(),prev:()=>r.prev()},r.__notifySpeaker=()=>{r.__speakerCb&&!l.closed&&r.__speakerCb(pi(r,u()))};let m=`${r.config.width} / ${r.config.height}`;return l.document.write(`<!doctype html><html><head><meta charset="utf-8">
101
101
  <title>Decklight \u2014 speaker view</title>
102
102
  <style>
103
103
  body { margin:0; background:#111; color:#eee; font:14px/1.5 -apple-system, system-ui, sans-serif;
@@ -227,30 +227,30 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),U===void 0&
227
227
  }
228
228
  connect(30);
229
229
  <\/script>
230
- </body></html>`),l.document.close(),l}function li(r,a){let{slide:l,step:d,totalSlides:u}=r.state,m=r._records[l-1],f=m?m.groups.length:0,h=d<f?`/${l}/${d+1}`:l<u?`/${l+1}/0`:`/${l}/${d}`,w=r._sections[l-1]?.querySelector("aside.notes"),k=r._sections[l-1]?.querySelector("aside.rehearse");return{slide:l,step:d,totalSlides:u,totalSteps:f,url:a,nextHash:h,notesSegments:ai(w?w.innerHTML:""),rehearseSegments:k?ai(k.innerHTML):null,labels:r._stepLabels(l-1),qr:r.__remoteQr??null}}ae();le();function kt(r,a){r.addEventListener("click",l=>{l.target===r&&a()})}function jt(r,a,l,{scroll:d=!0}={}){let u=(a+r.length)%r.length;return r.forEach((m,f)=>m.classList.toggle(l,f===u)),d&&r[u]?.scrollIntoView({block:"nearest"}),u}function hr(r,{query:a="",onMove:l,onCommit:d,onType:u,onBackspace:m,onClear:f,onClose:h}){switch(r.key){case"ArrowDown":return l?.(1),!0;case"ArrowUp":return l?.(-1),!0;case"Enter":return d?.(),!0;case"Backspace":return m?(m(),!0):!1;case"Escape":return a&&f?f():h?.(),!0;default:return r.key.length===1&&u?(u(r.key),!0):!1}}function ci(){let r=[];return{register(a){return r.push(a),a},active:()=>r.find(a=>a.isOpen()),closeOthers(a){for(let l of r)l!==a&&l.isOpen()&&l.close()}}}ae();le();ae();le();function Oc(r){return function(){r|=0,r=r+1831565813|0;let a=Math.imul(r^r>>>15,1|r);return a=a+Math.imul(a^a>>>7,61|a)^a,((a^a>>>14)>>>0)/4294967296}}function Zt(r,a,l){r=(r%360+360)%360,a=Math.max(0,Math.min(100,a))/100,l=Math.max(0,Math.min(100,l))/100;let d=(1-Math.abs(2*l-1))*a,u=d*(1-Math.abs(r/60%2-1)),m=l-d/2,f=Math.floor(r/60)%6;return[[d,u,0],[u,d,0],[0,d,u],[0,u,d],[u,0,d],[d,0,u]][f].map(w=>Math.round((w+m)*255))}function un([r,a,l]){return"#"+[r,a,l].map(d=>d.toString(16).padStart(2,"0")).join("")}function Mn([r,a,l]){let d=[r,a,l].map(u=>(u/=255,u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)));return .2126*d[0]+.7152*d[1]+.0722*d[2]}function Mc(r,a){let[l,d]=[Mn(r),Mn(a)].sort((u,m)=>m-u);return(l+.05)/(d+.05)}var On=(r,a)=>Math.min(...a.map(l=>Mc(r,l)));function ft(r,a,l,d,u){let f=d.reduce((A,I)=>A+Mn(I),0)/d.length<.5?1:-1,h=[];for(let A=a;A>0;A-=15)h.push(A);h.push(0);for(let A of[f,-f])for(let I of h)for(let M=l;M>=2&&M<=98;M+=A){let C=Zt(r,I,M);if(On(C,d)>=u)return C}let w=[253,253,254],k=[8,9,10];return On(w,d)>=On(k,d)?w:k}var Lc=["amber","boreal","cinder","coral","drift","ember","fable","fjord","gale","harbor","iris","juniper","kelp","lumen","mesa","nectar","onyx","pluma","quartz","reef","sable","tundra","umbra","verdant","wisp","yonder","zephyr"],Vr='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',Rc='ui-rounded, "SF Pro Rounded", "Segoe UI", Roboto, Helvetica, Arial, sans-serif',Ic='"Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif',Bc='"SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code", Menlo, Consolas, monospace',Pc=[Vr,Vr,Rc,Ic],Dc=[600,650,700,750,800],qc=["4px","6px","8px","10px","12px","14px","18px"],di={analogous:[30,-30,60,15,-15],complementary:[180,150,210,30,-30],split:[150,210,30,180,-30],triadic:[120,240,60,180,300]},yn={bgSatMax:{dark:18,light:12},accentSat:[42,68],hlSat:[36,58],ansiSat:[46,66],gradientChance:.15,gradientHueDrift:[8,20]};function mr(r){r=(r??Math.floor(Math.random()*4294967295))>>>0;let a=Oc(r),l=X=>X[Math.floor(a()*X.length)],d=(X,Y)=>X+a()*(Y-X),u=a()<.5,m=Math.floor(a()*360),f=l(Object.keys(di)),h=di[f],w=m+h[0],k=a()*a(),A=(X,Y)=>X+k*(Y-X),I=A(5,yn.bgSatMax[u?"dark":"light"]),M=u?d(6,13):d(94,97.5),C=Zt(m,I,M),$=un(C),q=[C];if(a()<yn.gradientChance){let X=Zt(m+d(...yn.gradientHueDrift),I+d(0,8),M+(u?d(2.5,5):-d(2,4)));$=`linear-gradient(${Math.round(d(120,210))}deg, ${un(C)} 0%, ${un(X)} 100%)`,q=[C,X]}let he=Zt(m,Math.min(I+4,35),u?M+4:M-4),oe=ft(m,12,u?86:18,q,4.6),de=ft(m,10,u?64:44,q,3.1),me=a()<.5?ft(w,A(20,55),u?80:26,q,3.2):ft(m,8,u?92:12,q,4.6),Te=A(...yn.accentSat),$e=u?d(55,68):d(34,48),Re=Zt(w,Te,$e);for(;Math.max(On([253,253,254],[Re]),On([8,9,10],[Re]))<4.7;)$e+=u?1:-1,Re=Zt(w,Te,$e);let be=ft(w,18,Mn(Re)<.4?96:10,[Re],4.6),Ce=ft(a()<.5?w:m+(h[1]??30),A(35,60),u?70:34,q,3.2),Xe=un(he),xe=`1px solid ${un(Zt(m,Math.min(I+6,40),u?M+10:M-10))}`,E=l(qc),Ie=u?`0 ${Math.round(d(4,10))}px ${Math.round(d(18,30))}px rgba(0, 0, 0, 0.${Math.round(d(35,55))})`:`0 ${Math.round(d(3,6))}px ${Math.round(d(12,20))}px rgba(30, 30, 40, 0.${String(Math.round(d(8,14))).padStart(2,"0")})`,qe=Zt(m,Math.min(I+2,28),u?Math.max(M-3,3):Math.min(M-3,93)),De=[qe],F=ft(m,8,u?85:20,De,4.6),J={keyword:h[0],string:h[3]??120,number:h[2]??60,function:h[1]??210,type:h[4]??280},U=A(...yn.hlSat),fe=u?68:36,Ee={};for(let[X,Y]of Object.entries(J))Ee[X]=ft(m+Y,U,fe,De,4.6);Ee.comment=ft(m,12,u?60:46,De,3.2),Ee.punct=ft(m,10,u?74:32,De,4.6);let Ne=[0,h[0],h[1]??40,h[2]??90,h[3]??160,h[4]??230].map((X,Y)=>Zt(m+X,A(14,34),u?M+8+Y%3*2:M-6-Y%3*2)),s=[...q,...Ne],o=ft(m,14,u?60:42,q,2.2),O=ft(m,10,u?84:20,s,3.4),Be=ft(m,10,u?62:46,s,2.7),P=ft(w,Te,u?68:38,s,2.7),Ue=Ne.map(un),nt=Zt(m,Math.min(I+4,30),u?Math.max(M-4,3):d(12,18)),W=[nt],Ae=ft(m,8,82,W,4.6),Q=ft(w,A(...yn.ansiSat),66,W,3.2),ye={red:8,green:125,yellow:45,blue:215,magenta:290,cyan:175},x={black:ft(m,10,58,W,3.1),white:ft(m,6,88,W,4.6)};for(let[X,Y]of Object.entries(ye))x[X]=ft(Y+m%16-8,A(...yn.ansiSat),66,W,3.1);let we=X=>{let[Y,ge,V]=X.map(ne=>Math.min(255,Math.round(ne+(255-ne)*.35)));return On([Y,ge,V],W)>=3?[Y,ge,V]:ft(m,8,90,W,3.1)},g=`gen-${l(Lc)}-${(r%65535).toString(16).padStart(4,"0")}`,G=un,B={"--bg":$,"--bg-accent":un(he),"--fg":G(oe),"--muted":G(de),"--font-body":Vr,"--font-heading":l(Pc),"--font-mono":Bc,"--heading-color":G(me),"--heading-weight":String(l(Dc)),"--link":G(Ce),"--accent":G(Re),"--accent-contrast":G(be),"--block-bg":Xe,"--block-border":xe,"--block-radius":E,"--shadow":Ie,"--code-bg":G(qe),"--code-fg":G(F),"--hl-keyword":G(Ee.keyword),"--hl-string":G(Ee.string),"--hl-number":G(Ee.number),"--hl-comment":G(Ee.comment),"--hl-function":G(Ee.function),"--hl-type":G(Ee.type),"--hl-punct":G(Ee.punct),"--d-stroke":G(o),"--d-text":G(O),"--d-muted":G(Be),"--d-accent":G(P),"--d-fill-1":Ue[0],"--d-fill-2":Ue[1],"--d-fill-3":Ue[2],"--d-fill-4":Ue[3],"--d-fill-5":Ue[4],"--d-fill-6":Ue[5],"--term-bg":G(nt),"--term-fg":G(Ae),"--term-prompt":G(Q),"--term-cursor":G(Q),"--term-selection":`rgba(${Re[0]}, ${Re[1]}, ${Re[2]}, 0.30)`,"--ansi-black":G(x.black),"--ansi-red":G(x.red),"--ansi-green":G(x.green),"--ansi-yellow":G(x.yellow),"--ansi-blue":G(x.blue),"--ansi-magenta":G(x.magenta),"--ansi-cyan":G(x.cyan),"--ansi-white":G(x.white),"--ansi-bright-black":G(we(x.black)),"--ansi-bright-red":G(we(x.red)),"--ansi-bright-green":G(we(x.green)),"--ansi-bright-yellow":G(we(x.yellow)),"--ansi-bright-blue":G(we(x.blue)),"--ansi-bright-magenta":G(we(x.magenta)),"--ansi-bright-cyan":G(we(x.cyan)),"--ansi-bright-white":G(ft(m,6,97,W,3.1)),"--dim-opacity":(.25+Math.round(a()*15)/100).toFixed(2)};return{name:g,seed:r,dark:u,harmony:f,tokens:B}}var ui=[["canvas",["--bg","--bg-accent","--fg","--muted"]],["type",["--font-body","--font-heading","--font-mono","--heading-color","--heading-weight","--link"]],["accent",["--accent","--accent-contrast"]],["blocks",["--block-bg","--block-border","--block-radius","--shadow"]],["code",["--code-bg","--code-fg","--hl-keyword","--hl-string","--hl-number","--hl-comment","--hl-function","--hl-type","--hl-punct"]],["diagram",["--d-stroke","--d-text","--d-muted","--d-accent","--d-fill-1","--d-fill-2","--d-fill-3","--d-fill-4","--d-fill-5","--d-fill-6"]],["terminal",["--term-bg","--term-fg","--term-prompt","--term-cursor","--term-selection","--ansi-black","--ansi-red","--ansi-green","--ansi-yellow","--ansi-blue","--ansi-magenta","--ansi-cyan","--ansi-white","--ansi-bright-black","--ansi-bright-red","--ansi-bright-green","--ansi-bright-yellow","--ansi-bright-blue","--ansi-bright-magenta","--ansi-bright-cyan","--ansi-bright-white"]],["builds",["--dim-opacity"]]];function Zr(r,a){let l=`/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
230
+ </body></html>`),l.document.close(),l}function pi(r,i){let{slide:l,step:d,totalSlides:u}=r.state,m=r._records[l-1],f=m?m.groups.length:0,h=d<f?`/${l}/${d+1}`:l<u?`/${l+1}/0`:`/${l}/${d}`,b=r._sections[l-1]?.querySelector("aside.notes"),k=r._sections[l-1]?.querySelector("aside.rehearse");return{slide:l,step:d,totalSlides:u,totalSteps:f,url:i,nextHash:h,notesSegments:ui(b?b.innerHTML:""),rehearseSegments:k?ui(k.innerHTML):null,labels:r._stepLabels(l-1),qr:r.__remoteQr??null}}le();ce();function It(r,i){r.addEventListener("click",l=>{l.target===r&&i()})}function on(r,i,l,{scroll:d=!0}={}){let u=(i+r.length)%r.length;return r.forEach((m,f)=>m.classList.toggle(l,f===u)),d&&r[u]?.scrollIntoView({block:"nearest"}),u}function Er(r,{query:i="",onMove:l,onCommit:d,onType:u,onBackspace:m,onClear:f,onClose:h}){switch(r.key){case"ArrowDown":return l?.(1),!0;case"ArrowUp":return l?.(-1),!0;case"Enter":return d?.(),!0;case"Backspace":return m?(m(),!0):!1;case"Escape":return i&&f?f():h?.(),!0;default:return r.key.length===1&&u?(u(r.key),!0):!1}}function hi(){let r=[];return{register(i){return r.push(i),i},active:()=>r.find(i=>i.isOpen()),closeOthers(i){for(let l of r)l!==i&&l.isOpen()&&l.close()}}}le();ce();le();ce();function Ic(r){return function(){r|=0,r=r+1831565813|0;let i=Math.imul(r^r>>>15,1|r);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}function pn(r,i,l){r=(r%360+360)%360,i=Math.max(0,Math.min(100,i))/100,l=Math.max(0,Math.min(100,l))/100;let d=(1-Math.abs(2*l-1))*i,u=d*(1-Math.abs(r/60%2-1)),m=l-d/2,f=Math.floor(r/60)%6;return[[d,u,0],[u,d,0],[0,d,u],[0,u,d],[u,0,d],[d,0,u]][f].map(b=>Math.round((b+m)*255))}function An([r,i,l]){return"#"+[r,i,l].map(d=>d.toString(16).padStart(2,"0")).join("")}function Kn([r,i,l]){let d=[r,i,l].map(u=>(u/=255,u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)));return .2126*d[0]+.7152*d[1]+.0722*d[2]}function Bc(r,i){let[l,d]=[Kn(r),Kn(i)].sort((u,m)=>m-u);return(l+.05)/(d+.05)}var jn=(r,i)=>Math.min(...i.map(l=>Bc(r,l)));function Lt(r,i,l,d,u){let f=d.reduce((A,P)=>A+Kn(P),0)/d.length<.5?1:-1,h=[];for(let A=i;A>0;A-=15)h.push(A);h.push(0);for(let A of[f,-f])for(let P of h)for(let M=l;M>=2&&M<=98;M+=A){let T=pn(r,P,M);if(jn(T,d)>=u)return T}let b=[253,253,254],k=[8,9,10];return jn(b,d)>=jn(k,d)?b:k}var Pc=["amber","boreal","cinder","coral","drift","ember","fable","fjord","gale","harbor","iris","juniper","kelp","lumen","mesa","nectar","onyx","pluma","quartz","reef","sable","tundra","umbra","verdant","wisp","yonder","zephyr"],ns='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',Dc='ui-rounded, "SF Pro Rounded", "Segoe UI", Roboto, Helvetica, Arial, sans-serif',qc='"Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif',Fc='"SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code", Menlo, Consolas, monospace',zc=[ns,ns,Dc,qc],Uc=[600,650,700,750,800],Hc=["4px","6px","8px","10px","12px","14px","18px"],mi={analogous:[30,-30,60,15,-15],complementary:[180,150,210,30,-30],split:[150,210,30,180,-30],triadic:[120,240,60,180,300]},In={bgSatMax:{dark:18,light:12},accentSat:[42,68],hlSat:[36,58],ansiSat:[46,66],gradientChance:.15,gradientHueDrift:[8,20]};function Sr(r){r=(r??Math.floor(Math.random()*4294967295))>>>0;let i=Ic(r),l=it=>it[Math.floor(i()*it.length)],d=(it,Ee)=>it+i()*(Ee-it),u=i()<.5,m=Math.floor(i()*360),f=l(Object.keys(mi)),h=mi[f],b=m+h[0],k=i()*i(),A=(it,Ee)=>it+k*(Ee-it),P=A(5,In.bgSatMax[u?"dark":"light"]),M=u?d(6,13):d(94,97.5),T=pn(m,P,M),C=An(T),F=[T];if(i()<In.gradientChance){let it=pn(m+d(...In.gradientHueDrift),P+d(0,8),M+(u?d(2.5,5):-d(2,4)));C=`linear-gradient(${Math.round(d(120,210))}deg, ${An(T)} 0%, ${An(it)} 100%)`,F=[T,it]}let ye=pn(m,Math.min(P+4,35),u?M+4:M-4),ge=Lt(m,12,u?86:18,F,4.6),be=Lt(m,10,u?64:44,F,3.1),de=i()<.5?Lt(b,A(20,55),u?80:26,F,3.2):Lt(m,8,u?92:12,F,4.6),Oe=A(...In.accentSat),ke=u?d(55,68):d(34,48),De=pn(b,Oe,ke);for(;Math.max(jn([253,253,254],[De]),jn([8,9,10],[De]))<4.7;)ke+=u?1:-1,De=pn(b,Oe,ke);let xe=Lt(b,18,Kn(De)<.4?96:10,[De],4.6),Le=Lt(i()<.5?b:m+(h[1]??30),A(35,60),u?70:34,F,3.2),st=An(ye),at=`1px solid ${An(pn(m,Math.min(P+6,40),u?M+10:M-10))}`,_=l(Hc),qe=u?`0 ${Math.round(d(4,10))}px ${Math.round(d(18,30))}px rgba(0, 0, 0, 0.${Math.round(d(35,55))})`:`0 ${Math.round(d(3,6))}px ${Math.round(d(12,20))}px rgba(30, 30, 40, 0.${String(Math.round(d(8,14))).padStart(2,"0")})`,Je=pn(m,Math.min(P+2,28),u?Math.max(M-3,3):Math.min(M-3,93)),je=[Je],O=Lt(m,8,u?85:20,je,4.6),D={keyword:h[0],string:h[3]??120,number:h[2]??60,function:h[1]??210,type:h[4]??280},V=A(...In.hlSat),re=u?68:36,Ae={};for(let[it,Ee]of Object.entries(D))Ae[it]=Lt(m+Ee,V,re,je,4.6);Ae.comment=Lt(m,12,u?60:46,je,3.2),Ae.punct=Lt(m,10,u?74:32,je,4.6);let Ce=[0,h[0],h[1]??40,h[2]??90,h[3]??160,h[4]??230].map((it,Ee)=>pn(m+it,A(14,34),u?M+8+Ee%3*2:M-6-Ee%3*2)),s=[...F,...Ce],o=Lt(m,14,u?60:42,F,2.2),N=Lt(m,10,u?84:20,s,3.4),Fe=Lt(m,10,u?62:46,s,2.7),B=Lt(b,Oe,u?68:38,s,2.7),ot=Ce.map(An),mt=pn(m,Math.min(P+4,30),u?Math.max(M-4,3):d(12,18)),K=[mt],_e=Lt(m,8,82,K,4.6),Y=Lt(b,A(...In.ansiSat),66,K,3.2),Re={red:8,green:125,yellow:45,blue:215,magenta:290,cyan:175},y={black:Lt(m,10,58,K,3.1),white:Lt(m,6,88,K,4.6)};for(let[it,Ee]of Object.entries(Re))y[it]=Lt(Ee+m%16-8,A(...In.ansiSat),66,K,3.1);let Be=it=>{let[Ee,ze,oe]=it.map(Xe=>Math.min(255,Math.round(Xe+(255-Xe)*.35)));return jn([Ee,ze,oe],K)>=3?[Ee,ze,oe]:Lt(m,8,90,K,3.1)},w=`gen-${l(Pc)}-${(r%65535).toString(16).padStart(4,"0")}`,pe=An,Se={"--bg":C,"--bg-accent":An(ye),"--fg":pe(ge),"--muted":pe(be),"--font-body":ns,"--font-heading":l(zc),"--font-mono":Fc,"--heading-color":pe(de),"--heading-weight":String(l(Uc)),"--link":pe(Le),"--accent":pe(De),"--accent-contrast":pe(xe),"--block-bg":st,"--block-border":at,"--block-radius":_,"--shadow":qe,"--code-bg":pe(Je),"--code-fg":pe(O),"--hl-keyword":pe(Ae.keyword),"--hl-string":pe(Ae.string),"--hl-number":pe(Ae.number),"--hl-comment":pe(Ae.comment),"--hl-function":pe(Ae.function),"--hl-type":pe(Ae.type),"--hl-punct":pe(Ae.punct),"--d-stroke":pe(o),"--d-text":pe(N),"--d-muted":pe(Fe),"--d-accent":pe(B),"--d-fill-1":ot[0],"--d-fill-2":ot[1],"--d-fill-3":ot[2],"--d-fill-4":ot[3],"--d-fill-5":ot[4],"--d-fill-6":ot[5],"--term-bg":pe(mt),"--term-fg":pe(_e),"--term-prompt":pe(Y),"--term-cursor":pe(Y),"--term-selection":`rgba(${De[0]}, ${De[1]}, ${De[2]}, 0.30)`,"--ansi-black":pe(y.black),"--ansi-red":pe(y.red),"--ansi-green":pe(y.green),"--ansi-yellow":pe(y.yellow),"--ansi-blue":pe(y.blue),"--ansi-magenta":pe(y.magenta),"--ansi-cyan":pe(y.cyan),"--ansi-white":pe(y.white),"--ansi-bright-black":pe(Be(y.black)),"--ansi-bright-red":pe(Be(y.red)),"--ansi-bright-green":pe(Be(y.green)),"--ansi-bright-yellow":pe(Be(y.yellow)),"--ansi-bright-blue":pe(Be(y.blue)),"--ansi-bright-magenta":pe(Be(y.magenta)),"--ansi-bright-cyan":pe(Be(y.cyan)),"--ansi-bright-white":pe(Lt(m,6,97,K,3.1)),"--dim-opacity":(.25+Math.round(i()*15)/100).toFixed(2)};return{name:w,seed:r,dark:u,harmony:f,tokens:Se}}var fi=[["canvas",["--bg","--bg-accent","--fg","--muted"]],["type",["--font-body","--font-heading","--font-mono","--heading-color","--heading-weight","--link"]],["accent",["--accent","--accent-contrast"]],["blocks",["--block-bg","--block-border","--block-radius","--shadow"]],["code",["--code-bg","--code-fg","--hl-keyword","--hl-string","--hl-number","--hl-comment","--hl-function","--hl-type","--hl-punct"]],["diagram",["--d-stroke","--d-text","--d-muted","--d-accent","--d-fill-1","--d-fill-2","--d-fill-3","--d-fill-4","--d-fill-5","--d-fill-6"]],["terminal",["--term-bg","--term-fg","--term-prompt","--term-cursor","--term-selection","--ansi-black","--ansi-red","--ansi-green","--ansi-yellow","--ansi-blue","--ansi-magenta","--ansi-cyan","--ansi-white","--ansi-bright-black","--ansi-bright-red","--ansi-bright-green","--ansi-bright-yellow","--ansi-bright-blue","--ansi-bright-magenta","--ansi-bright-cyan","--ansi-bright-white"]],["builds",["--dim-opacity"]]];function rs(r,i){let l=`/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
231
231
  Decklight theme \xB7 ${r}
232
232
  generated by Decklight (\u2303T) \u2014 token contract: SPEC.md THEMING
233
233
  All values derived with WCAG luminance math; passes test/contrast.mjs
234
234
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
235
235
 
236
236
  .decklight {
237
- `;for(let[u,m]of ui){let f=m.filter(h=>a[h]!==void 0);if(f.length){l+=` /* \u2500\u2500 ${u} ${"\u2500".repeat(Math.max(1,26-u.length))} */
238
- `;for(let h of f)l+=` ${h}: ${a[h]};
237
+ `;for(let[u,m]of fi){let f=m.filter(h=>i[h]!==void 0);if(f.length){l+=` /* \u2500\u2500 ${u} ${"\u2500".repeat(Math.max(1,26-u.length))} */
238
+ `;for(let h of f)l+=` ${h}: ${i[h]};
239
239
  `;l+=`
240
- `}}let d=new Set(ui.flatMap(([,u])=>u));for(let[u,m]of Object.entries(a))d.has(u)||(l+=` ${u}: ${m};
240
+ `}}let d=new Set(fi.flatMap(([,u])=>u));for(let[u,m]of Object.entries(i))d.has(u)||(l+=` ${u}: ${m};
241
241
  `);return l.replace(/\n$/,"")+`}
242
- `}function pi({root:r,config:a,params:l,toast:d,debugLog:u,overlays:m,deck:f,editmode:h}){let w=[...document.querySelectorAll("style[data-theme]:not([data-theme-added])")],k=[...document.querySelectorAll("style[data-theme][data-theme-added]")],A=new Set(k.map(N=>N.dataset.theme).filter(Boolean)),I=w.length>0,M=I?null:document.querySelector('link[rel="stylesheet"][href*="themes/"]');if(I){let N=w.find(H=>!H.hasAttribute("disabled")&&H.media!=="not all");N=N||w[0],w.forEach(H=>{H.removeAttribute("disabled"),H.media=H===N?"all":"not all"})}let C=I||!!M,$=N=>(N.match(/themes\/([\w-]+)\.css/)||[])[1],q="decklight-theme:"+location.pathname,he="decklight-custom-themes",oe={};try{oe=JSON.parse(localStorage.getItem(he)||"{}")||{}}catch{}let de=null,j=null,me={};function Te(N,H,ie){let pe=ie==="generated"?de:me[N];return pe||(pe=document.createElement("style"),pe.media="not all",ie==="generated"?pe.dataset.generated="":pe.dataset.custom=""),pe.dataset.theme=N,pe.textContent=Zr(N,H),document.head.appendChild(pe),ie==="generated"?de=pe:me[N]=pe,pe}let $e=()=>[de,...Object.values(me),...k];function Re(N){for(let H of $e())H&&H!==N&&(H.media="not all")}let be=()=>$e().find(N=>N&&N.media!=="not all")||null,Ce=()=>{let N=be();return N?N.dataset.theme:I?w.find(H=>H.media!=="not all")?.dataset.theme:M?$(M.href):void 0};function Xe(){let N=getComputedStyle(r),H=Pe=>Pe?.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[\s,/]+([\d.]+))?\)/),ie=H(N.backgroundColor);(!ie||ie[4]!==void 0&&+ie[4]==0)&&(ie=H(N.backgroundImage));let pe=ie?Mn([+ie[1],+ie[2],+ie[3]])<.5:!1;r.setAttribute("data-canvas",pe?"dark":"light")}M?.addEventListener("load",Xe);function xe(N,H=!1){if(!N||!/^[\w-]+$/.test(N))return;let ie=!1;if(j&&de&&N===j.name)de.media="all",Re(de),ie=!oe[N];else if(oe[N]){let pe=Te(N,oe[N],"custom");pe.media="all",Re(pe)}else if(A.has(N)){let pe=k.find(Pe=>Pe.dataset.theme===N);pe.media="all",Re(pe)}else{if(!C)return;if(Re(null),I){let pe=w.find(Pe=>Pe.dataset.theme===N);if(!pe)return;w.forEach(Pe=>{Pe.media=Pe===pe?"all":"not all"})}else M.href=M.href.replace(/themes\/[\w-]+\.css(\?.*)?$/,`themes/${N}.css`)}if(!l.has("embedded")&&!ie)try{localStorage.setItem(q,N)}catch{}H||d(N),u("theme",N),Xe()}let E=typeof We<"u"?We:null,Ie={added:"Added",custom:"Custom",generated:"Generated"},qe=N=>E?.labels?.[N]??Ie[N]??N;function De(N){if(oe[N])return"custom";if(j&&N===j.name)return"generated";if(A.has(N))return"added";if(E){for(let[H,ie]of Object.entries(E.packs))if(ie.includes(N))return H}return"other"}let F=()=>{let N;if(I){let ie=w.map(pe=>pe.dataset.theme);N=a.themes?.length?a.themes.filter(pe=>ie.includes(pe)):ie}else N=a.themes?.length?a.themes:typeof Ke<"u"?Ke:[];let H=[...A,...Object.keys(oe)];if(j&&!oe[j.name]&&H.push(j.name),N=[...N,...H.filter(ie=>!N.includes(ie))],E){let ie=new Map,pe=0;for(let Pe of E.order)for(let Se of E.packs[Pe]??[])ie.set(Se,pe++);N=[...N].sort((Pe,Se)=>(ie.get(Pe)??1e9)-(ie.get(Se)??1e9))}return N};function J(N){let H=[];for(let ie of E.order){let pe=(E.packs[ie]??[]).filter(Pe=>N.includes(Pe));pe.length&&H.push([ie,pe])}for(let ie of["added","custom","generated"]){let pe=N.filter(Pe=>De(Pe)===ie);pe.length&&H.push([ie,pe])}return H}let U=N=>btoa(unescape(encodeURIComponent(JSON.stringify(N)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),fe=N=>JSON.parse(decodeURIComponent(escape(atob(N.replace(/-/g,"+").replace(/_/g,"/")))));function Ee(N,H=!1){j={name:N.name,tokens:N.tokens};let ie=Te(N.name,N.tokens,"generated");return ie.media="all",Re(ie),H||d(`\u2728 ${N.name} \u2014 \u2303T re-roll \xB7 \u2303\u21E7T save`,2800),Xe(),N.name}function ze(){return Ee(mr())}function Ne(N){if(!j||!de||de.media==="not all")return d("no generated theme to save \u2014 \u2303T to generate one"),null;let H=N??(window.prompt?.("Save theme as:",j.name.replace(/^gen-/,""))||"");if(H=String(H).toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),!H)return null;((typeof Ke<"u"?Ke:[]).includes(H)||w.some(Pe=>Pe.dataset.theme===H))&&(H="custom-"+H),oe[H]=j.tokens;try{localStorage.setItem(he,JSON.stringify(oe))}catch{}let pe=Te(H,oe[H],"custom");if(pe.media="all",de?.remove(),de=null,j=null,Re(pe),!l.has("embedded"))try{localStorage.setItem(q,H)}catch{}try{let Pe=new Blob([Zr(H,oe[H])],{type:"text/css"}),Se=document.createElement("a");Se.href=URL.createObjectURL(Pe),Se.download=`${H}.css`,Se.click(),setTimeout(()=>URL.revokeObjectURL(Se.href),5e3)}catch{}return d(`saved ${H} \u2014 ${H}.css downloaded`,2200),H}let s=null;function o(N=!1){return s?(clearTimeout(s.timer),s=null,N||d("theme cycle cancelled"),!0):!1}function O(N){let H=F();if(!C||H.length<2)return;if(s){let Se=s;clearTimeout(Se.timer),s=null,Se.dir===N?xe(Se.name):d("theme cycle cancelled");return}let ie=Ce(),pe=Math.max(0,H.indexOf(ie)),Pe=H[(pe+N+H.length)%H.length];if(E&&De(Pe)!==De(ie)){let Se=N>0?".":",",Me=N>0?",":".";s={dir:N,name:Pe,timer:setTimeout(()=>{s=null},4e3)},d(`\u2933 ${qe(De(Pe))} pack next (${Pe}) \u2014 ${Se} confirms \xB7 ${Me} or Esc cancels`,4e3);return}xe(Pe)}l.has("embedded")&&window.addEventListener("message",N=>{let H=N.data&&N.data.__decklightPreview;!H||N.source!==window.parent||(H.gen?Ee(H.gen,!0):H.theme?xe(H.theme,!0):H.goto&&f().goto(H.goto[0],H.goto[1]??0))});function Be(){let N=Ce(),H=oe[N]?{name:N,tokens:oe[N]}:j&&N===j.name?j:null;return H?"?embedded&gen="+U(H):N?"?embedded&theme="+encodeURIComponent(N):"?embedded"}function P(){let N=l.get("gen");if(N)try{let pe=fe(N);if(pe&&pe.tokens){Ee({name:pe.name||"gen-preview",tokens:pe.tokens},!0);return}}catch{}let H=null;try{H=localStorage.getItem(q)}catch{}let ie=l.get("theme")||H;ie&&xe(ie,!0)}let Ue="\0generate",nt="pack:",W="back",Ae="all",Q="browse",ye="",x=N=>N.charCodeAt(0)<32,we=null,g=0,G,B=[],X=null,Y="",ge="packs",V=()=>E?"packs":"all",ne=()=>h?.()?.available()===!0,Fe=()=>h?.()?.base()??"",Je=()=>ne()?[Q]:[],re=null,ke=N=>(re?.themes??[]).find(H=>H.qualified===N);async function He(){re={loading:!0,themes:[],stale:[]},_t("browse");let N;try{let H=await fetch(Fe()+"/edit/theme/browse"),ie=await H.json().catch(()=>({}));N=H.ok&&ie.ok?{themes:ie.themes??[],stale:ie.stale??[],cacheOnly:ie.cacheOnly!==!1}:{themes:[],stale:[],error:ie.error||`the author server said ${H.status}`}}catch{N={themes:[],stale:[],error:"the author server did not answer"}}!we||ge!=="browse"||(re=N,_t("browse"))}async function _e(N){let H=we?.querySelector(".tp-caption");H&&(H.textContent=`installing ${N}\u2026`);try{let ie=await fetch(Fe()+"/edit/theme/add",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:N})}),pe=await ie.json().catch(()=>({}));if(!ie.ok){let Pe=[pe.error,...pe.problems??[]].filter(Boolean).join(" \xB7 ");H&&(H.textContent=Pe||`install failed (${ie.status})`),d(`${N}: ${pe.error||"install refused"}`,3600);return}ot(),d(`installed ${pe.name}${pe.replaced?" (replaced)":""} \u2014 Z takes it back`,2800),u("theme",`${N} installed from a marketplace`)}catch{H&&(H.textContent="the author server did not answer")}}function Le(N){let H=f().state,ie="#/"+H.slide+"/"+H.step;if(N===Ue||oe[N]||j&&N===j.name){let pe=N===Ue?X:oe[N]?{name:N,tokens:oe[N]}:j;return location.pathname+"?embedded&gen="+U(pe)+ie}return location.pathname+"?embedded&theme="+encodeURIComponent(N)+ie}function Qe(N){N.textContent=X?`\u2728 ${X.name} \u2014 \u2303T re-rolls`:"\u2728 Generate new\u2026"}function Oe(){X=mr();let N=B.indexOf(Ue);N<0||(Qe(we.querySelectorAll(".tp-row")[N]),te(N,!0))}function Ye(){let N=we.querySelector(".tp-list"),H=Ce(),ie=F();if(ge==="browse"){let Se=(re?.themes??[]).filter(Me=>!Y||Me.qualified.includes(Y));B=[W,...Se.map(Me=>ye+Me.qualified)]}else if(Y)B=ie.filter(Se=>Se.includes(Y));else if(!E||ge==="all")B=E?[Ue,W,...ie]:[Ue,...ie,...Je()];else if(ge==="packs")B=[Ue,...J(ie).map(([Se])=>nt+Se),Ae,...Je()];else{let Se=ge.slice(5);B=[W,...J(ie).find(([Me])=>Me===Se)?.[1]??[]]}N.textContent="";let pe=(Se,Me)=>{let rt=document.createElement("span");rt.className="tp-tag",rt.textContent=Me,Se.appendChild(rt)};if(B.forEach((Se,Me)=>{let rt=document.createElement("div");if(rt.setAttribute("role","option"),Se===Ue)rt.className="tp-row tp-gen",Qe(rt);else if(Se===W)rt.className="tp-row tp-back",rt.textContent=V()==="packs"?"\u2190 packs":"\u2190 themes";else if(Se===Q)rt.className="tp-row tp-browse",rt.textContent="\u2315 Browse marketplaces\u2026";else if(Se.startsWith(ye)){let at=ke(Se.slice(ye.length));rt.className="tp-row tp-mkt",rt.textContent=at?.name??Se.slice(ye.length);let Et=A.has(at?.name)?"installed":at?.marketplace;Et&&pe(rt,Et)}else if(Se===Ae)rt.className="tp-row tp-all",rt.textContent="\u2733 all themes",pe(rt,String(ie.length));else if(Se.startsWith(nt)){let at=Se.slice(nt.length),Et=J(ie).find(([Nt])=>Nt===at)?.[1]??[];rt.className="tp-row tp-pack"+(Et.includes(H)?" tp-current":""),rt.textContent=`\u25B8 ${qe(at)}`,pe(rt,String(Et.length))}else{rt.className="tp-row"+(Se===H?" tp-current":""),rt.textContent=Se;let at=oe[Se]?"custom":j&&Se===j.name?"generated":A.has(Se)?"added":Y&&E?qe(De(Se)):null;at&&pe(rt,at)}rt.addEventListener("mouseenter",()=>te(Me,!1)),rt.addEventListener("click",()=>{te(Me,!0),gt()}),N.appendChild(rt)}),!B.length){let Se=document.createElement("div");Se.className="tp-none",Se.textContent="no themes match",N.appendChild(Se)}if(ge==="browse"){let Se=document.createElement("div");Se.className="tp-none",Se.textContent=re?.loading?"reading the catalogs\u2026":re?.error?re.error:B.some(Me=>Me.startsWith(ye))?re.stale?.length?`from the cache \xB7 never fetched: ${re.stale.join(", ")} \u2014 marketplace update`:"from the cache \u2014 listing never goes to the network":Y?"no marketplace theme matches":"no themes in the marketplaces you have registered",N.appendChild(Se)}let Pe=we.querySelector(".tp-filter");Pe.textContent=Y||"type to filter\u2026",Pe.classList.toggle("tp-active",!!Y)}function ct(){let N=Ce(),H=B.indexOf(N);if(H>=0)return H;let ie=B.indexOf(nt+De(N));return ie>=0?ie:Math.min(1,B.length-1)}function _t(N,H=!1){ge=N,Ye(),B.length&&te(ct(),H)}function Pt(N){Y=N.toLowerCase(),Ye(),B.length?te(Y?0:ct(),!1):we.querySelector(".tp-caption").textContent="no match"}function Kt(){if(we)return ot();m.closeOthers(st);let N=F();if(!C&&!N.length)return;Y="",ge=V(),re=null,we=document.createElement("div"),we.className="decklight-theme-picker",we.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Themes"></div></div><div class="tp-preview"><iframe title="Theme preview"></iframe><div class="tp-caption"></div></div></div>',Ye(),kt(we,ot),r.appendChild(we);let H=Ce();H&&Ct(we.querySelector("iframe"),H),te(ct(),!H)}function te(N,H){if(!B.length)return;g=(N+B.length)%B.length;let ie=B[g];ie===Ue&&!X&&(X=mr(),Qe(we.querySelectorAll(".tp-row")[g])),jt(we.querySelectorAll(".tp-row"),g,"tp-selected");let pe=F(),Pe=ie===Ue?X?`\u2728 ${X.name}`:"generate new":ie===W?V()==="packs"?"back to packs":"back to the theme list":ie===Q?"themes from the marketplaces you have registered":ie.startsWith(ye)?nn(ie.slice(ye.length)):ie===Ae?`all ${pe.length} themes, flattened`:ie.startsWith(nt)?`${qe(ie.slice(nt.length))} \xB7 ${J(pe).find(([Me])=>Me===ie.slice(nt.length))?.[1].length??0} themes`:E?`${qe(De(ie))} \xB7 ${ie}`:ie;if(we.querySelector(".tp-caption").textContent=Pe,clearTimeout(G),ie!==Ue&&x(ie))return;let Se=we.querySelector("iframe");H?Ct(Se,ie):G=setTimeout(()=>Ct(Se,ie),60)}function nn(N){let H=ke(N);return H?[H.qualified,H.description,A.has(H.name)?"installed \u2014 \u23CE re-installs it":"\u23CE installs it"].filter(Boolean).join(" \xB7 "):N}let Dt=!1,qt=null;function Xt(N){return N===Ue||oe[N]||j&&N===j.name?{gen:N===Ue?X:oe[N]?{name:N,tokens:oe[N]}:j}:{theme:N}}function Ct(N,H){if(!N.dataset.booted){N.dataset.booted="1",Dt=!1,N.addEventListener("load",()=>{if(Dt=!0,qt!==null&&we){let ie=qt;qt=null,Ct(N,ie)}},{once:!0}),N.src=Le(H);return}if(!Dt){qt=H;return}N.contentWindow?.postMessage({__decklightPreview:Xt(H)},"*")}function gt(){let N=B[g];if(N!==void 0){if(N===Ue){X&&Ee(X),ot();return}if(N===W){_t(V());return}if(N===Ae){_t("all");return}if(N===Q){He();return}if(N.startsWith(ye)){_e(N.slice(ye.length));return}if(N.startsWith(nt)){_t("pack:"+N.slice(nt.length),!0);return}xe(N),ot()}}function ot(){clearTimeout(G),we?.remove(),we=null}let st=m.register({isOpen:()=>!!we,close:ot,keydown(N){switch(N.key){case"ArrowDown":te(g+1,!1);break;case"ArrowUp":te(g-1,!1);break;case"Enter":gt();break;case"Backspace":Pt(Y.slice(0,-1));break;case"Escape":Y?Pt(""):ge!==V()?_t(V()):ot();break;default:if(N.key.length===1&&/[a-z0-9-]/i.test(N.key)){Pt(Y+N.key);break}return!1}return!0}});return{applyTheme:xe,currentTheme:Ce,themeList:F,cycleTheme:O,cancelCyclePending:o,rollTheme:ze,saveGeneratedTheme:Ne,adoptGenerated:Ee,updateCanvas:Xe,restoreSaved:P,previewQuery:Be,openPicker:Kt,closePicker:ot,browse(){we||Kt(),we&&He()},hasGenerated:()=>!!j,rollFromPicker(){return we&&B[g]===Ue?(Oe(),!0):!1}}}ae();le();ae();le();ae();le();var Xr=["A","B","C","D","E","F","G","H","X"],Ln="#edb58e",hi="#c98f6d",Fc="#43302a",Rn="#b96b58",In="#57262c",fr="#f6f1ea",mi="#d17a70",Yr=`<svg viewBox="0 0 240 240" role="img" aria-label="Narrator" xmlns="http://www.w3.org/2000/svg">
242
+ `}function gi({root:r,config:i,params:l,toast:d,debugLog:u,overlays:m,deck:f,editmode:h}){let b=[...document.querySelectorAll("style[data-theme]:not([data-theme-added])")],k=[...document.querySelectorAll("style[data-theme][data-theme-added]")],A=new Set(k.map(S=>S.dataset.theme).filter(Boolean)),P=new Map;for(let S of k){let L=S.dataset.themeMarketplace;S.dataset.theme&&L&&P.set(S.dataset.theme,{pack:`mkt:${L}`,label:S.dataset.themeSource||L})}let M=b.length>0,T=M?null:document.querySelector('link[rel="stylesheet"][href*="themes/"]');if(M){let S=b.find(L=>!L.hasAttribute("disabled")&&L.media!=="not all");S=S||b[0],b.forEach(L=>{L.removeAttribute("disabled"),L.media=L===S?"all":"not all"})}let C=M||!!T,F=S=>(S.match(/themes\/([\w-]+)\.css/)||[])[1],ye="decklight-theme:"+location.pathname,ge="decklight-custom-themes",be={};try{be=JSON.parse(localStorage.getItem(ge)||"{}")||{}}catch{}let J=null,de=null,Oe={};function ke(S,L,$){let Z=$==="generated"?J:Oe[S];return Z||(Z=document.createElement("style"),Z.media="not all",$==="generated"?Z.dataset.generated="":Z.dataset.custom=""),Z.dataset.theme=S,Z.textContent=rs(S,L),document.head.appendChild(Z),$==="generated"?J=Z:Oe[S]=Z,Z}let De=()=>[J,...Object.values(Oe),...k];function xe(S){for(let L of De())L&&L!==S&&(L.media="not all")}let Le=()=>De().find(S=>S&&S.media!=="not all")||null,st=()=>{let S=Le();return S?S.dataset.theme:M?b.find(L=>L.media!=="not all")?.dataset.theme:T?F(T.href):void 0};function at(){let S=getComputedStyle(r),L=te=>te?.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[\s,/]+([\d.]+))?\)/),$=L(S.backgroundColor);(!$||$[4]!==void 0&&+$[4]==0)&&($=L(S.backgroundImage));let Z=$?Kn([+$[1],+$[2],+$[3]])<.5:!1;r.setAttribute("data-canvas",Z?"dark":"light")}T?.addEventListener("load",at);function _(S,L=!1){if(!S||!/^[\w-]+$/.test(S))return;let $=!1;if(de&&J&&S===de.name)J.media="all",xe(J),$=!be[S];else if(be[S]){let Z=ke(S,be[S],"custom");Z.media="all",xe(Z)}else if(A.has(S)){let Z=k.find(te=>te.dataset.theme===S);Z.media="all",xe(Z)}else{if(!C)return;if(xe(null),M){let Z=b.find(te=>te.dataset.theme===S);if(!Z)return;b.forEach(te=>{te.media=te===Z?"all":"not all"})}else T.href=T.href.replace(/themes\/[\w-]+\.css(\?.*)?$/,`themes/${S}.css`)}if(!l.has("embedded")&&!$)try{localStorage.setItem(ye,S)}catch{}L||d(S),u("theme",S),at()}let qe=typeof Ze<"u"?Ze:null,Je={added:"Added",custom:"Custom",generated:"Generated"},je=new Map([...P.values()].map(S=>[S.pack,S.label])),O=S=>je.get(S)??qe?.labels?.[S]??Je[S]??S;function D(S){if(be[S])return"custom";if(de&&S===de.name)return"generated";if(P.has(S))return P.get(S).pack;if(A.has(S))return"added";if(qe){for(let[L,$]of Object.entries(qe.packs))if($.includes(S))return L}return"other"}let V=()=>{let S;if(M){let $=b.map(Z=>Z.dataset.theme);S=i.themes?.length?i.themes.filter(Z=>$.includes(Z)):$}else S=i.themes?.length?i.themes:typeof Ge<"u"?Ge:[];let L=[...A,...Object.keys(be)];if(de&&!be[de.name]&&L.push(de.name),S=[...S,...L.filter($=>!S.includes($))],qe){let $=new Map,Z=0;for(let te of qe.order)for(let fe of qe.packs[te]??[])$.set(fe,Z++);S=[...S].sort((te,fe)=>($.get(te)??1e9)-($.get(fe)??1e9))}return S};function re(S){let L=[];for(let $ of qe.order){let Z=(qe.packs[$]??[]).filter(te=>S.includes(te));Z.length&&L.push([$,Z])}for(let $ of new Set([...P.values()].map(Z=>Z.pack))){let Z=S.filter(te=>D(te)===$);Z.length&&L.push([$,Z])}for(let $ of["added","custom","generated"]){let Z=S.filter(te=>D(te)===$);Z.length&&L.push([$,Z])}return L}let Ae=S=>btoa(unescape(encodeURIComponent(JSON.stringify(S)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Ke=S=>JSON.parse(decodeURIComponent(escape(atob(S.replace(/-/g,"+").replace(/_/g,"/")))));function Ce(S,L=!1){de={name:S.name,tokens:S.tokens};let $=ke(S.name,S.tokens,"generated");return $.media="all",xe($),L||d(`\u2728 ${S.name} \u2014 \u2303T re-roll \xB7 \u2303\u21E7T save`,2800),at(),S.name}function s(){return Ce(Sr())}function o(S){if(!de||!J||J.media==="not all")return d("no generated theme to save \u2014 \u2303T to generate one"),null;let L=S??(window.prompt?.("Save theme as:",de.name.replace(/^gen-/,""))||"");if(L=String(L).toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),!L)return null;((typeof Ge<"u"?Ge:[]).includes(L)||b.some(te=>te.dataset.theme===L))&&(L="custom-"+L),be[L]=de.tokens;try{localStorage.setItem(ge,JSON.stringify(be))}catch{}let Z=ke(L,be[L],"custom");if(Z.media="all",J?.remove(),J=null,de=null,xe(Z),!l.has("embedded"))try{localStorage.setItem(ye,L)}catch{}try{let te=new Blob([rs(L,be[L])],{type:"text/css"}),fe=document.createElement("a");fe.href=URL.createObjectURL(te),fe.download=`${L}.css`,fe.click(),setTimeout(()=>URL.revokeObjectURL(fe.href),5e3)}catch{}return d(`saved ${L} \u2014 ${L}.css downloaded`,2200),L}let N=null;function Fe(S=!1){return N?(clearTimeout(N.timer),N=null,S||d("theme cycle cancelled"),!0):!1}function B(S){let L=V();if(!C||L.length<2)return;if(N){let fe=N;clearTimeout(fe.timer),N=null,fe.dir===S?_(fe.name):d("theme cycle cancelled");return}let $=st(),Z=Math.max(0,L.indexOf($)),te=L[(Z+S+L.length)%L.length];if(qe&&D(te)!==D($)){let fe=S>0?".":",",Qe=S>0?",":".";N={dir:S,name:te,timer:setTimeout(()=>{N=null},4e3)},d(`\u2933 ${O(D(te))} pack next (${te}) \u2014 ${fe} confirms \xB7 ${Qe} or Esc cancels`,4e3);return}_(te)}l.has("embedded")&&window.addEventListener("message",S=>{let L=S.data&&S.data.__decklightPreview;!L||S.source!==window.parent||(L.gen?Ce(L.gen,!0):L.theme?_(L.theme,!0):L.goto&&f().goto(L.goto[0],L.goto[1]??0))});function ot(){let S=st(),L=be[S]?{name:S,tokens:be[S]}:de&&S===de.name?de:null;return L?"?embedded&gen="+Ae(L):S?"?embedded&theme="+encodeURIComponent(S):"?embedded"}function mt(){let S=l.get("gen");if(S)try{let Z=Ke(S);if(Z&&Z.tokens){Ce({name:Z.name||"gen-preview",tokens:Z.tokens},!0);return}}catch{}let L=null;try{L=localStorage.getItem(ye)}catch{}let $=l.get("theme")||L;$&&_($,!0)}let K="\0generate",_e="pack:",Y="back",Re="all",y="browse",Be="",w=S=>S.charCodeAt(0)<32,pe=null,Se=0,it,Ee=[],ze=null,oe="",Xe="packs",gt=()=>qe?"packs":"all",Et=()=>h?.()?.available()===!0,me=()=>h?.()?.base()??"",Ne=()=>Et()?[y]:[],Ie=null,et=S=>(Ie?.themes??[]).find(L=>L.qualified===S);async function tt(){Ie={loading:!0,themes:[],stale:[]},Ot("browse");let S;try{let L=await fetch(me()+"/edit/theme/browse"),$=await L.json().catch(()=>({}));S=L.ok&&$.ok?{themes:$.themes??[],stale:$.stale??[],cacheOnly:$.cacheOnly!==!1}:{themes:[],stale:[],error:$.error||`the author server said ${L.status}`}}catch{S={themes:[],stale:[],error:"the author server did not answer"}}!pe||Xe!=="browse"||(Ie=S,Ot("browse"))}async function bt(S){let L=pe?.querySelector(".tp-caption");L&&(L.textContent=`installing ${S}\u2026`);try{let $=await fetch(me()+"/edit/theme/add",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:S})}),Z=await $.json().catch(()=>({}));if(!$.ok){let te=[Z.error,...Z.problems??[]].filter(Boolean).join(" \xB7 ");L&&(L.textContent=te||`install failed (${$.status})`),d(`${S}: ${Z.error||"install refused"}`,3600);return}se(),d(`installed ${Z.name}${Z.replaced?" (replaced)":""} \u2014 Z takes it back`,2800),u("theme",`${S} installed from a marketplace`)}catch{L&&(L.textContent="the author server did not answer")}}function He(S){let L=f().state,$="#/"+L.slide+"/"+L.step;if(S===K||be[S]||de&&S===de.name){let Z=S===K?ze:be[S]?{name:S,tokens:be[S]}:de;return location.pathname+"?embedded&gen="+Ae(Z)+$}return location.pathname+"?embedded&theme="+encodeURIComponent(S)+$}function ft(S){S.textContent=ze?`\u2728 ${ze.name} \u2014 \u2303T re-rolls`:"\u2728 Generate new\u2026"}function Dt(){ze=Sr();let S=Ee.indexOf(K);S<0||(ft(pe.querySelectorAll(".tp-row")[S]),_t(S,!0))}function Kt(){let S=pe.querySelector(".tp-list"),L=st(),$=V();if(Xe==="browse"){let fe=(Ie?.themes??[]).filter(Qe=>!oe||Qe.qualified.includes(oe));Ee=[Y,...fe.map(Qe=>Be+Qe.qualified)]}else if(oe)Ee=$.filter(fe=>fe.includes(oe));else if(!qe||Xe==="all")Ee=qe?[K,Y,...$]:[K,...$,...Ne()];else if(Xe==="packs")Ee=[K,...re($).map(([fe])=>_e+fe),Re,...Ne()];else{let fe=Xe.slice(5);Ee=[Y,...re($).find(([Qe])=>Qe===fe)?.[1]??[]]}S.textContent="";let Z=(fe,Qe)=>{let Pe=document.createElement("span");Pe.className="tp-tag",Pe.textContent=Qe,fe.appendChild(Pe)};if(Ee.forEach((fe,Qe)=>{let Pe=document.createElement("div");if(Pe.setAttribute("role","option"),fe===K)Pe.className="tp-row tp-gen",ft(Pe);else if(fe===Y)Pe.className="tp-row tp-back",Pe.textContent=gt()==="packs"?"\u2190 packs":"\u2190 themes";else if(fe===y)Pe.className="tp-row tp-browse",Pe.textContent="\u2315 Browse marketplaces\u2026";else if(fe.startsWith(Be)){let Ye=et(fe.slice(Be.length));Pe.className="tp-row tp-mkt",Pe.textContent=Ye?.name??fe.slice(Be.length);let ut=A.has(Ye?.name)?"installed":Ye?.marketplace;ut&&Z(Pe,ut)}else if(fe===Re)Pe.className="tp-row tp-all",Pe.textContent="\u2733 all themes",Z(Pe,String($.length));else if(fe.startsWith(_e)){let Ye=fe.slice(_e.length),ut=re($).find(([dt])=>dt===Ye)?.[1]??[];Pe.className="tp-row tp-pack"+(ut.includes(L)?" tp-current":""),Pe.textContent=`\u25B8 ${O(Ye)}`,Z(Pe,String(ut.length))}else{Pe.className="tp-row"+(fe===L?" tp-current":""),Pe.textContent=fe;let Ye=be[fe]?"custom":de&&fe===de.name?"generated":P.has(fe)?P.get(fe).label:A.has(fe)?"added":oe&&qe?O(D(fe)):null;Ye&&Z(Pe,Ye)}Pe.addEventListener("mouseenter",()=>_t(Qe,!1)),Pe.addEventListener("click",()=>{_t(Qe,!0),U()}),S.appendChild(Pe)}),!Ee.length){let fe=document.createElement("div");fe.className="tp-none",fe.textContent="no themes match",S.appendChild(fe)}if(Xe==="browse"){let fe=document.createElement("div");fe.className="tp-none",fe.textContent=Ie?.loading?"reading the catalogs\u2026":Ie?.error?Ie.error:Ee.some(Qe=>Qe.startsWith(Be))?Ie.stale?.length?`from the cache \xB7 never fetched: ${Ie.stale.join(", ")} \u2014 marketplace update`:"from the cache \u2014 listing never goes to the network":oe?"no marketplace theme matches":"no themes in the marketplaces you have registered",S.appendChild(fe)}let te=pe.querySelector(".tp-filter");te.textContent=oe||"type to filter\u2026",te.classList.toggle("tp-active",!!oe)}function Vt(){let S=st(),L=Ee.indexOf(S);if(L>=0)return L;let $=Ee.indexOf(_e+D(S));return $>=0?$:Math.min(1,Ee.length-1)}function Ot(S,L=!1){Xe=S,Kt(),Ee.length&&_t(Vt(),L)}function Q(S){oe=S.toLowerCase(),Kt(),Ee.length?_t(oe?0:Vt(),!1):pe.querySelector(".tp-caption").textContent="no match"}function Zt(){if(pe)return se();m.closeOthers($e);let S=V();if(!C&&!S.length)return;oe="",Xe=gt(),Ie=null,pe=document.createElement("div"),pe.className="decklight-theme-picker",pe.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Themes"></div></div><div class="tp-preview"><iframe title="Theme preview"></iframe><div class="tp-caption"></div></div></div>',Kt(),It(pe,se),r.appendChild(pe);let L=st();L&&W(pe.querySelector("iframe"),L),_t(Vt(),!L)}function _t(S,L){if(!Ee.length)return;Se=(S+Ee.length)%Ee.length;let $=Ee[Se];$===K&&!ze&&(ze=Sr(),ft(pe.querySelectorAll(".tp-row")[Se])),on(pe.querySelectorAll(".tp-row"),Se,"tp-selected");let Z=V(),te=$===K?ze?`\u2728 ${ze.name}`:"generate new":$===Y?gt()==="packs"?"back to packs":"back to the theme list":$===y?"themes from the marketplaces you have registered":$.startsWith(Be)?vt($.slice(Be.length)):$===Re?`all ${Z.length} themes, flattened`:$.startsWith(_e)?`${O($.slice(_e.length))} \xB7 ${re(Z).find(([Qe])=>Qe===$.slice(_e.length))?.[1].length??0} themes`:qe?`${O(D($))} \xB7 ${$}`:$;if(pe.querySelector(".tp-caption").textContent=te,clearTimeout(it),$!==K&&w($))return;let fe=pe.querySelector("iframe");L?W(fe,$):it=setTimeout(()=>W(fe,$),60)}function vt(S){let L=et(S);return L?[L.qualified,L.description,A.has(L.name)?"installed \u2014 \u23CE re-installs it":"\u23CE installs it"].filter(Boolean).join(" \xB7 "):S}let Wt=!1,Ht=null;function R(S){return S===K||be[S]||de&&S===de.name?{gen:S===K?ze:be[S]?{name:S,tokens:be[S]}:de}:{theme:S}}function W(S,L){if(!S.dataset.booted){S.dataset.booted="1",Wt=!1,S.addEventListener("load",()=>{if(Wt=!0,Ht!==null&&pe){let $=Ht;Ht=null,W(S,$)}},{once:!0}),S.src=He(L);return}if(!Wt){Ht=L;return}S.contentWindow?.postMessage({__decklightPreview:R(L)},"*")}function U(){let S=Ee[Se];if(S!==void 0){if(S===K){ze&&Ce(ze),se();return}if(S===Y){Ot(gt());return}if(S===Re){Ot("all");return}if(S===y){tt();return}if(S.startsWith(Be)){bt(S.slice(Be.length));return}if(S.startsWith(_e)){Ot("pack:"+S.slice(_e.length),!0);return}_(S),se()}}function se(){clearTimeout(it),pe?.remove(),pe=null}let $e=m.register({isOpen:()=>!!pe,close:se,keydown(S){switch(S.key){case"ArrowDown":_t(Se+1,!1);break;case"ArrowUp":_t(Se-1,!1);break;case"Enter":U();break;case"Backspace":Q(oe.slice(0,-1));break;case"Escape":oe?Q(""):Xe!==gt()?Ot(gt()):se();break;default:if(S.key.length===1&&/[a-z0-9-]/i.test(S.key)){Q(oe+S.key);break}return!1}return!0}});return{applyTheme:_,currentTheme:st,themeList:V,cycleTheme:B,cancelCyclePending:Fe,rollTheme:s,saveGeneratedTheme:o,adoptGenerated:Ce,updateCanvas:at,restoreSaved:mt,previewQuery:ot,openPicker:Zt,closePicker:se,browse(){pe||Zt(),pe&&tt()},hasGenerated:()=>!!de,rollFromPicker(){return pe&&Ee[Se]===K?(Dt(),!0):!1}}}le();ce();le();ce();le();ce();var ss=["A","B","C","D","E","F","G","H","X"],Wn="#edb58e",bi="#c98f6d",Gc="#43302a",Vn="#b96b58",Zn="#57262c",Ar="#f6f1ea",yi="#d17a70",os=`<svg viewBox="0 0 240 240" role="img" aria-label="Narrator" xmlns="http://www.w3.org/2000/svg">
243
243
  <circle cx="120" cy="120" r="116" fill="var(--block-bg, rgba(128,128,128,.14))" stroke="var(--accent, #6b7f9e)" stroke-opacity=".35" stroke-width="2"/>
244
244
  <clipPath id="dlc-bust"><circle cx="120" cy="120" r="114"/></clipPath>
245
245
  <g clip-path="url(#dlc-bust)">
246
246
  <path d="M120 164 C 94 164 71 178 61 198 L 56 240 L 184 240 L 179 198 C 169 178 146 164 120 164 Z" fill="var(--accent, #4f6fae)"/>
247
- <path d="M106 142 L 106 176 C 106 185 134 185 134 176 L 134 142 Z" fill="${Ln}"/>
248
- <path d="M106 142 L 106 156 C 114 162 126 162 134 156 L 134 142 Z" fill="${hi}"/>
247
+ <path d="M106 142 L 106 176 C 106 185 134 185 134 176 L 134 142 Z" fill="${Wn}"/>
248
+ <path d="M106 142 L 106 156 C 114 162 126 162 134 156 L 134 142 Z" fill="${bi}"/>
249
249
  <g data-idle>
250
- <circle cx="75" cy="98" r="9" fill="${Ln}"/>
251
- <circle cx="165" cy="98" r="9" fill="${Ln}"/>
252
- <path d="M120 38 C 91 38 76 62 76 93 C 76 123 96 149 120 149 C 144 149 164 123 164 93 C 164 62 149 38 120 38 Z" fill="${Ln}"/>
253
- <path d="M120 28 C 87 28 69 51 72 90 C 80 60 96 50 120 50 C 144 50 160 60 168 90 C 171 51 153 28 120 28 Z" fill="${Fc}"/>
250
+ <circle cx="75" cy="98" r="9" fill="${Wn}"/>
251
+ <circle cx="165" cy="98" r="9" fill="${Wn}"/>
252
+ <path d="M120 38 C 91 38 76 62 76 93 C 76 123 96 149 120 149 C 144 149 164 123 164 93 C 164 62 149 38 120 38 Z" fill="${Wn}"/>
253
+ <path d="M120 28 C 87 28 69 51 72 90 C 80 60 96 50 120 50 C 144 50 160 60 168 90 C 171 51 153 28 120 28 Z" fill="${Gc}"/>
254
254
  <path d="M92 84 Q 103 78 114 83" stroke="#4a352c" stroke-width="4" fill="none" stroke-linecap="round"/>
255
255
  <path d="M126 83 Q 137 78 148 84" stroke="#4a352c" stroke-width="4" fill="none" stroke-linecap="round"/>
256
256
  <ellipse cx="103" cy="97" rx="7" ry="5.5" fill="#fbf7f2"/>
@@ -261,38 +261,41 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),U===void 0&
261
261
  <circle cx="137" cy="97" r="3.2" fill="#5a4030"/>
262
262
  <circle cx="137" cy="97" r="1.5" fill="#241a14"/>
263
263
  <circle cx="138.3" cy="95.6" r=".8" fill="#fff"/>
264
- <g data-eyelid><rect x="95" y="90.5" width="16" height="12" rx="6" fill="${Ln}"/></g>
265
- <g data-eyelid><rect x="129" y="90.5" width="16" height="12" rx="6" fill="${Ln}"/></g>
266
- <path d="M120 101 L 117 115 Q 120 119 124 116" stroke="${hi}" stroke-width="3" fill="none" stroke-linecap="round"/>
264
+ <g data-eyelid><rect x="95" y="90.5" width="16" height="12" rx="6" fill="${Wn}"/></g>
265
+ <g data-eyelid><rect x="129" y="90.5" width="16" height="12" rx="6" fill="${Wn}"/></g>
266
+ <path d="M120 101 L 117 115 Q 120 119 124 116" stroke="${bi}" stroke-width="3" fill="none" stroke-linecap="round"/>
267
267
  <ellipse cx="96" cy="115" rx="6.5" ry="4" fill="#e59e7d" opacity=".4"/>
268
268
  <ellipse cx="144" cy="115" rx="6.5" ry="4" fill="#e59e7d" opacity=".4"/>
269
- <g data-mouth="X"><path d="M106 130 Q 120 136 134 130" stroke="${Rn}" stroke-width="4" fill="none" stroke-linecap="round"/></g>
270
- <g data-mouth="A"><path d="M105 130 Q 120 124 135 130 Q 120 137 105 130 Z" fill="${Rn}"/></g>
271
- <g data-mouth="B"><path d="M104 129 Q 120 122 136 129 Q 120 141 104 129 Z" fill="${In}"/><rect x="110" y="126" width="20" height="5" rx="2" fill="${fr}"/></g>
272
- <g data-mouth="C"><ellipse cx="120" cy="131" rx="13" ry="8.5" fill="${In}"/><rect x="109" y="124.5" width="22" height="4.5" rx="2" fill="${fr}"/></g>
273
- <g data-mouth="D"><ellipse cx="120" cy="132" rx="16" ry="12" fill="${In}"/><rect x="106" y="122" width="28" height="6" rx="2.5" fill="${fr}"/><ellipse cx="120" cy="140" rx="9" ry="4.5" fill="${mi}"/></g>
274
- <g data-mouth="E"><ellipse cx="120" cy="131" rx="9" ry="7" fill="${In}" stroke="${Rn}" stroke-width="3"/></g>
275
- <g data-mouth="F"><ellipse cx="120" cy="131" rx="6" ry="5.5" fill="${In}" stroke="${Rn}" stroke-width="3.5"/></g>
276
- <g data-mouth="G"><path d="M105 128 Q 120 123 135 128 Q 120 134 105 128 Z" fill="${Rn}"/><rect x="110" y="127" width="20" height="5" rx="2" fill="${fr}"/><path d="M108 134 Q 120 139 132 134" stroke="${Rn}" stroke-width="3" fill="none" stroke-linecap="round"/></g>
277
- <g data-mouth="H"><ellipse cx="120" cy="131" rx="12" ry="9" fill="${In}"/><path d="M113 125 Q 120 122 127 125 Q 127 132 120 133 Q 113 132 113 125 Z" fill="${mi}"/></g>
269
+ <g data-mouth="X"><path d="M106 130 Q 120 136 134 130" stroke="${Vn}" stroke-width="4" fill="none" stroke-linecap="round"/></g>
270
+ <g data-mouth="A"><path d="M105 130 Q 120 124 135 130 Q 120 137 105 130 Z" fill="${Vn}"/></g>
271
+ <g data-mouth="B"><path d="M104 129 Q 120 122 136 129 Q 120 141 104 129 Z" fill="${Zn}"/><rect x="110" y="126" width="20" height="5" rx="2" fill="${Ar}"/></g>
272
+ <g data-mouth="C"><ellipse cx="120" cy="131" rx="13" ry="8.5" fill="${Zn}"/><rect x="109" y="124.5" width="22" height="4.5" rx="2" fill="${Ar}"/></g>
273
+ <g data-mouth="D"><ellipse cx="120" cy="132" rx="16" ry="12" fill="${Zn}"/><rect x="106" y="122" width="28" height="6" rx="2.5" fill="${Ar}"/><ellipse cx="120" cy="140" rx="9" ry="4.5" fill="${yi}"/></g>
274
+ <g data-mouth="E"><ellipse cx="120" cy="131" rx="9" ry="7" fill="${Zn}" stroke="${Vn}" stroke-width="3"/></g>
275
+ <g data-mouth="F"><ellipse cx="120" cy="131" rx="6" ry="5.5" fill="${Zn}" stroke="${Vn}" stroke-width="3.5"/></g>
276
+ <g data-mouth="G"><path d="M105 128 Q 120 123 135 128 Q 120 134 105 128 Z" fill="${Vn}"/><rect x="110" y="127" width="20" height="5" rx="2" fill="${Ar}"/><path d="M108 134 Q 120 139 132 134" stroke="${Vn}" stroke-width="3" fill="none" stroke-linecap="round"/></g>
277
+ <g data-mouth="H"><ellipse cx="120" cy="131" rx="12" ry="9" fill="${Zn}"/><path d="M113 125 Q 120 122 127 125 Q 127 132 120 133 Q 113 132 113 125 Z" fill="${yi}"/></g>
278
278
  </g>
279
279
  </g>
280
- </svg>`;function zc(r,a){let l=r?.cues;if(!l?.length||!(a>=0)||r.duration&&a>=r.duration)return"X";let d=0,u=l.length-1,m=-1;for(;d<=u;){let h=d+u>>1;l[h].t<=a?(m=h,d=h+1):u=h-1}if(m<0)return"X";let f=l[m].v;return Xr.includes(f)?f:"X"}function fi(r){let a=m=>Math.round(m*1e3)/1e3,l=[],d=(m,f)=>{l.length&&l[l.length-1].v===f||l.push({t:a(m),v:f})},u=0;for(let{timeline:m,gap:f=0}of r){f>0&&(d(u,"X"),u+=f);for(let h of m?.cues??[])d(u+h.t,h.v);u+=m?.duration??0}return{v:1,kind:"visemes",duration:a(u),source:"stitch",cues:l}}function gi({root:r,config:a,debugLog:l,toast:d}){let u=a.narration?.character??{},m=u.bridgeUrl??"http://127.0.0.1:8789",f=u.fallback??"amplitude",h="decklight-character:"+location.pathname,w=u.mode??"off",k=u.engine??"wav2lip",A=u.portrait??"default",I=u.solo??!1;try{let Q=JSON.parse(localStorage.getItem(h));Q?.mode&&(w=Q.mode,k=Q.engine??k,A=Q.portrait??A),typeof Q?.solo=="boolean"&&(I=Q.solo)}catch{}let M=null,C=null,$=null,q=null,he=null,oe=null,de=null,j=0,me=!1,Te,$e=new Map,Re=new Map,be=Q=>`${Q}|${k}|${A}`;function Ce(){try{localStorage.setItem(h,JSON.stringify({mode:w,engine:k,portrait:A,solo:I}))}catch{}}function Xe(){r.classList.toggle("decklight-solo",I&&w!=="off"&&!!M?.classList.contains("show"))}function xe(){me||(me=!0,d("lipsync bridge unreachable \u2014 run: decklight lipsync"),l("lipsync","bridge unreachable \u2014 amplitude fallback"))}function E(){if(M||(M=document.createElement("div"),M.className="decklight-character pos-"+(u.position??"br"),M.setAttribute("aria-hidden","true"),u.size&&M.style.setProperty("--character-size",u.size+"px"),r.appendChild(M)),$!==w)if($=w,M.classList.toggle("mode-video",w==="video"),C=null,w==="video")M.innerHTML="",C=document.createElement("video"),C.muted=!0,C.playsInline=!0,C.preload="auto",M.appendChild(C);else if(u.sprites){M.innerHTML="";for(let Q of Xr){if(!u.sprites[Q])continue;let ye=document.createElement("img");ye.src=u.sprites[Q],ye.setAttribute("data-mouth",Q),ye.alt="",M.appendChild(ye)}}else if(typeof u.svg=="string"&&u.svg.startsWith("#")){M.innerHTML="";let Q=document.querySelector(u.svg);Q&&M.appendChild(Q.cloneNode(!0))}else typeof u.svg=="string"&&/^\s*</.test(u.svg)?M.innerHTML=u.svg:u.svg?(M.innerHTML=Yr,fetch(u.svg).then(Q=>Q.text()).then(Q=>{M&&$==="viseme"&&(M.innerHTML=Q)}).catch(()=>{})):M.innerHTML=Yr}function Ie(){E(),M.classList.add("show"),j||(j=setInterval(Ne,33)),Xe()}function qe(){j&&(clearInterval(j),j=0),M?.classList.remove("show"),C?.pause(),he=null,oe=null,De("X"),Xe()}function De(Q){Q===de||!M||(de=Q,M.setAttribute("data-viseme",Q))}let F=null,J=null,U=null,fe=null;function Ee(){if(f!=="amplitude"||!q)return!1;if(U===q)return!!J;U=q;try{F??=new(window.AudioContext||window.webkitAudioContext);let Q=F.createMediaElementSource(q);J=F.createAnalyser(),J.fftSize=512,Q.connect(J),J.connect(F.destination),fe=new Uint8Array(J.fftSize)}catch{J=null}return!!J}function ze(){J.getByteTimeDomainData(fe);let Q=0;for(let x=0;x<fe.length;x++){let we=(fe[x]-128)/128;Q+=we*we}let ye=Math.sqrt(Q/fe.length);return ye<.02?"X":ye<.06?"B":ye<.12?"C":"D"}function Ne(){if(M?.classList.contains("show")){if(w==="video"){C&&q&&C.readyState>=2&&!q.paused&&Math.abs(C.currentTime-q.currentTime)>.15&&(C.currentTime=q.currentTime);return}if(!q||q.paused||q.ended){De("X");return}he?De(zc(he,q.currentTime)):f==="hide"?De("X"):Ee()?De(ze()):De("X")}}function s(Q,ye,x){if(!$e.has(Q)){let we=(async()=>{let g=await ye;if(!g)return null;let G=Date.now(),B=await fetch(`${m}/viseme?text=${encodeURIComponent(x??"")}`,{method:"POST",headers:{"content-type":"audio/wav"},body:g.blob});if(!B.ok)throw new Error(String(B.status));let X=await B.json();return l("lipsync",`visemes ${Q} \xB7 ${X.cues?.length??0} cues \u2192 ${((Date.now()-G)/1e3).toFixed(1)}s`),X})();we.catch(()=>{$e.get(Q)===we&&$e.delete(Q)}),$e.set(Q,we)}return $e.get(Q)}function o(Q,ye){let x=be(Q);if(!Re.has(x)){let we=(async()=>{let g=await ye;if(!g)return null;let G=Date.now(),B=await fetch(`${m}/video?engine=${k}&portrait=${encodeURIComponent(A)}`,{method:"POST",headers:{"content-type":"audio/wav"},body:g.blob});if(!B.ok)throw new Error(String(B.status));let X=await B.blob(),Y=B.headers?.get?.("x-lipsync-cached")==="1";return l("lipsync",`video ${Q} \xB7 ${k} \u2192 ${((Date.now()-G)/1e3).toFixed(1)}s${Y?" (cached)":""}`),URL.createObjectURL(X)})();we.catch(()=>{Re.get(x)===we&&Re.delete(x)}),Re.set(x,we)}return Re.get(x)}function O(Q,ye,x){w==="viseme"?s(Q,ye,x).catch(()=>{}):w==="video"&&o(Q,ye).catch(()=>{})}function Be(Q,ye,x){w!=="off"&&(Ie(),oe=Q,w==="viseme"?(he=null,s(Q,Promise.resolve(ye),x).then(we=>{oe===Q&&(he=we)}).catch(()=>xe())):o(Q,Promise.resolve(ye)).then(we=>{oe!==Q||!we||!C||(C.src=we,C.playbackRate=q?.playbackRate??1,q&&!q.paused&&(C.currentTime=q.currentTime,C.play().catch(()=>{})))}).catch(()=>xe()))}function P(Q,ye){if(w==="off"||!Q||Q.live)return;Ie();let x=String(ye).padStart(2,"0"),we=`file|${Q.dir}|${x}`;oe=we,w==="viseme"?(he=null,(async()=>{let g=document.querySelector(`script[data-decklight-visemes="slide-${x}"]`);if(g)return JSON.parse(g.textContent);let G=await fetch(`${Q.dir}/slide-${x}.visemes.json`);if(!G.ok)throw new Error(String(G.status));return G.json()})().then(g=>{oe===we&&(he=g)}).catch(()=>{})):C&&(C.src=`${Q.dir}/slide-${x}.mp4`,C.playbackRate=q?.playbackRate??1,C.play().catch(()=>{}))}function Ue(Q){!Q||q===Q||(q=Q,Q.addEventListener("pause",()=>{w==="video"&&C?.pause()}),Q.addEventListener("play",()=>{w==="video"&&C?.src&&C.play().catch(()=>{})}),Q.addEventListener("ratechange",()=>{C&&(C.playbackRate=Q.playbackRate)}))}async function nt(){try{let Q=await fetch(m+"/ping");Te=Q.ok?await Q.json():null}catch{Te=null}return Te}function W(Q,ye={}){w=Q,ye.engine&&(k=ye.engine),ye.portrait&&(A=ye.portrait),Ce(),w==="off"?qe():(me=!1,E(),I&&Ie()),Xe(),l("lipsync",w==="off"?"character off":`character ${w}${w==="video"?` \xB7 ${k} \xB7 ${A}`:""}`)}function Ae(Q){I=!!Q,Ce();let ye=!!q&&!q.paused&&!q.ended;I&&w!=="off"?Ie():!I&&!ye&&qe(),Xe(),l("lipsync",`character solo ${I?"on":"off"}`)}return{get mode(){return w},get engine(){return k},get portrait(){return A},get solo(){return I},get bridgeInfo(){return Te},setMode:W,setSolo:Ae,prefetchSentence:O,beginSentence:Be,beginSlide:P,attachAudio:Ue,stop:qe,probe:nt,ensureTimeline:s}}ae();le();function Uc(r){let a=String(r??"").replace(/[?#].*$/,"");return a.slice(0,a.lastIndexOf("/")+1)}var Hc=/^[a-z][a-z0-9+.-]*:|^\/\//i;function bi(r,a,l){let d=r?.slides?.[l-1];return d?d.url?d.url:d.file?Hc.test(d.file)?d.file:Uc(a)+d.file:null:null}function gr(r,a=Date.now()){let l=r?.expires;if(!l)return{at:null,msLeft:1/0,expired:!1};let d=new Date(l);if(Number.isNaN(d.getTime()))return{at:null,msLeft:1/0,expired:!1};let u=d.getTime()-a;return{at:d,msLeft:u,expired:u<=0}}function yi(r){if(!Number.isFinite(r))return"";if(r<=0)return"expired";let a=Math.floor(r/6e4),l=Math.floor(a/60),d=Math.floor(l/24);return d?`${d}d ${l%24}h left`:l?`${l}h ${a%60}m left`:`${Math.max(1,a)}m left`}var br=r=>r.toISOString().slice(0,16).replace("T"," ")+"Z";function Jr(r){let a=r?.source??"<voice-dir>",l=r?.bucket??"gs://<bucket>/<prefix>",d=r?.signDuration??"7d";return`node tools/publish-voices.mjs ${a} --bucket ${l} --sign ${d}`}function Qr(r){return r?.manifest??r?.dir??null}function Gc({hasTracks:r,used:a,printMode:l,embedded:d,voiceover:u,captionsOn:m,narrating:f}={}){return!!r&&!a&&!l&&!d&&!u&&!m&&!f}function wi({root:r,stage:a,config:l,params:d,printMode:u,toast:m,logOnly:f,debugLog:h,overlays:w,instance:k,syncSoundBtn:A,updateDebugState:I,downloadFromUrl:M}){let C=0,$="decklight-narration:"+location.pathname,q=l.narration?.liveUrl??"http://127.0.0.1:8787/tts",he=[["Zephyr","bright"],["Puck","upbeat"],["Charon","informative"],["Kore","firm"],["Fenrir","excitable"],["Leda","youthful"],["Orus","firm"],["Aoede","breezy"],["Callirrhoe","easy-going"],["Autonoe","bright"],["Enceladus","breathy"],["Iapetus","clear"],["Umbriel","easy-going"],["Algieba","smooth"],["Despina","smooth"],["Erinome","clear"],["Algenib","gravelly"],["Rasalgethi","informative"],["Laomedeia","upbeat"],["Achernar","soft"],["Alnilam","firm"],["Schedar","even"],["Gacrux","mature"],["Pulcherrima","forward"],["Achird","friendly"],["Zubenelgenubi","casual"],["Vindemiatrix","gentle"],["Sadachbia","lively"],["Sadaltager","knowledgeable"],["Sulafat","warm"]],oe=q.replace(/\/tts\/?$/,"/ping"),de=he,j=!0,me=null,Te=null;function $e(){return Te??=fetch(oe).then(T=>T.ok?T.json():null).then(T=>{if(!T)return null;if(me=T.engine??null,Array.isArray(T.voices)&&T.voices.length&&(de=T.voices),j=T.stylable!==!1,h("tts",`bridge: ${T.engine} \xB7 ${T.model} \xB7 ${de.length} voice(s)`+(j?"":" \xB7 no style")),de.length&&!de.some(([K])=>K===xe.voice)){let K=xe.voice;xe={...xe,voice:de[0][0]},Me(),h("tts",`voice ${K} is not on this bridge \u2014 using ${xe.voice}`),E?.live&&m(`voice ${K} \u2192 ${xe.voice} (this bridge speaks its own roster)`,2600)}return T}).catch(()=>null),Te}let Re=[["Warm senior engineer","Read in a warm, welcoming tone, like a friendly battle-hardened senior engineer who is still curious about new technology.","warmly"],["Professional","Read in a clear, professional tone \u2014 measured, confident, and articulate.","professionally"],["Too serious","Read in an extremely grave, deadly serious tone, as if announcing news of the utmost importance.","serious"],["Joyful","Read in a joyful, light-hearted tone, smiling through every sentence.","joyfully"],["Super excited","Read in a super-excited, high-energy tone, barely containing your enthusiasm.","excited"],["Sad","Read in a somber, melancholic tone, on the verge of a sigh.","sad"]],be=([,T,K])=>me==="elevenlabs"?K:T,Ce=(()=>{let T=l.narration?.files;return T?Array.isArray(T)?T:[{label:"Narration",dir:T}]:[]})(),Xe={live:!0},xe={voice:"Alnilam",tone:Re[0][0],style:Re[0][1]},E=Ce[0]??null;try{let T=JSON.parse(localStorage.getItem($));if(T?.live?.voice)xe=T.live,E=Xe;else{let K=T?.track??T?.dir,y=Ce.find(_=>Qr(_)===K);y&&(E=y)}}catch{}let Ie=!1,qe=null,De="decklight-narr-rate:"+location.pathname,F=1;try{let T=parseFloat(localStorage.getItem(De)??"");T>=.25&&T<=2&&(F=T)}catch{}function J(T){F=Math.round(Math.min(2,Math.max(.25,F+T))*100)/100;try{localStorage.setItem(De,String(F))}catch{}qe&&(qe.playbackRate=F),m(`voice speed ${F}\xD7`),h("narr",`rate ${F}\xD7`),I()}let U=gi({root:r,config:l,debugLog:h,toast:m}),fe=new Map;function Ee(T){return(k._sections?.[T-1]?.querySelector("aside.notes")?.textContent??"").replace(/⟨CLICK⟩/g," ").replace(/\s+/g," ").trim()}function ze(T){return(k._sections?.[T-1]?.querySelector("aside.notes")?.textContent??"").split("\u27E8CLICK\u27E9").map(y=>y.replace(/\s+/g," ").trim())}function Ne(T,K,y){if(!T)return Promise.resolve(null);if(!fe.has(K)){let _=(async()=>{let S=Date.now();try{let R=await fetch(q,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:T,voice:xe.voice,style:xe.style})});if(!R.ok)throw new Error(String(R.status));let Z=await R.blob(),ue=parseFloat(R.headers?.get?.("x-tts-cost")??"")||0;return ue&&(C+=ue),h("tts",`${y} \xB7 ${xe.voice} \xB7 ${T.length} chars \u2192 ${((Date.now()-S)/1e3).toFixed(1)}s`+(ue?` \xB7 ~$${ue.toFixed(4)}`:"")),{url:URL.createObjectURL(Z),blob:Z}}catch(R){throw h("tts",`${y} \xB7 ${xe.voice} FAILED after ${((Date.now()-S)/1e3).toFixed(1)}s (${String(R.message||R)})`),R}})();_.catch(()=>{fe.get(K)===_&&fe.delete(K)}),fe.set(K,_)}return fe.get(K)}function s(T){return((T??"").match(/[^.!?…]+[.!?…]+[”’"')\]]*|[^.!?…]+$/g)??[]).map(K=>K.trim()).filter(Boolean)}let o=(T,K,y)=>`${T}|s${K}|n${y}|${xe.voice}|${xe.style}`;function O(T,K,y){let _=s(ze(T)[K])[y]??"";return Ne(_,o(T,K,y),`slide ${T} seg ${K} #${y+1}`)}let Be=T=>k._sections[T-1]?.dataset.narration==="hold",P=10,Ue=3,nt=0;function W(T){let K=[],y=k.state.slide,_=k.state.step;for(;K.length<T&&y<=k.state.totalSlides;){let S=ze(y),R=k._records[y-1]?k._records[y-1].groups.length:0;for(;_<=R&&K.length<T;_++){let Z=s(S[_]).length;for(let ue=0;ue<Z&&K.length<T;ue++)K.push([y,_,ue])}y+=1,_=0}return K}async function Ae(){let T=++nt,K=async()=>{for(;T===nt&&Ie&&E?.live;){let y=W(P).find(([_,S,R])=>!fe.has(o(_,S,R)));if(!y)return;try{if(await O(y[0],y[1],y[2]),U.mode!=="off"){let[_,S,R]=y;U.prefetchSentence(o(_,S,R),fe.get(o(_,S,R)),s(ze(_)[S])[R]??"")}}catch{return}await new Promise(_=>setTimeout(_,30))}};await Promise.all(Array.from({length:Ue},K))}let Q=0,ye=!1,x=!1,we=0;function g(){if(!Ie){m("narration is off \u2014 V starts it");return}ye=!ye,ye?qe?.pause():qe?.src&&qe.paused&&!qe.ended&&qe.currentTime>0?qe.play().catch(()=>{}):x||B(),m(ye?"\u23F8 narration paused \u2014 P resumes":"\u25B6 narration resumed"),h("narr",ye?"paused":"resumed"),I()}function G(T,K){if(!Ie||ye||!E?.live||k.state.slide!==T||k.state.step!==K)return;let y=k._records[T-1];K<(y?y.groups.length:0)?k.next():!Be(T)&&T<k.state.totalSlides&&k.goto(T+1,0)}async function B(){let T=k.state.slide,K=k.state.step,y=++Q;if(Ae(),!Ee(T)){if(Be(T)){h("narr",`hold on slide ${T} \u2014 manual advance`);return}setTimeout(()=>{y!==Q||!Ie||!E?.live||k.state.slide===T&&T<k.state.totalSlides&&k.goto(T+1,0)},400);return}let _=ze(T);if(!_[K]){setTimeout(()=>{y===Q&&G(T,K)},600);return}let S=s(_[K]),R=()=>y!==Q||!Ie||k.state.slide!==T||k.state.step!==K;we=y,x=!0;let Z=0;try{for(let ue=0;ue<S.length;ue++){for(;ye;){if(R())return;await new Promise(ht=>setTimeout(ht,150))}if(R())return;let Ve;try{Ve=await O(T,K,ue)}catch(ht){h("narr",`sentence failed (slide ${T} seg ${K} #${ue+1}) \u2014 narration stopped`),Le(X(ht));return}if(R())return;if(!Ve)continue;_t(S[ue]),qe??=new Audio,U.mode!=="off"&&(U.attachAudio(qe),U.beginSentence(o(T,K,ue),Ve,S[ue])),qe.src=Ve.url,qe.playbackRate=F;let it=!1;if(await new Promise(ht=>{qe.onended=ht,qe.play().catch(()=>{it=!0,ht()})}),it){Le("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}Z++}if(R())return;if(!Z&&S.length){Le("\u{1F507} the voice did not play \u2014 auto-advance stopped \xB7 press the key left of 1 for messages");return}G(T,K)}finally{we===y&&(x=!1)}}function X(T){let K=String(T?.message??T);return K.startsWith("429")?"\u{1F507} voice quota exceeded (429) \u2014 auto-advance stopped \xB7 a free engine: decklight author --tts-engine chirp":/^\d{3}/.test(K)?`\u{1F507} voice bridge error ${K.slice(0,3)} \u2014 auto-advance stopped \xB7 press the key left of 1 for messages`:"\u{1F507} voice bridge unreachable \u2014 auto-advance stopped \xB7 start it with: decklight tts"}let Y=new Map,ge=new Map,V=new Set,ne=null;function Fe(T){for(let K of document.querySelectorAll('script[type="application/json"][data-decklight-voices]'))if(K.getAttribute("data-decklight-voices")===T)try{return JSON.parse(K.textContent)}catch{return null}return null}function Je(T){if(!Y.has(T)){let K=Fe(T);Y.set(T,K?Promise.resolve(K):fetch(T).then(y=>{if(!y.ok)throw new Error(`HTTP ${y.status}`);return y.json()}).catch(y=>{throw Y.delete(T),y})),Y.get(T).then(y=>ge.set(T,y)).catch(()=>{})}return Y.get(T)}function re(T){let K=ge.get(T.manifest);if(!K)return V.has(T.manifest)?"hosted \u2014 the voice list did not load":(Je(T.manifest).catch(()=>V.add(T.manifest)).then(()=>{H&&pe==="tracks"&&pt("tracks")}),"hosted \u2014 checking\u2026");let y=gr(K);return y.at?y.expired?`EXPIRED ${br(y.at)} \u2014 re-sign to play`:`signed \xB7 ${yi(y.msLeft)}`:"hosted \xB7 no expiry"}async function ke(){if(!E||E.live||!E.manifest)return ne=null,!0;if(ne?.track!==E)try{ne={track:E,data:await Je(E.manifest)}}catch(K){return ne=null,Le(`\u{1F507} could not load the voice list for \u201C${E.label}\u201D (${E.manifest} \u2014 ${K.message}) \u2014 auto-advance stopped`),!1}let T=gr(ne.data);return T.expired?(Le(`\u{1F507} the signed voices for \u201C${E.label}\u201D expired ${br(T.at)} \u2014 auto-advance stopped \xB7 re-sign: ${Jr(ne.data)}`),!1):!0}function He(T){return E.manifest?bi(ne?.data,E.manifest,T):`${E.dir}/slide-${String(T).padStart(2,"0")}.${E.ext??"m4a"}`}function _e(){if(!E)return;if(E.live)return B();if(!Ee(k.state.slide)){qe?.pause();return}let T=He(k.state.slide);if(!T){qe?.pause();return}qe??=new Audio,qe.src=T,qe.playbackRate=F,U.mode!=="off"&&(U.attachAudio(qe),U.beginSlide(E,k.state.slide)),qe.onerror=()=>{h("narr",`no audio: ${T}`);let K=E.manifest?gr(ne?.data):null;if(K?.at){h("narr","signed url failed \u2014 a media element cannot report the status"),Le(`\u{1F507} slide ${k.state.slide} of \u201C${E.label}\u201D would not load (signed until ${br(K.at)}) \u2014 auto-advance stopped \xB7 re-sign: ${Jr(ne?.data)}`);return}m(`\u{1F507} no narration for slide ${k.state.slide} (${T}) \xB7 press the key left of 1 for messages`)},qe.play().catch(()=>{m("\u{1F507} the browser blocked audio \u2014 click the deck once, then V")})}function Le(T="narration off"){Ie=!1,Q++,nt++,ye=!1,qe?.pause(),U.stop(),m(T),h("narr",T),A()}async function Qe(){if(!E){rn(Ce.length?"tracks":"voices");return}if(Ie)return Le();if(st(),E.live&&await $e(),!await ke())return;Ie=!0;let T=E.live?`\u26A1 ${xe.voice} \xB7 ${xe.tone}`:E.label;m(`\u{1F50A} ${T} \u2014 V stops \xB7 N picks`),h("narr",`on \u2014 ${T}`),_e(),A()}k.on("slide",()=>{Ie&&_e()}),k.on("build",()=>{Ie&&E?.live&&B()});let Oe="decklight-captions:"+location.pathname,Ye=!1;try{Ye=localStorage.getItem(Oe)==="1"}catch{}let ct=null;function _t(T){ct&&(ct.textContent=T,ct.classList.toggle("show",!!T))}function Pt(){if(ct){if(Ie&&E?.live){_t("");return}_t(ze(k.state.slide)[k.state.step]??"")}}function Kt(){ct=document.createElement("div"),ct.className="decklight-captions",ct.setAttribute("aria-live","polite"),r.appendChild(ct),Pt()}function te(){Ye=!Ye;try{localStorage.setItem(Oe,Ye?"1":"0")}catch{}Ye?(Kt(),ot()):(ct?.remove(),ct=null),m(`captions ${Ye?"on":"off"}`),h("narr",`captions ${Ye?"on":"off"}`)}k.on("slide",Pt),k.on("build",Pt),Ye&&!u&&Kt();let nn="\u{1F50A} this deck has a voice-over \u2014 V plays it",Dt=900,qt=12e3,Xt="decklight-narr-used:"+location.pathname,Ct=!1;try{Ct=localStorage.getItem(Xt)==="1"}catch{}let gt=null;function ot(){if(!gt)return;let T=gt;gt=null,T.classList.remove("show"),setTimeout(()=>T.remove(),260)}function st(){if(ot(),!Ct){Ct=!0;try{localStorage.setItem(Xt,"1")}catch{}}}function N(){let T=document.createElement("button");T.type="button",T.className="decklight-narr-hint",T.setAttribute("aria-label","Play this deck\u2019s voice-over");let K=document.createElement("kbd");K.textContent="V",T.append("\u{1F50A} this deck has a voice-over \u2014 ",K," plays it"),T.addEventListener("click",()=>{ot(),Qe()}),gt=T,r.appendChild(T),T.offsetWidth,T.classList.add("show"),f?.(nn),h("narr","voice-over hint shown"),setTimeout(ot,qt)}Gc({hasTracks:Ce.length>0,used:Ct,printMode:u,embedded:!!d?.has("embedded"),voiceover:!!d?.has("voiceover"),captionsOn:Ye})&&setTimeout(()=>{Ie||N()},Dt);let H=null,ie=0,pe="tracks",Pe=[],Se=null;function Me(){try{localStorage.setItem($,JSON.stringify(E?.live?{live:xe}:{track:Qr(E),dir:E?.dir}))}catch{}}function rt(T,K){xe={voice:Se??xe.voice,tone:T,style:K},E=Xe,Me(),wt(),Ie||(Ie=!0),m(`\u26A1 live voice: ${xe.voice} \xB7 ${xe.tone} \u2014 V stops`),h("narr",`live config \u2014 ${xe.voice} \xB7 ${xe.tone}`),_e()}function at(T){Pe.length&&(ie=jt(H.querySelectorAll(".narr-row"),T,"narr-sel",{scroll:!1}))}function Et(){Pe[ie]?.commit()}function Nt(){pe==="custom"?pt("tones"):pe==="tones"?pt("voices"):pe==="charvideo"?pt("character"):(pe==="voices"||pe==="character")&&Ce.length?pt("tracks"):wt()}let Yt=!1;function Rt(T,K){U.setMode(T,K),wt(),m(T==="off"?"character off":T==="viseme"?`\u{1F3AD} character on \u2014 lips follow the narration${Ie?"":" \xB7 V starts it"}`:`\u{1F3A5} character video \u2014 ${U.engine} \xB7 ${U.portrait}${Ie?"":" \xB7 V starts narration"}`)}function wn(T){if(U.mode==="off"){m("turn the character on first \u2014 N \xB7 Character\u2026");return}U.setSolo(T),wt(),m(T?"\u{1F3AD} solo \u2014 the narrator has the stage \xB7 N brings the slides back":"solo off \u2014 the slides are back")}let Ht="Hey, this is Decklight",It=Ht,dt=null,St=new Map,ut=new Map,Ot=null,Gt=new Set;function xn(T){if(T===Ht)return St;if(T!==Ot){for(let K of ut.values())K.then(y=>URL.revokeObjectURL(y)).catch(()=>{});ut=new Map,Ot=T}return ut}let Wt=(T,K)=>`${T}|${K||""}`;function L(T,K,y,_=""){let S=Wt(K,_);if(!T.has(S)){let R=(async()=>{let Z=Date.now(),ue=await fetch(q,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:y,voice:K,style:_})});if(!ue.ok)throw new Error(String(ue.status));let Ve=await ue.blob(),it=parseFloat(ue.headers?.get?.("x-tts-cost")??"")||0;return it&&(C+=it),h("tts",`preview ${K}${_?" (styled)":""} \xB7 ${((Date.now()-Z)/1e3).toFixed(1)}s`+(it?` \xB7 ~$${it.toFixed(4)}`:"")),URL.createObjectURL(Ve)})();R.catch(()=>{T.get(S)===R&&T.delete(S)}),T.set(S,R)}return T.get(S)}async function vn(T,K,y){let _=`${y}|${T}`;if(Gt.has(_))return;Gt.add(_);let S=T===Ht,R=S?St:ut;try{h("narr",`preview prefetch ${y} (${S?"default":"custom"} sentence)`);for(let{voice:Z,style:ue}of K){if(!S&&Ot!==T)return;R.has(Wt(Z,ue))||await L(R,Z,T,ue).catch(()=>{})}h("narr",`preview prefetch ${y} complete`)}finally{Gt.delete(_)}}function Vt({voice:T,style:K="",prefetch:y},_){let S=It.trim();if(!S)return;let R=xn(S);_&&(_.textContent="\u2026"),L(R,T,S,K).then(Z=>{_?.isConnected&&(_.textContent="\u25B6"),dt??=new Audio,dt.src=Z,dt.play().catch(()=>{}),h("narr",`preview ${T}${K?" \xB7 styled":""}`),y==="voices"?vn(S,he.map(([ue])=>({voice:ue,style:""})),"voices"):y==="tones"&&vn(S,Re.map(ue=>({voice:T,style:be(ue)})),`tones:${T}`)}).catch(()=>{_?.isConnected&&(_.textContent="\u25B6"),m("live voice bridge unreachable \u2014 run: decklight tts"),h("narr",`preview ${T} failed`)})}function pt(T){pe=T;let K=H.querySelector(".narr-card");K.innerHTML="";let y=document.createElement("div");if(y.className="narr-head",K.appendChild(y),Pe=[],T==="tracks")y.textContent="narration",Ce.forEach(S=>Pe.push({text:S.manifest?`\u2601 ${S.label}`:`\u{1F50A} ${S.label} (${S.dir}/)`,flavor:S.manifest?re(S):"",cur:S===E,commit:()=>{E=S,Me(),wt(),m(`\u{1F50A} track: ${S.label}`),Ie&&ke().then(R=>{R&&_e()})}})),Pe.push({text:"\u26A1 Live voice \u2014 synthesize on the fly\u2026",cur:E?.live,commit:()=>pt("voices")}),Pe.push({text:"\u{1F9D1} Character \u2014 animated narrator\u2026",cur:U.mode!=="off",commit:()=>pt("character")});else if(T==="character"){y.textContent="character \u2014 an animated narrator lip-syncs the voice",Yt||(Yt=!0,U.probe().then(()=>{H&&pe==="character"&&pt("character")}));let S=U.bridgeInfo,R=S?.engines?.video??[];Pe.push({text:"Off",cur:U.mode==="off",commit:()=>Rt("off")}),Pe.push({text:"\u{1F3AD} 2D character \u2014 offline visemes",flavor:S?.engines?.viseme?"":"bridge offline \u2014 amplitude fallback",cur:U.mode==="viseme",commit:()=>Rt("viseme")}),Pe.push({text:`\u{1F3A5} Neural video \u2014 local GPU${R.length?"\u2026":""}`,flavor:R.length?"":"needs the bridge \u2014 run: decklight lipsync",cur:U.mode==="video",commit:()=>{R.length?pt("charvideo"):m("video needs wav2lip/sadtalker on the bridge \u2014 run: decklight lipsync")}}),U.mode!=="off"&&Pe.push({text:`${U.solo?"\u25C9":"\u25CB"} Solo \u2014 the narrator takes the stage`,flavor:"slide content steps aside",cur:U.solo,commit:()=>wn(!U.solo)})}else if(T==="charvideo"){y.textContent="neural video \u2014 pick engine \xB7 portrait";let S=U.bridgeInfo;for(let R of S?.engines?.video??[])for(let Z of S?.portraits?.length?S.portraits:["default"])Pe.push({text:`\u{1F3A5} ${R} \xB7 ${Z}`,cur:U.mode==="video"&&U.engine===R&&U.portrait===Z,commit:()=>Rt("video",{engine:R,portrait:Z})})}else if(T==="voices"){y.textContent="live voice \u2014 pick a voice \xB7 \u25B6 previews";let S=document.createElement("div");S.className="narr-preview-row";let R=document.createElement("input");R.className="narr-input narr-preview-text",R.value=It,R.placeholder="Preview sentence",R.setAttribute("aria-label","Preview sentence"),R.addEventListener("input",()=>{It=R.value}),R.addEventListener("keydown",ue=>{ue.key==="Escape"&&(Nt(),ue.preventDefault()),ue.stopPropagation()});let Z=document.createElement("button");Z.type="button",Z.className="narr-prev-btn narr-reset-btn",Z.textContent="\u21BA",Z.title="restore the default sentence",Z.setAttribute("aria-label","restore the default preview sentence"),Z.addEventListener("click",ue=>{ue.stopPropagation(),It=Ht,R.value=Ht}),S.append(R,Z),K.appendChild(S),de.forEach(([ue,Ve])=>Pe.push({text:ue,flavor:Ve,preview:{voice:ue,style:"",prefetch:"voices"},cur:E?.live&&xe.voice===ue,commit:()=>{if(Se=ue,j)return pt("tones");rt(me??"plain","")}}))}else if(T==="tones")y.textContent=`live voice \xB7 ${Se??xe.voice} \u2014 pick a tone \xB7 \u25B6 previews`,Re.forEach(S=>{let[R]=S,Z=be(S);Pe.push({text:R,preview:{voice:Se??xe.voice,style:Z,prefetch:"tones"},cur:E?.live&&xe.tone===R,commit:()=>rt(R,Z)})}),Pe.push({text:"Custom\u2026",cur:E?.live&&xe.tone==="Custom",commit:()=>pt("custom")});else{y.textContent=`live voice \xB7 ${Se??xe.voice} \u2014 type the delivery instruction \xB7 \u25B6 previews`;let S=document.createElement("div");S.className="narr-preview-row";let R=document.createElement("input");R.className="narr-input",R.value=xe.style,R.placeholder="Read in a \u2026",R.addEventListener("keydown",ue=>{ue.key==="Enter"?(At(),ue.preventDefault()):ue.key==="Escape"&&(Nt(),ue.preventDefault()),ue.stopPropagation()});let Z=document.createElement("button");Z.type="button",Z.className="narr-prev-btn narr-reset-btn",Z.textContent="\u25B6",Z.title="preview this delivery instruction",Z.setAttribute("aria-label","preview this delivery instruction"),Z.addEventListener("click",ue=>{ue.stopPropagation();let Ve=R.value.trim();Ve&&Vt({voice:Se??xe.voice,style:Ve},Z)}),S.append(R,Z),K.appendChild(S),setTimeout(()=>{R.focus(),R.select()},0),Pe=[],ie=0;return}Pe.forEach((S,R)=>{let Z=document.createElement("div");Z.className="narr-row"+(S.cur?" narr-cur":"");let ue=document.createElement("span");if(ue.className="narr-row-label",ue.textContent=S.text,S.flavor){let Ve=document.createElement("span");Ve.className="narr-flavor",Ve.textContent=S.flavor,ue.appendChild(Ve)}if(Z.appendChild(ue),S.preview){let Ve=document.createElement("button");Ve.type="button",Ve.className="narr-prev-btn",Ve.textContent="\u25B6",Ve.title=`preview ${S.preview.voice}`,Ve.setAttribute("aria-label",`preview ${S.preview.voice}`),Ve.addEventListener("click",it=>{it.stopPropagation(),Vt(S.preview,Ve)}),Z.appendChild(Ve)}Z.addEventListener("mouseenter",()=>at(R)),Z.addEventListener("click",()=>{at(R),Et()}),K.appendChild(Z)});let _=Pe.findIndex(S=>S.cur);at(Math.max(0,_)),H.querySelector(".narr-sel")?.scrollIntoView({block:"nearest"})}function At(){let T=H?.querySelector(".narr-input")?.value.trim();T&&rt("Custom",T)}function rn(T){if(H&&T===void 0)return wt();H||(H=document.createElement("div"),H.className="decklight-narr",H.innerHTML='<div class="narr-card" role="listbox" aria-label="Narration"></div>',kt(H,wt),r.appendChild(H)),pt(T??(Ce.length?"tracks":"voices")),$e().then(K=>{K&&H&&pe==="voices"&&pt("voices")})}function wt(){H?.remove(),H=null,Yt=!1}let $t=null,Ft="confirm",Mt=0;function sn(){let T=[];for(let K=1;K<=k.state.totalSlides;K++)Ee(K)&&T.push(K);return T}function hn(T){let K=Math.round(T/1e3);return K<60?`${K}s`:`${Math.floor(K/60)}m${String(K%60).padStart(2,"0")}s`}function Lt(T,K={}){Ft=T;let y=$t.querySelector(".narr-card");if(T==="confirm"){let _=K.total;y.innerHTML=`<div class="narr-head">record offline narration</div>
281
- <div class="rec-line">\u26A1 ${xe.voice} \xB7 ${xe.tone}</div>
282
- <div class="rec-line">${_} slide${_===1?"":"s"} stitched from the sentence cache \u2014 only unheard sentences synthesize</div>
280
+ </svg>`;function jc(r,i){let l=r?.cues;if(!l?.length||!(i>=0)||r.duration&&i>=r.duration)return"X";let d=0,u=l.length-1,m=-1;for(;d<=u;){let h=d+u>>1;l[h].t<=i?(m=h,d=h+1):u=h-1}if(m<0)return"X";let f=l[m].v;return ss.includes(f)?f:"X"}function wi(r){let i=m=>Math.round(m*1e3)/1e3,l=[],d=(m,f)=>{l.length&&l[l.length-1].v===f||l.push({t:i(m),v:f})},u=0;for(let{timeline:m,gap:f=0}of r){f>0&&(d(u,"X"),u+=f);for(let h of m?.cues??[])d(u+h.t,h.v);u+=m?.duration??0}return{v:1,kind:"visemes",duration:i(u),source:"stitch",cues:l}}function xi({root:r,config:i,debugLog:l,toast:d}){let u=i.narration?.character??{},m=u.bridgeUrl??"http://127.0.0.1:8789",f=u.fallback??"amplitude",h="decklight-character:"+location.pathname,b=u.mode??"off",k=u.engine??"wav2lip",A=u.portrait??"default",P=u.solo??!1;try{let Y=JSON.parse(localStorage.getItem(h));Y?.mode&&(b=Y.mode,k=Y.engine??k,A=Y.portrait??A),typeof Y?.solo=="boolean"&&(P=Y.solo)}catch{}let M=null,T=null,C=null,F=null,ye=null,ge=null,be=null,J=0,de=!1,Oe,ke=new Map,De=new Map,xe=Y=>`${Y}|${k}|${A}`;function Le(){try{localStorage.setItem(h,JSON.stringify({mode:b,engine:k,portrait:A,solo:P}))}catch{}}function st(){r.classList.toggle("decklight-solo",P&&b!=="off"&&!!M?.classList.contains("show"))}function at(){de||(de=!0,d("lipsync bridge unreachable \u2014 run: decklight lipsync"),l("lipsync","bridge unreachable \u2014 amplitude fallback"))}function _(){if(M||(M=document.createElement("div"),M.className="decklight-character pos-"+(u.position??"br"),M.setAttribute("aria-hidden","true"),u.size&&M.style.setProperty("--character-size",u.size+"px"),r.appendChild(M)),C!==b)if(C=b,M.classList.toggle("mode-video",b==="video"),T=null,b==="video")M.innerHTML="",T=document.createElement("video"),T.muted=!0,T.playsInline=!0,T.preload="auto",M.appendChild(T);else if(u.sprites){M.innerHTML="";for(let Y of ss){if(!u.sprites[Y])continue;let Re=document.createElement("img");Re.src=u.sprites[Y],Re.setAttribute("data-mouth",Y),Re.alt="",M.appendChild(Re)}}else if(typeof u.svg=="string"&&u.svg.startsWith("#")){M.innerHTML="";let Y=document.querySelector(u.svg);Y&&M.appendChild(Y.cloneNode(!0))}else typeof u.svg=="string"&&/^\s*</.test(u.svg)?M.innerHTML=u.svg:u.svg?(M.innerHTML=os,fetch(u.svg).then(Y=>Y.text()).then(Y=>{M&&C==="viseme"&&(M.innerHTML=Y)}).catch(()=>{})):M.innerHTML=os}function qe(){_(),M.classList.add("show"),J||(J=setInterval(Ce,33)),st()}function Je(){J&&(clearInterval(J),J=0),M?.classList.remove("show"),T?.pause(),ye=null,ge=null,je("X"),st()}function je(Y){Y===be||!M||(be=Y,M.setAttribute("data-viseme",Y))}let O=null,D=null,V=null,re=null;function Ae(){if(f!=="amplitude"||!F)return!1;if(V===F)return!!D;V=F;try{O??=new(window.AudioContext||window.webkitAudioContext);let Y=O.createMediaElementSource(F);D=O.createAnalyser(),D.fftSize=512,Y.connect(D),D.connect(O.destination),re=new Uint8Array(D.fftSize)}catch{D=null}return!!D}function Ke(){D.getByteTimeDomainData(re);let Y=0;for(let y=0;y<re.length;y++){let Be=(re[y]-128)/128;Y+=Be*Be}let Re=Math.sqrt(Y/re.length);return Re<.02?"X":Re<.06?"B":Re<.12?"C":"D"}function Ce(){if(M?.classList.contains("show")){if(b==="video"){T&&F&&T.readyState>=2&&!F.paused&&Math.abs(T.currentTime-F.currentTime)>.15&&(T.currentTime=F.currentTime);return}if(!F||F.paused||F.ended){je("X");return}ye?je(jc(ye,F.currentTime)):f==="hide"?je("X"):Ae()?je(Ke()):je("X")}}function s(Y,Re,y){if(!ke.has(Y)){let Be=(async()=>{let w=await Re;if(!w)return null;let pe=Date.now(),Se=await fetch(`${m}/viseme?text=${encodeURIComponent(y??"")}`,{method:"POST",headers:{"content-type":"audio/wav"},body:w.blob});if(!Se.ok)throw new Error(String(Se.status));let it=await Se.json();return l("lipsync",`visemes ${Y} \xB7 ${it.cues?.length??0} cues \u2192 ${((Date.now()-pe)/1e3).toFixed(1)}s`),it})();Be.catch(()=>{ke.get(Y)===Be&&ke.delete(Y)}),ke.set(Y,Be)}return ke.get(Y)}function o(Y,Re){let y=xe(Y);if(!De.has(y)){let Be=(async()=>{let w=await Re;if(!w)return null;let pe=Date.now(),Se=await fetch(`${m}/video?engine=${k}&portrait=${encodeURIComponent(A)}`,{method:"POST",headers:{"content-type":"audio/wav"},body:w.blob});if(!Se.ok)throw new Error(String(Se.status));let it=await Se.blob(),Ee=Se.headers?.get?.("x-lipsync-cached")==="1";return l("lipsync",`video ${Y} \xB7 ${k} \u2192 ${((Date.now()-pe)/1e3).toFixed(1)}s${Ee?" (cached)":""}`),URL.createObjectURL(it)})();Be.catch(()=>{De.get(y)===Be&&De.delete(y)}),De.set(y,Be)}return De.get(y)}function N(Y,Re,y){b==="viseme"?s(Y,Re,y).catch(()=>{}):b==="video"&&o(Y,Re).catch(()=>{})}function Fe(Y,Re,y){b!=="off"&&(qe(),ge=Y,b==="viseme"?(ye=null,s(Y,Promise.resolve(Re),y).then(Be=>{ge===Y&&(ye=Be)}).catch(()=>at())):o(Y,Promise.resolve(Re)).then(Be=>{ge!==Y||!Be||!T||(T.src=Be,T.playbackRate=F?.playbackRate??1,F&&!F.paused&&(T.currentTime=F.currentTime,T.play().catch(()=>{})))}).catch(()=>at()))}function B(Y,Re){if(b==="off"||!Y||Y.live)return;qe();let y=String(Re).padStart(2,"0"),Be=`file|${Y.dir}|${y}`;ge=Be,b==="viseme"?(ye=null,(async()=>{let w=document.querySelector(`script[data-decklight-visemes="slide-${y}"]`);if(w)return JSON.parse(w.textContent);let pe=await fetch(`${Y.dir}/slide-${y}.visemes.json`);if(!pe.ok)throw new Error(String(pe.status));return pe.json()})().then(w=>{ge===Be&&(ye=w)}).catch(()=>{})):T&&(T.src=`${Y.dir}/slide-${y}.mp4`,T.playbackRate=F?.playbackRate??1,T.play().catch(()=>{}))}function ot(Y){!Y||F===Y||(F=Y,Y.addEventListener("pause",()=>{b==="video"&&T?.pause()}),Y.addEventListener("play",()=>{b==="video"&&T?.src&&T.play().catch(()=>{})}),Y.addEventListener("ratechange",()=>{T&&(T.playbackRate=Y.playbackRate)}))}async function mt(){try{let Y=await fetch(m+"/ping");Oe=Y.ok?await Y.json():null}catch{Oe=null}return Oe}function K(Y,Re={}){b=Y,Re.engine&&(k=Re.engine),Re.portrait&&(A=Re.portrait),Le(),b==="off"?Je():(de=!1,_(),P&&qe()),st(),l("lipsync",b==="off"?"character off":`character ${b}${b==="video"?` \xB7 ${k} \xB7 ${A}`:""}`)}function _e(Y){P=!!Y,Le();let Re=!!F&&!F.paused&&!F.ended;P&&b!=="off"?qe():!P&&!Re&&Je(),st(),l("lipsync",`character solo ${P?"on":"off"}`)}return{get mode(){return b},get engine(){return k},get portrait(){return A},get solo(){return P},get bridgeInfo(){return Oe},setMode:K,setSolo:_e,prefetchSentence:N,beginSentence:Fe,beginSlide:B,attachAudio:ot,stop:Je,probe:mt,ensureTimeline:s}}le();ce();function Kc(r){let i=String(r??"").replace(/[?#].*$/,"");return i.slice(0,i.lastIndexOf("/")+1)}var Wc=/^[a-z][a-z0-9+.-]*:|^\/\//i;function vi(r,i,l){let d=r?.slides?.[l-1];return d?d.url?d.url:d.file?Wc.test(d.file)?d.file:Kc(i)+d.file:null:null}function _r(r,i=Date.now()){let l=r?.expires;if(!l)return{at:null,msLeft:1/0,expired:!1};let d=new Date(l);if(Number.isNaN(d.getTime()))return{at:null,msLeft:1/0,expired:!1};let u=d.getTime()-i;return{at:d,msLeft:u,expired:u<=0}}function ki(r){if(!Number.isFinite(r))return"";if(r<=0)return"expired";let i=Math.floor(r/6e4),l=Math.floor(i/60),d=Math.floor(l/24);return d?`${d}d ${l%24}h left`:l?`${l}h ${i%60}m left`:`${Math.max(1,i)}m left`}var Tr=r=>r.toISOString().slice(0,16).replace("T"," ")+"Z";function is(r){let i=r?.source??"<voice-dir>",l=r?.bucket??"gs://<bucket>/<prefix>",d=r?.signDuration??"7d";return`node tools/publish-voices.mjs ${i} --bucket ${l} --sign ${d}`}function as(r){return r?.manifest??r?.dir??null}function Vc({hasTracks:r,used:i,printMode:l,embedded:d,voiceover:u,captionsOn:m,narrating:f}={}){return!!r&&!i&&!l&&!d&&!u&&!m&&!f}function Zc(r){let i=Number(r);return Number.isFinite(i)&&i>0?i:0}function Xc(r){let i=r?.files;if(!i)return[];if(Array.isArray(i))return i;let l={label:"Narration",dir:i};return r.ext!==void 0&&(l.ext=r.ext),r.segments!==void 0&&(l.segments=r.segments),[l]}function Ei({root:r,stage:i,config:l,params:d,printMode:u,toast:m,logOnly:f,debugLog:h,overlays:b,instance:k,syncSoundBtn:A,updateDebugState:P,downloadFromUrl:M,authorBase:T=()=>null}){let C=0,F="decklight-narration:"+location.pathname,ye=l.narration?.liveUrl??"http://127.0.0.1:8787/tts",ge=[["Zephyr","bright"],["Puck","upbeat"],["Charon","informative"],["Kore","firm"],["Fenrir","excitable"],["Leda","youthful"],["Orus","firm"],["Aoede","breezy"],["Callirrhoe","easy-going"],["Autonoe","bright"],["Enceladus","breathy"],["Iapetus","clear"],["Umbriel","easy-going"],["Algieba","smooth"],["Despina","smooth"],["Erinome","clear"],["Algenib","gravelly"],["Rasalgethi","informative"],["Laomedeia","upbeat"],["Achernar","soft"],["Alnilam","firm"],["Schedar","even"],["Gacrux","mature"],["Pulcherrima","forward"],["Achird","friendly"],["Zubenelgenubi","casual"],["Vindemiatrix","gentle"],["Sadachbia","lively"],["Sadaltager","knowledgeable"],["Sulafat","warm"]],be=ye.replace(/\/tts\/?$/,"/ping"),J=ye.replace(/\/tts\/?$/,"/engines"),de=ye.replace(/\/tts\/?$/,"/engine"),Oe=ge,ke=!0,De=null,xe=null,Le=null;function st(){return xe??=fetch(be).then(E=>E.ok?E.json():null).then(E=>E?(at(E),h("tts",`bridge: ${E.engine} \xB7 ${E.model} \xB7 ${Oe.length} voice(s)`+(ke?"":" \xB7 no style")),E):null).catch(()=>null),xe}function at(E){if(!E)return null;if(De=E.engine??null,Array.isArray(E.voices)&&E.voices.length&&(Oe=E.voices),ke=E.stylable!==!1,Oe.length&&!Oe.some(([z])=>z===O.voice)){let z=O.voice;O={...O,voice:Oe[0][0]},qt(),h("tts",`voice ${z} is not on this bridge \u2014 using ${O.voice}`),D?.live&&m(`voice ${z} \u2192 ${O.voice} (this bridge speaks its own roster)`,2600)}return E}let _=[["Warm senior engineer","Read in a warm, welcoming tone, like a friendly battle-hardened senior engineer who is still curious about new technology.","warmly"],["Professional","Read in a clear, professional tone \u2014 measured, confident, and articulate.","professionally"],["Too serious","Read in an extremely grave, deadly serious tone, as if announcing news of the utmost importance.","serious"],["Joyful","Read in a joyful, light-hearted tone, smiling through every sentence.","joyfully"],["Super excited","Read in a super-excited, high-energy tone, barely containing your enthusiasm.","excited"],["Sad","Read in a somber, melancholic tone, on the verge of a sigh.","sad"]],qe=([,E,z])=>De==="elevenlabs"?z:E,Je=Xc(l.narration),je={live:!0},O={voice:"Alnilam",tone:_[0][0],style:_[0][1]},D=Je[0]??null;try{let E=JSON.parse(localStorage.getItem(F));if(E?.live?.voice)O=E.live,D=je;else{let z=E?.track??E?.dir,ne=Je.find(ae=>as(ae)===z);ne&&(D=ne)}}catch{}let V=!1,re=null,Ae="decklight-narr-rate:"+location.pathname,Ke=1;try{let E=parseFloat(localStorage.getItem(Ae)??"");E>=.25&&E<=2&&(Ke=E)}catch{}function Ce(E){Ke=Math.round(Math.min(2,Math.max(.25,Ke+E))*100)/100;try{localStorage.setItem(Ae,String(Ke))}catch{}re&&(re.playbackRate=Ke),m(`voice speed ${Ke}\xD7`),h("narr",`rate ${Ke}\xD7`),P()}let s=xi({root:r,config:l,debugLog:h,toast:m}),o=new Map;function N(E){return(k._sections?.[E-1]?.querySelector("aside.notes")?.textContent??"").replace(/⟨CLICK⟩/g," ").replace(/\s+/g," ").trim()}function Fe(E){return(k._sections?.[E-1]?.querySelector("aside.notes")?.textContent??"").split("\u27E8CLICK\u27E9").map(ne=>ne.replace(/\s+/g," ").trim())}function B(E,z,ne){if(!E)return Promise.resolve(null);if(!o.has(z)){let ae=(async()=>{let X=Date.now();try{let ue=await fetch(ye,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:E,voice:O.voice,style:O.style})});if(!ue.ok)throw new Error(String(ue.status));let we=await ue.blob(),Me=parseFloat(ue.headers?.get?.("x-tts-cost")??"")||0;return Me&&(C+=Me),h("tts",`${ne} \xB7 ${O.voice} \xB7 ${E.length} chars \u2192 ${((Date.now()-X)/1e3).toFixed(1)}s`+(Me?` \xB7 ~$${Me.toFixed(4)}`:"")),{url:URL.createObjectURL(we),blob:we}}catch(ue){throw h("tts",`${ne} \xB7 ${O.voice} FAILED after ${((Date.now()-X)/1e3).toFixed(1)}s (${String(ue.message||ue)})`),ue}})();ae.catch(()=>{o.get(z)===ae&&o.delete(z)}),o.set(z,ae)}return o.get(z)}function ot(E){return((E??"").match(/[^.!?…]+[.!?…]+[”’"')\]]*|[^.!?…]+$/g)??[]).map(z=>z.trim()).filter(Boolean)}let mt=E=>k._records?.[E-1]?.groups.length??0;function K(E,z){let ne=Fe(E),ae=z<mt(E)?[ne[z]]:ne.slice(z),X=[],ue=new Set;for(let we of ae){let Me=ot(we);Me.length&&ue.add(X.length),X.push(...Me)}return{sentences:X,segStarts:ue}}let _e=(E,z)=>K(E,z).sentences,Y=new Set;function Re(E){if(Y.has(E))return;let z=Fe(E).length,ne=mt(E)+1;if(z<=ne)return;Y.add(E);let ae=`slide ${E}: ${z} \u27E8CLICK\u27E9 segments but ${ne} build step${ne===1?"":"s"} \u2014 the last ${z-ne} ${z-ne===1?"is":"are"} spoken on the final step`;f?.(ae),h("narr",ae)}let y=(E,z,ne)=>`${E}|s${z}|n${ne}|${O.voice}|${O.style}`;function Be(E,z,ne){let ae=_e(E,z)[ne]??"";return B(ae,y(E,z,ne),`slide ${E} seg ${z} #${ne+1}`)}let w=E=>k._sections[E-1]?.dataset.narration==="hold",pe=E=>Zc(k._sections[E-1]?.dataset.narrationPause),Se=10,it=3,Ee=0;function ze(E){let z=[],ne=k.state.slide,ae=k.state.step;for(;z.length<E&&ne<=k.state.totalSlides;){let X=mt(ne);for(;ae<=X&&z.length<E;ae++){let ue=_e(ne,ae).length;for(let we=0;we<ue&&z.length<E;we++)z.push([ne,ae,we])}ne+=1,ae=0}return z}async function oe(){let E=++Ee,z=async()=>{for(;E===Ee&&V&&D?.live;){let ne=ze(Se).find(([ae,X,ue])=>!o.has(y(ae,X,ue)));if(!ne)return;try{if(await Be(ne[0],ne[1],ne[2]),s.mode!=="off"){let[ae,X,ue]=ne;s.prefetchSentence(y(ae,X,ue),o.get(y(ae,X,ue)),ot(Fe(ae)[X])[ue]??"")}}catch{return}await new Promise(ae=>setTimeout(ae,30))}};await Promise.all(Array.from({length:it},z))}let Xe=0,gt=!1,Et=!1,me=0;function Ne(){if(!V){m("narration is off \u2014 V starts it");return}gt=!gt,gt?re?.pause():re?.src&&re.paused&&!re.ended&&re.currentTime>0?re.play().catch(()=>{}):Et||et(),m(gt?"\u23F8 narration paused \u2014 P resumes":"\u25B6 narration resumed"),h("narr",gt?"paused":"resumed"),P()}async function Ie(E,z){let ne=Xe,ae=()=>ne!==Xe||!V||!D?.live||k.state.slide!==E||k.state.step!==z;if(gt||ae())return;let X=k._records[E-1];if(z<(X?X.groups.length:0)){k.next();return}if(w(E)||E>=k.state.totalSlides)return;let ue=pe(E);if(ue>0){h("narr",`slide ${E} \u2014 holding ${ue}s before the next slide`);for(let we=ue*1e3;we>0;){if(ae())return;let Me=Date.now();await new Promise(nt=>setTimeout(nt,Math.min(150,we))),gt||(we-=Date.now()-Me)}if(gt||ae())return}k.goto(E+1,0)}async function et(){let E=k.state.slide,z=k.state.step,ne=++Xe;if(oe(),!N(E)){if(w(E)){h("narr",`hold on slide ${E} \u2014 manual advance`);return}setTimeout(()=>{ne!==Xe||!V||!D?.live||k.state.slide===E&&E<k.state.totalSlides&&k.goto(E+1,0)},400);return}Re(E);let ae=_e(E,z);if(!ae.length){setTimeout(()=>{ne===Xe&&Ie(E,z)},600);return}let X=()=>ne!==Xe||!V||k.state.slide!==E||k.state.step!==z;me=ne,Et=!0;let ue=0;try{for(let we=0;we<ae.length;we++){for(;gt;){if(X())return;await new Promise(wt=>setTimeout(wt,150))}if(X())return;let Me;try{Me=await Be(E,z,we)}catch(wt){h("narr",`sentence failed (slide ${E} seg ${z} #${we+1}) \u2014 narration stopped`),vt(tt(wt));return}if(X())return;if(!Me)continue;U(ae[we]),re??=new Audio,s.mode!=="off"&&(s.attachAudio(re),s.beginSentence(y(E,z,we),Me,ae[we])),re.src=Me.url,re.playbackRate=Ke;let nt=!1;if(await new Promise(wt=>{re.onended=wt,re.play().catch(()=>{nt=!0,wt()})}),nt){vt("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}ue++}if(X())return;if(!ue&&ae.length){vt("\u{1F507} the voice did not play \u2014 auto-advance stopped \xB7 press the key left of 1 for messages");return}await Ie(E,z)}finally{me===ne&&(Et=!1)}}function tt(E){let z=String(E?.message??E);return z.startsWith("429")?"\u{1F507} voice quota exceeded (429) \u2014 auto-advance stopped \xB7 a free engine: decklight author --tts-engine chirp":/^\d{3}/.test(z)?`\u{1F507} voice bridge error ${z.slice(0,3)} \u2014 auto-advance stopped \xB7 press the key left of 1 for messages`:"\u{1F507} voice bridge unreachable \u2014 auto-advance stopped \xB7 start it with: decklight tts"}let bt=new Map,He=new Map,ft=new Set,Dt=null;function Kt(E){for(let z of document.querySelectorAll('script[type="application/json"][data-decklight-voices]'))if(z.getAttribute("data-decklight-voices")===E)try{return JSON.parse(z.textContent)}catch{return null}return null}function Vt(E){if(!bt.has(E)){let z=Kt(E);bt.set(E,z?Promise.resolve(z):fetch(E).then(ne=>{if(!ne.ok)throw new Error(`HTTP ${ne.status}`);return ne.json()}).catch(ne=>{throw bt.delete(E),ne})),bt.get(E).then(ne=>He.set(E,ne)).catch(()=>{})}return bt.get(E)}function Ot(E){let z=He.get(E.manifest);if(!z)return ft.has(E.manifest)?"hosted \u2014 the voice list did not load":(Vt(E.manifest).catch(()=>ft.add(E.manifest)).then(()=>{dt&&xt==="tracks"&&St("tracks")}),"hosted \u2014 checking\u2026");let ne=_r(z);return ne.at?ne.expired?`EXPIRED ${Tr(ne.at)} \u2014 re-sign to play`:`signed \xB7 ${ki(ne.msLeft)}`:"hosted \xB7 no expiry"}async function Q(){if(!D||D.live||!D.manifest)return Dt=null,!0;if(Dt?.track!==D)try{Dt={track:D,data:await Vt(D.manifest)}}catch(z){return Dt=null,vt(`\u{1F507} could not load the voice list for \u201C${D.label}\u201D (${D.manifest} \u2014 ${z.message}) \u2014 auto-advance stopped`),!1}let E=_r(Dt.data);return E.expired?(vt(`\u{1F507} the signed voices for \u201C${D.label}\u201D expired ${Tr(E.at)} \u2014 auto-advance stopped \xB7 re-sign: ${is(Dt.data)}`),!1):!0}function Zt(E){return D.manifest?vi(Dt?.data,D.manifest,E):`${D.dir}/slide-${String(E).padStart(2,"0")}.${D.ext??"m4a"}`}function _t(){if(!D)return;if(D.live)return et();if(!N(k.state.slide)){re?.pause();return}let E=Zt(k.state.slide);if(!E){re?.pause();return}re??=new Audio,re.src=E,re.playbackRate=Ke,s.mode!=="off"&&(s.attachAudio(re),s.beginSlide(D,k.state.slide)),re.onerror=()=>{h("narr",`no audio: ${E}`);let z=D.manifest?_r(Dt?.data):null;if(z?.at){h("narr","signed url failed \u2014 a media element cannot report the status"),vt(`\u{1F507} slide ${k.state.slide} of \u201C${D.label}\u201D would not load (signed until ${Tr(z.at)}) \u2014 auto-advance stopped \xB7 re-sign: ${is(Dt?.data)}`);return}m(`\u{1F507} no narration for slide ${k.state.slide} (${E}) \xB7 press the key left of 1 for messages`)},re.play().catch(()=>{m("\u{1F507} the browser blocked audio \u2014 click the deck once, then V")})}function vt(E="narration off"){V=!1,Xe++,Ee++,gt=!1,re?.pause(),s.stop(),m(E),h("narr",E),A()}async function Wt(){if(!D){Mt(Je.length?"tracks":"voices");return}if(V)return vt();if(Ye(),D.live&&await st(),!await Q())return;V=!0;let E=D.live?`\u26A1 ${O.voice} \xB7 ${O.tone}`:D.label;m(`\u{1F50A} ${E} \u2014 V stops \xB7 N picks`),h("narr",`on \u2014 ${E}`),_t(),A()}k.on("slide",()=>{V&&_t()}),k.on("build",()=>{V&&D?.live&&et()});let Ht="decklight-captions:"+location.pathname,R=!1;try{R=localStorage.getItem(Ht)==="1"}catch{}let W=null;function U(E){W&&(W.textContent=E,W.classList.toggle("show",!!E))}function se(){if(W){if(V&&D?.live){U("");return}U(_e(k.state.slide,k.state.step).join(" "))}}function $e(){W=document.createElement("div"),W.className="decklight-captions",W.setAttribute("aria-live","polite"),r.appendChild(W),se()}function S(){R=!R;try{localStorage.setItem(Ht,R?"1":"0")}catch{}R?($e(),Pe()):(W?.remove(),W=null),m(`captions ${R?"on":"off"}`),h("narr",`captions ${R?"on":"off"}`)}k.on("slide",se),k.on("build",se),R&&!u&&$e();let L="\u{1F50A} this deck has a voice-over \u2014 V plays it",$=900,Z=12e3,te="decklight-narr-used:"+location.pathname,fe=!1;try{fe=localStorage.getItem(te)==="1"}catch{}let Qe=null;function Pe(){if(!Qe)return;let E=Qe;Qe=null,E.classList.remove("show"),setTimeout(()=>E.remove(),260)}function Ye(){if(Pe(),!fe){fe=!0;try{localStorage.setItem(te,"1")}catch{}}}function ut(){let E=document.createElement("button");E.type="button",E.className="decklight-narr-hint",E.setAttribute("aria-label","Play this deck\u2019s voice-over");let z=document.createElement("kbd");z.textContent="V",E.append("\u{1F50A} this deck has a voice-over \u2014 ",z," plays it"),E.addEventListener("click",()=>{Pe(),Wt()}),Qe=E,r.appendChild(E),E.offsetWidth,E.classList.add("show"),f?.(L),h("narr","voice-over hint shown"),setTimeout(Pe,Z)}Vc({hasTracks:Je.length>0,used:fe,printMode:u,embedded:!!d?.has("embedded"),voiceover:!!d?.has("voiceover"),captionsOn:R})&&setTimeout(()=>{V||ut()},$);let dt=null,pt=0,xt="tracks",ht=[],yt=null;function qt(){try{localStorage.setItem(F,JSON.stringify(D?.live?{live:O}:{track:as(D),dir:D?.dir}))}catch{}}function Ft(E,z){O={voice:yt??O.voice,tone:E,style:z},D=je,qt(),Gt(),V||(V=!0),m(`\u26A1 live voice: ${O.voice} \xB7 ${O.tone} \u2014 V stops`),h("narr",`live config \u2014 ${O.voice} \xB7 ${O.tone}`),_t()}function Pt(E,{scroll:z=!1}={}){ht.length&&(pt=on(dt.querySelectorAll(".narr-row"),E,"narr-sel",{scroll:z}))}function an(){ht[pt]?.commit()}function ln(){xt==="custom"?St("tones"):xt==="tones"||xt==="engines"?St("voices"):xt==="charvideo"?St("character"):(xt==="voices"||xt==="character")&&Je.length?St("tracks"):Gt()}let tn=!1;function I(E,z){s.setMode(E,z),Gt(),m(E==="off"?"character off":E==="viseme"?`\u{1F3AD} character on \u2014 lips follow the narration${V?"":" \xB7 V starts it"}`:`\u{1F3A5} character video \u2014 ${s.engine} \xB7 ${s.portrait}${V?"":" \xB7 V starts narration"}`)}function Tn(E){if(s.mode==="off"){m("turn the character on first \u2014 N \xB7 Character\u2026");return}s.setSolo(E),Gt(),m(E?"\u{1F3AD} solo \u2014 the narrator has the stage \xB7 N brings the slides back":"solo off \u2014 the slides are back")}let nn="Hey, this is Decklight",Xt=nn,hn=null,Cn=new Map,Qt=new Map,cn=null,Rt=new Set;function Nn(E){if(E===nn)return Cn;if(E!==cn){for(let z of Qt.values())z.then(ne=>URL.revokeObjectURL(ne)).catch(()=>{});Qt=new Map,cn=E}return Qt}let rn=(E,z)=>`${E}|${z||""}`;function gn(E,z,ne,ae=""){let X=rn(z,ae);if(!E.has(X)){let ue=(async()=>{let we=Date.now(),Me=await fetch(ye,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:ne,voice:z,style:ae})});if(!Me.ok)throw new Error(String(Me.status));let nt=await Me.blob(),wt=parseFloat(Me.headers?.get?.("x-tts-cost")??"")||0;return wt&&(C+=wt),h("tts",`preview ${z}${ae?" (styled)":""} \xB7 ${((Date.now()-we)/1e3).toFixed(1)}s`+(wt?` \xB7 ~$${wt.toFixed(4)}`:"")),URL.createObjectURL(nt)})();ue.catch(()=>{E.get(X)===ue&&E.delete(X)}),E.set(X,ue)}return E.get(X)}async function Yt(E,z,ne){let ae=`${ne}|${E}`;if(Rt.has(ae))return;Rt.add(ae);let X=E===nn,ue=X?Cn:Qt;try{h("narr",`preview prefetch ${ne} (${X?"default":"custom"} sentence)`);for(let{voice:we,style:Me}of z){if(!X&&cn!==E)return;ue.has(rn(we,Me))||await gn(ue,we,E,Me).catch(()=>{})}h("narr",`preview prefetch ${ne} complete`)}finally{Rt.delete(ae)}}function $n({voice:E,style:z="",prefetch:ne},ae){let X=Xt.trim();if(!X)return;let ue=Nn(X);ae&&(ae.textContent="\u2026"),gn(ue,E,X,z).then(we=>{ae?.isConnected&&(ae.textContent="\u25B6"),hn??=new Audio,hn.src=we,hn.play().catch(()=>{}),h("narr",`preview ${E}${z?" \xB7 styled":""}`),ne==="voices"?Yt(X,Oe.map(([Me])=>({voice:Me,style:""})),"voices"):ne==="tones"&&Yt(X,_.map(Me=>({voice:E,style:qe(Me)})),`tones:${E}`)}).catch(()=>{ae?.isConnected&&(ae.textContent="\u25B6"),m("live voice bridge unreachable \u2014 run: decklight tts"),h("narr",`preview ${E} failed`)})}function St(E){xt=E;let z=dt.querySelector(".narr-card");z.innerHTML="";let ne=document.createElement("div");if(ne.className="narr-head",z.appendChild(ne),ht=[],E==="tracks")ne.textContent="narration",Je.forEach(X=>ht.push({text:X.manifest?`\u2601 ${X.label}`:`\u{1F50A} ${X.label} (${X.dir}/)`,flavor:X.manifest?Ot(X):"",cur:X===D,commit:()=>{D=X,qt(),Gt(),m(`\u{1F50A} track: ${X.label}`),V&&Q().then(ue=>{ue&&_t()})}})),ht.push({text:"\u26A1 Live voice \u2014 synthesize on the fly\u2026",cur:D?.live,commit:()=>St("voices")}),ht.push({text:"\u{1F9D1} Character \u2014 animated narrator\u2026",cur:s.mode!=="off",commit:()=>St("character")});else if(E==="character"){ne.textContent="character \u2014 an animated narrator lip-syncs the voice",tn||(tn=!0,s.probe().then(()=>{dt&&xt==="character"&&St("character")}));let X=s.bridgeInfo,ue=X?.engines?.video??[];ht.push({text:"Off",cur:s.mode==="off",commit:()=>I("off")}),ht.push({text:"\u{1F3AD} 2D character \u2014 offline visemes",flavor:X?.engines?.viseme?"":"bridge offline \u2014 amplitude fallback",cur:s.mode==="viseme",commit:()=>I("viseme")}),ht.push({text:`\u{1F3A5} Neural video \u2014 local GPU${ue.length?"\u2026":""}`,flavor:ue.length?"":"needs the bridge \u2014 run: decklight lipsync",cur:s.mode==="video",commit:()=>{ue.length?St("charvideo"):m("video needs wav2lip/sadtalker on the bridge \u2014 run: decklight lipsync")}}),s.mode!=="off"&&ht.push({text:`${s.solo?"\u25C9":"\u25CB"} Solo \u2014 the narrator takes the stage`,flavor:"slide content steps aside",cur:s.solo,commit:()=>Tn(!s.solo)})}else if(E==="charvideo"){ne.textContent="neural video \u2014 pick engine \xB7 portrait";let X=s.bridgeInfo;for(let ue of X?.engines?.video??[])for(let we of X?.portraits?.length?X.portraits:["default"])ht.push({text:`\u{1F3A5} ${ue} \xB7 ${we}`,cur:s.mode==="video"&&s.engine===ue&&s.portrait===we,commit:()=>I("video",{engine:ue,portrait:we})})}else if(E==="engines")ne.textContent="live voice \u2014 which engine speaks",Le||fetch(J).then(X=>X.ok?X.json():{stale:!0}).then(X=>{Le=X?.stale?"stale":X?.engines??[]}).catch(()=>{Le=[]}).then(()=>{dt&&xt==="engines"&&St("engines")}),Le?Le==="stale"?ht.push({text:`\u26A1 ${De??"the bridge"} \u2014 and it cannot be changed from here`,flavor:"this voice bridge predates the engine picker",blocked:"restart it: decklight author",cur:!0,commit:()=>{}}):Le.length||ht.push({text:"no voice bridge is answering",flavor:"the engine list comes from it",blocked:"decklight author",cur:!1,commit:()=>{}}):ht.push({text:"asking the bridge\u2026",cur:!1,commit:()=>{}}),(Array.isArray(Le)?Le:[]).forEach(X=>ht.push({text:X.name,flavor:X.ready?X.cost??"":X.why??"unavailable",blocked:X.ready?null:X.fix??null,cur:!!X.current,commit:()=>Bn(X)}));else if(E==="voices"){ne.textContent="live voice \u2014 pick a voice \xB7 \u25B6 previews",ht.push({text:`\u2699 engine: ${De??"the bridge"}\u2026`,flavor:"changes which voices exist",cur:!1,commit:()=>St("engines")});let X=document.createElement("div");X.className="narr-preview-row";let ue=document.createElement("input");ue.className="narr-input narr-preview-text",ue.value=Xt,ue.placeholder="Preview sentence",ue.setAttribute("aria-label","Preview sentence"),ue.addEventListener("input",()=>{Xt=ue.value}),ue.addEventListener("keydown",Me=>{Me.key==="Escape"&&(ln(),Me.preventDefault()),Me.stopPropagation()});let we=document.createElement("button");we.type="button",we.className="narr-prev-btn narr-reset-btn",we.textContent="\u21BA",we.title="restore the default sentence",we.setAttribute("aria-label","restore the default preview sentence"),we.addEventListener("click",Me=>{Me.stopPropagation(),Xt=nn,ue.value=nn}),X.append(ue,we),z.appendChild(X),Oe.forEach(([Me,nt])=>ht.push({text:Me,flavor:nt,preview:{voice:Me,style:"",prefetch:"voices"},cur:D?.live&&O.voice===Me,commit:()=>{if(yt=Me,ke)return St("tones");Ft(De??"plain","")}}))}else if(E==="tones")ne.textContent=`live voice \xB7 ${yt??O.voice} \u2014 pick a tone \xB7 \u25B6 previews`,_.forEach(X=>{let[ue]=X,we=qe(X);ht.push({text:ue,preview:{voice:yt??O.voice,style:we,prefetch:"tones"},cur:D?.live&&O.tone===ue,commit:()=>Ft(ue,we)})}),ht.push({text:"Custom\u2026",cur:D?.live&&O.tone==="Custom",commit:()=>St("custom")});else{ne.textContent=`live voice \xB7 ${yt??O.voice} \u2014 type the delivery instruction \xB7 \u25B6 previews`;let X=document.createElement("div");X.className="narr-preview-row";let ue=document.createElement("input");ue.className="narr-input",ue.value=O.style,ue.placeholder="Read in a \u2026",ue.addEventListener("keydown",Me=>{Me.key==="Enter"?(sn(),Me.preventDefault()):Me.key==="Escape"&&(ln(),Me.preventDefault()),Me.stopPropagation()});let we=document.createElement("button");we.type="button",we.className="narr-prev-btn narr-reset-btn",we.textContent="\u25B6",we.title="preview this delivery instruction",we.setAttribute("aria-label","preview this delivery instruction"),we.addEventListener("click",Me=>{Me.stopPropagation();let nt=ue.value.trim();nt&&$n({voice:yt??O.voice,style:nt},we)}),X.append(ue,we),z.appendChild(X),setTimeout(()=>{ue.focus(),ue.select()},0),ht=[],pt=0;return}ht.forEach((X,ue)=>{let we=document.createElement("div");we.className="narr-row"+(X.cur?" narr-cur":"")+(X.blocked||X.blocked===""?" narr-blocked":"");let Me=document.createElement("span");if(Me.className="narr-row-label",Me.textContent=X.text,X.flavor){let nt=document.createElement("span");nt.className="narr-flavor",nt.textContent=X.flavor,Me.appendChild(nt)}if(we.appendChild(Me),X.blocked){let nt=document.createElement("div");nt.className="narr-fix",nt.textContent=X.blocked,we.appendChild(nt)}if(X.preview){let nt=document.createElement("button");nt.type="button",nt.className="narr-prev-btn",nt.textContent="\u25B6",nt.title=`preview ${X.preview.voice}`,nt.setAttribute("aria-label",`preview ${X.preview.voice}`),nt.addEventListener("click",wt=>{wt.stopPropagation(),$n(X.preview,nt)}),we.appendChild(nt)}we.addEventListener("mouseenter",()=>Pt(ue)),we.addEventListener("click",()=>{Pt(ue),an()}),z.appendChild(we)});let ae=ht.findIndex(X=>X.cur);Pt(Math.max(0,ae),{scroll:!0})}async function Bn(E){if(E?.name){if(!E.ready)return m(E.fix?`${E.name}: ${E.why} \u2014 ${E.fix}`:`${E.name}: ${E.why??"unavailable"}`,5e3);if(E.current)return St("voices");try{let ne=await(await fetch(de,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:E.name})})).json();if(!ne.ok)return m(`${E.name}: ${ne.why??ne.error}${ne.fix?` \u2014 ${ne.fix}`:""}`,5e3);xe=Promise.resolve(at(ne)),Le=null,h("tts",`engine \u2192 ${ne.engine} \xB7 ${ne.model} \xB7 ${Oe.length} voice(s)`),m(`\u26A1 engine: ${ne.engine}${ne.cost?` \xB7 ${ne.cost}`:""} \u2014 this session only`,3200),ne.caveat&&m(ne.caveat,6e3),St("voices")}catch{m(`${E.name}: the voice bridge did not answer`,3e3)}}}function sn(){let E=dt?.querySelector(".narr-input")?.value.trim();E&&Ft("Custom",E)}function Mt(E){if(dt&&E===void 0)return Gt();dt||(dt=document.createElement("div"),dt.className="decklight-narr",dt.innerHTML='<div class="narr-card" role="listbox" aria-label="Narration"></div>',It(dt,Gt),r.appendChild(dt)),St(E??(Je.length?"tracks":"voices")),st().then(z=>{z&&dt&&xt==="voices"&&St("voices")})}function Gt(){dt?.remove(),dt=null,tn=!1}let jt=null,dn="confirm",kt=0;function Tt(){let E=[];for(let z=1;z<=k.state.totalSlides;z++)N(z)&&E.push(z);return E}function un(E){let z=Math.round(E/1e3);return z<60?`${z}s`:`${Math.floor(z/60)}m${String(z%60).padStart(2,"0")}s`}function bn(E,z={}){dn=E;let ne=jt.querySelector(".narr-card");if(E==="confirm"){let ae=z.total;ne.innerHTML=`<div class="narr-head">record offline narration</div>
281
+ <div class="rec-line">\u26A1 ${O.voice} \xB7 ${O.tone}</div>
282
+ <div class="rec-line">${ae} slide${ae===1?"":"s"} stitched from the sentence cache \u2014 only unheard sentences synthesize</div>
283
283
  <div class="narr-row narr-sel">Start recording</div>
284
- <div class="rec-hint">Enter to start \xB7 Esc to cancel</div>`,y.querySelector(".narr-row").addEventListener("click",an)}else if(T==="progress"){let{done:_,total:S,elapsedMs:R}=K,Z=S?Math.round(_/S*100):0,ue=_?hn(R/_*(S-_)):"\u2026";y.innerHTML=`<div class="narr-head">recording\u2026</div>
285
- <div class="rec-bar"><div class="rec-bar-fill" style="width:${Z}%"></div></div>
286
- <div class="rec-line">${_} / ${S} slides \xB7 ${hn(R)} elapsed \xB7 ~${ue} left</div>
287
- <div class="rec-hint">Esc to cancel</div>`}else{let{saved:_,total:S,cancelled:R}=K;y.innerHTML=`<div class="narr-head">${R?"recording cancelled":"recording done"}</div>
288
- <div class="rec-line">${_} / ${S} slide${S===1?"":"s"} saved as slide-NN.wav to your downloads</div>
289
- <div class="rec-line">Point <code>narration.files</code> at that folder with <code>ext: 'wav'</code> to play them back without the bridge.</div>
290
- <div class="rec-hint">Enter or Esc to close</div>`}}let zt=.15,Jt=.35;function on(T,K){let y=T.reduce((R,Z)=>R+Z.length,0),_=new DataView(new ArrayBuffer(44)),S=(R,Z)=>{for(let ue=0;ue<Z.length;ue++)_.setUint8(R+ue,Z.charCodeAt(ue))};return S(0,"RIFF"),_.setUint32(4,36+y,!0),S(8,"WAVE"),S(12,"fmt "),_.setUint32(16,16,!0),_.setUint16(20,1,!0),_.setUint16(22,1,!0),_.setUint32(24,K,!0),_.setUint32(28,K*2,!0),_.setUint16(32,2,!0),_.setUint16(34,16,!0),S(36,"data"),_.setUint32(40,y,!0),new Blob([_.buffer,...T],{type:"audio/wav"})}let Qt=(T,K)=>new Uint8Array(2*Math.round(T*K));async function Bt(T,K){let y=k._records[T-1],_=y?y.groups.length:0,S=ze(T),R=[],Z=24e3;for(let ue=0;ue<=_;ue++){let Ve=s(S[ue]);for(let it=0;it<Ve.length;it++){let ht=await O(T,ue,it);if(K!==Mt)return null;if(!ht)continue;let mn=await ht.blob.arrayBuffer();R.length===0?Z=new DataView(mn).getUint32(24,!0)||24e3:R.push(Qt(Z,it===0?Jt:zt)),R.push(new Uint8Array(mn.slice(44)))}}return R.length?on(R,Z):null}async function xt(T,K){if(U.mode!=="viseme")return null;let y=k._records[T-1],_=y?y.groups.length:0,S=ze(T),R=[];try{for(let Z=0;Z<=_;Z++){let ue=s(S[Z]);for(let Ve=0;Ve<ue.length;Ve++){let it=await U.ensureTimeline(o(T,Z,Ve),O(T,Z,Ve),ue[Ve]);if(K!==Mt)return null;it&&R.push({timeline:it,gap:R.length?Ve===0?Jt:zt:0})}}}catch{return h("lipsync",`slide ${T}: viseme sidecar skipped (bridge unreachable)`),null}return R.length?fi(R):null}async function an(){let T=sn(),K=++Mt,y=Date.now(),_=0,S=0;Lt("progress",{done:_,total:T.length,elapsedMs:0});for(let R of T){if(K!==Mt)return;try{let Z=await Bt(R,K);if(K!==Mt)return;if(Z){let ue=URL.createObjectURL(Z);M(ue,`slide-${String(R).padStart(2,"0")}.wav`),setTimeout(()=>URL.revokeObjectURL(ue),5e3),S++;let Ve=await xt(R,K);if(K!==Mt)return;if(Ve){let it=URL.createObjectURL(new Blob([JSON.stringify(Ve)],{type:"application/json"}));M(it,`slide-${String(R).padStart(2,"0")}.visemes.json`),setTimeout(()=>URL.revokeObjectURL(it),5e3)}}}catch{m(`slide ${R}: recording failed`)}_++,K===Mt&&Lt("progress",{done:_,total:T.length,elapsedMs:Date.now()-y})}K===Mt&&Lt("done",{saved:S,total:T.length})}function kn(){if(!E?.live){m("live voice only \u2014 pick a voice with N first");return}$t||($t=document.createElement("div"),$t.className="decklight-narr decklight-record",$t.innerHTML='<div class="narr-card" role="dialog" aria-label="Record offline narration"></div>',kt($t,bt),r.appendChild($t),Lt("confirm",{total:sn().length}))}function bt(){Mt++,$t?.remove(),$t=null}return w.register({isOpen:()=>!!$t,close:bt,keydown(T){if(T.key==="Escape")bt();else if(T.key==="Enter")Ft==="confirm"?an():Ft!=="progress"&&bt();else return!1;return!0}}),w.register({isOpen:()=>!!H,close:wt,keydown(T){if(pe==="custom")return T.key==="Enter"?(At(),!0):T.key==="Escape"?(Nt(),!0):!1;switch(T.key){case"ArrowDown":at(ie+1);break;case"ArrowUp":at(ie-1);break;case"Enter":Et();break;case"Escape":Nt();break;case"n":case"N":wt();break;default:return!1}return!0}}),{character:U,toggleNarration:Qe,toggleNarrPause:g,changeNarrRate:J,toggleCaptions:te,openPicker:rn,openRecordDialog:kn,applySolo:wn,notesSegs:ze,status:()=>({narrating:Ie,paused:ye,rate:F,captionsOn:Ye,track:E,live:!!E?.live,voice:xe.voice,tone:xe.tone,hasTracks:Ce.length>0,spend:C})}}ae();le();function jc(r,a){let l=[];for(let d=0;d<r;d+=a){let u=[];for(let m=d;m<r&&m<d+a;m++)u.push(m);l.push(u)}return l}function xi(r,a,l){let d=r.ownerDocument,u=h=>{let w=d.createElement("div");return w.className=h,w},m=h=>{let w=u("print-slot"),k=u("decklight-stage print-slide");return k.appendChild(h),w.appendChild(k),w};if(l==="handout")for(let h of jc(a.length,3)){let w=u("print-page print-handout");for(let k of h){let A=u("print-row");A.appendChild(m(a[k])),A.appendChild(u("print-notelines")),w.appendChild(A)}r.appendChild(w)}else a.forEach(h=>{let w=u("print-page print-notes-page"),k=u("print-notes"),A=h.querySelector("aside.notes");A&&(k.innerHTML=A.innerHTML),w.appendChild(m(h)),w.appendChild(k),r.appendChild(w)});let f=d.createElement("style");f.textContent="@media print { @page { size: 816px 1056px; margin: 0; } html, body { margin: 0; padding: 0; } }",d.head.appendChild(f)}ae();le();ae();le();function Kc(r,a,l,d){let u=d||1;return{x:(r-l.left)/u,y:(a-l.top)/u}}function Wc(r,a,l=300){return r.filter(d=>a-d.t<l)}function vi(r,a){let l=a.querySelector(":scope > .decklight-stage"),d=null,u=null,m=null,f=[],h=null,w=[],k=null,A=0,I=()=>getComputedStyle(a).getPropertyValue("--accent").trim()||"#fff",M=be=>Kc(be.clientX,be.clientY,l.getBoundingClientRect(),r._scale);function C(){if(!u)return;let be=window.devicePixelRatio||1,Ce=a.getBoundingClientRect(),Xe=l.getBoundingClientRect(),xe=r._scale||1;u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d.width,d.height),u.setTransform(be*xe,0,0,be*xe,(Xe.left-Ce.left)*be,(Xe.top-Ce.top)*be),u.lineCap=u.lineJoin="round",u.lineWidth=3.5;for(let E of h?[...f,h]:f)if(E.points.length){u.strokeStyle=E.color,u.beginPath(),u.moveTo(E.points[0].x,E.points[0].y);for(let Ie of E.points)u.lineTo(Ie.x,Ie.y);u.stroke()}if(m==="laser"&&k){let E=I(),Ie=performance.now();u.fillStyle=E;for(let qe of w){let De=1-(Ie-qe.t)/300;u.globalAlpha=De*.4,u.beginPath(),u.arc(qe.x,qe.y,3+4*De,0,Math.PI*2),u.fill()}u.globalAlpha=1,u.shadowColor=E,u.shadowBlur=22,u.beginPath(),u.arc(k.x,k.y,7,0,Math.PI*2),u.fill(),u.shadowBlur=0}}function $(){A=0,w=Wc(w,performance.now()),C(),w.length&&(A=requestAnimationFrame($))}let q=()=>{A||(A=requestAnimationFrame($))};function he(be){if(!(m!=="pen"||be.button>0)){try{d.setPointerCapture(be.pointerId)}catch{}h={color:I(),points:[M(be)]},C(),be.preventDefault()}}function oe(be){m==="pen"&&h?(h.points.push(M(be)),C()):m==="laser"&&(k=M(be),w.push({...k,t:performance.now()}),q())}function de(){h&&(f.push(h),h=null)}function j(){let be=a.getBoundingClientRect(),Ce=window.devicePixelRatio||1;d.width=Math.max(1,Math.round(be.width*Ce)),d.height=Math.max(1,Math.round(be.height*Ce)),C()}function me(){d||(d=document.createElement("canvas"),d.className="decklight-annotate",d.setAttribute("aria-hidden","true"),a.appendChild(d),u=d.getContext("2d"),d.addEventListener("pointerdown",he),d.addEventListener("pointermove",oe),d.addEventListener("pointerup",de),d.addEventListener("pointercancel",de),d.addEventListener("touchstart",be=>be.stopPropagation(),{passive:!0}),j(),new ResizeObserver(()=>{j(),requestAnimationFrame(C)}).observe(a))}function Te(be="pen"){return m=m===be?null:be,m&&me(),d&&(d.classList.toggle("tool-pen",m==="pen"),d.classList.toggle("tool-laser",m==="laser")),h&&(f.push(h),h=null),m!=="laser"&&(w=[],k=null,u&&C()),m}function $e(){f=[],h=null,w=[],k=null,u&&C()}function Re(be){me(),f.push({color:I(),points:be.map(Ce=>({x:Ce.x,y:Ce.y}))}),C()}return r.on("slide",$e),{toggle:Te,laser:()=>Te("laser"),clear:$e,stroke:Re,get tool(){return m},get active(){return m!==null}}}function ki({root:r,printMode:a,toast:l,debugLog:d,overlays:u,instance:m,narration:f,downloadFromUrl:h,setProgressBar:w}){let k="decklight-clock:"+location.pathname,A=!1;try{A=localStorage.getItem(k)==="1"}catch{}let I=null,M=null,C=null,$=!1,q=J=>String(J).padStart(2,"0");function he(J){let U=Math.floor(J/1e3),fe=Math.floor(U/3600);return(fe?fe+":":"")+q(Math.floor(U/60)%60)+":"+q(U%60)}function oe(){if(!I)return;let J=new Date;I.querySelector(".clk-time").textContent=q(J.getHours())+":"+q(J.getMinutes()),I.querySelector(".clk-elapsed").textContent="+"+he(C==null?0:Date.now()-C)}function de(){I=document.createElement("div"),I.className="decklight-clock",I.innerHTML='<span class="clk-time"></span><span class="clk-elapsed"></span>',r.appendChild(I),oe(),M=setInterval(oe,1e3)}function j(){A=!A;try{localStorage.setItem(k,A?"1":"0")}catch{}A?de():(clearInterval(M),M=null,I?.remove(),I=null),l(`clock ${A?"on":"off"}`),d("nav",`clock ${A?"on":"off"}`)}m.on("ready",()=>{$=!0});let me=()=>{!$||C!=null||(C=Date.now(),oe())};m.on("slide",me),m.on("build",me),m.toggleClock=j,A&&!a&&de();let Te="decklight-progress:"+location.pathname,$e=!1;try{$e=localStorage.getItem(Te)==="1"}catch{}let Re=null;function be(){Re=document.createElement("div"),Re.className="decklight-progress",Re.innerHTML='<div class="bar"></div>',r.appendChild(Re),w(Re.querySelector(".bar")),m._updateChrome()}function Ce(){$e=!$e;try{localStorage.setItem(Te,$e?"1":"0")}catch{}$e?be():(Re?.remove(),Re=null,w(null)),l(`progress bar ${$e?"on":"off"}`),d("nav",`progress bar ${$e?"on":"off"}`)}m.toggleProgress=Ce,$e&&!a&&be();let Xe=null;a||(Xe=vi(m,r),m.annotate=Xe);function xe(J){if(!Xe)return;let U=J==="laser"?Xe.laser():Xe.toggle();l(U==="pen"?"pen on \u2014 drag to draw \xB7 \u232B clears \xB7 W off":U==="laser"?"laser on \u2014 \u21E7W off":"ink off"),d("nav",`ink ${U??"off"}`)}function E(){return(m._sections||[]).map((J,U)=>({n:U+1,title:J.querySelector("h1, h2, h3")?.textContent.trim()||`Slide ${U+1}`,segs:f.notesSegs(U+1).filter(Boolean)}))}function Ie(J){let U=(document.title||"Deck").trim(),fe=J?[`# ${U} \u2014 transcript`,""]:[`${U} \u2014 transcript`,""];for(let{n:Ee,title:ze,segs:Ne}of E())if(Ne.length){fe.push(J?`## ${Ee}. ${ze}`:`${Ee}. ${ze}`,"");for(let s of Ne)fe.push(s,"")}return fe.join(`
291
- `)}function qe(J){let U=J==="md",fe=URL.createObjectURL(new Blob([Ie(U)],{type:U?"text/markdown":"text/plain"})),Ee=(location.pathname.split("/").pop()||"deck").replace(/\.html?$/i,"");h(fe,`${Ee}-transcript.${U?"md":"txt"}`),setTimeout(()=>URL.revokeObjectURL(fe),5e3),d("narr",`transcript exported (.${U?"md":"txt"})`)}let De=null;function F(){if(De){De.remove(),De=null;return}De=document.createElement("div"),De.className="decklight-narr decklight-transcript";let J=document.createElement("div");J.className="narr-card";let U=document.createElement("div");U.className="narr-head",U.textContent="transcript \u2014 the deck\u2019s spoken notes \xB7 Esc closes";let fe=document.createElement("div");fe.className="tr-actions";for(let[Ee,ze]of[["\u2B07 export .txt","txt"],["\u2B07 export .md","md"]]){let Ne=document.createElement("button");Ne.type="button",Ne.className="narr-prev-btn",Ne.textContent=Ee,Ne.addEventListener("click",()=>qe(ze)),fe.appendChild(Ne)}J.append(U,fe);for(let{n:Ee,title:ze,segs:Ne}of E()){if(!Ne.length)continue;let s=document.createElement("div");s.className="tr-slide";let o=document.createElement("div");o.className="tr-title",o.textContent=`${Ee} \xB7 ${ze}`,o.title="jump to this slide",o.addEventListener("click",()=>{F(),m.goto(Ee,0,{force:!0})}),s.appendChild(o);for(let O of Ne){let Be=document.createElement("p");Be.className="tr-seg",Be.textContent=O,s.appendChild(Be)}J.appendChild(s)}De.appendChild(J),kt(De,F),r.appendChild(De)}return m.transcript={open:F,text:()=>Ie(!1),markdown:()=>Ie(!0)},u.register({isOpen:()=>!!De,close:F,keydown:J=>J.key==="Escape"&&(F(),!0)}),{toggleClock:j,toggleProgress:Ce,toggleInk:xe,toggleTranscript:F,get annotator(){return Xe},status:()=>({clockOn:A,progressOn:$e})}}ae();le();var Vc=["data-background-image","data-background-video","data-background-poster","data-background-size","data-background-position","data-background-dim"];function Zc(r){let a=r["data-background-image"]||null,l=r["data-background-video"]||null;if(!a&&!l)return null;let d=parseFloat(r["data-background-dim"]);return{image:a,video:l,poster:r["data-background-poster"]||null,size:r["data-background-size"]==="contain"?"contain":"cover",position:r["data-background-position"]||"center",dim:Number.isFinite(d)?Math.min(Math.max(d,0),1):0}}var Xc=r=>`url("${String(r).replace(/["\\]/g,"\\$&")}")`;function Yc(r){let a={};for(let l of Vc){let d=r.getAttribute(l);d!==null&&(a[l]=d)}return a}function Ei(r,{printMode:a=!1}={}){r.forEach(l=>{let d=Zc(Yc(l)),u=l.querySelector(":scope > .slide-bg");if(!d){u?.remove();return}let m=JSON.stringify(d)+(a?"\xB7print":"");if(u&&u.dataset.sig===m){u!==l.firstElementChild&&l.prepend(u);return}u||(u=document.createElement("div"),u.className="slide-bg",u.setAttribute("aria-hidden","true")),u.dataset.sig=m,u.textContent="",u.style.backgroundSize=d.size,u.style.backgroundPosition=d.position;let f=d.image||(a?d.poster:null);if(u.style.backgroundImage=f?Xc(f):"",d.video&&!a){let h=document.createElement("video");h.muted=!0,h.loop=!0,h.setAttribute("muted",""),h.setAttribute("loop",""),h.setAttribute("playsinline",""),h.preload="auto",d.poster&&(h.poster=d.poster),h.style.objectFit=d.size,h.style.objectPosition=d.position,h.src=d.video,u.appendChild(h)}if(d.dim>0){let h=document.createElement("div");h.className="slide-bg-dim",h.style.opacity=String(d.dim),u.appendChild(h)}l.prepend(u)})}ae();le();ae();le();var Jc="npx decklight author";function Qc(r){let a=r||"";try{a=decodeURIComponent(a)}catch{}/^\/[A-Za-z]:/.test(a)&&(a=a.slice(1));let l=a.lastIndexOf("/");return{dir:l>0?a.slice(0,l):"",file:l>=0?a.slice(l+1):a}}function tn(r,a={}){let{protocol:l="",pathname:d=""}=a,{dir:u,file:m}=Qc(d),f=/\.html?$/i.test(m)?m:"<deck.html>",h=l==="file:"&&u?`from ${u}, `:"";return`${r} needs author mode: ${h}run ${Jc} ${f}, then reopen the URL it prints`}function Si({root:r,config:a,params:l,printMode:d,toast:u,debugLog:m,overlays:f,instance:h,notesSegs:w,dismissOthers:k}){let A=!1,I="",M=[],C=null,$=[],q=null;if(!d&&!l.has("embedded")){let g=a.edit?.url?[a.edit.url]:/^https?:$/.test(location.protocol)?[""]:["http://127.0.0.1:8788"];(async()=>{for(let G of g)try{let B=await fetch(G+"/edit/ping");if(!B.ok)continue;let X=await B.json();if(!X?.ok)continue;let Y=decodeURIComponent(location.pathname.split("/").pop()||"");if(Y&&X.name&&Y!==X.name){m("edit",`server edits ${X.name}, this deck is ${Y} \u2014 not wiring up`);continue}I=G,A=!0,M=Array.isArray(X.agents)?X.agents:[],C=typeof X.preferredAgent=="string"?X.preferredAgent:null,$=Array.isArray(X.wizards)?X.wizards:[],q=X.agentBusy||null,q&&u(`${q.agent} is editing the deck\u2026`,2e3);let ge=new EventSource(G+"/edit/events");ge.onmessage=()=>location.reload(),ge.addEventListener("agent",V=>{try{let ne=JSON.parse(V.data);if(ne.state==="start")q=ne,u(`\u{1F916} ${ne.agent} is editing the deck\u2026`,2200),m("agent",`${ne.agent} start: ${(ne.prompt||"").slice(0,80)}`);else if(ne.state==="done"){q=null;let Fe=ne.ok?"":ne.error?` \u2014 ${ne.error}`:` (exit ${ne.code})`;u(ne.changed?`\u{1F916} ${ne.agent} edited the deck \u2014 Z undoes${Fe}`:`\u{1F916} ${ne.agent} finished \u2014 no changes${Fe}`,3e3),m("agent",`${ne.agent} done ok=${ne.ok} changed=${ne.changed}${Fe}`)}}catch{}}),m("edit",`live reload connected${G?` (${G})`:""}`+(M.length?` \xB7 agents: ${M.map(V=>V.name).join(", ")}`:""));return}catch{}await he()})()}async function he(){let g=/^https?:$/.test(location.protocol)?"":"http://127.0.0.1:8790";try{let G=await fetch(g+"/present/ping");if(!G.ok)return;let B=await G.json();if(!B?.ok||!B.present)return;let X=decodeURIComponent(location.pathname.split("/").pop()||"");if(X&&B.name&&X!==B.name){m("present",`server presents ${B.name}, this deck is ${X} \u2014 not wiring up`);return}h.__remoteQr=B.remote?`${g||location.origin}/remote/qr.svg`:null,new EventSource(g+"/present/events").addEventListener("remote",V=>{try{let{key:ne}=JSON.parse(V.data);ne==="next"?h.next():ne==="prev"&&h.prev()}catch{}});let ge=()=>{fetch(g+"/remote/pos",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({i:h.state.slide,n:h.state.totalSlides})}).catch(()=>{})};h.on("slide",ge),h.on("build",ge),ge(),m("present",`remote connected${g?` (${g})`:""} \u2014 no edit surface`)}catch{}}async function oe(g){if(!A){u(tn(g,location),3200);return}try{let G=await fetch(I+"/edit/"+g,{method:"POST"}),B=await G.json().catch(()=>({}));if(!G.ok){u(B.error||`${g} failed`);return}u(`${g} \u2014 ${B.undo} back \xB7 ${B.redo} forward`),m("edit",`${g} \u2192 ${B.undo} back, ${B.redo} forward`)}catch{u(`${g} failed \u2014 is the dev server still up?`,2200)}}let de=null;function j(){if(de){de.remove(),de=null;return}if(!A){u(tn("asking an agent",location),3200);return}if(!M.length){u("no agent CLI detected on the dev machine (claude, codex, bob, \u2026)",2600);return}if(q){u(`${q.agent} is still working on the last ask`,2200);return}de=document.createElement("div"),de.className="decklight-narr decklight-editor";let g=document.createElement("div");g.className="narr-card";let G=document.createElement("div");G.className="narr-head",G.textContent="ask an agent \u2014 edits the deck file \xB7 \u2318\u23CE sends \xB7 Esc closes";let B=document.createElement("textarea");B.className="narr-input edit-notes",B.placeholder=`e.g. "make slide ${h.state.slide} a split layout with the diagram on the left"`,B.spellcheck=!1;let X=C&&M.some(ne=>ne.name===C)?C:M[0].name,Y=document.createElement("div");if(Y.className="tr-actions",M.length>1){let ne=document.createElement("select");ne.className="narr-prev-btn";for(let Fe of M){let Je=document.createElement("option");Je.value=Fe.name,Je.textContent=Fe.label,ne.appendChild(Je)}ne.value=X,ne.addEventListener("change",()=>{X=ne.value,C=ne.value,fetch(I+"/edit/agent/prefer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:ne.value})}).catch(()=>{}),m("agent",`preferred agent \u2192 ${ne.value}`)}),ne.addEventListener("keydown",Fe=>Fe.stopPropagation()),Y.appendChild(ne)}let ge=async()=>{let ne=B.value.trim();if(ne)try{let Fe=await fetch(I+"/edit/agent",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({prompt:ne,agent:X})}),Je=await Fe.json().catch(()=>({}));if(!Fe.ok)throw new Error(Je.error||Fe.status);j()}catch(Fe){u(`ask failed: ${String(Fe.message||Fe).slice(0,60)}`,2200)}};B.addEventListener("keydown",ne=>{ne.key==="Enter"&&(ne.metaKey||ne.ctrlKey)?(ge(),ne.preventDefault()):ne.key==="Escape"&&(j(),ne.preventDefault()),ne.stopPropagation()});let V=document.createElement("button");V.type="button",V.className="narr-prev-btn",V.textContent="\u{1F916} send to agent",V.addEventListener("click",ge),Y.appendChild(V),g.append(G,B,Y),de.appendChild(g),kt(de,j),r.appendChild(de),setTimeout(()=>B.focus(),0)}let me=null;function Te(){if(me){me.remove(),me=null;return}let g=h.state.slide;if(!A){u(tn("editing notes",location),3200);return}me=document.createElement("div"),me.className="decklight-narr decklight-editor";let G=document.createElement("div");G.className="narr-card";let B=document.createElement("div");B.className="narr-head",B.textContent=`edit notes \u2014 slide ${g} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let X=document.createElement("textarea");X.className="narr-input edit-notes",X.value=w(g).filter((ne,Fe,Je)=>ne||Fe<Je.length).join(`
284
+ <div class="rec-hint">Enter to start \xB7 Esc to cancel</div>`,ne.querySelector(".narr-row").addEventListener("click",zt)}else if(E==="progress"){let{done:ae,total:X,elapsedMs:ue}=z,we=X?Math.round(ae/X*100):0,Me=ae?un(ue/ae*(X-ae)):"\u2026";ne.innerHTML=`<div class="narr-head">recording\u2026</div>
285
+ <div class="rec-bar"><div class="rec-bar-fill" style="width:${we}%"></div></div>
286
+ <div class="rec-line">${ae} / ${X} slides \xB7 ${un(ue)} elapsed \xB7 ~${Me} left</div>
287
+ <div class="rec-hint">Esc to cancel</div>`}else{let{saved:ae,total:X,cancelled:ue,dir:we}=z,Me=we?`saved as slide-NN.wav in <code>${$t(we)}/</code>, next to the deck`:"saved as slide-NN.wav to your downloads",nt=we?`Set <code>narration: { files: '${$t(we)}', ext: 'wav' }</code> to play them back without the bridge \u2014 <code>decklight bundle</code> picks the folder up from there.`:"Move them next to the deck and point <code>narration.files</code> at that folder with <code>ext: 'wav'</code> to play them back without the bridge.";ne.innerHTML=`<div class="narr-head">${ue?"recording cancelled":"recording done"}</div>
288
+ <div class="rec-line">${ae} / ${X} slide${X===1?"":"s"} ${Me}</div>
289
+ <div class="rec-line">${nt}</div>
290
+ <div class="rec-hint">Enter or Esc to close</div>`}}let On=.15,yn=.35;function wn(E,z){let ne=E.reduce((ue,we)=>ue+we.length,0),ae=new DataView(new ArrayBuffer(44)),X=(ue,we)=>{for(let Me=0;Me<we.length;Me++)ae.setUint8(ue+Me,we.charCodeAt(Me))};return X(0,"RIFF"),ae.setUint32(4,36+ne,!0),X(8,"WAVE"),X(12,"fmt "),ae.setUint32(16,16,!0),ae.setUint16(20,1,!0),ae.setUint16(22,1,!0),ae.setUint32(24,z,!0),ae.setUint32(28,z*2,!0),ae.setUint16(32,2,!0),ae.setUint16(34,16,!0),X(36,"data"),ae.setUint32(40,ne,!0),new Blob([ae.buffer,...E],{type:"audio/wav"})}let v=(E,z)=>new Uint8Array(2*Math.round(E*z));async function H(E,z){let ne=mt(E),ae=[],X=24e3;for(let we=0;we<=ne;we++){let{sentences:Me,segStarts:nt}=K(E,we);for(let wt=0;wt<Me.length;wt++){let vn=await Be(E,we,wt);if(z!==kt)return null;if(!vn)continue;let lr=await vn.blob.arrayBuffer();ae.length===0?X=new DataView(lr).getUint32(24,!0)||24e3:ae.push(v(X,wt===0||nt.has(wt)?yn:On)),ae.push(new Uint8Array(lr.slice(44)))}}let ue=pe(E);return ae.length&&ue>0&&ae.push(v(X,ue)),ae.length?wn(ae,X):null}async function G(E,z){if(s.mode!=="viseme")return null;let ne=mt(E),ae=[];try{for(let ue=0;ue<=ne;ue++){let{sentences:we,segStarts:Me}=K(E,ue);for(let nt=0;nt<we.length;nt++){let wt=await s.ensureTimeline(y(E,ue,nt),Be(E,ue,nt),we[nt]);if(z!==kt)return null;wt&&ae.push({timeline:wt,gap:ae.length?nt===0||Me.has(nt)?yn:On:0})}}}catch{return h("lipsync",`slide ${E}: viseme sidecar skipped (bridge unreachable)`),null}let X=pe(E);return ae.length&&X>0&&ae.push({timeline:{cues:[],duration:0},gap:X}),ae.length?wi(ae):null}let ve="voiceover";function Ue(){let E=l.narration?.files,z=typeof E=="string"?E:Array.isArray(E)?E.find(ne=>typeof ne?.dir=="string")?.dir:null;return z&&!/^[a-z][a-z0-9+.-]*:/i.test(z)&&!/^[/\\]/.test(z)&&!z.split(/[/\\]/).includes("..")?z:ve}async function Ct(E,z,ne,ae){if(ae)try{if((await(await fetch(`${ae.base}/edit/record?slide=${E}&kind=${z}&dir=${encodeURIComponent(ae.name)}`,{method:"POST",body:ne})).json())?.ok)return!0}catch{}let X=`slide-${String(E).padStart(2,"0")}.${z==="wav"?"wav":"visemes.json"}`,ue=URL.createObjectURL(ne);return M(ue,X),setTimeout(()=>URL.revokeObjectURL(ue),5e3),!1}async function zt(){let E=Tt(),z=++kt,ne=Date.now(),ae=0,X=0,ue=0,we=T(),Me=we==null?null:{base:we,name:Ue()};bn("progress",{done:ae,total:E.length,elapsedMs:0});for(let nt of E){if(z!==kt)return;try{let wt=await H(nt,z);if(z!==kt)return;if(wt){if(await Ct(nt,"wav",wt,Me)&&ue++,z!==kt)return;X++;let vn=await G(nt,z);if(z!==kt)return;vn&&await Ct(nt,"visemes",new Blob([JSON.stringify(vn)],{type:"application/json"}),Me)}}catch{m(`slide ${nt}: recording failed`)}ae++,z===kt&&bn("progress",{done:ae,total:E.length,elapsedMs:Date.now()-ne})}z===kt&&bn("done",{saved:X,total:E.length,dir:ue?Me.name:null})}function xn(){if(!D?.live){m("live voice only \u2014 pick a voice with N first");return}jt||(jt=document.createElement("div"),jt.className="decklight-narr decklight-record",jt.innerHTML='<div class="narr-card" role="dialog" aria-label="Record offline narration"></div>',It(jt,Jt),r.appendChild(jt),bn("confirm",{total:Tt().length}))}function Jt(){kt++,jt?.remove(),jt=null}return b.register({isOpen:()=>!!jt,close:Jt,keydown(E){if(E.key==="Escape")Jt();else if(E.key==="Enter")dn==="confirm"?zt():dn!=="progress"&&Jt();else return!1;return!0}}),b.register({isOpen:()=>!!dt,close:Gt,keydown(E){if(xt==="custom")return E.key==="Enter"?(sn(),!0):E.key==="Escape"?(ln(),!0):!1;switch(E.key){case"ArrowDown":Pt(pt+1,{scroll:!0});break;case"ArrowUp":Pt(pt-1,{scroll:!0});break;case"Enter":an();break;case"Escape":ln();break;case"n":case"N":Gt();break;default:return!1}return!0}}),{character:s,toggleNarration:Wt,toggleNarrPause:Ne,changeNarrRate:Ce,toggleCaptions:S,openPicker:Mt,openRecordDialog:xn,applySolo:Tn,notesSegs:Fe,status:()=>({narrating:V,paused:gt,rate:Ke,captionsOn:R,track:D,live:!!D?.live,voice:O.voice,tone:O.tone,hasTracks:Je.length>0,spend:C})}}le();ce();function Yc(r,i){let l=[];for(let d=0;d<r;d+=i){let u=[];for(let m=d;m<r&&m<d+i;m++)u.push(m);l.push(u)}return l}function Si(r,i,l){let d=r.ownerDocument,u=h=>{let b=d.createElement("div");return b.className=h,b},m=h=>{let b=u("print-slot"),k=u("decklight-stage print-slide");return k.appendChild(h),b.appendChild(k),b};if(l==="handout")for(let h of Yc(i.length,3)){let b=u("print-page print-handout");for(let k of h){let A=u("print-row");A.appendChild(m(i[k])),A.appendChild(u("print-notelines")),b.appendChild(A)}r.appendChild(b)}else i.forEach(h=>{let b=u("print-page print-notes-page"),k=u("print-notes"),A=h.querySelector("aside.notes");A&&(k.innerHTML=A.innerHTML),b.appendChild(m(h)),b.appendChild(k),r.appendChild(b)});let f=d.createElement("style");f.textContent="@media print { @page { size: 816px 1056px; margin: 0; } html, body { margin: 0; padding: 0; } }",d.head.appendChild(f)}le();ce();le();ce();function Jc(r,i,l,d){let u=d||1;return{x:(r-l.left)/u,y:(i-l.top)/u}}function Qc(r,i,l=300){return r.filter(d=>i-d.t<l)}function Ai(r,i){let l=i.querySelector(":scope > .decklight-stage"),d=null,u=null,m=null,f=[],h=null,b=[],k=null,A=0,P=()=>getComputedStyle(i).getPropertyValue("--accent").trim()||"#fff",M=xe=>Jc(xe.clientX,xe.clientY,l.getBoundingClientRect(),r._scale);function T(){if(!u)return;let xe=window.devicePixelRatio||1,Le=i.getBoundingClientRect(),st=l.getBoundingClientRect(),at=r._scale||1;u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d.width,d.height),u.setTransform(xe*at,0,0,xe*at,(st.left-Le.left)*xe,(st.top-Le.top)*xe),u.lineCap=u.lineJoin="round",u.lineWidth=3.5;for(let _ of h?[...f,h]:f)if(_.points.length){u.strokeStyle=_.color,u.beginPath(),u.moveTo(_.points[0].x,_.points[0].y);for(let qe of _.points)u.lineTo(qe.x,qe.y);u.stroke()}if(m==="laser"&&k){let _=P(),qe=performance.now();u.fillStyle=_;for(let Je of b){let je=1-(qe-Je.t)/300;u.globalAlpha=je*.4,u.beginPath(),u.arc(Je.x,Je.y,3+4*je,0,Math.PI*2),u.fill()}u.globalAlpha=1,u.shadowColor=_,u.shadowBlur=22,u.beginPath(),u.arc(k.x,k.y,7,0,Math.PI*2),u.fill(),u.shadowBlur=0}}function C(){A=0,b=Qc(b,performance.now()),T(),b.length&&(A=requestAnimationFrame(C))}let F=()=>{A||(A=requestAnimationFrame(C))};function ye(xe){if(!(m!=="pen"||xe.button>0)){try{d.setPointerCapture(xe.pointerId)}catch{}h={color:P(),points:[M(xe)]},T(),xe.preventDefault()}}function ge(xe){m==="pen"&&h?(h.points.push(M(xe)),T()):m==="laser"&&(k=M(xe),b.push({...k,t:performance.now()}),F())}function be(){h&&(f.push(h),h=null)}function J(){let xe=i.getBoundingClientRect(),Le=window.devicePixelRatio||1;d.width=Math.max(1,Math.round(xe.width*Le)),d.height=Math.max(1,Math.round(xe.height*Le)),T()}function de(){d||(d=document.createElement("canvas"),d.className="decklight-annotate",d.setAttribute("aria-hidden","true"),i.appendChild(d),u=d.getContext("2d"),d.addEventListener("pointerdown",ye),d.addEventListener("pointermove",ge),d.addEventListener("pointerup",be),d.addEventListener("pointercancel",be),d.addEventListener("touchstart",xe=>xe.stopPropagation(),{passive:!0}),J(),new ResizeObserver(()=>{J(),requestAnimationFrame(T)}).observe(i))}function Oe(xe="pen"){return m=m===xe?null:xe,m&&de(),d&&(d.classList.toggle("tool-pen",m==="pen"),d.classList.toggle("tool-laser",m==="laser")),h&&(f.push(h),h=null),m!=="laser"&&(b=[],k=null,u&&T()),m}function ke(){f=[],h=null,b=[],k=null,u&&T()}function De(xe){de(),f.push({color:P(),points:xe.map(Le=>({x:Le.x,y:Le.y}))}),T()}return r.on("slide",ke),{toggle:Oe,laser:()=>Oe("laser"),clear:ke,stroke:De,get tool(){return m},get active(){return m!==null}}}function _i({root:r,printMode:i,toast:l,debugLog:d,overlays:u,instance:m,narration:f,downloadFromUrl:h,setProgressBar:b}){let k="decklight-clock:"+location.pathname,A=!1;try{A=localStorage.getItem(k)==="1"}catch{}let P=null,M=null,T=null,C=!1,F=D=>String(D).padStart(2,"0");function ye(D){let V=Math.floor(D/1e3),re=Math.floor(V/3600);return(re?re+":":"")+F(Math.floor(V/60)%60)+":"+F(V%60)}function ge(){if(!P)return;let D=new Date;P.querySelector(".clk-time").textContent=F(D.getHours())+":"+F(D.getMinutes()),P.querySelector(".clk-elapsed").textContent="+"+ye(T==null?0:Date.now()-T)}function be(){P=document.createElement("div"),P.className="decklight-clock",P.innerHTML='<span class="clk-time"></span><span class="clk-elapsed"></span>',r.appendChild(P),ge(),M=setInterval(ge,1e3)}function J(){A=!A;try{localStorage.setItem(k,A?"1":"0")}catch{}A?be():(clearInterval(M),M=null,P?.remove(),P=null),l(`clock ${A?"on":"off"}`),d("nav",`clock ${A?"on":"off"}`)}m.on("ready",()=>{C=!0});let de=()=>{!C||T!=null||(T=Date.now(),ge())};m.on("slide",de),m.on("build",de),m.toggleClock=J,A&&!i&&be();let Oe="decklight-progress:"+location.pathname,ke=!1;try{ke=localStorage.getItem(Oe)==="1"}catch{}let De=null;function xe(){De=document.createElement("div"),De.className="decklight-progress",De.innerHTML='<div class="bar"></div>',r.appendChild(De),b(De.querySelector(".bar")),m._updateChrome()}function Le(){ke=!ke;try{localStorage.setItem(Oe,ke?"1":"0")}catch{}ke?xe():(De?.remove(),De=null,b(null)),l(`progress bar ${ke?"on":"off"}`),d("nav",`progress bar ${ke?"on":"off"}`)}m.toggleProgress=Le,ke&&!i&&xe();let st=null;i||(st=Ai(m,r),m.annotate=st);function at(D){if(!st)return;let V=D==="laser"?st.laser():st.toggle();l(V==="pen"?"pen on \u2014 drag to draw \xB7 \u232B clears \xB7 W off":V==="laser"?"laser on \u2014 \u21E7W off":"ink off"),d("nav",`ink ${V??"off"}`)}function _(){return(m._sections||[]).map((D,V)=>({n:V+1,title:D.querySelector("h1, h2, h3")?.textContent.trim()||`Slide ${V+1}`,segs:f.notesSegs(V+1).filter(Boolean)}))}function qe(D){let V=(document.title||"Deck").trim(),re=D?[`# ${V} \u2014 transcript`,""]:[`${V} \u2014 transcript`,""];for(let{n:Ae,title:Ke,segs:Ce}of _())if(Ce.length){re.push(D?`## ${Ae}. ${Ke}`:`${Ae}. ${Ke}`,"");for(let s of Ce)re.push(s,"")}return re.join(`
291
+ `)}function Je(D){let V=D==="md",re=URL.createObjectURL(new Blob([qe(V)],{type:V?"text/markdown":"text/plain"})),Ae=(location.pathname.split("/").pop()||"deck").replace(/\.html?$/i,"");h(re,`${Ae}-transcript.${V?"md":"txt"}`),setTimeout(()=>URL.revokeObjectURL(re),5e3),d("narr",`transcript exported (.${V?"md":"txt"})`)}let je=null;function O(){if(je){je.remove(),je=null;return}je=document.createElement("div"),je.className="decklight-narr decklight-transcript";let D=document.createElement("div");D.className="narr-card";let V=document.createElement("div");V.className="narr-head",V.textContent="transcript \u2014 the deck\u2019s spoken notes \xB7 Esc closes";let re=document.createElement("div");re.className="tr-actions";for(let[Ae,Ke]of[["\u2B07 export .txt","txt"],["\u2B07 export .md","md"]]){let Ce=document.createElement("button");Ce.type="button",Ce.className="narr-prev-btn",Ce.textContent=Ae,Ce.addEventListener("click",()=>Je(Ke)),re.appendChild(Ce)}D.append(V,re);for(let{n:Ae,title:Ke,segs:Ce}of _()){if(!Ce.length)continue;let s=document.createElement("div");s.className="tr-slide";let o=document.createElement("div");o.className="tr-title",o.textContent=`${Ae} \xB7 ${Ke}`,o.title="jump to this slide",o.addEventListener("click",()=>{O(),m.goto(Ae,0,{force:!0})}),s.appendChild(o);for(let N of Ce){let Fe=document.createElement("p");Fe.className="tr-seg",Fe.textContent=N,s.appendChild(Fe)}D.appendChild(s)}je.appendChild(D),It(je,O),r.appendChild(je)}return m.transcript={open:O,text:()=>qe(!1),markdown:()=>qe(!0)},u.register({isOpen:()=>!!je,close:O,keydown:D=>D.key==="Escape"&&(O(),!0)}),{toggleClock:J,toggleProgress:Le,toggleInk:at,toggleTranscript:O,get annotator(){return st},status:()=>({clockOn:A,progressOn:ke})}}le();ce();var ed=["data-background-image","data-background-video","data-background-poster","data-background-size","data-background-position","data-background-dim"];function td(r){let i=r["data-background-image"]||null,l=r["data-background-video"]||null;if(!i&&!l)return null;let d=parseFloat(r["data-background-dim"]);return{image:i,video:l,poster:r["data-background-poster"]||null,size:r["data-background-size"]==="contain"?"contain":"cover",position:r["data-background-position"]||"center",dim:Number.isFinite(d)?Math.min(Math.max(d,0),1):0}}var nd=r=>`url("${String(r).replace(/["\\]/g,"\\$&")}")`;function rd(r){let i={};for(let l of ed){let d=r.getAttribute(l);d!==null&&(i[l]=d)}return i}function Ti(r,{printMode:i=!1}={}){r.forEach(l=>{let d=td(rd(l)),u=l.querySelector(":scope > .slide-bg");if(!d){u?.remove();return}let m=JSON.stringify(d)+(i?"\xB7print":"");if(u&&u.dataset.sig===m){u!==l.firstElementChild&&l.prepend(u);return}u||(u=document.createElement("div"),u.className="slide-bg",u.setAttribute("aria-hidden","true")),u.dataset.sig=m,u.textContent="",u.style.backgroundSize=d.size,u.style.backgroundPosition=d.position;let f=d.image||(i?d.poster:null);if(u.style.backgroundImage=f?nd(f):"",d.video&&!i){let h=document.createElement("video");h.muted=!0,h.loop=!0,h.setAttribute("muted",""),h.setAttribute("loop",""),h.setAttribute("playsinline",""),h.preload="auto",d.poster&&(h.poster=d.poster),h.style.objectFit=d.size,h.style.objectPosition=d.position,h.src=d.video,u.appendChild(h)}if(d.dim>0){let h=document.createElement("div");h.className="slide-bg-dim",h.style.opacity=String(d.dim),u.appendChild(h)}l.prepend(u)})}le();ce();le();ce();var sd="npx decklight author";function od(r){let i=r||"";try{i=decodeURIComponent(i)}catch{}/^\/[A-Za-z]:/.test(i)&&(i=i.slice(1));let l=i.lastIndexOf("/");return{dir:l>0?i.slice(0,l):"",file:l>=0?i.slice(l+1):i}}function fn(r,i={}){let{protocol:l="",pathname:d=""}=i,{dir:u,file:m}=od(d),f=/\.html?$/i.test(m)?m:"<deck.html>",h=l==="file:"&&u?`from ${u}, `:"";return`${r} needs author mode: ${h}run ${sd} ${f}, then reopen the URL it prints`}function id(r){let i=Math.max(0,Math.floor((Number(r)||0)/1e3)),l=String(i%60).padStart(2,"0"),d=Math.floor(i/60);return d<60?`${d}:${l}`:`${Math.floor(d/60)}:${String(d%60).padStart(2,"0")}:${l}`}var ad={second:"s",minute:"m",hour:"h",day:"d",week:"w",month:"mo",year:"y"};function Ci(r){let i=/^(\d+)\s+(second|minute|hour|day|week|month|year)s?\s+ago$/.exec(String(r??"").trim());return i?`${i[1]}${ad[i[2]]}`:String(r??"")}function Ni(r,i=Date.now()){if(!r||!r.agent)return null;let l=Number(r.startedAt);return!Number.isFinite(l)||l<=0||l>i?r.agent:`${r.agent} \xB7 ${id(i-l)}`}function $i(r,{shown:i=!1,threshold:l=10}={}){if(i||!r||!["ok","no-upstream"].includes(r.state))return null;let d=r.state==="ok"?r.ahead:r.unpushed;return!d||d<l?null:`\u2191${d} commits are only on this machine \u2014 H shows them`}le();ce();var ld=/<\s*(pre|textarea|script|style)\b/i,cd=r=>!ld.test(String(r??""));function Oi(r){let i=String(r??"");if(!cd(i))return i;let l=i.split(`
292
+ `);if(l.length<2)return i;let d=1/0;for(let u of l.slice(1))if(u.trim()&&(/^\s*\t/.test(u)||(d=Math.min(d,/^ */.exec(u)[0].length),d===0)))return i;return Number.isFinite(d)?l.map((u,m)=>m===0?u:u.trim()?u.slice(d):"").join(`
293
+ `):i}function Mi({root:r,config:i,params:l,printMode:d,toast:u,debugLog:m,overlays:f,instance:h,notesSegs:b,dismissOthers:k}){let A=!1,P="",M=[],T=null,C=[],F=null,ye=!1,ge=null,be=0;function J(){let R=Ni(F);if(!R){clearInterval(be),be=0,ge?.remove(),ge=null;return}ge||(ge=document.createElement("div"),ge.className="decklight-agent-chip",ge.setAttribute("role","status"),ge.setAttribute("aria-live","polite"),r.appendChild(ge)),ge.textContent=`\u{1F916} ${R}`,ge.title=F.prompt?`asked: ${F.prompt}`:"",be||(be=setInterval(J,1e3))}if(!d&&!l.has("embedded")){let R=i.edit?.url?[i.edit.url]:/^https?:$/.test(location.protocol)?[""]:["http://127.0.0.1:8788"];(async()=>{for(let W of R)try{let U=await fetch(W+"/edit/ping");if(!U.ok)continue;let se=await U.json();if(!se?.ok)continue;let $e=decodeURIComponent(location.pathname.split("/").pop()||"");if($e&&se.name&&$e!==se.name){m("edit",`server edits ${se.name}, this deck is ${$e} \u2014 not wiring up`);continue}P=W,A=!0,M=Array.isArray(se.agents)?se.agents:[],T=typeof se.preferredAgent=="string"?se.preferredAgent:null,C=Array.isArray(se.wizards)?se.wizards:[];let S=$i(se.remote);S&&(ye=!0,u(S,4200)),F=se.agentBusy||null,F&&u(`${F.agent} is editing the deck\u2026`,2e3),J();let L=new EventSource(W+"/edit/events");L.onmessage=()=>location.reload(),L.addEventListener("agent",$=>{try{let Z=JSON.parse($.data);if(Z.state==="start")F=Z,J(),u(`\u{1F916} ${Z.agent} is editing the deck\u2026`,2200),m("agent",`${Z.agent} start: ${(Z.prompt||"").slice(0,80)}`);else if(Z.state==="done"){F=null,J();let te=Z.ok?"":Z.error?` \u2014 ${Z.error}`:` (exit ${Z.code})`;u(Z.changed?`\u{1F916} ${Z.agent} edited the deck \u2014 Z undoes${te}`:`\u{1F916} ${Z.agent} finished \u2014 no changes${te}`,3e3),m("agent",`${Z.agent} done ok=${Z.ok} changed=${Z.changed}${te}`)}}catch{}}),m("edit",`live reload connected${W?` (${W})`:""}`+(M.length?` \xB7 agents: ${M.map($=>$.name).join(", ")}`:""));return}catch{}await _()})()}let de=null,Oe=!1,ke=null;function De(){ke?.remove(),ke=null}function xe(R,W){let U=document.createElement("div");return U.className=W,U.textContent=R,U}async function Le(R){let W=ke?.querySelector(".tp-list");if(!W)return;W.textContent="",W.appendChild(xe(R.message??R.state,"hs-remote"));for(let $e of R.commits??[])W.appendChild(xe(`${$e.hash} ${$e.subject}`,"tp-row"));let U=ke.querySelector(".up-actions");U.textContent="";let se=($e,S)=>{let L=document.createElement("button");return L.type="button",L.className="narr-prev-btn",L.textContent=$e,L.addEventListener("click",S),U.appendChild(L),L};se("check now",async()=>{U.textContent="checking\u2026",await Le(await st("/present/upstream/check"))}),R.state==="behind"&&R.pull?.offered?se("update the deck",async()=>{U.textContent="pulling\u2026";let $e=await st("/present/upstream/pull");if($e.reload)return location.reload();await Le({...$e,commits:[],message:$e.message}),$e.state==="pulled"&&se("show it anyway",()=>location.reload())}):R.pull&&!R.pull.offered&&R.state==="behind"&&U.appendChild(xe(`update control off \u2014 ${R.pull.reason}`,"hs-remote"))}async function st(R){try{return await(await fetch(de+R,{method:"POST"})).json()}catch{return{state:"error",message:"the presenting server did not answer"}}}async function at(){if(ke)return De();let R;try{let W=await fetch(de+"/present/upstream");if(!W.ok)return u("this deck is not a tracked file in a git clone \u2014 nothing to update from",3400);R=await W.json()}catch{return u("deck update: the presenting server did not answer",3e3)}k(),ke=document.createElement("div"),ke.className="decklight-theme-picker decklight-finder decklight-restore decklight-history",ke.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter">Deck update \u2014 Esc closes</div><div class="tp-list" role="listbox" aria-label="Upstream commits"></div><div class="up-actions tr-actions"></div></div></div>',It(ke,De),r.appendChild(ke),await Le(R)}f.register({isOpen:()=>!!ke,close:De,keydown:R=>R.key==="Escape"&&(De(),!0)});async function _(){let R=/^https?:$/.test(location.protocol)?"":"http://127.0.0.1:8790";try{let W=await fetch(R+"/present/ping");if(!W.ok)return;let U=await W.json();if(!U?.ok||!U.present)return;let se=decodeURIComponent(location.pathname.split("/").pop()||"");if(se&&U.name&&se!==U.name){m("present",`server presents ${U.name}, this deck is ${se} \u2014 not wiring up`);return}h.__remoteQr=U.remote?`${R||location.origin}/remote/qr.svg`:null,de=R,Oe=!0,new EventSource(R+"/present/events").addEventListener("remote",L=>{try{let{key:$}=JSON.parse(L.data);$==="next"?h.next():$==="prev"&&h.prev()}catch{}});let S=()=>{fetch(R+"/remote/pos",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({i:h.state.slide,n:h.state.totalSlides})}).catch(()=>{})};h.on("slide",S),h.on("build",S),S(),m("present",`remote connected${R?` (${R})`:""} \u2014 no edit surface`)}catch{}}async function qe(R){if(!A){u(fn(R,location),3200);return}try{let W=await fetch(P+"/edit/"+R,{method:"POST"}),U=await W.json().catch(()=>({}));if(!W.ok){u(U.error||`${R} failed`);return}u(`${R} \u2014 ${U.undo} back \xB7 ${U.redo} forward`),m("edit",`${R} \u2192 ${U.undo} back, ${U.redo} forward`)}catch{u(`${R} failed \u2014 is the dev server still up?`,2200)}}let Je=null;function je(){if(Je){Je.remove(),Je=null;return}if(!A){u(fn("asking an agent",location),3200);return}if(!M.length){u("no agent CLI detected on the dev machine (claude, codex, bob, \u2026)",2600);return}if(F){u(`${F.agent} is still working on the last ask`,2200);return}Je=document.createElement("div"),Je.className="decklight-narr decklight-editor";let R=document.createElement("div");R.className="narr-card";let W=document.createElement("div");W.className="narr-head",W.textContent="ask an agent \u2014 edits the deck file \xB7 \u2318\u23CE sends \xB7 Esc closes";let U=document.createElement("textarea");U.className="narr-input edit-notes",U.placeholder=`e.g. "make slide ${h.state.slide} a split layout with the diagram on the left"`,U.spellcheck=!1;let se=T&&M.some($=>$.name===T)?T:M[0].name,$e=document.createElement("div");if($e.className="tr-actions",M.length>1){let $=document.createElement("select");$.className="narr-prev-btn";for(let Z of M){let te=document.createElement("option");te.value=Z.name,te.textContent=Z.label,$.appendChild(te)}$.value=se,$.addEventListener("change",()=>{se=$.value,T=$.value,fetch(P+"/edit/agent/prefer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:$.value})}).catch(()=>{}),m("agent",`preferred agent \u2192 ${$.value}`)}),$.addEventListener("keydown",Z=>Z.stopPropagation()),$e.appendChild($)}let S=async()=>{let $=U.value.trim();if($)try{let Z=await fetch(P+"/edit/agent",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({prompt:$,agent:se})}),te=await Z.json().catch(()=>({}));if(!Z.ok)throw new Error(te.error||Z.status);je()}catch(Z){u(`ask failed: ${String(Z.message||Z).slice(0,60)}`,2200)}};U.addEventListener("keydown",$=>{$.key==="Enter"&&($.metaKey||$.ctrlKey)?(S(),$.preventDefault()):$.key==="Escape"&&(je(),$.preventDefault()),$.stopPropagation()});let L=document.createElement("button");L.type="button",L.className="narr-prev-btn",L.textContent="\u{1F916} send to agent",L.addEventListener("click",S),$e.appendChild(L),R.append(W,U,$e),Je.appendChild(R),It(Je,je),r.appendChild(Je),setTimeout(()=>U.focus(),0)}let O=null;function D(){if(O){O.remove(),O=null;return}let R=h.state.slide;if(!A){u(fn("editing notes",location),3200);return}O=document.createElement("div"),O.className="decklight-narr decklight-editor";let W=document.createElement("div");W.className="narr-card";let U=document.createElement("div");U.className="narr-head",U.textContent=`edit notes \u2014 slide ${R} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let se=document.createElement("textarea");se.className="narr-input edit-notes",se.value=b(R).filter(($,Z,te)=>$||Z<te.length).join(`
292
294
 
293
295
  \u27E8CLICK\u27E9
294
296
 
295
- `),X.spellcheck=!1;let Y=async()=>{try{let ne=await fetch(I+"/edit/notes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:g,text:X.value})});if(!ne.ok)throw new Error(await ne.text());m("edit",`notes saved \u2014 slide ${g}`),u("notes saved \u2014 reloading")}catch(ne){u(`save failed: ${String(ne.message||ne).slice(0,60)}`)}};X.addEventListener("keydown",ne=>{ne.key==="Enter"&&(ne.metaKey||ne.ctrlKey)?(Y(),ne.preventDefault()):ne.key==="Escape"&&(Te(),ne.preventDefault()),ne.stopPropagation()});let ge=document.createElement("div");ge.className="tr-actions";let V=document.createElement("button");V.type="button",V.className="narr-prev-btn",V.textContent="\u{1F4BE} save to file",V.addEventListener("click",Y),ge.appendChild(V),G.append(B,X,ge),me.appendChild(G),kt(me,Te),r.appendChild(me),setTimeout(()=>X.focus(),0)}let $e=["fade","fade-up","fade-down","zoom","pop","draw","highlight"],Re=!1,be=null,Ce=[],Xe=0,xe="main",E=null;function Ie(){if(!A){u(tn("editing an element",location),3200);return}Re=!Re,De(),u(Re?"element edit mode on \u2014 right-click a slide element":"element edit mode off",2200)}function qe(g,G){let B=G;for(;B&&B!==g&&B.parentElement!==g;)B=B.parentElement;return B&&B!==g?B:null}r.addEventListener("contextmenu",g=>{if(!Re)return;let G=g.target.closest("section"),B=G?h._sections.indexOf(G)+1:0;if(!G||!B)return;if(g.preventDefault(),G.hasAttribute("data-markdown-removed")){u("this slide has no per-element source mapping (data-markdown, removed in 0.3.0) \u2014 edit the file directly",3400);return}let X=qe(G,g.target),Y=X?[...G.children].indexOf(X):null;k?.(),U(g.clientX,g.clientY,{sec:G,slide:B,index:Y})});function De(){be?.remove(),be=null,xe="main"}function F(){let g=be.querySelector(".cm-list");g.textContent="";let G=[];if(xe==="effects"){G.push({label:"\u2190 back",back:!0,run:()=>{xe="main",F()}});for(let B of $e)G.push({label:B,run:()=>Ee(B)});G.push({label:"none (instant)",run:()=>Ee("none")}),G.push({label:"remove effect",run:()=>Ee(null)})}else E.index===null?G.push({label:"Edit speaker notes",run:()=>{De(),Te()}}):(G.push({label:"Edit speaker notes",run:()=>{De(),Te()}}),G.push({label:"Remove element",run:fe}),G.push({label:"Edit content (HTML)",run:()=>{De(),s(E)}}),G.push({label:"Add text effect \u25B8",run:()=>{xe="effects",F()}}));Ce=G,G.forEach((B,X)=>{let Y=document.createElement("div");Y.className="cm-row"+(B.back?" cm-back":""),Y.setAttribute("role","option"),Y.textContent=B.label,Y.addEventListener("mouseenter",()=>J(X,!1)),Y.addEventListener("click",B.run),g.appendChild(Y)}),J(0,!1)}function J(g,G){let B=be.querySelectorAll(".cm-row");B.length&&(Xe=jt(B,g,"cm-selected",{scroll:G}))}function U(g,G,B){E=B,xe="main",be=document.createElement("div"),be.className="decklight-ctxmenu";let X=document.createElement("div");X.className="cm-card";let Y=document.createElement("div");Y.className="cm-list",Y.setAttribute("role","listbox"),Y.setAttribute("aria-label","Element edit menu"),X.appendChild(Y),be.appendChild(X),r.appendChild(be),F();let ge=r.getBoundingClientRect(),V=Math.min(g-ge.left,ge.width-X.offsetWidth-4),ne=Math.min(G-ge.top,ge.height-X.offsetHeight-4);X.style.left=Math.max(4,V)+"px",X.style.top=Math.max(4,ne)+"px",kt(be,De)}async function fe(){let{slide:g,index:G}=E;De();try{let B=await fetch(I+"/edit/element/remove",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:g,index:G})}),X=await B.json().catch(()=>({}));if(!B.ok)throw new Error(X.error||B.status);u(X.changed?"element removed \u2014 reloading":"nothing to remove")}catch(B){u(`remove failed: ${String(B.message||B).slice(0,60)}`,2200)}}async function Ee(g){let{slide:G,index:B}=E;De();try{let X=await fetch(I+"/edit/element/effect",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:G,index:B,effect:g})}),Y=await X.json().catch(()=>({}));if(!X.ok)throw new Error(Y.error||X.status);u(g===null?"effect removed \u2014 reloading":`effect: ${g} \u2014 reloading`)}catch(X){u(`effect save failed: ${String(X.message||X).slice(0,60)}`,2200)}}let ze=null;function Ne(){ze?.remove(),ze=null}function s({slide:g,index:G}){ze=document.createElement("div"),ze.className="decklight-narr decklight-editor";let B=document.createElement("div");B.className="narr-card";let X=document.createElement("div");X.className="narr-head",X.textContent=`edit content \u2014 slide ${g}, element ${G} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let Y=document.createElement("textarea");Y.className="narr-input edit-notes",Y.value="loading\u2026",Y.disabled=!0,Y.spellcheck=!1;let ge=async()=>{try{let Fe=await fetch(I+"/edit/element/content",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:g,index:G,html:Y.value})});if(!Fe.ok)throw new Error(await Fe.text());u("element content saved \u2014 reloading")}catch(Fe){u(`save failed: ${String(Fe.message||Fe).slice(0,60)}`)}};Y.addEventListener("keydown",Fe=>{Fe.key==="Enter"&&(Fe.metaKey||Fe.ctrlKey)?(ge(),Fe.preventDefault()):Fe.key==="Escape"&&(Ne(),Fe.preventDefault()),Fe.stopPropagation()});let V=document.createElement("div");V.className="tr-actions";let ne=document.createElement("button");ne.type="button",ne.className="narr-prev-btn",ne.textContent="\u{1F4BE} save to file",ne.addEventListener("click",ge),V.appendChild(ne),B.append(X,Y,V),ze.appendChild(B),kt(ze,Ne),r.appendChild(ze),(async()=>{try{let Fe=await fetch(`${I}/edit/element/source?slide=${g}&index=${G}`),Je=await Fe.json().catch(()=>({}));if(!Fe.ok||!Je.ok)throw new Error(Je.error||Fe.status);Y.value=Je.html,Y.disabled=!1,Y.focus()}catch(Fe){Y.value="",u(`could not read the element's source: ${String(Fe.message||Fe).slice(0,60)}`,2600)}})()}f.register({isOpen:()=>!!be,close:De,keydown(g){switch(g.key){case"ArrowDown":J(Xe+1,!0);break;case"ArrowUp":J(Xe-1,!0);break;case"Enter":Ce[Xe]?.run();break;case"Escape":De();break;default:return!1}return!0}}),f.register({isOpen:()=>!!ze,close:Ne,keydown:g=>g.key==="Escape"&&(Ne(),!0)});let o=null,O=[],Be=0,P=null;function Ue(g,G){G&&(g.src=`${I}/edit/at?ref=${encodeURIComponent(G.hash)}&embedded`)}function nt(g,G){let B=[...o.querySelectorAll(".tp-row")];if(!B.length)return;Be=jt(B,g,"tp-selected");let X=O[Be];o.querySelector(".tp-caption").textContent=X?`${X.hash} \xB7 ${X.when} \xB7 ${X.subject}`:"";let Y=o.querySelector("iframe");clearTimeout(P),G?Ue(Y,X):P=setTimeout(()=>Ue(Y,X),60)}async function W(){if(o)return Ae();if(!A)return u(tn("restoring a version",location),3200);let g=[];try{let X=await(await fetch(I+"/edit/history")).json();if(!X.ok)return u(`restore: ${X.error}`,3e3);g=X.entries||[]}catch{return u("restore: could not read the deck history",3e3)}if(!g.length)return u("restore: git has no record of this deck yet",3e3);k(),O=g,o=document.createElement("div"),o.className="decklight-theme-picker decklight-finder decklight-restore",o.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter">Restore a version \u2014 \u2191\u2193 to browse, \u23CE to restore</div><div class="tp-list" role="listbox" aria-label="Deck history"></div></div><div class="tp-preview"><iframe title="Version preview"></iframe><div class="tp-caption"></div></div></div>';let G=o.querySelector(".tp-list");O.forEach((B,X)=>{let Y=document.createElement("div");Y.className="tp-row",Y.setAttribute("role","option");let ge=document.createElement("span");ge.className="rs-hash",ge.textContent=B.hash;let V=document.createElement("span");V.className="rs-when",V.textContent=B.when,Y.append(ge,` ${B.subject} `,V),Y.addEventListener("click",()=>{nt(X,!0),Q()}),G.appendChild(Y)}),kt(o,Ae),r.appendChild(o),nt(0,!0)}function Ae(){clearTimeout(P),o?.remove(),o=null}async function Q(){let g=O[Be];if(g){Ae();try{let B=await(await fetch(I+"/edit/restore",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:g.hash})})).json();if(!B.ok)return u(`restore failed: ${B.error}`,3e3);if(!B.changed)return u(`already at ${g.hash}`,2e3);u(`restored ${g.hash} \u2014 Z takes it back`,2600)}catch{u("restore failed: the edit server did not answer",3e3)}}}f.register({isOpen:()=>!!me,close:Te,keydown:g=>g.key==="Escape"&&(Te(),!0)}),f.register({isOpen:()=>!!de,close:j,keydown:g=>g.key==="Escape"&&(j(),!0)}),f.register({isOpen:()=>!!o,close:Ae,keydown(g){switch(g.key){case"ArrowDown":nt(Be+1,!1);break;case"ArrowUp":nt(Be-1,!1);break;case"Enter":Q();break;case"Escape":Ae();break;default:return!1}return!0}});let ye=null;function x(){ye?.remove(),ye=null}async function we(g){if(ye){x();return}if(!A){u(tn("configuring an engine",location),3200);return}let G,B;try{let _e=await fetch(`${I}/edit/wizard?engine=${encodeURIComponent(g)}`),Le=await _e.json().catch(()=>({}));if(!_e.ok||!Le?.schema){u(Le.error||`no wizard for ${g}`,3200);return}if(typeof Le.from!="string"||!Le.from||typeof Le.provenance?.askedBy!="string"||typeof Le.provenance?.sentTo!="string"){u("the server did not say who is asking for these answers \u2014 not prompting",3200);return}G=Le.schema,B=Le.provenance}catch{u("the author server did not answer",2600);return}k?.(),ye=document.createElement("div"),ye.className="decklight-narr decklight-editor";let X=document.createElement("div");X.className="narr-card";let Y=document.createElement("div");Y.className="narr-head",Y.textContent=`${G.title} \u2014 \u2318\u23CE saves \xB7 Esc closes`;let ge=document.createElement("div");ge.className="wiz-src";let V=document.createElement("div");V.textContent=B.askedBy;let ne=document.createElement("div");ne.textContent=B.sentTo,ge.append(V,ne),X.append(Y,ge);let Fe=new Map;for(let _e of G.fields){let Le=document.createElement("label");Le.className="tr-actions";let Qe=document.createElement("span");Qe.textContent=_e.required?`${_e.label} *`:_e.label;let Oe;if(_e.type==="choice"){Oe=document.createElement("select");for(let Ye of _e.options){let ct=document.createElement("option");ct.value=Ye,ct.textContent=Ye,Oe.append(ct)}_e.default&&(Oe.value=_e.default)}else _e.type==="boolean"?(Oe=document.createElement("input"),Oe.type="checkbox",Oe.checked=_e.default===!0):(Oe=document.createElement("input"),Oe.type=_e.type==="secret"?"password":"text",Oe.autocomplete=_e.type==="secret"?"off":"on",Oe.spellcheck=!1,_e.default!==void 0&&(Oe.value=String(_e.default)));Oe.className="narr-input",Fe.set(_e.name,{field:_e,input:Oe}),Le.append(Qe,Oe),X.append(Le)}let Je=document.createElement("div");Je.className="narr-head";let re=document.createElement("button");re.className="narr-prev-btn",re.textContent="save";let ke=document.createElement("div");ke.className="tr-actions",ke.append(re),X.append(ke,Je),ye.append(X),r.append(ye),Fe.values().next().value?.input.focus();async function He(){let _e={};for(let[Le,{field:Qe,input:Oe}]of Fe){let Ye=Qe.type==="boolean"?Oe.checked:Oe.value;Ye!==""&&Ye!==void 0&&(_e[Le]=Ye)}re.disabled=!0,Je.textContent="checking\u2026";try{let Le=await fetch(`${I}/edit/wizard`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:G.engine,answers:_e})}),Qe=await Le.json().catch(()=>({}));if(!Le.ok){Je.textContent=Qe.state==="unreachable"?`could not reach it \u2014 ${Qe.error??"try again"}`:Qe.state==="prerequisite"?`not ready on this machine \u2014 ${Qe.error??"something it needs is missing"}`:`not accepted \u2014 ${Qe.error??"check the answers"}`,re.disabled=!1;return}m("wizard",`${G.engine} configured: ${JSON.stringify(Qe.stored)}`),x(),u(`${G.title} configured`,2200)}catch(Le){Je.textContent=`could not reach the author server \u2014 ${String(Le.message||Le).slice(0,50)}`,re.disabled=!1}}re.addEventListener("click",He),ye.addEventListener("keydown",_e=>{_e.key==="Enter"&&(_e.metaKey||_e.ctrlKey)&&(_e.preventDefault(),He())})}return f.register({isOpen:()=>!!ye,close:x,keydown:g=>g.key==="Escape"&&(x(),!0)}),{deckHistory:oe,toggleEditor:Te,toggleAgentAsk:j,toggleElementEdit:Ie,elementEditOn:()=>Re,wizard:we,wizards:()=>$.slice(),restore:{open:W,close:Ae,list:()=>O.slice()},available:()=>A,base:()=>I}}ae();le();var jn=[{id:"palette",text:"press / for the command palette \u2014 every command, type to filter"},{id:"help",text:"press ? for the keyboard shortcuts"},{id:"goto",text:"press G to jump to any slide by name"},{id:"theme",text:"press T to browse themes \u2014 the deck restyles live"},{id:"overview",text:"press O for the slide overview grid"},{id:"speaker",text:"press S for speaker view \u2014 notes, next slide and a timer"},{id:"narrate",text:"press V to have the deck narrate itself from its speaker notes"},{id:"messages",text:"press ` (left of 1) for the message log \u2014 every message the deck has shown"},{id:"fullscreen",text:"press F for fullscreen, B to black out the screen mid-talk"},{id:"author",text:"author mode (decklight author <deck.html>) turns this player into an editor \u2014 A asks an AI agent"}],Ai="decklight-onboarded",es="decklight-tips-seen",_i="decklight-tips-off";function ts(r){try{return localStorage.getItem(r)}catch{return null}}function yr(r,a){try{localStorage.setItem(r,a)}catch{}}function Ti({root:r,printMode:a,params:l,toast:d,debugLog:u,overlays:m,deck:f}){let h=l.has("embedded"),w=a||h,k=null;function A(){k&&(k.remove(),k=null,yr(Ai,"1"),u?.("nav","welcome dismissed"))}function I(){k||a||(k=document.createElement("div"),k.className="decklight-welcome",k.innerHTML=`<div class="wel-card">
297
+ `),se.spellcheck=!1;let $e=async()=>{try{let $=await fetch(P+"/edit/notes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:R,text:se.value})});if(!$.ok)throw new Error(await $.text());m("edit",`notes saved \u2014 slide ${R}`),u("notes saved \u2014 reloading")}catch($){u(`save failed: ${String($.message||$).slice(0,60)}`)}};se.addEventListener("keydown",$=>{$.key==="Enter"&&($.metaKey||$.ctrlKey)?($e(),$.preventDefault()):$.key==="Escape"&&(D(),$.preventDefault()),$.stopPropagation()});let S=document.createElement("div");S.className="tr-actions";let L=document.createElement("button");L.type="button",L.className="narr-prev-btn",L.textContent="\u{1F4BE} save to file",L.addEventListener("click",$e),S.appendChild(L),W.append(U,se,S),O.appendChild(W),It(O,D),r.appendChild(O),setTimeout(()=>se.focus(),0)}let V=["fade","fade-up","fade-down","zoom","pop","draw","highlight"],re=!1,Ae=null,Ke=[],Ce=0,s="main",o=null;function N(){if(!A){u(fn("editing an element",location),3200);return}re=!re,B(),u(re?"element edit mode on \u2014 right-click a slide element":"element edit mode off",2200)}function Fe(R,W){let U=W;for(;U&&U!==R&&U.parentElement!==R;)U=U.parentElement;return U&&U!==R?U:null}r.addEventListener("contextmenu",R=>{if(!re)return;let W=R.target.closest("section"),U=W?h._sections.indexOf(W)+1:0;if(!W||!U)return;if(R.preventDefault(),W.hasAttribute("data-markdown-removed")){u("this slide has no per-element source mapping (data-markdown, removed in 0.3.0) \u2014 edit the file directly",3400);return}let se=Fe(W,R.target),$e=se?[...W.children].indexOf(se):null;k?.(),K(R.clientX,R.clientY,{sec:W,slide:U,index:$e})});function B(){Ae?.remove(),Ae=null,s="main"}function ot(){let R=Ae.querySelector(".cm-list");R.textContent="";let W=[];if(s==="effects"){W.push({label:"\u2190 back",back:!0,run:()=>{s="main",ot()}});for(let U of V)W.push({label:U,run:()=>Y(U)});W.push({label:"none (instant)",run:()=>Y("none")}),W.push({label:"remove effect",run:()=>Y(null)})}else o.index===null?W.push({label:"Edit speaker notes",run:()=>{B(),D()}}):(W.push({label:"Edit speaker notes",run:()=>{B(),D()}}),W.push({label:"Remove element",run:_e}),W.push({label:"Edit content (HTML)",run:()=>{B(),Be(o)}}),W.push({label:"Add text effect \u25B8",run:()=>{s="effects",ot()}}));Ke=W,W.forEach((U,se)=>{let $e=document.createElement("div");$e.className="cm-row"+(U.back?" cm-back":""),$e.setAttribute("role","option"),$e.textContent=U.label,$e.addEventListener("mouseenter",()=>mt(se,!1)),$e.addEventListener("click",U.run),R.appendChild($e)}),mt(0,!1)}function mt(R,W){let U=Ae.querySelectorAll(".cm-row");U.length&&(Ce=on(U,R,"cm-selected",{scroll:W}))}function K(R,W,U){o=U,s="main",Ae=document.createElement("div"),Ae.className="decklight-ctxmenu";let se=document.createElement("div");se.className="cm-card";let $e=document.createElement("div");$e.className="cm-list",$e.setAttribute("role","listbox"),$e.setAttribute("aria-label","Element edit menu"),se.appendChild($e),Ae.appendChild(se),r.appendChild(Ae),ot();let S=r.getBoundingClientRect(),L=Math.min(R-S.left,S.width-se.offsetWidth-4),$=Math.min(W-S.top,S.height-se.offsetHeight-4);se.style.left=Math.max(4,L)+"px",se.style.top=Math.max(4,$)+"px",It(Ae,B)}async function _e(){let{slide:R,index:W}=o;B();try{let U=await fetch(P+"/edit/element/remove",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:R,index:W})}),se=await U.json().catch(()=>({}));if(!U.ok)throw new Error(se.error||U.status);u(se.changed?"element removed \u2014 reloading":"nothing to remove")}catch(U){u(`remove failed: ${String(U.message||U).slice(0,60)}`,2200)}}async function Y(R){let{slide:W,index:U}=o;B();try{let se=await fetch(P+"/edit/element/effect",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:W,index:U,effect:R})}),$e=await se.json().catch(()=>({}));if(!se.ok)throw new Error($e.error||se.status);u(R===null?"effect removed \u2014 reloading":`effect: ${R} \u2014 reloading`)}catch(se){u(`effect save failed: ${String(se.message||se).slice(0,60)}`,2200)}}let Re=null;function y(){Re?.remove(),Re=null}function Be({slide:R,index:W}){Re=document.createElement("div"),Re.className="decklight-narr decklight-editor";let U=document.createElement("div");U.className="narr-card";let se=document.createElement("div");se.className="narr-head",se.textContent=`edit content \u2014 slide ${R}, element ${W} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let $e=document.createElement("div");$e.className="edit-code";let S=document.createElement("pre");S.setAttribute("aria-hidden","true");let L=document.createElement("code");L.className="hljs language-xml",S.appendChild(L);let $=document.createElement("textarea");$.className="narr-input edit-notes",$.value="loading\u2026",$.disabled=!0,$.spellcheck=!1,$e.append(S,$);let Z=()=>{L.innerHTML=Nt.highlight(`${$.value}
298
+ `,{language:"xml"}).value};$.addEventListener("input",Z),$.addEventListener("scroll",()=>{S.scrollTop=$.scrollTop,S.scrollLeft=$.scrollLeft});let te=async()=>{try{let Pe=await fetch(P+"/edit/element/content",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:R,index:W,html:$.value})});if(!Pe.ok)throw new Error(await Pe.text());u("element content saved \u2014 reloading")}catch(Pe){u(`save failed: ${String(Pe.message||Pe).slice(0,60)}`)}};$.addEventListener("keydown",Pe=>{Pe.key==="Enter"&&(Pe.metaKey||Pe.ctrlKey)?(te(),Pe.preventDefault()):Pe.key==="Escape"&&(y(),Pe.preventDefault()),Pe.stopPropagation()});let fe=document.createElement("div");fe.className="tr-actions";let Qe=document.createElement("button");Qe.type="button",Qe.className="narr-prev-btn",Qe.textContent="\u{1F4BE} save to file",Qe.addEventListener("click",te),fe.appendChild(Qe),U.append(se,$e,fe),Re.appendChild(U),It(Re,y),r.appendChild(Re),(async()=>{try{let Pe=await fetch(`${P}/edit/element/source?slide=${R}&index=${W}`),Ye=await Pe.json().catch(()=>({}));if(!Pe.ok||!Ye.ok)throw new Error(Ye.error||Pe.status);$.value=Oi(Ye.html),$.disabled=!1,Z(),$.focus()}catch(Pe){$.value="",u(`could not read the element's source: ${String(Pe.message||Pe).slice(0,60)}`,2600)}})()}f.register({isOpen:()=>!!Ae,close:B,keydown(R){switch(R.key){case"ArrowDown":mt(Ce+1,!0);break;case"ArrowUp":mt(Ce-1,!0);break;case"Enter":Ke[Ce]?.run();break;case"Escape":B();break;default:return!1}return!0}}),f.register({isOpen:()=>!!Re,close:y,keydown:R=>R.key==="Escape"&&(y(),!0)});let w=null,pe=[],Se=0,it=null,Ee=1,ze=!1,oe=null,Xe=!1,gt={first:'<path d="M17 6l-6 6 6 6"/><path d="M7 6v12"/>',prev:'<path d="M15 6l-6 6 6 6"/>',next:'<path d="M9 6l6 6-6 6"/>',last:'<path d="M7 6l6 6-6 6"/><path d="M17 6v12"/>'},Et={first:"first slide (Home)",prev:"previous slide (\u2190)",next:"next slide (\u2192)",last:"last slide (End)"},me=R=>`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${R}</svg>`,Ne=()=>Number(pe[Se]?.slides)||0;function Ie(R){let W=Ne();Ee=Math.max(1,W?Math.min(R,W):R);let U=w?.querySelector("iframe");ze?U?.contentWindow?.postMessage({__decklightPreview:{goto:[Ee,0]}},"*"):oe=Ee,et()}function et(){let R=w?.querySelector(".hs-nav");if(!R)return;let W=Ne();R.querySelector(".hs-pos").textContent=W?`${Ee} / ${W}`:`${Ee}`;for(let U of R.querySelectorAll(".hs-btn")){let se=U.dataset.go;U.disabled=Ee<=1&&(se==="first"||se==="prev")||!!W&&Ee>=W&&(se==="next"||se==="last")}}function tt(R){return Ie(R==="first"?1:R==="prev"?Ee-1:R==="next"?Ee+1:Ne()||Ee+1)}function bt(R,W){W&&(ze=!1,oe=null,Ee=1,R.addEventListener("load",()=>{if(ze=!0,oe!=null){let U=oe;oe=null,Ie(U)}},{once:!0}),R.src=`${P}/edit/at?ref=${encodeURIComponent(W.hash)}&embedded`,et())}function He(R,W){let U=[...w.querySelectorAll(".tp-row")];if(!U.length)return;Zt(),Se=on(U,R,"tp-selected");let se=pe[Se];w.querySelector(".tp-caption").textContent=se?`${se.hash} \xB7 ${se.when} \xB7 ${se.subject}${ft(se)}`:"";let $e=w.querySelector("iframe");clearTimeout(it),W?bt($e,se):it=setTimeout(()=>bt($e,se),60)}function ft(R){let W=[];Number.isFinite(R.slides)&&W.push(`${R.slides} slide${R.slides===1?"":"s"}`);let U=[R.add?`+${R.add}`:"",R.del?`\u2212${R.del}`:""].filter(Boolean);return U.length&&W.push(`${U.join(" ")} lines`),W.length?` \xB7 ${W.join(" \xB7 ")}`:""}async function Dt(){if(w)return Ot();if(!A)return u(`the progress bar moved to J \u2014 ${fn("history",location)}`,3800);let R="history",W=[],U=null;try{let L=await(await fetch(P+"/edit/history")).json();if(!L.ok)return u(`${R}: ${L.error}`,3e3);W=L.entries||[],U=L.remote||null}catch{return u(`${R}: could not read the deck history`,3e3)}if(!W.length)return u(`${R}: git has no record of this deck yet`,3e3);k(),pe=W,Xe=!1,w=document.createElement("div"),w.className="decklight-theme-picker decklight-finder decklight-restore decklight-history",w.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="hs-remote"></div><div class="tp-list" role="listbox" aria-label="Deck history"></div><div class="hs-confirm" hidden></div></div><div class="tp-preview"><iframe title="Version preview"></iframe><div class="hs-nav" role="group" aria-label="Preview navigation">'+["first","prev"].map(S=>Kt(S)).join("")+'<span class="hs-pos" aria-live="polite"></span>'+["next","last"].map(S=>Kt(S)).join("")+'</div><div class="tp-caption"></div></div></div>',w.querySelector(".tp-filter").textContent="History \u2014 \u2191\u2193 browse \xB7 \u2190\u2192 preview \xB7 \u23CE restore";let se=w.querySelector(".hs-remote");U?.line?se.textContent=U.line:se.remove();for(let S of w.querySelectorAll(".hs-btn"))S.addEventListener("click",()=>tt(S.dataset.go));let $e=w.querySelector(".tp-list");pe.forEach((S,L)=>{let $=document.createElement("div");$.className="tp-row",$.setAttribute("role","option");let Z=document.createElement("span");Z.className="rs-subject",Z.textContent=S.subject;let te=document.createElement("span");te.className="hs-meta";let fe=document.createElement("span");if(fe.className="rs-hash",fe.textContent=S.hash,te.append(fe,Vt(S)),S.pushed===!1){let Pe=document.createElement("span");Pe.className="hs-push",Pe.title="only on this machine",Pe.textContent="\u2191",te.append(Pe)}let Qe=document.createElement("span");Qe.className="rs-when",Qe.title=S.when,Qe.textContent=Ci(S.when),te.append(Qe),$.append(Z,te),$.addEventListener("click",()=>{He(L,!0),Q()}),$e.appendChild($)}),It(w,Ot),r.appendChild(w),He(0,!0)}function Kt(R){return`<button type="button" class="hs-btn" data-go="${R}" title="${Et[R]}" aria-label="${Et[R]}">${me(gt[R])}</button>`}function Vt(R){let W=document.createElement("span");if(W.className="hs-stat",Number.isFinite(R.slides)){let U=document.createElement("span");U.className="hs-slides",U.title=`${R.slides} slide${R.slides===1?"":"s"} in this version`,U.textContent=String(R.slides),W.append(U)}if(R.add){let U=document.createElement("span");U.className="hs-add",U.title=`${R.add} line${R.add===1?"":"s"} added`,U.textContent=`+${R.add}`,W.append(U)}if(R.del){let U=document.createElement("span");U.className="hs-del",U.title=`${R.del} line${R.del===1?"":"s"} removed`,U.textContent=`\u2212${R.del}`,W.append(U)}return W}function Ot(){clearTimeout(it),w?.remove(),w=null,Xe=!1,ze=!1,oe=null}function Q(){let R=pe[Se];if(!R)return;Xe=!0;let W=w.querySelector(".hs-confirm");W.hidden=!1,W.textContent="";let U=document.createElement("div");U.className="hs-q",U.append("restore ",Object.assign(document.createElement("span"),{className:"hs-q-hash",textContent:R.hash}),Object.assign(document.createElement("span"),{className:"hs-q-sub",textContent:` ${R.subject}`}),"?");let se=document.createElement("div");se.className="hs-why",se.textContent=`${Number.isFinite(R.slides)?`${R.slides} slides. `:""}Written as a NEW commit \u2014 nothing is rewritten, and where you are now stays in this list.`;let $e=document.createElement("div");$e.className="hs-buttons";let S=document.createElement("button");S.type="button",S.className="hs-yes",S.textContent="restore this version",S.addEventListener("click",_t);let L=document.createElement("button");L.type="button",L.className="hs-no",L.textContent="cancel",L.addEventListener("click",Zt),$e.append(S,L);let $=document.createElement("div");$.className="hs-keys",$.textContent="\u23CE confirms \xB7 Esc cancels",W.append(U,se,$e,$)}function Zt(){Xe=!1;let R=w?.querySelector(".hs-confirm");R&&(R.hidden=!0,R.textContent="")}async function _t(){let R=pe[Se];if(!(!R||!Xe)){Ot();try{let U=await(await fetch(P+"/edit/restore",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:R.hash})})).json();if(!U.ok)return u(`restore failed: ${U.error}`,3e3);if(!U.changed)return u(`already at ${R.hash}`,2e3);u(`restored ${R.hash} \u2014 Z takes it back`,2600)}catch{u("restore failed: the edit server did not answer",3e3)}}}f.register({isOpen:()=>!!O,close:D,keydown:R=>R.key==="Escape"&&(D(),!0)}),f.register({isOpen:()=>!!Je,close:je,keydown:R=>R.key==="Escape"&&(je(),!0)}),f.register({isOpen:()=>!!w,close:Ot,keydown(R){switch(R.key){case"ArrowDown":He(Se+1,!1);break;case"ArrowUp":He(Se-1,!1);break;case"ArrowLeft":tt("prev");break;case"ArrowRight":tt("next");break;case"Home":tt("first");break;case"End":tt("last");break;case"Enter":Xe?_t():Q();break;case"Escape":Xe?Zt():Ot();break;default:return!1}return!0}});let vt=null;function Wt(){vt?.remove(),vt=null}async function Ht(R){if(vt){Wt();return}if(!A){u(fn("configuring an engine",location),3200);return}let W,U;try{let Ye=await fetch(`${P}/edit/wizard?engine=${encodeURIComponent(R)}`),ut=await Ye.json().catch(()=>({}));if(!Ye.ok||!ut?.schema){u(ut.error||`no wizard for ${R}`,3200);return}if(typeof ut.from!="string"||!ut.from||typeof ut.provenance?.askedBy!="string"||typeof ut.provenance?.sentTo!="string"){u("the server did not say who is asking for these answers \u2014 not prompting",3200);return}W=ut.schema,U=ut.provenance}catch{u("the author server did not answer",2600);return}k?.(),vt=document.createElement("div"),vt.className="decklight-narr decklight-editor";let se=document.createElement("div");se.className="narr-card";let $e=document.createElement("div");$e.className="narr-head",$e.textContent=`${W.title} \u2014 \u2318\u23CE saves \xB7 Esc closes`;let S=document.createElement("div");S.className="wiz-src";let L=document.createElement("div");L.textContent=U.askedBy;let $=document.createElement("div");$.textContent=U.sentTo,S.append(L,$),se.append($e,S);let Z=new Map;for(let Ye of W.fields){let ut=document.createElement("label");ut.className="tr-actions";let dt=document.createElement("span");dt.textContent=Ye.required?`${Ye.label} *`:Ye.label;let pt;if(Ye.type==="choice"){pt=document.createElement("select");for(let xt of Ye.options){let ht=document.createElement("option");ht.value=xt,ht.textContent=xt,pt.append(ht)}Ye.default&&(pt.value=Ye.default)}else Ye.type==="boolean"?(pt=document.createElement("input"),pt.type="checkbox",pt.checked=Ye.default===!0):(pt=document.createElement("input"),pt.type=Ye.type==="secret"?"password":"text",pt.autocomplete=Ye.type==="secret"?"off":"on",pt.spellcheck=!1,Ye.default!==void 0&&(pt.value=String(Ye.default)));pt.className="narr-input",Z.set(Ye.name,{field:Ye,input:pt}),ut.append(dt,pt),se.append(ut)}let te=document.createElement("div");te.className="narr-head";let fe=document.createElement("button");fe.className="narr-prev-btn",fe.textContent="save";let Qe=document.createElement("div");Qe.className="tr-actions",Qe.append(fe),se.append(Qe,te),vt.append(se),r.append(vt),Z.values().next().value?.input.focus();async function Pe(){let Ye={};for(let[ut,{field:dt,input:pt}]of Z){let xt=dt.type==="boolean"?pt.checked:pt.value;xt!==""&&xt!==void 0&&(Ye[ut]=xt)}fe.disabled=!0,te.textContent="checking\u2026";try{let ut=await fetch(`${P}/edit/wizard`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:W.engine,answers:Ye})}),dt=await ut.json().catch(()=>({}));if(!ut.ok){te.textContent=dt.state==="unreachable"?`could not reach it \u2014 ${dt.error??"try again"}`:dt.state==="prerequisite"?`not ready on this machine \u2014 ${dt.error??"something it needs is missing"}`:`not accepted \u2014 ${dt.error??"check the answers"}`,fe.disabled=!1;return}m("wizard",`${W.engine} configured: ${JSON.stringify(dt.stored)}`),Wt(),u(`${W.title} configured`,2200)}catch(ut){te.textContent=`could not reach the author server \u2014 ${String(ut.message||ut).slice(0,50)}`,fe.disabled=!1}}fe.addEventListener("click",Pe),vt.addEventListener("keydown",Ye=>{Ye.key==="Enter"&&(Ye.metaKey||Ye.ctrlKey)&&(Ye.preventDefault(),Pe())})}return f.register({isOpen:()=>!!vt,close:Wt,keydown:R=>R.key==="Escape"&&(Wt(),!0)}),{deckHistory:qe,toggleEditor:D,toggleAgentAsk:je,toggleElementEdit:N,elementEditOn:()=>re,wizard:Ht,wizards:()=>C.slice(),history:{open:()=>!A&&Oe?at():Dt(),close:()=>{Ot(),De()},list:()=>pe.slice()},restore:{open:Dt,close:Ot,list:()=>pe.slice()},available:()=>A,base:()=>P}}le();ce();var rr=[{id:"palette",text:"press / for the command palette \u2014 every command, type to filter"},{id:"help",text:"press ? for the keyboard shortcuts"},{id:"goto",text:"press G to jump to any slide by name"},{id:"theme",text:"press T to browse themes \u2014 the deck restyles live"},{id:"overview",text:"press O for the slide overview grid"},{id:"speaker",text:"press S for speaker view \u2014 notes, next slide and a timer"},{id:"narrate",text:"press V to have the deck narrate itself from its speaker notes"},{id:"messages",text:"press ` (left of 1) for the message log \u2014 every message the deck has shown"},{id:"fullscreen",text:"press F for fullscreen, B to black out the screen mid-talk"},{id:"author",text:"author mode (decklight author <deck.html>) turns this player into an editor \u2014 A asks an AI agent"}],Li="decklight-onboarded",ls="decklight-tips-seen",Ri="decklight-tips-off";function cs(r){try{return localStorage.getItem(r)}catch{return null}}function Cr(r,i){try{localStorage.setItem(r,i)}catch{}}function Ii({root:r,printMode:i,params:l,toast:d,debugLog:u,overlays:m,deck:f}){let h=l.has("embedded"),b=i||h,k=null;function A(){k&&(k.remove(),k=null,Cr(Li,"1"),u?.("nav","welcome dismissed"))}function P(){k||i||(k=document.createElement("div"),k.className="decklight-welcome",k.innerHTML=`<div class="wel-card">
296
299
  <h3>Welcome to Decklight</h3>
297
300
  <p class="wel-lead">This deck is a single HTML file \u2014 no build step, authored by you or an AI agent, and provable by a headless render.</p>
298
301
  <table>
@@ -306,9 +309,9 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),U===void 0&
306
309
  <span>Press any key to dismiss \u2014 reopen anytime from the <code>/</code> palette.</span>
307
310
  <button type="button" class="wel-go">Got it</button>
308
311
  </div>
309
- </div>`,k.addEventListener("click",j=>{j.stopPropagation(),A()}),kt(k,A),r.appendChild(k),u?.("nav","welcome shown"))}m.register({isOpen:()=>!!k,close:A,keydown:()=>(A(),!0)});function M(){return ts(_i)!=="1"}function C(){try{let j=JSON.parse(ts(es)||"[]");return new Set(Array.isArray(j)?j:[])}catch{return new Set}}function $(){let j=C();return jn.find(me=>!j.has(me.id))||null}function q(){let j=$();if(!j)return null;let me=C();return me.add(j.id),yr(es,JSON.stringify([...me])),d(`tip \xB7 ${j.text}`,5200),j.id}function he(j){yr(_i,j?"0":"1"),d(j?"tips on \u2014 one per deck you open":"tips off")}function oe(){yr(es,"[]"),d(`tips reset \u2014 all ${jn.length} will show again, one per deck`)}function de(j){if(!w&&(f().on("slide",A),f().on("build",A),!(j.slide!==1||j.step!==0))){if(ts(Ai)!=="1"){I();return}M()&&q()}}return{start:de,showWelcome:I,dismissWelcome:A,showTip:q,setTips:he,resetTips:oe,status:()=>({tipsOn:M(),tipsLeft:$()?jn.length-C().size:0})}}ae();le();function Ci({sectionsOf:r,checkOverflow:a,ResizeObs:l=typeof ResizeObserver=="function"?ResizeObserver:null,MutationObs:d=typeof MutationObserver=="function"?MutationObserver:null,schedule:u=m=>setTimeout(m)}){let m=[],f=0;function h(){f||(f=u(()=>{f=0;let M=r();for(let C of m)a(C,M.indexOf(C)+1)})||1)}let w=l?new l(h):null;function k(M){if(w)for(let C of[M,...M.querySelectorAll("*")])C.parentElement?.closest(".terminal")||w.observe(C)}let A=d?new d(M=>{let C=q=>!(q.nodeType===1?q:q.parentElement)?.closest(".terminal"),$=!1;for(let q of M)if(C(q.target)){$=!0;for(let he of q.addedNodes)he.nodeType===1&&he.isConnected&&k(he)}$&&h()}):null,I=M=>{M.target.closest?.(".terminal")||h()};return{watch(M){w?.disconnect(),A?.disconnect();for(let C of m)for(let $ of["load","error"])C.removeEventListener($,I,!0);m=M.filter(Boolean);for(let C of m){k(C),A?.observe(C,{childList:!0,subtree:!0,characterData:!0});for(let $ of["load","error"])C.addEventListener($,I,!0)}h()},get watched(){return m.slice()}}}ae();le();function Ni({config:r,root:a,embedded:l,sectionsOf:d,slideOf:u,navigate:m}){let f=!l&&r.playlist?.modules?.length?r.playlist:null,h=f?f.index??0:0,w=!!a.querySelector("section[data-module]");function k(){let I=[];return(d()||[]).forEach((M,C)=>{M.hasAttribute("data-module")&&I.push({title:M.getAttribute("data-module"),slide:C+1})}),I}function A(I=k()){let M=-1;return I.forEach((C,$)=>{C.slide<=u()&&(M=$)}),M}return{get playlist(){return f},get index(){return h},get hasMarkers(){return w},get any(){return w||!!f},markers:k,currentMarkerIndex:A,gotoModule(I){if(!f)return!1;let M=f.modules[h+I];return M?(m(M.href+(I>0?"#/1/0":"#/999/999")),!0):!1},navigateToModule(I){let M=f?.modules[I];M&&m(M.href+"#/1/0")},title(){if(w){let I=k();return I[A(I)]?.title||""}return f?.modules[h]?.title||""}}}ae();le();function ed(r,a,l){return(r.querySelector("h1, h2, h3")?.textContent||"").replace(/\s+/g," ").trim()||l.slice(0,60)||`slide ${a+1}`}function td(r){return[...r.children].filter(l=>!l.matches("aside, script, style")).map(l=>l.textContent).join(" ").replace(/\s+/g," ").trim()}function $i({sections:r,modules:a=[],skipModule:l=-1}){let d=r.map((m,f)=>{let h=td(m);return{slide:f+1,title:ed(m,f,h),haystack:h.toLowerCase()}}),u=a.map((m,f)=>({module:f,title:m.title,href:m.href,haystack:(m.title||"").toLowerCase()})).filter(m=>m.module!==l);return[...d,...u]}function Oi(r,a){let l=String(a??"").toLowerCase().split(/\s+/).filter(Boolean),d=[],u=[];for(let m of r){let f=m.title.toLowerCase();l.every(h=>f.includes(h))?d.push(m):l.every(h=>m.haystack.includes(h))&&u.push(m)}return[...d,...u]}ae();le();function Mi({now:r=Date.now,keep:a=200}={}){let l=r(),d=[],u=null;function m(f,h){let w={t:((r()-l)/1e3).toFixed(3),kind:f,msg:h};return d.push(w),d.length>a&&d.shift(),u?.(w),w}return{log:m,get entries(){return d.slice()},onEntry(f){u=f}}}ae();le();var nd=["auto","centered","pinned","top","split","split-flip"];function rd({autoPins:r,hasSplitPair:a}){return nd.filter(l=>(l!=="pinned"||!r)&&(l!=="split-flip"||a))}function sd(r,a,l){if(!r.length)return null;let d=Math.max(0,r.indexOf(a));return r[(d+l+r.length)%r.length]}function Li({slideOf:r,sectionAt:a,describe:l,available:d,unavailableMessage:u,apply:m,relayout:f,post:h,toast:w,debugLog:k,schedule:A=setTimeout,cancel:I=clearTimeout,delay:M=600}){let C=null,$=null;function q(){I($);let de=C;C=null,de&&h({slide:de.slide,layout:de.name}).then(()=>k("layout",`slide ${de.slide}: ${de.name} \u2192 saved to file`)).catch(()=>w("layout save failed \u2014 is the dev server still up?",2200))}function he(de=r()){let j=a(de);return j?rd(l(j)):[]}function oe(de){if(!d()){w(u(),3200);return}let j=r(),me=a(j);if(!me)return;let Te=sd(he(j),me.getAttribute("data-layout")||"auto",de);if(!Te)return;m(me,Te),C&&C.slide!==j&&q(),C={slide:j,name:Te},I($),$=A(q,M);let $e=f(me,j);w($e?`layout: ${Te} \u2014 fights this slide's own column flexbox; pick one`:`layout: ${Te}`),k("layout",`slide ${j}: ${Te}`)}return{ring:he,cycle:oe,flush:q}}ae();le();function Ri({commands:r,query:a="",totalSlides:l=0,makeGotoRow:d,makeSearchRow:u}){let m=String(a).toLowerCase(),f=r.filter(w=>!m||(w.label+" "+(w.alias??"")).toLowerCase().includes(m)),h=String(a).trim().match(/^(?:goto\s*)?(\d+)$/i);if(h&&d){let w=Math.max(1,Math.min(parseInt(h[1],10),l));f.unshift(d(w,l))}return m&&!h&&u&&!f.some(w=>w.label.toLowerCase().startsWith(m))&&f.push(u(a)),f}var od={transition:"fade",hash:!0,controls:!0,slideNumber:!1,width:1280,height:720,pinTitles:!0},xr=99,id=18,Ii=6,ad="ul, ol, svg, pre, table, .terminal, img, .columns",Bn=null;function Kn(r,a){Ws(r,a),Bn&&Bn._rescanFor(r)}function ld(r){let a=getComputedStyle(r).position;return a==="absolute"||a==="fixed"}function cd(r){for(let a of r.children)if(!a.matches("aside, script, style, .decklight-hero-logo, .slide-bg")){if(a.matches("h1, h2"))return a;if(!ld(a))return null}return null}function dd(r,a){if(!a||r.getAttribute("data-subtitle")==="none")return null;let l=a.nextElementSibling;return l&&l.matches("p")&&!l.hasAttribute("data-build")?(l.classList.add("subtitle"),l):r.querySelector(":scope > p.subtitle")}function Pi(r){return r.pinTitles===!0?xr:typeof r.pinTitles=="number"&&isFinite(r.pinTitles)?r.pinTitles:null}function Di(r,a){let l=Pi(a),d=r.getAttribute("data-pin");if(d==="none")return null;if(d!==null&&d!==""){let m=parseFloat(d);return isFinite(m)?m:l??xr}return d===""?l??xr:l===null?null:[...r.querySelectorAll(ad)].some(m=>!m.closest("aside")&&!m.closest(".decklight-hero-logo"))?l:null}function wr(r,a){r.forEach(l=>{let d=cd(l),u=l.getAttribute("data-layout"),m;if(u==="pinned"){let k=parseFloat(l.getAttribute("data-pin"));m=isFinite(k)?k:Pi(a)??xr}else u==="centered"||u==="top"?m=null:m=Di(l,a);let f=dd(l,d);if(l.querySelector(":scope > .pin-title")?.classList.remove("pin-title"),l.querySelector(":scope > .pin-subtitle")?.classList.remove("pin-subtitle"),m===null||!d){l.removeAttribute("data-pinned"),l.style.removeProperty("--pin-y"),l.style.removeProperty("--pin-sub-y"),l.style.removeProperty("--pin-space");return}d.classList.add("pin-title"),l.setAttribute("data-pinned",""),l.style.setProperty("--pin-y",m+"px"),l.classList.add("pin-measure");let h=d.offsetHeight||0,w=m+h;f&&(f.classList.add("pin-subtitle"),l.style.setProperty("--pin-sub-y",Math.round(w+Ii)+"px"),w+=Ii+(f.offsetHeight||0)),l.classList.remove("pin-measure"),l.style.setProperty("--pin-space",Math.round(w+id)+"px")})}function qi(r){return[...r.children].filter(a=>!a.matches("h1, h2, .subtitle, aside, script, style, .decklight-hero-logo, .slide-bg"))}function Bi(r){r.forEach((a,l)=>{if(a.querySelectorAll(":scope > .split-columns, :scope > .split-footer").forEach(u=>u.classList.remove("split-columns","split-footer")),!/^split/.test(a.getAttribute("data-layout")||"")){a.removeAttribute("data-split-conflict");return}let d=qi(a);if(ud(a,d,l+1),d.length===1&&d[0].matches("ul, ol")){d[0].classList.add("split-columns");return}for(let u of d.slice(2))u.classList.add("split-footer")})}function ud(r,a,l){let d=a.some(m=>{let f=getComputedStyle(m);return/flex$/.test(f.display)&&f.flexDirection.startsWith("row")}),u=r.hasAttribute("data-split-conflict");r.toggleAttribute("data-split-conflict",d),d&&!u&&console.warn(`Decklight: slide ${l} combines data-layout="split" with its own column flexbox \u2014 two layout systems fight; drop the data-layout or the flex shell (SPEC COMPARISON_SLIDES)`)}function ns(r,a){if(!r)return;let l=[r,...r.querySelectorAll("pre, table, svg, ul, ol, blockquote")].some(u=>u.scrollHeight>u.clientHeight+2&&getComputedStyle(u).overflowY!=="visible"&&!u.closest(".terminal")&&!u.hasAttribute("data-scroll-ok")),d=r.hasAttribute("data-overflow");r.toggleAttribute("data-overflow",l),l&&!d&&console.warn(`Decklight: slide ${a} content overflows and is clipped \u2014 reduce content or font size`)}function pd(r){r.querySelectorAll("section[data-markdown]").forEach((a,l)=>{a.setAttribute("data-markdown-removed","");let d=[...r.children].indexOf(a)+1||l+1;console.warn(`Decklight: slide ${d} uses data-markdown, which was removed in 0.3.0 \u2014 its content is in a <script type="text/template"> the browser will not render. Author the slide in HTML (SPEC DECK_ANATOMY).`)})}function Fi(r={}){let a=new URLSearchParams(location.search),l={...od,...r};a.has("embedded")&&(l.controls=!1);let d=a.has("print"),u=a.get("print")||"",m=Mi(),f=null,h=(y,_)=>m.log(y,_),w=document.querySelector(".decklight");if(!w)throw new Error("Decklight: no .decklight element found");let k=ci(),A=Ni({config:l,root:w,embedded:a.has("embedded"),sectionsOf:()=>te._sections,slideOf:()=>te.state.slide,navigate:y=>{location.href=y}}),I=A.playlist,M=A.index,C=A.hasMarkers,$=y=>A.gotoModule(y),q=y=>A.navigateToModule(y),he=200,oe=4,de=[],j=null,me=null;function Te(){return de}function $e(y){de.push({at:new Date,text:String(y)}),de.length>he&&de.shift(),me&&St()}function Re(y,_=3200){if($e(y),d)return;j||(j=document.createElement("div"),j.className="decklight-messages",w.appendChild(j));let S=document.createElement("div");for(S.className="decklight-toast",S.textContent=y,j.appendChild(S),requestAnimationFrame(()=>S.classList.add("show"));j.children.length>oe;)j.firstChild.remove();setTimeout(()=>{S.classList.remove("show"),setTimeout(()=>S.remove(),260)},_)}let be=Ti({root:w,printMode:d,params:a,toast:Re,debugLog:h,overlays:k,deck:()=>te}),Ce=pi({root:w,config:l,params:a,toast:Re,debugLog:h,overlays:k,deck:()=>te,editmode:()=>xt}),{applyTheme:Xe,currentTheme:xe,cycleTheme:E,cancelCyclePending:Ie,rollTheme:qe,saveGeneratedTheme:De}=Ce,F=null,J=0,U="",fe=[],Ee,ze=!1,Ne=null;function s(){return $i({sections:te._sections,modules:I?.modules??[],skipModule:M})}function o(){let y=F.querySelector(".tp-list");if(fe=Oi(F.__index,U),y.textContent="",fe.forEach((S,R)=>{let Z=document.createElement("div");Z.className="tp-row"+(S.slide===te.state.slide?" tp-current":"")+(S.href?" tp-module":""),Z.textContent=S.href?`\u25B8 ${S.title} \u2014 module`:`${S.slide} \xB7 ${S.title}`,Z.addEventListener("mouseenter",()=>Be(R,!1)),Z.addEventListener("click",()=>{Be(R,!0),Ue()}),y.appendChild(Z)}),!fe.length){let S=document.createElement("div");S.className="tp-none",S.textContent="no matches",y.appendChild(S)}let _=F.querySelector(".tp-filter");_.textContent=U||(I?"type to find a slide or module\u2026":"type to find a slide\u2026"),_.classList.toggle("tp-active",!!U)}function O(y,_){let S=_.href??location.pathname,R=_.slide??1;if(y.dataset.doc!==S){y.dataset.doc=S,ze=!1,y.addEventListener("load",()=>{if(ze=!0,Ne&&F){let Z=Ne;Ne=null,O(y,Z)}},{once:!0}),y.src=S+Ce.previewQuery()+"#/"+R+"/0";return}if(!ze){Ne=_;return}y.contentWindow?.postMessage({__decklightPreview:{goto:[R,0]}},"*")}function Be(y,_){if(!fe.length)return;J=jt(F.querySelectorAll(".tp-row"),y,"tp-selected");let S=fe[J];F.querySelector(".tp-caption").textContent=S.href?`module \u2014 ${S.title} (${S.href})`:`slide ${S.slide} \u2014 ${S.title}`,clearTimeout(Ee);let R=F.querySelector("iframe");_?O(R,S):Ee=setTimeout(()=>O(R,S),60)}function P(y){U=y,o(),fe.length?Be(0,!1):F.querySelector(".tp-caption").textContent="no match"}function Ue(){let y=fe[J];if(W(),!!y){if(y.href)return q(y.module);te.goto(y.slide,0)}}function nt(){if(F)return W();Ce.closePicker(),xt.restore.close(),U="",F=document.createElement("div"),F.className="decklight-theme-picker decklight-finder",F.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Slides"></div></div><div class="tp-preview"><iframe title="Slide preview"></iframe><div class="tp-caption"></div></div></div>',F.__index=s(),o(),kt(F,W),w.appendChild(F),Be(Math.max(0,fe.findIndex(y=>y.slide===te.state.slide)),!0)}function W(){clearTimeout(Ee),F?.remove(),F=null}let Ae=null,Q=0,ye="",x=[];function we(){let y=S=>typeof S=="function";return[{label:"Find slide\u2026",hint:"G",alias:"search grep goto module chapter jump",run:()=>{nt(),ye&&P(ye)}},{label:"Restore a version\u2026",hint:"R",alias:"history git rollback undo revert commit",run:()=>xt.restore.open()},{label:"Go to slide\u2026",hint:"#",alias:"goto",keepOpen:!0,run:()=>{ye="goto ",g()}},{label:"Theme\u2026",hint:"T",run:Ce.openPicker},{label:"Cycle theme",hint:", \xB7 .",run:()=>E(1)},{label:"Generate a theme",hint:"\u2303T",run:qe},Ce.hasGenerated()&&{label:"Save the generated theme\u2026",hint:"\u2303\u21E7T",run:()=>De()},xt.available()&&{label:"Browse marketplace themes\u2026",alias:"marketplace install add third-party download catalog",run:Ce.browse},...xt.wizards().map(S=>({label:`Configure ${S.title}\u2026 (dev)`,alias:"engine wizard setup api key credential token marketplace",run:()=>xt.wizard(S.qualified)})),{label:"Font\u2026",hint:"[ \xB7 ]",run:ne},{label:"Cycle slide layout (dev)",hint:"L",alias:"pin pinned centered top auto split columns two sides arrange",run:()=>Pt(1)},{label:"Undo deck edit (dev)",hint:"Z",alias:"revert back history",run:()=>an("undo")},{label:"Redo deck edit (dev)",hint:"\u21E7Z",alias:"forward history repeat",run:()=>an("redo")},{label:"Ask agent\u2026 (dev)",hint:"A",alias:"ai claude codex bob gemini prompt edit",run:bt},{label:"Messages",hint:"`",alias:"log toast notifications warnings why voice stopped history",run:ut},{label:`Narration ${At.status().narrating?"off":"on"}`,hint:"V",run:wt},{label:"Narration track\u2026",hint:"N",alias:"voice audio",run:()=>Lt("tracks")},{label:"Live voice\u2026",alias:"tts synthesize tone gemini",run:()=>Lt("voices")},{label:"Character\u2026",alias:"avatar lipsync face talking head visemes",run:()=>Lt("character")},{label:`Character solo ${rn.solo?"off":"on"}`,alias:"centre center stage narrator only fullscreen avatar",run:()=>At.applySolo(!rn.solo)},{label:"Record offline narration\u2026",hint:"\u21E7V",alias:"export download batch wav tts",run:sn},{label:"Voice faster",hint:">",alias:"speed rate playback",run:()=>Ft(.25)},{label:"Voice slower",hint:"<",alias:"speed rate playback",run:()=>Ft(-.25)},{label:"Speaker view",hint:"S",run:()=>{let S=te.__speakerWin;S&&!S.closed?S.__decklightSpeakerToggle?.():te.__speakerWin=Wr(te)}},{label:"Overview",hint:"O",run:Et},{label:"Blackout",hint:"B",run:Yt},{label:`Pen ${zt.annotator?.tool==="pen"?"off":"on"} \u2014 draw on the slide`,hint:"W",alias:"ink annotate draw scribble marker highlight",run:()=>Qt("pen")},{label:`Laser pointer ${zt.annotator?.tool==="laser"?"off":"on"}`,hint:"\u21E7W",alias:"ink dot glow point at",run:()=>Qt("laser")},{label:"Debug log",hint:"D",alias:"console events state",run:dt},{label:`Captions ${At.status().captionsOn?"off":"on"}`,hint:"C",alias:"cc subtitles closed caption",run:Mt},{label:`Clock ${zt.status().clockOn?"off":"on"}`,hint:"K",alias:"time elapsed timer talk wall watch",run:Jt},{label:`Progress bar ${zt.status().progressOn?"off":"on"}`,hint:"H",alias:"bar bottom edge position how far through shape of the talk",run:on},{label:"Transcript\u2026",alias:"notes script export text markdown spoken",run:Bt},{label:`Narration ${At.status().paused?"resume":"pause"}`,hint:"P",alias:"pause resume voice",run:$t},{label:"Edit speaker notes\u2026",alias:"edit mode notes write right-click background",run:kn},{label:`Element edit mode ${xt.elementEditOn()?"off":"on"} (dev)`,hint:"E",alias:"right-click remove delete html content build animation entrance effect context menu",run:T},{label:"Fullscreen",hint:"F",run:()=>H()},{label:"Print view (all slides, new tab)",hint:"",run:()=>window.open(location.pathname+"?print")},{label:"First slide",hint:"Home",run:()=>te.goto(1,0)},{label:"Last slide",hint:"End",run:()=>te.goto(te.state.totalSlides,0)},{label:"Keyboard help",hint:"?",run:Ot},{label:"Welcome to Decklight",alias:"onboarding intro getting started first run tour what is this help me",run:be.showWelcome},{label:`Tips ${be.status().tipsOn?"off":"on"}`,alias:"hints teach shortcuts learn stop showing quiet",run:()=>be.setTips(!be.status().tipsOn)},be.status().tipsLeft<jn.length&&{label:"Reset tips",alias:"hints again start over show all unsee replay",run:be.resetTips}].filter(Boolean).filter(S=>y(S.run))}function g(){let y=Ae.querySelector(".narr-card");y.textContent="",x=Ri({commands:we(),query:ye,totalSlides:te.state.totalSlides,makeGotoRow:(S,R)=>({label:`Go to slide ${S} / ${R}`,hint:"\u23CE",run:()=>te.goto(S,0)}),makeSearchRow:S=>({label:`Search slides for \u201C${S}\u201D`,hint:"",run:()=>{nt(),P(S)}})});let _=document.createElement("div");if(_.className="pal-input"+(ye?" tp-active":""),_.textContent=ye||"type a command\u2026",y.appendChild(_),x.forEach((S,R)=>{let Z=document.createElement("div");Z.className="narr-row pal-row";let ue=document.createElement("span");if(ue.textContent=S.label,Z.appendChild(ue),S.hint){let Ve=document.createElement("span");Ve.className="pal-kbd",Ve.textContent=S.hint,Z.appendChild(Ve)}Z.addEventListener("mouseenter",()=>G(R)),Z.addEventListener("click",()=>{G(R),B()}),y.appendChild(Z)}),!x.length){let S=document.createElement("div");S.className="tp-none",S.textContent="no matching command",y.appendChild(S)}G(0)}function G(y){x.length&&(Q=jt(Ae.querySelectorAll(".pal-row"),y,"narr-sel"))}function B(){let y=x[Q];y&&(y.keepOpen||Y(),y.run())}function X(){if(Ae)return Y();F&&W(),xt.restore.close(),ye="",Ae=document.createElement("div"),Ae.className="decklight-narr decklight-palette",Ae.innerHTML='<div class="narr-card" role="listbox" aria-label="Commands"></div>',kt(Ae,Y),w.appendChild(Ae),g()}function Y(){Ae?.remove(),Ae=null}let ge=null,V=0;function ne(){if(ge)return Je();ge=document.createElement("div"),ge.className="decklight-narr decklight-font-picker",ge.innerHTML='<div class="narr-card" role="listbox" aria-label="Fonts"></div>';let y=ge.querySelector(".narr-card");re.forEach(([_],S)=>{let R=document.createElement("div");R.className="narr-row"+(S===He?" narr-cur":""),R.textContent=_,S>0&&(R.style.fontFamily=re[S][1]),R.addEventListener("mouseenter",()=>Fe(S)),R.addEventListener("click",()=>{_e(S),Je()}),y.appendChild(R)}),kt(ge,Je),w.appendChild(ge),Fe(He)}function Fe(y){V=jt(ge.querySelectorAll(".narr-row"),y,"narr-sel")}function Je(){ge?.remove(),ge=null}Ce.restoreSaved();let re=[["theme default",null],["system sans","-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"],["rounded","ui-rounded, 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, 'Arial Rounded MT Bold', Calibri, sans-serif"],["humanist","Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif"],["geometric","'Avenir Next', Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif"],["classical serif","'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif"],["transitional serif","Charter, 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif"],["slab serif","Rockwell, 'Rockwell Nova', 'Roboto Slab', 'DejaVu Serif', 'Sitka Small', serif"],["monospace","'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace"]],ke="decklight-font:"+location.pathname,He=0;function _e(y,{silent:_=!1,remeasure:S=!0}={}){He=(y%re.length+re.length)%re.length;let[R,Z]=re[He];if(Z?(w.style.setProperty("--font-body",Z),w.style.setProperty("--font-heading",Z)):(w.style.removeProperty("--font-body"),w.style.removeProperty("--font-heading")),!a.has("embedded"))try{Z?localStorage.setItem(ke,String(He)):localStorage.removeItem(ke)}catch{}S&&(wr(te._sections,l),ns(te._sections[te.state.slide-1],te.state.slide)),_||Re(`font: ${R}`),h("font",R)}function Le(y){_e(He+y)}try{let y=parseInt(localStorage.getItem(ke),10);y>0&&y<re.length&&_e(y,{silent:!0,remeasure:!1})}catch{}function Qe(y){if(!y)return null;if(y.startsWith("#")){let S=document.querySelector(y);if(!S)return null;let R=S.cloneNode(!0);return R.removeAttribute("id"),R.style.removeProperty("display"),R}if(y.trim().startsWith("<")){let S=document.createElement("div");return S.innerHTML=y,S.firstElementChild}let _=document.createElement("img");return _.src=y,_.alt="",_}let Oe=null;Ce.updateCanvas();let Ye=w.querySelector(":scope > .decklight-stage");if(!Ye){for(Ye=document.createElement("div"),Ye.className="decklight-stage";w.firstChild;)Ye.appendChild(w.firstChild);w.appendChild(Ye)}if(Ye.style.width=l.width+"px",Ye.style.height=l.height+"px",l.logo&&(l.logo.src||l.logo.onLight||l.logo.onDark)){Oe=document.createElement("div"),Oe.className="decklight-logo",Oe.setAttribute("data-pos",l.logo.position||"bottom-left"),l.logo.height&&Oe.style.setProperty("--logo-h",l.logo.height+"px");for(let[y,_]of[["src","on-any"],["onLight","on-light"],["onDark","on-dark"]]){let S=Qe(l.logo[y]);if(!S)continue;let R=document.createElement("span");R.className=_,R.appendChild(S),Oe.appendChild(R)}w.appendChild(Oe)}function ct(y){Oe&&y.forEach(_=>{if(!_.hasAttribute("data-logo")||_.querySelector(":scope > .decklight-hero-logo"))return;let S=document.createElement("div");S.className="decklight-hero-logo";let R=parseFloat(_.getAttribute("data-logo"));R&&S.style.setProperty("--hero-logo-h",R+"px"),S.innerHTML=Oe.innerHTML,_.prepend(S)})}pd(Ye),to(Ye),po(Ye),Ys(Ye),ii(Ye,Kn);let _t=Li({slideOf:()=>te.state.slide,sectionAt:y=>te._sections[y-1],describe:y=>({autoPins:Di(y,l)!==null,hasSplitPair:qi(y).length>1}),available:()=>xt.available(),unavailableMessage:()=>tn("layout",location),apply:(y,_)=>{_==="auto"?y.removeAttribute("data-layout"):y.setAttribute("data-layout",_)},relayout:(y,_)=>(wr(te._sections,l),Bi(te._sections),ns(y,_),y.hasAttribute("data-split-conflict")),post:y=>fetch(xt.base()+"/edit/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(y)}).then(_=>{if(!_.ok)throw new Error(_.status)}),toast:Re,debugLog:h}),Pt=y=>_t.cycle(y),Kt=y=>_t.ring(y),te={root:w,stage:Ye,config:l,_sections:[],_records:[],state:{slide:1,step:0,totalSlides:0},_listeners:new Map,_scale:1,on(y,_){return this._listeners.has(y)||this._listeners.set(y,new Set),this._listeners.get(y).add(_),this},_emit(y,_){(this._listeners.get(y)||[]).forEach(S=>S(_)),w.dispatchEvent(new CustomEvent("decklight:"+y,{detail:_}))},sync(){this._sections=[...Ye.querySelectorAll(":scope > section")],this._sections.forEach((_,S)=>_.setAttribute("data-slide-index",String(S+1))),Xs(Ye,l.concepts),ct(this._sections),Ei(this._sections,{printMode:d}),wr(this._sections,l),Bi(this._sections),this._records=this._sections.map(_=>Pr(_)),this.state.totalSlides=this._sections.length,this.state.slide=Math.min(this.state.slide,this.state.totalSlides||1);let y=this._records[this.state.slide-1];y&&(this.state.step=Math.min(this.state.step,y.groups.length)),Vt(d?this._sections:[this._sections[this.state.slide-1]])},_rescanFor(y){let _=y.closest("section"),S=this._sections.indexOf(_);if(S!==-1){if(this._records[S]=Pr(_),d){cn(this._records[S],this._records[S].groups.length);return}S===this.state.slide-1?(this.state.step=Math.min(this._requestedStep??this.state.step,this._records[S].groups.length),this._requestedStep=null,Dt(()=>cn(this._records[S],this.state.step)),this._updateHash(!1)):Dt(()=>cn(this._records[S],0)),this._notify()}},_stepLabels(y){let _=this._records[y];return _?Vs(_):[]},next(){let y=this._records[this.state.slide-1];y&&this.state.step<y.groups.length?this.goto(this.state.slide,this.state.step+1,{direction:"fwd"}):this.state.slide<this.state.totalSlides?this.goto(this.state.slide+1,0,{direction:"fwd"}):$(1)},prev(){if(this.state.step>0)this.goto(this.state.slide,this.state.step-1,{direction:"back"});else if(this.state.slide>1){let y=this._records[this.state.slide-2];this.goto(this.state.slide-1,y.groups.length,{direction:"back"})}else $(-1)},goto(y,_=0,S={}){y=Math.max(1,Math.min(y,this.state.totalSlides));let R=this._records[y-1];this._requestedStep=_,_=Math.max(0,Math.min(_,R?R.groups.length:0));let Z=y===this.state.slide;if(Z&&_===this.state.step&&!S.force)return;let ue=S.direction||(y>this.state.slide||Z&&_>this.state.step?"fwd":"back");!Z||S.force?(this._activateSlide(y,ue,S),this.state.slide=y,this.state.step=_,Dt(()=>cn(R,_)),this._emit("slide",{slide:y,total:this.state.totalSlides,direction:ue}),Vt([this._sections[y-1]])):(this.state.step=_,cn(R,_),this._emit("build",{slide:y,index:_,total:R.groups.length,direction:ue})),this._updateChrome(),this._updateHash(!Z),this._notify()},_activateSlide(y,_,S={}){let R=this._sections[this.state.slide-1],Z=this._sections[y-1];if(w.classList.toggle("has-hero-logo",Z?.hasAttribute("data-logo")??!1),R===Z){Z.classList.add("active");return}let ue=!R||!R.classList.contains("active"),Ve=R&&Z&&!ue&&R.hasAttribute("data-auto-animate")&&Z.hasAttribute("data-auto-animate")&&Math.abs(this._sections.indexOf(Z)-this._sections.indexOf(R))===1;if(this._sections.forEach(Dn=>Dn.classList.remove("active","entering","leaving","dir-fwd","dir-back","tr-none","tr-fade","tr-slide","tr-scale","tr-flip")),Z.classList.add("active"),ue||d)return;if(Ve){R.classList.add("leaving"),R.style.visibility="hidden",Z.style.visibility="hidden",Z.offsetWidth,Z.style.visibility="",lo(R,Z,this._scale),R.classList.remove("leaving"),R.style.visibility="";return}let it=oo(Z.getAttribute("data-transition"),this.config.transition),ht=io(it,_);if(!ht)return;Z.classList.add(...ht.entering),R.classList.add(...ht.leaving);let mn=or(getComputedStyle(Z).getPropertyValue("--transition-duration"),350);setTimeout(()=>{R.classList.remove(...ht.leaving),Z.classList.remove(...ht.entering)},mn+60)},_updateChrome(){if(Ct){let y=this._records[this.state.slide-1],_=y?y.groups.length:0,S=this.state.totalSlides<=1?1:(this.state.slide-1+(_?this.state.step/(_+1):0))/(this.state.totalSlides-1);Ct.style.width=(Math.min(S,1)*100).toFixed(2)+"%"}if(gt){let y=this.config.slideNumber?this.config.slideNumber==="n/N"?`${this.state.slide} / ${this.state.totalSlides}`:String(this.state.slide):"";if(gt.textContent=y,A.any){let _=A.title(),S=document.createElement("span");S.className="mod",S.textContent=_,gt.prepend(S)}}},_updateHash(y){if(!this.config.hash||d)return;let _=`#/${this.state.slide}/${this.state.step}`;"#"+qt(location.hash)!==_&&(pt=!0,y?history.pushState(null,"",_):history.replaceState(null,"",_),setTimeout(()=>{pt=!1}))},_notify(){this.__notifySpeaker&&this.__notifySpeaker()}};function nn(y,_){let S=document.createElement("a");S.href=y,S.download=_,document.body.appendChild(S),S.click(),S.remove()}function Dt(y){w.classList.add("decklight-no-anim"),y(),w.offsetWidth,w.classList.remove("decklight-no-anim")}function qt(y){return(y||"").replace(/^#/,"")}function Xt(){let y=qt(location.hash).match(/^\/(\d+)(?:\/(\d+))?/);return y?{slide:parseInt(y[1],10),step:y[2]?parseInt(y[2],10):0}:null}let Ct=null,gt=null;if(l.controls&&!d){let y=document.createElement("div");y.className="decklight-controls",y.innerHTML=`
312
+ </div>`,k.addEventListener("click",J=>{J.stopPropagation(),A()}),It(k,A),r.appendChild(k),u?.("nav","welcome shown"))}m.register({isOpen:()=>!!k,close:A,keydown:()=>(A(),!0)});function M(){return cs(Ri)!=="1"}function T(){try{let J=JSON.parse(cs(ls)||"[]");return new Set(Array.isArray(J)?J:[])}catch{return new Set}}function C(){let J=T();return rr.find(de=>!J.has(de.id))||null}function F(){let J=C();if(!J)return null;let de=T();return de.add(J.id),Cr(ls,JSON.stringify([...de])),d(`tip \xB7 ${J.text}`,5200),J.id}function ye(J){Cr(Ri,J?"0":"1"),d(J?"tips on \u2014 one per deck you open":"tips off")}function ge(){Cr(ls,"[]"),d(`tips reset \u2014 all ${rr.length} will show again, one per deck`)}function be(J){if(!b&&(f().on("slide",A),f().on("build",A),!(J.slide!==1||J.step!==0))){if(cs(Li)!=="1"){P();return}M()&&F()}}return{start:be,showWelcome:P,dismissWelcome:A,showTip:F,setTips:ye,resetTips:ge,status:()=>({tipsOn:M(),tipsLeft:C()?rr.length-T().size:0})}}le();ce();function Bi({sectionsOf:r,checkOverflow:i,ResizeObs:l=typeof ResizeObserver=="function"?ResizeObserver:null,MutationObs:d=typeof MutationObserver=="function"?MutationObserver:null,schedule:u=m=>setTimeout(m)}){let m=[],f=0;function h(){f||(f=u(()=>{f=0;let M=r();for(let T of m)i(T,M.indexOf(T)+1)})||1)}let b=l?new l(h):null;function k(M){if(b)for(let T of[M,...M.querySelectorAll("*")])T.parentElement?.closest(".terminal")||b.observe(T)}let A=d?new d(M=>{let T=F=>!(F.nodeType===1?F:F.parentElement)?.closest(".terminal"),C=!1;for(let F of M)if(T(F.target)){C=!0;for(let ye of F.addedNodes)ye.nodeType===1&&ye.isConnected&&k(ye)}C&&h()}):null,P=M=>{M.target.closest?.(".terminal")||h()};return{watch(M){b?.disconnect(),A?.disconnect();for(let T of m)for(let C of["load","error"])T.removeEventListener(C,P,!0);m=M.filter(Boolean);for(let T of m){k(T),A?.observe(T,{childList:!0,subtree:!0,characterData:!0});for(let C of["load","error"])T.addEventListener(C,P,!0)}h()},get watched(){return m.slice()}}}le();ce();function Pi({config:r,root:i,embedded:l,sectionsOf:d,slideOf:u,navigate:m}){let f=!l&&r.playlist?.modules?.length?r.playlist:null,h=f?f.index??0:0,b=!!i.querySelector("section[data-module]");function k(){let P=[];return(d()||[]).forEach((M,T)=>{M.hasAttribute("data-module")&&P.push({title:M.getAttribute("data-module"),slide:T+1})}),P}function A(P=k()){let M=-1;return P.forEach((T,C)=>{T.slide<=u()&&(M=C)}),M}return{get playlist(){return f},get index(){return h},get hasMarkers(){return b},get any(){return b||!!f},markers:k,currentMarkerIndex:A,gotoModule(P){if(!f)return!1;let M=f.modules[h+P];return M?(m(M.href+(P>0?"#/1/0":"#/999/999")),!0):!1},navigateToModule(P){let M=f?.modules[P];M&&m(M.href+"#/1/0")},title(){if(b){let P=k();return P[A(P)]?.title||""}return f?.modules[h]?.title||""}}}le();ce();function dd(r,i,l){return(r.querySelector("h1, h2, h3")?.textContent||"").replace(/\s+/g," ").trim()||l.slice(0,60)||`slide ${i+1}`}function ud(r){return[...r.children].filter(l=>!l.matches("aside, script, style")).map(l=>l.textContent).join(" ").replace(/\s+/g," ").trim()}function Di({sections:r,modules:i=[],skipModule:l=-1}){let d=r.map((m,f)=>{let h=ud(m);return{slide:f+1,title:dd(m,f,h),haystack:h.toLowerCase()}}),u=i.map((m,f)=>({module:f,title:m.title,href:m.href,haystack:(m.title||"").toLowerCase()})).filter(m=>m.module!==l);return[...d,...u]}function qi(r,i){let l=String(i??"").toLowerCase().split(/\s+/).filter(Boolean),d=[],u=[];for(let m of r){let f=m.title.toLowerCase();l.every(h=>f.includes(h))?d.push(m):l.every(h=>m.haystack.includes(h))&&u.push(m)}return[...d,...u]}le();ce();function Fi({now:r=Date.now,keep:i=200}={}){let l=r(),d=[],u=null;function m(f,h){let b={t:((r()-l)/1e3).toFixed(3),kind:f,msg:h};return d.push(b),d.length>i&&d.shift(),u?.(b),b}return{log:m,get entries(){return d.slice()},onEntry(f){u=f}}}le();ce();var pd=["auto","centered","pinned","top","split","split-flip"];function hd({autoPins:r,hasSplitPair:i}){return pd.filter(l=>(l!=="pinned"||!r)&&(l!=="split-flip"||i))}function md(r,i,l){if(!r.length)return null;let d=Math.max(0,r.indexOf(i));return r[(d+l+r.length)%r.length]}function zi({slideOf:r,sectionAt:i,describe:l,available:d,unavailableMessage:u,apply:m,relayout:f,post:h,toast:b,debugLog:k,schedule:A=setTimeout,cancel:P=clearTimeout,delay:M=600}){let T=null,C=null;function F(){P(C);let be=T;T=null,be&&h({slide:be.slide,layout:be.name}).then(()=>k("layout",`slide ${be.slide}: ${be.name} \u2192 saved to file`)).catch(()=>b("layout save failed \u2014 is the dev server still up?",2200))}function ye(be=r()){let J=i(be);return J?hd(l(J)):[]}function ge(be){if(!d()){b(u(),3200);return}let J=r(),de=i(J);if(!de)return;let Oe=md(ye(J),de.getAttribute("data-layout")||"auto",be);if(!Oe)return;m(de,Oe),T&&T.slide!==J&&F(),T={slide:J,name:Oe},P(C),C=A(F,M);let ke=f(de,J);b(ke?`layout: ${Oe} \u2014 fights this slide's own column flexbox; pick one`:`layout: ${Oe}`),k("layout",`slide ${J}: ${Oe}`)}return{ring:ye,cycle:ge,flush:F}}le();ce();function Ui({commands:r,query:i="",totalSlides:l=0,makeGotoRow:d,makeSearchRow:u}){let m=String(i).toLowerCase(),f=r.filter(b=>!m||(b.label+" "+(b.alias??"")).toLowerCase().includes(m)),h=String(i).trim().match(/^(?:goto\s*)?(\d+)$/i);if(h&&d){let b=Math.max(1,Math.min(parseInt(h[1],10),l));f.unshift(d(b,l))}return m&&!h&&u&&!f.some(b=>b.label.toLowerCase().startsWith(m))&&f.push(u(i)),f}var fd={transition:"fade",hash:!0,controls:!0,slideNumber:!1,width:1280,height:720,pinTitles:!0},$r=99,gd=18,Hi=6,bd="ul, ol, svg, pre, table, .terminal, img, .columns",Xn=null;function sr(r,i){Ys(r,i),Xn&&Xn._rescanFor(r)}function yd(r){let i=getComputedStyle(r).position;return i==="absolute"||i==="fixed"}function wd(r){for(let i of r.children)if(!i.matches("aside, script, style, .decklight-hero-logo, .slide-bg")){if(i.matches("h1, h2"))return i;if(!yd(i))return null}return null}function xd(r,i){if(!i||r.getAttribute("data-subtitle")==="none")return null;let l=i.nextElementSibling;return l&&l.matches("p")&&!l.hasAttribute("data-build")?(l.classList.add("subtitle"),l):r.querySelector(":scope > p.subtitle")}function ji(r){return r.pinTitles===!0?$r:typeof r.pinTitles=="number"&&isFinite(r.pinTitles)?r.pinTitles:null}function Ki(r,i){let l=ji(i),d=r.getAttribute("data-pin");if(d==="none")return null;if(d!==null&&d!==""){let m=parseFloat(d);return isFinite(m)?m:l??$r}return d===""?l??$r:l===null?null:[...r.querySelectorAll(bd)].some(m=>!m.closest("aside")&&!m.closest(".decklight-hero-logo"))?l:null}function Nr(r,i){r.forEach(l=>{let d=wd(l),u=l.getAttribute("data-layout"),m;if(u==="pinned"){let k=parseFloat(l.getAttribute("data-pin"));m=isFinite(k)?k:ji(i)??$r}else u==="centered"||u==="top"?m=null:m=Ki(l,i);let f=xd(l,d);if(l.querySelector(":scope > .pin-title")?.classList.remove("pin-title"),l.querySelector(":scope > .pin-subtitle")?.classList.remove("pin-subtitle"),m===null||!d){l.removeAttribute("data-pinned"),l.style.removeProperty("--pin-y"),l.style.removeProperty("--pin-sub-y"),l.style.removeProperty("--pin-space");return}d.classList.add("pin-title"),l.setAttribute("data-pinned",""),l.style.setProperty("--pin-y",m+"px"),l.classList.add("pin-measure");let h=d.offsetHeight||0,b=m+h;f&&(f.classList.add("pin-subtitle"),l.style.setProperty("--pin-sub-y",Math.round(b+Hi)+"px"),b+=Hi+(f.offsetHeight||0)),l.classList.remove("pin-measure"),l.style.setProperty("--pin-space",Math.round(b+gd)+"px")})}function Wi(r){return[...r.children].filter(i=>!i.matches("h1, h2, .subtitle, aside, script, style, .decklight-hero-logo, .slide-bg"))}function Gi(r){r.forEach((i,l)=>{if(i.querySelectorAll(":scope > .split-columns, :scope > .split-footer").forEach(u=>u.classList.remove("split-columns","split-footer")),!/^split/.test(i.getAttribute("data-layout")||"")){i.removeAttribute("data-split-conflict");return}let d=Wi(i);if(vd(i,d,l+1),d.length===1&&d[0].matches("ul, ol")){d[0].classList.add("split-columns");return}for(let u of d.slice(2))u.classList.add("split-footer")})}function vd(r,i,l){let d=i.some(m=>{let f=getComputedStyle(m);return/flex$/.test(f.display)&&f.flexDirection.startsWith("row")}),u=r.hasAttribute("data-split-conflict");r.toggleAttribute("data-split-conflict",d),d&&!u&&console.warn(`Decklight: slide ${l} combines data-layout="split" with its own column flexbox \u2014 two layout systems fight; drop the data-layout or the flex shell (SPEC COMPARISON_SLIDES)`)}function ds(r,i){if(!r)return;let l=[r,...r.querySelectorAll("pre, table, svg, ul, ol, blockquote")].some(u=>u.scrollHeight>u.clientHeight+2&&getComputedStyle(u).overflowY!=="visible"&&!u.closest(".terminal")&&!u.hasAttribute("data-scroll-ok")),d=r.hasAttribute("data-overflow");r.toggleAttribute("data-overflow",l),l&&!d&&console.warn(`Decklight: slide ${i} content overflows and is clipped \u2014 reduce content or font size`)}function kd(r){r.querySelectorAll("section[data-markdown]").forEach((i,l)=>{i.setAttribute("data-markdown-removed","");let d=[...r.children].indexOf(i)+1||l+1;console.warn(`Decklight: slide ${d} uses data-markdown, which was removed in 0.3.0 \u2014 its content is in a <script type="text/template"> the browser will not render. Author the slide in HTML (SPEC DECK_ANATOMY).`)})}function Vi(r={}){let i=new URLSearchParams(location.search),l={...fd,...r};i.has("embedded")&&(l.controls=!1);let d=i.has("print"),u=i.get("print")||"",m=Fi(),f=null,h=(v,H)=>m.log(v,H),b=document.querySelector(".decklight");if(!b)throw new Error("Decklight: no .decklight element found");let k=hi(),A=Pi({config:l,root:b,embedded:i.has("embedded"),sectionsOf:()=>Q._sections,slideOf:()=>Q.state.slide,navigate:v=>{location.href=v}}),P=A.playlist,M=A.index,T=A.hasMarkers,C=v=>A.gotoModule(v),F=v=>A.navigateToModule(v),ye=200,ge=4,be=[],J=null,de=null;function Oe(){return be}function ke(v){be.push({at:new Date,text:String(v)}),be.length>ye&&be.shift(),de&&ln()}function De(v,H=3200){if(ke(v),d)return;J||(J=document.createElement("div"),J.className="decklight-messages",b.appendChild(J));let G=document.createElement("div");for(G.className="decklight-toast",G.textContent=v,J.appendChild(G),requestAnimationFrame(()=>G.classList.add("show"));J.children.length>ge;)J.firstChild.remove();setTimeout(()=>{G.classList.remove("show"),setTimeout(()=>G.remove(),260)},H)}let xe=Ii({root:b,printMode:d,params:i,toast:De,debugLog:h,overlays:k,deck:()=>Q}),Le=gi({root:b,config:l,params:i,toast:De,debugLog:h,overlays:k,deck:()=>Q,editmode:()=>Tt}),{applyTheme:st,currentTheme:at,cycleTheme:_,cancelCyclePending:qe,rollTheme:Je,saveGeneratedTheme:je}=Le,O=null,D=0,V="",re=[],Ae,Ke=!1,Ce=null;function s(){return Di({sections:Q._sections,modules:P?.modules??[],skipModule:M})}function o(){let v=O.querySelector(".tp-list");if(re=qi(O.__index,V),v.textContent="",re.forEach((G,ve)=>{let Ue=document.createElement("div");Ue.className="tp-row"+(G.slide===Q.state.slide?" tp-current":"")+(G.href?" tp-module":""),Ue.textContent=G.href?`\u25B8 ${G.title} \u2014 module`:`${G.slide} \xB7 ${G.title}`,Ue.addEventListener("mouseenter",()=>Fe(ve,!1)),Ue.addEventListener("click",()=>{Fe(ve,!0),ot()}),v.appendChild(Ue)}),!re.length){let G=document.createElement("div");G.className="tp-none",G.textContent="no matches",v.appendChild(G)}let H=O.querySelector(".tp-filter");H.textContent=V||(P?"type to find a slide or module\u2026":"type to find a slide\u2026"),H.classList.toggle("tp-active",!!V)}function N(v,H){let G=H.href??location.pathname,ve=H.slide??1;if(v.dataset.doc!==G){v.dataset.doc=G,Ke=!1,v.addEventListener("load",()=>{if(Ke=!0,Ce&&O){let Ue=Ce;Ce=null,N(v,Ue)}},{once:!0}),v.src=G+Le.previewQuery()+"#/"+ve+"/0";return}if(!Ke){Ce=H;return}v.contentWindow?.postMessage({__decklightPreview:{goto:[ve,0]}},"*")}function Fe(v,H){if(!re.length)return;D=on(O.querySelectorAll(".tp-row"),v,"tp-selected");let G=re[D];O.querySelector(".tp-caption").textContent=G.href?`module \u2014 ${G.title} (${G.href})`:`slide ${G.slide} \u2014 ${G.title}`,clearTimeout(Ae);let ve=O.querySelector("iframe");H?N(ve,G):Ae=setTimeout(()=>N(ve,G),60)}function B(v){V=v,o(),re.length?Fe(0,!1):O.querySelector(".tp-caption").textContent="no match"}function ot(){let v=re[D];if(K(),!!v){if(v.href)return F(v.module);Q.goto(v.slide,0)}}function mt(){if(O)return K();Le.closePicker(),Tt.restore.close(),V="",O=document.createElement("div"),O.className="decklight-theme-picker decklight-finder",O.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Slides"></div></div><div class="tp-preview"><iframe title="Slide preview"></iframe><div class="tp-caption"></div></div></div>',O.__index=s(),o(),It(O,K),b.appendChild(O),Fe(Math.max(0,re.findIndex(v=>v.slide===Q.state.slide)),!0)}function K(){clearTimeout(Ae),O?.remove(),O=null}let _e=null,Y=0,Re="",y=[];function Be(){let v=G=>typeof G=="function";return[{label:"Find slide\u2026",hint:"G",alias:"search grep goto module chapter jump",run:()=>{mt(),Re&&B(Re)}},{label:"History\u2026 (dev)",hint:"H",alias:"restore version rollback revert back git log commits unpushed push remote when changed",run:()=>Tt.history.open()},{label:"Go to slide\u2026",hint:"#",alias:"goto",keepOpen:!0,run:()=>{Re="goto ",w()}},{label:"Theme\u2026",hint:"T",run:Le.openPicker},{label:"Cycle theme",hint:", \xB7 .",run:()=>_(1)},{label:"Generate a theme",hint:"\u2303T",run:Je},Le.hasGenerated()&&{label:"Save the generated theme\u2026",hint:"\u2303\u21E7T",run:()=>je()},Tt.available()&&{label:"Browse marketplace themes\u2026",alias:"marketplace install add third-party download catalog",run:Le.browse},...Tt.wizards().map(G=>({label:`Configure ${G.title}\u2026 (dev)`,alias:"engine wizard setup api key credential token marketplace",run:()=>Tt.wizard(G.qualified)})),{label:"Font\u2026",hint:"[ \xB7 ]",run:Xe},{label:"Cycle slide layout (dev)",hint:"L",alias:"pin pinned centered top auto split columns two sides arrange",run:()=>Vt(1)},{label:"Undo deck edit (dev)",hint:"Z",alias:"revert back history",run:()=>un("undo")},{label:"Redo deck edit (dev)",hint:"\u21E7Z",alias:"forward history repeat",run:()=>un("redo")},{label:"Ask agent\u2026 (dev)",hint:"A",alias:"ai claude codex bob gemini prompt edit",run:On},{label:"Messages",hint:"`",alias:"log toast notifications warnings why voice stopped history",run:tn},{label:`Narration ${Rt.status().narrating?"off":"on"}`,hint:"V",run:rn},{label:"Narration track\u2026",hint:"N",alias:"voice audio",run:()=>sn("tracks")},{label:"Live voice\u2026",alias:"tts synthesize tone gemini",run:()=>sn("voices")},{label:"Character\u2026",alias:"avatar lipsync face talking head visemes",run:()=>sn("character")},{label:`Character solo ${Nn.solo?"off":"on"}`,alias:"centre center stage narrator only fullscreen avatar",run:()=>Rt.applySolo(!Nn.solo)},{label:"Record offline narration\u2026",hint:"\u21E7V",alias:"export download batch wav tts",run:St},{label:"Voice faster",hint:">",alias:"speed rate playback",run:()=>Yt(.25)},{label:"Voice slower",hint:"<",alias:"speed rate playback",run:()=>Yt(-.25)},{label:"Speaker view",hint:"S",run:()=>{let G=Q.__speakerWin;G&&!G.closed?G.__decklightSpeakerToggle?.():Q.__speakerWin=ts(Q)}},{label:"Overview",hint:"O",run:pt},{label:"Blackout",hint:"B",run:ht},{label:`Pen ${Mt.annotator?.tool==="pen"?"off":"on"} \u2014 draw on the slide`,hint:"W",alias:"ink annotate draw scribble marker highlight",run:()=>dn("pen")},{label:`Laser pointer ${Mt.annotator?.tool==="laser"?"off":"on"}`,hint:"\u21E7W",alias:"ink dot glow point at",run:()=>dn("laser")},{label:"Debug log",hint:"D",alias:"console events state",run:an},{label:`Captions ${Rt.status().captionsOn?"off":"on"}`,hint:"C",alias:"cc subtitles closed caption",run:$n},{label:`Clock ${Mt.status().clockOn?"off":"on"}`,hint:"K",alias:"time elapsed timer talk wall watch",run:Gt},{label:`Progress bar ${Mt.status().progressOn?"off":"on"}`,hint:"J",alias:"bar bottom edge position how far through shape of the talk",run:jt},{label:"Transcript\u2026",alias:"notes script export text markdown spoken",run:kt},{label:`Narration ${Rt.status().paused?"resume":"pause"}`,hint:"P",alias:"pause resume voice",run:gn},{label:"Edit speaker notes\u2026",alias:"edit mode notes write right-click background",run:bn},{label:`Element edit mode ${Tt.elementEditOn()?"off":"on"} (dev)`,hint:"E",alias:"right-click remove delete html content build animation entrance effect context menu",run:yn},{label:"Fullscreen",hint:"F",run:()=>Z()},{label:"Print view (all slides, new tab)",hint:"",run:()=>window.open(location.pathname+"?print")},{label:"First slide",hint:"Home",run:()=>Q.goto(1,0)},{label:"Last slide",hint:"End",run:()=>Q.goto(Q.state.totalSlides,0)},{label:"Keyboard help",hint:"?",run:I},{label:"Welcome to Decklight",alias:"onboarding intro getting started first run tour what is this help me",run:xe.showWelcome},{label:`Tips ${xe.status().tipsOn?"off":"on"}`,alias:"hints teach shortcuts learn stop showing quiet",run:()=>xe.setTips(!xe.status().tipsOn)},xe.status().tipsLeft<rr.length&&{label:"Reset tips",alias:"hints again start over show all unsee replay",run:xe.resetTips}].filter(Boolean).filter(G=>v(G.run))}function w(){let v=_e.querySelector(".narr-card");v.textContent="",y=Ui({commands:Be(),query:Re,totalSlides:Q.state.totalSlides,makeGotoRow:(G,ve)=>({label:`Go to slide ${G} / ${ve}`,hint:"\u23CE",run:()=>Q.goto(G,0)}),makeSearchRow:G=>({label:`Search slides for \u201C${G}\u201D`,hint:"",run:()=>{mt(),B(G)}})});let H=document.createElement("div");if(H.className="pal-input"+(Re?" tp-active":""),H.textContent=Re||"type a command\u2026",v.appendChild(H),y.forEach((G,ve)=>{let Ue=document.createElement("div");Ue.className="narr-row pal-row";let Ct=document.createElement("span");if(Ct.textContent=G.label,Ue.appendChild(Ct),G.hint){let zt=document.createElement("span");zt.className="pal-kbd",zt.textContent=G.hint,Ue.appendChild(zt)}Ue.addEventListener("mouseenter",()=>pe(ve)),Ue.addEventListener("click",()=>{pe(ve),Se()}),v.appendChild(Ue)}),!y.length){let G=document.createElement("div");G.className="tp-none",G.textContent="no matching command",v.appendChild(G)}pe(0)}function pe(v){y.length&&(Y=on(_e.querySelectorAll(".pal-row"),v,"narr-sel"))}function Se(){let v=y[Y];v&&(v.keepOpen||Ee(),v.run())}function it(){if(_e)return Ee();O&&K(),Tt.restore.close(),Re="",_e=document.createElement("div"),_e.className="decklight-narr decklight-palette",_e.innerHTML='<div class="narr-card" role="listbox" aria-label="Commands"></div>',It(_e,Ee),b.appendChild(_e),w()}function Ee(){_e?.remove(),_e=null}let ze=null,oe=0;function Xe(){if(ze)return Et();ze=document.createElement("div"),ze.className="decklight-narr decklight-font-picker",ze.innerHTML='<div class="narr-card" role="listbox" aria-label="Fonts"></div>';let v=ze.querySelector(".narr-card");me.forEach(([H],G)=>{let ve=document.createElement("div");ve.className="narr-row"+(G===Ie?" narr-cur":""),ve.textContent=H,G>0&&(ve.style.fontFamily=me[G][1]),ve.addEventListener("mouseenter",()=>gt(G)),ve.addEventListener("click",()=>{et(G),Et()}),v.appendChild(ve)}),It(ze,Et),b.appendChild(ze),gt(Ie)}function gt(v){oe=on(ze.querySelectorAll(".narr-row"),v,"narr-sel")}function Et(){ze?.remove(),ze=null}Le.restoreSaved();let me=[["theme default",null],["system sans","-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"],["rounded","ui-rounded, 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, 'Arial Rounded MT Bold', Calibri, sans-serif"],["humanist","Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif"],["geometric","'Avenir Next', Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif"],["classical serif","'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif"],["transitional serif","Charter, 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif"],["slab serif","Rockwell, 'Rockwell Nova', 'Roboto Slab', 'DejaVu Serif', 'Sitka Small', serif"],["monospace","'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace"]],Ne="decklight-font:"+location.pathname,Ie=0;function et(v,{silent:H=!1,remeasure:G=!0}={}){Ie=(v%me.length+me.length)%me.length;let[ve,Ue]=me[Ie];if(Ue?(b.style.setProperty("--font-body",Ue),b.style.setProperty("--font-heading",Ue)):(b.style.removeProperty("--font-body"),b.style.removeProperty("--font-heading")),!i.has("embedded"))try{Ue?localStorage.setItem(Ne,String(Ie)):localStorage.removeItem(Ne)}catch{}G&&(Nr(Q._sections,l),ds(Q._sections[Q.state.slide-1],Q.state.slide)),H||De(`font: ${ve}`),h("font",ve)}function tt(v){et(Ie+v)}try{let v=parseInt(localStorage.getItem(Ne),10);v>0&&v<me.length&&et(v,{silent:!0,remeasure:!1})}catch{}function bt(v){if(!v)return null;if(v.startsWith("#")){let G=document.querySelector(v);if(!G)return null;let ve=G.cloneNode(!0);return ve.removeAttribute("id"),ve.style.removeProperty("display"),ve}if(v.trim().startsWith("<")){let G=document.createElement("div");return G.innerHTML=v,G.firstElementChild}let H=document.createElement("img");return H.src=v,H.alt="",H}let He=null;Le.updateCanvas();let ft=b.querySelector(":scope > .decklight-stage");if(!ft){for(ft=document.createElement("div"),ft.className="decklight-stage";b.firstChild;)ft.appendChild(b.firstChild);b.appendChild(ft)}if(ft.style.width=l.width+"px",ft.style.height=l.height+"px",l.logo&&(l.logo.src||l.logo.onLight||l.logo.onDark)){He=document.createElement("div"),He.className="decklight-logo",He.setAttribute("data-pos",l.logo.position||"bottom-left"),l.logo.height&&He.style.setProperty("--logo-h",l.logo.height+"px");for(let[v,H]of[["src","on-any"],["onLight","on-light"],["onDark","on-dark"]]){let G=bt(l.logo[v]);if(!G)continue;let ve=document.createElement("span");ve.className=H,ve.appendChild(G),He.appendChild(ve)}b.appendChild(He)}function Dt(v){He&&v.forEach(H=>{if(!H.hasAttribute("data-logo")||H.querySelector(":scope > .decklight-hero-logo"))return;let G=document.createElement("div");G.className="decklight-hero-logo";let ve=parseFloat(H.getAttribute("data-logo"));ve&&G.style.setProperty("--hero-logo-h",ve+"px"),G.innerHTML=He.innerHTML,H.prepend(G)})}kd(ft),oo(ft),go(ft),to(ft),di(ft,sr);let Kt=zi({slideOf:()=>Q.state.slide,sectionAt:v=>Q._sections[v-1],describe:v=>({autoPins:Ki(v,l)!==null,hasSplitPair:Wi(v).length>1}),available:()=>Tt.available(),unavailableMessage:()=>fn("layout",location),apply:(v,H)=>{H==="auto"?v.removeAttribute("data-layout"):v.setAttribute("data-layout",H)},relayout:(v,H)=>(Nr(Q._sections,l),Gi(Q._sections),ds(v,H),v.hasAttribute("data-split-conflict")),post:v=>fetch(Tt.base()+"/edit/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(v)}).then(H=>{if(!H.ok)throw new Error(H.status)}),toast:De,debugLog:h}),Vt=v=>Kt.cycle(v),Ot=v=>Kt.ring(v),Q={root:b,stage:ft,config:l,_sections:[],_records:[],state:{slide:1,step:0,totalSlides:0},_listeners:new Map,_scale:1,on(v,H){return this._listeners.has(v)||this._listeners.set(v,new Set),this._listeners.get(v).add(H),this},_emit(v,H){(this._listeners.get(v)||[]).forEach(G=>G(H)),b.dispatchEvent(new CustomEvent("decklight:"+v,{detail:H}))},sync(){this._sections=[...ft.querySelectorAll(":scope > section")],this._sections.forEach((H,G)=>H.setAttribute("data-slide-index",String(G+1))),eo(ft,l.concepts),Dt(this._sections),Ti(this._sections,{printMode:d}),Nr(this._sections,l),Gi(this._sections),this._records=this._sections.map(H=>jr(H)),this.state.totalSlides=this._sections.length,this.state.slide=Math.min(this.state.slide,this.state.totalSlides||1);let v=this._records[this.state.slide-1];v&&(this.state.step=Math.min(this.state.step,v.groups.length)),Qt(d?this._sections:[this._sections[this.state.slide-1]])},_rescanFor(v){let H=v.closest("section"),G=this._sections.indexOf(H);if(G!==-1){if(this._records[G]=jr(H),d){En(this._records[G],this._records[G].groups.length);return}G===this.state.slide-1?(this.state.step=Math.min(this._requestedStep??this.state.step,this._records[G].groups.length),this._requestedStep=null,_t(()=>En(this._records[G],this.state.step)),this._updateHash(!1)):_t(()=>En(this._records[G],0)),this._notify()}},_stepLabels(v){let H=this._records[v];return H?Js(H):[]},next(){let v=this._records[this.state.slide-1];v&&this.state.step<v.groups.length?this.goto(this.state.slide,this.state.step+1,{direction:"fwd"}):this.state.slide<this.state.totalSlides?this.goto(this.state.slide+1,0,{direction:"fwd"}):C(1)},prev(){if(this.state.step>0)this.goto(this.state.slide,this.state.step-1,{direction:"back"});else if(this.state.slide>1){let v=this._records[this.state.slide-2];this.goto(this.state.slide-1,v.groups.length,{direction:"back"})}else C(-1)},goto(v,H=0,G={}){v=Math.max(1,Math.min(v,this.state.totalSlides));let ve=this._records[v-1];this._requestedStep=H,H=Math.max(0,Math.min(H,ve?ve.groups.length:0));let Ue=v===this.state.slide;if(Ue&&H===this.state.step&&!G.force)return;let Ct=G.direction||(v>this.state.slide||Ue&&H>this.state.step?"fwd":"back");!Ue||G.force?(this._activateSlide(v,Ct,G),this.state.slide=v,this.state.step=H,_t(()=>En(ve,H)),this._emit("slide",{slide:v,total:this.state.totalSlides,direction:Ct}),Qt([this._sections[v-1]])):(this.state.step=H,En(ve,H),this._emit("build",{slide:v,index:H,total:ve.groups.length,direction:Ct})),this._updateChrome(),this._updateHash(!Ue),this._notify()},_activateSlide(v,H,G={}){let ve=this._sections[this.state.slide-1],Ue=this._sections[v-1];if(b.classList.toggle("has-hero-logo",Ue?.hasAttribute("data-logo")??!1),ve===Ue){Ue.classList.add("active");return}let Ct=!ve||!ve.classList.contains("active"),zt=ve&&Ue&&!Ct&&ve.hasAttribute("data-auto-animate")&&Ue.hasAttribute("data-auto-animate")&&Math.abs(this._sections.indexOf(Ue)-this._sections.indexOf(ve))===1;if(this._sections.forEach(z=>z.classList.remove("active","entering","leaving","dir-fwd","dir-back","tr-none","tr-fade","tr-slide","tr-scale","tr-flip")),Ue.classList.add("active"),Ct||d)return;if(zt){ve.classList.add("leaving"),ve.style.visibility="hidden",Ue.style.visibility="hidden",Ue.offsetWidth,Ue.style.visibility="",ho(ve,Ue,this._scale),ve.classList.remove("leaving"),ve.style.visibility="";return}let xn=co(Ue.getAttribute("data-transition"),this.config.transition),Jt=uo(xn,H);if(!Jt)return;Ue.classList.add(...Jt.entering),ve.classList.add(...Jt.leaving);let E=fr(getComputedStyle(Ue).getPropertyValue("--transition-duration"),350);setTimeout(()=>{ve.classList.remove(...Jt.leaving),Ue.classList.remove(...Jt.entering)},E+60)},_updateChrome(){if(se){let v=this._records[this.state.slide-1],H=v?v.groups.length:0,G=this.state.totalSlides<=1?1:(this.state.slide-1+(H?this.state.step/(H+1):0))/(this.state.totalSlides-1);se.style.width=(Math.min(G,1)*100).toFixed(2)+"%"}if($e){let v=this.config.slideNumber?this.config.slideNumber==="n/N"?`${this.state.slide} / ${this.state.totalSlides}`:String(this.state.slide):"";if($e.textContent=v,A.any){let H=A.title(),G=document.createElement("span");G.className="mod",G.textContent=H,$e.prepend(G)}}},_updateHash(v){!this.config.hash||d||(R=R||!!v,!Ht&&(Ht=setTimeout(()=>{Ht=null,W()},Wt)))},_notify(){this.__notifySpeaker&&this.__notifySpeaker()}};function Zt(v,H){let G=document.createElement("a");G.href=v,G.download=H,document.body.appendChild(G),G.click(),G.remove()}function _t(v){b.classList.add("decklight-no-anim"),v(),b.offsetWidth,b.classList.remove("decklight-no-anim")}function vt(v){return(v||"").replace(/^#/,"")}let Wt=90,Ht=null,R=!1;function W(v=!0){if(!Q||!l.hash||d)return;let H=`#/${Q.state.slide}/${Q.state.step}`,G=R;if(R=!1,"#"+vt(location.hash)!==H){cn=!0;try{G?history.pushState(null,"",H):history.replaceState(null,"",H)}catch{}setTimeout(()=>{cn=!1}),v&&"#"+vt(location.hash)!==H&&(R=G,requestAnimationFrame(()=>W(!1)))}}function U(){let v=vt(location.hash).match(/^\/(\d+)(?:\/(\d+))?/);return v?{slide:parseInt(v[1],10),step:v[2]?parseInt(v[2],10):0}:null}let se=null,$e=null;if(l.controls&&!d){let v=document.createElement("div");v.className="decklight-controls",v.innerHTML=`
310
313
  <button class="decklight-arrow prev" aria-label="Previous">\u2039</button>
311
- <button class="decklight-arrow next" aria-label="Next">\u203A</button>`,w.appendChild(y),y.querySelector(".prev").addEventListener("click",()=>te.prev()),y.querySelector(".next").addEventListener("click",()=>te.next())}let ot={full:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>',unfull:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>',sound:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H3v6h3l5 4z"/><path d="M15.5 8.5a5 5 0 0 1 0 7"/><path d="M18.5 5.5a9 9 0 0 1 0 13"/></svg>',mute:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H3v6h3l5 4z"/><path d="M17 10l5 4M22 10l-5 4"/></svg>'},st=null,N=null;function H(){let y=w||document.documentElement;document.fullscreenElement?document.exitFullscreen?.():y.requestFullscreen?.()?.catch?.(()=>{})}document.addEventListener("fullscreenchange",()=>{st&&(st.innerHTML=document.fullscreenElement?ot.unfull:ot.full)});function ie(){if(!N)return;let y=At.status().narrating;N.innerHTML=y?ot.sound:ot.mute,N.setAttribute("aria-label",y?"Mute narration":"Play narration"),N.setAttribute("aria-pressed",String(y))}(l.slideNumber||I||C)&&!d&&(gt=document.createElement("div"),gt.className="decklight-slide-number",(I||C)&&(gt.title="G \u2014 find a slide or module",gt.style.cursor="pointer",gt.addEventListener("click",()=>nt())),w.appendChild(gt));let pe=null,Pe=0;function Se(){return getComputedStyle(pe).gridTemplateColumns.split(" ").length||1}function Me(y){let _=pe.querySelectorAll(".ov-cell");Pe=Math.max(0,Math.min(y,_.length-1)),_.forEach((S,R)=>S.classList.toggle("ov-selected",R===Pe)),_[Pe]?.scrollIntoView({block:"nearest"})}function rt(){let y=Pe+1;Et(),te.goto(y,0,{force:!0})}function at(){if(!pe)return;let y=pe.querySelector(".ov-cell");if(!y)return;pe.style.gridAutoRows=Math.round(y.clientWidth*l.height/l.width)+"px";let _=y.clientWidth/l.width;pe.querySelectorAll(".ov-frame").forEach(S=>{S.style.transform=`scale(${_})`})}function Et(){if(pe){window.removeEventListener("resize",at),pe.remove(),pe=null,w.classList.remove("decklight-overview");return}pe=document.createElement("div"),pe.className="decklight-overview-grid",te._sections.forEach((y,_)=>{let S=document.createElement("div");S.className="ov-cell"+(_===te.state.slide-1?" ov-current":"");let R=document.createElement("div");R.className="ov-frame",R.style.width=l.width+"px",R.style.height=l.height+"px";let Z=y.cloneNode(!0);Z.classList.add("active","ov-clone"),Z.querySelectorAll("aside.notes, aside.rehearse").forEach(Ve=>Ve.remove()),Z.querySelectorAll("input, button, select, textarea").forEach(Ve=>{Ve.removeAttribute("name"),Ve.disabled=!0}),R.appendChild(Z),S.appendChild(R);let ue=document.createElement("span");ue.className="ov-num",ue.textContent=String(_+1),S.appendChild(ue),S.addEventListener("click",()=>{Et(),te.goto(_+1,0,{force:!0})}),pe.appendChild(S)}),w.classList.add("decklight-overview"),w.appendChild(pe),at(),Me(te.state.slide-1),window.addEventListener("resize",at)}let Nt=null;function Yt(){if(Nt){Nt.remove(),Nt=null;return}Nt=document.createElement("div"),Nt.className="decklight-blackout",w.appendChild(Nt)}let Rt=null;function wn(){let y=te._records?.[te.state.slide-1],_=At.status(),S=_.live?`\u26A1 ${_.voice} \xB7 ${_.tone}`:_.track?`\u{1F50A} ${_.track.label}`:"none";return`slide ${te.state.slide}/${te.state.totalSlides} \xB7 step ${te.state.step}/${y?y.groups.length:0} \xB7 theme ${xe()??"\u2014"} \xB7 narration ${_.narrating?_.paused?"paused":"on":"off"} (${S})`+(_.rate!==1?` \xB7 ${_.rate}\xD7`:"")+(_.spend>0?` \xB7 tts ~$${_.spend.toFixed(4)}`:"")}function Ht(y){let _=document.createElement("div");_.className="dbg-row dbg-"+y.kind;for(let[S,R]of[["dbg-t",y.t],["dbg-k",y.kind],["dbg-m",y.msg]]){let Z=document.createElement("span");Z.className=S,Z.textContent=R,_.appendChild(Z)}f.querySelector(".dbg-log").appendChild(_)}function It(){let y=f?.querySelector(".dbg-state");y&&(y.textContent=wn())}function dt(){if(f){f.remove(),f=null,m.onEntry(null);return}f=document.createElement("div"),f.className="decklight-debug",f.innerHTML='<div class="dbg-head">debug log \u2014 D closes</div><div class="dbg-state"></div><div class="dbg-log"></div>',w.appendChild(f),m.entries.forEach(Ht),It();let y=f.querySelector(".dbg-log");y.scrollTop=y.scrollHeight,m.onEntry(_=>{Ht(_),It();let S=f.querySelector(".dbg-log");S.scrollTop=S.scrollHeight})}function St(){let y=me?.querySelector(".msg-log");if(y){if(y.innerHTML="",!de.length){let _=document.createElement("div");_.className="msg-empty",_.textContent="no messages yet",y.appendChild(_);return}de.forEach(({at:_,text:S})=>{let R=document.createElement("div");R.className="msg-row";let Z=document.createElement("span");Z.className="msg-time",Z.textContent=_.toLocaleTimeString([],{hour12:!1});let ue=document.createElement("span");ue.className="msg-text",ue.textContent=S,R.append(Z,ue),y.appendChild(R)}),y.scrollTop=y.scrollHeight}}function ut(){if(me){me.remove(),me=null;return}me=document.createElement("div"),me.className="decklight-msglog",me.innerHTML='<div class="msg-head">messages \u2014 the key left of 1 closes</div><div class="msg-log"></div>',w.appendChild(me),St()}te.on("ready",y=>h("ready",`${y.slides} slides${y.print?" \xB7 print":""}`)),te.on("slide",y=>{h("slide",`\u2192 ${y.slide}/${y.total} (${y.direction})`),It()}),te.on("build",y=>{h("build",`slide ${y.slide} step ${y.index}/${y.total} (${y.direction})`),It()}),window.addEventListener("error",y=>h("error",String(y.message)));function Ot(){if(Rt){Rt.remove(),Rt=null;return}Rt=document.createElement("div"),Rt.className="decklight-help",Rt.innerHTML=`<div class="help-card"><h3>Keyboard</h3><table>
314
+ <button class="decklight-arrow next" aria-label="Next">\u203A</button>`,b.appendChild(v),v.querySelector(".prev").addEventListener("click",()=>Q.prev()),v.querySelector(".next").addEventListener("click",()=>Q.next())}let S={full:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>',unfull:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>',sound:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H3v6h3l5 4z"/><path d="M15.5 8.5a5 5 0 0 1 0 7"/><path d="M18.5 5.5a9 9 0 0 1 0 13"/></svg>',mute:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H3v6h3l5 4z"/><path d="M17 10l5 4M22 10l-5 4"/></svg>'},L=null,$=null;function Z(){let v=b||document.documentElement;document.fullscreenElement?document.exitFullscreen?.():v.requestFullscreen?.()?.catch?.(()=>{})}document.addEventListener("fullscreenchange",()=>{L&&(L.innerHTML=document.fullscreenElement?S.unfull:S.full)});function te(){if(!$)return;let v=Rt.status().narrating;$.innerHTML=v?S.sound:S.mute,$.setAttribute("aria-label",v?"Mute narration":"Play narration"),$.setAttribute("aria-pressed",String(v))}(l.slideNumber||P||T)&&!d&&($e=document.createElement("div"),$e.className="decklight-slide-number",(P||T)&&($e.title="G \u2014 find a slide or module",$e.style.cursor="pointer",$e.addEventListener("click",()=>mt())),b.appendChild($e));let fe=null,Qe=0;function Pe(){return getComputedStyle(fe).gridTemplateColumns.split(" ").length||1}function Ye(v){let H=fe.querySelectorAll(".ov-cell");Qe=Math.max(0,Math.min(v,H.length-1)),H.forEach((G,ve)=>G.classList.toggle("ov-selected",ve===Qe)),H[Qe]?.scrollIntoView({block:"nearest"})}function ut(){let v=Qe+1;pt(),Q.goto(v,0,{force:!0})}function dt(){if(!fe)return;let v=fe.querySelector(".ov-cell");if(!v)return;fe.style.gridAutoRows=Math.round(v.clientWidth*l.height/l.width)+"px";let H=v.clientWidth/l.width;fe.querySelectorAll(".ov-frame").forEach(G=>{G.style.transform=`scale(${H})`})}function pt(){if(fe){window.removeEventListener("resize",dt),fe.remove(),fe=null,b.classList.remove("decklight-overview");return}fe=document.createElement("div"),fe.className="decklight-overview-grid",Q._sections.forEach((v,H)=>{let G=document.createElement("div");G.className="ov-cell"+(H===Q.state.slide-1?" ov-current":"");let ve=document.createElement("div");ve.className="ov-frame",ve.style.width=l.width+"px",ve.style.height=l.height+"px";let Ue=v.cloneNode(!0);Ue.classList.add("active","ov-clone"),Ue.querySelectorAll("aside.notes, aside.rehearse").forEach(zt=>zt.remove()),Ue.querySelectorAll("input, button, select, textarea").forEach(zt=>{zt.removeAttribute("name"),zt.disabled=!0}),ve.appendChild(Ue),G.appendChild(ve);let Ct=document.createElement("span");Ct.className="ov-num",Ct.textContent=String(H+1),G.appendChild(Ct),G.addEventListener("click",()=>{pt(),Q.goto(H+1,0,{force:!0})}),fe.appendChild(G)}),b.classList.add("decklight-overview"),b.appendChild(fe),dt(),Ye(Q.state.slide-1),window.addEventListener("resize",dt)}let xt=null;function ht(){if(xt){xt.remove(),xt=null;return}xt=document.createElement("div"),xt.className="decklight-blackout",b.appendChild(xt)}let yt=null;function qt(){let v=Q._records?.[Q.state.slide-1],H=Rt.status(),G=H.live?`\u26A1 ${H.voice} \xB7 ${H.tone}`:H.track?`\u{1F50A} ${H.track.label}`:"none";return`slide ${Q.state.slide}/${Q.state.totalSlides} \xB7 step ${Q.state.step}/${v?v.groups.length:0} \xB7 theme ${at()??"\u2014"} \xB7 narration ${H.narrating?H.paused?"paused":"on":"off"} (${G})`+(H.rate!==1?` \xB7 ${H.rate}\xD7`:"")+(H.spend>0?` \xB7 tts ~$${H.spend.toFixed(4)}`:"")}function Ft(v){let H=document.createElement("div");H.className="dbg-row dbg-"+v.kind;for(let[G,ve]of[["dbg-t",v.t],["dbg-k",v.kind],["dbg-m",v.msg]]){let Ue=document.createElement("span");Ue.className=G,Ue.textContent=ve,H.appendChild(Ue)}f.querySelector(".dbg-log").appendChild(H)}function Pt(){let v=f?.querySelector(".dbg-state");v&&(v.textContent=qt())}function an(){if(f){f.remove(),f=null,m.onEntry(null);return}f=document.createElement("div"),f.className="decklight-debug",f.innerHTML='<div class="dbg-head">debug log \u2014 D closes</div><div class="dbg-state"></div><div class="dbg-log"></div>',b.appendChild(f),m.entries.forEach(Ft),Pt();let v=f.querySelector(".dbg-log");v.scrollTop=v.scrollHeight,m.onEntry(H=>{Ft(H),Pt();let G=f.querySelector(".dbg-log");G.scrollTop=G.scrollHeight})}function ln(){let v=de?.querySelector(".msg-log");if(v){if(v.innerHTML="",!be.length){let H=document.createElement("div");H.className="msg-empty",H.textContent="no messages yet",v.appendChild(H);return}be.forEach(({at:H,text:G})=>{let ve=document.createElement("div");ve.className="msg-row";let Ue=document.createElement("span");Ue.className="msg-time",Ue.textContent=H.toLocaleTimeString([],{hour12:!1});let Ct=document.createElement("span");Ct.className="msg-text",Ct.textContent=G,ve.append(Ue,Ct),v.appendChild(ve)}),v.scrollTop=v.scrollHeight}}function tn(){if(de){de.remove(),de=null;return}de=document.createElement("div"),de.className="decklight-msglog",de.innerHTML='<div class="msg-head">messages \u2014 the key left of 1 closes</div><div class="msg-log"></div>',b.appendChild(de),ln()}Q.on("ready",v=>h("ready",`${v.slides} slides${v.print?" \xB7 print":""}`)),Q.on("slide",v=>{h("slide",`\u2192 ${v.slide}/${v.total} (${v.direction})`),Pt()}),Q.on("build",v=>{h("build",`slide ${v.slide} step ${v.index}/${v.total} (${v.direction})`),Pt()}),window.addEventListener("error",v=>h("error",String(v.message)));function I(){if(yt){yt.remove(),yt=null;return}yt=document.createElement("div"),yt.className="decklight-help",yt.innerHTML=`<div class="help-card"><h3>Keyboard</h3><table>
312
315
  <tr><td>\u2192 / Space</td><td>next build / slide</td></tr>
313
316
  <tr><td>\u2190</td><td>previous</td></tr>
314
317
  <tr><td>Home / End</td><td>first / last slide</td></tr>
@@ -325,13 +328,13 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),U===void 0&
325
328
  <tr><td>W</td><td>pen \u2014 draw on the slide (\u232B clears)</td></tr>
326
329
  <tr><td>\u21E7W</td><td>laser pointer</td></tr>
327
330
  <tr><td>K</td><td>clock \u2014 wall time + elapsed talk</td></tr>
328
- <tr><td>H</td><td>progress bar \u2014 position in the deck, bottom edge</td></tr>
331
+ <tr><td>J</td><td>progress bar \u2014 position in the deck, bottom edge</td></tr>
332
+ <tr><td>H</td><td>history \u2014 commits, slides and diff per version, \u23CE restores one (author mode; R too)</td></tr>
329
333
  <tr><td>P</td><td>pause / resume narration</td></tr>
330
334
  <tr><td>F</td><td>fullscreen</td></tr>
331
335
  <tr><td>T</td><td>theme picker (type to filter)</td></tr>
332
336
  <tr><td>/</td><td>command palette (find, themes, everything)</td></tr>
333
337
  <tr><td>G</td><td>slide finder (live preview)</td></tr>
334
- <tr><td>R</td><td>restore a version (author mode \u2014 git history, live preview)</td></tr>
335
338
  <tr><td>E</td><td>element edit mode \u2014 right-click a slide element (author mode)</td></tr>
336
339
  <tr><td>, / .</td><td>cycle theme</td></tr>
337
340
  <tr><td>[ / ]</td><td>cycle font</td></tr>
@@ -341,16 +344,16 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),U===void 0&
341
344
  <tr><td>\u2303T</td><td>generate a theme (repeat to re-roll)</td></tr>
342
345
  <tr><td>\u2303\u21E7T</td><td>save the generated theme</td></tr>
343
346
  <tr><td>?</td><td>this help</td></tr>
344
- <tr><td>/</td><td>command palette \u2014 \u201CWelcome to Decklight\u201D reopens the intro</td></tr></table></div>`,Rt.addEventListener("click",Ot),w.appendChild(Rt)}k.register({isOpen:()=>!!Ae,close:Y,keydown:y=>hr(y,{query:ye,onMove:_=>G(Q+_),onCommit:B,onType:_=>{ye+=_,g()},onBackspace:()=>{ye=ye.slice(0,-1),g()},onClear:()=>{ye="",g()},onClose:Y})}),k.register({isOpen:()=>!!ge,close:Je,keydown:y=>hr(y,{onMove:_=>Fe(V+_),onCommit:()=>{_e(V),Je()},onClose:Je})}),k.register({isOpen:()=>!!F,close:W,keydown:y=>hr(y,{query:U,onMove:_=>Be(J+_,!1),onCommit:Ue,onType:_=>P(U+_),onBackspace:()=>P(U.slice(0,-1)),onClear:()=>P(""),onClose:W})}),k.register({isOpen:()=>!!pe,close:Et,keydown(y){switch(y.key){case"ArrowRight":Me(Pe+1);break;case"ArrowLeft":Me(Pe-1);break;case"ArrowDown":Me(Pe+Se());break;case"ArrowUp":Me(Pe-Se());break;case"Enter":case" ":rt();break;case"o":case"O":case"Escape":Et();break;default:return!1}return!0}});let Gt=y=>y.code==="Backquote"||y.key==="`"||y.key==="~"||y.key==="\xB2";function xn(y){if(Gt(y)&&(y.metaKey||y.ctrlKey||y.altKey)){ut(),y.preventDefault();return}if(/^(input|textarea|select)$/i.test(y.target.tagName))return;if(y.ctrlKey&&!y.metaKey&&!y.altKey&&(y.key==="T"||y.key==="t")){y.shiftKey?De():Ce.rollFromPicker()||qe(),y.preventDefault();return}if(y.metaKey||y.ctrlKey||y.altKey)return;let _=k.active();if(_){_.keydown(y)&&y.preventDefault();return}if(Gt(y)){ut(),y.preventDefault();return}switch(y.key){case"ArrowRight":case" ":case"PageDown":te.next();break;case"ArrowLeft":case"PageUp":te.prev();break;case"Home":te.goto(1,0);break;case"End":te.goto(te.state.totalSlides,0);break;case"o":case"O":Et();break;case"b":case"B":Yt();break;case"d":case"D":dt();break;case"c":case"C":Mt();break;case"k":case"K":Jt();break;case"h":case"H":on();break;case"p":case"P":$t();break;case"g":case"G":nt();break;case"r":case"R":xt.restore.open();break;case"e":case"E":T();break;case"f":case"F":H();break;case"v":case"V":y.shiftKey?sn():wt();break;case"n":case"N":Lt();break;case"s":case"S":{let S=te.__speakerWin;S&&!S.closed?S.__decklightSpeakerToggle?.():te.__speakerWin=Wr(te);break}case"t":case"T":Ce.openPicker();break;case"/":X();break;case".":E(1);break;case",":E(-1);break;case">":Ft(.25);break;case"<":Ft(-.25);break;case"]":Le(1);break;case"[":Le(-1);break;case"l":case"L":Pt(y.shiftKey?-1:1);break;case"z":case"Z":an(y.shiftKey?"redo":"undo");break;case"a":case"A":bt();break;case"w":case"W":Qt(y.shiftKey?"laser":"pen");break;case"Backspace":if(!zt.annotator?.active)return;zt.annotator.clear();break;case"?":Ot();break;case"Escape":if(Ie())break;pe&&Et();break;default:return}y.preventDefault()}d||document.addEventListener("keydown",xn);let Wt=null;w.addEventListener("touchstart",y=>{Wt=y.touches[0].clientX},{passive:!0}),w.addEventListener("touchend",y=>{if(Wt==null)return;let _=y.changedTouches[0].clientX-Wt;Math.abs(_)>40&&(_<0?te.next():te.prev()),Wt=null},{passive:!0});function L(){let y=w.getBoundingClientRect(),_=Math.min(y.width/l.width,y.height/l.height)||1;te._scale=_,Ye.style.transform=`translate(-50%, -50%) scale(${_})`}d||(new ResizeObserver(L).observe(w),L());let vn=Ci({sectionsOf:()=>te._sections,checkOverflow:ns}),Vt=y=>vn.watch(y),pt=!1;if(l.hash&&!d&&window.addEventListener("hashchange",()=>{if(pt)return;let y=Xt();y&&te.goto(y.slide,y.step,{force:!0})}),!d){let y=()=>{te._sections.forEach((_,S)=>{let R=_.querySelector(":scope > .slide-bg > video");R&&(S===te.state.slide-1?R.play()?.catch?.(()=>{}):R.paused||R.pause())})};te.on("slide",y)}te.sync(),d&&Oe&&(te._sections.forEach(y=>{y.hasAttribute("data-logo")||y.appendChild(Oe.cloneNode(!0))}),Oe.remove()),document.fonts?.ready?.then(()=>{(Bn===te||!Bn)&&wr(te._sections,l)}),te.theme=y=>Xe(y),te.themePicker={open:Ce.openPicker,close:Ce.closePicker},te.generateTheme=qe,te.cycleFont=Le,te.cycleLayout=Pt,te.layoutRing=Kt,te.toggleMessages=ut,te.messages=Te,te.showWelcome=be.showWelcome,te.tips={show:be.showTip,reset:be.resetTips,set:be.setTips,status:be.status};let At=wi({root:w,stage:Ye,config:l,params:a,printMode:d,toast:Re,logOnly:$e,debugLog:h,overlays:k,instance:te,syncSoundBtn:ie,updateDebugState:It,downloadFromUrl:nn}),{character:rn,toggleNarration:wt,toggleNarrPause:$t,changeNarrRate:Ft,toggleCaptions:Mt,openRecordDialog:sn,notesSegs:hn}=At,Lt=At.openPicker;te.toggleNarration=wt;let zt=ki({root:w,printMode:d,toast:Re,debugLog:h,overlays:k,instance:te,narration:At,downloadFromUrl:nn,setProgressBar:y=>{Ct=y}}),{toggleClock:Jt,toggleProgress:on,toggleInk:Qt,toggleTranscript:Bt}=zt;te.toggleClock=Jt,te.toggleProgress=on;let xt=Si({root:w,config:l,params:a,printMode:d,toast:Re,debugLog:h,overlays:k,instance:te,notesSegs:hn,dismissOthers:()=>{Ce.closePicker(),F&&W(),Ae&&Y()}}),{deckHistory:an,toggleEditor:kn,toggleAgentAsk:bt,toggleElementEdit:T}=xt;if(te.restore=xt.restore,te.wizard=xt.wizard,te.toggleElementEdit=T,a.has("voiceover")&&At.status().track&&!d){let y=()=>{window.removeEventListener("pointerdown",y),window.removeEventListener("keydown",y),At.status().narrating||wt()};window.addEventListener("pointerdown",y,{once:!0}),window.addEventListener("keydown",y,{once:!0})}if(!d){let y=document.createElement("div");y.className="decklight-touch-controls",st=document.createElement("button"),st.type="button",st.className="decklight-touch-btn",st.setAttribute("aria-label","Fullscreen"),st.innerHTML=ot.full,st.addEventListener("click",H),y.appendChild(st),At.status().hasTracks&&(N=document.createElement("button"),N.type="button",N.className="decklight-touch-btn",N.addEventListener("pointerdown",_=>_.stopPropagation()),N.addEventListener("click",()=>wt()),y.appendChild(N),ie()),w.appendChild(y)}if(te.saveGeneratedTheme=y=>De(y),d)return w.classList.add("decklight-print"),te._sections.forEach((y,_)=>{y.classList.add("active"),cn(te._records[_],te._records[_].groups.length)}),(u==="handout"||u==="notes")&&(w.classList.add("decklight-print-"+u),xi(Ye,te._sections,u)),Vt(te._sections),w.__decklight=te,Bn=te,te._emit("ready",{slides:te.state.totalSlides,print:!0}),te;let K=l.hash&&Xt()||{slide:1,step:0};return te._sections.forEach((y,_)=>{_!==K.slide-1&&cn(te._records[_],0)}),te.goto(K.slide,K.step,{force:!0}),w.__decklight=te,Bn=te,te._emit("ready",{slides:te.state.totalSlides}),be.start(K),te}ae();le();ae();le();var rs="\x1B",vr=Object.freeze({fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1});function hd(r){if(r<16)return null;if(r>=16&&r<=231){let l=r-16,d=[0,95,135,175,215,255];return[d[Math.floor(l/36)%6],d[Math.floor(l/6)%6],d[l%6]]}let a=8+(r-232)*10;return[a,a,a]}var Pn=class{constructor(){this.rows=[[]],this.row=0,this.col=0,this.style={...vr},this._pending=""}write(a){let l=this._pending+a;this._pending="";let d=0;for(;d<l.length;){let u=l[d];if(u===rs){let m=this._consumeEscape(l,d);if(m===0){this._pending=l.slice(d);return}d+=m;continue}if(d+=1,u===`
345
- `){this._lineFeed();continue}if(u==="\r"){this.col=0;continue}if(u==="\b"){this.col=Math.max(0,this.col-1);continue}if(u===" "){this.col=(Math.floor(this.col/8)+1)*8;continue}u!=="\x07"&&(u<" "&&u!==" "||this._putChar(u))}}_lineFeed(){this.row+=1,this.rows[this.row]||(this.rows[this.row]=[])}_putChar(a){let l=this.rows[this.row];for(;l.length<this.col;)l.push({ch:" ",style:vr});l[this.col]={ch:a,style:{...this.style}},this.col+=1}_consumeEscape(a,l){if(l+1>=a.length)return 0;let d=a[l+1];if(d==="["){let u=l+2;for(;u<a.length;){let m=a.charCodeAt(u);if(m>=64&&m<=126)return this._handleCsi(a.slice(l+2,u),a[u]),u-l+1;u+=1}return 0}if(d==="]"){let u=l+2;for(;u<a.length;){if(a[u]==="\x07")return u-l+1;if(a[u]===rs&&a[u+1]==="\\")return u-l+2;if(a[u]===rs&&u+1>=a.length)return 0;u+=1}return 0}return d==="("||d===")"?l+2<a.length?3:0:2}_handleCsi(a,l){if(!a.startsWith("?"))switch(l){case"m":this._sgr(a);return;case"K":this._eraseLine(a);return;case"C":this.col+=Math.max(1,parseInt(a||"1",10)||1);return;case"D":this.col=Math.max(0,this.col-Math.max(1,parseInt(a||"1",10)||1));return;default:return}}_eraseLine(a){let l=parseInt(a||"0",10)||0,d=this.rows[this.row];if(l===0){d.length=Math.min(d.length,this.col);return}if(l===1){for(let u=0;u<=Math.min(this.col,d.length-1);u++)d[u]={ch:" ",style:vr};return}if(l===2){d.length=0;return}}_sgr(a){let l=a===""?[0]:a.split(";").map(u=>parseInt(u,10)||0),d=0;for(;d<l.length;){let u=l[d];if(u===0)this.style={...vr};else if(u===1)this.style.bold=!0;else if(u===2)this.style.dim=!0;else if(u===3)this.style.italic=!0;else if(u===4)this.style.underline=!0;else if(u===7)this.style.inverse=!0;else if(u===22)this.style.bold=!1,this.style.dim=!1;else if(u===23)this.style.italic=!1;else if(u===24)this.style.underline=!1;else if(u===27)this.style.inverse=!1;else if(u>=30&&u<=37)this.style.fg={type:"ansi",idx:u-30};else if(u>=90&&u<=97)this.style.fg={type:"ansi",idx:u-90+8};else if(u===39)this.style.fg=null;else if(u>=40&&u<=47)this.style.bg={type:"ansi",idx:u-40};else if(u>=100&&u<=107)this.style.bg={type:"ansi",idx:u-100+8};else if(u===49)this.style.bg=null;else if(u===38||u===48){let m=u===38?"fg":"bg";l[d+1]===5&&l.length>d+2?(this.style[m]={type:"256",idx:l[d+2]},d+=2):l[d+1]===2&&l.length>d+4&&(this.style[m]={type:"rgb",r:l[d+2],g:l[d+3],b:l[d+4]},d+=4)}d+=1}}get lines(){return this.rows.map(a=>{let l=[];for(let d of a){let u=l[l.length-1];u&&md(u.style,d.style)?u.text+=d.ch:l.push({text:d.ch,style:d.style})}return l})}toHtml(){return this.lines.map(a=>gd(a)).join(`
346
- `)}};function md(r,a){return r.bold===a.bold&&r.dim===a.dim&&r.italic===a.italic&&r.underline===a.underline&&r.inverse===a.inverse&&zi(r.fg,a.fg)&&zi(r.bg,a.bg)}function zi(r,a){return r===a?!0:!r||!a?!1:r.type===a.type&&r.idx===a.idx&&r.r===a.r&&r.g===a.g&&r.b===a.b}function fd(r){if(r.type==="256"){if(r.idx<16)return null;let[a,l,d]=hd(r.idx);return`rgb(${a},${l},${d})`}return r.type==="rgb"?`rgb(${r.r},${r.g},${r.b})`:null}function gd(r){return r.map(({text:a,style:l})=>{let d=[],u=[],{fg:m,bg:f}=l;l.inverse&&([m,f]=[f??{type:"inv-default-bg"},m??{type:"inv-default-fg"}]);for(let[A,I]of[[m,"fg"],[f,"bg"]])if(A)if(A.type==="ansi"||A.type==="256"&&A.idx<16)d.push(`ansi-${I}-${A.idx}`);else if(A.type==="inv-default-bg")d.push("ansi-inv-fg");else if(A.type==="inv-default-fg")d.push("ansi-inv-bg");else{let M=fd(A);M&&u.push(`${I==="fg"?"color":"background-color"}:${M}`)}l.bold&&d.push("ansi-bold"),l.dim&&d.push("ansi-dim"),l.italic&&d.push("ansi-italic"),l.underline&&d.push("ansi-underline");let h=vt(a);if(!d.length&&!u.length)return h;let w=d.length?` class="${d.join(" ")}"`:"",k=u.length?` style="${u.join(";")}"`:"";return`<span${w}${k}>${h}</span>`}).join("")}var Ui=24,bd=r=>Math.max(1,Math.min(10,r)),yd=r=>2**((r-5)/2.5),Hi=55,Zn=[120,160],Gi="decklight-term-wpm:"+location.pathname,wd=r=>Zn.reduce((a,l)=>Math.abs(l-r)<Math.abs(a-r)?l:a),Wn=["thocky","creamy","clacky","off"],ji="decklight-term-typesound:"+location.pathname,Ki="decklight-term-fontsize:"+location.pathname,Vn=[.75,.9,1,1.15,1.35,1.6],Wi={thocky:{click:.17,clickF:[680,1250],clickQ:.9,lp:1800,clickDecay:[.012,.017],thump:.008,thumpF:[130,185],thumpF2:[58,85],thumpF2Prob:.22,ring:[.005,.009]},creamy:{click:.3,clickF:[1400,2850],clickQ:.95,lp:3800,clickDecay:[.007,.011],thump:.0056,thumpF:[60,110],ring:[.065,.095]},clacky:{click:.34,clickF:[2300,3900],clickQ:1.1,lp:6800,clickDecay:[.005,.008],thump:.003,thumpF:[90,140],ring:[.035,.055]}};function ss(r){let a=90+Math.random()*120;return Math.random()<.15&&(a+=Math.random()*240),r===" "?a+=70+Math.random()*220:".,:;/|&>-_=\"'`()".includes(r)&&(a+=40+Math.random()*140),Math.random()<.035&&(a+=300+Math.random()*440),a}var xd=.012,yt=null,kr=null,Sr=new Set,Vi=r=>{Sr.add(r),r.addEventListener("ended",()=>Sr.delete(r),{once:!0})};function vd(){if(!yt)return;let r=yt.currentTime;for(let a of Sr)try{a.stop(r)}catch{}Sr.clear()}function Er(r="",a="thocky",l=.12){try{let d=window.AudioContext||window.webkitAudioContext;if(!d)return;if(yt??=new d,yt.state==="suspended"&&yt.resume(),!kr){let q=Math.floor(yt.sampleRate*.06);kr=yt.createBuffer(1,q,yt.sampleRate);let he=kr.getChannelData(0);for(let oe=0;oe<q;oe++)he[oe]=Math.random()*2-1}let u=Wi[a]??Wi.thocky,m=(q,he)=>q+Math.random()*(he-q),f=yt.currentTime+xd,h=r===" ",w=m(.45,1.3)*(h?1.25:1),k=m(...u.clickF)*(h?.7:1),A=m(...u.ring)*(h?1.5:1),I=(q,he,oe,de)=>{let j=yt.createBufferSource();j.buffer=kr;let me=yt.createBiquadFilter();me.type="bandpass",me.frequency.value=oe,me.Q.value=u.clickQ;let Te=yt.createBiquadFilter();Te.type="lowpass",Te.frequency.value=u.lp;let $e=yt.createGain();$e.gain.setValueAtTime(1e-4,q),$e.gain.exponentialRampToValueAtTime(he,q+7e-4),$e.gain.exponentialRampToValueAtTime(1e-4,q+de),j.connect(me),me.connect(Te),Te.connect($e),$e.connect(yt.destination),j.start(q),j.stop(q+de+.01),Vi(j)},M=(q,he,oe,de)=>{let j=yt.createOscillator();j.type="sine",j.frequency.setValueAtTime(oe,q),j.frequency.exponentialRampToValueAtTime(oe*.6,q+de*.6);let me=yt.createGain();me.gain.setValueAtTime(1e-4,q),me.gain.exponentialRampToValueAtTime(he,q+m(.003,.011)),me.gain.exponentialRampToValueAtTime(he*.25,q+de),me.gain.exponentialRampToValueAtTime(1e-4,q+de*2),j.connect(me),me.connect(yt.destination),j.start(q),j.stop(q+de*2+.01),Vi(j)},C=u.thumpF2&&Math.random()<(u.thumpF2Prob??.4)?u.thumpF2:u.thumpF;I(f,u.click*w*(h?.82:1),k,m(...u.clickDecay)*(h?1.2:1)),M(f,u.thump*w*(h?2.4:1),m(...C)*(h?.7:1),A);let $=f+Math.max(.01,Math.min(m(.035,.08),l*.55));I($,u.click*w*m(.35,.55),k*1.15,m(...u.clickDecay)*.8),M($,u.thump*w*(h?.5:.25),m(...C)*(h?.7:1),A*.6)}catch{}}function kd(){try{let r=window.AudioContext||window.webkitAudioContext;if(!r)return;yt??=new r,yt.state==="suspended"&&yt.resume()}catch{}}var Zi=!1;function Ed(){if(Zi||typeof document>"u")return;Zi=!0;let r=()=>{kd(),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0)};document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",r,!0)}function is(r,a=document){let l=[...a.querySelectorAll(".terminal[data-cast], .terminal[data-cast-inline]")];return l.length&&Ed(),Promise.all(l.map(d=>Sd(d,r).catch(u=>{Cd(d,u)})))}async function Sd(r,a){if(r.dataset.decklightTerminal)return;r.dataset.decklightTerminal="1";let l,d,u=r.dataset.castInline;if(u){d=u;let w=document.querySelector(u);if(!w&&document.readyState==="loading"&&(await new Promise(k=>document.addEventListener("DOMContentLoaded",k,{once:!0})),w=document.querySelector(u)),!w)throw new Error(`inline cast not found: ${u}`);l=w.textContent}else{d=r.dataset.cast;let w=await fetch(d);if(!w.ok)throw new Error(`failed to load cast: ${d} (${w.status})`);l=await w.text()}let m=Ad(l,d),f=new os(r,m);r._decklightTerminal=f;let h=r.dataset.mode||"step";m.imported&&h==="step"&&!m.hasMarkers&&(h="play"),h==="play"?f.mountPlayMode():f.mountStepMode(a)}function Ad(r,a){let l=null;try{l=JSON.parse(r)}catch{}if(l){if(l.decklightCast===1&&Array.isArray(l.steps))return l;throw new Error(`not a decklight cast (v1): ${a}`)}return _d(r,a)}function _d(r,a){let l=r.split(`
347
- `).filter(w=>w.trim()),d;try{d=JSON.parse(l[0])}catch{d=null}if(!d||d.version!==2)throw new Error(`not a decklight cast or asciicast v2: ${a}`);let u=[],m={cmd:"",raw:!0,output:[]},f=0,h=!1;for(let w of l.slice(1)){let k;try{k=JSON.parse(w)}catch{continue}if(!Array.isArray(k)||k.length<3)continue;let[A,I,M]=k;I==="m"?(h=!0,m.output.length&&u.push(m),m={cmd:String(M||""),raw:!0,output:[]},f=A):I==="o"&&m.output.push([Math.max(0,Td(A-f)),M])}if(m.output.length&&u.push(m),!u.length)throw new Error(`asciicast has no output events: ${a}`);return{decklightCast:1,imported:!0,hasMarkers:h,meta:{cols:d.width||100,rows:d.height||28,prompt:""},steps:u}}function Td(r){return Math.round(r*1e3)/1e3}function Cd(r,a){r.innerHTML=`<div class="terminal-window terminal-broken"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">terminal</span></div><div class="terminal-screen"><pre class="terminal-lines">\u26A0 ${vt(String(a.message||a))}</pre></div></div>`}var os=class{constructor(a,l){this.el=a,this.cast=l,this.prompt=l.meta.prompt??"$ ";let d=bd(parseInt(a.dataset.typeSpeed??"5",10)||5);this.typeWpm=wd(Hi*yd(d));try{let m=parseInt(localStorage.getItem(Gi)??"",10);Zn.includes(m)&&(this.typeWpm=m)}catch{}a.dataset.typeWpm=String(this.typeWpm),this.fontIdx=Vn.indexOf(1);try{let m=parseInt(localStorage.getItem(Ki)??"",10);m>=0&&m<Vn.length&&(this.fontIdx=m)}catch{}this._applyFont();let u=(a.dataset.typeSound||"thocky").toLowerCase();this.soundName=Wn.includes(u)?u:"thocky";try{let m=localStorage.getItem(ji);m&&Wn.includes(m)&&(this.soundName=m)}catch{}this.typeSound=this.soundName==="off"?null:this.soundName,this.maxStep=(parseFloat(a.dataset.maxStep||"2.5")||2.5)*1e3,this.visibleRows=parseInt(a.dataset.rows||"",10)||Math.min(l.meta.rows||Ui,Ui),this.epoch=0,this.applied=0,this.playable=l.steps.filter(m=>!m.hidden&&m.sleep==null),this._mountChrome(),this._watchSlide()}stop(){if(this.epoch+=1,vd(),this.playing){this.playing=!1;let a=this.controlsEl?.querySelector(".terminal-play");a&&(a.textContent="\u25B6")}}_watchSlide(){let a=this.el.closest("section");if(!a||typeof MutationObserver!="function")return;new MutationObserver(()=>{a.classList.contains("active")||this.stop()}).observe(a,{attributes:!0,attributeFilter:["class"]})}_mountChrome(){let a=this.el.dataset.title||"Terminal";this.el.innerHTML=`<div class="terminal-window"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">${vt(a)}</span><span class="terminal-controls"></span></div><div class="terminal-screen"><pre class="terminal-lines"></pre></div></div>`,this.linesEl=this.el.querySelector(".terminal-lines"),this.screenEl=this.el.querySelector(".terminal-screen"),this.controlsEl=this.el.querySelector(".terminal-controls"),this.screenEl.style.maxHeight=`calc(${this.visibleRows} * var(--term-line-height, 1.45em))`}_renderComplete(a,{withCursor:l=!0}={}){let d=[];for(let u=0;u<a;u++)d.push(this._stepHtml(this.playable[u]));l&&!this.cast.imported&&d.push(this._promptHtml()+'<span class="terminal-cursor"></span>'),this.linesEl.innerHTML=d.join(`
348
- `),this._scrollToEnd()}_stepEvents(a){return[...(a.output||[]).map(([l,d])=>({t:l,kind:"o",d})),...(a.input||[]).map(([l,d])=>({t:l,kind:"i",d:d.replace(/\r?\n$/,"")}))].sort((l,d)=>l.t-d.t)}_stepHtml(a){let l=new Pn;for(let u of this._stepEvents(a))l.write(u.d);let d=l.toHtml();return a.raw?d:this._promptHtml()+`<span class="terminal-cmd">${vt(a.cmd)}</span>`+(d?`
349
- `+d:"")}_promptHtml(){return`<span class="terminal-prompt">${vt(this.prompt)}</span>`}_scrollToEnd(){this.screenEl.scrollTop=this.screenEl.scrollHeight}_applyFont(){let a=Vn[this.fontIdx];this.el.style.fontSize=a===1?"":`${a}em`}_mountFontButton(){let a=document.createElement("button");a.className="terminal-btn terminal-fontsize",a.title="font size: click cycles 75% to 160%",a.setAttribute("aria-label","font size");let l=()=>{a.textContent=`A ${Math.round(Vn[this.fontIdx]*100)}%`};l(),a.addEventListener("click",()=>{this.fontIdx=(this.fontIdx+1)%Vn.length,this._applyFont();try{localStorage.setItem(Ki,String(this.fontIdx))}catch{}l()}),this.controlsEl.appendChild(a)}_mountSpeedButton(){let a=document.createElement("button");a.className="terminal-btn terminal-typespeed",a.title="typing speed: click cycles words per minute",a.setAttribute("aria-label","typing speed");let l=()=>{a.textContent=`\u2328 ${this.typeWpm} wpm`};l(),a.addEventListener("click",()=>{let d=(Zn.indexOf(this.typeWpm)+1)%Zn.length;this.typeWpm=Zn[d],this.el.dataset.typeWpm=String(this.typeWpm);try{localStorage.setItem(Gi,String(this.typeWpm))}catch{}l()}),this.controlsEl.appendChild(a)}_mountSoundButton(){let a=document.createElement("button");a.className="terminal-btn terminal-typesound",a.title="key sound: click cycles thocky, creamy, clacky, off",a.setAttribute("aria-label","key sound");let l=()=>{a.textContent=`\u266A ${this.soundName}`};l(),a.addEventListener("click",()=>{let d=(Wn.indexOf(this.soundName)+1)%Wn.length;this.soundName=Wn[d],this.typeSound=this.soundName==="off"?null:this.soundName,this.el.dataset.typeSound=this.soundName;try{localStorage.setItem(ji,this.soundName)}catch{}this.typeSound&&Er("a",this.typeSound,.12),l()}),this.controlsEl.appendChild(a)}_typeFactor(a,l=!1){return(l&&this.speed||1)*(this.typeWpm/Hi)*(a.typeSpeed||1)}async _typeCmd(a,l,d,u,m=!1){for(let f=1;f<=a.length;f++){if(this.epoch!==u)return!1;let h=a[f-1],w=ss(h)/this._typeFactor(d,m);this.typeSound&&Er(h,this.typeSound,w/1e3),this.linesEl.innerHTML=l+this._promptHtml()+`<span class="terminal-cmd">${vt(a.slice(0,f))}</span><span class="terminal-cursor"></span>`,this._scrollToEnd(),await pn(w)}return!0}mountStepMode(a){this.controlsEl.innerHTML="",this._mountSpeedButton(),this._mountSoundButton(),this._mountFontButton();let l=this.playable,d=Math.min(Math.max(parseInt(this.el.dataset.poster||"0",10)||0,0),l.length);if(this.applied=d,this._renderComplete(d),!a||typeof a.registerBuildProvider!="function"){this._renderComplete(l.length,{withCursor:!1});return}a.registerBuildProvider(this.el,{count:l.length-d,label:u=>l[d+u]?`${this.prompt}${l[d+u].cmd||"\u25B6 recording"}`:"",apply:u=>this.applyStep(d+Math.max(0,Math.min(u,l.length-d)))})}applyStep(a){this.epoch+=1;let l=a===this.applied+1;if(this.applied=a,!l){this._renderComplete(a);return}this._animateStep(a-1,this.epoch)}async _animateStep(a,l){let d=this.playable[a],u=[];for(let C=0;C<a;C++)u.push(this._stepHtml(this.playable[C]));let m=u.length?u.join(`
347
+ <tr><td>/</td><td>command palette \u2014 \u201CWelcome to Decklight\u201D reopens the intro</td></tr></table></div>`,yt.addEventListener("click",I),b.appendChild(yt)}k.register({isOpen:()=>!!_e,close:Ee,keydown:v=>Er(v,{query:Re,onMove:H=>pe(Y+H),onCommit:Se,onType:H=>{Re+=H,w()},onBackspace:()=>{Re=Re.slice(0,-1),w()},onClear:()=>{Re="",w()},onClose:Ee})}),k.register({isOpen:()=>!!ze,close:Et,keydown:v=>Er(v,{onMove:H=>gt(oe+H),onCommit:()=>{et(oe),Et()},onClose:Et})}),k.register({isOpen:()=>!!O,close:K,keydown:v=>Er(v,{query:V,onMove:H=>Fe(D+H,!1),onCommit:ot,onType:H=>B(V+H),onBackspace:()=>B(V.slice(0,-1)),onClear:()=>B(""),onClose:K})}),k.register({isOpen:()=>!!fe,close:pt,keydown(v){switch(v.key){case"ArrowRight":Ye(Qe+1);break;case"ArrowLeft":Ye(Qe-1);break;case"ArrowDown":Ye(Qe+Pe());break;case"ArrowUp":Ye(Qe-Pe());break;case"Enter":case" ":ut();break;case"o":case"O":case"Escape":pt();break;default:return!1}return!0}});let Tn=v=>v.code==="Backquote"||v.key==="`"||v.key==="~"||v.key==="\xB2";function nn(v){if(Tn(v)&&(v.metaKey||v.ctrlKey||v.altKey)){tn(),v.preventDefault();return}if(/^(input|textarea|select)$/i.test(v.target.tagName))return;if(v.ctrlKey&&!v.metaKey&&!v.altKey&&(v.key==="T"||v.key==="t")){v.shiftKey?je():Le.rollFromPicker()||Je(),v.preventDefault();return}if(v.metaKey||v.ctrlKey||v.altKey)return;let H=k.active();if(H){H.keydown(v)&&v.preventDefault();return}if(Tn(v)){tn(),v.preventDefault();return}switch(v.key){case"ArrowRight":case" ":case"PageDown":Q.next();break;case"ArrowLeft":case"PageUp":Q.prev();break;case"Home":Q.goto(1,0);break;case"End":Q.goto(Q.state.totalSlides,0);break;case"o":case"O":pt();break;case"b":case"B":ht();break;case"d":case"D":an();break;case"c":case"C":$n();break;case"k":case"K":Gt();break;case"j":case"J":jt();break;case"h":case"H":Tt.history.open();break;case"p":case"P":gn();break;case"g":case"G":mt();break;case"r":case"R":Tt.history.open();break;case"e":case"E":yn();break;case"f":case"F":Z();break;case"v":case"V":v.shiftKey?St():rn();break;case"n":case"N":sn();break;case"s":case"S":{let G=Q.__speakerWin;G&&!G.closed?G.__decklightSpeakerToggle?.():Q.__speakerWin=ts(Q);break}case"t":case"T":Le.openPicker();break;case"/":it();break;case".":_(1);break;case",":_(-1);break;case">":Yt(.25);break;case"<":Yt(-.25);break;case"]":tt(1);break;case"[":tt(-1);break;case"l":case"L":Vt(v.shiftKey?-1:1);break;case"z":case"Z":un(v.shiftKey?"redo":"undo");break;case"a":case"A":On();break;case"w":case"W":dn(v.shiftKey?"laser":"pen");break;case"Backspace":if(!Mt.annotator?.active)return;Mt.annotator.clear();break;case"?":I();break;case"Escape":if(qe())break;fe&&pt();break;default:return}v.preventDefault()}d||document.addEventListener("keydown",nn);let Xt=null;b.addEventListener("touchstart",v=>{Xt=v.touches[0].clientX},{passive:!0}),b.addEventListener("touchend",v=>{if(Xt==null)return;let H=v.changedTouches[0].clientX-Xt;Math.abs(H)>40&&(H<0?Q.next():Q.prev()),Xt=null},{passive:!0});function hn(){let v=b.getBoundingClientRect(),H=Math.min(v.width/l.width,v.height/l.height)||1;Q._scale=H,ft.style.transform=`translate(-50%, -50%) scale(${H})`}d||(new ResizeObserver(hn).observe(b),hn());let Cn=Bi({sectionsOf:()=>Q._sections,checkOverflow:ds}),Qt=v=>Cn.watch(v),cn=!1;if(l.hash&&!d&&window.addEventListener("hashchange",()=>{if(cn)return;let v=U();v&&Q.goto(v.slide,v.step,{force:!0})}),!d){let v=()=>{Q._sections.forEach((H,G)=>{let ve=H.querySelector(":scope > .slide-bg > video");ve&&(G===Q.state.slide-1?ve.play()?.catch?.(()=>{}):ve.paused||ve.pause())})};Q.on("slide",v)}Q.sync(),d&&He&&(Q._sections.forEach(v=>{v.hasAttribute("data-logo")||v.appendChild(He.cloneNode(!0))}),He.remove()),document.fonts?.ready?.then(()=>{(Xn===Q||!Xn)&&Nr(Q._sections,l)}),Q.theme=v=>st(v),Q.themePicker={open:Le.openPicker,close:Le.closePicker},Q.generateTheme=Je,Q.cycleFont=tt,Q.cycleLayout=Vt,Q.layoutRing=Ot,Q.toggleMessages=tn,Q.messages=Oe,Q.showWelcome=xe.showWelcome,Q.tips={show:xe.showTip,reset:xe.resetTips,set:xe.setTips,status:xe.status};let Rt=Ei({root:b,stage:ft,config:l,params:i,printMode:d,toast:De,logOnly:ke,debugLog:h,overlays:k,instance:Q,syncSoundBtn:te,updateDebugState:Pt,downloadFromUrl:Zt,authorBase:()=>Tt?.available()?Tt.base():null}),{character:Nn,toggleNarration:rn,toggleNarrPause:gn,changeNarrRate:Yt,toggleCaptions:$n,openRecordDialog:St,notesSegs:Bn}=Rt,sn=Rt.openPicker;Q.toggleNarration=rn;let Mt=_i({root:b,printMode:d,toast:De,debugLog:h,overlays:k,instance:Q,narration:Rt,downloadFromUrl:Zt,setProgressBar:v=>{se=v}}),{toggleClock:Gt,toggleProgress:jt,toggleInk:dn,toggleTranscript:kt}=Mt;Q.toggleClock=Gt,Q.toggleProgress=jt;let Tt=Mi({root:b,config:l,params:i,printMode:d,toast:De,debugLog:h,overlays:k,instance:Q,notesSegs:Bn,dismissOthers:()=>{Le.closePicker(),O&&K(),_e&&Ee()}}),{deckHistory:un,toggleEditor:bn,toggleAgentAsk:On,toggleElementEdit:yn}=Tt;if(Q.restore=Tt.restore,Q.wizard=Tt.wizard,Q.toggleElementEdit=yn,i.has("voiceover")&&Rt.status().track&&!d){let v=()=>{window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v),Rt.status().narrating||rn()};window.addEventListener("pointerdown",v,{once:!0}),window.addEventListener("keydown",v,{once:!0})}if(!d){let v=document.createElement("div");v.className="decklight-touch-controls",L=document.createElement("button"),L.type="button",L.className="decklight-touch-btn",L.setAttribute("aria-label","Fullscreen"),L.innerHTML=S.full,L.addEventListener("click",Z),v.appendChild(L),Rt.status().hasTracks&&($=document.createElement("button"),$.type="button",$.className="decklight-touch-btn",$.addEventListener("pointerdown",H=>H.stopPropagation()),$.addEventListener("click",()=>rn()),v.appendChild($),te()),b.appendChild(v)}if(Q.saveGeneratedTheme=v=>je(v),d)return b.classList.add("decklight-print"),Q._sections.forEach((v,H)=>{v.classList.add("active"),En(Q._records[H],Q._records[H].groups.length)}),(u==="handout"||u==="notes")&&(b.classList.add("decklight-print-"+u),Si(ft,Q._sections,u)),Qt(Q._sections),b.__decklight=Q,Xn=Q,Q._emit("ready",{slides:Q.state.totalSlides,print:!0}),Q;let wn=l.hash&&U()||{slide:1,step:0};return Q._sections.forEach((v,H)=>{H!==wn.slide-1&&En(Q._records[H],0)}),Q.goto(wn.slide,wn.step,{force:!0}),b.__decklight=Q,Xn=Q,Q._emit("ready",{slides:Q.state.totalSlides}),xe.start(wn),Q}le();ce();le();ce();var us="\x1B",Or=Object.freeze({fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1});function Ed(r){if(r<16)return null;if(r>=16&&r<=231){let l=r-16,d=[0,95,135,175,215,255];return[d[Math.floor(l/36)%6],d[Math.floor(l/6)%6],d[l%6]]}let i=8+(r-232)*10;return[i,i,i]}var Yn=class{constructor(){this.rows=[[]],this.row=0,this.col=0,this.style={...Or},this._pending=""}write(i){let l=this._pending+i;this._pending="";let d=0;for(;d<l.length;){let u=l[d];if(u===us){let m=this._consumeEscape(l,d);if(m===0){this._pending=l.slice(d);return}d+=m;continue}if(d+=1,u===`
348
+ `){this._lineFeed();continue}if(u==="\r"){this.col=0;continue}if(u==="\b"){this.col=Math.max(0,this.col-1);continue}if(u===" "){this.col=(Math.floor(this.col/8)+1)*8;continue}u!=="\x07"&&(u<" "&&u!==" "||this._putChar(u))}}_lineFeed(){this.row+=1,this.rows[this.row]||(this.rows[this.row]=[])}_putChar(i){let l=this.rows[this.row];for(;l.length<this.col;)l.push({ch:" ",style:Or});l[this.col]={ch:i,style:{...this.style}},this.col+=1}_consumeEscape(i,l){if(l+1>=i.length)return 0;let d=i[l+1];if(d==="["){let u=l+2;for(;u<i.length;){let m=i.charCodeAt(u);if(m>=64&&m<=126)return this._handleCsi(i.slice(l+2,u),i[u]),u-l+1;u+=1}return 0}if(d==="]"){let u=l+2;for(;u<i.length;){if(i[u]==="\x07")return u-l+1;if(i[u]===us&&i[u+1]==="\\")return u-l+2;if(i[u]===us&&u+1>=i.length)return 0;u+=1}return 0}return d==="("||d===")"?l+2<i.length?3:0:2}_handleCsi(i,l){if(!i.startsWith("?"))switch(l){case"m":this._sgr(i);return;case"K":this._eraseLine(i);return;case"C":this.col+=Math.max(1,parseInt(i||"1",10)||1);return;case"D":this.col=Math.max(0,this.col-Math.max(1,parseInt(i||"1",10)||1));return;default:return}}_eraseLine(i){let l=parseInt(i||"0",10)||0,d=this.rows[this.row];if(l===0){d.length=Math.min(d.length,this.col);return}if(l===1){for(let u=0;u<=Math.min(this.col,d.length-1);u++)d[u]={ch:" ",style:Or};return}if(l===2){d.length=0;return}}_sgr(i){let l=i===""?[0]:i.split(";").map(u=>parseInt(u,10)||0),d=0;for(;d<l.length;){let u=l[d];if(u===0)this.style={...Or};else if(u===1)this.style.bold=!0;else if(u===2)this.style.dim=!0;else if(u===3)this.style.italic=!0;else if(u===4)this.style.underline=!0;else if(u===7)this.style.inverse=!0;else if(u===22)this.style.bold=!1,this.style.dim=!1;else if(u===23)this.style.italic=!1;else if(u===24)this.style.underline=!1;else if(u===27)this.style.inverse=!1;else if(u>=30&&u<=37)this.style.fg={type:"ansi",idx:u-30};else if(u>=90&&u<=97)this.style.fg={type:"ansi",idx:u-90+8};else if(u===39)this.style.fg=null;else if(u>=40&&u<=47)this.style.bg={type:"ansi",idx:u-40};else if(u>=100&&u<=107)this.style.bg={type:"ansi",idx:u-100+8};else if(u===49)this.style.bg=null;else if(u===38||u===48){let m=u===38?"fg":"bg";l[d+1]===5&&l.length>d+2?(this.style[m]={type:"256",idx:l[d+2]},d+=2):l[d+1]===2&&l.length>d+4&&(this.style[m]={type:"rgb",r:l[d+2],g:l[d+3],b:l[d+4]},d+=4)}d+=1}}get lines(){return this.rows.map(i=>{let l=[];for(let d of i){let u=l[l.length-1];u&&Sd(u.style,d.style)?u.text+=d.ch:l.push({text:d.ch,style:d.style})}return l})}toHtml(){return this.lines.map(i=>_d(i)).join(`
349
+ `)}};function Sd(r,i){return r.bold===i.bold&&r.dim===i.dim&&r.italic===i.italic&&r.underline===i.underline&&r.inverse===i.inverse&&Zi(r.fg,i.fg)&&Zi(r.bg,i.bg)}function Zi(r,i){return r===i?!0:!r||!i?!1:r.type===i.type&&r.idx===i.idx&&r.r===i.r&&r.g===i.g&&r.b===i.b}function Ad(r){if(r.type==="256"){if(r.idx<16)return null;let[i,l,d]=Ed(r.idx);return`rgb(${i},${l},${d})`}return r.type==="rgb"?`rgb(${r.r},${r.g},${r.b})`:null}function _d(r){return r.map(({text:i,style:l})=>{let d=[],u=[],{fg:m,bg:f}=l;l.inverse&&([m,f]=[f??{type:"inv-default-bg"},m??{type:"inv-default-fg"}]);for(let[A,P]of[[m,"fg"],[f,"bg"]])if(A)if(A.type==="ansi"||A.type==="256"&&A.idx<16)d.push(`ansi-${P}-${A.idx}`);else if(A.type==="inv-default-bg")d.push("ansi-inv-fg");else if(A.type==="inv-default-fg")d.push("ansi-inv-bg");else{let M=Ad(A);M&&u.push(`${P==="fg"?"color":"background-color"}:${M}`)}l.bold&&d.push("ansi-bold"),l.dim&&d.push("ansi-dim"),l.italic&&d.push("ansi-italic"),l.underline&&d.push("ansi-underline");let h=$t(i);if(!d.length&&!u.length)return h;let b=d.length?` class="${d.join(" ")}"`:"",k=u.length?` style="${u.join(";")}"`:"";return`<span${b}${k}>${h}</span>`}).join("")}var Xi=24,Td=r=>Math.max(1,Math.min(10,r)),Cd=r=>2**((r-5)/2.5),Yi=55,ar=[120,160],Ji="decklight-term-wpm:"+location.pathname,Nd=r=>ar.reduce((i,l)=>Math.abs(l-r)<Math.abs(i-r)?l:i),or=["thocky","creamy","clacky","off"],Qi="decklight-term-typesound:"+location.pathname,ea="decklight-term-fontsize:"+location.pathname,ir=[.75,.9,1,1.15,1.35,1.6],ta={thocky:{click:.17,clickF:[680,1250],clickQ:.9,lp:1800,clickDecay:[.012,.017],thump:.008,thumpF:[130,185],thumpF2:[58,85],thumpF2Prob:.22,ring:[.005,.009]},creamy:{click:.3,clickF:[1400,2850],clickQ:.95,lp:3800,clickDecay:[.007,.011],thump:.0056,thumpF:[60,110],ring:[.065,.095]},clacky:{click:.34,clickF:[2300,3900],clickQ:1.1,lp:6800,clickDecay:[.005,.008],thump:.003,thumpF:[90,140],ring:[.035,.055]}};function ps(r){let i=90+Math.random()*120;return Math.random()<.15&&(i+=Math.random()*240),r===" "?i+=70+Math.random()*220:".,:;/|&>-_=\"'`()".includes(r)&&(i+=40+Math.random()*140),Math.random()<.035&&(i+=300+Math.random()*440),i}var $d=.012,Bt=null,Mr=null,Rr=new Set,na=r=>{Rr.add(r),r.addEventListener("ended",()=>Rr.delete(r),{once:!0})};function Od(){if(!Bt)return;let r=Bt.currentTime;for(let i of Rr)try{i.stop(r)}catch{}Rr.clear()}function Lr(r="",i="thocky",l=.12){try{let d=window.AudioContext||window.webkitAudioContext;if(!d)return;if(Bt??=new d,Bt.state==="suspended"&&Bt.resume(),!Mr){let F=Math.floor(Bt.sampleRate*.06);Mr=Bt.createBuffer(1,F,Bt.sampleRate);let ye=Mr.getChannelData(0);for(let ge=0;ge<F;ge++)ye[ge]=Math.random()*2-1}let u=ta[i]??ta.thocky,m=(F,ye)=>F+Math.random()*(ye-F),f=Bt.currentTime+$d,h=r===" ",b=m(.45,1.3)*(h?1.25:1),k=m(...u.clickF)*(h?.7:1),A=m(...u.ring)*(h?1.5:1),P=(F,ye,ge,be)=>{let J=Bt.createBufferSource();J.buffer=Mr;let de=Bt.createBiquadFilter();de.type="bandpass",de.frequency.value=ge,de.Q.value=u.clickQ;let Oe=Bt.createBiquadFilter();Oe.type="lowpass",Oe.frequency.value=u.lp;let ke=Bt.createGain();ke.gain.setValueAtTime(1e-4,F),ke.gain.exponentialRampToValueAtTime(ye,F+7e-4),ke.gain.exponentialRampToValueAtTime(1e-4,F+be),J.connect(de),de.connect(Oe),Oe.connect(ke),ke.connect(Bt.destination),J.start(F),J.stop(F+be+.01),na(J)},M=(F,ye,ge,be)=>{let J=Bt.createOscillator();J.type="sine",J.frequency.setValueAtTime(ge,F),J.frequency.exponentialRampToValueAtTime(ge*.6,F+be*.6);let de=Bt.createGain();de.gain.setValueAtTime(1e-4,F),de.gain.exponentialRampToValueAtTime(ye,F+m(.003,.011)),de.gain.exponentialRampToValueAtTime(ye*.25,F+be),de.gain.exponentialRampToValueAtTime(1e-4,F+be*2),J.connect(de),de.connect(Bt.destination),J.start(F),J.stop(F+be*2+.01),na(J)},T=u.thumpF2&&Math.random()<(u.thumpF2Prob??.4)?u.thumpF2:u.thumpF;P(f,u.click*b*(h?.82:1),k,m(...u.clickDecay)*(h?1.2:1)),M(f,u.thump*b*(h?2.4:1),m(...T)*(h?.7:1),A);let C=f+Math.max(.01,Math.min(m(.035,.08),l*.55));P(C,u.click*b*m(.35,.55),k*1.15,m(...u.clickDecay)*.8),M(C,u.thump*b*(h?.5:.25),m(...T)*(h?.7:1),A*.6)}catch{}}function Md(){try{let r=window.AudioContext||window.webkitAudioContext;if(!r)return;Bt??=new r,Bt.state==="suspended"&&Bt.resume()}catch{}}var ra=!1;function Ld(){if(ra||typeof document>"u")return;ra=!0;let r=()=>{Md(),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0)};document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",r,!0)}function ms(r,i=document){let l=[...i.querySelectorAll(".terminal[data-cast], .terminal[data-cast-inline]")];return l.length&&Ld(),Promise.all(l.map(d=>Rd(d,r).catch(u=>{Dd(d,u)})))}async function Rd(r,i){if(r.dataset.decklightTerminal)return;r.dataset.decklightTerminal="1";let l,d,u=r.dataset.castInline;if(u){d=u;let b=document.querySelector(u);if(!b&&document.readyState==="loading"&&(await new Promise(k=>document.addEventListener("DOMContentLoaded",k,{once:!0})),b=document.querySelector(u)),!b)throw new Error(`inline cast not found: ${u}`);l=b.textContent}else{d=r.dataset.cast;let b=await fetch(d);if(!b.ok)throw new Error(`failed to load cast: ${d} (${b.status})`);l=await b.text()}let m=Id(l,d),f=new hs(r,m);r._decklightTerminal=f;let h=r.dataset.mode||"step";m.imported&&h==="step"&&!m.hasMarkers&&(h="play"),h==="play"?f.mountPlayMode():f.mountStepMode(i)}function Id(r,i){let l=null;try{l=JSON.parse(r)}catch{}if(l){if(l.decklightCast===1&&Array.isArray(l.steps))return l;throw new Error(`not a decklight cast (v1): ${i}`)}return Bd(r,i)}function Bd(r,i){let l=r.split(`
350
+ `).filter(b=>b.trim()),d;try{d=JSON.parse(l[0])}catch{d=null}if(!d||d.version!==2)throw new Error(`not a decklight cast or asciicast v2: ${i}`);let u=[],m={cmd:"",raw:!0,output:[]},f=0,h=!1;for(let b of l.slice(1)){let k;try{k=JSON.parse(b)}catch{continue}if(!Array.isArray(k)||k.length<3)continue;let[A,P,M]=k;P==="m"?(h=!0,m.output.length&&u.push(m),m={cmd:String(M||""),raw:!0,output:[]},f=A):P==="o"&&m.output.push([Math.max(0,Pd(A-f)),M])}if(m.output.length&&u.push(m),!u.length)throw new Error(`asciicast has no output events: ${i}`);return{decklightCast:1,imported:!0,hasMarkers:h,meta:{cols:d.width||100,rows:d.height||28,prompt:""},steps:u}}function Pd(r){return Math.round(r*1e3)/1e3}function Dd(r,i){r.innerHTML=`<div class="terminal-window terminal-broken"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">terminal</span></div><div class="terminal-screen"><pre class="terminal-lines">\u26A0 ${$t(String(i.message||i))}</pre></div></div>`}var hs=class{constructor(i,l){this.el=i,this.cast=l,this.prompt=l.meta.prompt??"$ ";let d=Td(parseInt(i.dataset.typeSpeed??"5",10)||5);this.typeWpm=Nd(Yi*Cd(d));try{let m=parseInt(localStorage.getItem(Ji)??"",10);ar.includes(m)&&(this.typeWpm=m)}catch{}i.dataset.typeWpm=String(this.typeWpm),this.fontIdx=ir.indexOf(1);try{let m=parseInt(localStorage.getItem(ea)??"",10);m>=0&&m<ir.length&&(this.fontIdx=m)}catch{}this._applyFont();let u=(i.dataset.typeSound||"thocky").toLowerCase();this.soundName=or.includes(u)?u:"thocky";try{let m=localStorage.getItem(Qi);m&&or.includes(m)&&(this.soundName=m)}catch{}this.typeSound=this.soundName==="off"?null:this.soundName,this.maxStep=(parseFloat(i.dataset.maxStep||"2.5")||2.5)*1e3,this.visibleRows=parseInt(i.dataset.rows||"",10)||Math.min(l.meta.rows||Xi,Xi),this.epoch=0,this.applied=0,this.playable=l.steps.filter(m=>!m.hidden&&m.sleep==null),this._mountChrome(),this._watchSlide()}stop(){if(this.epoch+=1,Od(),this.playing){this.playing=!1;let i=this.controlsEl?.querySelector(".terminal-play");i&&(i.textContent="\u25B6")}}_watchSlide(){let i=this.el.closest("section");if(!i||typeof MutationObserver!="function")return;new MutationObserver(()=>{i.classList.contains("active")||this.stop()}).observe(i,{attributes:!0,attributeFilter:["class"]})}_mountChrome(){let i=this.el.dataset.title||"Terminal";this.el.innerHTML=`<div class="terminal-window"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">${$t(i)}</span><span class="terminal-controls"></span></div><div class="terminal-screen"><pre class="terminal-lines"></pre></div></div>`,this.linesEl=this.el.querySelector(".terminal-lines"),this.screenEl=this.el.querySelector(".terminal-screen"),this.controlsEl=this.el.querySelector(".terminal-controls"),this.screenEl.style.maxHeight=`calc(${this.visibleRows} * var(--term-line-height, 1.45em))`}_renderComplete(i,{withCursor:l=!0}={}){let d=[];for(let u=0;u<i;u++)d.push(this._stepHtml(this.playable[u]));l&&!this.cast.imported&&d.push(this._promptHtml()+'<span class="terminal-cursor"></span>'),this.linesEl.innerHTML=d.join(`
351
+ `),this._scrollToEnd()}_stepEvents(i){return[...(i.output||[]).map(([l,d])=>({t:l,kind:"o",d})),...(i.input||[]).map(([l,d])=>({t:l,kind:"i",d:d.replace(/\r?\n$/,"")}))].sort((l,d)=>l.t-d.t)}_stepHtml(i){let l=new Yn;for(let u of this._stepEvents(i))l.write(u.d);let d=l.toHtml();return i.raw?d:this._promptHtml()+`<span class="terminal-cmd">${$t(i.cmd)}</span>`+(d?`
352
+ `+d:"")}_promptHtml(){return`<span class="terminal-prompt">${$t(this.prompt)}</span>`}_scrollToEnd(){this.screenEl.scrollTop=this.screenEl.scrollHeight}_applyFont(){let i=ir[this.fontIdx];this.el.style.fontSize=i===1?"":`${i}em`}_mountFontButton(){let i=document.createElement("button");i.className="terminal-btn terminal-fontsize",i.title="font size: click cycles 75% to 160%",i.setAttribute("aria-label","font size");let l=()=>{i.textContent=`A ${Math.round(ir[this.fontIdx]*100)}%`};l(),i.addEventListener("click",()=>{this.fontIdx=(this.fontIdx+1)%ir.length,this._applyFont();try{localStorage.setItem(ea,String(this.fontIdx))}catch{}l()}),this.controlsEl.appendChild(i)}_mountSpeedButton(){let i=document.createElement("button");i.className="terminal-btn terminal-typespeed",i.title="typing speed: click cycles words per minute",i.setAttribute("aria-label","typing speed");let l=()=>{i.textContent=`\u2328 ${this.typeWpm} wpm`};l(),i.addEventListener("click",()=>{let d=(ar.indexOf(this.typeWpm)+1)%ar.length;this.typeWpm=ar[d],this.el.dataset.typeWpm=String(this.typeWpm);try{localStorage.setItem(Ji,String(this.typeWpm))}catch{}l()}),this.controlsEl.appendChild(i)}_mountSoundButton(){let i=document.createElement("button");i.className="terminal-btn terminal-typesound",i.title="key sound: click cycles thocky, creamy, clacky, off",i.setAttribute("aria-label","key sound");let l=()=>{i.textContent=`\u266A ${this.soundName}`};l(),i.addEventListener("click",()=>{let d=(or.indexOf(this.soundName)+1)%or.length;this.soundName=or[d],this.typeSound=this.soundName==="off"?null:this.soundName,this.el.dataset.typeSound=this.soundName;try{localStorage.setItem(Qi,this.soundName)}catch{}this.typeSound&&Lr("a",this.typeSound,.12),l()}),this.controlsEl.appendChild(i)}_typeFactor(i,l=!1){return(l&&this.speed||1)*(this.typeWpm/Yi)*(i.typeSpeed||1)}async _typeCmd(i,l,d,u,m=!1){for(let f=1;f<=i.length;f++){if(this.epoch!==u)return!1;let h=i[f-1],b=ps(h)/this._typeFactor(d,m);this.typeSound&&Lr(h,this.typeSound,b/1e3),this.linesEl.innerHTML=l+this._promptHtml()+`<span class="terminal-cmd">${$t(i.slice(0,f))}</span><span class="terminal-cursor"></span>`,this._scrollToEnd(),await _n(b)}return!0}mountStepMode(i){this.controlsEl.innerHTML="",this._mountSpeedButton(),this._mountSoundButton(),this._mountFontButton();let l=this.playable,d=Math.min(Math.max(parseInt(this.el.dataset.poster||"0",10)||0,0),l.length);if(this.applied=d,this._renderComplete(d),!i||typeof i.registerBuildProvider!="function"){this._renderComplete(l.length,{withCursor:!1});return}i.registerBuildProvider(this.el,{count:l.length-d,label:u=>l[d+u]?`${this.prompt}${l[d+u].cmd||"\u25B6 recording"}`:"",apply:u=>this.applyStep(d+Math.max(0,Math.min(u,l.length-d)))})}applyStep(i){this.epoch+=1;let l=i===this.applied+1;if(this.applied=i,!l){this._renderComplete(i);return}this._animateStep(i-1,this.epoch)}async _animateStep(i,l){let d=this.playable[i],u=[];for(let T=0;T<i;T++)u.push(this._stepHtml(this.playable[T]));let m=u.length?u.join(`
350
353
  `)+`
351
- `:"",f=d.cmd||"";if(!d.raw){if(!await this._typeCmd(f,m,d,l))return;await pn(120/this._typeFactor(d))}let h=this._stepEvents(d),w=h.length?h[h.length-1].t*1e3:0,k=w>this.maxStep?this.maxStep/w:1,A=new Pn,I=()=>{let C=A.toHtml();this.linesEl.innerHTML=d.raw?m+C:m+this._promptHtml()+`<span class="terminal-cmd">${vt(f)}</span>`+(C?`
352
- `+C:""),this._scrollToEnd()},M=0;for(let C of h){let $=Math.min((C.t-M)*1e3*k,400);if(M=C.t,$>8&&await pn($),this.epoch!==l)return;if(C.kind==="i")for(let q of C.d){if(this.epoch!==l)return;let he=ss(q)/this._typeFactor(d);this.typeSound&&Er(q,this.typeSound,he/1e3),A.write(q),I(),await pn(he)}else A.write(C.d),I()}this.epoch===l&&this._renderComplete(a+1)}mountPlayMode(){let a=[1,2,4],l=parseFloat(this.el.dataset.speed);this.speed=a.includes(l)?l:1,this.playing=!1,this.controlsEl.innerHTML=`<button class="terminal-btn terminal-play" aria-label="play">\u25B6</button><button class="terminal-btn terminal-speed" aria-label="speed">${this.speed}\xD7</button><button class="terminal-btn terminal-restart" aria-label="restart">\u21BA</button>`,this._mountSoundButton(),this._mountFontButton();let d=this.controlsEl.querySelector(".terminal-play"),u=this.controlsEl.querySelector(".terminal-speed");this.controlsEl.querySelector(".terminal-restart").addEventListener("click",()=>this._restart(d)),u.addEventListener("click",()=>{this.speed=this.speed>=4?1:this.speed*2,u.textContent=`${this.speed}\xD7`}),d.addEventListener("click",()=>{this.playing?this.stop():(d.textContent="\u23F8",this._playAll(d))}),this._renderComplete(0)}_restart(a){this.stop(),a.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(0)}async _playAll(a){this.playing=!0;let l=++this.epoch,d=this._playedUpTo||0;for(let u=d;u<this.cast.steps.length;u++){let m=this.cast.steps[u];if(m.hidden){this._playedUpTo=u+1;continue}if(m.sleep!=null){if(await pn(m.sleep*1e3/this.speed),this.epoch!==l){this._playedUpTo=u;return}this._playedUpTo=u+1;continue}let h=this.cast.steps.slice(0,u).filter(C=>!C.hidden&&C.sleep==null).map(C=>this._stepHtml(C)),w=h.length?h.join(`
354
+ `:"",f=d.cmd||"";if(!d.raw){if(!await this._typeCmd(f,m,d,l))return;await _n(120/this._typeFactor(d))}let h=this._stepEvents(d),b=h.length?h[h.length-1].t*1e3:0,k=b>this.maxStep?this.maxStep/b:1,A=new Yn,P=()=>{let T=A.toHtml();this.linesEl.innerHTML=d.raw?m+T:m+this._promptHtml()+`<span class="terminal-cmd">${$t(f)}</span>`+(T?`
355
+ `+T:""),this._scrollToEnd()},M=0;for(let T of h){let C=Math.min((T.t-M)*1e3*k,400);if(M=T.t,C>8&&await _n(C),this.epoch!==l)return;if(T.kind==="i")for(let F of T.d){if(this.epoch!==l)return;let ye=ps(F)/this._typeFactor(d);this.typeSound&&Lr(F,this.typeSound,ye/1e3),A.write(F),P(),await _n(ye)}else A.write(T.d),P()}this.epoch===l&&this._renderComplete(i+1)}mountPlayMode(){let i=[1,2,4],l=parseFloat(this.el.dataset.speed);this.speed=i.includes(l)?l:1,this.playing=!1,this.controlsEl.innerHTML=`<button class="terminal-btn terminal-play" aria-label="play">\u25B6</button><button class="terminal-btn terminal-speed" aria-label="speed">${this.speed}\xD7</button><button class="terminal-btn terminal-restart" aria-label="restart">\u21BA</button>`,this._mountSoundButton(),this._mountFontButton();let d=this.controlsEl.querySelector(".terminal-play"),u=this.controlsEl.querySelector(".terminal-speed");this.controlsEl.querySelector(".terminal-restart").addEventListener("click",()=>this._restart(d)),u.addEventListener("click",()=>{this.speed=this.speed>=4?1:this.speed*2,u.textContent=`${this.speed}\xD7`}),d.addEventListener("click",()=>{this.playing?this.stop():(d.textContent="\u23F8",this._playAll(d))}),this._renderComplete(0)}_restart(i){this.stop(),i.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(0)}async _playAll(i){this.playing=!0;let l=++this.epoch,d=this._playedUpTo||0;for(let u=d;u<this.cast.steps.length;u++){let m=this.cast.steps[u];if(m.hidden){this._playedUpTo=u+1;continue}if(m.sleep!=null){if(await _n(m.sleep*1e3/this.speed),this.epoch!==l){this._playedUpTo=u;return}this._playedUpTo=u+1;continue}let h=this.cast.steps.slice(0,u).filter(T=>!T.hidden&&T.sleep==null).map(T=>this._stepHtml(T)),b=h.length?h.join(`
353
356
  `)+`
354
- `:"",k=m.cmd||"";if(!m.raw&&!await this._typeCmd(k,w,m,l,!0)){this._playedUpTo=u;return}let A=new Pn,I=()=>{let C=A.toHtml();this.linesEl.innerHTML=m.raw?w+C:w+this._promptHtml()+`<span class="terminal-cmd">${vt(k)}</span>`+(C?`
355
- `+C:""),this._scrollToEnd()},M=0;for(let C of this._stepEvents(m)){let $=(C.t-M)*1e3/this.speed;if(M=C.t,$>4&&await pn($),this.epoch!==l){this._playedUpTo=u;return}if(C.kind==="i")for(let q of C.d){if(this.epoch!==l){this._playedUpTo=u;return}let he=ss(q)/this._typeFactor(m,!0);this.typeSound&&Er(q,this.typeSound,he/1e3),A.write(q),I(),await pn(he)}else A.write(C.d),I()}await pn(350/this.speed),this._playedUpTo=u+1}this.playing=!1,a.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(this.playable.length,{withCursor:!0})}};function pn(r){return new Promise(a=>setTimeout(a,r))}var Nd="0.5.0";function $d(r={}){let a=Fi(r),l=is||(void 0)?.registerTerminals;return typeof l=="function"&&Promise.resolve(l({registerBuildProvider:Kn},document)).catch(d=>console.error("Decklight: terminal subsystem failed to initialize",d)),a}function Od(r=document){let a=is||(void 0)?.registerTerminals;return typeof a=="function"?Promise.resolve(a({registerBuildProvider:Kn},r)):Promise.resolve()}return Va(Md);})();
357
+ `:"",k=m.cmd||"";if(!m.raw&&!await this._typeCmd(k,b,m,l,!0)){this._playedUpTo=u;return}let A=new Yn,P=()=>{let T=A.toHtml();this.linesEl.innerHTML=m.raw?b+T:b+this._promptHtml()+`<span class="terminal-cmd">${$t(k)}</span>`+(T?`
358
+ `+T:""),this._scrollToEnd()},M=0;for(let T of this._stepEvents(m)){let C=(T.t-M)*1e3/this.speed;if(M=T.t,C>4&&await _n(C),this.epoch!==l){this._playedUpTo=u;return}if(T.kind==="i")for(let F of T.d){if(this.epoch!==l){this._playedUpTo=u;return}let ye=ps(F)/this._typeFactor(m,!0);this.typeSound&&Lr(F,this.typeSound,ye/1e3),A.write(F),P(),await _n(ye)}else A.write(T.d),P()}await _n(350/this.speed),this._playedUpTo=u+1}this.playing=!1,i.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(this.playable.length,{withCursor:!0})}};function _n(r){return new Promise(i=>setTimeout(i,r))}var qd="0.6.0";function Fd(r={}){let i=Vi(r),l=ms||(void 0)?.registerTerminals;return typeof l=="function"&&Promise.resolve(l({registerBuildProvider:sr},document)).catch(d=>console.error("Decklight: terminal subsystem failed to initialize",d)),i}function zd(r=document){let i=ms||(void 0)?.registerTerminals;return typeof i=="function"?Promise.resolve(i({registerBuildProvider:sr},r)):Promise.resolve()}return Ja(Ud);})();
356
359
  //# sourceMappingURL=decklight.js.map