decklight 0.3.0 → 0.5.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.3.0 — Copyright 2026 Gilles Philippart — SPDX-License-Identifier: Apache-2.0 */
2
- var Decklight=(()=>{var Ra=Object.create;var tr=Object.defineProperty;var Ia=Object.getOwnPropertyDescriptor;var Ba=Object.getOwnPropertyNames;var Pa=Object.getPrototypeOf,Da=Object.prototype.hasOwnProperty;var zs=(r,a)=>()=>(r&&(a=r(r=0)),a);var qa=(r,a)=>()=>(a||r((a={exports:{}}).exports,a),a.exports),Fa=(r,a)=>{for(var l in a)tr(r,l,{get:a[l],enumerable:!0})},Us=(r,a,l,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let u of Ba(a))!Da.call(r,u)&&u!==l&&tr(r,u,{get:()=>a[u],enumerable:!(d=Ia(a,u))||d.enumerable});return r};var za=(r,a,l)=>(l=r!=null?Ra(Pa(r)):{},Us(a||!r||!r.__esModule?tr(l,"default",{value:r,enumerable:!0}):l,r)),Ua=r=>Us(tr({},"__esModule",{value:!0}),r);var Ve,ae=zs(()=>{Ve={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=zs(()=>{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 _o=qa((eu,Ao)=>{ae();le();function ho(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)&&ho(l)}),r}var ir=class{constructor(a){a.data===void 0&&(a.data={}),this.data=a.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function mo(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 wl="</span>",io=r=>!!r.scope,xl=(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}`},qr=class{constructor(a,l){this.buffer="",this.classPrefix=l.classPrefix,a.walk(this)}addText(a){this.buffer+=mo(a)}openNode(a){if(!io(a))return;let l=xl(a.scope,{prefix:this.classPrefix});this.span(l)}closeNode(a){io(a)&&(this.buffer+=wl)}value(){return this.buffer}span(a){this.buffer+=`<span class="${a}">`}},ao=(r={})=>{let a={children:[]};return Object.assign(a,r),a},Fr=class r{constructor(){this.rootNode=ao(),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=ao({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)}))}},zr=class extends Fr{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 qr(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Un(r){return r?typeof r=="string"?r:r.source:null}function fo(r){return bn("(?=",r,")")}function vl(r){return bn("(?:",r,")*")}function kl(r){return bn("(?:",r,")?")}function bn(...r){return r.map(l=>Un(l)).join("")}function El(r){let a=r[r.length-1];return typeof a=="object"&&a.constructor===Object?(r.splice(r.length-1,1),a):{}}function Hr(...r){return"("+(El(r).capture?"":"?:")+r.map(d=>Un(d)).join("|")+")"}function go(r){return new RegExp(r.toString()+"|").exec("").length-1}function Sl(r,a){let l=r&&r.exec(a);return l&&l.index===0}var Al=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Gr(r,{joinWith:a}){let l=0;return r.map(d=>{l+=1;let u=l,h=Un(d),f="";for(;h.length>0;){let m=Al.exec(h);if(!m){f+=h;break}f+=h.substring(0,m.index),h=h.substring(m.index+m[0].length),m[0][0]==="\\"&&m[1]?f+="\\"+String(Number(m[1])+u):(f+=m[0],m[0]==="("&&l++)}return f}).map(d=>`(${d})`).join(a)}var _l=/\b\B/,bo="[a-zA-Z]\\w*",jr="[a-zA-Z_]\\w*",yo="\\b\\d+(\\.\\d+)?",wo="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",xo="\\b(0b[01]+)",Tl="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Cl=(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)},Hn={begin:"\\\\[\\s\\S]",relevance:0},Nl={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Hn]},$l={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Hn]},Ol={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/},lr=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=Hr("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},Ml=lr("//","$"),Ll=lr("/\\*","\\*/"),Rl=lr("#","$"),Il={scope:"number",begin:yo,relevance:0},Bl={scope:"number",begin:wo,relevance:0},Pl={scope:"number",begin:xo,relevance:0},Dl={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Hn,{begin:/\[/,end:/\]/,relevance:0,contains:[Hn]}]},ql={scope:"title",begin:bo,relevance:0},Fl={scope:"title",begin:jr,relevance:0},zl={begin:"\\.\\s*"+jr,relevance:0},Ul=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()}})},or=Object.freeze({__proto__:null,APOS_STRING_MODE:Nl,BACKSLASH_ESCAPE:Hn,BINARY_NUMBER_MODE:Pl,BINARY_NUMBER_RE:xo,COMMENT:lr,C_BLOCK_COMMENT_MODE:Ll,C_LINE_COMMENT_MODE:Ml,C_NUMBER_MODE:Bl,C_NUMBER_RE:wo,END_SAME_AS_BEGIN:Ul,HASH_COMMENT_MODE:Rl,IDENT_RE:bo,MATCH_NOTHING_RE:_l,METHOD_GUARD:zl,NUMBER_MODE:Il,NUMBER_RE:yo,PHRASAL_WORDS_MODE:Ol,QUOTE_STRING_MODE:$l,REGEXP_MODE:Dl,RE_STARTERS_RE:Tl,SHEBANG:Cl,TITLE_MODE:ql,UNDERSCORE_IDENT_RE:jr,UNDERSCORE_TITLE_MODE:Fl});function Hl(r,a){r.input[r.index-1]==="."&&a.ignoreMatch()}function Gl(r,a){r.className!==void 0&&(r.scope=r.className,delete r.className)}function jl(r,a){a&&r.beginKeywords&&(r.begin="\\b("+r.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",r.__beforeBegin=Hl,r.keywords=r.keywords||r.beginKeywords,delete r.beginKeywords,r.relevance===void 0&&(r.relevance=0))}function Kl(r,a){Array.isArray(r.illegal)&&(r.illegal=Hr(...r.illegal))}function Wl(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 Vl(r,a){r.relevance===void 0&&(r.relevance=1)}var Zl=(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,fo(l.begin)),r.starts={relevance:0,contains:[Object.assign(l,{endsParent:!0})]},r.relevance=0,delete l.beforeMatch},Xl=["of","and","for","in","not","or","if","then","parent","list","value"],Yl="keyword";function vo(r,a,l=Yl){let d=Object.create(null);return typeof r=="string"?u(l,r.split(" ")):Array.isArray(r)?u(l,r):Object.keys(r).forEach(function(h){Object.assign(d,vo(r[h],a,h))}),d;function u(h,f){a&&(f=f.map(m=>m.toLowerCase())),f.forEach(function(m){let b=m.split("|");d[b[0]]=[h,Jl(b[0],b[1])]})}}function Jl(r,a){return a?Number(a):Ql(r)?0:1}function Ql(r){return Xl.includes(r.toLowerCase())}var lo={},gn=r=>{console.error(r)},co=(r,...a)=>{console.log(`WARN: ${r}`,...a)},Cn=(r,a)=>{lo[`${r}/${a}`]||(console.log(`Deprecated as of ${r}. ${a}`),lo[`${r}/${a}`]=!0)},ar=new Error;function ko(r,a,{key:l}){let d=0,u=r[l],h={},f={};for(let m=1;m<=a.length;m++)f[m+d]=u[m],h[m+d]=!0,d+=go(a[m-1]);r[l]=f,r[l]._emit=h,r[l]._multi=!0}function ec(r){if(Array.isArray(r.begin)){if(r.skip||r.excludeBegin||r.returnBegin)throw gn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ar;if(typeof r.beginScope!="object"||r.beginScope===null)throw gn("beginScope must be object"),ar;ko(r,r.begin,{key:"beginScope"}),r.begin=Gr(r.begin,{joinWith:""})}}function tc(r){if(Array.isArray(r.end)){if(r.skip||r.excludeEnd||r.returnEnd)throw gn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ar;if(typeof r.endScope!="object"||r.endScope===null)throw gn("endScope must be object"),ar;ko(r,r.end,{key:"endScope"}),r.end=Gr(r.end,{joinWith:""})}}function nc(r){r.scope&&typeof r.scope=="object"&&r.scope!==null&&(r.beginScope=r.scope,delete r.scope)}function rc(r){nc(r),typeof r.beginScope=="string"&&(r.beginScope={_wrap:r.beginScope}),typeof r.endScope=="string"&&(r.endScope={_wrap:r.endScope}),ec(r),tc(r)}function sc(r){function a(f,m){return new RegExp(Un(f),"m"+(r.case_insensitive?"i":"")+(r.unicodeRegex?"u":"")+(m?"g":""))}class l{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(m,b){b.position=this.position++,this.matchIndexes[this.matchAt]=b,this.regexes.push([b,m]),this.matchAt+=go(m)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let m=this.regexes.map(b=>b[1]);this.matcherRe=a(Gr(m,{joinWith:"|"}),!0),this.lastIndex=0}exec(m){this.matcherRe.lastIndex=this.lastIndex;let b=this.matcherRe.exec(m);if(!b)return null;let k=b.findIndex((I,M)=>M>0&&I!==void 0),S=this.matchIndexes[k];return b.splice(0,k),Object.assign(b,S)}}class d{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(m){if(this.multiRegexes[m])return this.multiRegexes[m];let b=new l;return this.rules.slice(m).forEach(([k,S])=>b.addRule(k,S)),b.compile(),this.multiRegexes[m]=b,b}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(m,b){this.rules.push([m,b]),b.type==="begin"&&this.count++}exec(m){let b=this.getMatcher(this.regexIndex);b.lastIndex=this.lastIndex;let k=b.exec(m);if(this.resumingScanAtSamePosition()&&!(k&&k.index===this.lastIndex)){let S=this.getMatcher(0);S.lastIndex=this.lastIndex+1,k=S.exec(m)}return k&&(this.regexIndex+=k.position+1,this.regexIndex===this.count&&this.considerAll()),k}}function u(f){let m=new d;return f.contains.forEach(b=>m.addRule(b.begin,{rule:b,type:"begin"})),f.terminatorEnd&&m.addRule(f.terminatorEnd,{type:"end"}),f.illegal&&m.addRule(f.illegal,{type:"illegal"}),m}function h(f,m){let b=f;if(f.isCompiled)return b;[Gl,Wl,rc,Zl].forEach(S=>S(f,m)),r.compilerExtensions.forEach(S=>S(f,m)),f.__beforeBegin=null,[jl,Kl,Vl].forEach(S=>S(f,m)),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=vo(f.keywords,r.case_insensitive)),b.keywordPatternRe=a(k,!0),m&&(f.begin||(f.begin=/\B|\b/),b.beginRe=a(b.begin),!f.end&&!f.endsWithParent&&(f.end=/\B|\b/),f.end&&(b.endRe=a(b.end)),b.terminatorEnd=Un(b.end)||"",f.endsWithParent&&m.terminatorEnd&&(b.terminatorEnd+=(f.end?"|":"")+m.terminatorEnd)),f.illegal&&(b.illegalRe=a(f.illegal)),f.contains||(f.contains=[]),f.contains=[].concat(...f.contains.map(function(S){return oc(S==="self"?f:S)})),f.contains.forEach(function(S){h(S,b)}),f.starts&&h(f.starts,m),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=dn(r.classNameAliases||{}),h(r)}function Eo(r){return r?r.endsWithParent||Eo(r.starts):!1}function oc(r){return r.variants&&!r.cachedVariants&&(r.cachedVariants=r.variants.map(function(a){return dn(r,{variants:null},a)})),r.cachedVariants?r.cachedVariants:Eo(r)?dn(r,{starts:r.starts?dn(r.starts):null}):Object.isFrozen(r)?dn(r):r}var ic="11.11.1",Ur=class extends Error{constructor(a,l){super(a),this.name="HTMLInjectionError",this.html=l}},Dr=mo,uo=dn,po=Symbol("nomatch"),ac=7,So=function(r){let a=Object.create(null),l=Object.create(null),d=[],u=!0,h="Could not find the language '{}', did you forget to load/include a language module?",f={disableAutodetect:!0,name:"Plain text",contains:[]},m={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:zr};function b(F){return m.noHighlightRe.test(F)}function k(F){let J=F.className+" ";J+=F.parentNode?F.parentNode.className:"";let H=m.languageDetectRe.exec(J);if(H){let fe=be(H[1]);return fe||(co(h.replace("{}",H[1])),co("Falling back to no-highlight mode for this block.",F)),fe?H[1]:"no-highlight"}return J.split(/\s+/).find(fe=>b(fe)||be(fe))}function S(F,J,H){let fe="",Ee="";typeof J=="object"?(fe=F,H=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),H===void 0&&(H=!0);let ze={code:fe,language:Ee};qe("before:highlight",ze);let Ne=ze.result?ze.result:I(ze.language,ze.code,H);return Ne.code=ze.code,qe("after:highlight",Ne),Ne}function I(F,J,H,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]<=ac&&(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=Sl(re.endRe,He);if(_e){if(re["on:end"]){let Le=new ir(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 ir(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 po;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"&&!H){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!==po)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(h.replace("{}",F)),new Error('Unknown language: "'+F+'"');let g=sc(we),j="",B=fe||g,X={},Y=new m.__emitter(m);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(),j=Y.toHTML(),{language:F,value:j,relevance:V,illegal:!1,_emitter:Y,_top:B}}catch(re){if(re.message&&re.message.includes("Illegal"))return{language:F,value:Dr(J),illegal:!0,relevance:0,_illegalBy:{message:re.message,index:ne,context:J.slice(ne-100,ne+100),mode:re.mode,resultSoFar:j},_emitter:Y};if(u)return{language:F,value:Dr(J),illegal:!1,relevance:0,errorRaised:re,_emitter:Y,_top:B};throw re}}function M(F){let J={value:Dr(F),illegal:!1,relevance:0,_top:f,_emitter:new m.__emitter(m)};return J._emitter.addText(F),J}function C(F,J){J=J||m.languages||Object.keys(a);let H=M(F),fe=J.filter(be).filter(Xe).map(o=>I(o,F,!1));fe.unshift(H);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,H){let fe=J&&l[J]||H;F.classList.add("hljs"),F.classList.add(`language-${fe}`)}function q(F){let J=null,H=k(F);if(b(H))return;if(qe("before:highlightElement",{el:F,language:H}),F.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",F);return}if(F.children.length>0&&(m.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)),m.throwUnescapedHTML))throw new Ur("One of your code blocks includes unescaped HTML.",F.innerHTML);J=F;let fe=J.textContent,Ee=H?S(fe,{language:H,ignoreIllegals:!0}):C(fe);F.innerHTML=Ee.value,F.dataset.highlighted="yes",$(F,H,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){m=uo(m,F)}let se=()=>{me(),Cn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ce(){me(),Cn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let U=!1;function me(){function F(){me()}if(document.readyState==="loading"){U||window.addEventListener("DOMContentLoaded",F,!1),U=!0;return}document.querySelectorAll(m.cssSelector).forEach(q)}function Te(F,J){let H=null;try{H=J(r)}catch(fe){if(gn("Language definition for '{}' could not be registered.".replace("{}",F)),u)gn(fe);else throw fe;H=f}H.name||(H.name=F),a[F]=H,H.rawDefinition=J.bind(null,r),H.aliases&&Ce(H.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(H=>{l[H.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 H=F;d.forEach(function(fe){fe[H]&&fe[H](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:S,highlightAuto:C,highlightAll:me,highlightElement:q,highlightBlock:De,configure:he,initHighlighting:se,initHighlightingOnLoad:ce,registerLanguage:Te,unregisterLanguage:$e,listLanguages:Re,getLanguage:be,registerAliases:Ce,autoDetection:Xe,inherit:uo,addPlugin:E,removePlugin:Ie}),r.debugMode=function(){u=!1},r.safeMode=function(){u=!0},r.versionString=ic,r.regex={concat:bn,lookahead:fo,either:Hr,optional:kl,anyNumberOfTimes:vl};for(let F in or)typeof or[F]=="object"&&ho(or[F]);return Object.assign(r,or),r},Nn=So({});Nn.newInstance=()=>So({});Ao.exports=Nn;Nn.HighlightJS=Nn;Nn.default=Nn});var _d={};Fa(_d,{init:()=>Sd,initTerminals:()=>Ad,registerBuildProvider:()=>jn,version:()=>Ed});ae();le();ae();le();ae();le();var ja=new Set(["UL","OL","TABLE","TBODY","DL","SVG"]),Ka=new Set(["defs","title","desc","style","metadata"]),js=new Map;function Ks(r,a){js.set(r,a)}function rr(r){return[...r.children].filter(a=>{let l=a.tagName.toLowerCase();return!(Ka.has(l)||l==="aside"&&a.classList.contains("notes")||a.hasAttribute("data-build-stay"))})}function Wa(r){if(r.hasAttribute("data-build-self"))return!1;let a=r.tagName.toUpperCase();return ja.has(a)?!0:a==="DIV"||a==="G"?rr(r).length>=2:!1}function Va(r){if(r.tagName.toUpperCase()==="TABLE"){let l=r.querySelector(":scope > tbody");return l?rr(l):rr(r).filter(d=>d.tagName==="TR")}return rr(r)}function Za(r){let a=r.map((f,m)=>({...f,i:m}));a.sort((f,m)=>f.key-m.key||f.i-m.i);let l=[],d=null,u=null,h=!1;for(let f of a){if(d&&f.explicit&&h&&f.key===u){d.push(f.i);continue}d=[f.i],u=f.key,h=f.explicit,l.push(d)}return l}function Hs(r,a){r.classList.add("build-step"),r.setAttribute("data-build-style",a),r.setAttribute("data-build-state","pending"),a==="draw"&&Xa(r)}var Gs="path, line, polyline, polygon, circle, ellipse, rect";function Xa(r){let a=r.matches?.(Gs)?[r]:[...r.querySelectorAll(Gs)],l=!1;for(let u of a){let h=u.getAttribute("stroke")??getComputedStyle(u).stroke;if(!h||h==="none")continue;let f=0;try{f=u.getTotalLength()}catch{continue}if(!f)continue;l=!0;let m=u.getAttribute("stroke-dasharray")||u.style.strokeDasharray;m&&(u.dataset.drawOrig=m);for(let[b,k]of Ir){let S=u.getAttribute(b);S&&(u.dataset[k]=S)}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 Ir=[["marker-start","drawMarkerStart"],["marker-mid","drawMarkerMid"],["marker-end","drawMarkerEnd"]];function nr(r,a){for(let[l,d]of Ir)d in r.dataset&&(a?r.setAttribute(l,r.dataset[d]):r.removeAttribute(l))}function Ya(r,a){for(let l of r.querySelectorAll(".draw-stroke")){let d=l.dataset.drawOrig,u=Ir.some(([,h])=>h in l.dataset);if(!(!d&&!u))if(a==="done")d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),nr(l,!0);else if(a==="pending")l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),nr(l,!1);else{l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),nr(l,!1);let h=()=>{r.getAttribute("data-build-state")!=="pending"&&(d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),nr(l,!0))},f=parseFloat(getComputedStyle(l).transitionDuration)||0;f===0?h():(l.addEventListener("transitionend",h,{once:!0}),setTimeout(h,f*1e3+150))}}}function Br(r){let a=[],l=[],d=new Set,u=0,h=(S,I)=>{let M=I!=null&&I!=="",C=M?parseInt(I,10):u;a.push(S),l.push({key:Number.isFinite(C)?C:u,explicit:M}),u++},f=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT);for(let S=f.nextNode();S;S=f.nextNode()){if(d.has(S))continue;let I=js.get(S);if(I){for(let C=0;C<I.count;C++)h({kind:"provider",provider:I,el:S,sub:C},null);S.querySelectorAll("*").forEach(C=>d.add(C));continue}if(!S.hasAttribute("data-build"))continue;let M=S.getAttribute("data-build")||"fade";if(Wa(S)){for(let C of Va(S)){d.add(C),C.querySelectorAll("[data-build]").forEach(q=>d.add(q));let $=C.getAttribute("data-build")||M;Hs(C,$),h({kind:"dom",el:C,container:S},C.getAttribute("data-build-order"))}S.setAttribute("data-build-container","")}else Hs(S,M),h({kind:"dom",el:S,container:null},S.getAttribute("data-build-order"))}let m=Za(l),b=[],k=new Map;return a.forEach((S,I)=>{if(S.kind==="provider"){if(!k.has(S.provider)){let M={el:S.el,provider:S.provider,stepIdxs:[]};k.set(S.provider,M),b.push(M)}k.get(S.provider).stepIdxs.push(I)}}),{steps:a,groups:m,providers:b}}function cn(r,a){let l=new Set;r.groups.forEach((f,m)=>{for(let b of f)m<a&&l.add(b)});let d=a>0?r.groups[a-1]??[]:[],u=new Set(d),h=new Set;r.steps.forEach((f,m)=>{if(f.kind!=="dom")return;let b=u.has(m)?"current":l.has(m)?"done":"pending";f.el.setAttribute("data-build-state",b),f.el.getAttribute("data-build-style")==="draw"&&Ya(f.el,b),f.container&&h.add(f.container)});for(let f of h){let m=!!f.querySelector(':scope [data-build-style="highlight"][data-build-state="current"]');f.classList.toggle("has-current-highlight",m)}for(let f of r.providers){let m=f.stepIdxs.filter(b=>l.has(b)||u.has(b)).length;f._last!==m&&(f._last=m,f.provider.apply(m))}}function Ws(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 Vs="rect, circle, ellipse, polygon, polyline, path";function Ja(r){let a=5381;for(let l of String(r))a=(a*33^l.charCodeAt(0))>>>0;return 1+a%6}function Qa(r,a={}){let l=a[r];return typeof l=="number"?`var(--d-fill-${l})`:typeof l=="string"?l:`var(--d-fill-${Ja(r)})`}function Zs(r,a={}){let l=new Map;r.querySelectorAll("svg [data-concept]").forEach(d=>{let u=d.getAttribute("data-concept");if(!u)return;let h=Qa(u,a),f=h.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 m=d.matches(Vs)?[d]:[...d.children].filter(b=>b.matches(Vs));for(let b of m){let k=b.getAttribute("fill")==="none"||b.style.fill==="none";b.style.setProperty(k?"stroke":"fill",h)}})}var el=["fill","stroke","filter","clip-path","mask","marker-start","marker-mid","marker-end","style"];function Xs(r){r.querySelectorAll("svg").forEach((a,l)=>{let d=`svg${l}-`,u=new Map;if(a.querySelectorAll("[id]").forEach(f=>{let m=f.id;u.set(m,d+m),f.id=d+m}),u.size===0)return;let h=f=>f.replace(/url\(['"]?#([^'")]+)['"]?\)/g,(m,b)=>u.has(b)?`url(#${u.get(b)})`:m);a.querySelectorAll("*").forEach(f=>{for(let m of el){let b=f.getAttribute(m);b&&b.includes("url(#")&&f.setAttribute(m,h(b))}for(let m of["href","xlink:href"]){let b=f.getAttribute(m);b&&b.startsWith("#")&&u.has(b.slice(1))&&f.setAttribute(m,"#"+u.get(b.slice(1)))}})})}ae();le();ae();le();var vt=r=>String(r).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");var Ys=640,tl=360,Js=["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 nl(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(!Js.includes(d))throw new Error(`unknown type "${d}" \u2014 use ${Js.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),h=l.series.map((k,S)=>{if(!k||!Array.isArray(k.data))throw new Error(`series ${S+1}: "data" must be an array of numbers`);return{name:k.name!=null?String(k.name):`series ${S+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&&h.length>1)throw new Error("pie takes exactly one series (labels are the slices)");if(f&&!h[0].data.some(k=>k>0))throw new Error("pie needs at least one positive value");let m=tl,b=a.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"`);m=Math.round(Ys*+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:h,legend:l.legend,width:Ys,height:m,build:l.build}}function rl(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)),h=d/u,f=(h<=1?1:h<=2?2:h<=2.5?2.5:h<=5?5:10)*u,m=Math.floor(r/f+1e-9)*f,b=Math.ceil(a/f-1e-9)*f,k=Math.max(1,Math.round((b-m)/f)),S=Array.from({length:k+1},(I,M)=>+(m+M*f).toPrecision(12));return{min:S[0],max:S[k],step:f,ticks:S}}function sl(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 ol(r,a,l,d){let u=d.max-d.min||1,h=S=>l.y+l.h*(1-(S-d.min)/u),f=h(Math.max(d.min,Math.min(d.max,0))),m=l.w/a,b=m*.72,k=b/r.length;return r.map((S,I)=>Array.from({length:a},(M,C)=>{let $=S.data[C];if($==null||!Number.isFinite($))return null;let q=h($);return{x:l.x+C*m+(m-b)/2+I*k+1,y:Math.min(q,f),w:Math.max(1,k-2),h:Math.abs(f-q),value:$}}))}function il(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 al(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 ll(r,a,l,d,u=0){let h=r.map(k=>Math.max(0,Number(k)||0)),f=h.reduce((k,S)=>k+S,0);if(f<=0)throw new Error("pie needs at least one positive value");let m=(k,S)=>[a+S*Math.cos(k),l+S*Math.sin(k)],b=-Math.PI/2;return h.map(k=>{let S=k/f,I=b,M=b+S*2*Math.PI;b=M;let C=(I+M)/2,$=u>0?(d+u)/2:d*.66,[q,he]=m(C,$),[se,ce]=m(C,d+14),U={value:k,frac:S,mid:C,labelX:q,labelY:he,outX:se,outY:ce,anchor:Math.cos(C)<-1e-6?"end":Math.cos(C)>1e-6?"start":"middle"};if(S===0)return{...U,d:""};let me;if(S>=.9999){let[Te,$e]=m(I,d),[Re,be]=m(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]=m(I,u),[xe,E]=m(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]=m(I,d),[be,Ce]=m(M,d);if(u>0){let[Xe,xe]=m(M,u),[E,Ie]=m(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{...U,d:me}})}var Tn='fill="var(--d-text)"';function Pr(r,a){return`<g class="chart-series" data-series="${a+1}" data-name="${vt(r.name)}"`+(r.concept?` data-concept="${vt(r.concept)}"`:"")+">"}function cl(r,a,l){let d=r.series.flatMap($=>$.data).filter($=>$!=null),u=Math.min(0,...d),h=Math.max(0,...d),f=rl(u,h===u?u+1:h,5),m=f.ticks.map($=>sl($,f.step)),b=14+Math.max(...m.map($=>$.length))*6.6+8,k={x:b,y:r.title||Qs(r)?40:18,w:r.width-b-14,h:0};k.h=r.height-k.y-34;let S=f.max-f.min||1,I=$=>k.y+k.h*(1-($-f.min)/S);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(m[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 $=ol(r.series,r.labels.length,k,f);r.series.forEach((q,he)=>{l.push(Pr(q,he)),$[he].forEach(se=>{se&&l.push(`<rect class="chart-bar draw-fade" x="${ve(se.x)}" y="${ve(se.y)}" width="${ve(se.w)}" height="${ve(se.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((U,me)=>U==null?null:{x:k.x+(me+.5)*C,y:I(U)}),se=il(he),ce='stroke-linejoin="round" stroke-linecap="round"';if(l.push(Pr($,q)),r.type==="area"&&l.push(`<path class="chart-area draw-fade" d="${al(he,M)}" fill="${_n(q)}" fill-opacity="0.35"/>`),l.push(`<g class="chart-casing"><path d="${se}" fill="none" stroke="var(--d-stroke)" stroke-width="4.5" ${ce}/></g>`),l.push(`<path class="chart-line" d="${se}" fill="none" stroke="${_n(q)}" stroke-width="2.5" ${ce}/>`),r.type==="line")for(let U of he)U&&l.push(`<circle class="chart-dot draw-fade" cx="${ve(U.x)}" cy="${ve(U.y)}" r="4" fill="${_n(q)}" stroke="var(--d-stroke)" stroke-width="1"/>`);l.push("</g>")})}function dl(r,a){let l=r.title?40:16,d=r.width/2,u=l+(r.height-l-12)/2,h=Math.max(24,Math.min((r.height-l-12)/2-26,r.width/2-110)),f=ll(r.series[0].data.map(m=>m??0),d,u,h,r.donut?h*.55:0);a.push(Pr(r.series[0],0)),f.forEach((m,b)=>{m.d&&(a.push(`<path class="chart-slice draw-fade" d="${m.d}" fill="${_n(b)}" fill-rule="evenodd" stroke="var(--d-stroke)" stroke-width="1.5" stroke-linejoin="round"/>`),a.push(`<text class="chart-cat draw-fade" x="${ve(m.outX)}" y="${ve(m.outY+4)}" text-anchor="${m.anchor}" font-size="12" ${Tn}>${vt(r.labels[b])}</text>`),m.frac>=.05&&a.push(`<text class="chart-value draw-fade" x="${ve(m.labelX)}" y="${ve(m.labelY+4)}" text-anchor="middle" font-size="12" font-weight="600" ${Tn}>${Math.round(m.frac*100)}%</text>`))}),a.push("</g>")}function Qs(r){return r.legend===!0?!0:r.legend===!1?!1:r.type!=="pie"&&r.series.length>1}function ul(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>`),Qs(r)){let u=r.series.map(f=>({name:f.name,w:f.name.length*6.6+24})),h=r.width-14-u.reduce((f,m)=>f+m.w,0);r.series.forEach((f,m)=>{a.push(`<rect class="chart-swatch" x="${ve(h)}" y="14" width="11" height="11" rx="2" fill="${_n(m)}" stroke="var(--d-stroke)" stroke-width="1"/>`),a.push(`<text class="chart-legend" x="${ve(h+16)}" y="24" font-size="12" ${Tn}>${vt(f.name)}</text>`),h+=u[m].w})}r.type==="pie"?dl(r,l):cl(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 eo(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=nl(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=ul(d);let h=u.content.firstElementChild;a.hasAttribute("data-build")?(h.setAttribute("data-build",a.getAttribute("data-build")),a.removeAttribute("data-build")):d.build!=null&&d.build!==!1&&h.setAttribute("data-build",d.build===!0?"":String(d.build)),a.getAttribute("data-chart")||a.setAttribute("data-chart",d.donut?"donut":d.type),a.insertBefore(h,l)}catch(d){let u=document.createElement("div");u.className="chart-broken",u.textContent=`chart: ${d.message||d}`,a.insertBefore(u,l)}})}ae();le();var sr=["opacity","color","backgroundColor","borderRadius","fontSize"],pl=["transform",...sr.map(r=>r.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()))];function to(r){let a=getComputedStyle(r),l={rect:r.getBoundingClientRect()};for(let d of sr)l[d]=a[d];return l}function hl(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 no(r,a,l){let d=getComputedStyle(a).getPropertyValue("--auto-animate-duration").trim(),u=(d.endsWith("ms")?parseFloat(d):d.endsWith("s")?parseFloat(d)*1e3:parseFloat(d))||500,h=new Map;r.querySelectorAll("[data-id]").forEach(b=>{h.set(b.getAttribute("data-id"),to(b))});let f=[];a.querySelectorAll("[data-id]").forEach(b=>{let k=h.get(b.getAttribute("data-id"));k&&f.push({el:b,o:k})});for(let{el:b,o:k}of f){let S=to(b),I=hl(b,l),M=(k.rect.left-S.rect.left)/I.x,C=(k.rect.top-S.rect.top)/I.y,$=b.children.length===0&&k.fontSize!==S.fontSize,q=$?1:S.rect.width?k.rect.width/S.rect.width:1,he=$?1:S.rect.height?k.rect.height/S.rect.height:1,se=b.getAttribute("style")??"";b.style.transition="none",b.ownerSVGElement&&(b.style.transformBox="fill-box"),b.style.transformOrigin="0 0",b.style.transform=`translate(${M}px, ${C}px) scale(${q}, ${he})`;for(let U of sr)b.style[U]=k[U];b.offsetWidth,b.style.transition=pl.map(U=>`${U} ${u}ms ease`).join(", "),b.style.transform="";for(let U of sr)b.style[U]=S[U];let ce=()=>{se?b.setAttribute("style",se):b.removeAttribute("style"),b.removeEventListener("transitionend",ce)};b.addEventListener("transitionend",ce),setTimeout(ce,u+80)}let m=new Set(f.map(b=>b.el));return[...a.children].forEach(b=>{b.matches("aside.notes")||m.has(b)||[...m].some(S=>b.contains(S))||(b.classList.add("aa-fresh"),requestAnimationFrame(()=>requestAnimationFrame(()=>b.classList.add("aa-in"))),setTimeout(()=>b.classList.remove("aa-fresh","aa-in"),u+120))}),u}ae();le();ae();le();var ro=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"),oe,de;oe=i>15?"\u2026"+v.slice(i-15,i):v.slice(0,i),de=D+15<v.length?v.slice(D,D+15)+"\u2026":v.slice(D),c+=oe+z+de}let y=new Error(c);return y.name="ParseError",y.__proto__=r.prototype,y.position=i,y}}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;"},h=/[&><"']/g;function f(e){return String(e).replace(h,t=>u[t])}let m=function(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?m(e.body[0]):e:e.type==="font"?m(e.body):e},b=function(e){let t=m(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},k=function(e){return+e.toFixed(4)},S="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 y=0;y<t.length;++y)M[t[y]]=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},se=function(e){return e.type==="ordgroup"?e.body:[e]};class ce{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 U=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=U(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(U(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=U(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(U(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 ce(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=U(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(U(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},H=["\\widetilde","\\widehat","\\widecheck","\\utilde"],fe=e=>{let t=J(e.label);if(H.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 j={"--":!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(j,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 y=i.children[p];Fe(t,y)}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,y]of Object.entries(e.attributes))i.attributes[p]=y}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 ce))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 y=Oe(e[0],t);return y instanceof E&&y.type==="mo"&&(y.setAttribute("lspace","0em"),y.setAttribute("rspace","0em")),[y]}let i=[],c=[],p;for(let y=0;y<e.length;y++)c.push(Oe(e[y],t));for(let y=0;y<c.length;y++){let v=c[y];if(y<e.length-1&&_e(e[y])&&_e(e[y+1])&&v.setAttribute("rspace","0em"),y>0&&_e(e[y])&&_e(e[y-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"&&y<c.length-1&&c[y+1].type==="mn"&&He(e,y))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 y=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(oe,de,ee){let et=[],Ge=[],tt=[],lt=0,je=0;for(;je<oe.length;){for(;oe[je]instanceof ce;)oe.splice(je,1,...oe[je].children);let Ze=oe[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(de==="="&&Ut==="="){if(lt+=1,lt>1){tt.pop();let Tt=new E("mrow",tt);Ge.push(Tt),tt=[Ze]}}else if(de==="tex"){let Tt=je<oe.length-1?oe[je+1]:null,An=!0;if(!Tt||Tt.type!=="mtext"||!Tt.attributes.linebreak||Tt.attributes.linebreak!=="nobreak")for(let en=je+1;en<oe.length;en++){let ln=oe[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,y,i.displayMode);if(c&&(D=((oe,de,ee,et)=>{de=Qe(de[0].body,ee),(de=Je(de)).classes.push("tml-tag");let Ge=_t(oe);oe=new E("mtd",[oe]);let tt=[Ye(),oe,Ye()];tt[et?0:2].children.push(de);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 oe=new E("annotation",[new Ie(t)]);oe.setAttribute("encoding","application/x-tex"),D=new E("semantics",[D,oe])}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,y=e.label==="\\vec",v=y==="\\vec"?"-vec":"";y&&n.classes.push("tml-vec");let D=y?"-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}`)):y?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&&S.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},ft=e=>[1,.7,.5][Math.max(e-1,0)],it=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/ft(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)},G=(e,t)=>Number(e)/ft(t),ie=(e,t,n,i)=>{let c=J(e),p=e.slice(1,3)==="eq",y=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=G(y,v.level),z=G(y,3),oe=N(null,D.toFixed(4),0),de=N(null,z.toFixed(4),0),ee=G(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,de])}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,de])}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,oe]),y==="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),y,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"),y=new E("mpadded",[st(.2778),D,v,st(.2778)])}else v.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),y=new E("mpadded",[st(.2778),v,p,st(.2778)]);return y.setAttribute("voffset","-0.18em"),y.setAttribute("height","-0.18em"),y.setAttribute("depth","+0.18em"),y}});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 y=0;y<t.length;++y)Pe[t[y]]=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]),y=new E("mpadded",[p]);return y.setAttribute("width","0.1px"),y.setAttribute("displaystyle","false"),y.setAttribute("scriptlevel","1"),y}}),$({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(y=>{p+="\\partial "+y.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}}}
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
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:y,leqno:v,arraystretch:D,arraycolsep:z},oe){let de=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(y&&ee.length===y){if(!n.includes("array"))throw new r(y===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===de){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 "+de,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:oe,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},gt=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 oe=e.body[z],de=[],ee=e.scriptLevel==="text"?Ot:e.scriptLevel==="script"?Gt:ut;for(let je=0;je<oe.length;je++){let Ze=new E("mtd",[Oe(oe[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)}de.push(Ze)}let et=e.body[0].length;for(let je=0;je<et-oe.length;je++)de.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&&(de.unshift(kn(e)),de.push(kn(e)),e.leqno?de[0].children.push(Ze):de[de.length-1].children.push(Ze))}let Ge=new E("mtr",de,[]),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 oe=0;oe<n.length;oe++)for(let de=0;de<n[oe].children.length;de++)n[oe].children[de].style.paddingTop=z,n[oe].children[de].style.paddingBottom=z}let y,v;if(e.envClasses.length>0&&(y=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=it(e.arraycolsep,t);y=z.number.toFixed(4),v=z.unit}if(y){let z=n.length===0?0:n[0].children.length,oe=(de,ee)=>de===0&&ee===0||de===z-1&&ee===1?"0":e.envClasses[0]!=="align"?y:ee===1?"0":p?de%2?"1":"0":de%2?"0":"1";for(let de=0;de<n.length;de++)for(let ee=0;ee<n[de].children.length;ee++)n[de].children[ee].style.paddingLeft=`${oe(ee,0)}${v}`,n[de].children[ee].style.paddingRight=`${oe(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 oe=0;oe<n.length;oe++){let de=n[oe];if(z){for(let ee=0;ee<de.children.length;ee++)de.children[ee].classes=["tml-"+(ee%2?"left":"right")];if(p){let ee=e.leqno?0:de.children.length-1;de.children[ee].classes=[]}}if(de.children.length>1&&e.envClasses.includes("cases")&&(de.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(let ee of de.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,oe=!1,de=0,ee=z.length;for(;z[de].type==="separator";)de+=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=de;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()]);oe=!0}else if(z[Ge].type==="separator"){if(oe){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)}oe=!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,y=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),y=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 y<D.length&&(y=D.length)});for(let D=0;D<y;++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(y){let v=rt(y).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,y)}),[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:gt}),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,y]=Jt(e.parser.gullet.macros);return c.arraystretch=p,!y||y===6&&y==="pt"||(c.arraycolsep=y),t?{type:"leftright",mode:e.mode,body:[c],left:t[0],right:t[1],rightColor:void 0}:c},mathmlBuilder:gt}),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 oe=1;oe<c.length;oe++){p[oe-1].push(c[oe].shift());let de=[];for(let ee=0;ee<c[oe].length;ee++)de.push(c[oe][ee]);p[oe-1].push(It(de,"vphantom"))}let y=new Array(c.length).fill().map(()=>[]);for(let oe=0;oe<c[0].length;oe++)y[0].push(c[0][oe]);for(let oe=1;oe<c.length;oe++)for(let de=0;de<c[0].length;de++)y[oe].push(It(c[oe][de].body,"hphantom"));for(let oe=0;oe<c[0].length;oe++)c[0][oe]=It(c[0][oe].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:y,cols:new Array(y.length).fill({type:"align",align:"c"}),rowGaps:new Array(y.length-1).fill(null),hLinesBeforeRow:new Array(y.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(y.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:gt}),Se({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:e=>Bt(e.parser,{envClasses:["small"]},"script"),mathmlBuilder:gt}),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:gt}),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:gt}),Se({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:T,mathmlBuilder:gt}),Se({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:T,mathmlBuilder:gt}),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:gt}),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:gt}),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:gt}),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 y=n[p],v=Nt();for(let D=0;D<y.length;D++)if(Yt(y[D])){i.push(v),D+=1;let z=rt(y[D]).text,oe=new Array(2);if(oe[0]={type:"ordgroup",mode:"math",body:[]},oe[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<y.length;Ge++){if(Rt(y[Ge],z)){et=!1,D=Ge;break}if(Yt(y[Ge]))throw new r("Missing a "+z+" character to complete a CD arrow.",y[Ge]);oe[ee].body.push(y[Ge])}if(et)throw new r("Missing a "+z+" character to complete a CD arrow.",y[D])}}let de=wn(z,oe,t);i.push(de),v=Nt()}else v.body.push(y[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:gt}),$({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,y={mode:e.mode,envName:t.slice(1),delimiters:c,parser:e},v=p.handler(y);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:b(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&&S.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 de=new E("mspace",[]);de.setAttribute("height","0.85em"),n.children.push(de)}let y;if(e.isCharacterBox)y=new E("mspace",[]),y.setAttribute("height","1em");else{let de=Oe(e.body,t),ee=new E("mpadded",[de]);ee.setAttribute("width","0.1px"),y=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 de=new E("mspace",[]);de.setAttribute("width","0.2em"),D.children.unshift(de)}D.setAttribute("width","0.1px");let z=new E("mover",[y,D]),oe=new E("mrow",[],["ff-nudge-left"]);return xe([re([p,z]),oe])}}),$({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 y=0;y<i.length;y++)c+=Me(i[y],"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 w=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,_=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,A=/^ *\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},We=JSON.parse(`{
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(`{
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),H===void 0&
88
88
  "Yellow": "#fff404",
89
89
  "YellowGreen": "#98cc6c",
90
90
  "YellowOrange": "#ffa41c"
91
- }`),ot=(e,t)=>{let n="";if(e==="HTML"){if(!w.test(t))throw new r("Invalid HTML input.");n=t}else if(e==="RGB"){if(!A.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},bt=(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:We[e]&&(e=We[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=ot(c,v)}else p=bt(Me(n[0],"raw").string,e.gullet.macros,t);let y=n[1];return{type:"color",mode:e.mode,color:p,isTextColor:!0,body:se(y)}},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,y="";if(p){let D=Me(i[0],"raw").string;y=ot(p,D)}else y=bt(Me(i[0],"raw").string,e.gullet.macros,n);let v=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:y,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 y=Me(i[2],"raw").string,v=ot(p,y);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=it(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"},Zn=e=>{let t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new r("Expected a control sequence",e);return t},is=(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,y=[[]];for(;e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){c=e.gullet.future(),y[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++,y.push([])}else{if(n.text==="EOF")throw new r("Expected a macro definition");y[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:y},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=Zn(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 is(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=Zn(e.gullet.popToken()),i=e.gullet.popToken(),c=e.gullet.popToken();return is(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=Zn(e.gullet.popToken()),e.gullet.popToken()):n=Zn(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:y}=e.gullet.consumeArg();return t==="\\providecommand"&&e.gullet.macros.has(n)||e.gullet.macros.set(n,{tokens:y,numArgs:p}),{type:"internal",mode:e.mode}}});let Ar={"\\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}},_r={"(":")","\\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"},Gi=new Set(Object.keys(_r));new Set(Object.values(_r));let as=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","."]),ji=new Set(["}","\\left","\\middle","\\right"]),Xn=e=>e.length>0&&(as.has(e)||Ar[e]||ji.has(e)),ls=[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&&as.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 Ki=new Set(["/","\\","\\backslash","\u2216","\\vert","|"]),Yn=(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 cs(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:Ar[e.funcName].size,mclass:Ar[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"),(Ki.has(n)||n.indexOf("arrow")>-1)&&i.setAttribute("stretchy","true"),i.setAttribute("symmetric","true"),i.setAttribute("minsize",ls[e.size]+"em"),i.setAttribute("maxsize",ls[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 y=Me(i.parseFunction(),"leftright-right");return{type:"leftright",mode:i.mode,body:c,left:n.text,right:y.delim,isStretchy:!0}},mathmlBuilder:(e,t)=>{cs(e);let n=Le(e.body,t),i=Yn(e.left,e.mode,"prefix",!0);n.unshift(i);let c=Yn(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(Gi),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=_r[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)=>{cs(e);let n=Le(e.body,t),i=Yn(e.left,e.mode,"prefix",!1);n.unshift(i);let c=Yn(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 Wi=["\\boxed","\\fcolorbox","\\colorbox"],En=(e,t)=>{let n=Wi.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=ot(c,v)}else p=bt(Me(n[0],"raw").string,e.gullet.macros);let y=n[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,body:y}},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,y="";if(c){let D=Me(n[0],"raw").string,z=Me(n[0],"raw").string;y=ot(c,D),p=ot(c,z)}else y=bt(Me(n[0],"raw").string,e.gullet.macros),p=bt(Me(n[1],"raw").string,e.gullet.macros);let v=n[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,borderColor:y,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:y,optArgs:v}=e.parseArguments("\\begin{"+c+"}",p),D={mode:e.mode,envName:c,parser:e},z=p.handler(D,y,v);e.expect("\\end",!1);let oe=e.nextToken,de=Me(e.parseFunction(),"environment");if(de.name!==c)throw new r(`Mismatch: \\begin{${c}} matched by \\end{${de.name}}`,oe);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 ds=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),Vi=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),Zi=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),us=Object.freeze({"\u03F5":119527,\u03D1:119564,\u03F0:119534,\u03C6:119577,\u03F1:119535,\u03D6:119563}),Xi=Object.freeze({"\u03F5":119643,\u03D1:119680,\u03F0:119650,\u03C6:119693,\u03F1:119651,\u03D6:119679}),ps=Object.freeze({"\u03F5":119701,\u03D1:119738,\u03F0:119708,\u03C6:119751,\u03F1:119709,\u03D6:119737}),Yi=Object.freeze({"\u03F5":119759,\u03D1:119796,\u03F0:119766,\u03C6:119809,\u03F1:119767,\u03D6:119795}),Ji=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>ds[e]||119899,"script-bold":e=>119951,fraktur:e=>Vi[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>Zi[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=>ds[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=>us[e]||-51,italic:e=>0,"bold-italic":e=>Xi[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>ps[e]||116,"sans-serif-bold":e=>ps[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>Yi[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||us[e]?"varGreek":47<n&&n<58?"numeral":"other";return i==="other"?e:String.fromCodePoint(n+Ji[i][t](e))},Qi=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"}),ea=["mathrm","mathit"],hs=(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(!ea.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 oe=v.body.body[z].type;if(oe!=="mathord"&&(oe!=="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 y=c.children[0];for(let v=1;v<c.children.length;v++)y.children.push(c.children[v].children[0]);if(y.attributes.mathvariant&&y.attributes.mathvariant==="normal"){let v=new E("mtext",new Ie("\u200B"));return new E("mrow",[v,y])}return y},ms={"\\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 ms&&(c=ms[c]),{type:"font",mode:e.mode,font:c.slice(1),body:i}},mathmlBuilder:hs}),$({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:hs});let fs=["display","text","script","scriptscript"],ta={auto:-1,display:0,text:0,script:1,scriptscript:2},Tr=(e,t)=>{t=((p,y)=>{let v=y;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=it(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 y=new E("mo",[new Ie(e.leftDelim.replace("\\",""))]);y.setAttribute("fence","true"),p.push(y)}if(p.push(c),e.rightDelim!=null){let y=new E("mo",[new Ie(e.rightDelim.replace("\\",""))]);y.setAttribute("fence","true"),p.push(y)}c=re(p)}return e.scriptLevel!=="auto"&&(c=new E("mstyle",[c]),c.setAttribute("displaystyle",String(e.scriptLevel==="display")),c.setAttribute("scriptlevel",ta[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,y=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":y="(",v=")";break;case"\\\\bracefrac":y="\\{",v="\\}";break;case"\\\\brackfrac":y="[",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:y,rightDelim:v,scriptLevel:D,barSize:null}},mathmlBuilder:Tr}),$({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 gs=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"?gs(c.text):null,y=he(t[1]),v=y.type==="atom"&&y.family==="close"?gs(y.text):null,D=Me(t[2],"size"),z,oe=null;D.isBlank?z=!0:(oe=D.value,z=oe.number>0);let de="auto",ee=t[3];if(ee.type==="ordgroup"){if(ee.body.length>0){let et=Me(ee.body[0],"textord");de=fs[Number(et.text)]}}else ee=Me(ee,"textord"),de=fs[Number(ee.text)];return{type:"genfrac",mode:e.mode,numer:n,denom:i,continued:!1,hasBarLine:z,barSize:oe,leftDelim:p,rightDelim:v,scriptLevel:de}},mathmlBuilder:Tr}),$({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],y=c.number>0;return{type:"genfrac",mode:e.mode,numer:i,denom:p,continued:!1,hasBarLine:y,barSize:c,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Tr}),$({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},t)=>({type:"hbox",mode:e.mode,body:se(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 y,v={};switch(t){case"\\class":v.class=c,y={command:"\\class",class:c};break;case"\\id":v.id=c,y={command:"\\id",id:c};break;case"\\style":v.style=c,y={command:"\\style",style:c};break;case"\\data":{let D=c.split(",");for(let z=0;z<D.length;z++){let oe=D[z].split("=");if(oe.length!==2)throw new r("Error parsing key-value for \\data");v["data-"+oe[0].trim()]=oe[1].trim()}y={command:"\\data",attributes:v};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(y))throw new r(`Function "${t}" is not trusted`,n);return{type:"html",mode:e.mode,attributes:v,body:se(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 Cr=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"},y={number:0,unit:"em"},v="";if(i[0]){let z=Me(i[0],"raw").string.split(",");for(let oe=0;oe<z.length;oe++){let de=z[oe].split("=");if(de.length===2){let ee=de[1].trim();switch(de[0].trim()){case"alt":v=ee;break;case"width":c=Cr(ee);break;case"height":p=Cr(ee);break;case"totalheight":y=Cr(ee);break;default:throw new r("Invalid key: '"+de[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:y,src:D}},mathmlBuilder:(e,t)=>{let n=it(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=it(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 y=new Xe(e.src,e.alt,p);return y.height=n,y.depth=i,new E("mtext",[y])}}),$({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",y=c.value.unit==="mu";if(p){if(!y)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(y)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=it(e.dimension,t),i=n.number>0&&n.unit==="em"?bs(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 bs=function(e){return e>=.05555&&e<=.05556?"\u200A":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200A":""},ys=/[^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(ys,"")}),mathmlBuilder(e,t){let n=new E("mrow",[],["tml-label"]);return e.string.length>0&&n.setLabel(e.string),n}});let na=["\\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(na.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(se(e.body),t),y=new E("mphantom",p);n=new E("mpadded",[y]),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:se(t[0]),text:se(t[1]),script:se(t[2]),scriptscript:se(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 ra=["text","textord","mathord","atom"];function ws(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=b(i),p=!0,y={type:"mathord",text:"",mode:e.mode},v=i.body?i.body:[i];for(let D of v){if(!ra.includes(D.type)){p=!1;break}Ne[e.mode][D.text]?y.text+=Ne[e.mode][D.text].replace:D.text?y.text+=D.text:D.body&&D.body.map(z=>{y.text+=z.text})}return p&&t==="\\mathord"&&y.type==="mathord"&&y.text.length>1?y:{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:se(p?y:i),isCharacterBox:c,mustPromote:p}},mathmlBuilder:ws});let xs=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:xs(t[0]),body:se(t[1]),isCharacterBox:b(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"?xs(i):"mrel";let y={type:p==="mrel"||p==="mbin"?"op":"ordgroup",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!=="\\stackrel",body:se(i)};return{type:"supsub",mode:c.mode,stack:!0,base:y,sup:t==="\\underset"?null:c,sub:t==="\\underset"?c:null}},mathmlBuilder:ws});let Jn=(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,y=i[1].body.length>0?i[1].body[0]:null;return p||y?p?{type:"multiscript",mode:e.mode,isSideset:t==="\\sideset",prescripts:p,postscripts:y,base:c}:{type:"styling",mode:e.mode,scriptLevel:"text",body:[{type:"supsub",mode:e.mode,base:c,sup:y.sup,sub:y.sub}]}:c},mathmlBuilder(e,t){let n=Oe(e.base,t),i=new E("mprescripts"),c=new E("none"),p=[],y=Jn(e.prescripts.sub,t,c),v=Jn(e.prescripts.sup,t,c);return e.isSideset&&(y.setAttribute("style","text-align: left;"),v.setAttribute("style","text-align: left;")),e.postscripts?p=[n,Jn(e.postscripts.sub,t,c),Jn(e.postscripts.sup,t,c),i,y,v]:p=[n,i,y,v],new E("mmultiscripts",p)}}),$({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){let n=b(t[0]),i;return n?(i=se(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 sa=["textord","mathord","atom"],oa=["\\smallint"],Nr=["textord","mathord","ordgroup","close","leftright","font"],vs=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)]),oa.includes(e.name)?n.setAttribute("largeop","false"):n.setAttribute("movablelimits","false"),e.fromMathOp&&vs(n);else if(e.body)n=new E("mo",Le(e.body,t)),e.fromMathOp&&vs(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},ia={"\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=ia[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&&sa.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:se(n)}},mathmlBuilder:Fn});let aa={"\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:Xn(i),needsLeadingSpace:n.length>0&&Nr.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:Xn(i),needsLeadingSpace:n.length>0&&Nr.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=aa[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:se(i),alwaysHandleSupSub:t==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:Xn(p),needsLeadingSpace:c.length>0&&Nr.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 y=i[p];if(y instanceof E)switch(((y.type==="mrow"||y.type==="mpadded")&&y.children.length===1&&y.children[0]instanceof E||y.type==="mrow"&&y.children.length===2&&y.children[0]instanceof E&&y.children[1]instanceof E&&y.children[1].type==="mspace"&&!y.children[1].attributes.width&&y.children[1].children.length===0)&&(y=y.children[0]),y.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(y.attributes.width){let v=y.attributes.width.replace("em",""),D=bs(Number(v));D===""?c=!1:i[p]=new E("mtext",[new Ie(D)])}break;case"mo":{let v=y.children[0];y.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(y=>y.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 y=new E("mspace");y.setAttribute("width","0.1667em"),p.unshift(y)}if(!e.isFollowedByDelimiter){let y=new E("mspace");y.setAttribute("width","0.1667em"),p.push(y)}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:se(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(se(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(se(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:se(t[0])}),mathmlBuilder(e,t){let n=Le(e.body,t),i=qe(n);return i.setAttribute("style","font-weight:bold"),i}});let ks=(e,t)=>{let n=t.withLevel(Ot),i=new E("mpadded",[Oe(e.body,n)]),c=it(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:ks}),$({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:ks}),$({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(ys,"")}),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=it(e.width,t),i=it(e.height,t),c=e.shift?it(e.shift,t):{number:0,unit:"em"},p=t.color&&t.getColor()||"black",y=new E("mspace");if(n.number>0&&i.number>0&&y.setAttribute("mathbackground",p),y.setAttribute("width",n.number+n.unit),y.setAttribute("height",i.number+i.unit),c.number===0)return y;let v=new E("mpadded",[y]);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 Es=/^[0-9]$/,la={0:"\u2080",1:"\u2081",2:"\u2082",3:"\u2083",4:"\u2084",5:"\u2085",6:"\u2086",7:"\u2087",8:"\u2088",9:"\u2089"},ca={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"||!Es.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"||!Es.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=>ca[p]).join(""),i=e.denominator.split("").map(p=>la[p]).join(""),c=new Ie(n+"\u2044"+i,e.mode,t);return new E("mn",[c],["special-fraction"])}});let Ss={"\\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(Ss[e.funcName]),i=Le(e.body,n),c=qe(i),p=(Ss[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 y=t[0];return{type:"smash",mode:e.mode,body:y,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 da=["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&&da.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 ua={display:0,text:1,script:2,scriptscript:3},pa={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(ua[e.scriptLevel]),i=Le(e.body,n),c=qe(i),p=pa[e.scriptLevel];return c.setAttribute("scriptlevel",p[0]),c.setAttribute("displaystyle",p[1]),c}});let ha=/^m(over|under|underover)$/;q({type:"supsub",mathmlBuilder(e,t){let n,i,c=!1,p=!1,y=!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,y=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 oe;if(c)oe=n?"mover":"munder";else if(e.sub)if(e.sup){let ee=e.base;oe=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;oe=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;oe=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 de=new E(oe,D);if(p){let ee=new E("mo",[ne("\u2061","text")]);if(v){let et=new E("mspace");et.setAttribute("width","0.1667em"),de=xe([et,de,ee])}else de=xe([de,ee]);if(y){let et=new E("mspace");et.setAttribute("width","0.1667em"),de.children.push(et)}}else ha.test(oe)&&(de=new E("mrow",[de]));return de}});let ma=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],fa=["\\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||fa.includes(i)})(e.text))n.setAttribute("stretchy","false");else if(ma.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 As={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},_s=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(As,n)?As[n]:null},ga=/^\d(?:[\d,.]*\d)?$/,ba=/[A-Ba-z]/,ya=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=_s(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 y=new E("mi",[n]);if(p==="normal"&&(y.setAttribute("mathvariant","normal"),n.text.length===1)){let v=new E("mspace",[]);y=new E("mrow",[y,v])}return y}}),q({type:"textord",mathmlBuilder(e,t){let n=e.text,i=n.codePointAt(0);t.fontFamily==="textsc"&&96<i&&i<123&&(n=Qi[n]);let c=ne(n,e.mode,t),p=_s(e,t)||"normal",y;if(ga.test(e.text)){let v=e.mode==="text"?"mtext":"mn";if(p==="italic"||p==="bold-italic")return((D,z,oe)=>{let de=new E(oe,[D]),ee=new E("mstyle",[de]);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("")),y=new E(v,[c])}else if(e.mode==="text")p!=="normal"&&(c.text=Sn(c.text,p)),y=new E("mtext",[c]);else if(ya.has(e.text))y=new E("mo",[c]),y.classes.push("tml-prime");else{let v=c.text;p!=="italic"&&(c.text=Sn(c.text,p)),y=new E("mi",[c]),c.text===v&&ba.test(v)&&y.setAttribute("mathvariant","italic")}return y}});let wa={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},xa={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};q({type:"spacing",mathmlBuilder(e,t){let n;if(Object.prototype.hasOwnProperty.call(xa,e.text))n=new E("mtext",[new Ie("\xA0")]);else{if(!Object.prototype.hasOwnProperty.call(wa,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 Ts={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Cs={"\\textbf":"textbf","\\textmd":"textmd"},va={"\\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:se(i),font:t}},mathmlBuilder(e,t){let n=((c,p)=>{let y=c.font;return y?Ts[y]?p.withTextFontFamily(Ts[y]):Cs[y]?p.withTextFontWeight(Cs[y]):y==="\\emph"?p.fontShape==="textit"?p.withTextFontShape("textup"):p.withTextFontShape("textit"):p.withTextFontShape(va[y]):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(ka(e)),i=new E("mtext",[n]);return i.setAttribute("mathvariant","monospace"),i}});let ka=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),fn=M,Ns=`[ \r
93
- ]`,Ea=`(\\\\[a-zA-Z@]+)${Ns}*`,$r="[\u0300-\u036F]",$s=new RegExp(`${$r}+$`),Sa=`(${Ns}+)|\\\\(
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}+)|\\\\(
94
94
  |[ \r ]+
95
- ?)[ \r ]*|([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]${$r}*|[\uD800-\uDBFF][\uDC00-\uDFFF]${$r}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Ea}|\\\\[^\uD800-\uDFFF])`;class Os{constructor(t,n){this.input=t,this.settings=n,this.tokenRegex=new RegExp(Sa,"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 Aa{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 Ms={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class _a{constructor(t,n,i){this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new Aa(vn,n.macros),this.mode=i,this.stack=[]}feed(t){this.lexer=new Os(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,y=0,v=0;do{if(p=this.popToken(),n.push(p),p.text==="{")++y;else if(p.text==="}"){if(--y,y===-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((y===0||y===1&&t[v]==="{")&&p.text===t[v]){if(++v,v===t.length){n.splice(-v,v);break}}else v=0}while(y!==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 y=this.popToken();if(c[p]!==y.text)throw new r("Use of the macro doesn't match its definition",y)}}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,y=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,...y[+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 Os(i,this.settings),y=[],v=p.lex();for(;v.text!=="EOF";)y.push(v),v=p.lex();return y.reverse(),{tokens:y,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(Ms,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 Ls=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Qn=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"}),Rs=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 Or={"\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"}},Is={\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 Ta=["bin","op","open","punct","rel"],Ca=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Na=/^ *\\text/;class zn{constructor(t,n,i=!1){this.mode="math",this.gullet=new _a(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 y=this.parseAtom(n);if(!y)break;y.type!=="internal"&&(c.push(y),this.prevAtomType=y.type==="atom"?y.family:y.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,y=t.slice(0,i),v=t.slice(i+1),D;return c=y.length===1&&y[0].type==="ordgroup"?y[0]:{type:"ordgroup",mode:this.mode,body:y},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 y=p.text==="\\limits";n.limits=y,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 y={type:"textord",mode:this.mode,text:"\\prime"},v=[y];for(this.consume();this.fetch().text==="'";)v.push(y),this.consume();this.fetch().text==="^"&&v.push(this.handleSupSubscript("superscript")),i={type:"ordgroup",mode:this.mode,body:v}}else{if(!Qn[p.text])break;{let y=Ls.test(p.text),v=[];for(v.push(new St(Qn[p.text])),this.consume();;){let z=this.fetch().text;if(!Qn[z]||Ls.test(z)!==y)break;v.unshift(new St(Qn[z])),this.consume()}let D=this.subparse(v);y?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:Xn(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 y=this.prevAtomType,{args:v,optArgs:D}=this.parseArguments(c,p);return this.prevAtomType=y,this.callFunction(c,v,D,i,t)}callFunction(t,n,i,c,p){let y={funcName:t,parser:this,token:c,breakOnTokenText:p},v=fn[t];if(v&&v.handler)return v.handler(y,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 y=0;y<i;y++){let v=n.argTypes&&n.argTypes[y],D=y<n.numOptionalArgs;(n.primitive&&v==null||n.type==="sqrt"&&y===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,y="";for(;(c=this.fetch()).text!=="EOF"&&t.test(y+c.text);)p=c,y+=p.text,this.consume();if(y==="")throw new r("Invalid "+n+": '"+i.text+"'",i);return i.range(p,y)}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=Ca.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 y={type:"ordgroup",mode:this.mode,loc:i.loc,body:p};return n&&this.switchMode(c),y}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 y=c==="{"?"}":c==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();let v=this.parseExpression(!1,y),D=this.fetch();this.expect(y),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(Ms,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),y=p.charAt(0)==="*";if(y&&(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:y}}if(Object.prototype.hasOwnProperty.call(Is,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=Is[n[0]]+n.slice(1)}let i=this.mode==="math"?$s.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"||!Ta.includes(this.prevAtomType)&&this.prevAtomType!==""||(p="open");let y=dt.range(t),v;if(Object.prototype.hasOwnProperty.call(Ee,p)){let D=p;v={type:"atom",mode:this.mode,family:D,loc:y,text:n},D!=="rel"&&D!=="bin"||this.prevAtomType!=="text"||Na.test(y.lexer.input.slice(y.end))&&(v.needsSpacing=!0)}else{if(Rs[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:y,text:Rs[n]}}}v={type:p,mode:this.mode,loc:y,text:n}}c=v}else{if(!(n.charCodeAt(0)>=128||$s.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 y=i[0][p];if(!Or[y])throw new r(`Unknown accent ' ${y}'`,t);let v=Or[y][this.mode]||Or[y].text;if(!v)throw new r(`Accent ${y} 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 Bs=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},$a=[2,2,3,3];class Mr{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 Mr(n)}withLevel(t){return this.extend({level:t})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:$a[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 Ps(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 y=p.attributes.id.value;t[y]=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 y=p.getElementsByClassName("tml-tag");if(y.length>0){let v=p.attributes.id.value;t[v]=y[0].textContent}}[...e.getElementsByClassName("tml-ref")].forEach(p=>{let y=p.getAttribute("href"),v=t[y.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 Oa=function(e,t,n){let i=n,c=0,p=e.length;for(;i<t.length;){let y=t[i];if(c<=0&&t.slice(i,i+p)===e)return i;y==="\\"?i++:y==="{"?c++:y==="}"&&c--,i++}return-1},Ma=/^\\(?:begin|(?:eq)?ref){/,Ds=[{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}],er={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},Lr=[{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}],La=function(e,t){let n=function(c,p){let y,v=[],D=new RegExp("("+p.map(z=>z.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")+")");for(;y=c.search(D),y!==-1;){y>0&&(v.push({type:"text",data:c.slice(0,y)}),c=c.slice(y));let z=p.findIndex(ee=>c.startsWith(ee.left));if(y=Oa(p[z].right,c,p[z].left.length),y===-1)break;let oe=c.slice(0,y+p[z].right.length),de=Ma.test(oe)?oe:c.slice(p[z].left.length,y);v.push({type:"math",data:de,rawData:oe,display:p[z].display}),c=c.slice(y+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"),y=n[c].data;t.displayMode=n[c].display;try{t.preProcess&&(y=t.preProcess(y)),ro.render(y,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},qs=function(e,t){for(let n=0;n<e.childNodes.length;n++){let i=e.childNodes[n];if(i.nodeType===3){let c=La(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)&&qs(i,t)}}},Fs=function(e,t,n={}){t.textContent="";let i=t.tagName.toLowerCase()==="math";i&&(n.wrap="none");let c=Rr(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."),Fs=function(){throw new r("Temml doesn't work in quirks mode.")});let Rr=function(e,t){let n=new I(t);try{let i=Bs(e,n);return Pt(i,e,new Mr({level:n.displayMode?ut:Ot,maxSize:n.maxSize}),n)}catch(i){return function(c,p,y){if(y.throwOnError||!(c instanceof r))throw c;let v=new Re(["temml-error"],[new be(p+`
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+`
98
98
 
99
- `+c.toString())]);return v.style.color=y.errorColor,v.style.whiteSpace="pre-line",v}(i,e,n)}};return{version:"0.13.3",render:Fs,renderToString:function(e,t){return Rr(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==="("?er[i]:i==="$+"||i==="(+"?er[i.slice(0,1)].concat(Lr):i==="ams"?Lr:i==="all"?er["("].concat(er.$).concat(Lr):Ds)(n.fences):n.delimiters=n.delimiters||Ds,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||{},qs(e,n),Ps(e)},postProcess:Ps,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 Bs(e,n)},__renderToMathMLTree:Rr,__defineSymbol:s,__defineMacro:L}}(),so=ro;function ml(r,a){return so.renderToString(r,{displayMode:a,throwOnError:!1})}function fl(r,a){let l=a;for(;(l=r.indexOf("$$",l))!==-1;){if(r[l-1]!=="\\")return l;l+=1}return-1}function gl(r){let a=[],l="",d=()=>{l&&(a.push({type:"text",value:l}),l="")},u=0;for(;u<r.length;){let h=r[u];if(h==="\\"){let f=r[u+1];if(f==="$"){l+="$",u+=2;continue}if(f==="("){let m=r.indexOf("\\)",u+2);if(m!==-1){d(),a.push({type:"math",tex:r.slice(u+2,m),display:!1}),u=m+2;continue}}l+=f===void 0?h:h+f,u+=f===void 0?1:2;continue}if(h==="$"&&r[u+1]==="$"){let f=fl(r,u+2);if(f!==-1){d(),a.push({type:"math",tex:r.slice(u+2,f),display:!0}),u=f+2;continue}}l+=h,u+=1}return d(),a}var bl="code, pre, script, style, svg, aside, math";function yl(r){let a=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:d=>d.parentElement&&d.parentElement.closest(bl)?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=gl(d.nodeValue);if(u.length===1&&u[0].type==="text"&&u[0].value===d.nodeValue)continue;let h=document.createDocumentFragment();for(let f of u)if(f.type==="text")h.appendChild(document.createTextNode(f.value));else{let m=document.createElement("span");m.innerHTML=ml(f.tex,f.display),h.appendChild(m.firstElementChild??document.createTextNode(""))}d.parentNode.replaceChild(h,d)}}function oo(r){r.querySelectorAll("section[data-math]").forEach(a=>yl(a))}ae();le();ae();le();var To=za(_o(),1);var ht=To.default;ae();le();function Co(r){let a=r.regex,l=r.COMMENT("--","$"),d={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},u={begin:/"/,end:/"/,contains:[{match:/""/}]},h=["true","false","unknown"],f=["double precision","large object","with timezone","without timezone"],m=["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"],S=["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=S,$=[...k,...b].filter(Te=>!S.includes(Te)),q={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},he={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},se={match:a.concat(/\b/,a.either(...C),/\s*\(/),relevance:0,keywords:{built_in:C}};function ce(Te){return a.concat(/\b/,a.either(...Te.map($e=>$e.replace(/\s+/,"\\s+"))),/\b/)}let U={scope:"keyword",match:ce(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:h,type:m,built_in:I},contains:[{scope:"type",match:ce(f)},U,se,q,d,u,r.C_NUMBER_MODE,r.C_BLOCK_COMMENT_MODE,l,he]}}ae();le();var No="[A-Za-z$_][0-9A-Za-z$_]*",lc=["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"],cc=["true","false","null","undefined","NaN","Infinity"],$o=["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"],Oo=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Mo=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],dc=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],uc=[].concat(Mo,$o,Oo);function Lo(r){let a=r.regex,l=(H,{after:fe})=>{let Ee="</"+H[0].slice(1);return H.input.indexOf(Ee,fe)!==-1},d=No,u={begin:"<>",end:"</>"},h=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,fe)=>{let Ee=H[0].length+H.index,ze=H.input[Ee];if(ze==="<"||ze===","){fe.ignoreMatch();return}ze===">"&&(l(H,{after:Ee})||fe.ignoreMatch());let Ne,s=H.input.substring(Ee);if(Ne=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Ne=s.match(/^\s+extends\s+/))&&Ne.index===0){fe.ignoreMatch();return}}},m={$pattern:No,keyword:lc,literal:cc,built_in:uc,"variable.language":dc},b="[0-9](_?[0-9])*",k=`\\.(${b})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",I={className:"number",variants:[{begin:`(\\b(${S})((${k})|\\.)?|(${k}))[eE][+-]?(${b})\\b`},{begin:`\\b(${S})\\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:m,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]},ce={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]},U=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,{match:/\$\d+/},I];M.contains=U.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(U)});let me=[].concat(ce,M.contains),Te=me.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(me)}]),$e={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,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:{_:[...$o,...Oo]}},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(H){return a.concat("(?!",H.join("|"),")")}let Ie={match:a.concat(/\b/,E([...Mo,"super","import"].map(H=>`${H}\\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:m,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,ce,{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:[ce,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:m,contains:Te}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:h},{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 cr="[A-Za-z$_][0-9A-Za-z$_]*",Ro=["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"],Io=["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"],qo=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Fo=[].concat(Do,Bo,Po);function pc(r){let a=r.regex,l=(H,{after:fe})=>{let Ee="</"+H[0].slice(1);return H.input.indexOf(Ee,fe)!==-1},d=cr,u={begin:"<>",end:"</>"},h=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,fe)=>{let Ee=H[0].length+H.index,ze=H.input[Ee];if(ze==="<"||ze===","){fe.ignoreMatch();return}ze===">"&&(l(H,{after:Ee})||fe.ignoreMatch());let Ne,s=H.input.substring(Ee);if(Ne=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Ne=s.match(/^\s+extends\s+/))&&Ne.index===0){fe.ignoreMatch();return}}},m={$pattern:cr,keyword:Ro,literal:Io,built_in:Fo,"variable.language":qo},b="[0-9](_?[0-9])*",k=`\\.(${b})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",I={className:"number",variants:[{begin:`(\\b(${S})((${k})|\\.)?|(${k}))[eE][+-]?(${b})\\b`},{begin:`\\b(${S})\\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:m,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]},ce={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]},U=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,{match:/\$\d+/},I];M.contains=U.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(U)});let me=[].concat(ce,M.contains),Te=me.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(me)}]),$e={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,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(H){return a.concat("(?!",H.join("|"),")")}let Ie={match:a.concat(/\b/,E([...Do,"super","import"].map(H=>`${H}\\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:m,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,ce,{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:[ce,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:m,contains:Te}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:h},{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 zo(r){let a=r.regex,l=pc(r),d=cr,u=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],h={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]},m={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},b=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],k={$pattern:cr,keyword:Ro.concat(b),literal:Io,built_in:Fo.concat(u),"variable.language":qo},S={className:"meta",begin:"@"+d},I=(q,he,se)=>{let ce=q.contains.findIndex(U=>U.label===he);if(ce===-1)throw new Error("can not find mode to replace");q.contains.splice(ce,1,se)};Object.assign(l.keywords,k),l.exports.PARAMS_CONTAINS.push(S);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([S,h,f,C]),I(l,"shebang",r.SHEBANG()),I(l,"use_strict",m);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 Uo(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"],m={$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:m,illegal:/#/},S={begin:/\{\{/,relevance:0},I={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,S,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[r.BACKSLASH_ESCAPE,b,S,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,S,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,S,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:m,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},se={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:["self",b,q,I,r.HASH_COMMENT_MODE]}]};return k.contains=[I,q,b],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:m,illegal:/(<\/|\?)|=>/,contains:[b,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:[se]},{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,se,I]}]}}ae();le();function Ho(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]},h=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"})]}},m={className:"string",begin:/"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,l,u]};u.contains.push(m);let b={match:/\\"/},k={className:"string",begin:/'/,end:/'/},S={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"],se={match:/(\/[a-z._-]+)+/},ce=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],U=["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:[...ce,...U,"set","shopt",...me,...Te]},contains:[C,r.SHEBANG(),$,I,h,f,se,m,b,k,S,l]}}ae();le();function Go(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:/\}/}]},h={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]},m=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,h,f],se=[...he];return se.pop(),se.push(m),C.contains=se,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:he}}ae();le();function jo(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])*",dr=`\\.(${$n})`,ur="[0-9a-fA-F](_*[0-9a-fA-F])*",Ko={className:"number",variants:[{begin:`(\\b(${$n})((${dr})|\\.)?|(${dr}))[eE][+-]?(${$n})[fFdD]?\\b`},{begin:`\\b(${$n})((${dr})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${dr})[fFdD]?\\b`},{begin:`\\b(${$n})[fFdD]\\b`},{begin:`\\b0[xX]((${ur})\\.?|(${ur})?\\.(${ur}))[pP][+-]?(${$n})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ur})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Wo(r,a,l){return l===-1?"":r.replace(a,d=>Wo(r,a,l-1))}function Vo(r){let a=r.regex,l="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",d=l+Wo("(?:<"+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"]}]},S={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:[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:[S,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,Ko,r.C_BLOCK_COMMENT_MODE]},r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE]},Ko,k]}}ae();le();function Zo(r){let h={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:h,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:h,illegal:/["']/}]}]}}ae();le();function Xo(r){let a=r.regex,l=/(r#)?/,d=a.concat(l,r.UNDERSCORE_IDENT_RE),u=a.concat(l,r.IDENT_RE),h={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))?",m=["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!"],S=["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:S,keyword:m,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:S}},{className:"punctuation",begin:"->"},h]}}ae();le();function Yo(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]+;/},h={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},f=r.inherit(h,{begin:/\(/,end:/\)/}),m=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:[h,b,m,f,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[h,f,b,m]}]}]},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: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 hc=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_-]*/}}),mc=["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"],fc=["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"],gc=[...mc,...fc],bc=["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(),yc=["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(),wc=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),xc=["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 Jo(r){let a=r.regex,l=hc(r),d={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},u="and or not only",h=/@-?\w[\w]*(-\w+)*/,f="[a-zA-Z-][a-zA-Z0-9_-]*",m=[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:":("+yc.join("|")+")"},{begin:":(:)?("+wc.join("|")+")"}]},l.CSS_VARIABLE,{className:"attribute",begin:"\\b("+xc.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[l.BLOCK_COMMENT,l.HEXCOLOR,l.IMPORTANT,l.CSS_NUMBER_MODE,...m,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...m,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},l.FUNCTION_DISPATCH]},{begin:a.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:h},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:u,attribute:bc.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...m,l.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+gc.join("|")+")\\b"}]}}ae();le();function Qo(r){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}ht.registerLanguage("sql",Co);ht.registerLanguage("javascript",Lo);ht.registerLanguage("typescript",zo);ht.registerLanguage("python",Uo);ht.registerLanguage("bash",Ho);ht.registerLanguage("yaml",Go);ht.registerLanguage("json",jo);ht.registerLanguage("java",Vo);ht.registerLanguage("go",Zo);ht.registerLanguage("rust",Xo);ht.registerLanguage("xml",Yo);ht.registerLanguage("css",Jo);ht.registerLanguage("plaintext",Qo);ht.registerAliases(["js"],{languageName:"javascript"});ht.registerAliases(["ts"],{languageName:"typescript"});ht.registerAliases(["shell","sh","zsh"],{languageName:"bash"});ht.registerAliases(["html"],{languageName:"xml"});ht.registerAliases(["text","plain"],{languageName:"plaintext"});function vc(r,a){return r.split("|").map(l=>{if(l=l.trim(),l===""||l==="all")return Array.from({length:a},(u,h)=>h+1);let d=[];for(let u of l.split(",")){let h=u.trim().match(/^(\d+)(?:-(\d+))?$/);if(!h)continue;let f=parseInt(h[1],10),m=h[2]?parseInt(h[2],10):f;for(let b=f;b<=Math.min(m,a);b++)d.push(b)}return d})}function kc(r){let a=[[]];for(function l(d,u){for(let h of d.childNodes)h.nodeType===Node.TEXT_NODE?h.nodeValue.split(`
100
- `).forEach((m,b)=>{b>0&&a.push([]),m&&a[a.length-1].push({path:u,text:m})}):h.nodeType===Node.ELEMENT_NODE&&l(h,[...u,h])}(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:h}of l){let f=d;for(let m of u){let b=f.lastChild;b&&b.__orig===m||(b=m.cloneNode(!1),b.__orig=m,f.appendChild(b)),f=b}f.appendChild(document.createTextNode(h))}r.appendChild(d)}return r.querySelectorAll(":scope > .code-line")}function Ec(r,a){if(r.length===a)return"all lines";let l=[...r],d=[],u=l[0],h=l[0];for(let f of l.slice(1)){if(f===h+1){h=f;continue}d.push(u===h?`${u}`:`${u}-${h}`),u=h=f}return d.push(u===h?`${u}`:`${u}-${h}`),`lines ${d.join(",")}`}function ei(r,a){r.querySelectorAll("pre > code").forEach(l=>{let d=[...l.classList].find(S=>S.startsWith("language-")),u=d?d.slice(9):null,h=l.textContent.replace(/^\n/,"").replace(/\s+$/,"");u&&ht.getLanguage(u)?l.innerHTML=ht.highlight(h,{language:u}).value:l.textContent=h,l.classList.add("hljs");let f=l.parentElement,m=kc(l);f.hasAttribute("data-lines-numbers")&&f.classList.add("line-numbers");let b=f.getAttribute("data-lines");if(!b)return;let k=vc(b,m.length);f.classList.add("stepping"),a(f,{count:k.length,label:S=>S===0?"code":Ec(k[S-1],m.length),apply(S){if(m.forEach(C=>C.classList.remove("line-hl","line-dim")),S===0)return;let I=new Set(k[S-1]),M=I.size===m.length;m.forEach((C,$)=>{I.has($+1)?C.classList.add("line-hl"):M||C.classList.add("line-dim")})}})})}ae();le();var Sc=/⟨CLICK⟩|&lt;CLICK&gt;|<click(?:\s[^>]*)?>(?:<\/click>)?/gi;function ti(r){return(r||"").split(Sc)}function Kr(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:()=>ni(r,u()),next:()=>r.next(),prev:()=>r.prev()},r.__notifySpeaker=()=>{r.__speakerCb&&!l.closed&&r.__speakerCb(ni(r,u()))};let h=`${r.config.width} / ${r.config.height}`;return l.document.write(`<!doctype html><html><head><meta charset="utf-8">
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">
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;
@@ -123,7 +123,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),H===void 0&
123
123
  .thumbs { display:flex; flex-direction:column; gap:10px; min-height:0; align-items:start; }
124
124
  /* Panes keep the presentation's aspect ratio: width-driven, capped so a
125
125
  short window can't push the notes off screen. */
126
- .thumb { width:min(100%, calc(42vh * (${h}))); aspect-ratio:${h}; border:1px solid #333; border-radius:8px; overflow:hidden; position:relative; }
126
+ .thumb { width:min(100%, calc(42vh * (${m}))); aspect-ratio:${m}; border:1px solid #333; border-radius:8px; overflow:hidden; position:relative; }
127
127
  .thumb .tag { position:absolute; top:6px; left:8px; z-index:2; background:#0009; padding:1px 8px; border-radius:4px; font-size:11px; }
128
128
  iframe { width:100%; height:100%; border:0; background:#000; }
129
129
  aside { grid-column:1/3; overflow:auto; background:#1b1b1b; border-radius:8px; padding:14px 16px; font-size:16px; line-height:1.65; }
@@ -227,30 +227,30 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),H===void 0&
227
227
  }
228
228
  connect(30);
229
229
  <\/script>
230
- </body></html>`),l.document.close(),l}function ni(r,a){let{slide:l,step:d,totalSlides:u}=r.state,h=r._records[l-1],f=h?h.groups.length:0,m=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:a,nextHash:m,notesSegments:ti(b?b.innerHTML:""),rehearseSegments:k?ti(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((h,f)=>h.classList.toggle(l,f===u)),d&&r[u]?.scrollIntoView({block:"nearest"}),u}function pr(r,{query:a="",onMove:l,onCommit:d,onType:u,onBackspace:h,onClear:f,onClose:m}){switch(r.key){case"ArrowDown":return l?.(1),!0;case"ArrowUp":return l?.(-1),!0;case"Enter":return d?.(),!0;case"Backspace":return h?(h(),!0):!1;case"Escape":return a&&f?f():m?.(),!0;default:return r.key.length===1&&u?(u(r.key),!0):!1}}function ri(){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 Ac(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)),h=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+h)*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 _c(r,a){let[l,d]=[Mn(r),Mn(a)].sort((u,h)=>h-u);return(l+.05)/(d+.05)}var On=(r,a)=>Math.min(...a.map(l=>_c(r,l)));function mt(r,a,l,d,u){let f=d.reduce((S,I)=>S+Mn(I),0)/d.length<.5?1:-1,m=[];for(let S=a;S>0;S-=15)m.push(S);m.push(0);for(let S of[f,-f])for(let I of m)for(let M=l;M>=2&&M<=98;M+=S){let C=Zt(r,I,M);if(On(C,d)>=u)return C}let b=[253,253,254],k=[8,9,10];return On(b,d)>=On(k,d)?b:k}var Tc=["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"],Wr='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',Cc='ui-rounded, "SF Pro Rounded", "Segoe UI", Roboto, Helvetica, Arial, sans-serif',Nc='"Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif',$c='"SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code", Menlo, Consolas, monospace',Oc=[Wr,Wr,Cc,Nc],Mc=[600,650,700,750,800],Lc=["4px","6px","8px","10px","12px","14px","18px"],si={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 hr(r){r=(r??Math.floor(Math.random()*4294967295))>>>0;let a=Ac(r),l=X=>X[Math.floor(a()*X.length)],d=(X,Y)=>X+a()*(Y-X),u=a()<.5,h=Math.floor(a()*360),f=l(Object.keys(si)),m=si[f],b=h+m[0],k=a()*a(),S=(X,Y)=>X+k*(Y-X),I=S(5,yn.bgSatMax[u?"dark":"light"]),M=u?d(6,13):d(94,97.5),C=Zt(h,I,M),$=un(C),q=[C];if(a()<yn.gradientChance){let X=Zt(h+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(h,Math.min(I+4,35),u?M+4:M-4),se=mt(h,12,u?86:18,q,4.6),ce=mt(h,10,u?64:44,q,3.1),me=a()<.5?mt(b,S(20,55),u?80:26,q,3.2):mt(h,8,u?92:12,q,4.6),Te=S(...yn.accentSat),$e=u?d(55,68):d(34,48),Re=Zt(b,Te,$e);for(;Math.max(On([253,253,254],[Re]),On([8,9,10],[Re]))<4.7;)$e+=u?1:-1,Re=Zt(b,Te,$e);let be=mt(b,18,Mn(Re)<.4?96:10,[Re],4.6),Ce=mt(a()<.5?b:h+(m[1]??30),S(35,60),u?70:34,q,3.2),Xe=un(he),xe=`1px solid ${un(Zt(h,Math.min(I+6,40),u?M+10:M-10))}`,E=l(Lc),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(h,Math.min(I+2,28),u?Math.max(M-3,3):Math.min(M-3,93)),De=[qe],F=mt(h,8,u?85:20,De,4.6),J={keyword:m[0],string:m[3]??120,number:m[2]??60,function:m[1]??210,type:m[4]??280},H=S(...yn.hlSat),fe=u?68:36,Ee={};for(let[X,Y]of Object.entries(J))Ee[X]=mt(h+Y,H,fe,De,4.6);Ee.comment=mt(h,12,u?60:46,De,3.2),Ee.punct=mt(h,10,u?74:32,De,4.6);let Ne=[0,m[0],m[1]??40,m[2]??90,m[3]??160,m[4]??230].map((X,Y)=>Zt(h+X,S(14,34),u?M+8+Y%3*2:M-6-Y%3*2)),s=[...q,...Ne],o=mt(h,14,u?60:42,q,2.2),O=mt(h,10,u?84:20,s,3.4),Be=mt(h,10,u?62:46,s,2.7),P=mt(b,Te,u?68:38,s,2.7),Ue=Ne.map(un),nt=Zt(h,Math.min(I+4,30),u?Math.max(M-4,3):d(12,18)),W=[nt],Ae=mt(h,8,82,W,4.6),Q=mt(b,S(...yn.ansiSat),66,W,3.2),ye={red:8,green:125,yellow:45,blue:215,magenta:290,cyan:175},x={black:mt(h,10,58,W,3.1),white:mt(h,6,88,W,4.6)};for(let[X,Y]of Object.entries(ye))x[X]=mt(Y+h%16-8,S(...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]:mt(h,8,90,W,3.1)},g=`gen-${l(Tc)}-${(r%65535).toString(16).padStart(4,"0")}`,j=un,B={"--bg":$,"--bg-accent":un(he),"--fg":j(se),"--muted":j(ce),"--font-body":Wr,"--font-heading":l(Oc),"--font-mono":$c,"--heading-color":j(me),"--heading-weight":String(l(Mc)),"--link":j(Ce),"--accent":j(Re),"--accent-contrast":j(be),"--block-bg":Xe,"--block-border":xe,"--block-radius":E,"--shadow":Ie,"--code-bg":j(qe),"--code-fg":j(F),"--hl-keyword":j(Ee.keyword),"--hl-string":j(Ee.string),"--hl-number":j(Ee.number),"--hl-comment":j(Ee.comment),"--hl-function":j(Ee.function),"--hl-type":j(Ee.type),"--hl-punct":j(Ee.punct),"--d-stroke":j(o),"--d-text":j(O),"--d-muted":j(Be),"--d-accent":j(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":j(nt),"--term-fg":j(Ae),"--term-prompt":j(Q),"--term-cursor":j(Q),"--term-selection":`rgba(${Re[0]}, ${Re[1]}, ${Re[2]}, 0.30)`,"--ansi-black":j(x.black),"--ansi-red":j(x.red),"--ansi-green":j(x.green),"--ansi-yellow":j(x.yellow),"--ansi-blue":j(x.blue),"--ansi-magenta":j(x.magenta),"--ansi-cyan":j(x.cyan),"--ansi-white":j(x.white),"--ansi-bright-black":j(we(x.black)),"--ansi-bright-red":j(we(x.red)),"--ansi-bright-green":j(we(x.green)),"--ansi-bright-yellow":j(we(x.yellow)),"--ansi-bright-blue":j(we(x.blue)),"--ansi-bright-magenta":j(we(x.magenta)),"--ansi-bright-cyan":j(we(x.cyan)),"--ansi-bright-white":j(mt(h,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 oi=[["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 Vr(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 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
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,h]of oi){let f=h.filter(m=>a[m]!==void 0);if(f.length){l+=` /* \u2500\u2500 ${u} ${"\u2500".repeat(Math.max(1,26-u.length))} */
238
- `;for(let m of f)l+=` ${m}: ${a[m]};
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]};
239
239
  `;l+=`
240
- `}}let d=new Set(oi.flatMap(([,u])=>u));for(let[u,h]of Object.entries(a))d.has(u)||(l+=` ${u}: ${h};
240
+ `}}let d=new Set(ui.flatMap(([,u])=>u));for(let[u,m]of Object.entries(a))d.has(u)||(l+=` ${u}: ${m};
241
241
  `);return l.replace(/\n$/,"")+`}
242
- `}function ii({root:r,config:a,params:l,toast:d,debugLog:u,overlays:h,deck:f,editmode:m}){let b=[...document.querySelectorAll("style[data-theme]:not([data-theme-added])")],k=[...document.querySelectorAll("style[data-theme][data-theme-added]")],S=new Set(k.map(N=>N.dataset.theme).filter(Boolean)),I=b.length>0,M=I?null:document.querySelector('link[rel="stylesheet"][href*="themes/"]');if(I){let N=b.find(G=>!G.hasAttribute("disabled")&&G.media!=="not all");N=N||b[0],b.forEach(G=>{G.removeAttribute("disabled"),G.media=G===N?"all":"not all"})}let C=I||!!M,$=N=>(N.match(/themes\/([\w-]+)\.css/)||[])[1],q="decklight-theme:"+location.pathname,he="decklight-custom-themes",se={};try{se=JSON.parse(localStorage.getItem(he)||"{}")||{}}catch{}let ce=null,U=null,me={};function Te(N,G,ie){let pe=ie==="generated"?ce: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=Vr(N,G),document.head.appendChild(pe),ie==="generated"?ce=pe:me[N]=pe,pe}let $e=()=>[ce,...Object.values(me),...k];function Re(N){for(let G of $e())G&&G!==N&&(G.media="not all")}let be=()=>$e().find(N=>N&&N.media!=="not all")||null,Ce=()=>{let N=be();return N?N.dataset.theme:I?b.find(G=>G.media!=="not all")?.dataset.theme:M?$(M.href):void 0};function Xe(){let N=getComputedStyle(r),G=Pe=>Pe?.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[\s,/]+([\d.]+))?\)/),ie=G(N.backgroundColor);(!ie||ie[4]!==void 0&&+ie[4]==0)&&(ie=G(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,G=!1){if(!N||!/^[\w-]+$/.test(N))return;let ie=!1;if(U&&ce&&N===U.name)ce.media="all",Re(ce),ie=!se[N];else if(se[N]){let pe=Te(N,se[N],"custom");pe.media="all",Re(pe)}else if(S.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=b.find(Pe=>Pe.dataset.theme===N);if(!pe)return;b.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{}G||d(N),u("theme",N),Xe()}let E=typeof Ve<"u"?Ve:null,Ie={added:"Added",custom:"Custom",generated:"Generated"},qe=N=>E?.labels?.[N]??Ie[N]??N;function De(N){if(se[N])return"custom";if(U&&N===U.name)return"generated";if(S.has(N))return"added";if(E){for(let[G,ie]of Object.entries(E.packs))if(ie.includes(N))return G}return"other"}let F=()=>{let N;if(I){let ie=b.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 G=[...S,...Object.keys(se)];if(U&&!se[U.name]&&G.push(U.name),N=[...N,...G.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 G=[];for(let ie of E.order){let pe=(E.packs[ie]??[]).filter(Pe=>N.includes(Pe));pe.length&&G.push([ie,pe])}for(let ie of["added","custom","generated"]){let pe=N.filter(Pe=>De(Pe)===ie);pe.length&&G.push([ie,pe])}return G}let H=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,G=!1){U={name:N.name,tokens:N.tokens};let ie=Te(N.name,N.tokens,"generated");return ie.media="all",Re(ie),G||d(`\u2728 ${N.name} \u2014 \u2303T re-roll \xB7 \u2303\u21E7T save`,2800),Xe(),N.name}function ze(){return Ee(hr())}function Ne(N){if(!U||!ce||ce.media==="not all")return d("no generated theme to save \u2014 \u2303T to generate one"),null;let G=N??(window.prompt?.("Save theme as:",U.name.replace(/^gen-/,""))||"");if(G=String(G).toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),!G)return null;((typeof Ke<"u"?Ke:[]).includes(G)||b.some(Pe=>Pe.dataset.theme===G))&&(G="custom-"+G),se[G]=U.tokens;try{localStorage.setItem(he,JSON.stringify(se))}catch{}let pe=Te(G,se[G],"custom");if(pe.media="all",ce?.remove(),ce=null,U=null,Re(pe),!l.has("embedded"))try{localStorage.setItem(q,G)}catch{}try{let Pe=new Blob([Vr(G,se[G])],{type:"text/css"}),Se=document.createElement("a");Se.href=URL.createObjectURL(Pe),Se.download=`${G}.css`,Se.click(),setTimeout(()=>URL.revokeObjectURL(Se.href),5e3)}catch{}return d(`saved ${G} \u2014 ${G}.css downloaded`,2200),G}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 G=F();if(!C||G.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,G.indexOf(ie)),Pe=G[(pe+N+G.length)%G.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 G=N.data&&N.data.__decklightPreview;!G||N.source!==window.parent||(G.gen?Ee(G.gen,!0):G.theme?xe(G.theme,!0):G.goto&&f().goto(G.goto[0],G.goto[1]??0))});function Be(){let N=Ce(),G=se[N]?{name:N,tokens:se[N]}:U&&N===U.name?U:null;return G?"?embedded&gen="+H(G):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 G=null;try{G=localStorage.getItem(q)}catch{}let ie=l.get("theme")||G;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,j,B=[],X=null,Y="",ge="packs",V=()=>E?"packs":"all",ne=()=>m?.()?.available()===!0,Fe=()=>m?.()?.base()??"",Je=()=>ne()?[Q]:[],re=null,ke=N=>(re?.themes??[]).find(G=>G.qualified===N);async function He(){re={loading:!0,themes:[],stale:[]},_t("browse");let N;try{let G=await fetch(Fe()+"/edit/theme/browse"),ie=await G.json().catch(()=>({}));N=G.ok&&ie.ok?{themes:ie.themes??[],stale:ie.stale??[],cacheOnly:ie.cacheOnly!==!1}:{themes:[],stale:[],error:ie.error||`the author server said ${G.status}`}}catch{N={themes:[],stale:[],error:"the author server did not answer"}}!we||ge!=="browse"||(re=N,_t("browse"))}async function _e(N){let G=we?.querySelector(".tp-caption");G&&(G.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 ");G&&(G.textContent=Pe||`install failed (${ie.status})`),d(`${N}: ${pe.error||"install refused"}`,3600);return}it(),d(`installed ${pe.name}${pe.replaced?" (replaced)":""} \u2014 Z takes it back`,2800),u("theme",`${N} installed from a marketplace`)}catch{G&&(G.textContent="the author server did not answer")}}function Le(N){let G=f().state,ie="#/"+G.slide+"/"+G.step;if(N===Ue||se[N]||U&&N===U.name){let pe=N===Ue?X:se[N]?{name:N,tokens:se[N]}:U;return location.pathname+"?embedded&gen="+H(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=hr();let N=B.indexOf(Ue);N<0||(Qe(we.querySelectorAll(".tp-row")[N]),te(N,!0))}function Ye(){let N=we.querySelector(".tp-list"),G=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=S.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(G)?" tp-current":""),rt.textContent=`\u25B8 ${qe(at)}`,pe(rt,String(Et.length))}else{rt.className="tp-row"+(Se===G?" tp-current":""),rt.textContent=Se;let at=se[Se]?"custom":U&&Se===U.name?"generated":S.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),ft()}),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(),G=B.indexOf(N);if(G>=0)return G;let ie=B.indexOf(nt+De(N));return ie>=0?ie:Math.min(1,B.length-1)}function _t(N,G=!1){ge=N,Ye(),B.length&&te(ct(),G)}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 it();h.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,it),r.appendChild(we);let G=Ce();G&&Ct(we.querySelector("iframe"),G),te(ct(),!G)}function te(N,G){if(!B.length)return;g=(N+B.length)%B.length;let ie=B[g];ie===Ue&&!X&&(X=hr(),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(j),ie!==Ue&&x(ie))return;let Se=we.querySelector("iframe");G?Ct(Se,ie):j=setTimeout(()=>Ct(Se,ie),60)}function nn(N){let G=ke(N);return G?[G.qualified,G.description,S.has(G.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||se[N]||U&&N===U.name?{gen:N===Ue?X:se[N]?{name:N,tokens:se[N]}:U}:{theme:N}}function Ct(N,G){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(G);return}if(!Dt){qt=G;return}N.contentWindow?.postMessage({__decklightPreview:Xt(G)},"*")}function ft(){let N=B[g];if(N!==void 0){if(N===Ue){X&&Ee(X),it();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),it()}}function it(){clearTimeout(j),we?.remove(),we=null}let st=h.register({isOpen:()=>!!we,close:it,keydown(N){switch(N.key){case"ArrowDown":te(g+1,!1);break;case"ArrowUp":te(g-1,!1);break;case"Enter":ft();break;case"Backspace":Pt(Y.slice(0,-1));break;case"Escape":Y?Pt(""):ge!==V()?_t(V()):it();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:it,browse(){we||Kt(),we&&He()},hasGenerated:()=>!!U,rollFromPicker(){return we&&B[g]===Ue?(Oe(),!0):!1}}}ae();le();ae();le();ae();le();var Zr=["A","B","C","D","E","F","G","H","X"],Ln="#edb58e",ai="#c98f6d",Rc="#43302a",Rn="#b96b58",In="#57262c",mr="#f6f1ea",li="#d17a70",Xr=`<svg viewBox="0 0 240 240" role="img" aria-label="Narrator" xmlns="http://www.w3.org/2000/svg">
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">
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
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="${ai}"/>
248
+ <path d="M106 142 L 106 156 C 114 162 126 162 134 156 L 134 142 Z" fill="${hi}"/>
249
249
  <g data-idle>
250
250
  <circle cx="75" cy="98" r="9" fill="${Ln}"/>
251
251
  <circle cx="165" cy="98" r="9" fill="${Ln}"/>
252
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="${Rc}"/>
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}"/>
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"/>
@@ -263,36 +263,36 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),H===void 0&
263
263
  <circle cx="138.3" cy="95.6" r=".8" fill="#fff"/>
264
264
  <g data-eyelid><rect x="95" y="90.5" width="16" height="12" rx="6" fill="${Ln}"/></g>
265
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="${ai}" stroke-width="3" fill="none" stroke-linecap="round"/>
266
+ <path d="M120 101 L 117 115 Q 120 119 124 116" stroke="${hi}" 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
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
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="${mr}"/></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="${mr}"/></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="${mr}"/><ellipse cx="120" cy="140" rx="9" ry="4.5" fill="${li}"/></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
274
  <g data-mouth="E"><ellipse cx="120" cy="131" rx="9" ry="7" fill="${In}" stroke="${Rn}" stroke-width="3"/></g>
275
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="${mr}"/><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="${li}"/></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>
278
278
  </g>
279
279
  </g>
280
- </svg>`;function Ic(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,h=-1;for(;d<=u;){let m=d+u>>1;l[m].t<=a?(h=m,d=m+1):u=m-1}if(h<0)return"X";let f=l[h].v;return Zr.includes(f)?f:"X"}function ci(r){let a=h=>Math.round(h*1e3)/1e3,l=[],d=(h,f)=>{l.length&&l[l.length-1].v===f||l.push({t:a(h),v:f})},u=0;for(let{timeline:h,gap:f=0}of r){f>0&&(d(u,"X"),u+=f);for(let m of h?.cues??[])d(u+m.t,m.v);u+=h?.duration??0}return{v:1,kind:"visemes",duration:a(u),source:"stitch",cues:l}}function di({root:r,config:a,debugLog:l,toast:d}){let u=a.narration?.character??{},h=u.bridgeUrl??"http://127.0.0.1:8789",f=u.fallback??"amplitude",m="decklight-character:"+location.pathname,b=u.mode??"off",k=u.engine??"wav2lip",S=u.portrait??"default",I=u.solo??!1;try{let Q=JSON.parse(localStorage.getItem(m));Q?.mode&&(b=Q.mode,k=Q.engine??k,S=Q.portrait??S),typeof Q?.solo=="boolean"&&(I=Q.solo)}catch{}let M=null,C=null,$=null,q=null,he=null,se=null,ce=null,U=0,me=!1,Te,$e=new Map,Re=new Map,be=Q=>`${Q}|${k}|${S}`;function Ce(){try{localStorage.setItem(m,JSON.stringify({mode:b,engine:k,portrait:S,solo:I}))}catch{}}function Xe(){r.classList.toggle("decklight-solo",I&&b!=="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)),$!==b)if($=b,M.classList.toggle("mode-video",b==="video"),C=null,b==="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 Zr){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=Xr,fetch(u.svg).then(Q=>Q.text()).then(Q=>{M&&$==="viseme"&&(M.innerHTML=Q)}).catch(()=>{})):M.innerHTML=Xr}function Ie(){E(),M.classList.add("show"),U||(U=setInterval(Ne,33)),Xe()}function qe(){U&&(clearInterval(U),U=0),M?.classList.remove("show"),C?.pause(),he=null,se=null,De("X"),Xe()}function De(Q){Q===ce||!M||(ce=Q,M.setAttribute("data-viseme",Q))}let F=null,J=null,H=null,fe=null;function Ee(){if(f!=="amplitude"||!q)return!1;if(H===q)return!!J;H=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(b==="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(Ic(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 j=Date.now(),B=await fetch(`${h}/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()-j)/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 j=Date.now(),B=await fetch(`${h}/video?engine=${k}&portrait=${encodeURIComponent(S)}`,{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()-j)/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){b==="viseme"?s(Q,ye,x).catch(()=>{}):b==="video"&&o(Q,ye).catch(()=>{})}function Be(Q,ye,x){b!=="off"&&(Ie(),se=Q,b==="viseme"?(he=null,s(Q,Promise.resolve(ye),x).then(we=>{se===Q&&(he=we)}).catch(()=>xe())):o(Q,Promise.resolve(ye)).then(we=>{se!==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(b==="off"||!Q||Q.live)return;Ie();let x=String(ye).padStart(2,"0"),we=`file|${Q.dir}|${x}`;se=we,b==="viseme"?(he=null,(async()=>{let g=document.querySelector(`script[data-decklight-visemes="slide-${x}"]`);if(g)return JSON.parse(g.textContent);let j=await fetch(`${Q.dir}/slide-${x}.visemes.json`);if(!j.ok)throw new Error(String(j.status));return j.json()})().then(g=>{se===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",()=>{b==="video"&&C?.pause()}),Q.addEventListener("play",()=>{b==="video"&&C?.src&&C.play().catch(()=>{})}),Q.addEventListener("ratechange",()=>{C&&(C.playbackRate=Q.playbackRate)}))}async function nt(){try{let Q=await fetch(h+"/ping");Te=Q.ok?await Q.json():null}catch{Te=null}return Te}function W(Q,ye={}){b=Q,ye.engine&&(k=ye.engine),ye.portrait&&(S=ye.portrait),Ce(),b==="off"?qe():(me=!1,E(),I&&Ie()),Xe(),l("lipsync",b==="off"?"character off":`character ${b}${b==="video"?` \xB7 ${k} \xB7 ${S}`:""}`)}function Ae(Q){I=!!Q,Ce();let ye=!!q&&!q.paused&&!q.ended;I&&b!=="off"?Ie():!I&&!ye&&qe(),Xe(),l("lipsync",`character solo ${I?"on":"off"}`)}return{get mode(){return b},get engine(){return k},get portrait(){return S},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 Bc(r){let a=String(r??"").replace(/[?#].*$/,"");return a.slice(0,a.lastIndexOf("/")+1)}var Pc=/^[a-z][a-z0-9+.-]*:|^\/\//i;function ui(r,a,l){let d=r?.slides?.[l-1];return d?d.url?d.url:d.file?Pc.test(d.file)?d.file:Bc(a)+d.file:null:null}function fr(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 pi(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 gr=r=>r.toISOString().slice(0,16).replace("T"," ")+"Z";function Yr(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 Jr(r){return r?.manifest??r?.dir??null}function Dc({hasTracks:r,used:a,printMode:l,embedded:d,voiceover:u,captionsOn:h,narrating:f}={}){return!!r&&!a&&!l&&!d&&!u&&!h&&!f}function hi({root:r,stage:a,config:l,params:d,printMode:u,toast:h,logOnly:f,debugLog:m,overlays:b,instance:k,syncSoundBtn:S,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"]],se=q.replace(/\/tts\/?$/,"/ping"),ce=he,U=!0,me=null,Te=null;function $e(){return Te??=fetch(se).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&&(ce=T.voices),U=T.stylable!==!1,m("tts",`bridge: ${T.engine} \xB7 ${T.model} \xB7 ${ce.length} voice(s)`+(U?"":" \xB7 no style")),ce.length&&!ce.some(([K])=>K===xe.voice)){let K=xe.voice;xe={...xe,voice:ce[0][0]},Me(),m("tts",`voice ${K} is not on this bridge \u2014 using ${xe.voice}`),E?.live&&h(`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,w=Ce.find(_=>Jr(_)===K);w&&(E=w)}}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),h(`voice speed ${F}\xD7`),m("narr",`rate ${F}\xD7`),I()}let H=di({root:r,config:l,debugLog:m,toast:h}),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(w=>w.replace(/\s+/g," ").trim())}function Ne(T,K,w){if(!T)return Promise.resolve(null);if(!fe.has(K)){let _=(async()=>{let A=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),m("tts",`${w} \xB7 ${xe.voice} \xB7 ${T.length} chars \u2192 ${((Date.now()-A)/1e3).toFixed(1)}s`+(ue?` \xB7 ~$${ue.toFixed(4)}`:"")),{url:URL.createObjectURL(Z),blob:Z}}catch(R){throw m("tts",`${w} \xB7 ${xe.voice} FAILED after ${((Date.now()-A)/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,w)=>`${T}|s${K}|n${w}|${xe.voice}|${xe.style}`;function O(T,K,w){let _=s(ze(T)[K])[w]??"";return Ne(_,o(T,K,w),`slide ${T} seg ${K} #${w+1}`)}let Be=T=>k._sections[T-1]?.dataset.narration==="hold",P=10,Ue=3,nt=0;function W(T){let K=[],w=k.state.slide,_=k.state.step;for(;K.length<T&&w<=k.state.totalSlides;){let A=ze(w),R=k._records[w-1]?k._records[w-1].groups.length:0;for(;_<=R&&K.length<T;_++){let Z=s(A[_]).length;for(let ue=0;ue<Z&&K.length<T;ue++)K.push([w,_,ue])}w+=1,_=0}return K}async function Ae(){let T=++nt,K=async()=>{for(;T===nt&&Ie&&E?.live;){let w=W(P).find(([_,A,R])=>!fe.has(o(_,A,R)));if(!w)return;try{if(await O(w[0],w[1],w[2]),H.mode!=="off"){let[_,A,R]=w;H.prefetchSentence(o(_,A,R),fe.get(o(_,A,R)),s(ze(_)[A])[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){h("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(),h(ye?"\u23F8 narration paused \u2014 P resumes":"\u25B6 narration resumed"),m("narr",ye?"paused":"resumed"),I()}function j(T,K){if(!Ie||ye||!E?.live||k.state.slide!==T||k.state.step!==K)return;let w=k._records[T-1];K<(w?w.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,w=++Q;if(Ae(),!Ee(T)){if(Be(T)){m("narr",`hold on slide ${T} \u2014 manual advance`);return}setTimeout(()=>{w!==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(()=>{w===Q&&j(T,K)},600);return}let A=s(_[K]),R=()=>w!==Q||!Ie||k.state.slide!==T||k.state.step!==K;we=w,x=!0;let Z=0;try{for(let ue=0;ue<A.length;ue++){for(;ye;){if(R())return;await new Promise(bt=>setTimeout(bt,150))}if(R())return;let We;try{We=await O(T,K,ue)}catch(bt){m("narr",`sentence failed (slide ${T} seg ${K} #${ue+1}) \u2014 narration stopped`),Le(X(bt));return}if(R())return;if(!We)continue;_t(A[ue]),qe??=new Audio,H.mode!=="off"&&(H.attachAudio(qe),H.beginSentence(o(T,K,ue),We,A[ue])),qe.src=We.url,qe.playbackRate=F;let ot=!1;if(await new Promise(bt=>{qe.onended=bt,qe.play().catch(()=>{ot=!0,bt()})}),ot){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&&A.length){Le("\u{1F507} the voice did not play \u2014 auto-advance stopped \xB7 press the key left of 1 for messages");return}j(T,K)}finally{we===w&&(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(w=>{if(!w.ok)throw new Error(`HTTP ${w.status}`);return w.json()}).catch(w=>{throw Y.delete(T),w})),Y.get(T).then(w=>ge.set(T,w)).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(()=>{G&&pe==="tracks"&&pt("tracks")}),"hosted \u2014 checking\u2026");let w=fr(K);return w.at?w.expired?`EXPIRED ${gr(w.at)} \u2014 re-sign to play`:`signed \xB7 ${pi(w.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=fr(ne.data);return T.expired?(Le(`\u{1F507} the signed voices for \u201C${E.label}\u201D expired ${gr(T.at)} \u2014 auto-advance stopped \xB7 re-sign: ${Yr(ne.data)}`),!1):!0}function He(T){return E.manifest?ui(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,H.mode!=="off"&&(H.attachAudio(qe),H.beginSlide(E,k.state.slide)),qe.onerror=()=>{m("narr",`no audio: ${T}`);let K=E.manifest?fr(ne?.data):null;if(K?.at){m("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 ${gr(K.at)}) \u2014 auto-advance stopped \xB7 re-sign: ${Yr(ne?.data)}`);return}h(`\u{1F507} no narration for slide ${k.state.slide} (${T}) \xB7 press the key left of 1 for messages`)},qe.play().catch(()=>{h("\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(),H.stop(),h(T),m("narr",T),S()}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;h(`\u{1F50A} ${T} \u2014 V stops \xB7 N picks`),m("narr",`on \u2014 ${T}`),_e(),S()}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(),it()):(ct?.remove(),ct=null),h(`captions ${Ye?"on":"off"}`),m("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 ft=null;function it(){if(!ft)return;let T=ft;ft=null,T.classList.remove("show"),setTimeout(()=>T.remove(),260)}function st(){if(it(),!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",()=>{it(),Qe()}),ft=T,r.appendChild(T),T.offsetWidth,T.classList.add("show"),f?.(nn),m("narr","voice-over hint shown"),setTimeout(it,qt)}Dc({hasTracks:Ce.length>0,used:Ct,printMode:u,embedded:!!d?.has("embedded"),voiceover:!!d?.has("voiceover"),captionsOn:Ye})&&setTimeout(()=>{Ie||N()},Dt);let G=null,ie=0,pe="tracks",Pe=[],Se=null;function Me(){try{localStorage.setItem($,JSON.stringify(E?.live?{live:xe}:{track:Jr(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),h(`\u26A1 live voice: ${xe.voice} \xB7 ${xe.tone} \u2014 V stops`),m("narr",`live config \u2014 ${xe.voice} \xB7 ${xe.tone}`),_e()}function at(T){Pe.length&&(ie=jt(G.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){H.setMode(T,K),wt(),h(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 ${H.engine} \xB7 ${H.portrait}${Ie?"":" \xB7 V starts narration"}`)}function wn(T){if(H.mode==="off"){h("turn the character on first \u2014 N \xB7 Character\u2026");return}H.setSolo(T),wt(),h(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(w=>URL.revokeObjectURL(w)).catch(()=>{});ut=new Map,Ot=T}return ut}let Wt=(T,K)=>`${T}|${K||""}`;function L(T,K,w,_=""){let A=Wt(K,_);if(!T.has(A)){let R=(async()=>{let Z=Date.now(),ue=await fetch(q,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:w,voice:K,style:_})});if(!ue.ok)throw new Error(String(ue.status));let We=await ue.blob(),ot=parseFloat(ue.headers?.get?.("x-tts-cost")??"")||0;return ot&&(C+=ot),m("tts",`preview ${K}${_?" (styled)":""} \xB7 ${((Date.now()-Z)/1e3).toFixed(1)}s`+(ot?` \xB7 ~$${ot.toFixed(4)}`:"")),URL.createObjectURL(We)})();R.catch(()=>{T.get(A)===R&&T.delete(A)}),T.set(A,R)}return T.get(A)}async function vn(T,K,w){let _=`${w}|${T}`;if(Gt.has(_))return;Gt.add(_);let A=T===Ht,R=A?St:ut;try{m("narr",`preview prefetch ${w} (${A?"default":"custom"} sentence)`);for(let{voice:Z,style:ue}of K){if(!A&&Ot!==T)return;R.has(Wt(Z,ue))||await L(R,Z,T,ue).catch(()=>{})}m("narr",`preview prefetch ${w} complete`)}finally{Gt.delete(_)}}function Vt({voice:T,style:K="",prefetch:w},_){let A=It.trim();if(!A)return;let R=xn(A);_&&(_.textContent="\u2026"),L(R,T,A,K).then(Z=>{_?.isConnected&&(_.textContent="\u25B6"),dt??=new Audio,dt.src=Z,dt.play().catch(()=>{}),m("narr",`preview ${T}${K?" \xB7 styled":""}`),w==="voices"?vn(A,he.map(([ue])=>({voice:ue,style:""})),"voices"):w==="tones"&&vn(A,Re.map(ue=>({voice:T,style:be(ue)})),`tones:${T}`)}).catch(()=>{_?.isConnected&&(_.textContent="\u25B6"),h("live voice bridge unreachable \u2014 run: decklight tts"),m("narr",`preview ${T} failed`)})}function pt(T){pe=T;let K=G.querySelector(".narr-card");K.innerHTML="";let w=document.createElement("div");if(w.className="narr-head",K.appendChild(w),Pe=[],T==="tracks")w.textContent="narration",Ce.forEach(A=>Pe.push({text:A.manifest?`\u2601 ${A.label}`:`\u{1F50A} ${A.label} (${A.dir}/)`,flavor:A.manifest?re(A):"",cur:A===E,commit:()=>{E=A,Me(),wt(),h(`\u{1F50A} track: ${A.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:H.mode!=="off",commit:()=>pt("character")});else if(T==="character"){w.textContent="character \u2014 an animated narrator lip-syncs the voice",Yt||(Yt=!0,H.probe().then(()=>{G&&pe==="character"&&pt("character")}));let A=H.bridgeInfo,R=A?.engines?.video??[];Pe.push({text:"Off",cur:H.mode==="off",commit:()=>Rt("off")}),Pe.push({text:"\u{1F3AD} 2D character \u2014 offline visemes",flavor:A?.engines?.viseme?"":"bridge offline \u2014 amplitude fallback",cur:H.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:H.mode==="video",commit:()=>{R.length?pt("charvideo"):h("video needs wav2lip/sadtalker on the bridge \u2014 run: decklight lipsync")}}),H.mode!=="off"&&Pe.push({text:`${H.solo?"\u25C9":"\u25CB"} Solo \u2014 the narrator takes the stage`,flavor:"slide content steps aside",cur:H.solo,commit:()=>wn(!H.solo)})}else if(T==="charvideo"){w.textContent="neural video \u2014 pick engine \xB7 portrait";let A=H.bridgeInfo;for(let R of A?.engines?.video??[])for(let Z of A?.portraits?.length?A.portraits:["default"])Pe.push({text:`\u{1F3A5} ${R} \xB7 ${Z}`,cur:H.mode==="video"&&H.engine===R&&H.portrait===Z,commit:()=>Rt("video",{engine:R,portrait:Z})})}else if(T==="voices"){w.textContent="live voice \u2014 pick a voice \xB7 \u25B6 previews";let A=document.createElement("div");A.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}),A.append(R,Z),K.appendChild(A),ce.forEach(([ue,We])=>Pe.push({text:ue,flavor:We,preview:{voice:ue,style:"",prefetch:"voices"},cur:E?.live&&xe.voice===ue,commit:()=>{if(Se=ue,U)return pt("tones");rt(me??"plain","")}}))}else if(T==="tones")w.textContent=`live voice \xB7 ${Se??xe.voice} \u2014 pick a tone \xB7 \u25B6 previews`,Re.forEach(A=>{let[R]=A,Z=be(A);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{w.textContent=`live voice \xB7 ${Se??xe.voice} \u2014 type the delivery instruction \xB7 \u25B6 previews`;let A=document.createElement("div");A.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 We=R.value.trim();We&&Vt({voice:Se??xe.voice,style:We},Z)}),A.append(R,Z),K.appendChild(A),setTimeout(()=>{R.focus(),R.select()},0),Pe=[],ie=0;return}Pe.forEach((A,R)=>{let Z=document.createElement("div");Z.className="narr-row"+(A.cur?" narr-cur":"");let ue=document.createElement("span");if(ue.className="narr-row-label",ue.textContent=A.text,A.flavor){let We=document.createElement("span");We.className="narr-flavor",We.textContent=A.flavor,ue.appendChild(We)}if(Z.appendChild(ue),A.preview){let We=document.createElement("button");We.type="button",We.className="narr-prev-btn",We.textContent="\u25B6",We.title=`preview ${A.preview.voice}`,We.setAttribute("aria-label",`preview ${A.preview.voice}`),We.addEventListener("click",ot=>{ot.stopPropagation(),Vt(A.preview,We)}),Z.appendChild(We)}Z.addEventListener("mouseenter",()=>at(R)),Z.addEventListener("click",()=>{at(R),Et()}),K.appendChild(Z)});let _=Pe.findIndex(A=>A.cur);at(Math.max(0,_)),G.querySelector(".narr-sel")?.scrollIntoView({block:"nearest"})}function At(){let T=G?.querySelector(".narr-input")?.value.trim();T&&rt("Custom",T)}function rn(T){if(G&&T===void 0)return wt();G||(G=document.createElement("div"),G.className="decklight-narr",G.innerHTML='<div class="narr-card" role="listbox" aria-label="Narration"></div>',kt(G,wt),r.appendChild(G)),pt(T??(Ce.length?"tracks":"voices")),$e().then(K=>{K&&G&&pe==="voices"&&pt("voices")})}function wt(){G?.remove(),G=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 w=$t.querySelector(".narr-card");if(T==="confirm"){let _=K.total;w.innerHTML=`<div class="narr-head">record offline narration</div>
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
281
  <div class="rec-line">\u26A1 ${xe.voice} \xB7 ${xe.tone}</div>
282
282
  <div class="rec-line">${_} slide${_===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>`,w.querySelector(".narr-row").addEventListener("click",an)}else if(T==="progress"){let{done:_,total:A,elapsedMs:R}=K,Z=A?Math.round(_/A*100):0,ue=_?hn(R/_*(A-_)):"\u2026";w.innerHTML=`<div class="narr-head">recording\u2026</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
285
  <div class="rec-bar"><div class="rec-bar-fill" style="width:${Z}%"></div></div>
286
- <div class="rec-line">${_} / ${A} slides \xB7 ${hn(R)} elapsed \xB7 ~${ue} left</div>
287
- <div class="rec-hint">Esc to cancel</div>`}else{let{saved:_,total:A,cancelled:R}=K;w.innerHTML=`<div class="narr-head">${R?"recording cancelled":"recording done"}</div>
288
- <div class="rec-line">${_} / ${A} slide${A===1?"":"s"} saved as slide-NN.wav to your downloads</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
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 w=T.reduce((R,Z)=>R+Z.length,0),_=new DataView(new ArrayBuffer(44)),A=(R,Z)=>{for(let ue=0;ue<Z.length;ue++)_.setUint8(R+ue,Z.charCodeAt(ue))};return A(0,"RIFF"),_.setUint32(4,36+w,!0),A(8,"WAVE"),A(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),A(36,"data"),_.setUint32(40,w,!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 w=k._records[T-1],_=w?w.groups.length:0,A=ze(T),R=[],Z=24e3;for(let ue=0;ue<=_;ue++){let We=s(A[ue]);for(let ot=0;ot<We.length;ot++){let bt=await O(T,ue,ot);if(K!==Mt)return null;if(!bt)continue;let mn=await bt.blob.arrayBuffer();R.length===0?Z=new DataView(mn).getUint32(24,!0)||24e3:R.push(Qt(Z,ot===0?Jt:zt)),R.push(new Uint8Array(mn.slice(44)))}}return R.length?on(R,Z):null}async function xt(T,K){if(H.mode!=="viseme")return null;let w=k._records[T-1],_=w?w.groups.length:0,A=ze(T),R=[];try{for(let Z=0;Z<=_;Z++){let ue=s(A[Z]);for(let We=0;We<ue.length;We++){let ot=await H.ensureTimeline(o(T,Z,We),O(T,Z,We),ue[We]);if(K!==Mt)return null;ot&&R.push({timeline:ot,gap:R.length?We===0?Jt:zt:0})}}}catch{return m("lipsync",`slide ${T}: viseme sidecar skipped (bridge unreachable)`),null}return R.length?ci(R):null}async function an(){let T=sn(),K=++Mt,w=Date.now(),_=0,A=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),A++;let We=await xt(R,K);if(K!==Mt)return;if(We){let ot=URL.createObjectURL(new Blob([JSON.stringify(We)],{type:"application/json"}));M(ot,`slide-${String(R).padStart(2,"0")}.visemes.json`),setTimeout(()=>URL.revokeObjectURL(ot),5e3)}}}catch{h(`slide ${R}: recording failed`)}_++,K===Mt&&Lt("progress",{done:_,total:T.length,elapsedMs:Date.now()-w})}K===Mt&&Lt("done",{saved:A,total:T.length})}function kn(){if(!E?.live){h("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,gt),r.appendChild($t),Lt("confirm",{total:sn().length}))}function gt(){Mt++,$t?.remove(),$t=null}return b.register({isOpen:()=>!!$t,close:gt,keydown(T){if(T.key==="Escape")gt();else if(T.key==="Enter")Ft==="confirm"?an():Ft!=="progress"&&gt();else return!1;return!0}}),b.register({isOpen:()=>!!G,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:H,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 qc(r,a){let l=[];for(let d=0;d<r;d+=a){let u=[];for(let h=d;h<r&&h<d+a;h++)u.push(h);l.push(u)}return l}function mi(r,a,l){let d=r.ownerDocument,u=m=>{let b=d.createElement("div");return b.className=m,b},h=m=>{let b=u("print-slot"),k=u("decklight-stage print-slide");return k.appendChild(m),b.appendChild(k),b};if(l==="handout")for(let m of qc(a.length,3)){let b=u("print-page print-handout");for(let k of m){let S=u("print-row");S.appendChild(h(a[k])),S.appendChild(u("print-notelines")),b.appendChild(S)}r.appendChild(b)}else a.forEach(m=>{let b=u("print-page print-notes-page"),k=u("print-notes"),S=m.querySelector("aside.notes");S&&(k.innerHTML=S.innerHTML),b.appendChild(h(m)),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)}ae();le();ae();le();function Fc(r,a,l,d){let u=d||1;return{x:(r-l.left)/u,y:(a-l.top)/u}}function zc(r,a,l=300){return r.filter(d=>a-d.t<l)}function fi(r,a){let l=a.querySelector(":scope > .decklight-stage"),d=null,u=null,h=null,f=[],m=null,b=[],k=null,S=0,I=()=>getComputedStyle(a).getPropertyValue("--accent").trim()||"#fff",M=be=>Fc(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 m?[...f,m]: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(h==="laser"&&k){let E=I(),Ie=performance.now();u.fillStyle=E;for(let qe of b){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 $(){S=0,b=zc(b,performance.now()),C(),b.length&&(S=requestAnimationFrame($))}let q=()=>{S||(S=requestAnimationFrame($))};function he(be){if(!(h!=="pen"||be.button>0)){try{d.setPointerCapture(be.pointerId)}catch{}m={color:I(),points:[M(be)]},C(),be.preventDefault()}}function se(be){h==="pen"&&m?(m.points.push(M(be)),C()):h==="laser"&&(k=M(be),b.push({...k,t:performance.now()}),q())}function ce(){m&&(f.push(m),m=null)}function U(){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",se),d.addEventListener("pointerup",ce),d.addEventListener("pointercancel",ce),d.addEventListener("touchstart",be=>be.stopPropagation(),{passive:!0}),U(),new ResizeObserver(()=>{U(),requestAnimationFrame(C)}).observe(a))}function Te(be="pen"){return h=h===be?null:be,h&&me(),d&&(d.classList.toggle("tool-pen",h==="pen"),d.classList.toggle("tool-laser",h==="laser")),m&&(f.push(m),m=null),h!=="laser"&&(b=[],k=null,u&&C()),h}function $e(){f=[],m=null,b=[],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 h},get active(){return h!==null}}}function gi({root:r,printMode:a,toast:l,debugLog:d,overlays:u,instance:h,narration:f,downloadFromUrl:m,setProgressBar:b}){let k="decklight-clock:"+location.pathname,S=!1;try{S=localStorage.getItem(k)==="1"}catch{}let I=null,M=null,C=null,$=!1,q=J=>String(J).padStart(2,"0");function he(J){let H=Math.floor(J/1e3),fe=Math.floor(H/3600);return(fe?fe+":":"")+q(Math.floor(H/60)%60)+":"+q(H%60)}function se(){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 ce(){I=document.createElement("div"),I.className="decklight-clock",I.innerHTML='<span class="clk-time"></span><span class="clk-elapsed"></span>',r.appendChild(I),se(),M=setInterval(se,1e3)}function U(){S=!S;try{localStorage.setItem(k,S?"1":"0")}catch{}S?ce():(clearInterval(M),M=null,I?.remove(),I=null),l(`clock ${S?"on":"off"}`),d("nav",`clock ${S?"on":"off"}`)}h.on("ready",()=>{$=!0});let me=()=>{!$||C!=null||(C=Date.now(),se())};h.on("slide",me),h.on("build",me),h.toggleClock=U,S&&!a&&ce();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),b(Re.querySelector(".bar")),h._updateChrome()}function Ce(){$e=!$e;try{localStorage.setItem(Te,$e?"1":"0")}catch{}$e?be():(Re?.remove(),Re=null,b(null)),l(`progress bar ${$e?"on":"off"}`),d("nav",`progress bar ${$e?"on":"off"}`)}h.toggleProgress=Ce,$e&&!a&&be();let Xe=null;a||(Xe=fi(h,r),h.annotate=Xe);function xe(J){if(!Xe)return;let H=J==="laser"?Xe.laser():Xe.toggle();l(H==="pen"?"pen on \u2014 drag to draw \xB7 \u232B clears \xB7 W off":H==="laser"?"laser on \u2014 \u21E7W off":"ink off"),d("nav",`ink ${H??"off"}`)}function E(){return(h._sections||[]).map((J,H)=>({n:H+1,title:J.querySelector("h1, h2, h3")?.textContent.trim()||`Slide ${H+1}`,segs:f.notesSegs(H+1).filter(Boolean)}))}function Ie(J){let H=(document.title||"Deck").trim(),fe=J?[`# ${H} \u2014 transcript`,""]:[`${H} \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 H=J==="md",fe=URL.createObjectURL(new Blob([Ie(H)],{type:H?"text/markdown":"text/plain"})),Ee=(location.pathname.split("/").pop()||"deck").replace(/\.html?$/i,"");m(fe,`${Ee}-transcript.${H?"md":"txt"}`),setTimeout(()=>URL.revokeObjectURL(fe),5e3),d("narr",`transcript exported (.${H?"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 H=document.createElement("div");H.className="narr-head",H.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(H,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(),h.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 h.transcript={open:F,text:()=>Ie(!1),markdown:()=>Ie(!0)},u.register({isOpen:()=>!!De,close:F,keydown:J=>J.key==="Escape"&&(F(),!0)}),{toggleClock:U,toggleProgress:Ce,toggleInk:xe,toggleTranscript:F,get annotator(){return Xe},status:()=>({clockOn:S,progressOn:$e})}}ae();le();var Uc=["data-background-image","data-background-video","data-background-poster","data-background-size","data-background-position","data-background-dim"];function Hc(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 Gc=r=>`url("${String(r).replace(/["\\]/g,"\\$&")}")`;function jc(r){let a={};for(let l of Uc){let d=r.getAttribute(l);d!==null&&(a[l]=d)}return a}function bi(r,{printMode:a=!1}={}){r.forEach(l=>{let d=Hc(jc(l)),u=l.querySelector(":scope > .slide-bg");if(!d){u?.remove();return}let h=JSON.stringify(d)+(a?"\xB7print":"");if(u&&u.dataset.sig===h){u!==l.firstElementChild&&l.prepend(u);return}u||(u=document.createElement("div"),u.className="slide-bg",u.setAttribute("aria-hidden","true")),u.dataset.sig=h,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?Gc(f):"",d.video&&!a){let m=document.createElement("video");m.muted=!0,m.loop=!0,m.setAttribute("muted",""),m.setAttribute("loop",""),m.setAttribute("playsinline",""),m.preload="auto",d.poster&&(m.poster=d.poster),m.style.objectFit=d.size,m.style.objectPosition=d.position,m.src=d.video,u.appendChild(m)}if(d.dim>0){let m=document.createElement("div");m.className="slide-bg-dim",m.style.opacity=String(d.dim),u.appendChild(m)}l.prepend(u)})}ae();le();ae();le();var Kc="npx decklight author";function Wc(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:h}=Wc(d),f=/\.html?$/i.test(h)?h:"<deck.html>",m=l==="file:"&&u?`from ${u}, `:"";return`${r} needs author mode: ${m}run ${Kc} ${f}, then reopen the URL it prints`}function yi({root:r,config:a,params:l,printMode:d,toast:u,debugLog:h,overlays:f,instance:m,notesSegs:b,dismissOthers:k}){let S=!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 j of g)try{let B=await fetch(j+"/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){h("edit",`server edits ${X.name}, this deck is ${Y} \u2014 not wiring up`);continue}I=j,S=!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(j+"/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),h("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),h("agent",`${ne.agent} done ok=${ne.ok} changed=${ne.changed}${Fe}`)}}catch{}}),h("edit",`live reload connected${j?` (${j})`:""}`+(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 j=await fetch(g+"/present/ping");if(!j.ok)return;let B=await j.json();if(!B?.ok||!B.present)return;let X=decodeURIComponent(location.pathname.split("/").pop()||"");if(X&&B.name&&X!==B.name){h("present",`server presents ${B.name}, this deck is ${X} \u2014 not wiring up`);return}m.__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"?m.next():ne==="prev"&&m.prev()}catch{}});let ge=()=>{fetch(g+"/remote/pos",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({i:m.state.slide,n:m.state.totalSlides})}).catch(()=>{})};m.on("slide",ge),m.on("build",ge),ge(),h("present",`remote connected${g?` (${g})`:""} \u2014 no edit surface`)}catch{}}async function se(g){if(!S){u(tn(g,location),3200);return}try{let j=await fetch(I+"/edit/"+g,{method:"POST"}),B=await j.json().catch(()=>({}));if(!j.ok){u(B.error||`${g} failed`);return}u(`${g} \u2014 ${B.undo} back \xB7 ${B.redo} forward`),h("edit",`${g} \u2192 ${B.undo} back, ${B.redo} forward`)}catch{u(`${g} failed \u2014 is the dev server still up?`,2200)}}let ce=null;function U(){if(ce){ce.remove(),ce=null;return}if(!S){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}ce=document.createElement("div"),ce.className="decklight-narr decklight-editor";let g=document.createElement("div");g.className="narr-card";let j=document.createElement("div");j.className="narr-head",j.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 ${m.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(()=>{}),h("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);U()}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"&&(U(),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(j,B,Y),ce.appendChild(g),kt(ce,U),r.appendChild(ce),setTimeout(()=>B.focus(),0)}let me=null;function Te(){if(me){me.remove(),me=null;return}let g=m.state.slide;if(!S){u(tn("editing notes",location),3200);return}me=document.createElement("div"),me.className="decklight-narr decklight-editor";let j=document.createElement("div");j.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=b(g).filter((ne,Fe,Je)=>ne||Fe<Je.length).join(`
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(`
292
292
 
293
293
  \u27E8CLICK\u27E9
294
294
 
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());h("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),j.append(B,X,ge),me.appendChild(j),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(!S){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,j){let B=j;for(;B&&B!==g&&B.parentElement!==g;)B=B.parentElement;return B&&B!==g?B:null}r.addEventListener("contextmenu",g=>{if(!Re)return;let j=g.target.closest("section"),B=j?m._sections.indexOf(j)+1:0;if(!j||!B)return;if(g.preventDefault(),j.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(j,g.target),Y=X?[...j.children].indexOf(X):null;k?.(),H(g.clientX,g.clientY,{sec:j,slide:B,index:Y})});function De(){be?.remove(),be=null,xe="main"}function F(){let g=be.querySelector(".cm-list");g.textContent="";let j=[];if(xe==="effects"){j.push({label:"\u2190 back",back:!0,run:()=>{xe="main",F()}});for(let B of $e)j.push({label:B,run:()=>Ee(B)});j.push({label:"none (instant)",run:()=>Ee("none")}),j.push({label:"remove effect",run:()=>Ee(null)})}else E.index===null?j.push({label:"Edit speaker notes",run:()=>{De(),Te()}}):(j.push({label:"Edit speaker notes",run:()=>{De(),Te()}}),j.push({label:"Remove element",run:fe}),j.push({label:"Edit content (HTML)",run:()=>{De(),s(E)}}),j.push({label:"Add text effect \u25B8",run:()=>{xe="effects",F()}}));Ce=j,j.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,j){let B=be.querySelectorAll(".cm-row");B.length&&(Xe=jt(B,g,"cm-selected",{scroll:j}))}function H(g,j,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(j-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:j}=E;De();try{let B=await fetch(I+"/edit/element/remove",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:g,index:j})}),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:j,index:B}=E;De();try{let X=await fetch(I+"/edit/element/effect",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:j,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:j}){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 ${j} \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:j,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=${j}`),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,j){j&&(g.src=`${I}/edit/at?ref=${encodeURIComponent(j.hash)}&embedded`)}function nt(g,j){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),j?Ue(Y,X):P=setTimeout(()=>Ue(Y,X),60)}async function W(){if(o)return Ae();if(!S)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 j=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()}),j.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:()=>!!ce,close:U,keydown:g=>g.key==="Escape"&&(U(),!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(!S){u(tn("configuring an engine",location),3200);return}let j,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}j=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=`${j.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 j.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:j.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}h("wizard",`${j.engine} configured: ${JSON.stringify(Qe.stored)}`),x(),u(`${j.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:se,toggleEditor:Te,toggleAgentAsk:U,toggleElementEdit:Ie,elementEditOn:()=>Re,wizard:we,wizards:()=>$.slice(),restore:{open:W,close:Ae,list:()=>O.slice()},available:()=>S,base:()=>I}}ae();le();var Gn=[{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"}],wi="decklight-onboarded",Qr="decklight-tips-seen",xi="decklight-tips-off";function es(r){try{return localStorage.getItem(r)}catch{return null}}function br(r,a){try{localStorage.setItem(r,a)}catch{}}function vi({root:r,printMode:a,params:l,toast:d,debugLog:u,overlays:h,deck:f}){let m=l.has("embedded"),b=a||m,k=null;function S(){k&&(k.remove(),k=null,br(wi,"1"),u?.("nav","welcome dismissed"))}function I(){k||a||(k=document.createElement("div"),k.className="decklight-welcome",k.innerHTML=`<div class="wel-card">
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">
296
296
  <h3>Welcome to Decklight</h3>
297
297
  <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
298
  <table>
@@ -306,9 +306,9 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),H===void 0&
306
306
  <span>Press any key to dismiss \u2014 reopen anytime from the <code>/</code> palette.</span>
307
307
  <button type="button" class="wel-go">Got it</button>
308
308
  </div>
309
- </div>`,k.addEventListener("click",U=>{U.stopPropagation(),S()}),kt(k,S),r.appendChild(k),u?.("nav","welcome shown"))}h.register({isOpen:()=>!!k,close:S,keydown:()=>(S(),!0)});function M(){return es(xi)!=="1"}function C(){try{let U=JSON.parse(es(Qr)||"[]");return new Set(Array.isArray(U)?U:[])}catch{return new Set}}function $(){let U=C();return Gn.find(me=>!U.has(me.id))||null}function q(){let U=$();if(!U)return null;let me=C();return me.add(U.id),br(Qr,JSON.stringify([...me])),d(`tip \xB7 ${U.text}`,5200),U.id}function he(U){br(xi,U?"0":"1"),d(U?"tips on \u2014 one per deck you open":"tips off")}function se(){br(Qr,"[]"),d(`tips reset \u2014 all ${Gn.length} will show again, one per deck`)}function ce(U){if(!b&&(f().on("slide",S),f().on("build",S),!(U.slide!==1||U.step!==0))){if(es(wi)!=="1"){I();return}M()&&q()}}return{start:ce,showWelcome:I,dismissWelcome:S,showTip:q,setTips:he,resetTips:se,status:()=>({tipsOn:M(),tipsLeft:$()?Gn.length-C().size:0})}}ae();le();function ki({sectionsOf:r,checkOverflow:a,ResizeObs:l=typeof ResizeObserver=="function"?ResizeObserver:null,MutationObs:d=typeof MutationObserver=="function"?MutationObserver:null,schedule:u=h=>setTimeout(h)}){let h=[],f=0;function m(){f||(f=u(()=>{f=0;let M=r();for(let C of h)a(C,M.indexOf(C)+1)})||1)}let b=l?new l(m):null;function k(M){if(b)for(let C of[M,...M.querySelectorAll("*")])C.parentElement?.closest(".terminal")||b.observe(C)}let S=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)}$&&m()}):null,I=M=>{M.target.closest?.(".terminal")||m()};return{watch(M){b?.disconnect(),S?.disconnect();for(let C of h)for(let $ of["load","error"])C.removeEventListener($,I,!0);h=M.filter(Boolean);for(let C of h){k(C),S?.observe(C,{childList:!0,subtree:!0,characterData:!0});for(let $ of["load","error"])C.addEventListener($,I,!0)}m()},get watched(){return h.slice()}}}ae();le();function Ei({config:r,root:a,embedded:l,sectionsOf:d,slideOf:u,navigate:h}){let f=!l&&r.playlist?.modules?.length?r.playlist:null,m=f?f.index??0:0,b=!!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 S(I=k()){let M=-1;return I.forEach((C,$)=>{C.slide<=u()&&(M=$)}),M}return{get playlist(){return f},get index(){return m},get hasMarkers(){return b},get any(){return b||!!f},markers:k,currentMarkerIndex:S,gotoModule(I){if(!f)return!1;let M=f.modules[m+I];return M?(h(M.href+(I>0?"#/1/0":"#/999/999")),!0):!1},navigateToModule(I){let M=f?.modules[I];M&&h(M.href+"#/1/0")},title(){if(b){let I=k();return I[S(I)]?.title||""}return f?.modules[m]?.title||""}}}ae();le();function Vc(r,a,l){return(r.querySelector("h1, h2, h3")?.textContent||"").replace(/\s+/g," ").trim()||l.slice(0,60)||`slide ${a+1}`}function Zc(r){return[...r.children].filter(l=>!l.matches("aside, script, style")).map(l=>l.textContent).join(" ").replace(/\s+/g," ").trim()}function Si({sections:r,modules:a=[],skipModule:l=-1}){let d=r.map((h,f)=>{let m=Zc(h);return{slide:f+1,title:Vc(h,f,m),haystack:m.toLowerCase()}}),u=a.map((h,f)=>({module:f,title:h.title,href:h.href,haystack:(h.title||"").toLowerCase()})).filter(h=>h.module!==l);return[...d,...u]}function Ai(r,a){let l=String(a??"").toLowerCase().split(/\s+/).filter(Boolean),d=[],u=[];for(let h of r){let f=h.title.toLowerCase();l.every(m=>f.includes(m))?d.push(h):l.every(m=>h.haystack.includes(m))&&u.push(h)}return[...d,...u]}ae();le();function _i({now:r=Date.now,keep:a=200}={}){let l=r(),d=[],u=null;function h(f,m){let b={t:((r()-l)/1e3).toFixed(3),kind:f,msg:m};return d.push(b),d.length>a&&d.shift(),u?.(b),b}return{log:h,get entries(){return d.slice()},onEntry(f){u=f}}}ae();le();var Xc=["auto","centered","pinned","top","split","split-flip"];function Yc({autoPins:r,hasSplitPair:a}){return Xc.filter(l=>(l!=="pinned"||!r)&&(l!=="split-flip"||a))}function Jc(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 Ti({slideOf:r,sectionAt:a,describe:l,available:d,unavailableMessage:u,apply:h,relayout:f,post:m,toast:b,debugLog:k,schedule:S=setTimeout,cancel:I=clearTimeout,delay:M=600}){let C=null,$=null;function q(){I($);let ce=C;C=null,ce&&m({slide:ce.slide,layout:ce.name}).then(()=>k("layout",`slide ${ce.slide}: ${ce.name} \u2192 saved to file`)).catch(()=>b("layout save failed \u2014 is the dev server still up?",2200))}function he(ce=r()){let U=a(ce);return U?Yc(l(U)):[]}function se(ce){if(!d()){b(u(),3200);return}let U=r(),me=a(U);if(!me)return;let Te=Jc(he(U),me.getAttribute("data-layout")||"auto",ce);if(!Te)return;h(me,Te),C&&C.slide!==U&&q(),C={slide:U,name:Te},I($),$=S(q,M);let $e=f(me,U);b($e?`layout: ${Te} \u2014 fights this slide's own column flexbox; pick one`:`layout: ${Te}`),k("layout",`slide ${U}: ${Te}`)}return{ring:he,cycle:se,flush:q}}ae();le();function Ci({commands:r,query:a="",totalSlides:l=0,makeGotoRow:d,makeSearchRow:u}){let h=String(a).toLowerCase(),f=r.filter(b=>!h||(b.label+" "+(b.alias??"")).toLowerCase().includes(h)),m=String(a).trim().match(/^(?:goto\s*)?(\d+)$/i);if(m&&d){let b=Math.max(1,Math.min(parseInt(m[1],10),l));f.unshift(d(b,l))}return h&&!m&&u&&!f.some(b=>b.label.toLowerCase().startsWith(h))&&f.push(u(a)),f}var Qc={transition:"fade",hash:!0,controls:!0,slideNumber:!1,width:1280,height:720,pinTitles:!0},wr=99,ed=18,Ni=6,td="ul, ol, svg, pre, table, .terminal, img, .columns",Bn=null;function jn(r,a){Ks(r,a),Bn&&Bn._rescanFor(r)}function nd(r){let a=getComputedStyle(r).position;return a==="absolute"||a==="fixed"}function rd(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(!nd(a))return null}return null}function sd(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 Oi(r){return r.pinTitles===!0?wr:typeof r.pinTitles=="number"&&isFinite(r.pinTitles)?r.pinTitles:null}function Mi(r,a){let l=Oi(a),d=r.getAttribute("data-pin");if(d==="none")return null;if(d!==null&&d!==""){let h=parseFloat(d);return isFinite(h)?h:l??wr}return d===""?l??wr:l===null?null:[...r.querySelectorAll(td)].some(h=>!h.closest("aside")&&!h.closest(".decklight-hero-logo"))?l:null}function yr(r,a){r.forEach(l=>{let d=rd(l),u=l.getAttribute("data-layout"),h;if(u==="pinned"){let k=parseFloat(l.getAttribute("data-pin"));h=isFinite(k)?k:Oi(a)??wr}else u==="centered"||u==="top"?h=null:h=Mi(l,a);let f=sd(l,d);if(l.querySelector(":scope > .pin-title")?.classList.remove("pin-title"),l.querySelector(":scope > .pin-subtitle")?.classList.remove("pin-subtitle"),h===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",h+"px"),l.classList.add("pin-measure");let m=d.offsetHeight||0,b=h+m;f&&(f.classList.add("pin-subtitle"),l.style.setProperty("--pin-sub-y",Math.round(b+Ni)+"px"),b+=Ni+(f.offsetHeight||0)),l.classList.remove("pin-measure"),l.style.setProperty("--pin-space",Math.round(b+ed)+"px")})}function Li(r){return[...r.children].filter(a=>!a.matches("h1, h2, .subtitle, aside, script, style, .decklight-hero-logo, .slide-bg"))}function $i(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=Li(a);if(od(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 od(r,a,l){let d=a.some(h=>{let f=getComputedStyle(h);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 ts(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 id(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 Ri(r={}){let a=new URLSearchParams(location.search),l={...Qc,...r};a.has("embedded")&&(l.controls=!1);let d=a.has("print"),u=a.get("print")||"",h=_i(),f=null,m=(w,_)=>h.log(w,_),b=document.querySelector(".decklight");if(!b)throw new Error("Decklight: no .decklight element found");let k=ri(),S=Ei({config:l,root:b,embedded:a.has("embedded"),sectionsOf:()=>te._sections,slideOf:()=>te.state.slide,navigate:w=>{location.href=w}}),I=S.playlist,M=S.index,C=S.hasMarkers,$=w=>S.gotoModule(w),q=w=>S.navigateToModule(w),he=200,se=4,ce=[],U=null,me=null;function Te(){return ce}function $e(w){ce.push({at:new Date,text:String(w)}),ce.length>he&&ce.shift(),me&&St()}function Re(w,_=3200){if($e(w),d)return;U||(U=document.createElement("div"),U.className="decklight-messages",b.appendChild(U));let A=document.createElement("div");for(A.className="decklight-toast",A.textContent=w,U.appendChild(A),requestAnimationFrame(()=>A.classList.add("show"));U.children.length>se;)U.firstChild.remove();setTimeout(()=>{A.classList.remove("show"),setTimeout(()=>A.remove(),260)},_)}let be=vi({root:b,printMode:d,params:a,toast:Re,debugLog:m,overlays:k,deck:()=>te}),Ce=ii({root:b,config:l,params:a,toast:Re,debugLog:m,overlays:k,deck:()=>te,editmode:()=>xt}),{applyTheme:Xe,currentTheme:xe,cycleTheme:E,cancelCyclePending:Ie,rollTheme:qe,saveGeneratedTheme:De}=Ce,F=null,J=0,H="",fe=[],Ee,ze=!1,Ne=null;function s(){return Si({sections:te._sections,modules:I?.modules??[],skipModule:M})}function o(){let w=F.querySelector(".tp-list");if(fe=Ai(F.__index,H),w.textContent="",fe.forEach((A,R)=>{let Z=document.createElement("div");Z.className="tp-row"+(A.slide===te.state.slide?" tp-current":"")+(A.href?" tp-module":""),Z.textContent=A.href?`\u25B8 ${A.title} \u2014 module`:`${A.slide} \xB7 ${A.title}`,Z.addEventListener("mouseenter",()=>Be(R,!1)),Z.addEventListener("click",()=>{Be(R,!0),Ue()}),w.appendChild(Z)}),!fe.length){let A=document.createElement("div");A.className="tp-none",A.textContent="no matches",w.appendChild(A)}let _=F.querySelector(".tp-filter");_.textContent=H||(I?"type to find a slide or module\u2026":"type to find a slide\u2026"),_.classList.toggle("tp-active",!!H)}function O(w,_){let A=_.href??location.pathname,R=_.slide??1;if(w.dataset.doc!==A){w.dataset.doc=A,ze=!1,w.addEventListener("load",()=>{if(ze=!0,Ne&&F){let Z=Ne;Ne=null,O(w,Z)}},{once:!0}),w.src=A+Ce.previewQuery()+"#/"+R+"/0";return}if(!ze){Ne=_;return}w.contentWindow?.postMessage({__decklightPreview:{goto:[R,0]}},"*")}function Be(w,_){if(!fe.length)return;J=jt(F.querySelectorAll(".tp-row"),w,"tp-selected");let A=fe[J];F.querySelector(".tp-caption").textContent=A.href?`module \u2014 ${A.title} (${A.href})`:`slide ${A.slide} \u2014 ${A.title}`,clearTimeout(Ee);let R=F.querySelector("iframe");_?O(R,A):Ee=setTimeout(()=>O(R,A),60)}function P(w){H=w,o(),fe.length?Be(0,!1):F.querySelector(".tp-caption").textContent="no match"}function Ue(){let w=fe[J];if(W(),!!w){if(w.href)return q(w.module);te.goto(w.slide,0)}}function nt(){if(F)return W();Ce.closePicker(),xt.restore.close(),H="",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),b.appendChild(F),Be(Math.max(0,fe.findIndex(w=>w.slide===te.state.slide)),!0)}function W(){clearTimeout(Ee),F?.remove(),F=null}let Ae=null,Q=0,ye="",x=[];function we(){let w=A=>typeof A=="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(A=>({label:`Configure ${A.title}\u2026 (dev)`,alias:"engine wizard setup api key credential token marketplace",run:()=>xt.wizard(A.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:gt},{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 A=te.__speakerWin;A&&!A.closed?A.__decklightSpeakerToggle?.():te.__speakerWin=Kr(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:()=>G()},{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<Gn.length&&{label:"Reset tips",alias:"hints again start over show all unsee replay",run:be.resetTips}].filter(Boolean).filter(A=>w(A.run))}function g(){let w=Ae.querySelector(".narr-card");w.textContent="",x=Ci({commands:we(),query:ye,totalSlides:te.state.totalSlides,makeGotoRow:(A,R)=>({label:`Go to slide ${A} / ${R}`,hint:"\u23CE",run:()=>te.goto(A,0)}),makeSearchRow:A=>({label:`Search slides for \u201C${A}\u201D`,hint:"",run:()=>{nt(),P(A)}})});let _=document.createElement("div");if(_.className="pal-input"+(ye?" tp-active":""),_.textContent=ye||"type a command\u2026",w.appendChild(_),x.forEach((A,R)=>{let Z=document.createElement("div");Z.className="narr-row pal-row";let ue=document.createElement("span");if(ue.textContent=A.label,Z.appendChild(ue),A.hint){let We=document.createElement("span");We.className="pal-kbd",We.textContent=A.hint,Z.appendChild(We)}Z.addEventListener("mouseenter",()=>j(R)),Z.addEventListener("click",()=>{j(R),B()}),w.appendChild(Z)}),!x.length){let A=document.createElement("div");A.className="tp-none",A.textContent="no matching command",w.appendChild(A)}j(0)}function j(w){x.length&&(Q=jt(Ae.querySelectorAll(".pal-row"),w,"narr-sel"))}function B(){let w=x[Q];w&&(w.keepOpen||Y(),w.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),b.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 w=ge.querySelector(".narr-card");re.forEach(([_],A)=>{let R=document.createElement("div");R.className="narr-row"+(A===He?" narr-cur":""),R.textContent=_,A>0&&(R.style.fontFamily=re[A][1]),R.addEventListener("mouseenter",()=>Fe(A)),R.addEventListener("click",()=>{_e(A),Je()}),w.appendChild(R)}),kt(ge,Je),b.appendChild(ge),Fe(He)}function Fe(w){V=jt(ge.querySelectorAll(".narr-row"),w,"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(w,{silent:_=!1,remeasure:A=!0}={}){He=(w%re.length+re.length)%re.length;let[R,Z]=re[He];if(Z?(b.style.setProperty("--font-body",Z),b.style.setProperty("--font-heading",Z)):(b.style.removeProperty("--font-body"),b.style.removeProperty("--font-heading")),!a.has("embedded"))try{Z?localStorage.setItem(ke,String(He)):localStorage.removeItem(ke)}catch{}A&&(yr(te._sections,l),ts(te._sections[te.state.slide-1],te.state.slide)),_||Re(`font: ${R}`),m("font",R)}function Le(w){_e(He+w)}try{let w=parseInt(localStorage.getItem(ke),10);w>0&&w<re.length&&_e(w,{silent:!0,remeasure:!1})}catch{}function Qe(w){if(!w)return null;if(w.startsWith("#")){let A=document.querySelector(w);if(!A)return null;let R=A.cloneNode(!0);return R.removeAttribute("id"),R.style.removeProperty("display"),R}if(w.trim().startsWith("<")){let A=document.createElement("div");return A.innerHTML=w,A.firstElementChild}let _=document.createElement("img");return _.src=w,_.alt="",_}let Oe=null;Ce.updateCanvas();let Ye=b.querySelector(":scope > .decklight-stage");if(!Ye){for(Ye=document.createElement("div"),Ye.className="decklight-stage";b.firstChild;)Ye.appendChild(b.firstChild);b.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[w,_]of[["src","on-any"],["onLight","on-light"],["onDark","on-dark"]]){let A=Qe(l.logo[w]);if(!A)continue;let R=document.createElement("span");R.className=_,R.appendChild(A),Oe.appendChild(R)}b.appendChild(Oe)}function ct(w){Oe&&w.forEach(_=>{if(!_.hasAttribute("data-logo")||_.querySelector(":scope > .decklight-hero-logo"))return;let A=document.createElement("div");A.className="decklight-hero-logo";let R=parseFloat(_.getAttribute("data-logo"));R&&A.style.setProperty("--hero-logo-h",R+"px"),A.innerHTML=Oe.innerHTML,_.prepend(A)})}id(Ye),eo(Ye),oo(Ye),Xs(Ye),ei(Ye,jn);let _t=Ti({slideOf:()=>te.state.slide,sectionAt:w=>te._sections[w-1],describe:w=>({autoPins:Mi(w,l)!==null,hasSplitPair:Li(w).length>1}),available:()=>xt.available(),unavailableMessage:()=>tn("layout",location),apply:(w,_)=>{_==="auto"?w.removeAttribute("data-layout"):w.setAttribute("data-layout",_)},relayout:(w,_)=>(yr(te._sections,l),$i(te._sections),ts(w,_),w.hasAttribute("data-split-conflict")),post:w=>fetch(xt.base()+"/edit/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(w)}).then(_=>{if(!_.ok)throw new Error(_.status)}),toast:Re,debugLog:m}),Pt=w=>_t.cycle(w),Kt=w=>_t.ring(w),te={root:b,stage:Ye,config:l,_sections:[],_records:[],state:{slide:1,step:0,totalSlides:0},_listeners:new Map,_scale:1,on(w,_){return this._listeners.has(w)||this._listeners.set(w,new Set),this._listeners.get(w).add(_),this},_emit(w,_){(this._listeners.get(w)||[]).forEach(A=>A(_)),b.dispatchEvent(new CustomEvent("decklight:"+w,{detail:_}))},sync(){this._sections=[...Ye.querySelectorAll(":scope > section")],this._sections.forEach((_,A)=>_.setAttribute("data-slide-index",String(A+1))),Zs(Ye,l.concepts),ct(this._sections),bi(this._sections,{printMode:d}),yr(this._sections,l),$i(this._sections),this._records=this._sections.map(_=>Br(_)),this.state.totalSlides=this._sections.length,this.state.slide=Math.min(this.state.slide,this.state.totalSlides||1);let w=this._records[this.state.slide-1];w&&(this.state.step=Math.min(this.state.step,w.groups.length)),Vt(d?this._sections:[this._sections[this.state.slide-1]])},_rescanFor(w){let _=w.closest("section"),A=this._sections.indexOf(_);if(A!==-1){if(this._records[A]=Br(_),d){cn(this._records[A],this._records[A].groups.length);return}A===this.state.slide-1?(this.state.step=Math.min(this._requestedStep??this.state.step,this._records[A].groups.length),this._requestedStep=null,Dt(()=>cn(this._records[A],this.state.step)),this._updateHash(!1)):Dt(()=>cn(this._records[A],0)),this._notify()}},_stepLabels(w){let _=this._records[w];return _?Ws(_):[]},next(){let w=this._records[this.state.slide-1];w&&this.state.step<w.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 w=this._records[this.state.slide-2];this.goto(this.state.slide-1,w.groups.length,{direction:"back"})}else $(-1)},goto(w,_=0,A={}){w=Math.max(1,Math.min(w,this.state.totalSlides));let R=this._records[w-1];this._requestedStep=_,_=Math.max(0,Math.min(_,R?R.groups.length:0));let Z=w===this.state.slide;if(Z&&_===this.state.step&&!A.force)return;let ue=A.direction||(w>this.state.slide||Z&&_>this.state.step?"fwd":"back");!Z||A.force?(this._activateSlide(w,ue,A),this.state.slide=w,this.state.step=_,Dt(()=>cn(R,_)),this._emit("slide",{slide:w,total:this.state.totalSlides,direction:ue}),Vt([this._sections[w-1]])):(this.state.step=_,cn(R,_),this._emit("build",{slide:w,index:_,total:R.groups.length,direction:ue})),this._updateChrome(),this._updateHash(!Z),this._notify()},_activateSlide(w,_,A={}){let R=this._sections[this.state.slide-1],Z=this._sections[w-1];if(b.classList.toggle("has-hero-logo",Z?.hasAttribute("data-logo")??!1),R===Z){Z.classList.add("active");return}let ue=!R||!R.classList.contains("active"),We=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(We){R.classList.add("leaving"),R.style.visibility="hidden",Z.style.visibility="hidden",Z.offsetWidth,Z.style.visibility="",no(R,Z,this._scale),R.classList.remove("leaving"),R.style.visibility="";return}let ot=Z.getAttribute("data-transition")||this.config.transition;if(ot==="none")return;let bt="dir-"+_;Z.classList.add("entering","tr-"+ot,bt),R.classList.add("leaving","tr-"+ot,bt,"active-out");let mn=parseFloat(getComputedStyle(Z).getPropertyValue("--transition-duration"))*1e3||350;setTimeout(()=>{R.classList.remove("leaving","tr-"+ot,bt,"active-out"),Z.classList.remove("entering","tr-"+ot,bt)},mn+60)},_updateChrome(){if(Ct){let w=this._records[this.state.slide-1],_=w?w.groups.length:0,A=this.state.totalSlides<=1?1:(this.state.slide-1+(_?this.state.step/(_+1):0))/(this.state.totalSlides-1);Ct.style.width=(Math.min(A,1)*100).toFixed(2)+"%"}if(ft){let w=this.config.slideNumber?this.config.slideNumber==="n/N"?`${this.state.slide} / ${this.state.totalSlides}`:String(this.state.slide):"";if(ft.textContent=w,S.any){let _=S.title(),A=document.createElement("span");A.className="mod",A.textContent=_,ft.prepend(A)}}},_updateHash(w){if(!this.config.hash||d)return;let _=`#/${this.state.slide}/${this.state.step}`;"#"+qt(location.hash)!==_&&(pt=!0,w?history.pushState(null,"",_):history.replaceState(null,"",_),setTimeout(()=>{pt=!1}))},_notify(){this.__notifySpeaker&&this.__notifySpeaker()}};function nn(w,_){let A=document.createElement("a");A.href=w,A.download=_,document.body.appendChild(A),A.click(),A.remove()}function Dt(w){b.classList.add("decklight-no-anim"),w(),b.offsetWidth,b.classList.remove("decklight-no-anim")}function qt(w){return(w||"").replace(/^#/,"")}function Xt(){let w=qt(location.hash).match(/^\/(\d+)(?:\/(\d+))?/);return w?{slide:parseInt(w[1],10),step:w[2]?parseInt(w[2],10):0}:null}let Ct=null,ft=null;if(l.controls&&!d){let w=document.createElement("div");w.className="decklight-controls",w.innerHTML=`
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=`
310
310
  <button class="decklight-arrow prev" aria-label="Previous">\u2039</button>
311
- <button class="decklight-arrow next" aria-label="Next">\u203A</button>`,b.appendChild(w),w.querySelector(".prev").addEventListener("click",()=>te.prev()),w.querySelector(".next").addEventListener("click",()=>te.next())}let it={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 G(){let w=b||document.documentElement;document.fullscreenElement?document.exitFullscreen?.():w.requestFullscreen?.()?.catch?.(()=>{})}document.addEventListener("fullscreenchange",()=>{st&&(st.innerHTML=document.fullscreenElement?it.unfull:it.full)});function ie(){if(!N)return;let w=At.status().narrating;N.innerHTML=w?it.sound:it.mute,N.setAttribute("aria-label",w?"Mute narration":"Play narration"),N.setAttribute("aria-pressed",String(w))}(l.slideNumber||I||C)&&!d&&(ft=document.createElement("div"),ft.className="decklight-slide-number",(I||C)&&(ft.title="G \u2014 find a slide or module",ft.style.cursor="pointer",ft.addEventListener("click",()=>nt())),b.appendChild(ft));let pe=null,Pe=0;function Se(){return getComputedStyle(pe).gridTemplateColumns.split(" ").length||1}function Me(w){let _=pe.querySelectorAll(".ov-cell");Pe=Math.max(0,Math.min(w,_.length-1)),_.forEach((A,R)=>A.classList.toggle("ov-selected",R===Pe)),_[Pe]?.scrollIntoView({block:"nearest"})}function rt(){let w=Pe+1;Et(),te.goto(w,0,{force:!0})}function at(){if(!pe)return;let w=pe.querySelector(".ov-cell");if(!w)return;pe.style.gridAutoRows=Math.round(w.clientWidth*l.height/l.width)+"px";let _=w.clientWidth/l.width;pe.querySelectorAll(".ov-frame").forEach(A=>{A.style.transform=`scale(${_})`})}function Et(){if(pe){window.removeEventListener("resize",at),pe.remove(),pe=null,b.classList.remove("decklight-overview");return}pe=document.createElement("div"),pe.className="decklight-overview-grid",te._sections.forEach((w,_)=>{let A=document.createElement("div");A.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=w.cloneNode(!0);Z.classList.add("active","ov-clone"),Z.querySelectorAll("aside.notes, aside.rehearse").forEach(We=>We.remove()),Z.querySelectorAll("input, button, select, textarea").forEach(We=>{We.removeAttribute("name"),We.disabled=!0}),R.appendChild(Z),A.appendChild(R);let ue=document.createElement("span");ue.className="ov-num",ue.textContent=String(_+1),A.appendChild(ue),A.addEventListener("click",()=>{Et(),te.goto(_+1,0,{force:!0})}),pe.appendChild(A)}),b.classList.add("decklight-overview"),b.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",b.appendChild(Nt)}let Rt=null;function wn(){let w=te._records?.[te.state.slide-1],_=At.status(),A=_.live?`\u26A1 ${_.voice} \xB7 ${_.tone}`:_.track?`\u{1F50A} ${_.track.label}`:"none";return`slide ${te.state.slide}/${te.state.totalSlides} \xB7 step ${te.state.step}/${w?w.groups.length:0} \xB7 theme ${xe()??"\u2014"} \xB7 narration ${_.narrating?_.paused?"paused":"on":"off"} (${A})`+(_.rate!==1?` \xB7 ${_.rate}\xD7`:"")+(_.spend>0?` \xB7 tts ~$${_.spend.toFixed(4)}`:"")}function Ht(w){let _=document.createElement("div");_.className="dbg-row dbg-"+w.kind;for(let[A,R]of[["dbg-t",w.t],["dbg-k",w.kind],["dbg-m",w.msg]]){let Z=document.createElement("span");Z.className=A,Z.textContent=R,_.appendChild(Z)}f.querySelector(".dbg-log").appendChild(_)}function It(){let w=f?.querySelector(".dbg-state");w&&(w.textContent=wn())}function dt(){if(f){f.remove(),f=null,h.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),h.entries.forEach(Ht),It();let w=f.querySelector(".dbg-log");w.scrollTop=w.scrollHeight,h.onEntry(_=>{Ht(_),It();let A=f.querySelector(".dbg-log");A.scrollTop=A.scrollHeight})}function St(){let w=me?.querySelector(".msg-log");if(w){if(w.innerHTML="",!ce.length){let _=document.createElement("div");_.className="msg-empty",_.textContent="no messages yet",w.appendChild(_);return}ce.forEach(({at:_,text:A})=>{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=A,R.append(Z,ue),w.appendChild(R)}),w.scrollTop=w.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>',b.appendChild(me),St()}te.on("ready",w=>m("ready",`${w.slides} slides${w.print?" \xB7 print":""}`)),te.on("slide",w=>{m("slide",`\u2192 ${w.slide}/${w.total} (${w.direction})`),It()}),te.on("build",w=>{m("build",`slide ${w.slide} step ${w.index}/${w.total} (${w.direction})`),It()}),window.addEventListener("error",w=>m("error",String(w.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>
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>
312
312
  <tr><td>\u2192 / Space</td><td>next build / slide</td></tr>
313
313
  <tr><td>\u2190</td><td>previous</td></tr>
314
314
  <tr><td>Home / End</td><td>first / last slide</td></tr>
@@ -341,16 +341,16 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),H===void 0&
341
341
  <tr><td>\u2303T</td><td>generate a theme (repeat to re-roll)</td></tr>
342
342
  <tr><td>\u2303\u21E7T</td><td>save the generated theme</td></tr>
343
343
  <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),b.appendChild(Rt)}k.register({isOpen:()=>!!Ae,close:Y,keydown:w=>pr(w,{query:ye,onMove:_=>j(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:w=>pr(w,{onMove:_=>Fe(V+_),onCommit:()=>{_e(V),Je()},onClose:Je})}),k.register({isOpen:()=>!!F,close:W,keydown:w=>pr(w,{query:H,onMove:_=>Be(J+_,!1),onCommit:Ue,onType:_=>P(H+_),onBackspace:()=>P(H.slice(0,-1)),onClear:()=>P(""),onClose:W})}),k.register({isOpen:()=>!!pe,close:Et,keydown(w){switch(w.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=w=>w.code==="Backquote"||w.key==="`"||w.key==="~"||w.key==="\xB2";function xn(w){if(Gt(w)&&(w.metaKey||w.ctrlKey||w.altKey)){ut(),w.preventDefault();return}if(/^(input|textarea|select)$/i.test(w.target.tagName))return;if(w.ctrlKey&&!w.metaKey&&!w.altKey&&(w.key==="T"||w.key==="t")){w.shiftKey?De():Ce.rollFromPicker()||qe(),w.preventDefault();return}if(w.metaKey||w.ctrlKey||w.altKey)return;let _=k.active();if(_){_.keydown(w)&&w.preventDefault();return}if(Gt(w)){ut(),w.preventDefault();return}switch(w.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":G();break;case"v":case"V":w.shiftKey?sn():wt();break;case"n":case"N":Lt();break;case"s":case"S":{let A=te.__speakerWin;A&&!A.closed?A.__decklightSpeakerToggle?.():te.__speakerWin=Kr(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(w.shiftKey?-1:1);break;case"z":case"Z":an(w.shiftKey?"redo":"undo");break;case"a":case"A":gt();break;case"w":case"W":Qt(w.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}w.preventDefault()}d||document.addEventListener("keydown",xn);let Wt=null;b.addEventListener("touchstart",w=>{Wt=w.touches[0].clientX},{passive:!0}),b.addEventListener("touchend",w=>{if(Wt==null)return;let _=w.changedTouches[0].clientX-Wt;Math.abs(_)>40&&(_<0?te.next():te.prev()),Wt=null},{passive:!0});function L(){let w=b.getBoundingClientRect(),_=Math.min(w.width/l.width,w.height/l.height)||1;te._scale=_,Ye.style.transform=`translate(-50%, -50%) scale(${_})`}d||(new ResizeObserver(L).observe(b),L());let vn=ki({sectionsOf:()=>te._sections,checkOverflow:ts}),Vt=w=>vn.watch(w),pt=!1;if(l.hash&&!d&&window.addEventListener("hashchange",()=>{if(pt)return;let w=Xt();w&&te.goto(w.slide,w.step,{force:!0})}),!d){let w=()=>{te._sections.forEach((_,A)=>{let R=_.querySelector(":scope > .slide-bg > video");R&&(A===te.state.slide-1?R.play()?.catch?.(()=>{}):R.paused||R.pause())})};te.on("slide",w)}te.sync(),d&&Oe&&(te._sections.forEach(w=>{w.hasAttribute("data-logo")||w.appendChild(Oe.cloneNode(!0))}),Oe.remove()),document.fonts?.ready?.then(()=>{(Bn===te||!Bn)&&yr(te._sections,l)}),te.theme=w=>Xe(w),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=hi({root:b,stage:Ye,config:l,params:a,printMode:d,toast:Re,logOnly:$e,debugLog:m,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=gi({root:b,printMode:d,toast:Re,debugLog:m,overlays:k,instance:te,narration:At,downloadFromUrl:nn,setProgressBar:w=>{Ct=w}}),{toggleClock:Jt,toggleProgress:on,toggleInk:Qt,toggleTranscript:Bt}=zt;te.toggleClock=Jt,te.toggleProgress=on;let xt=yi({root:b,config:l,params:a,printMode:d,toast:Re,debugLog:m,overlays:k,instance:te,notesSegs:hn,dismissOthers:()=>{Ce.closePicker(),F&&W(),Ae&&Y()}}),{deckHistory:an,toggleEditor:kn,toggleAgentAsk:gt,toggleElementEdit:T}=xt;if(te.restore=xt.restore,te.wizard=xt.wizard,te.toggleElementEdit=T,a.has("voiceover")&&At.status().track&&!d){let w=()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("keydown",w),At.status().narrating||wt()};window.addEventListener("pointerdown",w,{once:!0}),window.addEventListener("keydown",w,{once:!0})}if(!d){let w=document.createElement("div");w.className="decklight-touch-controls",st=document.createElement("button"),st.type="button",st.className="decklight-touch-btn",st.setAttribute("aria-label","Fullscreen"),st.innerHTML=it.full,st.addEventListener("click",G),w.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()),w.appendChild(N),ie()),b.appendChild(w)}if(te.saveGeneratedTheme=w=>De(w),d)return b.classList.add("decklight-print"),te._sections.forEach((w,_)=>{w.classList.add("active"),cn(te._records[_],te._records[_].groups.length)}),(u==="handout"||u==="notes")&&(b.classList.add("decklight-print-"+u),mi(Ye,te._sections,u)),Vt(te._sections),b.__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((w,_)=>{_!==K.slide-1&&cn(te._records[_],0)}),te.goto(K.slide,K.step,{force:!0}),b.__decklight=te,Bn=te,te._emit("ready",{slides:te.state.totalSlides}),be.start(K),te}ae();le();ae();le();var ns="\x1B",xr=Object.freeze({fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1});function ad(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={...xr},this._pending=""}write(a){let l=this._pending+a;this._pending="";let d=0;for(;d<l.length;){let u=l[d];if(u===ns){let h=this._consumeEscape(l,d);if(h===0){this._pending=l.slice(d);return}d+=h;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:xr});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 h=a.charCodeAt(u);if(h>=64&&h<=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]===ns&&a[u+1]==="\\")return u-l+2;if(a[u]===ns&&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:xr};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={...xr};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 h=u===38?"fg":"bg";l[d+1]===5&&l.length>d+2?(this.style[h]={type:"256",idx:l[d+2]},d+=2):l[d+1]===2&&l.length>d+4&&(this.style[h]={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&&ld(u.style,d.style)?u.text+=d.ch:l.push({text:d.ch,style:d.style})}return l})}toHtml(){return this.lines.map(a=>dd(a)).join(`
346
- `)}};function ld(r,a){return r.bold===a.bold&&r.dim===a.dim&&r.italic===a.italic&&r.underline===a.underline&&r.inverse===a.inverse&&Ii(r.fg,a.fg)&&Ii(r.bg,a.bg)}function Ii(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 cd(r){if(r.type==="256"){if(r.idx<16)return null;let[a,l,d]=ad(r.idx);return`rgb(${a},${l},${d})`}return r.type==="rgb"?`rgb(${r.r},${r.g},${r.b})`:null}function dd(r){return r.map(({text:a,style:l})=>{let d=[],u=[],{fg:h,bg:f}=l;l.inverse&&([h,f]=[f??{type:"inv-default-bg"},h??{type:"inv-default-fg"}]);for(let[S,I]of[[h,"fg"],[f,"bg"]])if(S)if(S.type==="ansi"||S.type==="256"&&S.idx<16)d.push(`ansi-${I}-${S.idx}`);else if(S.type==="inv-default-bg")d.push("ansi-inv-fg");else if(S.type==="inv-default-fg")d.push("ansi-inv-bg");else{let M=cd(S);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 m=vt(a);if(!d.length&&!u.length)return m;let b=d.length?` class="${d.join(" ")}"`:"",k=u.length?` style="${u.join(";")}"`:"";return`<span${b}${k}>${m}</span>`}).join("")}var Bi=24,ud=r=>Math.max(1,Math.min(10,r)),pd=r=>2**((r-5)/2.5),Pi=55,Vn=[120,160],Di="decklight-term-wpm:"+location.pathname,hd=r=>Vn.reduce((a,l)=>Math.abs(l-r)<Math.abs(a-r)?l:a),Kn=["thocky","creamy","clacky","off"],qi="decklight-term-typesound:"+location.pathname,Fi="decklight-term-fontsize:"+location.pathname,Wn=[.75,.9,1,1.15,1.35,1.6],zi={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 rs(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 md=.012,yt=null,vr=null,Er=new Set,Ui=r=>{Er.add(r),r.addEventListener("ended",()=>Er.delete(r),{once:!0})};function fd(){if(!yt)return;let r=yt.currentTime;for(let a of Er)try{a.stop(r)}catch{}Er.clear()}function kr(r="",a="thocky",l=.12){try{let d=window.AudioContext||window.webkitAudioContext;if(!d)return;if(yt??=new d,yt.state==="suspended"&&yt.resume(),!vr){let q=Math.floor(yt.sampleRate*.06);vr=yt.createBuffer(1,q,yt.sampleRate);let he=vr.getChannelData(0);for(let se=0;se<q;se++)he[se]=Math.random()*2-1}let u=zi[a]??zi.thocky,h=(q,he)=>q+Math.random()*(he-q),f=yt.currentTime+md,m=r===" ",b=h(.45,1.3)*(m?1.25:1),k=h(...u.clickF)*(m?.7:1),S=h(...u.ring)*(m?1.5:1),I=(q,he,se,ce)=>{let U=yt.createBufferSource();U.buffer=vr;let me=yt.createBiquadFilter();me.type="bandpass",me.frequency.value=se,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+ce),U.connect(me),me.connect(Te),Te.connect($e),$e.connect(yt.destination),U.start(q),U.stop(q+ce+.01),Ui(U)},M=(q,he,se,ce)=>{let U=yt.createOscillator();U.type="sine",U.frequency.setValueAtTime(se,q),U.frequency.exponentialRampToValueAtTime(se*.6,q+ce*.6);let me=yt.createGain();me.gain.setValueAtTime(1e-4,q),me.gain.exponentialRampToValueAtTime(he,q+h(.003,.011)),me.gain.exponentialRampToValueAtTime(he*.25,q+ce),me.gain.exponentialRampToValueAtTime(1e-4,q+ce*2),U.connect(me),me.connect(yt.destination),U.start(q),U.stop(q+ce*2+.01),Ui(U)},C=u.thumpF2&&Math.random()<(u.thumpF2Prob??.4)?u.thumpF2:u.thumpF;I(f,u.click*b*(m?.82:1),k,h(...u.clickDecay)*(m?1.2:1)),M(f,u.thump*b*(m?2.4:1),h(...C)*(m?.7:1),S);let $=f+Math.max(.01,Math.min(h(.035,.08),l*.55));I($,u.click*b*h(.35,.55),k*1.15,h(...u.clickDecay)*.8),M($,u.thump*b*(m?.5:.25),h(...C)*(m?.7:1),S*.6)}catch{}}function gd(){try{let r=window.AudioContext||window.webkitAudioContext;if(!r)return;yt??=new r,yt.state==="suspended"&&yt.resume()}catch{}}var Hi=!1;function bd(){if(Hi||typeof document>"u")return;Hi=!0;let r=()=>{gd(),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0)};document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",r,!0)}function os(r,a=document){let l=[...a.querySelectorAll(".terminal[data-cast], .terminal[data-cast-inline]")];return l.length&&bd(),Promise.all(l.map(d=>yd(d,r).catch(u=>{kd(d,u)})))}async function yd(r,a){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 h=wd(l,d),f=new ss(r,h);r._decklightTerminal=f;let m=r.dataset.mode||"step";h.imported&&m==="step"&&!h.hasMarkers&&(m="play"),m==="play"?f.mountPlayMode():f.mountStepMode(a)}function wd(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 xd(r,a)}function xd(r,a){let l=r.split(`
347
- `).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: ${a}`);let u=[],h={cmd:"",raw:!0,output:[]},f=0,m=!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[S,I,M]=k;I==="m"?(m=!0,h.output.length&&u.push(h),h={cmd:String(M||""),raw:!0,output:[]},f=S):I==="o"&&h.output.push([Math.max(0,vd(S-f)),M])}if(h.output.length&&u.push(h),!u.length)throw new Error(`asciicast has no output events: ${a}`);return{decklightCast:1,imported:!0,hasMarkers:m,meta:{cols:d.width||100,rows:d.height||28,prompt:""},steps:u}}function vd(r){return Math.round(r*1e3)/1e3}function kd(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 ss=class{constructor(a,l){this.el=a,this.cast=l,this.prompt=l.meta.prompt??"$ ";let d=ud(parseInt(a.dataset.typeSpeed??"5",10)||5);this.typeWpm=hd(Pi*pd(d));try{let h=parseInt(localStorage.getItem(Di)??"",10);Vn.includes(h)&&(this.typeWpm=h)}catch{}a.dataset.typeWpm=String(this.typeWpm),this.fontIdx=Wn.indexOf(1);try{let h=parseInt(localStorage.getItem(Fi)??"",10);h>=0&&h<Wn.length&&(this.fontIdx=h)}catch{}this._applyFont();let u=(a.dataset.typeSound||"thocky").toLowerCase();this.soundName=Kn.includes(u)?u:"thocky";try{let h=localStorage.getItem(qi);h&&Kn.includes(h)&&(this.soundName=h)}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||Bi,Bi),this.epoch=0,this.applied=0,this.playable=l.steps.filter(h=>!h.hidden&&h.sleep==null),this._mountChrome(),this._watchSlide()}stop(){if(this.epoch+=1,fd(),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(`
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
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=Wn[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(Wn[this.fontIdx]*100)}%`};l(),a.addEventListener("click",()=>{this.fontIdx=(this.fontIdx+1)%Wn.length,this._applyFont();try{localStorage.setItem(Fi,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=(Vn.indexOf(this.typeWpm)+1)%Vn.length;this.typeWpm=Vn[d],this.el.dataset.typeWpm=String(this.typeWpm);try{localStorage.setItem(Di,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=(Kn.indexOf(this.soundName)+1)%Kn.length;this.soundName=Kn[d],this.typeSound=this.soundName==="off"?null:this.soundName,this.el.dataset.typeSound=this.soundName;try{localStorage.setItem(qi,this.soundName)}catch{}this.typeSound&&kr("a",this.typeSound,.12),l()}),this.controlsEl.appendChild(a)}_typeFactor(a,l=!1){return(l&&this.speed||1)*(this.typeWpm/Pi)*(a.typeSpeed||1)}async _typeCmd(a,l,d,u,h=!1){for(let f=1;f<=a.length;f++){if(this.epoch!==u)return!1;let m=a[f-1],b=rs(m)/this._typeFactor(d,h);this.typeSound&&kr(m,this.typeSound,b/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(b)}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 h=u.length?u.join(`
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(`
350
350
  `)+`
351
- `:"",f=d.cmd||"";if(!d.raw){if(!await this._typeCmd(f,h,d,l))return;await pn(120/this._typeFactor(d))}let m=this._stepEvents(d),b=m.length?m[m.length-1].t*1e3:0,k=b>this.maxStep?this.maxStep/b:1,S=new Pn,I=()=>{let C=S.toHtml();this.linesEl.innerHTML=d.raw?h+C:h+this._promptHtml()+`<span class="terminal-cmd">${vt(f)}</span>`+(C?`
352
- `+C:""),this._scrollToEnd()},M=0;for(let C of m){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=rs(q)/this._typeFactor(d);this.typeSound&&kr(q,this.typeSound,he/1e3),S.write(q),I(),await pn(he)}else S.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 h=this.cast.steps[u];if(h.hidden){this._playedUpTo=u+1;continue}if(h.sleep!=null){if(await pn(h.sleep*1e3/this.speed),this.epoch!==l){this._playedUpTo=u;return}this._playedUpTo=u+1;continue}let m=this.cast.steps.slice(0,u).filter(C=>!C.hidden&&C.sleep==null).map(C=>this._stepHtml(C)),b=m.length?m.join(`
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(`
353
353
  `)+`
354
- `:"",k=h.cmd||"";if(!h.raw&&!await this._typeCmd(k,b,h,l,!0)){this._playedUpTo=u;return}let S=new Pn,I=()=>{let C=S.toHtml();this.linesEl.innerHTML=h.raw?b+C:b+this._promptHtml()+`<span class="terminal-cmd">${vt(k)}</span>`+(C?`
355
- `+C:""),this._scrollToEnd()},M=0;for(let C of this._stepEvents(h)){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=rs(q)/this._typeFactor(h,!0);this.typeSound&&kr(q,this.typeSound,he/1e3),S.write(q),I(),await pn(he)}else S.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 Ed="0.3.0";function Sd(r={}){let a=Ri(r),l=os||(void 0)?.registerTerminals;return typeof l=="function"&&Promise.resolve(l({registerBuildProvider:jn},document)).catch(d=>console.error("Decklight: terminal subsystem failed to initialize",d)),a}function Ad(r=document){let a=os||(void 0)?.registerTerminals;return typeof a=="function"?Promise.resolve(a({registerBuildProvider:jn},r)):Promise.resolve()}return Ua(_d);})();
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);})();
356
356
  //# sourceMappingURL=decklight.js.map