|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[48136],{48136:function(e,t,n){var i=Object.defineProperty,o=Object.defineProperties,r=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,c=(e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&c(e,n,t[n]);if(a)for(var n of a(t))l.call(t,n)&&c(e,n,t[n]);return e},h=(e,t)=>o(e,r(t)),u=e=>"symbol"==typeof e?e:e+"",p=(e,t)=>{var n={};for(var i in e)s.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&a)for(var i of a(e))t.indexOf(i)<0&&l.call(e,i)&&(n[i]=e[i]);return n};function m(e){return Array.isArray(e)}function f(){return"window"in globalThis&&"document"in globalThis}function g(){return"function"==typeof navigator.vibrate}function b(){var e,t;if(!f())return"other";const n=null!=(t=null==(e=navigator.userAgentData)?void 0:e.platform)?t:navigator.platform;return/^mac/i.test(n)?5===navigator.maxTouchPoints?"ios":"macos":/^win/i.test(n)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function y(){return HTMLElement.prototype.hasOwnProperty("popover")}var v={strings:{en:{"keyboard.tooltip.symbols":"符号","keyboard.tooltip.greek":"希腊字母","keyboard.tooltip.numeric":"数字","keyboard.tooltip.alphabetic":"罗马字母","tooltip.cut to clipboard":"剪切到剪贴板","tooltip.copy to clipboard":"复制到剪贴板","tooltip.paste from clipboard":"粘贴","tooltip.redo":"重做","tooltip.toggle virtual keyboard":"切换虚拟键盘","tooltip.undo":"撤消","menu.insert matrix":"插入矩阵","menu.borders":"矩阵分隔符","menu.array.add row above":"在后面添加行","menu.array.add row below":"在前面添加行","menu.array.add column after":"在后面添加列r","menu.array.add column before":"在前面添加列","menu.array.delete row":"删除行","menu.array.delete rows":"删除选定行","menu.array.delete column":"删除列","menu.array.delete columns":"删除选定的列","menu.mode":"模式","menu.mode-math":"数学","menu.mode-text":"文本","menu.mode-latex":"LaTeX","tooltip.blackboard":"黑板","tooltip.bold":"粗体","tooltip.italic":"斜体","tooltip.fraktur":"Fraktur","tooltip.script":"脚本","tooltip.caligraphic":"草书","tooltip.typewriter":"打字机","tooltip.roman-upright":"罗马直立","tooltip.row-by-col":"%@ × %@","menu.font-style":"字体样式","menu.accent":"重音","menu.decoration":"装饰","menu.color":"颜色","menu.background-color":"背景","menu.evaluate":"计算","menu.simplify":"简化","menu.solve":"求解","menu.solve-for":"求解 %@","menu.cut":"剪切","menu.copy":"复制","menu.copy-as-latex":"复制为 LaTeX","menu.copy-as-ascii-math":"复制为 ASCII Math","menu.copy-as-mathml":"复制为 MathML","menu.paste":"粘贴","menu.select-all":"全选","color.red":"红色","color.orange":"橙色","color.yellow":"黄色","color.lime":"绿黄色","color.green":"绿色","color.teal":"青色","color.cyan":"蓝绿色","color.blue":"蓝色","color.indigo":"靛蓝色","color.purple":"紫色","color.magenta":"洋红色","color.black":"黑色","color.dark-grey":"深灰色","color.grey":"灰色","color.light-grey":"浅灰色","color.white":"白色"}},_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return v._locale||(v._locale=f()?navigator.language.slice(0,5):"en-US"),v._locale},set locale(e){v._locale=e,v._numberFormatter=void 0,v.dirty=!0},get numberFormatter(){return v._numberFormatter||(v._numberFormatter=new Intl.NumberFormat(v.locale)),v._numberFormatter},merge(e,t){if("string"==typeof e&&t)v.strings[e]=d(d({},v.strings[e]),t),v.dirty=!0;else for(const t of Object.keys(e))v.merge(t,e[t])},get dirty(){return v._dirty},set dirty(e){v._dirty||v._dirty===e||(v._dirty=!0,setTimeout((()=>{v._dirty=!1,this._subscribers.forEach((e=>null==e?void 0:e()))}),0))},subscribe(e){return v._subscribers.push(e),v._subscribers.length-1},unsubscribe(e){e<0||e>=v._subscribers.length||(v._subscribers[e]=void 0)},update(e){let t=e.querySelectorAll("[data-l10n-tooltip]");for(const e of t){const t=e.getAttribute("data-l10n-tooltip");if(t){const n=x(t);n&&e.setAttribute("data-tooltip",n)}}t=e.querySelectorAll("[data-l10n-arial-label]");for(const e of t){const t=e.getAttribute("data-l10n-arial-label");if(t){const n=x(t);n&&e.setAttribute("aria-label",n)}}}};function x(e,...t){if(void 0===e)return;let n="";const i=v.locale;v.strings[i]&&(n=v.strings[i][e]);const o=i.slice(0,2);if(!n&&v.strings[o]&&(n=v.strings[o][e]),n||(n=v.strings.en[e]),!n)return;const r=/(%@|%([0-9]+)\$@)/g;let a=r.exec(n),s=0;for(;a;){if(t[s++]){let e=t[a[2]?parseInt(a[2],10)-1:s-1];"number"==typeof e&&(e=v.numberFormatter.format(e)),n=n.replace(a[1],e)}a=r.exec(n)}return n=n.replace(/%%/g,"%"),n}var w={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},_={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},k={red:"#fbbbb6",orange:"#ffe0c2",yellow:"#fff1c2",lime:"#d0e8b9",green:"#bceac4",teal:"#b9f1f1",cyan:"#b8e5c9",blue:"#b6d9fb",indigo:"#d1c2f0",purple:"#e3baf8",magenta:"#f9c8e0",black:"#353535","dark-grey":"#8C8C8C",grey:"#D0D0D0","light-grey":"#F0F0F0",white:"#ffffff"},M={red:"#d7170b",orange:"#fe8a2b",yellow:"#ffc02b",lime:"#63b215",green:"#21ba3a",teal:"#17cfcf",cyan:"#13a7ec",blue:"#0d80f2",indigo:"#63c",purple:"#a219e6",magenta:"#eb4799",black:"#000","dark-grey":"#666",grey:"#A6A6A6","light-grey":"#d4d5d2",white:"#ffffff"},S={Red:"red",Orange:"orange",Yellow:"yellow",LimeGreen:"lime",Green:"green",TealBlue:"teal",Blue:"blue",Violet:"indigo",Purple:"purple",Magenta:"magenta",Black:"black",Gray:"grey",White:"white"},L={Apricot:"#FBB982",Aquamarine:"#00B5BE",Bittersweet:"#C04F17",Black:"#221E1F",Blue:"#2D2F92",BlueGreen:"#00B3B8",BlueViolet:"#473992",BrickRed:"#B6321C",Brown:"#792500",BurntOrange:"#F7921D",CadetBlue:"#74729A",CarnationPink:"#F282B4",Cerulean:"#00A2E3",CornflowerBlue:"#41B0E4",Cyan:"#00AEEF",Dandelion:"#FDBC42",DarkOrchid:"#A4538A",Emerald:"#00A99D",ForestGreen:"#009B55",Fuchsia:"#8C368C",Goldenrod:"#FFDF42",Gray:"#949698",Green:"#00A64F",GreenYellow:"#DFE674",JungleGreen:"#00A99A",Lavender:"#F49EC4",Limegreen:"#8DC73E",Magenta:"#EC008C",Mahogany:"#A9341F",Maroon:"#AF3235",Melon:"#F89E7B",MidnightBlue:"#006795",Mulberry:"#A93C93",NavyBlue:"#006EB8",OliveGreen:"#3C8031",Orange:"#F58137",OrangeRed:"#ED135A",Orchid:"#AF72B0",Peach:"#F7965A",Periwinkle:"#7977B8",PineGreen:"#008B72",Plum:"#92268F",ProcessBlue:"#00B0F0",Purple:"#99479B",RawSienna:"#974006",Red:"#ED1B23",RedOrange:"#F26035",RedViolet:"#A1246B",Rhodamine:"#EF559F",RoyalBlue:"#0071BC",RoyalPurple:"#613F99",RubineRed:"#ED017D",Salmon:"#F69289",SeaGreen:"#3FBC9D",Sepia:"#671800",SkyBlue:"#46C5DD",SpringGreen:"#C6DC67",Tan:"#DA9D76",TealBlue:"#00AEB3",Thistle:"#D883B7",Turquoise:"#00B4CE",Violet:"#58429B",VioletRed:"#EF58A0",White:"#FFFFFF",WildStrawberry:"#EE2967",Yellow:"#FFF200",YellowGreen:"#98CC70",YellowOrange:"#FAA21A"};function C(e){var t,n,i,o,r,a;const s=e.split("!");let l,c,d,h=255,u=255,p=255,m=-1;const f=s.length>0&&s[0].startsWith("-");f&&(s[0]=s[0].slice(1));for(let e=0;e<s.length;e++){l=h,c=u,d=p;const f=null==(t=s[e].trim().match(/^([A-Za-z\d-]+)/))?void 0:t[1],g=null==f?void 0:f.toLowerCase(),b=f&&null!=(a=null!=(r=null!=(o=null!=(i=null!=(n=M[g])?n:M[S[f]])?i:_[f])?o:L[f])?r:w[f])?a:s[e].trim();let y=b.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if((null==y?void 0:y[1])&&y[2]&&y[3])h=Math.max(0,Math.min(255,Number.parseInt(y[1],16))),u=Math.max(0,Math.min(255,Number.parseInt(y[2],16))),p=Math.max(0,Math.min(255,Number.parseInt(y[3],16)));else if(y=b.match(/^#([\da-f]{3})$/i),null==y?void 0:y[1]){const e=Number.parseInt(y[1][0],16),t=Number.parseInt(y[1][1],16),n=Number.parseInt(y[1][2],16);h=Math.max(0,Math.min(255,16*e+e)),u=Math.max(0,Math.min(255,16*t+t)),p=Math.max(0,Math.min(255,16*n+n))}else{if(y=b.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),!((null==y?void 0:y[1])&&y[2]&&y[3]))return;h=Math.max(0,Math.min(255,Number.parseInt(y[1]))),u=Math.max(0,Math.min(255,Number.parseInt(y[2]))),p=Math.max(0,Math.min(255,Number.parseInt(y[3])))}m>=0&&(h=(1-m)*h+m*l,u=(1-m)*u+m*c,p=(1-m)*p+m*d,m=-1),e+1<s.length&&(m=Math.max(0,Math.min(100,Number.parseInt(s[++e])))/100)}return m>=0&&(h=m*h+(1-m)*l,u=m*u+(1-m)*c,p=m*p+(1-m)*d),f&&(h=255-h,u=255-u,p=255-p),"#"+("00"+Math.round(h).toString(16)).slice(-2)+("00"+Math.round(u).toString(16)).slice(-2)+("00"+Math.round(p).toString(16)).slice(-2)}function E(e){var t,n;return e=e.trim(),null!=(n=null!=(t=k[e.toLowerCase()])?t:k[S[e]])?n:C(e)}function K(e,t,n){return n<0&&(n+=6),n>=6&&(n-=6),n<1?(t-e)*n+e:n<3?t:n<4?(t-e)*(4-n)+e:e}function A(e){return e<0?0:e>255?255:Math.round(e)}function D(e){let t=function(e){if(!e)return;if("#"!==e[0])return;let t;return(e=e.slice(1)).length<=4?(t={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},4===e.length&&(t.a=parseInt(e[3]+e[3],16)/255)):(t={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},8===e.length&&(t.a=parseInt(e[6]+e[7],16)/255)),t&&void 0===t.a&&(t.a=1),t}(e);if(!t)return e;let{h:n,s:i,l:o}=function(e){let{r:t,g:n,b:i}=e;t/=255,n/=255,i/=255;const o=Math.min(t,n,i),r=Math.max(t,n,i),a=r-o;let s,l;r===o?s=0:t===r?s=(n-i)/a:n===r?s=2+(i-t)/a:i===r&&(s=4+(t-n)/a),s=Math.min(60*s,360),s<0&&(s+=360);const c=(o+r)/2;return l=r===o?0:c<=.5?a/(r+o):a/(2-r-o),{h:s,s:l,l:c}}(t);return i+=.1,o-=.1,function(e){const{r:t,g:n,b:i}=e;let o=((1<<24)+(A(t)<<16)+(A(n)<<8)+A(i)).toString(16).slice(1);return o[0]===o[1]&&o[2]===o[3]&&o[4]===o[5]&&o[6]===o[7]&&(o=o[0]+o[2]+o[4]),"#"+o}(function(e){let[t,n,i]=[e.h,e.s,e.l];t=(t+360)%360/60,i=Math.max(0,Math.min(i,1)),n=Math.max(0,Math.min(n,1));const o=i<=.5?i*(n+1):i+n-i*n,r=2*i-o;return{r:Math.round(255*K(r,o,t+2)),g:Math.round(255*K(r,o,t)),b:Math.round(255*K(r,o,t-2))}}({h:n,s:i,l:o}))}var z={60:"\\lt",62:"\\gt",111:"o",38:"\\&",123:"\\lbrace",125:"\\rbrace",91:"\\lbrack",93:"\\rbrack",58:"\\colon",160:"~",172:"\\neg",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",8224:"\\dagger",8225:"\\ddagger",8230:"\\ldots",8308:"^{4}",8309:"^{5}",8310:"^{6}",8311:"^{7}",8312:"^{8}",8313:"^{9}",8314:"^{+}",8315:"^{-}",8316:"^{=}",8319:"^{n}",8320:"_{0}",8321:"_{1}",8322:"_{2}",8323:"_{3}",8324:"_{4}",8325:"_{5}",8326:"_{6}",8327:"_{7}",8328:"_{8}",8329:"_{9}",8330:"_{+}",8331:"_{-}",8332:"_{=}",8336:"_{a}",8337:"_{e}",8338:"_{o}",8339:"_{x}",8242:"\\prime",39:"\\prime",8592:"\\gets",8594:"\\to",9651:"\\triangle",9661:"\\triangledown",8715:"\\owns",8727:"\\ast",8739:"\\vert",8741:"\\Vert",8743:"\\land",8744:"\\lor",8901:"\\cdot",8904:"\\bowtie",8800:"\\ne",8804:"\\le",8805:"\\ge",8869:"\\bot",10231:"\\biconditional",10232:"\\impliedby",10233:"\\implies",10234:"\\iff",8450:"\\mathbb{C}",8469:"\\mathbb{N}",8473:"\\mathbb{P}",8474:"\\mathbb{Q}",8477:"\\mathbb{R}",8484:"\\mathbb{Z}",8461:"\\mathbb{H}",8476:"\\Re",8465:"\\Im",42:"\\ast",11036:"\\square",9633:"\\square",8720:"\\coprod",8716:"\\not\\ni",9671:"\\diamond",8846:"\\uplus",8851:"\\sqcap",8852:"\\sqcup",8768:"\\wr",8750:"\\oint",8226:"\\textbullet",8722:"-",978:"\\Upsilon"},T={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},B=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{start:119964,len:26,offset:65,variant:"script"},{start:119990,len:26,offset:97,variant:"script"},{start:120016,len:26,offset:65,variant:"script",style:"bold"},{start:120042,len:26,offset:97,variant:"script",style:"bold"},{start:120068,len:26,offset:65,variant:"fraktur"},{start:120094,len:26,offset:97,variant:"fraktur"},{start:120172,len:26,offset:65,variant:"fraktur",style:"bold"},{start:120198,len:26,offset:97,variant:"fraktur",style:"bold"},{start:120120,len:26,offset:65,variant:"double-struck"},{start:120146,len:26,offset:97,variant:"double-struck"},{start:120224,len:26,offset:65,variant:"sans-serif"},{start:120250,len:26,offset:97,variant:"sans-serif"},{start:120276,len:26,offset:65,variant:"sans-serif",style:"bold"},{start:120302,len:26,offset:97,variant:"sans-serif",style:"bold"},{start:120328,len:26,offset:65,variant:"sans-serif",style:"italic"},{start:120354,len:26,offset:97,variant:"sans-serif",style:"italic"},{start:120380,len:26,offset:65,variant:"sans-serif",style:"bolditalic"},{start:120406,len:26,offset:97,variant:"sans-serif",style:"bolditalic"},{start:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,style:"bolditalic"},{start:120662,len:25,offset:913,variant:"sans-serif",style:"bold"},{start:120688,len:25,offset:945,variant:"sans-serif",style:"bold"},{start:120720,len:25,offset:913,variant:"sans-serif",style:"bolditalic"},{start:120746,len:25,offset:945,variant:"sans-serif",style:"bolditalic"},{start:120782,len:10,offset:48,variant:"main",style:"bold"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"},{start:120822,len:10,offset:48,variant:"monospace"}];function $(e,t,n){if(!/[A-Za-z\d]/.test(e))return e;if("up"===n&&(n=void 0),!t&&!n)return e;const i=e.codePointAt(0);if(void 0===i)return e;for(const e of B)if((!t||e.variant===t)&&(!n||e.style===n)&&i>=e.offset&&i<e.offset+e.len){const t=e.start+i-e.offset;return String.fromCodePoint(T[t]||t)}return e}function P(e){var t;if((e<119808||e>120831)&&(e<8448||e>8527))return{char:String.fromCodePoint(e)};for(const n in T)if(T[n]===e){e=null!=(t=n.codePointAt(0))?t:0;break}for(const t of B)if(e>=t.start&&e<t.start+t.len)return{char:String.fromCodePoint(e-t.start+t.offset),variant:t.variant,style:t.style};return{char:String.fromCodePoint(e)}}function O(e){return e?Array.isArray(e)?e:"object"==typeof e&&"group"in e?e.group:[]:[]}var q,N,I,F={},R=d({},z),V={},H={},W={iff:{primitive:!0,captureSelection:!0,def:"\\;⟺\\;"},nicefrac:"^{#1}\\!\\!/\\!_{#2}",phase:{def:"\\enclose{phasorangle}{#1}",args:1,captureSelection:!1},rd:"\\mathrm{d}",rD:"\\mathrm{D}",doubleStruckCapitalN:"\\mathbb{N}",doubleStruckCapitalR:"\\mathbb{R}",doubleStruckCapitalQ:"\\mathbb{Q}",doubleStruckCapitalZ:"\\mathbb{Z}",doubleStruckCapitalP:"\\mathbb{P}",scriptCapitalE:"\\mathscr{E}",scriptCapitalH:"\\mathscr{H}",scriptCapitalL:"\\mathscr{L}",gothicCapitalC:"\\mathfrak{C}",gothicCapitalH:"\\mathfrak{H}",gothicCapitalI:"\\mathfrak{I}",gothicCapitalR:"\\mathfrak{R}",imaginaryI:"\\mathrm{i}",imaginaryJ:"\\mathrm{j}",exponentialE:"\\mathrm{e}",differentialD:"\\mathrm{d}",capitalDifferentialD:"\\mathrm{D}",mathstrut:{def:"\\vphantom{(}",primitive:!0},angl:"\\enclose{actuarial}{#1}",angln:"\\enclose{actuarial}{n}",anglr:"\\enclose{actuarial}{r}",anglk:"\\enclose{actuarial}{k}",mathtools:{primitive:!0,package:{ordinarycolon:":",vcentcolon:"\\mathrel{\\mathop\\ordinarycolon}",dblcolon:'{\\mathop{\\char"2237}}',coloneqq:'{\\mathop{\\char"2254}}',Coloneqq:'{\\mathop{\\char"2237\\char"3D}}',coloneq:'{\\mathop{\\char"3A\\char"2212}}',Coloneq:'{\\mathop{\\char"2237\\char"2212}}',eqqcolon:'{\\mathop{\\char"2255}}',Eqqcolon:'{\\mathop{\\char"3D\\char"2237}}',eqcolon:'{\\mathop{\\char"2239}}',Eqcolon:'{\\mathop{\\char"2212\\char"2237}}',colonapprox:'{\\mathop{\\char"003A\\char"2248}}',Colonapprox:'{\\mathop{\\char"2237\\char"2248}}',colonsim:'{\\mathop{\\char"3A\\char"223C}}',Colonsim:'{\\mathop{\\char"2237\\char"223C}}',colondash:"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",Colondash:"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"}},ratio:"\\vcentcolon",coloncolon:"\\dblcolon",colonequals:"\\coloneq",coloncolonequals:"\\Coloneq",equalscolon:"\\eqcolon",equalscoloncolon:"\\Eqcolon",colonminus:"\\colondash",coloncolonminus:"\\Colondash",minuscolon:"\\dashcolon",minuscoloncolon:"\\Dashcolon",coloncolonapprox:"\\Colonapprox",coloncolonsim:"\\Colonsim",simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",simcoloncolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcoloncolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",notni:"\\mathrel{\\char`∌}",limsup:"\\operatorname*{lim\\,sup}",liminf:"\\operatorname*{lim\\,inf}",injlim:"\\operatorname*{inj\\,lim}",projlim:"\\operatorname*{proj\\,lim}",varlimsup:"\\operatorname*{\\overline{lim}}",varliminf:"\\operatorname*{\\underline{lim}}",varinjlim:"\\operatorname*{\\underrightarrow{lim}}",varprojlim:"\\operatorname*{\\underleftarrow{lim}}",argmin:"\\operatorname*{arg\\,min}",argmax:"\\operatorname*{arg\\,max}",plim:"\\mathop{\\operatorname{plim}}\\limits",tripledash:{def:"\\vphantom{-}\\raise{4mu}{\\mkern1.5mu\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2mu}}",expand:!0},"braket.sty":{package:{bra:{def:"\\mathinner{\\langle{#1}|}",args:1,captureSelection:!1},ket:{def:"\\mathinner{|{#1}\\rangle}",args:1,captureSelection:!1},braket:{def:"\\mathinner{\\langle{#1}\\rangle}",args:1,captureSelection:!1},set:{def:"\\mathinner{\\lbrace #1 \\rbrace}",args:1,captureSelection:!1},Bra:{def:"\\left\\langle #1\\right|",args:1,captureSelection:!1},Ket:{def:"\\left|#1\\right\\rangle",args:1,captureSelection:!1},Braket:{def:"\\left\\langle{#1}\\right\\rangle",args:1,captureSelection:!1},Set:{def:"\\left\\lbrace #1 \\right\\rbrace",args:1,captureSelection:!1}}},"amsmath.sty":{package:{varGamma:"\\mathit{\\Gamma}",varDelta:"\\mathit{\\Delta}",varTheta:"\\mathit{\\Theta}",varLambda:"\\mathit{\\Lambda}",varXi:"\\mathit{\\Xi}",varPi:"\\mathit{\\Pi}",varSigma:"\\mathit{\\Sigma}",varUpsilon:"\\mathit{\\Upsilon}",varPhi:"\\mathit{\\Phi}",varPsi:"\\mathit{\\Psi}",varOmega:"\\mathit{\\Omega}",pmod:{def:"\\quad(\\operatorname{mod}\\ #1)",args:1,expand:!1,captureSelection:!1},mod:{def:"\\quad\\operatorname{mod}\\,\\,#1",args:1,expand:!1},bmod:{def:"\\;\\mathbin{\\operatorname{mod }}",expand:!1}},primitive:!0},"texvc.sty":{package:{darr:"\\downarrow",dArr:"\\Downarrow",Darr:"\\Downarrow",lang:"\\langle",rang:"\\rangle",uarr:"\\uparrow",uArr:"\\Uparrow",Uarr:"\\Uparrow",N:"\\mathbb{N}",R:"\\mathbb{R}",Z:"\\mathbb{Z}",alef:"\\aleph",alefsym:"\\aleph",Alpha:"\\mathrm{A}",Beta:"\\mathrm{B}",bull:"\\bullet",Chi:"\\mathrm{X}",clubs:"\\clubsuit",cnums:"\\mathbb{C}",Complex:"\\mathbb{C}",Dagger:"\\ddagger",diamonds:"\\diamondsuit",empty:"\\emptyset",Epsilon:"\\mathrm{E}",Eta:"\\mathrm{H}",exist:"\\exists",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",Harr:"\\Leftrightarrow",hearts:"\\heartsuit",image:"\\Im",infin:"\\infty",Iota:"\\mathrm{I}",isin:"\\in",Kappa:"\\mathrm{K}",larr:"\\leftarrow",lArr:"\\Leftarrow",Larr:"\\Leftarrow",lrarr:"\\leftrightarrow",lrArr:"\\Leftrightarrow",Lrarr:"\\Leftrightarrow",Mu:"\\mathrm{M}",natnums:"\\mathbb{N}",Nu:"\\mathrm{N}",Omicron:"\\mathrm{O}",plusmn:"\\pm",rarr:"\\rightarrow",rArr:"\\Rightarrow",Rarr:"\\Rightarrow",real:"\\Re",reals:"\\mathbb{R}",Reals:"\\mathbb{R}",Rho:"\\mathrm{P}",sdot:"\\cdot",sect:"\\S",spades:"\\spadesuit",sub:"\\subset",sube:"\\subseteq",supe:"\\supseteq",Tau:"\\mathrm{T}",thetasym:"\\vartheta",weierp:"\\wp",Zeta:"\\mathrm{Z}"},primitive:!1}},j={" ":32,"\\!":33,"\\#":35,"\\$":36,"\\%":37,"\\&":38,"-":45,"\\textunderscore":95,"\\euro":8364,"\\maltese":10016,"\\{":123,"\\}":125,"\\textbraceleft":123,"\\textbraceright":125,"\\lbrace":123,"\\rbrace":125,"\\lbrack":91,"\\rbrack":93,"\\nobreakspace":160,"\\ldots":8230,"\\textellipsis":8230,"\\backslash":92,"`":8216,"'":8217,"``":8220,"''":8221,"\\degree":176,"\\textasciicircum":94,"\\textasciitilde":126,"\\textasteriskcentered":42,"\\textbackslash":92,"\\textbullet":8226,"\\textdollar":36,"\\textsterling":163,"\\textdagger":8224,"\\textdaggerdbl":8225,"–":8211,"—":8212,"‘":8216,"’":8217,"“":8220,"”":8221,'"':8221,"\\ss":223,"\\ae":230,"\\oe":339,"\\AE":198,"\\OE":338,"\\O":216,"\\i":305,"\\j":567,"\\aa":229,"\\AA":197},U=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/;function J(e,t,n="mord",i){void 0!==t&&(F[e]={definitionType:"symbol",type:n,variant:i,codepoint:t},R[t]||(R[t]=e))}function X(e,t,n){if("string"!=typeof e)for(const[i,o,r,a]of e)J(i,o,null!=r?r:t,null!=a?a:n);else for(let t=0;t<e.length;t++){const n=e.charAt(t);J(n,n.codePointAt(0))}}function G(e,t){for(let n=e;n<=t;n++)J(String.fromCodePoint(n),n)}function Z(e){let t="auto";const n=e.match(/:([^=]+)/);return n&&(t=n[1].trim()),t}function Y(e){if(!e)return[];const t=[];let n=e.split("]");if(n[0].startsWith("[")){t.push({isOptional:!0,type:Z(n[0].slice(1))});for(let e=1;e<=n.length;e++)t.push(...Y(n[e]))}else if(n=e.split("}"),n[0].startsWith("{")){t.push({isOptional:!1,type:Z(n[0].slice(1))});for(let e=1;e<=n.length;e++)t.push(...Y(n[e]))}return t}function Q(e){if(!e)return"";let t="",n=!0;for(const i of e)"string"==typeof i.value?t+=i.value:n=!1;return n?t:""}function ee(e,t){"string"==typeof e&&(e=[e]);const n={tabular:!1,params:[],createAtom:t};for(const t of e)H[t]=n}function te(e,t,n){"string"==typeof e&&(e=[e]);const i={tabular:!0,params:Y(t),createAtom:n};for(const t of e)H[t]=i}function ne(e,t,n){var i,o;n||(n={});const r={definitionType:"function",params:Y(t),ifMode:n.ifMode,isFunction:null!=(i=n.isFunction)&&i,applyMode:n.applyMode,infix:null!=(o=n.infix)&&o,parse:n.parse,createAtom:n.createAtom,applyStyle:n.applyStyle,serialize:n.serialize,render:n.render};if("string"==typeof e)V["\\"+e]=r;else for(const t of e)V["\\"+t]=r}function ie(e){return I||(I=re(W)),e?re(d(d({},I),e)):I}function oe(e,t){var n,i,o,r;if("string"==typeof e){let o=0;const r=e;return/(^|[^\\])#1/.test(r)&&(o=1),/(^|[^\\])#2/.test(r)&&(o=2),/(^|[^\\])#3/.test(r)&&(o=3),/(^|[^\\])#4/.test(r)&&(o=4),/(^|[^\\])#5/.test(r)&&(o=5),/(^|[^\\])#6/.test(r)&&(o=6),/(^|[^\\])#7/.test(r)&&(o=7),/(^|[^\\])#8/.test(r)&&(o=8),/(^|[^\\])#9/.test(r)&&(o=9),{expand:null==(n=null==t?void 0:t.expand)||n,captureSelection:null==(i=null==t?void 0:t.captureSelection)||i,args:o,def:r}}return d({expand:null==(o=null==t?void 0:t.expand)||o,captureSelection:null==(r=null==t?void 0:t.captureSelection)||r,args:0},e)}function re(e){if(!e)return{};const t={};for(const n of Object.keys(e)){const i=e[n];if(null==i)delete t[n];else if("object"==typeof i&&"package"in i)for(const e of Object.keys(i.package))t[e]=oe(i.package[e],{expand:!i.primitive,captureSelection:i.captureSelection});else t[n]=oe(i)}return t}function ae(e,t="math"){if(!e||0===e.length)return null;let n=null;if(e.startsWith("\\")){if(n=V[e],n)return n.ifMode&&n.ifMode!==t?null:n;"math"===t?n=F[e]:j[e]&&(n={definitionType:"symbol",type:"mord",codepoint:j[e]})}else if("math"===t){if(n=F[e],!n&&1===e.length){const t=le("math",e.codePointAt(0));return t.startsWith("\\")?h(d({},ae(t,"math")),{command:t}):null}}else j[e]?n={definitionType:"symbol",type:"mord",codepoint:j[e]}:"text"===t&&(n={definitionType:"symbol",type:"mord",codepoint:e.codePointAt(0)});return null!=n?n:null}function se(e,t){if(!e.startsWith("\\"))return null;return t[e.slice(1)]}function le(e,t){if(void 0===t)return"";if("math"===e&&R[t])return R[t];if("text"===e){const e=Object.keys(j).find((e=>j[e]===t));return e||String.fromCodePoint(t)}return String.fromCodePoint(t)}!function(){if(!f())return!0;if(/firefox/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/firefox\/(\d+)/i);if(!e)return!1;return parseInt(e[1])>=78}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/edg\/(\d+)/i);if(!e)return!1;return parseInt(e[1])>=79}return!0}()?(q=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,N=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/):(q=new RegExp("\\p{Letter}","u"),N=new RegExp("[0-9\\p{Letter}]","u"));var ce=[0,.68889,0,0,.72222],de=[0,.68889,0,0,.66667],he=[0,.68889,0,0,.77778],ue=[0,.68889,0,0,.61111],pe=[.16667,.68889,0,0,.77778],me=[0,.68889,0,0,.55556],fe=[0,0,0,0,.25],ge=[0,.825,0,0,2.33334],be=[0,.9,0,0,2.33334],ye=[0,.68889,0,0,.54028],ve=[-.03598,.46402,0,0,.5],xe=[-.13313,.36687,0,0,1],we=[.01354,.52239,0,0,1],_e=[.01354,.52239,0,0,1.11111],ke=[0,.54986,0,0,1],Me=[0,.69224,0,0,.5],Se=[0,.43056,0,0,1],Le=[.08198,.58198,0,0,.77778],Ce=[.19444,.69224,0,0,.41667],Ee=[.1808,.675,0,0,1],Ke=[.19444,.69224,0,0,.83334],Ae=[.13667,.63667,0,0,1],De=[-.064,.437,0,0,1.334],ze=[.08167,.58167,0,0,.77778],Te=[0,.69224,0,0,.72222],Be=[0,.69224,0,0,.66667],$e=[-.13313,.36687,0,0,.77778],Pe=[.06062,.54986,0,0,.77778],Oe=[0,.69224,0,0,.77778],qe=[.25583,.75583,0,0,.77778],Ne=[.25142,.75726,0,0,.77778],Ie=[.20576,.70576,0,0,.77778],Fe=[.30274,.79383,0,0,.77778],Re=[.22958,.72958,0,0,.77778],Ve=[.1808,.675,0,0,.77778],He=[.13667,.63667,0,0,.77778],We=[.13597,.63597,0,0,.77778],je=[.03517,.54986,0,0,.77778],Ue=[0,.675,0,0,.77778],Je=[.19444,.69224,0,0,.61111],Xe=[0,.54986,0,0,.76042],Ge=[0,.54986,0,0,.66667],Ze=[.0391,.5391,0,0,.77778],Ye=[.03517,.54986,0,0,1.33334],Qe=[.38569,.88569,0,0,.77778],et=[.23222,.74111,0,0,.77778],tt=[.19444,.69224,0,0,.77778],nt=[0,.37788,0,0,.5],it=[0,.54986,0,0,.72222],ot=[0,.69224,0,0,.83334],rt=[.11111,.69224,0,0,.66667],at=[.26167,.75726,0,0,.77778],st=[.48256,.98256,0,0,.77778],lt=[.28481,.79383,0,0,.77778],ct=[.08167,.58167,0,0,.22222],dt=[.08167,.58167,0,0,.38889],ht=[0,.43056,.04028,0,.66667],ut=[.41951,.91951,0,0,.77778],pt=[.24982,.74947,0,0,.38865],mt=[.08319,.58283,0,0,.75623],ft=[0,.10803,0,0,.27764],gt=[0,.47534,0,0,.50181],bt=[.18906,.47534,0,0,.50181],yt=[0,.69141,0,0,.50181],vt=[.24982,.74947,0,0,.27764],xt=[0,.69141,0,0,.21471],wt=[.25,.75,0,0,.44722],_t=[0,.64444,0,0,.575],kt=[.08556,.58556,0,0,.89444],Mt=[0,.69444,0,0,.89444],St=[0,.68611,0,0,.9],Lt=[0,.68611,0,0,.86944],Ct=[.25,.75,0,0,.575],Et=[.25,.75,0,0,.31944],Kt=[0,.69444,0,0,.63889],At=[0,.69444,0,0,.31944],Dt=[0,.44444,0,0,.63889],zt=[0,.44444,0,0,.51111],Tt=[0,.69444,0,0,.575],Bt=[.13333,.63333,0,0,.89444],$t=[0,.44444,0,0,.31944],Pt=[0,.69444,0,0,.86944],Ot=[0,.68611,0,0,.69166],qt=[0,.68611,0,0,.83055],Nt=[0,.68611,0,0,.89444],It=[0,.69444,0,0,.60278],Ft=[.19444,.69444,0,0,.51111],Rt=[0,.69444,0,0,.83055],Vt=[-.10889,.39111,0,0,1.14999],Ht=[.19444,.69444,0,0,.575],Wt=[.19444,.69444,0,0,1.14999],jt=[.19444,.69444,0,0,.70277],Ut=[.05556,.75,0,0,.575],Jt=[0,.68611,0,0,.95833],Xt=[.08556,.58556,0,0,.76666],Gt=[-.02639,.47361,0,0,.575],Zt=[0,.44444,0,0,.89444],Yt=[0,.55556,0,0,.76666],Qt=[-.10889,.39111,0,0,.89444],en=[.00222,.50222,0,0,.89444],tn=[.19667,.69667,0,0,.89444],nn=[.08556,.58556,0,0,1.14999],on=[0,.69444,0,0,.70277],rn=[-.02778,.47222,0,0,.575],an=[.25,.75,0,0,.51111],sn=[-.13889,.36111,0,0,1.14999],ln=[.19444,.69444,0,0,1.02222],cn=[.12963,.69444,0,0,.89444],dn=[.19444,.69444,0,0,.44722],hn=[0,.64444,.13167,0,.59111],un=[.19444,.64444,.13167,0,.59111],pn=[0,.68611,.17208,0,.8961],mn=[.19444,.44444,.105,0,.53222],fn=[0,.44444,.085,0,.82666],gn=[0,.69444,.06709,0,.59111],bn=[0,.69444,.12945,0,.35555],yn=[0,.69444,0,0,.94888],vn=[0,.69444,.11472,0,.59111],xn=[0,.68611,.10778,0,.88555],wn=[0,.69444,.07939,0,.62055],_n=[0,.69444,.12417,0,.30667],kn=[0,.64444,.13556,0,.51111],Mn=[.19444,.64444,.13556,0,.51111],Sn=[0,.68333,.16389,0,.74333],Ln=[.19444,.43056,.08847,0,.46],Cn=[0,.43056,.07514,0,.71555],En=[0,.69444,.06646,0,.51111],Kn=[0,.69444,0,0,.83129],An=[0,.69444,.1225,0,.51111],Dn=[0,.68333,.09403,0,.76666],zn=[0,.68333,.11111,0,.76666],Tn=[0,.69444,.06961,0,.51444],Bn=[0,.69444,0,0,.27778],$n=[.25,.75,0,0,.38889],Pn=[0,.64444,0,0,.5],On=[0,.69444,0,0,.77778],qn=[0,.68333,0,0,.75],Nn=[0,.68333,0,0,.77778],In=[0,.68333,0,0,.68056],Fn=[0,.68333,0,0,.72222],Rn=[.25,.75,0,0,.5],Vn=[.25,.75,0,0,.27778],Hn=[0,.69444,0,0,.5],Wn=[0,.69444,0,0,.55556],jn=[0,.43056,0,0,.44445],Un=[0,.43056,0,0,.5],Jn=[.19444,.43056,0,0,.55556],Xn=[0,.43056,0,0,.55556],Gn=[.08333,.58333,0,0,.77778],Zn=[0,.43056,0,0,.27778],Yn=[0,.66786,0,0,.27778],Qn=[0,.69444,0,0,.75],ei=[0,.66786,0,0,.5],ti=[0,.68333,0,0,.625],ni=[.19444,.69444,0,0,.44445],ii=[0,.69444,0,0,.72222],oi=[.19444,.69444,0,0,.5],ri=[.19444,.69444,0,0,1],ai=[.011,.511,0,0,1.126],si=[.19444,.69444,0,0,.61111],li=[.05556,.75,0,0,.5],ci=[0,.68333,0,0,.83334],di=[.0391,.5391,0,0,.66667],hi=[-.05555,.44445,0,0,.5],ui=[0,.43056,0,0,.77778],pi=[0,.55556,0,0,.66667],mi=[-.03625,.46375,0,0,.77778],fi=[-.01688,.48312,0,0,.77778],gi=[.0391,.5391,0,0,1],bi=[0,.69444,0,0,.61111],yi=[-.03472,.46528,0,0,.5],vi=[.25,.75,0,0,.44445],xi=[-.14236,.35764,0,0,1],wi=[.244,.744,0,0,.412],_i=[.19444,.69444,0,0,.88889],ki=[.12963,.69444,0,0,.77778],Mi=[.19444,.69444,0,0,.38889],Si=[.011,.511,0,0,1.638],Li=[.19444,.69444,0,0,0],Ci=[0,.44444,0,0,.575],Ei=[.19444,.44444,0,0,.575],Ki=[0,.68611,0,0,.75555],Ai=[0,.69444,0,0,.66759],Di=[0,.68611,0,0,.80555],zi=[0,.68611,.08229,0,.98229],Ti=[0,.68611,0,0,.76666],Bi=[0,.44444,0,0,.58472],$i=[.19444,.44444,0,0,.6118],Pi=[.19444,.43056,0,0,.5],Oi=[0,.68333,.02778,.08334,.76278],qi=[0,.68333,.08125,.05556,.83125],Ni=[0,.43056,0,.05556,.48472],Ii=[.19444,.43056,0,.08334,.51702],Fi=[.25,.75,0,0,.42778],Ri=[0,.69444,0,0,.55],Vi=[0,.69444,0,0,.73334],Hi=[0,.69444,0,0,.79445],Wi=[0,.69444,0,0,.51945],ji=[0,.69444,0,0,.70278],Ui=[0,.69444,0,0,.76389],Ji=[.25,.75,0,0,.34306],Xi=[0,.69444,0,0,.56111],Gi=[0,.69444,0,0,.25556],Zi=[.19444,.45833,0,0,.56111],Yi=[0,.45833,0,0,.56111],Qi=[0,.69444,0,0,.30556],eo=[0,.69444,0,0,.58056],to=[0,.69444,0,0,.67223],no=[0,.69444,0,0,.85556],io=[0,.69444,0,0,.55834],oo=[0,.65556,.11156,0,.5],ro=[0,.69444,.08094,0,.70834],ao=[.17014,0,0,0,.44445],so=[0,.69444,.0799,0,.5],lo=[0,.69444,0,0,.73752],co=[0,.69444,.09205,0,.5],ho=[0,.69444,.09031,0,.77778],uo=[0,.69444,.07816,0,.27778],po=[0,.69444,.00316,0,.5],mo=[.19444,.69444,0,0,.83334],fo=[.05556,.75,0,0,.83334],go=[0,.75,0,0,.5],bo=[.125,.08333,0,0,.27778],yo=[0,.08333,0,0,.27778],vo=[0,.65556,0,0,.5],xo=[0,.69444,0,0,.47222],wo=[0,.69444,0,0,.66667],_o=[0,.69444,0,0,.59722],ko=[0,.69444,0,0,.54167],Mo=[0,.69444,0,0,.70834],So=[.25,.75,0,0,.28889],Lo=[0,.69444,0,0,.51667],Co=[0,.44444,0,0,.44445],Eo=[.19444,.44444,0,0,.51667],Ko=[0,.44444,0,0,.38333],Ao=[0,.44444,0,0,.51667],Do=[0,.69444,0,0,.83334],zo=[.35001,.85,0,0,.45834],To=[.35001,.85,0,0,.57778],Bo=[.35001,.85,0,0,.41667],$o=[.35001,.85,0,0,.58334],Po=[0,.72222,0,0,.55556],Oo=[1e-5,.6,0,0,.66667],qo=[1e-5,.6,0,0,.77778],No=[.25001,.75,0,0,.94445],Io=[.306,.805,.19445,0,.47222],Fo=[.30612,.805,.19445,0,.47222],Ro=[.25001,.75,0,0,.83334],Vo=[.35001,.85,0,0,.47222],Ho=[.25001,.75,0,0,1.11111],Wo=[.65002,1.15,0,0,.59722],jo=[.65002,1.15,0,0,.81111],Uo=[.65002,1.15,0,0,.47222],Jo=[.65002,1.15,0,0,.66667],Xo=[0,.75,0,0,1],Go=[.55001,1.05,0,0,1.27778],Zo=[.862,1.36,.44445,0,.55556],Yo=[.86225,1.36,.44445,0,.55556],Qo=[.55001,1.05,0,0,1.11111],er=[.65002,1.15,0,0,.52778],tr=[.65002,1.15,0,0,.61111],nr=[.55001,1.05,0,0,1.51112],ir=[.95003,1.45,0,0,.73611],or=[.95003,1.45,0,0,1.04445],rr=[.95003,1.45,0,0,.52778],ar=[.95003,1.45,0,0,.75],sr=[0,.75,0,0,1.44445],lr=[.95003,1.45,0,0,.58334],cr=[1.25003,1.75,0,0,.79167],dr=[1.25003,1.75,0,0,1.27778],hr=[1.25003,1.75,0,0,.58334],ur=[1.25003,1.75,0,0,.80556],pr=[0,.825,0,0,1.8889],mr=[1.25003,1.75,0,0,.63889],fr=[.64502,1.155,0,0,.875],gr=[1e-5,.6,0,0,.875],br=[-99e-5,.601,0,0,.66667],yr=[.64502,1.155,0,0,.66667],vr=[1e-5,.9,0,0,.88889],xr=[.65002,1.15,0,0,.88889],wr=[.90001,0,0,0,.88889],_r=[-.00499,.605,0,0,1.05556],kr=[0,.12,0,0,.45],Mr=[0,.61111,0,0,.525],Sr=[.08333,.69444,0,0,.525],Lr=[-.08056,.53055,0,0,.525],Cr=[-.05556,.55556,0,0,.525],Er=[0,.43056,0,0,.525],Kr=[.22222,.43056,0,0,.525],Ar=[0,0,0,0,.525],Dr={"AMS-Regular":{32:fe,65:ce,66:de,67:ce,68:ce,69:de,70:ue,71:he,72:he,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:he,76:de,77:[0,.68889,0,0,.94445],78:ce,79:pe,80:ue,81:pe,82:ce,83:me,84:de,85:ce,86:ce,87:[0,.68889,0,0,1],88:ce,89:ce,90:de,107:me,160:fe,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:me,295:ye,710:ge,732:be,770:ge,771:be,989:ze,1008:ht,8245:[0,.54986,0,0,.275],8463:ye,8487:ce,8498:me,8502:de,8503:[0,.68889,0,0,.44445],8504:de,8513:[0,.68889,0,0,.63889],8592:ve,8594:ve,8602:xe,8603:xe,8606:we,8608:we,8610:_e,8611:_e,8619:ke,8620:ke,8621:[-.13313,.37788,0,0,1.38889],8622:xe,8624:Me,8625:Me,8630:Se,8631:Se,8634:Le,8635:Le,8638:Ce,8639:Ce,8642:Ce,8643:Ce,8644:Ee,8646:Ee,8647:Ee,8648:Ke,8649:Ee,8650:Ke,8651:we,8652:we,8653:xe,8654:xe,8655:xe,8666:Ae,8667:Ae,8669:[-.13313,.37788,0,0,1],8672:De,8674:De,8705:[0,.825,0,0,.5],8708:me,8709:ze,8717:[0,.43056,0,0,.42917],8722:ve,8724:[.08198,.69224,0,0,.77778],8726:ze,8733:Oe,8736:Te,8737:Te,8738:[.03517,.52239,0,0,.72222],8739:ct,8740:[.25142,.74111,0,0,.27778],8741:dt,8742:[.25142,.74111,0,0,.5],8756:Be,8757:Be,8764:$e,8765:[-.13313,.37788,0,0,.77778],8769:$e,8770:mi,8774:Fe,8776:fi,8778:ze,8782:Pe,8783:Pe,8785:Le,8786:Le,8787:Le,8790:Oe,8791:Re,8796:[.08198,.91667,0,0,.77778],8806:qe,8807:qe,8808:Ne,8809:Ne,8812:[.25583,.75583,0,0,.5],8814:Ie,8815:Ie,8816:Fe,8817:Fe,8818:Re,8819:Re,8822:Ve,8823:Ve,8828:He,8829:He,8830:Re,8831:Re,8832:Ie,8833:Ie,8840:Fe,8841:Fe,8842:We,8843:We,8847:je,8848:je,8858:Le,8859:Le,8861:Le,8862:Ue,8863:Ue,8864:Ue,8865:Ue,8872:[0,.69224,0,0,.61111],8873:Te,8874:[0,.69224,0,0,.88889],8876:ue,8877:ue,8878:ce,8879:ce,8882:je,8883:je,8884:He,8885:He,8888:[0,.54986,0,0,1.11111],8890:Jn,8891:Je,8892:Je,8901:[0,.54986,0,0,.27778],8903:ze,8905:ze,8906:ze,8907:Oe,8908:Oe,8909:[-.03598,.46402,0,0,.77778],8910:Xe,8911:Xe,8912:je,8913:je,8914:Ge,8915:Ge,8916:Be,8918:Ze,8919:Ze,8920:Ye,8921:Ye,8922:Qe,8923:Qe,8926:He,8927:He,8928:Fe,8929:Fe,8934:et,8935:et,8936:et,8937:et,8938:Ie,8939:Ie,8940:Fe,8941:Fe,8994:tt,8995:tt,9416:[.15559,.69224,0,0,.90222],9484:Me,9488:Me,9492:nt,9496:nt,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:Ue,9633:Ue,9650:it,9651:it,9654:je,9660:it,9661:it,9664:je,9674:rt,9733:[.19444,.69224,0,0,.94445],10003:ot,10016:ot,10731:rt,10846:[.19444,.75583,0,0,.61111],10877:He,10878:He,10885:qe,10886:qe,10887:We,10888:We,10889:at,10890:at,10891:st,10892:st,10901:He,10902:He,10933:Ne,10934:Ne,10935:at,10936:at,10937:at,10938:at,10949:qe,10950:qe,10955:lt,10956:lt,57350:ct,57351:dt,57352:ze,57353:ht,57356:Ne,57357:Ne,57358:ut,57359:Fe,57360:Fe,57361:ut,57366:Ne,57367:Ne,57368:Ne,57369:Ne,57370:We,57371:We},"Caligraphic-Regular":{32:fe,65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:fe},"Fraktur-Regular":{32:fe,33:[0,.69141,0,0,.29574],34:xt,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:pt,41:pt,42:[0,.62119,0,0,.27764],43:mt,44:ft,45:mt,46:ft,47:[.24982,.74947,0,0,.50181],48:gt,49:gt,50:gt,51:bt,52:bt,53:bt,54:yt,55:bt,56:yt,57:bt,58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:vt,93:vt,94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:fe,8216:xt,8217:xt,58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:fe,33:[0,.69444,0,0,.35],34:It,35:[.19444,.69444,0,0,.95833],36:Ut,37:[.05556,.75,0,0,.95833],38:Mt,39:At,40:wt,41:wt,42:[0,.75,0,0,.575],43:Bt,44:[.19444,.15556,0,0,.31944],45:Ko,46:[0,.15556,0,0,.31944],47:Ct,48:_t,49:_t,50:_t,51:_t,52:_t,53:_t,54:_t,55:_t,56:_t,57:_t,58:$t,59:[.19444,.44444,0,0,.31944],60:kt,61:Qt,62:kt,63:[0,.69444,0,0,.54305],64:Mt,65:Lt,66:[0,.68611,0,0,.81805],67:qt,68:[0,.68611,0,0,.88194],69:Ki,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:St,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:Ot,77:[0,.68611,0,0,1.09166],78:St,79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:Lt,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:Et,92:Ct,93:Et,94:Tt,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:Kt,99:zt,100:Kt,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:Kt,105:At,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:At,109:[0,.44444,0,0,.95833],110:Dt,111:Ci,112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:Dt,118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:zt,123:Ct,124:Et,125:Ct,126:[.35,.34444,0,0,.575],160:fe,163:[0,.69444,0,0,.86853],168:Tt,172:[0,.44444,0,0,.76666],176:Pt,177:Bt,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:Bt,216:[.04861,.73472,0,0,.89444],223:_o,230:[0,.44444,0,0,.83055],247:Bt,248:[.09722,.54167,0,0,.575],305:$t,338:[0,.68611,0,0,1.16944],339:Zt,567:[.19444,.44444,0,0,.35139],710:Tt,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:Tt,715:Tt,728:Tt,729:At,730:Pt,732:Tt,733:Tt,915:Ot,916:Jt,920:Nt,923:Di,926:Ti,928:St,931:qt,933:Nt,934:qt,936:Nt,937:qt,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:At,8217:At,8220:It,8221:It,8224:Ft,8225:Ft,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:Ai,8465:Rt,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:Rt,8501:on,8592:Vt,8593:Ht,8594:Vt,8595:Ht,8596:Vt,8597:Ct,8598:Wt,8599:Wt,8600:Wt,8601:Wt,8636:Vt,8637:Vt,8640:Vt,8641:Vt,8656:Vt,8657:jt,8658:Vt,8659:jt,8660:Vt,8661:[.25,.75,0,0,.70277],8704:Kt,8706:[0,.69444,.06389,0,.62847],8707:Kt,8709:Ut,8711:Jt,8712:Xt,8715:Xt,8722:Bt,8723:Bt,8725:Ct,8726:Ct,8727:rn,8728:Gt,8729:Gt,8730:[.18,.82,0,0,.95833],8733:Zt,8734:[0,.44444,0,0,1.14999],8736:Te,8739:Et,8741:Ct,8743:Yt,8744:Yt,8745:Yt,8746:Yt,8747:[.19444,.69444,.12778,0,.56875],8764:Qt,8768:[.19444,.69444,0,0,.31944],8771:en,8776:[.02444,.52444,0,0,.89444],8781:en,8801:en,8804:tn,8805:tn,8810:nn,8811:nn,8826:kt,8827:kt,8834:kt,8835:kt,8838:tn,8839:tn,8846:Yt,8849:tn,8850:tn,8851:Yt,8852:Yt,8853:Bt,8854:Bt,8855:Bt,8856:Bt,8857:Bt,8866:on,8867:on,8868:Mt,8869:Mt,8900:Gt,8901:[-.02639,.47361,0,0,.31944],8902:rn,8968:an,8969:an,8970:an,8971:an,8994:sn,8995:sn,9651:ln,9657:rn,9661:ln,9667:rn,9711:Wt,9824:cn,9825:cn,9826:cn,9827:cn,9837:[0,.75,0,0,.44722],9838:dn,9839:dn,10216:wt,10217:wt,10815:St,10927:tn,10928:tn,57376:Li},"Main-BoldItalic":{32:fe,33:[0,.69444,.11417,0,.38611],34:wn,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:bn,40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:hn,49:hn,50:hn,51:hn,52:un,53:hn,54:hn,55:un,56:hn,57:hn,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:vn,64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:pn,73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:pn,79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:gn,95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:mn,104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:mn,114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:fe,168:[0,.69444,.11473,0,.59111],176:yn,184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:fn,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:fn,567:[.19444,.44444,.04611,0,.385],710:gn,711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:bn,730:yn,732:vn,733:vn,915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:pn,931:[0,.68611,.11431,0,.82666],933:xn,934:[0,.68611,.05632,0,.82666],936:xn,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:bn,8217:bn,8220:[0,.69444,.16772,0,.62055],8221:wn},"Main-Italic":{32:fe,33:_n,34:Tn,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:_n,40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:kn,49:kn,50:kn,51:kn,52:Mn,53:kn,54:kn,55:Mn,56:kn,57:kn,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:An,64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:Sn,73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:Sn,79:Dn,80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:Sn,86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:En,95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:Ln,104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:Ln,114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:fe,168:[0,.66786,.10474,0,.51111],176:Kn,184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:Cn,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:Cn,710:En,711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:Kn,732:[0,.66786,.11585,0,.51111],733:An,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:Dn,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:Sn,931:[0,.68333,.12028,0,.71555],933:zn,934:[0,.68333,.05986,0,.71555],936:zn,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:_n,8217:_n,8220:[0,.69444,.1685,0,.51444],8221:Tn,8463:ye},"Main-Regular":{32:fe,33:Bn,34:Hn,35:mo,36:li,37:fo,38:On,39:Bn,40:$n,41:$n,42:go,43:Gn,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:Rn,48:Pn,49:Pn,50:Pn,51:Pn,52:Pn,53:Pn,54:Pn,55:Pn,56:Pn,57:Pn,58:Zn,59:[.19444,.43056,0,0,.27778],60:Ze,61:$e,62:Ze,63:xo,64:On,65:qn,66:[0,.68333,0,0,.70834],67:Fn,68:[0,.68333,0,0,.76389],69:In,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:qn,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:Nn,76:ti,77:[0,.68333,0,0,.91667],78:qn,79:Nn,80:In,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:Fn,85:qn,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:qn,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:Vn,92:Rn,93:Vn,94:Hn,95:[.31,.12056,.02778,0,.5],97:Un,98:Wn,99:jn,100:Wn,101:jn,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:Wn,105:Yn,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:Bn,109:[0,.43056,0,0,.83334],110:Xn,111:Un,112:Jn,113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:Xn,118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:jn,123:Rn,124:Vn,125:Rn,126:[.35,.31786,0,0,.5],160:fe,163:[0,.69444,0,0,.76909],167:ni,168:ei,172:[0,.43056,0,0,.66667],176:Qn,177:Gn,182:si,184:ao,198:[0,.68333,0,0,.90278],215:Gn,216:[.04861,.73194,0,0,.77778],223:Hn,230:[0,.43056,0,0,.72222],247:Gn,248:[.09722,.52778,0,0,.5],305:Zn,338:[0,.68333,0,0,1.01389],339:ui,567:[.19444,.43056,0,0,.30556],710:Hn,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:Hn,715:Hn,728:Hn,729:Yn,730:Qn,732:ei,733:Hn,915:ti,916:ci,920:Nn,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:qn,931:Fn,933:Nn,934:Fn,936:Nn,937:Fn,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:Bn,8217:Bn,8220:Hn,8221:Hn,8224:ni,8225:ni,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:ye,8465:ii,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:ii,8501:bi,8592:xe,8593:oi,8594:xe,8595:oi,8596:xe,8597:Rn,8598:ri,8599:ri,8600:ri,8601:ri,8614:[.011,.511,0,0,1],8617:ai,8618:ai,8636:xe,8637:xe,8640:xe,8641:xe,8652:[.011,.671,0,0,1],8656:xe,8657:si,8658:xe,8659:si,8660:xe,8661:[.25,.75,0,0,.61111],8704:Wn,8706:[0,.69444,.05556,.08334,.5309],8707:Wn,8709:li,8711:ci,8712:di,8715:di,8722:Gn,8723:Gn,8725:Rn,8726:Rn,8727:yi,8728:hi,8729:hi,8730:[.2,.8,0,0,.83334],8733:ui,8734:Se,8736:Te,8739:Vn,8741:Rn,8743:pi,8744:pi,8745:pi,8746:pi,8747:[.19444,.69444,.11111,0,.41667],8764:$e,8768:[.19444,.69444,0,0,.27778],8771:mi,8773:[-.022,.589,0,0,1],8776:fi,8781:mi,8784:[-.133,.67,0,0,.778],8801:mi,8804:We,8805:We,8810:gi,8811:gi,8826:Ze,8827:Ze,8834:Ze,8835:Ze,8838:We,8839:We,8846:pi,8849:We,8850:We,8851:pi,8852:pi,8853:Gn,8854:Gn,8855:Gn,8856:Gn,8857:Gn,8866:bi,8867:bi,8868:On,8869:On,8872:[.249,.75,0,0,.867],8900:hi,8901:[-.05555,.44445,0,0,.27778],8902:yi,8904:[.005,.505,0,0,.9],8942:[.03,.9,0,0,.278],8943:[-.19,.31,0,0,1.172],8945:[-.1,.82,0,0,1.282],8968:vi,8969:vi,8970:vi,8971:vi,8994:xi,8995:xi,9136:wi,9137:wi,9651:_i,9657:yi,9661:_i,9667:yi,9711:ri,9824:ki,9825:ki,9826:ki,9827:ki,9837:[0,.75,0,0,.38889],9838:Mi,9839:Mi,10216:$n,10217:$n,10222:wi,10223:wi,10229:[.011,.511,0,0,1.609],10230:Si,10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:Si,10815:qn,10927:We,10928:We,57376:Li},"Math-BoldItalic":{32:fe,48:Ci,49:Ci,50:Ci,51:Ei,52:Ei,53:Ei,54:_t,55:Ei,56:_t,57:Ei,65:Lt,66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:zi,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:Ki,77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:Ai,105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:Bi,112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:fe,915:[0,.68611,.15972,0,.65694],916:Jt,920:[0,.68611,.03194,0,.86722],923:Di,926:[0,.68611,.07458,0,.84125],928:zi,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:Ti,936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:Bi,960:[0,.44444,.03704,0,.68241],961:$i,962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:$i,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:fe,48:Un,49:Un,50:Un,51:Pi,52:Pi,53:Pi,54:Pn,55:Pi,56:Pn,57:Pi,65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:qi,73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:Oi,80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:Ni,112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:fe,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:Oi,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:qi,931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:Ni,960:[0,.43056,.03588,0,.57003],961:Ii,962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:Ii,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:fe,33:[0,.69444,0,0,.36667],34:io,35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:Qi,40:Fi,41:Fi,42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:Ri,49:Ri,50:Ri,51:Ri,52:Ri,53:Ri,54:Ri,55:Ri,56:Ri,57:Ri,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:Wi,64:Vi,65:Vi,66:Vi,67:ji,68:Hi,69:[0,.69444,0,0,.64167],70:bi,71:Vi,72:Hi,73:[0,.69444,0,0,.33056],74:Wi,75:Ui,76:eo,77:[0,.69444,0,0,.97778],78:Hi,79:Hi,80:ji,81:[.10556,.69444,0,0,.79445],82:ji,83:bi,84:Vi,85:Ui,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:Vi,89:[0,.69444,.0275,0,.73334],90:to,91:Ji,93:Ji,94:Ri,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:Xi,99:[0,.45833,0,0,.48889],100:Xi,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:Xi,105:Gi,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:Gi,109:[0,.45833,0,0,.86667],110:Yi,111:[0,.45833,0,0,.55],112:Zi,113:Zi,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:Yi,118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:fe,168:Ri,176:Vi,180:Ri,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:Ri,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:Ri,729:Qi,730:Vi,732:Ri,733:Ri,915:eo,916:[0,.69444,0,0,.91667],920:no,923:to,926:Vi,928:Hi,931:Hi,933:no,934:Hi,936:no,937:Hi,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:Qi,8217:Qi,8220:io,8221:io},"SansSerif-Italic":{32:fe,33:[0,.69444,.05733,0,.31945],34:po,35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:uo,40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:bo,45:[0,.44444,.01946,0,.33333],46:yo,47:[.25,.75,.13164,0,.5],48:oo,49:oo,50:oo,51:oo,52:oo,53:oo,54:oo,55:oo,56:oo,57:oo,58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:wo,66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:ro,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:ko,77:[0,.69444,.08094,0,.875],78:ro,79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:so,95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:fe,168:[0,.67937,.06385,0,.5],176:lo,184:ao,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:so,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:co,715:Hn,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:lo,732:[0,.67659,.08826,0,.5],733:co,915:[0,.69444,.13372,0,.54167],916:Do,920:[0,.69444,.07555,0,.77778],923:bi,926:[0,.69444,.12816,0,.66667],928:ro,931:[0,.69444,.11983,0,.72222],933:ho,934:[0,.69444,.04603,0,.72222],936:ho,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:uo,8217:uo,8220:[0,.69444,.14205,0,.5],8221:po},"SansSerif-Regular":{32:fe,33:[0,.69444,0,0,.31945],34:Hn,35:mo,36:li,37:fo,38:[0,.69444,0,0,.75834],39:Bn,40:$n,41:$n,42:go,43:Gn,44:bo,45:[0,.44444,0,0,.33333],46:yo,47:Rn,48:vo,49:vo,50:vo,51:vo,52:vo,53:vo,54:vo,55:vo,56:vo,57:vo,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:xo,64:wo,65:wo,66:wo,67:Kt,68:[0,.69444,0,0,.72223],69:_o,70:[0,.69444,0,0,.56945],71:wo,72:Mo,73:Bn,74:xo,75:[0,.69444,0,0,.69445],76:ko,77:[0,.69444,0,0,.875],78:Mo,79:[0,.69444,0,0,.73611],80:Kt,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:Wn,84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:wo,89:[0,.69444,.025,0,.66667],90:bi,91:So,93:So,94:Hn,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:Lo,99:Co,100:Lo,101:Co,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:Lo,105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:Ao,111:[0,.44444,0,0,.5],112:Eo,113:Eo,114:[0,.44444,.01389,0,.34167],115:Ko,116:[0,.57143,0,0,.36111],117:Ao,118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:fe,168:[0,.67937,0,0,.5],176:wo,184:ao,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:Hn,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:Hn,715:Hn,728:Hn,729:[0,.67937,0,0,.27778],730:wo,732:[0,.67659,0,0,.5],733:Hn,915:ko,916:Do,920:On,923:bi,926:wo,928:Mo,931:ii,933:On,934:ii,936:On,937:ii,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:Bn,8217:Bn,8220:Hn,8221:Hn},"Script-Regular":{32:fe,65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:fe},"Size1-Regular":{32:fe,40:zo,41:zo,47:To,91:Bo,92:To,93:Bo,123:$o,125:$o,160:fe,710:Po,732:Po,770:Po,771:Po,8214:[-99e-5,.601,0,0,.77778],8593:Oo,8595:Oo,8657:qo,8659:qo,8719:No,8720:No,8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:Fo,8748:Io,8749:Io,8750:Fo,8896:Ro,8897:Ro,8898:Ro,8899:Ro,8968:Vo,8969:Vo,8970:Vo,8971:Vo,9168:br,10216:Vo,10217:Vo,10752:Ho,10753:Ho,10754:Ho,10756:Ro,10758:Ro},"Size2-Regular":{32:fe,40:Wo,41:Wo,47:jo,91:Uo,92:jo,93:Uo,123:Jo,125:Jo,160:fe,710:Xo,732:Xo,770:Xo,771:Xo,8719:Go,8720:Go,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:Yo,8748:Zo,8749:Zo,8750:Yo,8896:Qo,8897:Qo,8898:Qo,8899:Qo,8968:er,8969:er,8970:er,8971:er,10216:tr,10217:tr,10752:nr,10753:nr,10754:nr,10756:Qo,10758:Qo},"Size3-Regular":{32:fe,40:ir,41:ir,47:or,91:rr,92:or,93:rr,123:ar,125:ar,160:fe,710:sr,732:sr,770:sr,771:sr,8730:[.95003,1.45,0,0,1],8968:lr,8969:lr,8970:lr,8971:lr,10216:ar,10217:ar},"Size4-Regular":{32:fe,40:cr,41:cr,47:dr,91:hr,92:dr,93:hr,123:ur,125:ur,160:fe,710:pr,732:pr,770:pr,771:pr,8730:[1.25003,1.75,0,0,1],8968:mr,8969:mr,8970:mr,8971:mr,9115:fr,9116:gr,9117:fr,9118:fr,9119:gr,9120:fr,9121:yr,9122:br,9123:yr,9124:yr,9125:br,9126:yr,9127:vr,9128:xr,9129:wr,9130:[0,.3,0,0,.88889],9131:vr,9132:xr,9133:wr,9143:[.88502,.915,0,0,1.05556],10216:ur,10217:ur,57344:_r,57345:_r,57680:kr,57681:kr,57682:kr,57683:kr},"Typewriter-Regular":{32:Ar,33:Mr,34:Mr,35:Mr,36:Sr,37:Sr,38:Mr,39:Mr,40:Sr,41:Sr,42:[0,.52083,0,0,.525],43:Lr,44:[.13889,.125,0,0,.525],45:Lr,46:[0,.125,0,0,.525],47:Sr,48:Mr,49:Mr,50:Mr,51:Mr,52:Mr,53:Mr,54:Mr,55:Mr,56:Mr,57:Mr,58:Er,59:[.13889,.43056,0,0,.525],60:Cr,61:[-.19549,.41562,0,0,.525],62:Cr,63:Mr,64:Mr,65:Mr,66:Mr,67:Mr,68:Mr,69:Mr,70:Mr,71:Mr,72:Mr,73:Mr,74:Mr,75:Mr,76:Mr,77:Mr,78:Mr,79:Mr,80:Mr,81:[.13889,.61111,0,0,.525],82:Mr,83:Mr,84:Mr,85:Mr,86:Mr,87:Mr,88:Mr,89:Mr,90:Mr,91:Sr,92:Sr,93:Sr,94:Mr,95:[.09514,0,0,0,.525],96:Mr,97:Er,98:Mr,99:Er,100:Mr,101:Er,102:Mr,103:Kr,104:Mr,105:Mr,106:[.22222,.61111,0,0,.525],107:Mr,108:Mr,109:Er,110:Er,111:Er,112:Kr,113:Kr,114:Er,115:Er,116:[0,.55358,0,0,.525],117:Er,118:Er,119:Er,120:Er,121:Kr,122:Er,123:Sr,124:Sr,125:Sr,126:Mr,127:Mr,160:Ar,176:Mr,184:[.19445,0,0,0,.525],305:Er,567:Kr,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:Mr,715:Mr,728:Mr,730:Mr,770:Mr,771:Mr,776:Mr,915:Mr,916:Mr,920:Mr,923:Mr,926:Mr,928:Mr,931:Mr,933:Mr,934:Mr,936:Mr,937:Mr,8216:Mr,8217:Mr,8242:Mr,9251:[.11111,.21944,0,0,.525]}},zr=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,Tr=10,Br=.25,$r=.431,Pr={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[$r,$r,$r],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.5,.732,.925],num2:[.394,.384,.5],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[Br,Br,Br],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04]},Or=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],qr={" ":" ","":" ","Å":"A","Ç":"C","Ð":"D","Þ":"o","å":"a","ç":"c","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function Nr(e,t){void 0===e&&(e=77);const n=Dr[t][e];if(n)return{defaultMetrics:!1,depth:n[0],height:n[1],italic:n[2],skew:n[3],width:n[4]};if(11034===e)return{defaultMetrics:!0,depth:.2,height:.8,italic:0,skew:0,width:.8};const i=String.fromCodePoint(e);if(i in qr)e=qr[i].codePointAt(0);else if(zr.test(i))return e=77,{defaultMetrics:!0,depth:.2,height:.9,italic:0,skew:0,width:1};return{defaultMetrics:!0,depth:.2,height:.7,italic:0,skew:0,width:.8}}var Ir={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],longrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],longleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],longleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],longrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],longleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],longleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],longRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716],longLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Fr={widehat1:[1062,239,.24],widehat2:[2364,300,.3],widehat3:[2364,360,.36],widehat4:[2364,420,.42],widecheck1:[1062,239,.24],widecheck2:[2364,300,.3],widecheck3:[2364,360,.36],widecheck4:[2364,420,.42],widetilde1:[600,260,.26],widetilde2:[1033,286,.286],widetilde3:[2339,306,.306],widetilde4:[2340,312,.34],overarc:[1061,159,.3],underarc:[1061,159,.3]},Rr={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",overarc:"M529 0c179 0 524 115 524 115 5 1 9 5 9 10 0 1-1 2-1 3l-4 22c-1 5-5 9-11 9h-2s-338-93-512-92c-174 0-513 92-513 92h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13 0 0 342-115 520-115z",underarc:"m 529 160\n c -179 0 -524 -115 -524 -115\n c -5 -1 -9 -5 -9 -10\n c 0 -1 1 -2 1 -3\n l 4 -22\n c 1 -5 5 -9 11 -9\n h 2\n s 338 93 512 92\n c 174 0 513 -92 513 -92\n h 2\n c 5 0 9 4 11 9\n l 5 22\n c 1 6 -2 12 -8 13\n c 0 0 -342 115 -520 115\n z\n ",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",widetilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",widetilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",widetilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",widetilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};var Vr,Hr=8205,Wr=[[Hr,1],[65038,2],[127995,5],[129456,4],[917536,96]],jr=[127462,127487];function Ur(e){var t;if(void 0===Vr){Vr={};for(const e of Wr)for(let t=e[0];t<=e[0]+e[1]-1;t++)Vr[t]=!0}return null!=(t=Vr[e])&&t}function Jr(e){return e>=jr[0]&&e<=jr[1]}function Xr(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;const t=[],n=function(e){const t=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(13===i&&10===e.charCodeAt(n+1)&&(i=10,n++),13!==i&&12!==i||(i=10),0===i&&(i=65533),i>=55296&&i<=56319){const t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(i=65536+1024*(i-55296)+(t-56320),n++)}t.push(i)}return t}(e);let i=0;for(;i<n.length;){const e=n[i++],o=n[i];if(o===Hr){const e=i-1;for(i+=2;n[i]===Hr;)i+=2;t.push(String.fromCodePoint(...n.slice(e,i-e+1)))}else if(Ur(o)){const e=i-1;for(;Ur(n[i]);)i+=n[i]===Hr?2:1;t.push(String.fromCodePoint(...n.slice(e,2*i-e-1)))}else Jr(e)?(i+=1,t.push(String.fromCodePoint(...n.slice(i-2,2)))):t.push(String.fromCodePoint(e))}return t}function Gr(e,t){var n,i,o,r;const a=[];let s=e.next();if(s)if("\\relax"===s);else if("\\noexpand"===s)s=e.next(),s&&a.push(s);else if("\\obeyspaces"===s)e.obeyspaces=!0;else if("\\bgroup"===s)a.push("<{>");else if("\\egroup"===s)a.push("<}>");else if("\\string"===s){if(s=e.next(),s)if(s.startsWith("\\"))for(const e of s)a.push("\\"===e?"\\backslash":e);else"<{>"===s?a.push("\\{"):"<space>"===s?a.push("~"):"<}>"===s&&a.push("\\}")}else if("\\csname"===s){for(;"<space>"===e.peek();)e.next();let o="",r=!1,l=[];do{if(0===l.length)if(/^#[\d?@]$/.test(e.peek())){const o=e.get().slice(1);l=Zr(null!=(i=null!=(n=null==t?void 0:t(o))?n:null==t?void 0:t("?"))?i:"\\placeholder{}",t),s=l[0]}else s=e.next(),l=s?[s]:[];r=0===l.length,r||"\\endcsname"!==s||(r=!0,l.shift()),r||(r="<$>"===s||"<$$>"===s||"<{>"===s||"<}>"===s||"string"==typeof s&&s.length>1&&s.startsWith("\\")),r||(o+=l.shift())}while(!r);o&&a.push("\\"+o),a.push(...l)}else if("\\endcsname"===s);else if(s.length>1&&s.startsWith("#")){const e=s.slice(1);a.push(...Zr(null!=(r=null!=(o=null==t?void 0:t(e))?o:null==t?void 0:t("?"))?r:"\\placeholder{}",t))}else a.push(s);return a}function Zr(e,t=null){const n=[];let i="";for(const t of e.toString().split(/\r?\n/)){i&&n.push(i),i=" ";const e=t.match(/((?:\\%)|[^%])*/);null!==e&&n.push(e[0])}const o=new class{constructor(e){this.obeyspaces=!1,this.pos=0,this.s=Xr(e)}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(e){const t="string"==typeof this.s?e.exec(this.s.slice(this.pos)):e.exec(this.s.slice(this.pos).join(""));return(null==t?void 0:t[0])?(this.pos+=t[0].length,t[0]):""}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]+/))return"<space>";if(this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]/))return"<space>";const e=this.get();if("\\"===e){if(!this.end()){let e=this.match(/^[a-zA-Z\*]+/);return e?this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/):e=this.get(),"\\"+e}}else{if("{"===e)return"<{>";if("}"===e)return"<}>";if("^"===e){if("^"===this.peek()){this.get();const e=this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);if(e)return String.fromCodePoint(Number.parseInt(e.slice(e.lastIndexOf("^")+1),16))}return e}if("#"===e){if(!this.end()){let e=!1;if(/[\d?@]/.test(this.peek())&&(e=!0,this.pos+1<this.s.length)){const t=this.s[this.pos+1];e=/[^\dA-Za-z]/.test(t)}return e?"#"+this.get():"#"}}else if("$"===e)return"$"===this.peek()?(this.get(),"<$$>"):"<$>"}return e}}(function(e){var t;let n="";for(const i of e){if("{}<>[]$&#^_%:'˜".includes(i)){n+=i;continue}const e=null!=(t=i.codePointAt(0))?t:0;let o=z[e];if(o)o.startsWith("\\")?n+=o+" ":n+=o;else{const{char:t,variant:i,style:r}=P(e);switch(o=t,i){case"double-struck":o=`\\mathbb{${o}}`;break;case"fraktur":o=`\\mathfrak{${o}}`;break;case"script":o=`\\mathscr{${o}}`;break;case"sans-serif":o=`\\mathsf{${o}}`;break;case"monospace":o=`\\mathtt{${o}}`;break;case"calligraphic":o=`\\mathcal{${o}}`}switch(r){case"bold":o=`\\mathbf{${o}}`;break;case"italic":o=`\\mathit{${o}}`;break;case"bolditalic":o=`\\mathbfit{${o}}`}n+=o}}return n}(n.join(""))),r=[];do{r.push(...Gr(o,t))}while(!o.end());return r}function Yr(e){let t="";const n=[];for(const i of e)i&&(t&&/^[a-zA-Z\*]/.test(i)&&n.push(t),n.push(i),/^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(i)&&n.push(" "),t=/\\[a-zA-Z]+\*?$/.test(i)?" ":"");return n.join("")}function Qr(e,...t){return console.assert(e.startsWith("\\")),0===t.length?e:Yr([e,...t.map((e=>`{${e}}`))])}function ea(e){return Yr(e.map((e=>{var t;return null!=(t={"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"}[e])?t:e})))}var ta=class e{constructor(t){e._registry[t]=this}static createAtom(t,n,i){return e._registry[t].createAtom(n,ae(n,t),i)}static serialize(t,n){var i;if(!t||0===t.length)return"";if(null!=(i=n.skipStyles)&&i){const i=[];for(const o of ia(t)){const t=e._registry[o[0].mode];i.push(...t.serialize(o,n))}return Yr(i)}return Yr(function(e,t){if(0===e.length)return[];const{parent:n}=e[0],i=null==n?void 0:n.computedStyle.fontSize,o=[];for(const r of oa(e,"fontSize")){const e=r[0].computedStyle.fontSize,a=aa(r,t);a&&(!e||"auto"===e||n&&i===e?o.push(...a):o.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][e],...a))}return o}(t,n))}static getFont(t,n,i){return e._registry[t].getFont(n,i)}};ta._registry={};var na=ta;function ia(e){const t=[];let n=[],i="NONE";for(const o of e)"first"!==o.type&&(o.mode!==i?(n.length>0&&t.push(n),n=[o],i=o.mode):n.push(o));return n.length>0&&t.push(n),t}function oa(e,t){const n=[];let i,o=[];for(const r of e)if("first"!==r.type&&r.style){let e;"variant"===t?(e=r.style.variant,r.style.variantStyle&&"up"!==r.style.variantStyle&&(e+="-"+r.style.variantStyle)):e=r.style[t],e===i?o.push(r):(o.length>0&&n.push(o),o=[r],i=e)}return o.length>0&&n.push(o),n}function ra(e,t){var n;const{parent:i}=e[0],o=null==i?void 0:i.computedStyle.color,r=[];for(const a of ia(e)){const e=t.defaultMode;for(const s of oa(a,"color")){const a=s[0].computedStyle,l=na._registry[s[0].mode].serialize(s,h(d({},t),{defaultMode:"text"===e?"text":"math"}));t.skipStyles||!a.color||"none"===a.color||i&&o===a.color?r.push(Yr(l)):r.push(Qr("\\textcolor",null!=(n=a.verbatimColor)?n:a.color,Yr(l)))}}return r}function aa(e,t){const{parent:n}=e[0],i=null==n?void 0:n.computedStyle.backgroundColor;return oa(e,"backgroundColor").map((e=>{var o;if(e.length>0||"box"!==e[0].type){const r=e[0].computedStyle;if(r.backgroundColor&&"none"!==r.backgroundColor&&(!n||i!==r.backgroundColor))return Qr("\\colorbox",null!=(o=r.verbatimBackgroundColor)?o:r.backgroundColor,Yr(ra(e,h(d({},t),{defaultMode:"text"}))))}return Yr(ra(e,t))}))}function sa(e){if(!e)return;return{mord:"ord",mbin:"bin",mop:"op",mrel:"rel",mopen:"open",mclose:"close",mpunct:"punct",minner:"inner",spacing:"ignore",latex:"latex",composition:"inner",error:"inner",placeholder:"ord",supsub:"ignore"}[e]}function la(e){if(0===e.length)return"ord";const t=sa(e[0].type),n=sa(e[e.length-1].type);return t&&t===n?t:"ord"}function ca(e,t){if("string"==typeof e)return e;if("number"==typeof e){console.assert(Number.isFinite(e));const n=Math.ceil(100*e)/100;return 0===n?"0":n.toString()+(null!=t?t:"")}return""}var da=class e{constructor(t,n){var i,o,r,a,s;if("number"==typeof t?this.value=String.fromCodePoint(t):"string"==typeof t?this.value=t:m(t)?this.children=t.filter((e=>null!==e)):t&&t instanceof e&&(this.children=[t]),this.children)for(const e of this.children)e.parent=this;this.type=null!=(i=null==n?void 0:n.type)?i:"ignore",this.isSelected=!0===(null==n?void 0:n.isSelected),(null==n?void 0:n.caret)&&(this.caret=n.caret),this.classes=null!=(o=null==n?void 0:n.classes)?o:"",this.isTight=null!=(r=null==n?void 0:n.isTight)&&r,(null==n?void 0:n.attributes)&&(this.attributes=n.attributes);let l=null==n?void 0:n.fontFamily;(null==n?void 0:n.style)&&this.value&&(l=null!=(s=na.getFont(null!=(a=n.mode)?a:"math",this,h(d({variant:"normal"},n.style),{letterShapeStyle:n.letterShapeStyle})))?s:void 0),l||(l="Main-Regular"),this._height=0,this._depth=0,this._width=0,this.hasExplicitWidth=!1,this.skew=0,this.italic=0,this.maxFontSize=0,this.scale=1,void 0!==(null==n?void 0:n.maxFontSize)&&(this.maxFontSize=n.maxFontSize),function(e,t){var n;if("latex"===e.type)return e.height=.9,e.depth=.2,void(e._width=1);if(e.value){e.height=-1/0,e.depth=-1/0,e._width=0,e.skew=-1/0,e.italic=-1/0;for(let n=0;n<e.value.length;n++){const i=Nr(e.value.codePointAt(n),t);e.height=Math.max(e.height,i.height),e.depth=Math.max(e.depth,i.depth),e._width+=i.width,e.skew=i.skew,e.italic=i.italic}return}if(e.children&&e.children.length>0){let t=-1/0,i=-1/0,o=0;for(const r of e.children)r.height>t&&(t=r.height),r.depth>i&&(i=r.depth),o=Math.max(o,null!=(n=r.maxFontSize)?n:0);e.height=t,e.depth=i,e._width=e.children.reduce(((e,t)=>e+t.width),0),e.maxFontSize=o}}(this,l)}set atomID(e){void 0!==e&&0!==e.length&&(this.id=e)}selected(e){if(this.isSelected!==e&&(this.isSelected=e,this.children))for(const t of this.children)t.selected(e)}setStyle(e,t,n){if(void 0===t)return;const i=ca(t,n);i.length>0&&(this.cssProperties||(this.cssProperties={}),this.cssProperties[e]=i)}setTop(e){Number.isFinite(e)&&Math.abs(e)>.01&&(this.cssProperties||(this.cssProperties={}),this.cssProperties.top=ca(e,"em"),this.height-=e,this.depth+=e)}get left(){var e;return(null==(e=this.cssProperties)?void 0:e["margin-left"])?Number.parseFloat(this.cssProperties["margin-left"]):0}set left(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-left"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-left"]=ca(e,"em")))}set right(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-right"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-right"]=ca(e,"em")))}set bottom(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-bottom"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-bottom"]=ca(e,"em")))}get width(){return this._width*this.scale}set width(e){this._width=e,this.hasExplicitWidth=!0}set softWidth(e){}get height(){return this._height*this.scale}set height(e){this._height=e}get depth(){return this._depth*this.scale}set depth(e){this._depth=e}wrap(e){const t=e.parent;if(!t)return this;e.isPhantom&&this.setStyle("opacity",0);const n=e.color;n&&n!==t.color&&this.setStyle("color",n);let i=e.backgroundColor;this.isSelected&&(i=D(i)),i&&i!==t.backgroundColor&&(this.setStyle("background-color",i),this.setStyle("display","inline-block"));const o=e.scalingFactor;return this.scale=o,this.skew*=o,this.italic*=o,this}toMarkup(){var e,t,n,i;let o=null!=(e=this.value)?e:"";if(this.children)for(const e of this.children)o+=e.toMarkup();let r="";if(this.svgBody)r=function(e){if(Fr[e]){const[t,n,i]=Fr[e],o=`<span class="stretchy" style="height:${i}em"><svg width="100%" height="${i}em" viewBox="0 0 ${t} ${n}" preserveAspectRatio="none" ><path fill="currentcolor" d="${Rr[e]}"></path></svg></span>`;return`<span style="display:inline-block;height:${Math.floor(100*i/2)/100}em;min-width:0">${o}</span>`}const[t,n,i,o]=Ir[e];let r,a;const s=i/1e3;3===t.length?(r=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],a=["xMinYMin","xMidYMin","xMaxYMin"]):2===t.length?(r=["slice-1-of-2","slice-2-of-2"],a=["xMinYMin","xMaxYMin"]):(r=["slice-1-of-1"],a=[o]);const l=t.map(((e,t)=>`<span class="${r[t]}" style=height:${s}em><svg width=400em height=${s}em viewBox="0 0 400000 ${i}" preserveAspectRatio="${a[t]} slice"><path fill="currentcolor" d="${Rr[e]}"></path></svg></span>`)).join("");return`<span style="display:inline-block;height:${s}em;min-width:${n}em;">${l}</span>`}(this.svgBody);else if(this.svgOverlay){r='<span style="',r+="display: inline-block;",r+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`,r+=`vertical-align:${Math.floor(100*this.depth)/100}em;`,r+='">',r+=o,r+="</span>",r+='<svg style="position:absolute;overflow:visible;',r+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`;const e=null==(t=this.cssProperties)?void 0:t.padding;e?(r+=`top:${e};`,r+=`left:${e};`,r+=`width:calc(100% - 2 * ${e} );`):r+="top:0;left:0;width:100%;",r+="z-index:2;",r+='"',this.svgStyle&&(r+=this.svgStyle),r+=` viewBox="0 0 ${Math.floor(100*this.width)/100} ${Math.floor(100*(this.height+this.depth))/100}"`,r+=`>${this.svgOverlay}</svg>`}let a="";const s=this.classes.split(" ");s.push(null!=(n={latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"}[this.type])?n:""),"latex"===this.caret&&s.push("ML__latex-caret"),this.isSelected&&s.push("ML__selected");const l=1===s.length?s[0]:s.filter(((e,t,n)=>e.length>0&&n.indexOf(e)===t)).join(" ");if(l.length>0&&(a+=` class="${l}"`),this.id&&(a+=` data-atom-id=${this.id}`),this.cssId&&(a+=` id="${this.cssId.replace(/ /g,"-")}" `),this.attributes&&(a+=" "+Object.keys(this.attributes).map((e=>`${e}="${this.attributes[e]}"`)).join(" ")),this.htmlData){const e=this.htmlData.split(",");for(const t of e){const e=t.match(/([^=]+)=(.+$)/);if(e){const t=e[1].trim().replace(/ /g,"-");t&&(a+=` data-${t}="${e[2]}" `)}else{const e=t.trim().replace(/ /g,"-");e&&(a+=` data-${e} `)}}}const c=null!=(i=this.cssProperties)?i:{};this.hasExplicitWidth&&void 0===c.width&&(c.width=Math.ceil(100*this._width)/100+"em");const d=Object.keys(c).map((e=>`${e}:${c[e]}`));if(void 0!==this.scale&&1!==this.scale&&(o.length>0||r.length>0)&&d.push(`font-size: ${Math.ceil(1e4*this.scale)/100}%`),this.htmlStyle){const e=this.htmlStyle.split(";");let t="";for(const n of e){const e=n.match(/([^=]+):(.+$)/);if(e){const n=e[1].trim().replace(/ /g,"-");n&&(t+=`${n}:${e[2]};`)}}t&&(a+=` style="${t}"`)}d.length>0&&(a+=` style="${d.join(";")}"`);let h="";return h=a.length>0||r.length>0?`<span${a}>${o}${r}</span>`:o,"text"===this.caret?h+='<span class="ML__text-caret"></span>':"math"===this.caret&&(h+='<span class="ML__caret"></span>'),h}tryCoalesceWith(e){if(this.svgBody||!this.value)return!1;if(e.svgBody||!e.value)return!1;const t=this.children&&this.children.length>0,n=e.children&&e.children.length>0;if(t||n)return!1;if(e.cssProperties||this.cssProperties)for(const t of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"]){if(e.cssProperties&&t in e.cssProperties)return!1;if(this.cssProperties&&t in this.cssProperties)return!1}const i=this.cssProperties?Object.keys(this.cssProperties).length:0;if(i!==(e.cssProperties?Object.keys(e.cssProperties).length:0))return!1;if(i>0)for(const t of Object.keys(this.cssProperties))if(this.cssProperties[t]!==e.cssProperties[t])return!1;const o=this.classes.trim().replace(/\s+/g," ").split(" "),r=e.classes.trim().replace(/\s+/g," ").split(" ");if(o.length!==r.length)return!1;o.sort(),r.sort();for(const[e,t]of o.entries()){if("vertical-separator"===t)return!1;if(t!==r[e])return!1}return this.value+=e.value,this.height=Math.max(this.height,e.height),this.depth=Math.max(this.depth,e.depth),this._width=this._width+e._width,this.maxFontSize=Math.max(this.maxFontSize,e.maxFontSize),this.italic=e.italic,!0}};function ha(e){if(!e||0===e.length)return[];e[0].children=ha(e[0].children);const t=[e[0]];for(let n=1;n<e.length;n++)t[t.length-1].tryCoalesceWith(e[n])||(e[n].children=ha(e[n].children),t.push(e[n]));return t}function ua(e){return e.children&&(e.children=ha(e.children)),e}function pa(e,t){if(!e)return new da(null,t);const n=new da(null,{classes:"ML__strut",type:"ignore"});n.setStyle("height",Math.max(0,e.height),"em");const i=[n];if(0!==e.depth){const t=new da(null,{classes:"ML__strut--bottom",type:"ignore"});t.setStyle("height",e.height+e.depth,"em"),t.setStyle("vertical-align",-e.depth,"em"),i.push(t)}return i.push(e),new da(i,h(d({},t),{type:"lift"}))}function ma(e){const t=function(e){return Ir[e]?Ir[e][2]/1e3:Fr[e][2]}(e)/2,n=new da(null,{maxFontSize:0});return n.height=t+.166,n.depth=t-.166,n.svgBody=e,n}function fa(e){var t;const[n,i]=function(e){if("individualShift"in e){const t=e.individualShift;let n=t[0];const i=[n],o=-n.shift-n.box.depth;let r=o;for(let e=1;e<t.length;e++){const o=t[e],a=-o.shift-r-o.box.depth,s=a-(n.box.height+n.box.depth);r+=a,i.push(s),i.push(o),n=o}return[i,o]}if("top"in e){let t=e.top;for(const n of e.children)t-="number"==typeof n?n:n.box.height+n.box.depth;return[e.children,t]}if("bottom"in e)return[e.children,-e.bottom];if("firstBaseline"in e){const t=e.firstBaseline[0];if("number"==typeof t)throw new Error("First child must be an element.");return[e.firstBaseline,-t.box.depth]}if("shift"in e){const t=e.children[0];if("number"==typeof t)throw new Error("First child must be an element.");return[e.children,-t.box.depth-e.shift]}return[null,0]}(e);if(!n)return[[],0,0];const o=new da(null,{classes:"pstrut"});let r=0;for(const e of n)if("number"!=typeof e){const t=e.box;r=Math.max(r,t.maxFontSize,t.height)}r+=2,o.height=r,o.setStyle("height",r,"em");const a=[];let s=i,l=i,c=i,d=0;for(const e of n){if("number"==typeof e)c+=e;else{const n=e.box,i=null!=(t=e.classes)?t:[],s=new da([o,n],{classes:i.join(" "),style:e.style});n.setStyle("height",n.height+n.depth,"em"),n.setStyle("display","inline-block"),s.setStyle("top",-r-c-n.depth,"em"),e.marginLeft&&s.setStyle("margin-left",e.marginLeft,"em"),e.marginRight&&s.setStyle("margin-right",e.marginRight,"em"),a.push(s),c+=n.height+n.depth,d=Math.max(d,s.width)}s=Math.min(s,c),l=Math.max(l,c)}a.forEach((e=>{e.softWidth=d}));const h=new da(a,{classes:"vlist"});if(h.softWidth=d,h.height=l,h.setStyle("height",l,"em"),s>=0)return[[new da(h,{classes:"vlist-r"})],l,-s];const u=new da(new da(null),{classes:"vlist"});u.height=-s,u.setStyle("height",-s,"em");const p=new da(8203,{classes:"vlist-s",maxFontSize:0});return p.softWidth=0,p.height=0,p.depth=0,[[new da([h,p],{classes:"vlist-r"}),new da(u,{classes:"vlist-r"})],l,-s]}var ga=class extends da{constructor(e,t){var n;const[i,o,r]=fa(e);super(1===i.length?i[0]:i,{type:null==t?void 0:t.type,classes:(null!=(n=null==t?void 0:t.classes)?n:"")+" vlist-t"+(2===i.length?" vlist-t2":"")}),this.height=o,this.depth=r,this.softWidth=i.reduce(((e,t)=>Math.max(e,t.width)),0)}};var ba=class{constructor(e,t,n){this.id=e,this.sizeDelta=t,this.cramped=n;const i={"-4":2,"-3":1,0:0}[t];this.metrics=Object.keys(Pr).reduce(((e,t)=>h(d({},e),{[t]:Pr[t][i]})),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return va[[0,1,0,1,2,3,2,3][this.id]]}get sub(){return va[[0,0,0,0,2,2,2,2][this.id]]}get fracNum(){return va[[0,1,0,1,2,3,4,5][this.id]]}get fracDen(){return va[[0,0,0,0,2,2,4,4][this.id]]}get cramp(){return va[[0,0,2,2,4,4,6,6][this.id]]}get isTight(){return this.sizeDelta<0}},ya={7:new ba(7,0,!1),6:new ba(6,0,!0),5:new ba(5,0,!1),4:new ba(4,0,!0),3:new ba(3,-3,!1),2:new ba(2,-3,!0),1:new ba(1,-4,!1),0:new ba(0,-4,!0)},va=h(d({},ya),{displaystyle:ya[7],textstyle:ya[5],scriptstyle:ya[3],scriptscriptstyle:ya[1]});function xa(e,t){var n;if(!e)return 0;const i={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:3/4,em:Tr,bp:1.00375,dd:1238/1157,pc:12,in:72.27,mu:10/18}[null!=(n=e.unit)?n:"pt"];if(Number.isFinite(t)){const n=10**t;return Math.round(e.dimension/Tr*i*n)/n}return e.dimension*i}function wa(e,t){if(null===e)return 0;const n=xa(e)/Tr;if(Number.isFinite(t)){const e=10**t;return Math.round(n*e)/e}return n}function _a(e){var t;return`${e.dimension}${null!=(t=e.unit)?t:"pt"}`}function ka(e){var t,n;if(null==e)return null;let i="";if("dimension"in e&&(i=`${e.dimension}${null!=(t=e.unit)?t:"pt"}`),"glue"in e&&(i=function(e){let t=_a(e.glue);return e.grow&&0!==e.grow.dimension&&(t+=` plus ${_a(e.grow)}`),e.shrink&&0!==e.shrink.dimension&&(t+=` minus ${_a(e.shrink)}`),t}(e)),"number"in e)if("base"in e&&"decimal"!==e.base)if("alpha"===e.base)i=`\`${String.fromCodePoint(e.number)}`;else{const t=Math.round(e.number)>>>0;"hexadecimal"===e.base?(i=Number(t).toString(16).toUpperCase(),i=t<=255?i.padStart(2,"0"):t<=65535?i.padStart(4,"0"):t<=16777215?i.padStart(6,"0"):i.padStart(8,"0"),i=`"${i}`):"octal"===e.base&&(i=Number(t).toString(8),i=t<=63?i.padStart(2,"0"):t<=30583?i.padStart(4,"0"):i.padStart(8,"0"),i=`'${i}`)}else i=Number(e.number).toString();return"register"in e&&("factor"in e&&(-1===e.factor?i="-":1!==e.factor&&(i=Number(e.factor).toString())),"global"in e&&e.global&&(i+="\\global"),i+=`\\${e.register}`),"string"in e&&(i=e.string),null!=(n=e.relax)&&n&&(i+="\\relax"),i}function Ma(e,t){return null==e?null:"number"in e?h(d({},e),{number:e.number*t}):"register"in e?"factor"in e&&e.factor?h(d({},e),{factor:e.factor*t}):h(d({},e),{factor:t}):"dimension"in e?h(d({},e),{dimension:e.dimension*t}):"glue"in e?e.shrink&&e.grow?{glue:Ma(e.glue,t),shrink:Ma(e.shrink,t),grow:Ma(e.grow,t)}:e.shrink?{glue:Ma(e.glue,t),shrink:Ma(e.shrink,t)}:e.grow?{glue:Ma(e.glue,t),grow:Ma(e.grow,t)}:{glue:Ma(e.glue,t)}:null}var Sa={"p@":{dimension:1},"z@":{dimension:0},maxdimen:{dimension:16383.99999},hfuzz:{dimension:.1},vfuzz:{dimension:.1},overfullrule:{dimension:5},hsize:{dimension:6.5,unit:"in"},vsize:{dimension:8.9,unit:"in"},parindent:{dimension:20},maxdepth:{dimension:4},splitmaxdepth:{register:"maxdimen"},boxmaxdepth:{register:"maxdimen"},delimitershortfall:{dimension:5},nulldelimiterspace:{dimension:1.2,unit:"pt"},scriptspace:{dimension:.5},topskip:{dimension:10},splittopskip:{dimension:10},normalbaselineskip:{dimension:12},normallineskip:{dimension:1},normallineskiplimit:{dimension:0},jot:{dimension:3},doublerulesep:{dimension:2},arrayrulewidth:{dimension:.4},arraycolsep:{dimension:5},fboxsep:{dimension:3},fboxrule:{dimension:.4},"z@skip":{glue:{dimension:0},shrink:{dimension:0},grow:{dimension:0}},hideskip:{glue:{dimension:-1e3},grow:{dimension:1,unit:"fill"}},"@flushglue":{glue:{dimension:0},grow:{dimension:1,unit:"fill"}},parskip:{glue:{dimension:0},grow:{dimension:1}},abovedisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},abovedisplayshortskip:{glue:{dimension:0},grow:{dimension:3}},belowdisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},belowdisplayshortskip:{glue:{dimension:7},grow:{dimension:3},shrink:{dimension:4}},parfillskip:{glue:{dimension:0},grow:{dimension:1,unit:"fil"}},thinmuskip:{glue:{dimension:3,unit:"mu"}},medmuskip:{glue:{dimension:4,unit:"mu"},grow:{dimension:2,unit:"mu"},shrink:{dimension:4,unit:"mu"}},thickmuskip:{glue:{dimension:5,unit:"mu"},grow:{dimension:5,unit:"mu"}},smallskipamount:{glue:{dimension:3},grow:{dimension:1},shrink:{dimension:1}},medskipamount:{glue:{dimension:6},grow:{dimension:2},shrink:{dimension:3}},bigskipamount:{glue:{dimension:12},grow:{dimension:2},shrink:{dimension:4}},pretolerance:100,tolerance:200,hbadness:1e3,vbadness:1e3,linepenalty:10,hyphenpenalty:50,exhyphenpenalty:50,binoppenalty:700,relpenalty:500,clubpenalty:150,widowpenalty:150,displaywidowpenalty:50,brokenpenalty:100,predisplaypenalty:1e4,doublehyphendemerits:1e4,finalhyphendemerits:5e3,adjdemerits:1e4,tracinglostchars:1,uchyph:1,delimiterfactor:901,defaulthyphenchar:"\\-",defaultskewchar:-1,newlinechar:-1,showboxbreadth:5,showboxdepth:3,errorcontextlines:5,interdisplaylinepenalty:100,interfootnotelinepenalty:100,baselineSkip:1.2,arraystretch:1,month:(new Date).getMonth()+1,day:(new Date).getDate(),year:(new Date).getFullYear()};function La(){return d({},Sa)}function Ca(){return{registers:La(),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"▢",letterShapeStyle:v.locale.startsWith("fr")?"french":"tex",minFontScale:0,colorMap:C,backgroundColorMap:E,getMacro:e=>se(e,ie())}}var Ea=class e{constructor(t,n){var i,o,r,a,s,l,c,h,u,p,m,f,g,b,y;let v;(null==t?void 0:t.parent)?(this.parent=t.parent,v=t.parent,this.registers={}):(v=d(d({},Ca()),null!=(i=null==t?void 0:t.from)?i:{}),this.registers=v.registers),v.atomIdsSettings&&(this.atomIdsSettings=d({},v.atomIdsSettings)),this.renderPlaceholder=v.renderPlaceholder,this.isPhantom=null!=(a=null!=(r=null==t?void 0:t.isPhantom)?r:null==(o=this.parent)?void 0:o.isPhantom)&&a,this.letterShapeStyle=v.letterShapeStyle,this.minFontScale=v.minFontScale,(null==n?void 0:n.color)&&"none"!==n.color?this.color=n.color:this.color=null!=(l=null==(s=this.parent)?void 0:s.color)?l:"",(null==n?void 0:n.backgroundColor)&&"none"!==n.backgroundColor?this.backgroundColor=n.backgroundColor:this.backgroundColor=null!=(h=null==(c=this.parent)?void 0:c.backgroundColor)?h:"",(null==n?void 0:n.fontSize)&&"auto"!==n.fontSize&&n.fontSize!==(null==(u=this.parent)?void 0:u.size)?this.size=n.fontSize:this.size=null!=(m=null==(p=this.parent)?void 0:p.size)?m:5;let x=null!=(g=null==(f=this.parent)?void 0:f.mathstyle)?g:va.displaystyle;if("string"==typeof(null==t?void 0:t.mathstyle)){if(v instanceof e)switch(t.mathstyle){case"cramp":x=x.cramp;break;case"superscript":x=x.sup;break;case"subscript":x=x.sub;break;case"numerator":x=x.fracNum;break;case"denominator":x=x.fracDen}switch(t.mathstyle){case"textstyle":x=va.textstyle;break;case"displaystyle":x=va.displaystyle;break;case"scriptstyle":x=va.scriptstyle;break;case"scriptscriptstyle":x=va.scriptscriptstyle}}this.mathstyle=x,this.smartFence=v.smartFence,this.placeholderSymbol=v.placeholderSymbol,this.colorMap=null!=(b=v.colorMap)?b:e=>e,this.backgroundColorMap=null!=(y=v.backgroundColorMap)?y:e=>e,this.getMacro=v.getMacro,console.assert(void 0!==this.parent||void 0!==this.registers)}makeID(){if(!this.atomIdsSettings)return;if(this.atomIdsSettings.overrideID)return this.atomIdsSettings.overrideID;if("number"!=typeof this.atomIdsSettings.seed)return`${Date.now().toString(36).slice(-2)}${Math.floor(1e5*Math.random()).toString(36)}`;const e=this.atomIdsSettings.seed.toString(36);return this.atomIdsSettings.seed+=1,e}scale(e){return e*this.effectiveFontSize}get scalingFactor(){return this.parent?this.effectiveFontSize/this.parent.effectiveFontSize:1}get isDisplayStyle(){return 7===this.mathstyle.id||6===this.mathstyle.id}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(Or[Math.max(1,this.size+this.mathstyle.sizeDelta)],this.minFontScale)}getRegister(e){var t;return(null==(t=this.registers)?void 0:t[e])?this.registers[e]:this.parent?this.parent.getRegister(e):void 0}getRegisterAsNumber(e){const t=this.getRegister(e);return"number"==typeof t?t:"string"==typeof t?Number(t):void 0}getRegisterAsGlue(e){var t;if(null==(t=this.registers)?void 0:t[e]){const t=this.registers[e];return"object"==typeof t&&"glue"in t?t:"object"==typeof t&&"dimension"in t?{glue:{dimension:t.dimension}}:"number"==typeof t?{glue:{dimension:t}}:void 0}if(this.parent)return this.parent.getRegisterAsGlue(e)}getRegisterAsEm(e,t){return wa(this.getRegisterAsDimension(e),t)}getRegisterAsDimension(e){var t;if(null==(t=this.registers)?void 0:t[e]){const t=this.registers[e];return"object"==typeof t&&"glue"in t?t.glue:"object"==typeof t&&"dimension"in t?t:"number"==typeof t?{dimension:t}:void 0}if(this.parent)return this.parent.getRegisterAsDimension(e)}setRegister(e,t){void 0!==t?this.registers[e]=t:delete this.registers[e]}evaluate(e){if(!e||!("register"in e))return e;let t=this;if("global"in e&&e.global)for(;t.parent;)t=t.parent;let n=1;"factor"in e&&1!==e.factor&&void 0!==e.factor&&(n=e.factor);const i=t.getRegister(e.register);if(void 0===i)return;if("string"==typeof i)return{string:Number(i).toString()+i};if("number"==typeof i)return{number:n*i};const o=t.evaluate(i);return void 0!==o?"string"in o?{string:Number(i).toString()+o.string}:"number"in o?{number:n*o.number}:"dimension"in o?h(d({},o),{dimension:n*o.dimension}):"glue"in o?h(d({},o),{glue:h(d({},o.glue),{dimension:n*o.glue.dimension}),shrink:o.shrink?h(d({},o.shrink),{dimension:n*o.shrink.dimension}):void 0,grow:o.grow?h(d({},o.grow),{dimension:n*o.grow.dimension}):void 0}):e:void 0}toDimension(e){const t=this.evaluate(e);return void 0===t?null:"dimension"in t?t:"glue"in t?t.glue:"number"in t?{dimension:t.number}:null}toEm(e,t){if(null===e)return 0;const n=this.toDimension(e);return null===n?0:xa(n,t)/Tr}toNumber(e){if(null===e)return null;const t=this.evaluate(e);return void 0===t?null:"number"in t?t.number:"dimension"in t?t.dimension:"glue"in t?t.glue.dimension:"string"in t?Number(t.string):null}toColor(e){var t,n;if(null===e)return null;const i=this.evaluate(e);return void 0===i?null:"string"in i?null!=(n=null==(t=this.colorMap)?void 0:t.call(this,i.string))?n:i.string:null}toBackgroundColor(e){var t,n;if(null===e)return null;const i=this.evaluate(e);return void 0===i?null:"string"in i?null!=(n=null==(t=this.backgroundColorMap)?void 0:t.call(this,i.string))?n:i.string:null}},Ka=["body","above","below","superscript","subscript"];function Aa(e){return"string"==typeof e&&Ka.includes(e)}function Da(e){return void 0!==e&&Array.isArray(e)&&2===e.length}var za=class e{constructor(e){var t,n,i,o,r,a;this.type=e.type,"string"==typeof e.value&&(this.value=e.value),this.command=null!=(n=null!=(t=e.command)?t:this.value)?n:"",this.mode=null!=(i=e.mode)?i:"math",e.isFunction&&(this.isFunction=!0),e.limits&&(this.subsupPlacement=e.limits),this.style=d({},e.style),this.displayContainsHighlight=null!=(o=e.displayContainsHighlight)&&o,this.captureSelection=null!=(r=e.captureSelection)&&r,this.skipBoundary=null!=(a=e.skipBoundary)&&a,void 0!==e.verbatimLatex&&null!==e.verbatimLatex&&(this.verbatimLatex=e.verbatimLatex),e.args&&(this.args=e.args),e.body&&(this.body=e.body),this._changeCounter=0}static createBox(e,t,n){var i;if(!t)return null;const o=function(e){let t;const n=[];let i=[];for(const o of e)if(t||o.style){const e=o.computedStyle;t&&e.color===t.color&&e.backgroundColor===t.backgroundColor&&e.fontSize===t.fontSize?i.push(o):(i.length>0&&n.push(i),i=[o],t=e)}else i.push(o);i.length>0&&n.push(i);return n}(t),r=[];for(const t of o){const n=t[0].style,i=Ta(e,t,{style:{color:n.color,backgroundColor:n.backgroundColor,fontSize:n.fontSize}});i&&r.push(i)}if(0===r.length)return null;const a=(null!=(i=null==n?void 0:n.classes)?i:"").trim();return 1!==r.length||a||(null==n?void 0:n.type)?new da(r,{classes:a,type:null==n?void 0:n.type}).wrap(e):r[0].wrap(e)}static serialize(e,t){return na.serialize(e,t)}static commonAncestor(e,t){if(e===t)return e.parent;if(e.parent===t.parent)return e.parent;const n=new WeakSet;let{parent:i}=e;for(;i;)n.add(i),i=i.parent;for(i=t.parent;i;){if(n.has(i))return i;i=i.parent}console.assert(Boolean(i))}static fromJson(t){return new e("string"==typeof t?{type:"mord",value:t,mode:"math"}:t)}get latexMode(){return"math"===this.mode?"math":"text"}toJson(){const e={};if(this.type&&(e.type=this.type),"math"!==this.mode&&(e.mode=this.mode),this.command&&this.command!==this.value&&(e.command=this.command),void 0!==this.value&&(e.value=this.value),this.style&&Object.keys(this.style).length>0&&(e.style=d({},this.style)),void 0!==this.verbatimLatex&&(e.verbatimLatex=this.verbatimLatex),this.subsupPlacement&&(e.subsupPlacement=this.subsupPlacement),this.explicitSubsupPlacement&&(e.explicitSubsupPlacement=!0),this.isFunction&&(e.isFunction=!0),this.displayContainsHighlight&&(e.displayContainsHighlight=!0),this.isExtensibleSymbol&&(e.isExtensibleSymbol=!0),this.skipBoundary&&(e.skipBoundary=!0),this.captureSelection&&(e.captureSelection=!0),this.args&&(e.args=this.args.map((e=>null===e?"<null>":Array.isArray(e)&&e[0]instanceof za?{atoms:e.map((e=>e.toJson()))}:"object"==typeof e&&"group"in e?{group:e.group.map((e=>e.toJson()))}:e))),this._branches)for(const t of Object.keys(this._branches))this._branches[t]&&(e[t]=this._branches[t].filter((e=>"first"!==e.type)).map((e=>e.toJson())));return"mord"===e.type&&2===Object.keys(e).length&&"value"in e?e.value:e}get changeCounter(){return this.parent?this.parent.changeCounter:this._changeCounter}set isDirty(e){if(e){this.parent||this._changeCounter++,"verbatimLatex"in this&&(this.verbatimLatex=void 0),this._children=void 0;let{parent:e}=this;for(;e;)e.parent||e._changeCounter++,"verbatimLatex"in e&&(e.verbatimLatex=void 0),e._children=void 0,e=e.parent}}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const t=ae(this.command,this.mode);return(null==t?void 0:t.serialize)?t.serialize(this,e):this.body&&this.command?Yr([Qr(this.command,this.bodyToLatex(e)),this.supsubToLatex(e)]):this.body?Yr([this.bodyToLatex(e),this.supsubToLatex(e)]):this.value&&""!==this.value?this.command:""}bodyToLatex(e){var t;return na.serialize(this.body,h(d({},e),{defaultMode:null!=(t=e.defaultMode)?t:this.latexMode}))}aboveToLatex(e){return na.serialize(this.above,e)}belowToLatex(e){return na.serialize(this.below,e)}supsubToLatex(e){let t="";if(e=h(d({},e),{defaultMode:"math"}),void 0!==this.branch("subscript")){const n=na.serialize(this.subscript,e);0===n.length?t+="_{}":1===n.length&&/^[0-9]$/.test(n)?t+=`_${n}`:t+=`_{${n}}`}if(void 0!==this.branch("superscript")){const n=na.serialize(this.superscript,e);0===n.length?t+="^{}":1===n.length?"′"===n?t+="^\\prime ":"″"===n?t+="^\\doubleprime ":/^[0-9]$/.test(n)?t+=`^${n}`:t+=`^{${n}}`:t+=`^{${n}}`}return t}get treeDepth(){let e=1,t=this.parent;for(;t;)t=t.parent,e+=1;return e}get inCaptureSelection(){let e=this;for(;e;){if(e.captureSelection)return!0;e=e.parent}return!1}get parentPrompt(){let e=this.parent;for(;e;){if("prompt"===e.type&&!e.captureSelection)return e;e=e.parent}return null}branch(e){if(Aa(e)&&this._branches)return this._branches[e]}get branches(){if(!this._branches)return[];const e=[];for(const t of Ka)this._branches[t]&&e.push(t);return e}createBranch(e){return console.assert(Aa(e)),Aa(e)?(this._branches?this._branches[e]||(this._branches[e]=[this.makeFirstAtom(e)]):this._branches={[e]:[this.makeFirstAtom(e)]},this.isDirty=!0,this._branches[e]):[]}get row(){return Da(this.parentBranch)?this.parentBranch[0]:-1}get col(){return Da(this.parentBranch)?this.parentBranch[1]:-1}get body(){var e;return null==(e=this._branches)?void 0:e.body}set body(e){this.setChildren(e,"body")}get superscript(){var e;return null==(e=this._branches)?void 0:e.superscript}set superscript(e){this.setChildren(e,"superscript")}get subscript(){var e;return null==(e=this._branches)?void 0:e.subscript}set subscript(e){this.setChildren(e,"subscript")}get above(){var e;return null==(e=this._branches)?void 0:e.above}set above(e){this.setChildren(e,"above")}get below(){var e;return null==(e=this._branches)?void 0:e.below}set below(e){this.setChildren(e,"below")}get computedStyle(){var e,t;const n="string"==typeof this.style.verbatimColor,i="string"==typeof this.style.verbatimBackgroundColor,o=d(d({},null!=(t=null==(e=this.parent)?void 0:e.computedStyle)?t:{}),this.style);return delete o.variant,delete o.variantStyle,i||delete o.verbatimBackgroundColor,n||delete o.verbatimColor,o}applyStyle(e){this.isDirty=!0,this.style=d(d({},this.style),e),"none"===this.style.fontFamily&&delete this.style.fontFamily,"auto"===this.style.fontShape&&delete this.style.fontShape,"auto"===this.style.fontSeries&&delete this.style.fontSeries,"none"===this.style.color&&(delete this.style.color,delete this.style.verbatimColor),"none"===this.style.backgroundColor&&(delete this.style.backgroundColor,delete this.style.verbatimBackgroundColor),"auto"===this.style.fontSize&&delete this.style.fontSize;for(const t of this.children)t.applyStyle(e)}getInitialBaseElement(){var e,t,n;return this.hasEmptyBranch("body")?this:(console.assert("first"===(null==(e=this.body)?void 0:e[0].type)),null!=(n=null==(t=this.body[1])?void 0:t.getInitialBaseElement())?n:this)}getFinalBaseElement(){return this.hasEmptyBranch("body")?this:this.body[this.body.length-1].getFinalBaseElement()}isCharacterBox(){return"leftright"!==this.type&&"genfrac"!==this.type&&"subsup"!==this.type&&"delim"!==this.type&&"array"!==this.type&&"surd"!==this.type&&"mord"===this.getFinalBaseElement().type}hasEmptyBranch(e){const t=this.branch(e);return!t||(console.assert(t.length>0),console.assert("first"===t[0].type),1===t.length)}setChildren(e,t){var n;if(!e)return;if(console.assert(Aa(t)),!Aa(t))return;console.assert("first"!==(null==(n=e[0])?void 0:n.type));const i=[this.makeFirstAtom(t),...e];this._branches?this._branches[t]=i:this._branches={[t]:i};for(const n of e)n.parent=this,n.parentBranch=t;this.isDirty=!0}makeFirstAtom(t){const n=new e({type:"first",mode:this.mode});return n.parent=this,n.parentBranch=t,n}addChild(e,t){console.assert("first"!==e.type),this.createBranch(t).push(e),this.isDirty=!0,e.parent=this,e.parentBranch=t}addChildBefore(e,t){console.assert(void 0!==t.parentBranch);const n=this.createBranch(t.parentBranch);n.splice(n.indexOf(t),0,e),this.isDirty=!0,e.parent=this,e.parentBranch=t.parentBranch}addChildAfter(e,t){console.assert(void 0!==t.parentBranch);const n=this.createBranch(t.parentBranch);n.splice(n.indexOf(t)+1,0,e),this.isDirty=!0,e.parent=this,e.parentBranch=t.parentBranch}addChildren(e,t){const n=this.createBranch(t);for(const i of e)i.parent=this,i.parentBranch=t,n.push(i);this.isDirty=!0}addChildrenAfter(e,t){console.assert(0===e.length||"first"!==e[0].type),console.assert(void 0!==t.parentBranch);const n=this.createBranch(t.parentBranch);n.splice(n.indexOf(t)+1,0,...e),this.isDirty=!0;for(const n of e)n.parent=this,n.parentBranch=t.parentBranch;return e[e.length-1]}removeBranch(e){const t=this.branch(e);if(Aa(e)&&(this._branches[e]=void 0),!t)return[];for(const e of t)e.parent=void 0,e.parentBranch=void 0;return console.assert("first"===t[0].type),t.shift(),this.isDirty=!0,t}removeChild(e){if(console.assert(e.parent===this),"first"===e.type)return;const t=this.branch(e.parentBranch),n=t.indexOf(e);console.assert(n>=0),t.splice(n,1),this.isDirty=!0,e.parent=void 0,e.parentBranch=void 0}get siblings(){return this.parent?this.parent.branch(this.parentBranch):[]}get firstSibling(){return this.siblings[0]}get lastSibling(){const{siblings:e}=this;return e[e.length-1]}get isFirstSibling(){return this===this.firstSibling}get isLastSibling(){return this===this.lastSibling}get hasNoSiblings(){return 1===this.siblings.length}get leftSibling(){console.assert(void 0!==this.parent);const e=this.parent.branch(this.parentBranch);return e[e.indexOf(this)-1]}get rightSibling(){console.assert(void 0!==this.parent);const e=this.parent.branch(this.parentBranch);return e[e.indexOf(this)+1]}get hasChildren(){return Boolean(this._branches&&this.children.length>0)}get firstChild(){return console.assert(this.hasChildren),this.children[0]}get lastChild(){console.assert(this.hasChildren);const{children:e}=this;return e[e.length-1]}get children(){if(this._children)return this._children;if(!this._branches)return[];const e=[];for(const t of Ka)if(this._branches[t])for(const n of this._branches[t])e.push(...n.children),e.push(n);return this._children=e,e}render(e){if("first"===this.type&&!e.atomIdsSettings)return null;const t=ae(this.command,this.mode);if(null==t?void 0:t.render)return t.render(this,e);const n=new Ea({parent:e},this.style);let i=this.createBox(n,{classes:this.parent?"":"ML__base"});return i?(this.subsupPlacement||!this.superscript&&!this.subscript||(i=this.attachSupsub(n,{base:i})),i.wrap(n)):null}attachSupsub(t,n){var i;const o=n.base,r=this.superscript,a=this.subscript;if(!r&&!a)return o;let s=null,l=null;const c=null!=(i=n.isCharacterBox)?i:this.isCharacterBox();let d=0;if(r){const n=new Ea({parent:t,mathstyle:"superscript"});s=e.createBox(n,r),c||(d=o.height-t.metrics.supDrop*n.scalingFactor)}let h,u=0;if(a){const n=new Ea({parent:t,mathstyle:"subscript"});l=e.createBox(n,a),c||(u=o.depth+t.metrics.subDrop*n.scalingFactor)}h=t.isDisplayStyle?t.metrics.sup1:t.isCramped?t.metrics.sup3:t.metrics.sup2;const p=.05/t.scalingFactor;let m=null;if(l&&s){d=Math.max(d,h,s.depth+.25*t.metrics.xHeight),u=Math.max(u,t.metrics.sub2);const e=t.metrics.defaultRuleThickness;if(d-s.depth-(l.height-u)<4*e){u=4*e-(d-s.depth)+l.height;const n=.8*t.metrics.xHeight-(d-s.depth);n>0&&(d+=n,u-=n)}const n=this.isExtensibleSymbol&&o.italic?-o.italic:0;m=new ga({individualShift:[{box:l,shift:u,marginLeft:n},{box:s,shift:-d}]}).wrap(t)}else l&&!s?(u=Math.max(u,t.metrics.sub1,l.height-.3448),m=new ga({shift:u,children:[{box:l,marginRight:p,marginLeft:this.isCharacterBox()?-o.italic:0}]})):!l&&s&&(d=Math.max(d,h,s.depth+.10775),m=new ga({shift:-d,children:[{box:s,marginRight:p}]}));return new da([o,new da(m,{caret:this.caret,isSelected:this.isSelected,classes:"msubsup"})],{type:n.type})}attachLimits(t,n){const i=this.superscript?e.createBox(new Ea({parent:t,mathstyle:"superscript"},this.style),this.superscript):null,o=this.subscript?e.createBox(new Ea({parent:t,mathstyle:"subscript"},this.style),this.subscript):null;return i||o?function(e,t){var n,i,o,r,a;const s=e.metrics,l=new da(t.base),c=null!=(n=t.baseShift)?n:0,d=null!=(i=t.slant)?i:0;let h=0,u=0;t.above&&(h=null!=(o=t.aboveShift)?o:Math.max(s.bigOpSpacing1,s.bigOpSpacing3-t.above.depth)),t.below&&(u=null!=(r=t.belowShift)?r:Math.max(s.bigOpSpacing2,s.bigOpSpacing4-t.below.height));let p=null;if(t.below&&t.above){const n=s.bigOpSpacing5+t.below.height+t.below.depth+u+l.depth+c;p=new ga({bottom:n,children:[s.bigOpSpacing5,{box:t.below,marginLeft:-d,classes:["ML__center"]},u,{box:l,classes:["ML__center"]},h,{box:t.above,marginLeft:d,classes:["ML__center"]},s.bigOpSpacing5]}).wrap(e)}else if(t.below&&!t.above)p=new ga({top:l.height-c,children:[s.bigOpSpacing5,{box:t.below,marginLeft:-d,classes:["ML__center"]},u,{box:l,classes:["ML__center"]}]}).wrap(e);else if(!t.below&&t.above){const n=l.depth+c;p=new ga({bottom:n,children:[{box:l,classes:["ML__center"]},h,{box:t.above,marginLeft:d,classes:["ML__center"]},s.bigOpSpacing5]}).wrap(e)}else{const t=l.depth+c;p=new ga({bottom:t,children:[{box:l},s.bigOpSpacing5]}).wrap(e)}return new da(p,{type:null!=(a=t.type)?a:"op"})}(t,h(d({},n),{above:i,below:o})):n.base.wrap(t)}bind(e,t){if(!t||e.isPhantom||""===this.value)return t;let n=this.parent;for(;n&&!n.captureSelection;)n=n.parent;return(null==n?void 0:n.captureSelection)||(this.id||(this.id=e.makeID()),t.atomID=this.id),t}createBox(t,n){var i,o,r,a;const s=null!=(i=this.value)?i:this.body,l=null!=(o=null==n?void 0:n.boxType)?o:sa(this.type);let c=null!=(r=null==n?void 0:n.classes)?r:"";"text"===this.mode&&(c+=" ML__text");const u="string"==typeof s||void 0===s?new da(null!=s?s:null,{type:l,isSelected:this.isSelected,mode:this.mode,maxFontSize:t.scalingFactor,style:h(d({variant:"normal"},this.style),{fontSize:Math.max(1,t.size+t.mathstyle.sizeDelta)}),letterShapeStyle:t.letterShapeStyle,classes:c}):null!=(a=e.createBox(t,s,{type:l,classes:c}))?a:new da(null);return t.isTight&&(u.isTight=!0),"math"===this.mode&&"main"!==this.style.variant||(u.italic=0),u.right=u.italic,this.bind(t,u),this.caret&&(this.superscript||this.subscript||(u.caret=this.caret)),u}isDigit(){var e;return"mord"===this.type&&this.value?/^[\d,\.]$/.test(this.value):"group"===this.type&&2===(null==(e=this.body)?void 0:e.length)&&("first"===this.body[0].type&&","===this.body[1].value)}asDigit(){var e;return"mord"===this.type&&this.value&&/^[\d,\.]$/.test(this.value)?this.value:"group"===this.type&&2===(null==(e=this.body)?void 0:e.length)&&"first"===this.body[0].type&&","===this.body[1].value?".":""}};function Ta(e,t,n){var i,o,r,a,s;if(!t||0===t.length)return null;const l=new Ea({parent:e},n.style),c=!(null==(i=l.atomIdsSettings)?void 0:i.groupNumbers);let u=[];if(1===t.length){const e=t[0],n=e.render(l);n&&(c&&e.isSelected&&n.selected(!0),u=[n])}else{let e="",n=!0;for(const i of t){(null==(o=l.atomIdsSettings)?void 0:o.groupNumbers)&&e&&(n&&i.isDigit()||!n&&Ba(i))&&(l.atomIdsSettings.overrideID=e);const t=i.render(l);l.atomIdsSettings&&(l.atomIdsSettings.overrideID=void 0),t&&((null==(r=l.atomIdsSettings)?void 0:r.groupNumbers)&&((i.isDigit()||Ba(i))&&(e&&n===i.isDigit()||(n=i.isDigit(),e=null!=(a=i.id)?a:"")),!e||(i.isDigit()||Ba(i))&&i.hasEmptyBranch("superscript")&&i.hasEmptyBranch("subscript")||(e="")),c&&i.isSelected&&t.selected(!0),u.push(t))}}if(0===u.length)return null;const p=new da(u,h(d({isTight:l.isTight},n),{type:null!=(s=n.type)?s:"lift"}));return p.isSelected=u.every((e=>e.isSelected)),p.wrap(l)}function Ba(e){return"text"===e.mode}var $a=class e extends za{constructor(e,t,n){super({type:"text",command:e,mode:"text",displayContainsHighlight:!0}),this.value=t,this.verbatimLatex=t,this.applyStyle(n)}static fromJson(t){return new e(t.command,t.value,t.style)}render(e){const t=this.createBox(e);return this.caret&&(t.caret=this.caret),t}_serialize(e){var t;return null!=(t=this.verbatimLatex)?t:le("text",this.value.codePointAt(0))}};function Pa(e,t){return e[0]===t[0]&&e[1]===t[1]?"equal":"different"}function Oa(e){let t=1/0,n=-1/0;for(const i of e.ranges)t=Math.min(t,i[0],i[1]),n=Math.max(n,i[0],i[1]);return[t,n]}function qa(e){return"number"==typeof e&&!Number.isNaN(e)}function Na(e){return Array.isArray(e)&&2===e.length}function Ia(e){return null!=e&&"object"==typeof e&&"ranges"in e&&Array.isArray(e.ranges)}function Fa(e,t,n){return n?function(e,t){if(!t)return"";if("string"==typeof t)return t;if(!e||void 0===t.after)return t.value;let n=!1,i=!1,o=!1,r=!1,a=!1,s=!1,l=!1,c=!1,d=!1,h=!1,u=!1,p=!1,m=!1,f=!1,g=!1,b=e[0],y=0;for(;(null==b?void 0:b.type)&&/^(subsup|placeholder)$/.test(b.type);)y+=1,b=e[y];return n=!b||"first"===b.type,b&&(f="text"===b.mode,i=!f&&"mord"===b.type&&q.test(b.value),o=!f&&"mord"===b.type&&/\d+$/.test(b.value),r=!f&&b.isFunction,a="genfrac"===b.type,s="surd"===b.type,l="mbin"===b.type,c="mrel"===b.type,d="mop"===b.type||"operator"===b.type||"extensible-symbol"===b.type,h="mpunct"===b.type||"minner"===b.type,u="array"===b.type,p="mopen"===b.type,m="mclose"===b.type||"leftright"===b.type,g="space"===b.type),t.after.includes("nothing")&&n||t.after.includes("letter")&&i||t.after.includes("digit")&&o||t.after.includes("function")&&r||t.after.includes("frac")&&a||t.after.includes("surd")&&s||t.after.includes("binop")&&l||t.after.includes("relop")&&c||t.after.includes("operator")&&d||t.after.includes("punct")&&h||t.after.includes("array")&&u||t.after.includes("openfence")&&p||t.after.includes("closefence")&&m||t.after.includes("text")&&f||t.after.includes("space")&&g?t.value:""}(e,n[t]):""}var Ra={"&":"\\&","%":"\\%",$:"\\$","''":"^{\\doubleprime}","'''":"^{\\prime\\prime\\prime}","''''":"^{\\prime\\prime\\prime\\prime}",alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:"\\pi",Pi:"\\Pi",theta:"\\theta",Theta:"\\Theta",ii:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryI"},jj:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryJ"},ee:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:"\\nabla",grad:"\\nabla",del:"\\partial",deg:{after:"digit+space",value:"\\degree"},infty:"\\infty","∞":"\\infty",oo:{after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"∑":"\\sum",sum:"\\sum_{#?}^{#?}",int:"\\int_{#?}^{#?}",prod:"\\prod_{#?}^{#?}",sqrt:"\\sqrt{#?}","∆":"\\differentialD","∂":"\\differentialD",arcsin:"\\arcsin",arccos:"\\arccos",arctan:"\\arctan",arcsec:"\\arcsec",arccsc:"\\arccsc",arsinh:"\\arsinh",arcosh:"\\arcosh",artanh:"\\artanh",arcsech:"\\arcsech",arccsch:"\\arccsch",arg:"\\arg",ch:"\\ch",cosec:"\\cosec",cosh:"\\cosh",cot:"\\cot",cotg:"\\cotg",coth:"\\coth",csc:"\\csc",ctg:"\\ctg",cth:"\\cth",sec:"\\sec",sinh:"\\sinh",sh:"\\sh",tanh:"\\tanh",tg:"\\tg",th:"\\th",sin:"\\sin",cos:"\\cos",tan:"\\tan",lg:"\\lg",lb:"\\lb",log:"\\log",ln:"\\ln",exp:"\\exp",lim:"\\lim_{#?}",dx:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD x"},dy:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD y"},dt:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD t"},AA:"\\forall",EE:"\\exists","!EE":"\\nexists","&&":"\\land",xin:{after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},sint:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\sin t"},in:{after:"nothing+letter+closefence",value:"\\in"},"!in":"\\notin",NN:"\\mathbb{N}",ZZ:"\\Z",QQ:"\\Q",RR:"\\R",CC:"\\C",xx:"\\times","+-":"\\pm","≠":"\\ne","!=":"\\ne","≥":"\\ge",">=":"\\ge","≤":"\\le","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","≈":"\\approx","?=":"\\questeq","÷":"\\div","¬":"\\neg",":=":"\\coloneq","::":"\\Colon","(:":"\\langle",":)":"\\rangle",beta:"\\beta",chi:"\\chi",epsilon:"\\epsilon",varepsilon:"\\varepsilon",eta:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta"},gamma:"\\gamma",Gamma:"\\Gamma",iota:"\\iota",kappa:"\\kappa",lambda:"\\lambda",Lambda:"\\Lambda",mu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu"},nu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu"},"µ":"\\mu",phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\phi"},Phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Phi"},varphi:"\\varphi",psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\psi"},Psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Psi"},rho:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\rho"},sigma:"\\sigma",Sigma:"\\Sigma",tau:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\tau"},vartheta:"\\vartheta",upsilon:"\\upsilon",xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\xi"},Xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Xi"},zeta:"\\zeta",omega:"\\omega",Omega:"\\Omega","Ω":"\\omega",forall:"\\forall",exists:"\\exists","!exists":"\\nexists",":.":"\\therefore",liminf:"\\liminf_{#?}",limsup:"\\limsup_{#?}",argmin:"\\operatorname*{arg~min}_{#?}",argmax:"\\operatorname*{arg~max}_{#?}",det:"\\det",mod:"\\bmod{#?}","(mod":"\\pmod{#?}",max:"\\max",min:"\\min",erf:"\\operatorname{erf}",erfc:"\\operatorname{erfc}",bessel:"\\operatorname{bessel}",mean:"\\operatorname{mean}",median:"\\operatorname{median}",fft:"\\operatorname{fft}",lcm:"\\operatorname{lcm}",gcd:"\\operatorname{gcd}",randomReal:"\\operatorname{randomReal}",randomInteger:"\\operatorname{randomInteger}",Re:"\\operatorname{Re}",Im:"\\operatorname{Im}",mm:{after:"nothing+digit+operator",value:"\\operatorname{mm}"},cm:{after:"nothing+digit+operator",value:"\\operatorname{cm}"},km:{after:"nothing+digit+operator",value:"\\operatorname{km}"},kg:{after:"nothing+digit+operator",value:"\\operatorname{kg}"},"...":"\\ldots","+...":"+\\cdots","-...":"-\\cdots","->...":"\\to\\cdots","--\x3e...":"\\longrightarrow\\cdots","->":"\\to","|->":"\\mapsto","--\x3e":"\\longrightarrow","<--":"\\longleftarrow","=>":"\\Rightarrow","==>":"\\Longrightarrow","<=>":"\\Leftrightarrow","<->":"\\leftrightarrow","(.)":"\\odot","(+)":"\\oplus","(/)":"\\oslash","(*)":"\\otimes","(-)":"\\ominus","||":"\\Vert","*":"\\cdot","**":"\\star","***":"\\ast","//":"\\slash","\\\\":"\\backslash",setminus:"\\backslash","|><":"\\ltimes","><|":"\\rtimes","|><|":"\\bowtie","-:":"\\div",divide:"\\div","@":"\\circ","^^":"\\wedge","^^^":"\\bigwedge",vv:"\\vee",vvv:"\\bigvee",nn:"\\cap",nnn:"\\bigcap",uu:"\\cup",uuu:"\\bigcup","-=":"\\equiv","~=":"\\cong",lt:"<","lt=":"\\leq",gt:">","gt=":"\\geq","-<":"\\prec","-lt":"\\prec","-<=":"\\preceq",">-=":"\\succeq",prop:"\\propto",diamond:"\\diamond",square:"\\square",iff:"\\iff",sub:"\\subset",sup:"\\supset",sube:"\\subseteq",supe:"\\supseteq",uarr:"\\uparrow",darr:"\\downarrow",rarr:"\\rightarrow",rArr:"\\Rightarrow",larr:"\\leftarrow",lArr:"\\Leftarrow",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",aleph:"\\aleph",and:"\\land",or:"\\lor",not:"\\neg","_|_":"\\bot",TT:"\\top","|--":"\\vdash","|==":"\\models","|__":"\\lfloor","__|":"\\rfloor","|~":"\\lceil","~|":"\\rceil",">->":"\\rightarrowtail","->>":"\\twoheadrightarrow",">->>":"\\twoheadrightarrowtail",frac:"\\frac{#?}{#?}",cbrt:"\\sqrt[3]{#?}",nthroot:"\\sqrt[#?]{#?}"};function Va(e,t){var n;let i=null!=(n=null==t?void 0:t.format)?n:"auto";return"auto"===i&&([i,e]=function(e){if(e=e.trim(),e.length<=1)return["latex",e];let t;if([t,e]=Ja(e),t)return["latex",e];if(e.startsWith("`")&&e.endsWith("`"))return["ascii-math",e=e.substring(1,e.length-1)];if(e.includes("\\"))return["latex",e];if(/\$.+\$/.test(e))return["latex",`\\text{${e}}`];return[void 0,e]}(e)),"ascii-math"===i?["ascii-math",Ha(e=(e=(e=(e=(e=(e=e.replace(/\u2061/gu,"")).replace(/\u3016/gu,"{")).replace(/\u3017/gu,"}")).replace(/([^\\])sinx/g,"$1\\sin x")).replace(/([^\\])cosx/g,"$1\\cos x ")).replace(/\u2013/g,"-"),{inlineShortcuts:null==t?void 0:t.inlineShortcuts})]:["latex",e]}function Ha(e,t){var n,i,o;if(!e)return"";let r,a=!1;const s=null!=(n=t.inlineShortcuts)?n:Ra;if(a||!e.startsWith("^")&&!e.startsWith("_")||(r=Wa(e.slice(1),{inlineShortcuts:s,noWrap:!0}),e=e[0]+"{"+r.match+"}",e+=Ha(r.rest,t),a=!0),!a&&(r=e.match(/^(sqrt|\u221A)(.*)/),r)){r=Wa(r[2],{inlineShortcuts:s,noWrap:!0});e="\\sqrt{"+(null!=(i=r.match)?i:"\\placeholder{}")+"}",e+=Ha(r.rest,t),a=!0}if(!a&&(r=e.match(/^(\\cbrt|\u221B)(.*)/),r)){r=Wa(r[2],{inlineShortcuts:s,noWrap:!0});e="\\sqrt[3]{"+(null!=(o=r.match)?o:"\\placeholder{}")+"}",e+=Ha(r.rest,t),a=!0}if(a||(r=e.match(/^abs(.*)/),r&&(r=Wa(r[1],{inlineShortcuts:s,noWrap:!0}),e="\\left|"+r.match+"\\right|",e+=Ha(r.rest,t),a=!0)),a||(r=e.match(/^["”“](.*?)["”“](.*)/),r&&(e="\\text{"+r[1]+"}",e+=Ha(r[2],t),a=!0)),a||(r=e.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/),r&&(e=ja(r[1],s),e+=Ha(r[2],t),a=!0)),!a&&/^([fgh])[^a-zA-Z]/.test(e)&&(r=Wa(e.slice(1),{inlineShortcuts:s,noWrap:!0}),e="("===e[1]?e[0]+"\\left("+r.match+"\\right)":e[0]+r.match,e+=Ha(r.rest,t),a=!0),a||(r=e.match(/^([a-zA-Z]+)(.*)/),r&&(e=ja(r[1],s),e+=Ha(r[2],t),a=!0)),!a)if(r=Wa(e,{inlineShortcuts:s,noWrap:!0}),r.match&&"/"===r.rest[0]){const n=Wa(r.rest.slice(1),{inlineShortcuts:s,noWrap:!0});n.match&&(e="\\frac{"+r.match+"}{"+n.match+"}"+Ha(n.rest,t)),a=!0}else r.match&&(e=e.startsWith("(")?"\\left("+r.match+"\\right)"+Ha(r.rest,t):r.match+Ha(r.rest,t),a=!0);return a||(r=e.match(/^(\s+)(.*)$/),r&&(e=" "+Ha(r[2],t),a=!0)),e}function Wa(e,t){let n="",i=e=e.trim(),o=e.charAt(0),r={"(":")","{":"}","[":"]"}[o];if(r){let a=1,s=1;for(;s<e.length&&a>0;)e[s]===o&&a++,e[s]===r&&a--,s++;0===a?(t.noWrap&&"("===o?n=Ha(e.substring(1,s-1),t):("{"===o&&"}"===r&&(o="\\{",r="\\}"),n="\\left"+o+Ha(e.substring(1,s-1),t)+"\\right"+r),i=e.slice(Math.max(0,s))):(n=e.substring(1,s),i="")}else{let o=e.match(/^([a-zA-Z]+)/);if(o){let n=Fa(null,e,t.inlineShortcuts);if(n)return n=n.replace("_{#?}",""),n=n.replace("^{#?}",""),{match:n,rest:e.slice(n.length)}}if(o=e.match(/^([a-zA-Z])/),o)return{match:o[1],rest:e.slice(1)};if(o=e.match(/^(-)?\d+(\.\d*)?/),o)return{match:o[0],rest:e.slice(o[0].length)};/^\\(left|right)/.test(e)||(o=e.match(/^(\\[a-zA-Z]+)/),o&&(i=e.slice(o[1].length),n=o[1]))}return{match:n,rest:i}}function ja(e,t){let n=Fa(null,e,t);return n?(n=n.replace("_{#?}",""),n=n.replace("^{#?}",""),n+=" "):n=e,n}var Ua=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function Ja(e){const t=e.trim();for(const e of Ua)if(t.startsWith(e[0])&&t.endsWith(e[1]))return[!0,t.substring(e[0].length,t.length-e[1].length)];return[!1,e]}var Xa=(e,t,n)=>(Ua.some((e=>t.startsWith(e[0])&&t.endsWith(e[1])))||(t=`$$ ${t} $$`),t),Ga=class e{constructor(t){e._modes[t]=this}static onPaste(t,n,i){var o;if(!n.contentEditable&&"none"===n.userSelect)return n.model.announce("plonk"),!1;if("string"==typeof i){const e=new DataTransfer;e.setData("text/plain",i),i=e}const r=new ClipboardEvent("paste",{clipboardData:i,cancelable:!0});return!!(null==(o=n.host)?void 0:o.dispatchEvent(r))&&e._modes[t].onPaste(n,i)}static copyToClipboard(e,t){if(!e.contentEditable&&"none"===e.userSelect)return void e.model.announce("plonk");const n=e.model,i=n.selectionIsCollapsed?[0,n.lastOffset]:Oa(n.selection),o=n.getValue(i,t);navigator.clipboard.writeText(o).then((()=>{}),(()=>e.model.announce("plonk")))}static onCopy(e,t){var n;if(!t.clipboardData)return;if(!e.contentEditable&&"none"===e.userSelect)return void e.model.announce("plonk");const i=e.model,o=i.selectionIsCollapsed?[0,i.lastOffset]:Oa(i.selection);let r=i.getAtoms(o);if(r.every((e=>"text"===e.mode||!e.mode)))t.clipboardData.setData("text/plain",r.filter((e=>e instanceof $a)).map((e=>e.value)).join(""));else if(r.every((e=>"latex"===e.mode)))t.clipboardData.setData("text/plain",i.getAtoms(o,{includeChildren:!0}).map((e=>{var t;return null!=(t=e.value)?t:""})).join(""));else{let a;a=1===r.length&&void 0!==r[0].verbatimLatex?r[0].verbatimLatex:i.getValue(o,"latex-expanded"),t.clipboardData.setData("application/x-latex",a);try{t.clipboardData.setData("text/plain",e.options.onExport(e,a,o))}catch(e){}if(1===r.length){const e=r[0];"root"!==e.type&&"group"!==e.type||(r=e.body.filter((e=>"first"!==e.type)))}try{t.clipboardData.setData("application/json+mathlive",JSON.stringify(r.map((e=>e.toJson()))))}catch(e){}if(null==(n=window[Symbol.for("io.cortexjs.compute-engine")])?void 0:n.ComputeEngine){const e=window.MathfieldElement.computeEngine;if(e)try{const n=e.jsonSerializationOptions;e.jsonSerializationOptions={metadata:["latex"]};const r=e.parse(i.getValue(o,"latex-unstyled"));e.jsonSerializationOptions=n;const a=JSON.stringify(r.json);a&&t.clipboardData.setData("application/json",a)}catch(e){}}}t.preventDefault()}static insert(t,n,i={}){var o;const r="auto"===i.mode?t.mode:null!=(o=i.mode)?o:t.mode;return e._modes[r].insert(t,n,i)}onPaste(e,t){return!1}insert(e,t,n){return!1}};Ga._modes={};var Za=Ga,Ya=[{key:"left",command:"moveToPreviousChar"},{key:"right",command:"moveToNextChar"},{key:"up",command:"moveUp"},{key:"down",command:"moveDown"},{key:"shift+[ArrowLeft]",command:"extendSelectionBackward"},{key:"shift+[ArrowRight]",command:"extendSelectionForward"},{key:"shift+[ArrowUp]",command:"extendSelectionUpward"},{key:"shift+[ArrowDown]",command:"extendSelectionDownward"},{key:"[Backspace]",command:"deleteBackward"},{key:"alt+[Delete]",command:"deleteBackward"},{key:"[Delete]",command:"deleteForward"},{key:"alt+[Backspace]",command:"deleteForward"},{key:"alt+[ArrowLeft]",command:"moveToPreviousWord"},{key:"alt+[ArrowRight]",command:"moveToNextWord"},{key:"shift+alt+[ArrowLeft]",command:"extendToPreviousWord"},{key:"shift+alt+[ArrowRight]",command:"extendToNextWord"},{key:"ctrl+[ArrowLeft]",command:"moveToGroupStart"},{key:"ctrl+[ArrowRight]",command:"moveToGroupEnd"},{key:"shift+ctrl+[ArrowLeft]",command:"extendToGroupStart"},{key:"shift+ctrl+[ArrowRight]",command:"extendToGroupEnd"},{key:"[Home]",command:"moveToMathfieldStart"},{key:"cmd+[ArrowLeft]",command:"moveToMathfieldStart"},{key:"shift+[Home]",command:"extendToMathFieldStart"},{key:"shift+cmd+[ArrowLeft]",command:"extendToMathFieldStart"},{key:"[End]",command:"moveToMathfieldEnd"},{key:"cmd+[ArrowRight]",command:"moveToMathfieldEnd"},{key:"shift+[End]",command:"extendToMathFieldEnd"},{key:"shift+cmd+[ArrowRight]",command:"extendToMathFieldEnd"},{key:"[Pageup]",command:"moveToGroupStart"},{key:"[Pagedown]",command:"moveToGroupEnd"},{key:"[Tab]",command:"moveToNextGroup"},{key:"shift+[Tab]",command:"moveToPreviousGroup"},{key:"[Escape]",ifMode:"math",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"text",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"latex",command:["complete","complete",{selectItem:"true"}]},{key:"\\",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[IntlBackslash]",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[Tab]",ifMode:"latex",command:["complete","accept-suggestion"]},{key:"[Return]",ifMode:"latex",command:"complete"},{key:"[Enter]",ifMode:"latex",command:"complete"},{key:"shift+[Escape]",ifMode:"latex",command:["complete","reject"]},{key:"[ArrowDown]",ifMode:"latex",command:"nextSuggestion"},{key:"[ArrowUp]",ifMode:"latex",command:"previousSuggestion"},{key:"ctrl+a",ifPlatform:"!macos",command:"selectAll"},{key:"cmd+a",command:"selectAll"},{key:"[Cut]",command:"cutToClipboard"},{key:"[Copy]",command:"copyToClipboard"},{key:"[Paste]",command:"pasteFromClipboard"},{key:"[Clear]",command:"deleteBackward"},{key:"[Undo]",command:"undo"},{key:"[Redo]",command:"redo"},{key:"[EraseEof]",command:"deleteToGroupEnd"},{key:"ctrl+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"cmd+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"ctrl+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"cmd+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"ctrl+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"cmd+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"ctrl+z",ifPlatform:"!macos",command:"undo"},{key:"cmd+z",command:"undo"},{key:"ctrl+y",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+y",command:"redo"},{key:"shift+ctrl+z",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+z",command:"redo"},{key:"ctrl+b",ifPlatform:"macos",command:"moveToPreviousChar"},{key:"ctrl+f",ifPlatform:"macos",command:"moveToNextChar"},{key:"ctrl+p",ifPlatform:"macos",command:"moveUp"},{key:"ctrl+n",ifPlatform:"macos",command:"moveDown"},{key:"ctrl+a",ifPlatform:"macos",command:"moveToMathfieldStart"},{key:"ctrl+e",ifPlatform:"macos",command:"moveToMathfieldEnd"},{key:"shift+ctrl+b",ifPlatform:"macos",command:"extendSelectionBackward"},{key:"shift+ctrl+f",ifPlatform:"macos",command:"extendSelectionForward"},{key:"shift+ctrl+p",ifPlatform:"macos",command:"extendSelectionUpward"},{key:"shift+ctrl+n",ifPlatform:"macos",command:"extendSelectionDownward"},{key:"shift+ctrl+a",ifPlatform:"macos",command:"extendToMathFieldStart"},{key:"shift+ctrl+e",ifPlatform:"macos",command:"extendToMathFieldEnd"},{key:"alt+ctrl+b",ifPlatform:"macos",command:"moveToPreviousWord"},{key:"alt+ctrl+f",ifPlatform:"macos",command:"moveToNextWord"},{key:"shift+alt+ctrl+b",ifPlatform:"macos",command:"extendToPreviousWord"},{key:"shift+alt+ctrl+f",ifPlatform:"macos",command:"extendToNextWord"},{key:"ctrl+h",ifPlatform:"macos",command:"deleteBackward"},{key:"ctrl+d",ifPlatform:"macos",command:"deleteForward"},{key:"ctrl+l",ifPlatform:"macos",command:"scrollIntoView"},{key:"ctrl+[Digit2]",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"ctrl+[Digit5]",ifMode:"math",command:"moveToOpposite"},{key:"ctrl+[Digit6]",ifMode:"math",command:"moveToSuperscript"},{key:"ctrl+[Return]",ifMode:"math",command:"addRowAfter"},{key:"ctrl+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Return]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"alt+p",ifMode:"math",command:["insert","\\pi"]},{key:"alt+v",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"alt+o",ifMode:"math",command:["insert","\\emptyset"]},{key:"alt+d",ifMode:"math",command:["insert","\\differentialD"]},{key:"shift+alt+o",ifMode:"math",command:["insert","\\varnothing"]},{key:"shift+alt+d",ifMode:"math",command:["insert","\\partial"]},{key:"alt+[Backslash]",ifMode:"math",command:["insert","\\backslash"]},{key:"[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#?}{#@}"]},{key:"shift+alt+k",command:"toggleKeystrokeCaption"},{key:"alt+[Space]",command:"toggleContextMenu"},{key:"alt+shift+[Space]",command:"toggleVirtualKeyboard"},{key:"alt+ctrl+[ArrowUp]",command:["speak","all",{withHighlighting:!1}]},{key:"alt+ctrl+[ArrowDown]",command:["speak","selection",{withHighlighting:!1}]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["switchMode","text","",""]},{key:"shift+alt+[KeyT]",ifMode:"math",command:["switchMode","text","",""]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"text",command:["switchMode","math","",""]},{key:"shift+alt+[KeyT]",ifMode:"text",command:["switchMode","math","",""]},{key:"/",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+shift+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrack #0 \\right\\rbrack"]},{key:"ctrl+[Minus]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"moveToSubscript"},{key:"shift+alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrace #0 \\right\\rbrace"]},{key:"ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"shift+ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"shift+cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"ctrl+[Backspace]",ifMode:"math",command:"removeRow"},{key:"cmd+[Backspace]",ifMode:"math",command:"removeRow"},{key:"alt+[Tab]",ifMode:"math",command:"addColumnAfter"},{key:"shift+alt+[Tab]",ifMode:"math",command:"addColumnBefore"},{key:"alt+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Enter]",ifMode:"math",command:"addRowBefore"},{key:"alt+[Return]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Return]",ifMode:"math",command:"addRowBefore"},{key:"shift+[Backspace]",ifMode:"math",command:"removeColumn"},{key:"alt+[Digit5]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","$\\infty"]},{key:"alt+[Digit9]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","("]},{key:"alt+[Digit0]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert",")"]},{key:"alt+|",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","|"]},{key:"shift+[Backquote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\~"]},{key:"[Backquote]",ifLayout:["windows.french","linux.french"],ifMode:"math",command:["insert","^2"]},{key:"[Backquote]",ifLayout:["windows.german","linux.german"],ifMode:"math",command:["insert","^"]},{key:"[IntlBackslash]",ifLayout:["apple.german"],ifMode:"math",command:["insert","^"]}],Qa={"\\sqrt":["alt+v","ctrl+[Digit2]"],"\\pi":"alt+p","\\infty":"alt+[Digit5]","\\differentialD":"alt+d","\\partial":"shift+alt+d","\\frac":"Slash","\\emptyset":"alt+o","\\varnothing":"shift+alt+o","\\~":"~"};function es(e){var t;return(null==(t=e.element)?void 0:t.mathfield)===e}function ts(e){const t=function(e){var t,n;return null!=(n=null!=(t=e.querySelector(".ML__caret"))?t:e.querySelector(".ML__text-caret"))?n:e.querySelector(".ML__latex-caret")}(e);if(!t)return null;const n=t.getBoundingClientRect();return{x:n.right,y:n.bottom,height:n.height}}function ns(e){var t;if(!e.parent)return"root";let n=null!=(t=e.parent.id)?t:"";return n+="string"==typeof e.parentBranch?"-"+e.parentBranch:`-${e.parentBranch[0]}/${e.parentBranch[0]}`,n}function is(e,t,n){if(!t)return null;const i=e.field.getBoundingClientRect(),o=t.right-t.left,r=t.bottom-t.top,a=Math.ceil(t.left-i.left+e.field.scrollLeft*n),s=Math.ceil(t.top-i.top);return{left:a,right:a+o,top:s,bottom:s+r}}function os(e){const t=e.getBoundingClientRect(),n=parseInt(getComputedStyle(e).marginRight),i={top:t.top-1,bottom:t.bottom,left:t.left,right:t.right-1+n};if(0===e.children.length||"SVG"===e.tagName.toUpperCase())return i;for(const t of e.children)if(1===t.nodeType&&"atomId"in t.dataset&&!t.classList.contains("pstrut")){const e=os(t);i.left=Math.min(i.left,e.left),i.right=Math.max(i.right,e.right),i.top=Math.min(i.top,e.top),i.bottom=Math.max(i.bottom,e.bottom)}return i}function rs(e,t){var n,i;if(!t.id)return null;let o=null!=(i=null==(n=e.atomBoundsCache)?void 0:n.get(t.id))?i:null;if(null!==o)return o;const r=e.field.querySelector(`[data-atom-id="${t.id}"]`);return o=r?os(r):null,e.atomBoundsCache&&(o?e.atomBoundsCache.set(t.id,o):e.atomBoundsCache.delete(t.id)),null!=o?o:null}function as(e,t){return e.model.selection.ranges.reduce(((n,i)=>n.concat(...function(e,t,n){const i=new Map;for(const o of e.model.getAtoms(t,{includeChildren:!0})){if((null==n?void 0:n.excludeAtomsWithBackground)&&o.style.backgroundColor)continue;const t=e.field,r=t.offsetWidth;let a=Math.floor(t.getBoundingClientRect().width)/r;a=isNaN(a)?1:a;const s=is(e,rs(e,o),a);if(s){const e=ns(o);if(i.has(e)){const t=i.get(e);i.set(e,{left:Math.min(t.left,s.left),right:Math.max(t.right,s.right),top:Math.min(t.top,s.top),bottom:Math.max(t.bottom,s.bottom)})}else i.set(e,s)}}return[...i.values()]}(e,i,t))),[])}function ss(e,t){return"*"===e||"none"===t||("same-origin"===t?!window.origin||e===window.origin:"function"==typeof t&&t(e))}function ls(e){let t=0,n=0;const i=e.offsetWidth,o=e.offsetHeight;for(;e instanceof HTMLElement;)t+=e.offsetTop,n+=e.offsetLeft,e=e.offsetParent;return new DOMRect(n,t,i,o)}var cs,ds;function hs(e){let t="";switch(e){case"mathfield-element":t="\n :host { display: inline-block; background-color: field; color: fieldtext; border-width: 1px; border-style: solid; border-color: #acacac; border-radius: 2px; padding:4px;}\n :host([hidden]) { display: none; }\n :host([disabled]), :host([disabled]:focus), :host([disabled]:focus-within) { outline: none; opacity: .5; }\n :host(:focus), :host(:focus-within) {\n outline: Highlight auto 1px; /* For Firefox */\n outline: -webkit-focus-ring-color auto 1px;\n }\n :host([readonly]:focus), :host([readonly]:focus-within),\n :host([read-only]:focus), :host([read-only]:focus-within) {\n outline: none;\n }\n @media (hover: none) and (pointer: coarse) {\n :host(:not(:focus)) :first-child { pointer-events: none !important; }\n }";break;case"core":t=".ML__container {\n min-height: auto !important;\n --_hue: var(--hue, 212);\n --_placeholder-color: var(--placeholder-color, hsl(var(--_hue), 40%, 49%));\n --_placeholder-opacity: var(--placeholder-opacity, 0.4);\n --_text-font-family: var(--text-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif);\n}\n.ML__sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.ML__is-inline {\n display: inline-block;\n}\n.ML__base {\n visibility: inherit;\n display: inline-block;\n position: relative;\n cursor: text;\n padding: 0;\n margin: 0;\n box-sizing: content-box;\n border: 0;\n outline: 0;\n vertical-align: baseline;\n font-weight: inherit;\n font-family: inherit;\n font-style: inherit;\n text-decoration: none;\n width: min-content;\n}\n.ML__strut,\n.ML__strut--bottom {\n display: inline-block;\n min-height: 0.5em;\n}\n.ML__small-delim {\n font-family: KaTeX_Main;\n}\n/* Text mode */\n.ML__text {\n font-family: var(--_text-font-family);\n white-space: pre;\n}\n/* Use cmr for 'math upright' */\n.ML__cmr {\n font-family: KaTeX_Main;\n font-style: normal;\n}\n.ML__mathit {\n font-family: KaTeX_Math;\n /* The KaTeX_Math font is italic by default, so the font-style below is only \n useful when a fallback font is used\n */\n font-style: italic;\n}\n.ML__mathbf {\n font-family: KaTeX_Main;\n font-weight: bold;\n}\n/* Lowercase greek symbols should stick to math font when \\mathbf is applied \n to match TeX idiosyncratic behavior */\n.lcGreek.ML__mathbf {\n font-family: KaTeX_Math;\n font-weight: normal;\n}\n.ML__mathbfit {\n font-family: KaTeX_Math;\n font-weight: bold;\n font-style: italic;\n}\n.ML__ams {\n font-family: KaTeX_AMS;\n}\n/* Blackboard */\n.ML__bb {\n font-family: KaTeX_AMS;\n}\n.ML__cal {\n font-family: KaTeX_Caligraphic;\n}\n.ML__frak {\n font-family: KaTeX_Fraktur;\n}\n.ML__tt {\n font-family: KaTeX_Typewriter;\n}\n.ML__script {\n font-family: KaTeX_Script;\n}\n.ML__sans {\n font-family: KaTeX_SansSerif;\n}\n.ML__series_ul {\n font-weight: 100;\n}\n.ML__series_el {\n font-weight: 100;\n}\n.ML__series_l {\n font-weight: 200;\n}\n.ML__series_sl {\n font-weight: 300;\n}\n.ML__series_sb {\n font-weight: 500;\n}\n.ML__bold,\n.ML__boldsymbol {\n font-weight: 700;\n}\n.ML__series_eb {\n font-weight: 800;\n}\n.ML__series_ub {\n font-weight: 900;\n}\n.ML__series_uc {\n font-stretch: ultra-condensed;\n}\n.ML__series_ec {\n font-stretch: extra-condensed;\n}\n.ML__series_c {\n font-stretch: condensed;\n}\n.ML__series_sc {\n font-stretch: semi-condensed;\n}\n.ML__series_sx {\n font-stretch: semi-expanded;\n}\n.ML__series_x {\n font-stretch: expanded;\n}\n.ML__series_ex {\n font-stretch: extra-expanded;\n}\n.ML__series_ux {\n font-stretch: ultra-expanded;\n}\n.ML__it {\n font-style: italic;\n}\n.ML__shape_ol {\n -webkit-text-stroke: 1px black;\n text-stroke: 1px black;\n color: transparent;\n}\n.ML__shape_sc {\n font-variant: small-caps;\n}\n.ML__shape_sl {\n font-style: oblique;\n}\n/* First level emphasis */\n.ML__emph {\n color: #bc2612;\n}\n/* Second level emphasis */\n.ML__emph .ML__emph {\n color: #0c7f99;\n}\n.ML__highlight {\n color: #007cb2;\n background: #edd1b0;\n}\n.ML__center {\n text-align: center;\n}\n.ML__label_padding {\n padding: 0 0.5em;\n}\n.ML__frac-line {\n width: 100%;\n min-height: 1px;\n}\n.ML__frac-line:after {\n content: '';\n display: block;\n margin-top: max(-1px, -0.04em);\n min-height: max(1px, 0.04em);\n /* Ensure the line is visible when printing even if \"turn off background images\" is on*/\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n /* There's a bug since Chrome 62 where \n sub-pixel border lines don't draw at some zoom \n levels (110%, 90%). \n Setting the min-height used to work around it, but that workaround\n broke in Chrome 84 or so.\n Setting the background (and the min-height) seems to work for now.\n */\n background: currentColor;\n box-sizing: content-box;\n /* Vuetify sets the box-sizing to inherit \n causes the fraction line to not draw at all sizes (see #26) */\n /* On some versions of Firefox on Windows, the line fails to \n draw at some zoom levels, but setting the transform triggers\n the hardware accelerated path, which works */\n transform: translate(0, 0);\n}\n.ML__sqrt {\n display: inline-block;\n}\n.ML__sqrt-sign {\n display: inline-block;\n position: relative;\n}\n.ML__sqrt-line {\n display: inline-block;\n height: max(1px, 0.04em);\n width: 100%;\n}\n.ML__sqrt-line:before {\n content: '';\n display: block;\n margin-top: min(-1px, -0.04em);\n min-height: max(1px, 0.04em);\n /* Ensure the line is visible when printing even if \"turn off background images\" is on*/\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n background: currentColor;\n /* On some versions of Firefox on Windows, the line fails to \n draw at some zoom levels, but setting the transform triggers\n the hardware accelerated path, which works */\n transform: translate(0, 0);\n}\n.ML__sqrt-line:after {\n border-bottom-width: 1px;\n content: ' ';\n display: block;\n margin-top: -0.1em;\n}\n.ML__sqrt-index {\n margin-left: 0.27777778em;\n margin-right: -0.55555556em;\n}\n.ML__delim-size1 {\n font-family: KaTeX_Size1;\n}\n.ML__delim-size2 {\n font-family: KaTeX_Size2;\n}\n.ML__delim-size3 {\n font-family: KaTeX_Size3;\n}\n.ML__delim-size4 {\n font-family: KaTeX_Size4;\n}\n.ML__delim-mult .delim-size1 > span {\n font-family: KaTeX_Size1;\n}\n.ML__delim-mult .delim-size4 > span {\n font-family: KaTeX_Size4;\n}\n.ML__accent-body > span {\n font-family: KaTeX_Main;\n width: 0;\n}\n.ML__accent-vec {\n position: relative;\n left: 0.24em;\n}\n/** The markup for a LaTeX formula, either in an editable mathfield or \n in a static display.\n*/\n.ML__latex {\n display: inline-block;\n direction: ltr;\n text-align: left;\n text-indent: 0;\n text-rendering: auto;\n font-family: KaTeX_Main, 'Times New Roman', serif;\n font-style: normal;\n font-size-adjust: none;\n font-stretch: normal;\n font-variant-caps: normal;\n letter-spacing: normal;\n line-height: 1.2;\n word-wrap: normal;\n word-spacing: normal;\n white-space: nowrap;\n text-shadow: none;\n -webkit-user-select: none;\n user-select: none;\n width: min-content;\n}\n.ML__latex .style-wrap {\n position: relative;\n}\n.ML__latex .mfrac {\n display: inline-block;\n}\n.ML__latex .left-right {\n display: inline-block;\n}\n.ML__latex .vlist-t {\n display: inline-table;\n table-layout: fixed;\n border-collapse: collapse;\n}\n.ML__latex .vlist-r {\n display: table-row;\n}\n.ML__latex .vlist {\n display: table-cell;\n vertical-align: bottom;\n position: relative;\n}\n.ML__latex .vlist > span {\n display: block;\n height: 0;\n position: relative;\n}\n.ML__latex .vlist > span > span {\n display: inline-block;\n}\n.ML__latex .vlist > span > .pstrut {\n overflow: hidden;\n width: 0;\n}\n.ML__latex .vlist-t2 {\n margin-right: -2px;\n}\n.ML__latex .vlist-s {\n display: table-cell;\n vertical-align: bottom;\n font-size: 1px;\n width: 2px;\n min-width: 2px;\n}\n.ML__latex .msubsup {\n text-align: left;\n}\n.ML__latex .negativethinspace {\n display: inline-block;\n margin-left: -0.16667em;\n height: 0.71em;\n}\n.ML__latex .thinspace {\n display: inline-block;\n width: 0.16667em;\n height: 0.71em;\n}\n.ML__latex .mediumspace {\n display: inline-block;\n width: 0.22222em;\n height: 0.71em;\n}\n.ML__latex .thickspace {\n display: inline-block;\n width: 0.27778em;\n height: 0.71em;\n}\n.ML__latex .enspace {\n display: inline-block;\n width: 0.5em;\n height: 0.71em;\n}\n.ML__latex .quad {\n display: inline-block;\n width: 1em;\n height: 0.71em;\n}\n.ML__latex .qquad {\n display: inline-block;\n width: 2em;\n height: 0.71em;\n}\n.ML__latex .llap,\n.ML__latex .rlap {\n width: 0;\n position: relative;\n display: inline-block;\n}\n.ML__latex .llap > .inner,\n.ML__latex .rlap > .inner {\n position: absolute;\n}\n.ML__latex .llap > .fix,\n.ML__latex .rlap > .fix {\n display: inline-block;\n}\n.ML__latex .llap > .inner {\n right: 0;\n}\n.ML__latex .rlap > .inner {\n left: 0;\n}\n.ML__latex .rule {\n display: inline-block;\n border: solid 0;\n position: relative;\n box-sizing: border-box;\n}\n.ML__latex .overline .overline-line,\n.ML__latex .underline .underline-line {\n width: 100%;\n}\n.ML__latex .overline .overline-line:before,\n.ML__latex .underline .underline-line:before {\n content: '';\n border-bottom-style: solid;\n border-bottom-width: max(1px, 0.04em);\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n display: block;\n}\n.ML__latex .overline .overline-line:after,\n.ML__latex .underline .underline-line:after {\n border-bottom-style: solid;\n border-bottom-width: max(1px, 0.04em);\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n content: '';\n display: block;\n margin-top: -1px;\n}\n.ML__latex .stretchy {\n display: block;\n position: absolute;\n width: 100%;\n left: 0;\n overflow: hidden;\n}\n.ML__latex .stretchy:before,\n.ML__latex .stretchy:after {\n content: '';\n}\n.ML__latex .stretchy svg {\n display: block;\n position: absolute;\n width: 100%;\n height: inherit;\n fill: currentColor;\n stroke: currentColor;\n fill-rule: nonzero;\n fill-opacity: 1;\n stroke-width: 1;\n stroke-linecap: butt;\n stroke-linejoin: miter;\n stroke-miterlimit: 4;\n stroke-dasharray: none;\n stroke-dashoffset: 0;\n stroke-opacity: 1;\n}\n.ML__latex .slice-1-of-2 {\n display: inline-flex;\n position: absolute;\n left: 0;\n width: 50.2%;\n overflow: hidden;\n}\n.ML__latex .slice-2-of-2 {\n display: inline-flex;\n position: absolute;\n right: 0;\n width: 50.2%;\n overflow: hidden;\n}\n.ML__latex .slice-1-of-3 {\n display: inline-flex;\n position: absolute;\n left: 0;\n width: 25.1%;\n overflow: hidden;\n}\n.ML__latex .slice-2-of-3 {\n display: inline-flex;\n position: absolute;\n left: 25%;\n width: 50%;\n overflow: hidden;\n}\n.ML__latex .slice-3-of-3 {\n display: inline-flex;\n position: absolute;\n right: 0;\n width: 25.1%;\n overflow: hidden;\n}\n.ML__latex .slice-1-of-1 {\n display: inline-flex;\n position: absolute;\n width: 100%;\n left: 0;\n overflow: hidden;\n}\n.ML__latex .nulldelimiter {\n display: inline-block;\n}\n.ML__latex .op-group {\n display: inline-block;\n}\n.ML__latex .op-symbol {\n position: relative;\n}\n.ML__latex .op-symbol.small-op {\n font-family: KaTeX_Size1;\n}\n.ML__latex .op-symbol.large-op {\n font-family: KaTeX_Size2;\n}\n.ML__latex .mtable .vertical-separator {\n display: inline-block;\n min-width: 1px;\n box-sizing: border-box;\n}\n.ML__latex .mtable .arraycolsep {\n display: inline-block;\n}\n.ML__latex .mtable .col-align-m > .vlist-t {\n text-align: center;\n}\n.ML__latex .mtable .col-align-c > .vlist-t {\n text-align: center;\n}\n.ML__latex .mtable .col-align-l > .vlist-t {\n text-align: left;\n}\n.ML__latex .mtable .col-align-r > .vlist-t {\n text-align: right;\n}\n.ML__error {\n display: inline-block;\n background-image: radial-gradient(ellipse at center, hsl(341, 100%, 40%), rgba(0, 0, 0, 0) 70%);\n background-color: hsla(341, 100%, 40%, 0.1);\n background-repeat: repeat-x;\n background-size: 3px 3px;\n padding-bottom: 3px;\n background-position: 0 100%;\n}\n.ML__error > .ML__error {\n background: transparent;\n padding: 0;\n}\n.ML__placeholder {\n color: var(--_placeholder-color);\n opacity: var(--_placeholder-opacity);\n padding-left: 0.4ex;\n padding-right: 0.4ex;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n}\n.ML__notation {\n position: absolute;\n box-sizing: border-box;\n line-height: 0;\n}\n/* This class is used to implement the `\\mathtip` and `\\texttip` commands\n For UI elements, see `[data-ML__tooltip]`\n*/\n.ML__tooltip-container {\n position: relative;\n transform: scale(0);\n}\n.ML__tooltip-container .ML__tooltip-content {\n position: fixed;\n display: inline-table;\n visibility: hidden;\n z-index: 2;\n width: max-content;\n max-width: 400px;\n padding: 12px 12px;\n border-radius: 8px;\n background: #616161;\n --_selection-color: #fff;\n color: #fff;\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);\n opacity: 0;\n transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1);\n}\n.ML__tooltip-container .ML__tooltip-content .ML__text {\n white-space: normal;\n}\n.ML__tooltip-container .ML__tooltip-content .ML__base {\n display: contents;\n}\n.ML__tooltip-container:hover .ML__tooltip-content {\n visibility: visible;\n opacity: 1;\n font-size: 0.75em;\n transform: scale(1) translate(0, 3em);\n}\n";break;case"mathfield":t="@keyframes ML__caret-blink {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n}\n.ML__container {\n display: inline-flex;\n flex-flow: row;\n justify-content: space-between;\n align-items: flex-end;\n min-height: 39px;\n /* Need some room for the virtual keyboard toggle */\n width: 100%;\n /* Encourage browsers to consider allocating a hardware accelerated\n layer for this element. */\n isolation: isolate;\n /* Prevent the browser from trying to interpret touch gestures in the field */\n /* \"Disabling double-tap to zoom removes the need for browsers to\n delay the generation of click events when the user taps the screen.\" */\n touch-action: none;\n --_caret-color: var(--caret-color, hsl(var(--_hue), 40%, 49%));\n --_selection-color: var(--selection-color, #000);\n --_selection-background-color: var(--selection-background-color, hsl(var(--_hue), 70%, 85%));\n --_text-highlight-background-color: var(--highlight-text, hsla(var(--_hue), 40%, 50%, 0.1));\n --_contains-highlight-background-color: var(--contains-highlight-background-color, hsl(var(--_hue), 40%, 95%));\n --_smart-fence-color: var(--smart-fence-color, currentColor);\n --_smart-fence-opacity: var(--smart-fence-opacity, 0.5);\n --_latex-color: var(--latex-color, hsl(var(--_hue), 80%, 40%));\n --_correct-color: var(--correct-color, #10a000);\n --_incorrect-color: var(--incorrect-color, #a01b00);\n --_composition-background-color: var(--composition-background-color, #fff1c2);\n --_composition-text-color: var(--composition-text-color, black);\n --_composition-underline-color: var(--composition-underline-color, transparent);\n}\n/* This is the actual field content (formula) */\n.ML__content {\n display: flex;\n align-items: center;\n align-self: center;\n position: relative;\n overflow: hidden;\n padding: 2px 3px 2px 1px;\n width: 100%;\n}\n.ML__virtual-keyboard-toggle,\n.ML__menu-toggle {\n box-sizing: border-box;\n display: flex;\n align-self: center;\n align-items: center;\n flex-shrink: 0;\n flex-direction: column;\n justify-content: center;\n width: 34px;\n height: 34px;\n padding: 0;\n margin-right: 4px;\n cursor: pointer;\n /* Avoid some weird blinking with :hover */\n border-radius: 8px;\n border: 1px solid transparent;\n transition: background 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);\n color: hsl(var(--_hue), 40%, 50%);\n fill: currentColor;\n background: transparent;\n}\n.ML__virtual-keyboard-toggle:hover,\n.ML__menu-toggle:hover {\n background: hsla(0, 0%, 70%, 0.3);\n color: #333;\n fill: currentColor;\n}\n.ML__virtual-keyboard-toggle > span,\n.ML__menu-toggle > span {\n display: flex;\n align-self: center;\n align-items: center;\n}\n/* The invisible element used to capture keyboard events. We're just trying\n really hard to make sure it doesn't show. */\n.ML__keyboard-sink {\n display: inline-block;\n resize: none;\n outline: none;\n border: none;\n /* Need these for Microsoft Edge */\n position: fixed;\n clip: rect(0 0 0 0);\n /* Need this to prevent iOS Safari from auto-zooming */\n font-size: 1em;\n font-family: KaTeX_Main;\n line-height: 0.5;\n /* On Chromium, if this is 0, no keyboard events are received */\n}\n[part=\"placeholder\"] {\n color: var(--neutral-400);\n}\n.ML__composition {\n background: var(--_composition-background-color);\n color: var(--_composition-text-color);\n text-decoration: underline var(--_composition-underline-color);\n}\n.ML__caret::after {\n content: '';\n visibility: hidden;\n width: 0;\n display: inline-block;\n height: 0.76em;\n --_caret-width: clamp(2px, 0.08em, 10px);\n border: none;\n border-radius: calc(var(--_caret-width) / 2);\n border-right: var(--_caret-width) solid var(--_caret-color);\n margin-right: calc(-1 * var(--_caret-width));\n position: relative;\n left: -0.045em;\n bottom: -0.05em;\n animation: ML__caret-blink 1.05s step-end forwards infinite;\n}\n.ML__text-caret::after {\n content: '';\n visibility: hidden;\n width: 0;\n display: inline-block;\n height: 0.76em;\n --_caret-width: clamp(2px, 0.08em, 10px);\n border: none;\n border-radius: calc(var(--_caret-width) / 2);\n border-right: var(--_caret-width) solid var(--_caret-color);\n margin-right: calc(-1 * var(--_caret-width));\n position: relative;\n left: -0.045em;\n bottom: -0.05em;\n animation: ML__caret-blink 1.05s step-end forwards infinite;\n}\n.ML__latex-caret::after {\n content: '';\n visibility: hidden;\n --_caret-width: clamp(2px, 0.08em, 10px);\n border: none;\n border-radius: calc(var(--_caret-width) / 2);\n border-right: var(--_caret-width) solid var(--_latex-color);\n margin-right: calc(-1 * var(--_caret-width));\n position: relative;\n left: -0.019em;\n animation: ML__caret-blink 1.05s step-end forwards infinite;\n}\n.ML__focused .ML__latex-caret::after,\n.ML__focused .ML__text-caret::after,\n.ML__focused .ML__caret::after {\n visibility: visible;\n}\n.ML__focused .ML__text {\n background: var(--_text-highlight-background-color);\n}\n/* When using smartFence, the anticipated closing fence is displayed\nwith this style */\n.ML__smart-fence__close {\n opacity: var(--_smart-fence-opacity);\n color: var(--_smart-fence-color);\n}\n.ML__selected,\n.ML__focused .ML__selected .ML__contains-caret,\n.ML__focused .ML__selected .ML__smart-fence__close,\n.ML__focused .ML__selected .ML__placeholder {\n color: var(--_selection-color);\n opacity: 1;\n}\n.ML__selection {\n box-sizing: border-box;\n background: var(--_selection-background-color) !important;\n}\n.ML__contains-caret.ML__close,\n.ML__contains-caret.ML__open,\n.ML__contains-caret > .ML__close,\n.ML__contains-caret > .ML__open,\n.ML__contains-caret .ML__sqrt-sign,\n.ML__contains-caret .ML__sqrt-line {\n color: var(--_caret-color);\n}\n.ML__contains-highlight {\n box-sizing: border-box;\n background: transparent;\n}\n.ML__focused .ML__contains-highlight {\n background: var(--_contains-highlight-background-color);\n}\n.ML__raw-latex {\n font-family: 'Berkeley Mono', 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;\n font-weight: 400;\n font-size: 0.8em;\n letter-spacing: -0.05em;\n color: var(--_latex-color);\n}\n.ML__suggestion {\n color: var(--neutral-500);\n}\n.ML__virtual-keyboard-toggle.is-visible.is-pressed:hover {\n background: hsl(var(--_hue), 25%, 35%);\n color: #fafafa;\n fill: currentColor;\n}\n.ML__virtual-keyboard-toggle:focus {\n outline: none;\n border-radius: 8px;\n border: 2px solid hsl(var(--_hue), 40%, 50%);\n}\n.ML__virtual-keyboard-toggle.is-pressed,\n.ML__virtual-keyboard-toggle.is-active:hover,\n.ML__virtual-keyboard-toggle.is-active {\n background: hsl(var(--_hue), 25%, 35%);\n color: #fafafa;\n fill: currentColor;\n}\n/* Add an attribute 'data-tooltip' to automatically show a\n tooltip over a element on hover.\n*/\n[data-tooltip] {\n position: relative;\n}\n[data-tooltip]::after {\n content: attr(data-tooltip);\n position: absolute;\n display: block;\n z-index: 2;\n pointer-events: none;\n right: auto;\n top: calc(-100% - 4px);\n width: max-content;\n max-width: 200px;\n padding: 8px 8px;\n border-radius: 4px;\n background: #616161;\n color: #fff;\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);\n text-align: center;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n font-style: normal;\n font-weight: 400;\n font-size: 13px;\n /* Phone */\n opacity: 0;\n transform: scale(0.5);\n}\n@media only screen and (max-width: 767px) {\n [data-tooltip]::after {\n padding: 8px 16px;\n font-size: 16px;\n }\n}\nmenu [data-tooltip]::after {\n left: 100%;\n top: 0%;\n}\nmenu .ML__base {\n cursor: default;\n}\n/** Don't display if we're tracking, i.e. have the pointer down */\n.tracking [data-tooltip]:hover::after {\n /* Use visibility, not display. Display will remove the after from the DOM, and the override below will not work */\n visibility: hidden;\n}\n/** But do display if tracking and inside a menu */\n.tracking menu li[data-tooltip]:hover::after,\n[data-tooltip]:hover::after {\n visibility: visible;\n opacity: 1;\n transform: scale(1);\n transition-property: opacity, scale;\n transition-duration: 0.15s;\n transition-delay: 1s;\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n}\n.ML__prompt {\n border-radius: 2px;\n}\n.ML__editablePromptBox {\n outline: 1px solid #acacac;\n border-radius: 2px;\n z-index: -1;\n}\n.ML__focusedPromptBox {\n outline: highlight auto 1px;\n}\n.ML__lockedPromptBox {\n background-color: rgba(142, 142, 141, 0.4);\n z-index: -1;\n}\n.ML__correctPromptBox {\n outline: 1px solid var(--_correct-color);\n box-shadow: 0 0 5px var(--_correct-color);\n}\n.ML__incorrectPromptBox {\n outline: 1px solid var(--_incorrect-color);\n box-shadow: 0 0 5px var(--_incorrect-color);\n}\n.variant-submenu {\n display: flex;\n flex-direction: column;\n padding: 8px;\n}\n.variant-submenu [part=menu-item] {\n font-size: 2rem;\n text-align: center;\n margin: 0;\n}\n.insert-matrix-submenu {\n display: grid;\n padding: 8px;\n align-content: center;\n justify-content: center;\n grid-template-columns: repeat(5, minmax(0, 1fr));\n}\n.insert-matrix-submenu [part=menu-item] {\n font-size: 21px;\n border: none;\n border-radius: 0;\n line-height: 21px;\n text-align: center;\n padding: 0;\n margin: 0;\n}\n.border-submenu [part=menu-item] {\n font-size: 2rem;\n line-height: 1.2;\n text-align: center;\n}\n.swatches-submenu {\n --_swatch-size: 2rem;\n --_columns: 4;\n display: flex;\n flex-flow: wrap;\n padding: 8px;\n max-width: calc(var(--_columns) * (var(--_swatch-size) + 18px) + 16px);\n box-sizing: border-box;\n}\n.menu-swatch {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: fit-content;\n height: fit-content;\n margin: 2px;\n padding: 0;\n background: var(--neutral-200);\n}\n.menu-swatch > .label {\n padding: 0;\n margin: 0;\n line-height: 0;\n}\n.menu-swatch > .label > span {\n display: inline-block;\n margin: 6px;\n min-width: var(--_swatch-size);\n min-height: var(--_swatch-size);\n border-radius: 50%;\n}\n.menu-swatch.active {\n background: var(--neutral-100);\n scale: 1.4;\n}\n.menu-swatch.active > .label > span {\n border-radius: 2px;\n}\n.menu-swatch .ui-checkmark,\n.menu-swatch .ui-mixedmark {\n position: absolute;\n margin: 0;\n padding: 0;\n color: white;\n}\n.menu-swatch.dark-contrast .ui-checkmark,\n.menu-swatch.dark-contrast .ui-mixedmark {\n color: #000;\n}\n";break;case"environment-popover":t="#mathlive-environment-popover.is-visible {\n visibility: visible;\n}\n#mathlive-environment-popover {\n --_environment-panel-height: var(--environment-panel-height, 70px);\n --_accent-color: var(--accent-color, #aaa);\n --_background: var(--environment-panel-background, #fff);\n --_button-background: var(--environment-panel-button-background, white);\n --_button-background-hover: var(--environment-panel-button-background-hover, #f5f5f7);\n --_button-background-active: var(--environment-panel-button-background-active, #f5f5f7);\n --_button-text: var(--environment-panel-button-text, #e3e4e8);\n position: absolute;\n width: calc(var(--_environment-panel-height) * 2);\n height: var(--_environment-panel-height);\n border-radius: 4px;\n border: 1.5px solid var(--_accent-color);\n background-color: var(--_background);\n box-shadow: 0 0 30px 0 var(--environment-shadow, rgba(0, 0, 0, 0.4));\n pointer-events: all;\n visibility: hidden;\n}\n#mathlive-environment-popover .MLEP__array-buttons {\n height: calc(var(--_environment-panel-height) * 5/4);\n width: calc(var(--_environment-panel-height) * 5/4);\n margin-left: calc(0px - var(--_environment-panel-height) * 0.16);\n margin-top: calc(0px - var(--_environment-panel-height) * 0.19);\n}\n#mathlive-environment-popover .MLEP__array-buttons .font {\n fill: white;\n}\n#mathlive-environment-popover .MLEP__array-buttons circle {\n fill: #7f7f7f;\n transition: fill 300ms;\n}\n#mathlive-environment-popover .MLEP__array-buttons .MLEP__array-insert-background {\n fill-opacity: 1;\n fill: var(--_background);\n stroke: var(--_accent-color);\n stroke-width: 3px;\n}\n#mathlive-environment-popover .MLEP__array-buttons line {\n stroke: var(--_accent-color);\n stroke-opacity: 0;\n stroke-width: 40;\n pointer-events: none;\n transition: stroke-opacity 300ms;\n stroke-linecap: round;\n}\n#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover circle {\n fill: var(--_accent-color);\n}\n#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover line {\n stroke-opacity: 1;\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls {\n height: 100%;\n width: 50%;\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options {\n width: var(--_environment-panel-height);\n height: var(--_environment-panel-height);\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n justify-content: space-around;\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg {\n pointer-events: all;\n margin-top: 2px;\n width: calc(var(--_environment-panel-height) / 3 * 28 / 24);\n height: calc(var(--_environment-panel-height) / 3 - 2px);\n border-radius: calc(var(--_environment-panel-height) / 25);\n background-color: var(--_button-background);\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg:hover {\n background-color: var(--_button-background-hover);\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path,\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg line {\n stroke: var(--_button-text);\n stroke-width: 2;\n stroke-linecap: round;\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg rect,\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path {\n fill-opacity: 0;\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active {\n pointer-events: none;\n background-color: var(--_button-background-active);\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active path,\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active line {\n stroke: var(--_accent-color);\n}\n#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active circle {\n fill: var(--_accent-color);\n}\n";break;case"suggestion-popover":t="/* The element that display info while in latex mode */\n#mathlive-suggestion-popover {\n background-color: rgba(97, 97, 97);\n color: #fff;\n text-align: center;\n border-radius: 8px;\n position: fixed;\n z-index: 1;\n display: none;\n flex-direction: column;\n justify-content: center;\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n#mathlive-suggestion-popover.top-tip::after {\n content: '';\n position: absolute;\n top: -15px;\n left: calc(50% - 15px);\n width: 0;\n height: 0;\n border-left: 15px solid transparent;\n border-right: 15px solid transparent;\n border-bottom: 15px solid rgba(97, 97, 97);\n font-size: 1rem;\n}\n#mathlive-suggestion-popover.bottom-tip::after {\n content: '';\n position: absolute;\n bottom: -15px;\n left: calc(50% - 15px);\n width: 0;\n height: 0;\n border-left: 15px solid transparent;\n border-right: 15px solid transparent;\n border-top: 15px solid rgba(97, 97, 97);\n font-size: 1rem;\n}\n#mathlive-suggestion-popover.is-animated {\n transition: all 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);\n animation: ML__fade-in cubic-bezier(0, 0, 0.2, 1) 0.15s;\n}\n#mathlive-suggestion-popover.is-visible {\n display: flex;\n}\n@keyframes ML__fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n/* The wrapper class for the entire content of the popover panel */\n#mathlive-suggestion-popover ul {\n display: flex;\n flex-flow: column;\n list-style: none;\n margin: 0;\n padding: 0;\n align-items: flex-start;\n max-height: 400px;\n overflow-y: auto;\n}\n#mathlive-suggestion-popover li {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n margin: 8px;\n padding: 8px;\n width: calc(100% - 16px - 16px);\n column-gap: 1em;\n border-radius: 8px;\n cursor: pointer;\n /* Since the content can be clicked on, provide feedback on hover */\n}\n#mathlive-suggestion-popover li a {\n color: #5ea6fd;\n padding-top: 0.3em;\n margin-top: 0.4em;\n display: block;\n}\n#mathlive-suggestion-popover li a:hover {\n color: #5ea6fd;\n text-decoration: underline;\n}\n#mathlive-suggestion-popover li:hover,\n#mathlive-suggestion-popover li.is-pressed,\n#mathlive-suggestion-popover li.is-active {\n background: rgba(255, 255, 255, 0.1);\n}\n/* The command inside a popover (inside a #mathlive-suggestion-popover) */\n.ML__popover__command {\n font-size: 1.6rem;\n font-family: KaTeX_Main;\n}\n.ML__popover__current {\n background: #5ea6fd;\n color: #fff;\n}\n.ML__popover__latex {\n font-family: 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;\n align-self: center;\n}\n/* The keyboard shortcuts for a symbol as displayed in the popover */\n.ML__popover__keybinding {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n font-size: 0.8em;\n opacity: 0.7;\n}\n/* Style for the character that joins the modifiers of a keyboard shortcut \n(usually a \"+\" sign)*/\n.ML__shortcut-join {\n opacity: 0.5;\n}\n";break;case"keystroke-caption":t="/* The element that displays the keys as the user type them */\n#mathlive-keystroke-caption-panel {\n visibility: hidden;\n /*min-width: 160px;*/\n /*background-color: rgba(97, 97, 200, .95);*/\n background: var(--secondary, hsl(var(--_hue), 19%, 26%));\n border-color: var(--secondary-border, hsl(0, 0%, 91%));\n box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);\n text-align: center;\n border-radius: 6px;\n padding: 16px;\n position: absolute;\n z-index: 1;\n display: flex;\n flex-direction: row-reverse;\n justify-content: center;\n --keystroke: white;\n --on-keystroke: #555;\n --keystroke-border: #f7f7f7;\n}\n@media (prefers-color-scheme: dark) {\n body:not([theme='light']) #mathlive-keystroke-caption-panel {\n --keystroke: hsl(var(--_hue), 50%, 30%);\n --on-keystroke: hsl(0, 0%, 98%);\n --keystroke-border: hsl(var(--_hue), 50%, 25%);\n }\n}\nbody[theme='dark'] #mathlive-keystroke-caption-panel {\n --keystroke: hsl(var(--_hue), 50%, 30%);\n --on-keystroke: hsl(0, 0%, 98%);\n --keystroke-border: hsl(var(--_hue), 50%, 25%);\n}\n#mathlive-keystroke-caption-panel > span {\n min-width: 14px;\n /*height: 8px;*/\n margin: 0 8px 0 0;\n padding: 4px;\n background-color: var(--keystroke);\n color: var(--on-keystroke);\n fill: currentColor;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n font-size: 1em;\n border-radius: 6px;\n border: 2px solid var(--keystroke-border);\n /*box-shadow: 0 7px 14px rgba(0,0,0,0.25), 0 5px 5px rgba(0,0,0,0.22);*/\n}\n";break;case"virtual-keyboard":t=".ML__keyboard {\n --_keyboard-height: 0;\n --_keyboard-zindex: var(--keyboard-zindex, 105);\n --_accent-color: var(--keyboard-accent-color, #0c75d8);\n --_background: var(--keyboard-background, #cacfd7);\n --_border: var(--keyboard-border, #ddd);\n --_padding-horizontal: var(--keyboard-padding-horizontal, 0px);\n --_padding-top: var(--keyboard-padding-top, 5px);\n --_padding-bottom: var(--keyboard-padding-bottom, 0px);\n --_row-padding-left: var(--keyboard-row-padding-left, 0px);\n --_row-padding-right: var(--keyboard-row-padding-right, 0px);\n --_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);\n --_toolbar-text-active: var(--keyboard-toolbar-text-active, var(--_accent-color));\n --_toolbar-background: var(--keyboard-toolbar-background, transparent);\n --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);\n --_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);\n --_toolbar-font-size: var(--keyboard-toolbar-font-size, '135%');\n --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);\n --_keycap-background: var(--keycap-background, white);\n --_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);\n --_keycap-background-active: var(--keycap-background-active, var(--_accent-color));\n --_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));\n --_keycap-border: var(--keycap-border, #e5e6e9);\n --_keycap-border-bottom: var(--keycap-border-bottom, #8d8f92);\n --_keycap-text: var(--keycap-text, #000);\n --_keycap-text-active: var(--keycap-text-active, #fff);\n --_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));\n --_keycap-text-pressed: var(--keycap-text-pressed, #fff);\n --_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));\n --_keycap-primary-background: var(--keycap-primary-background, var(--_accent-color));\n --_keycap-primary-text: var(--keycap-primary-text, #ddd);\n --_keycap-primary-background-hover: var(--keycap-primary-background-hover, #0d80f2);\n --_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);\n --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);\n --_keycap-secondary-text: var(--keycap-secondary-text, #060707);\n --_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);\n --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);\n --_keycap-height: var(--keycap-height, 60px);\n /* Keycap width (incl. margin) */\n --_keycap-max-width: var(--keycap-max-width, 100px);\n --_keycap-gap: var(--keycap-gap, 8px);\n --_keycap-font-size: var(--keycap-font-size, clamp(16px, 4cqw, 24px));\n --_keycap-small-font-size: var(--keycap-small-font-size, calc(var(--keycap-font-size) * 0.8));\n --_keycap-extra-small-font-size: var(--keycap-extra-small-font-size, calc(var(--keycap-font-size) / 1.42));\n --_variant-panel-background: var(--variant-panel-background, #fff);\n --_variant-keycap-text: var(--variant-keycap-text, var(--_keycap-text));\n --_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));\n --_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));\n --_variant-keycap-length: var(--variant-keycap-length, 70px);\n --_variant-keycap-font-size: var(--variant-keycap-font-size, 30px);\n --_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 12px);\n --_keycap-shift-font-size: var(--keycap-shift-font-size, 16px);\n --_keycap-shift-color: var(--keycap-shift-color, var(--_accent-color));\n --_box-placeholder-color: var(--box-placeholder-color, var(--_accent-color));\n --_box-placeholder-pressed-color: var(--box-placeholder-pressed-color, var(--keycap-text-pressed));\n}\n.is-math-mode .MLK__rows .if-text-mode,\n.is-text-mode .MLK__rows .if-math-mode {\n display: none;\n}\n.if-can-undo,\n.if-can-redo,\n.if-can-copy,\n.if-can-cut,\n.if-can-paste {\n opacity: 0.4;\n pointer-events: none;\n}\n.can-undo .if-can-undo,\n.can-redo .if-can-redo,\n.can-copy .if-can-copy,\n.can-cut .if-can-cut,\n.can-paste .if-can-paste {\n opacity: 1;\n pointer-events: all;\n}\nbody > .ML__keyboard {\n position: fixed;\n --_padding-bottom: calc(var(--keyboard-padding-bottom, 0px) + env(safe-area-inset-bottom, 0));\n}\nbody > .ML__keyboard.is-visible > .MLK__backdrop {\n box-shadow: 0 -5px 6px rgba(0, 0, 0, 0.08);\n border-top: 1px solid var(--_border);\n}\nbody > .ML__keyboard.backdrop-is-transparent.is-visible > .MLK__backdrop {\n box-shadow: none;\n border: none;\n}\nbody > .ML__keyboard.is-visible.animate > .MLK__backdrop {\n transition: 0.28s cubic-bezier(0, 0, 0.2, 1);\n transition-property: transform, opacity;\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n}\n.ML__keyboard {\n position: relative;\n overflow: hidden;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n z-index: var(--_keyboard-zindex);\n box-sizing: border-box;\n outline: none;\n border: none;\n margin: 0;\n padding: 0;\n line-height: 1;\n overflow-wrap: unset;\n text-align: left;\n vertical-align: baseline;\n cursor: auto;\n white-space: pre;\n box-shadow: none;\n opacity: 1;\n transform: none;\n pointer-events: none;\n}\n.ML__keyboard :where(div) {\n box-sizing: border-box;\n outline: none;\n border: none;\n margin: 0;\n padding: 0;\n line-height: 1;\n overflow-wrap: unset;\n text-align: left;\n vertical-align: baseline;\n cursor: auto;\n white-space: pre;\n box-shadow: none;\n transform: none;\n}\n.MLK__backdrop {\n position: absolute;\n bottom: calc(-1 * var(--_keyboard-height));\n width: 100%;\n height: var(--_keyboard-height);\n box-sizing: border-box;\n padding-top: var(--_padding-top);\n padding-bottom: var(--_padding-bottom);\n padding-left: var(--_padding-horizontal);\n padding-right: var(--_padding-horizontal);\n opacity: 0;\n visibility: hidden;\n transform: translate(0, 0);\n background: var(--_background);\n}\n.backdrop-is-transparent .MLK__backdrop {\n background: transparent;\n}\n/* If a custom layout has a custom container/backdrop\n (backdrop-is-transparent), make sure to let pointer event go through. */\n.backdrop-is-transparent .MLK__plate {\n background: transparent;\n pointer-events: none;\n}\n/* If a custom layout has a custom container/backdrop, make sure to \n allow pointer events on it. */\n.backdrop-is-transparent .MLK__layer > div > div {\n pointer-events: all;\n}\n.ML__keyboard.is-visible > .MLK__backdrop {\n transform: translate(0, calc(-1 * var(--_keyboard-height)));\n opacity: 1;\n visibility: visible;\n}\n.caps-lock-indicator {\n display: none;\n width: 8px;\n height: 8px;\n background: #0cbc0c;\n box-shadow: inset 0 0 4px 0 #13ca13, 0 0 4px 0 #a9ef48;\n border-radius: 8px;\n right: 8px;\n top: 8px;\n position: absolute;\n}\n.ML__keyboard.is-caps-lock .caps-lock-indicator {\n display: block;\n}\n.ML__keyboard.is-caps-lock .shift {\n background: var(--_keycap-background-active);\n color: var(--_keycap-text-active);\n}\n.MLK__plate {\n position: absolute;\n top: var(--_padding-top);\n left: var(--_padding-horizontal);\n width: calc(100% - 2 * var(--_padding-horizontal));\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n container-type: inline-size;\n touch-action: none;\n -webkit-user-select: none;\n user-select: none;\n pointer-events: all;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n font-size: 16px;\n /* Size of toolbar labels */\n font-weight: 400;\n text-shadow: none;\n}\n.ML__box-placeholder {\n color: var(--_box-placeholder-color);\n}\n.MLK__tex {\n font-family: KaTeX_Main, KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;\n}\n.MLK__tex-math {\n font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;\n font-style: italic;\n}\n.MLK__layer {\n display: none;\n outline: none;\n}\n.MLK__layer.is-visible {\n display: flex;\n flex-flow: column;\n}\n/* Keyboard layouts are made or rows of keys... */\n.MLK__rows {\n --_keycap-width: min(var(--_keycap-max-width), 10cqw);\n display: flex;\n flex-flow: column;\n align-items: center;\n border-collapse: separate;\n clear: both;\n border: 0;\n margin: 0;\n margin-bottom: var(--_keycap-gap);\n gap: var(--_keycap-gap);\n /* If the styling include, e.g., some shadows, they will be\n cut off by the overflow. In that case, set the padding to \n compensate. */\n padding-left: var(--_row-padding-left);\n padding-right: var(--_row-padding-right);\n overflow: visible;\n touch-action: none;\n}\n.MLK__rows > .MLK__row {\n display: flex;\n flex-flow: row;\n justify-content: center;\n width: 100%;\n gap: var(--_keycap-gap);\n margin: 0;\n padding: 0;\n /* For the alignment of the text on some modifiers (e.g. shift) */\n /* Extra spacing between two adjacent keys */\n}\n.MLK__rows > .MLK__row .tex {\n font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;\n}\n.MLK__rows > .MLK__row .tex-math {\n font-family: KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;\n}\n.MLK__rows > .MLK__row .big-op {\n font-size: calc(1.25 * var(--_keycap-font-size));\n}\n.MLK__rows > .MLK__row .small {\n font-size: var(--_keycap-small-font-size);\n}\n.MLK__rows > .MLK__row .bottom {\n justify-content: flex-end;\n}\n.MLK__rows > .MLK__row .left {\n align-items: flex-start;\n padding-left: 12px;\n}\n.MLK__rows > .MLK__row .right {\n align-items: flex-end;\n padding-right: 12px;\n}\n.MLK__rows > .MLK__row .w0 {\n width: 0;\n}\n.MLK__rows > .MLK__row .w5 {\n width: calc(0.5 * var(--_keycap-width) - var(--_keycap-gap));\n}\n.MLK__rows > .MLK__row .w15 {\n width: calc(1.5 * var(--_keycap-width) - var(--_keycap-gap));\n}\n.MLK__rows > .MLK__row .w20 {\n width: calc(2 * var(--_keycap-width) - var(--_keycap-gap));\n}\n.MLK__rows > .MLK__row .w40 {\n width: calc(4 * var(--_keycap-width) - var(--_keycap-gap));\n}\n.MLK__rows > .MLK__row .w50 {\n width: calc(5 * var(--_keycap-width) - var(--_keycap-gap));\n}\n.MLK__rows > .MLK__row .MLK__keycap.w50 {\n font-size: 80%;\n padding-top: 10px;\n font-weight: 100;\n}\n.MLK__rows > .MLK__row .separator {\n background: transparent;\n border: none;\n pointer-events: none;\n}\n.MLK__rows > .MLK__row .horizontal-rule {\n height: 6px;\n margin-top: 3px;\n margin-bottom: 0;\n width: 100%;\n border-radius: 0;\n border-top: var(--_horizontal-rule);\n}\n.MLK__rows > .MLK__row .ghost {\n background: var(--_toolbar-background);\n border: none;\n color: var(--_toolbar-text);\n}\n.MLK__rows > .MLK__row .ghost:hover {\n background: var(--_toolbar-background-hover);\n}\n.MLK__rows > .MLK__row .bigfnbutton {\n font-size: var(--_keycap-extra-small-font-size);\n}\n.MLK__rows > .MLK__row .shift,\n.MLK__rows > .MLK__row .action {\n color: var(--_keycap-secondary-text);\n background: var(--_keycap-secondary-background);\n border-color: var(--_keycap-secondary-border);\n border-bottom-color: var(--_keycap-secondary-border-bottom);\n line-height: 0.8;\n font-size: min(1rem, var(--_keycap-small-font-size));\n font-weight: 600;\n padding: 8px 12px 8px 12px;\n}\n.MLK__rows > .MLK__row .shift:hover,\n.MLK__rows > .MLK__row .action:hover {\n background: var(--_keycap-secondary-background-hover);\n}\n.MLK__rows > .MLK__row .action.primary {\n background: var(--_keycap-primary-background);\n color: var(--_keycap-primary-text);\n}\n.MLK__rows > .MLK__row .action.primary:hover {\n background: var(--_keycap-primary-background-hover);\n color: var(--_keycap-primary-text);\n}\n.MLK__rows > .MLK__row .shift.selected,\n.MLK__rows > .MLK__row .action.selected {\n color: var(--_toolbar-text-active);\n}\n.MLK__rows > .MLK__row .shift.selected.is-pressed,\n.MLK__rows > .MLK__row .action.selected.is-pressed,\n.MLK__rows > .MLK__row .shift.selected.is-active,\n.MLK__rows > .MLK__row .action.selected.is-active {\n color: white;\n}\n.MLK__rows > .MLK__row .warning {\n background: #cd0030;\n color: white;\n}\n.MLK__rows > .MLK__row .warning svg.svg-glyph {\n width: 24px;\n height: 24px;\n min-height: 24px;\n}\n/** A regular keycap\n * Use the :where() pseudo-class to give it a very low specifity, \n * so that it can be overriden by custom style.\n */\n:where(.MLK__rows > .MLK__row div) {\n display: flex;\n flex-flow: column;\n align-items: center;\n justify-content: space-evenly;\n width: calc(var(--_keycap-width) - var(--_keycap-gap));\n height: var(--_keycap-height);\n box-sizing: border-box;\n padding: 0;\n vertical-align: top;\n text-align: center;\n float: left;\n color: var(--_keycap-text);\n fill: currentColor;\n font-size: var(--_keycap-font-size);\n background: var(--_keycap-background);\n border: 1px solid var(--_keycap-border);\n border-bottom-color: var(--_keycap-border-bottom);\n border-radius: 6px;\n cursor: pointer;\n touch-action: none;\n /* Keys with a variants panel */\n position: relative;\n overflow: hidden;\n -webkit-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n:where(.MLK__rows > .MLK__row div):hover {\n overflow: visible;\n background: var(--_keycap-background-hover);\n}\n:where(.MLK__rows > .MLK__row div) .ML__latex {\n pointer-events: none;\n touch-action: none;\n}\n:where(.MLK__rows > .MLK__row div) svg.svg-glyph {\n margin: 8px 0;\n width: 20px;\n height: 20px;\n min-height: 20px;\n}\n:where(.MLK__rows > .MLK__row div) svg.svg-glyph-lg {\n margin: 8px 0;\n width: 24px;\n height: 24px;\n min-height: 24px;\n}\n:where(.MLK__rows > .MLK__row div).MLK__tex-math {\n font-size: 25px;\n}\n:where(.MLK__rows > .MLK__row div).is-pressed {\n background: var(--_keycap-background-pressed);\n color: var(--_keycap-text-pressed);\n --_box-placeholder-color: var(--_box-placeholder-pressed-color);\n}\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,\n:where(.MLK__rows > .MLK__row div).action.is-active,\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,\n:where(.MLK__rows > .MLK__row div).action.is-pressed {\n z-index: calc(var(--_keyboard-zindex) - 5);\n}\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active aside,\n:where(.MLK__rows > .MLK__row div).action.is-active aside,\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed aside,\n:where(.MLK__rows > .MLK__row div).action.is-pressed aside {\n display: none;\n}\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active .MLK__shift,\n:where(.MLK__rows > .MLK__row div).action.is-active .MLK__shift,\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed .MLK__shift,\n:where(.MLK__rows > .MLK__row div).action.is-pressed .MLK__shift {\n display: none;\n}\n:where(.MLK__rows > .MLK__row div).shift.is-pressed,\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,\n:where(.MLK__rows > .MLK__row div).action.is-pressed {\n background: var(--_keycap-background-pressed);\n color: var(--_keycap-text-pressed);\n}\n:where(.MLK__rows > .MLK__row div).shift.is-active,\n:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,\n:where(.MLK__rows > .MLK__row div).action.is-active {\n background: var(--_keycap-background-active);\n color: var(--_keycap-text-active);\n --_box-placeholder-color: var(--_box-placeholder-pressed-color);\n}\n:where(.MLK__rows > .MLK__row div) small {\n color: var(--_keycap-secondary-text);\n}\n:where(.MLK__rows > .MLK__row div) aside {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n font-size: 10px;\n line-height: 10px;\n color: var(--_keycap-secondary-text);\n}\n/* Add an attribute 'data-tooltip' to display a tooltip on hover.\nNote there are a different set of tooltip rules for the keyboard toggle\n(it's in a different CSS tree) */\n.ML__keyboard [data-tooltip] {\n position: relative;\n}\n.ML__keyboard [data-tooltip]::after {\n position: absolute;\n display: inline-table;\n content: attr(data-tooltip);\n top: inherit;\n bottom: 100%;\n width: max-content;\n max-width: 200px;\n padding: 8px 8px;\n background: #616161;\n color: #fff;\n text-align: center;\n z-index: 2;\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);\n border-radius: 2px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n font-weight: 400;\n font-size: 12px;\n transition: all 0.15s cubic-bezier(0.4, 0, 1, 1) 1s;\n opacity: 0;\n transform: scale(0.5);\n}\n.ML__keyboard [data-tooltip]:hover {\n position: relative;\n}\n.ML__keyboard [data-tooltip]:hover::after {\n opacity: 1;\n transform: scale(1);\n}\n.MLK__toolbar {\n align-self: center;\n display: flex;\n flex-flow: row;\n justify-content: space-between;\n width: 100%;\n max-width: 996px;\n min-height: 32px;\n /* Icons for undo/redo, etc. */\n}\n.MLK__toolbar svg {\n height: 20px;\n width: 20px;\n}\n.MLK__toolbar > .left {\n position: relative;\n display: flex;\n justify-content: flex-start;\n flex-flow: row;\n}\n.MLK__toolbar > .right {\n display: flex;\n justify-content: flex-end;\n flex-flow: row;\n}\n.MLK__toolbar > div > div {\n /* \"button\" in the toolbar */\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--_toolbar-text);\n fill: currentColor;\n background: var(--_toolbar-background);\n font-size: var(--_toolbar-font-size);\n padding: 4px 15px;\n cursor: pointer;\n width: max-content;\n min-width: 42px;\n min-height: 34px;\n border: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-bottom: 8px;\n padding-top: 8px;\n margin-top: 0;\n margin-bottom: 4px;\n margin-left: 4px;\n margin-right: 4px;\n border-radius: 8px;\n box-shadow: none;\n border-bottom: 2px solid transparent;\n}\n.MLK__toolbar > div > div:not(.disabled):not(.selected):hover {\n background: var(--_toolbar-background-hover);\n}\n.MLK__toolbar > div > div.disabled svg,\n.MLK__toolbar > div > div.disabled:hover svg,\n.MLK__toolbar > div > div.disabled.is-pressed svg {\n color: var(--_toolbar-text);\n opacity: 0.2;\n}\n.MLK__toolbar > div > div:hover,\n.MLK__toolbar > div > div:active,\n.MLK__toolbar > div > div.is-pressed,\n.MLK__toolbar > div > div.is-active {\n color: var(--_toolbar-text-active);\n}\n.MLK__toolbar > div > div.selected {\n color: var(--_toolbar-text-active);\n background: var(--_toolbar-background-selected);\n border-radius: 0;\n border-bottom-color: var(--_toolbar-text-active);\n padding-bottom: 4px;\n margin-bottom: 8px;\n}\n/* This is the element that displays variants on press+hold */\n.MLK__variant-panel {\n visibility: hidden;\n position: fixed;\n display: flex;\n flex-flow: row wrap-reverse;\n justify-content: center;\n align-content: center;\n margin: 0;\n padding: 0;\n bottom: auto;\n top: 0;\n box-sizing: content-box;\n transform: none;\n z-index: calc(var(--_keyboard-zindex) + 1);\n touch-action: none;\n max-width: 350px;\n background: var(--_variant-panel-background);\n text-align: center;\n border-radius: 6px;\n padding: 6px;\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n transition: none;\n}\n.MLK__variant-panel.is-visible {\n visibility: visible;\n}\n.MLK__variant-panel.compact {\n --_variant-keycap-length: var(--variant-keycap-length, 50px);\n --_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);\n --_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 10px);\n}\n.MLK__variant-panel .item {\n display: flex;\n flex-flow: column;\n align-items: center;\n justify-content: center;\n font-size: var(--_variant-keycap-font-size);\n height: var(--_variant-keycap-length);\n width: var(--_variant-keycap-length);\n margin: 0;\n box-sizing: border-box;\n border-radius: 5px;\n border: 1px solid transparent;\n background: transparent;\n pointer-events: all;\n cursor: pointer;\n color: var(--_variant-keycap-text);\n fill: currentColor;\n}\n@media (max-height: 412px) {\n .MLK__variant-panel .item {\n --_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);\n --_variant-keycap-length: var(--variant-keycap-length, 50px);\n }\n}\n.MLK__variant-panel .item .ML__latex {\n pointer-events: none;\n}\n.MLK__variant-panel .item.is-active {\n background: var(--_variant-keycap-background-active);\n color: var(--_variant-keycap-text-active);\n}\n.MLK__variant-panel .item.is-pressed {\n background: var(--_variant-keycap-background-pressed);\n color: var(--_variant-keycap-text-pressed);\n}\n.MLK__variant-panel .item.small {\n font-size: var(--_keycap-small-font-size);\n}\n.MLK__variant-panel .item.swatch-button {\n box-sizing: border-box;\n background: #fbfbfb;\n}\n.MLK__variant-panel .item.swatch-button > span {\n display: inline-block;\n margin: 6px;\n width: calc(100% - 12px);\n height: calc(100% - 12px);\n border-radius: 50%;\n}\n.MLK__variant-panel .item.swatch-button:hover {\n background: #f0f0f0;\n}\n.MLK__variant-panel .item.swatch-button:hover > span {\n border-radius: 2px;\n}\n.MLK__variant-panel .item.box > div,\n.MLK__variant-panel .item.box > span {\n border: 1px dashed rgba(0, 0, 0, 0.24);\n}\n.MLK__variant-panel .item .warning {\n min-height: 60px;\n min-width: 60px;\n background: #cd0030;\n color: white;\n padding: 5px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 5px;\n}\n.MLK__variant-panel .item .warning.is-pressed,\n.MLK__variant-panel .item .warning.is-active {\n background: red;\n}\n.MLK__variant-panel .item .warning svg.svg-glyph {\n width: 50px;\n height: 50px;\n}\n.MLK__variant-panel .item aside {\n font-size: var(--_variant-keycap-aside-font-size);\n line-height: 12px;\n opacity: 0.78;\n padding-top: 2px;\n}\n.MLK__keycap {\n position: relative;\n}\n.MLK__shift {\n display: block;\n position: absolute;\n right: 4px;\n top: 4px;\n font-size: var(--_keycap-shift-font-size);\n color: var(--_keycap-shift-color);\n}\n.hide-shift .MLK__shift {\n display: none;\n}\n@media (max-width: 414px) {\n .MLK__variant-panel {\n max-width: 350px;\n --_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);\n --_variant-keycap-length: var(--variant-keycap-length, 50px);\n }\n}\n/* @xs breakpoint: iPhone 5 */\n@container (max-width: 414px) {\n .MLK__rows {\n --_keycap-gap: max(var(--_keycap-gap, 2px), 2px);\n --_keycap-height: max(var(--_keycap-height), 42px);\n --_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);\n }\n .MLK__toolbar > div > div {\n font-size: 100%;\n margin-left: 2px;\n margin-right: 2px;\n }\n .MLK__rows .shift,\n .MLK__rows .action {\n font-size: 65%;\n }\n .MLK__rows .warning svg.svg-glyph {\n width: 14px;\n height: 14px;\n min-height: 14px;\n }\n}\n@container (max-width: 744px) {\n .MLK__rows {\n --_keycap-gap: max(var(--keycap-gap, 2px), 2px);\n --_keycap-height: max(var(--keycap-height, 52px), 52px);\n --_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);\n }\n .MLK__toolbar > div > div {\n padding-left: 0;\n padding-right: 0;\n }\n .MLK__tooltip::after {\n padding: 8px 16px;\n font-size: 16px;\n }\n .MLK__rows > .MLK__row > div.fnbutton {\n font-size: 16px;\n }\n .MLK__rows > .MLK__row > div.bigfnbutton {\n font-size: calc(var(--_keycap-extra-small-font-size) / 1.55);\n }\n .MLK__rows > .MLK__row > div.small {\n font-size: 13px;\n }\n .MLK__rows > .MLK__row > div > aside {\n display: none;\n }\n .MLK__shift {\n display: none;\n }\n}\n/* Medium breakpoint: larger phones */\n@container (max-width: 768px) {\n .MLK__rows {\n --_keycap-height: max(var(--keycap-height, 42px), 42px);\n }\n .MLK__rows > .MLK__row > div > small {\n font-size: 14px;\n }\n}\n@media (max-height: 768px) {\n .MLK__rows {\n --_keycap-height: max(var(--keycap-height, 42px), 42px);\n }\n .MLK__rows > .MLK__row > div > small {\n font-size: 14px;\n }\n}\n@container (max-width: 1444px) {\n .MLK__rows .if-wide {\n display: none;\n }\n}\n@media (prefers-color-scheme: dark) {\n .ML__keyboard {\n --_accent-color: var(--keyboard-accent-color, #0b5c9c);\n --_background: var(--keyboard-background, #151515);\n --_border: var(--keyboard-border, transparent);\n --_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);\n --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);\n --keyboard-toolbar-background-hover: #303030;\n --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);\n --_keycap-background: var(--keycap-background, #1f2022);\n --_keycap-background-hover: var(--keycap-background-hover, #2f3032);\n --_keycap-border: var(--_keycap-border, transparent);\n --_keycap-border-bottom: var(--_keycap-border-bottom, transparent);\n --_keycap-text: var(--keycap-text, #e3e4e8);\n --_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);\n --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);\n --_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);\n --keycap-secondary-border: transparent;\n --keycap-secondary-border-bottom: transparent;\n --_keycap-secondary-border: var(--keycap-secondary-border, transparent);\n --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);\n --_variant-panel-background: var(--variant-panel-background, #303030);\n --_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);\n }\n}\n/* Same as the media query, but with a class */\n[theme='dark'] .ML__keyboard {\n --_accent-color: var(--keyboard-accent-color, #0b5c9c);\n --_background: var(--keyboard-background, #151515);\n --_border: var(--keyboard-border, transparent);\n --_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);\n --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);\n --keyboard-toolbar-background-hover: #303030;\n --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);\n --_keycap-background: var(--keycap-background, #1f2022);\n --_keycap-background-hover: var(--keycap-background-hover, #2f3032);\n --_keycap-border: var(--_keycap-border, transparent);\n --_keycap-border-bottom: var(--_keycap-border-bottom, transparent);\n --_keycap-text: var(--keycap-text, #e3e4e8);\n --_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);\n --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);\n --_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);\n --keycap-secondary-border: transparent;\n --keycap-secondary-border-bottom: transparent;\n --_keycap-secondary-border: var(--keycap-secondary-border, transparent);\n --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);\n --_variant-panel-background: var(--variant-panel-background, #303030);\n --_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);\n}\n[theme='light'] .ML__keyboard {\n --_accent-color: var(--keyboard-accent-color, #0c75d8);\n --_background: var(--keyboard-background, #cacfd7);\n --_border: var(--keyboard-border, #ddd);\n --_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);\n --_toolbar-background: var(--keyboard-toolbar-background, transparent);\n --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);\n --_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);\n --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);\n --_keycap-background: var(--keycap-background, white);\n --_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);\n --_keycap-background-active: var(--keycap-background-active, var(--_accent-color));\n --_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));\n --_keycap-border: var(--_keycap-border, #e5e6e9);\n --_keycap-border-bottom: var(--_keycap-border-bottom, #8d8f92);\n --_keycap-text: var(--keycap-text, #000);\n --_keycap-text-active: var(--keycap-text-active, #fff);\n --_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));\n --_keycap-text-pressed: var(--keycap-text-pressed, #fff);\n --_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));\n --_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);\n --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);\n --_keycap-secondary-text: var(--keycap-secondary-text, #060707);\n --_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);\n --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);\n --_variant-panel-background: var(--variant-panel-background, #fff);\n --_variant-keycap-text: var(--variant-keycap-textvar, var(--_keycap-text));\n --_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));\n --_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));\n}\n";break;case"ui":t=":host {\n --primary-color: #5898ff;\n --primary-color-dimmed: #c0c0f0;\n --primary-color-dark: var(--blue-500);\n --primary-color-light: var(--blue-100);\n --primary-color-reverse: #ffffff;\n --secondary-color: #ff8a65;\n --secondary-color-dimmed: #f0d5c5;\n --secondary-color-dark: var(--orange-500);\n --secondary-color-light: var(--orange-100);\n --secondary-color-reverse: #ffffff;\n --link-color: #5898ff;\n --link-color-dimmed: #c5c5c5;\n --link-color-dark: #121212;\n --link-color-light: #e2e2e2;\n --link-color-reverse: #ffffff;\n --semantic-blue: var(--blue-700);\n --semantic-red: var(--red-400);\n --semantic-orange: var(--orange-400);\n --semantic-green: var(--green-700);\n --neutral-100: #f5f5f5;\n --neutral-200: #eeeeee;\n --neutral-300: #e0e0e0;\n --neutral-400: #bdbdbd;\n --neutral-500: #9e9e9e;\n --neutral-600: #757575;\n --neutral-700: #616161;\n --neutral-800: #424242;\n --neutral-900: #212121;\n --red-25: #fff8f7;\n --red-50: #fff1ef;\n --red-100: #ffeae6;\n --red-200: #ffcac1;\n --red-300: #ffa495;\n --red-400: #ff7865;\n --red-500: #f21c0d;\n --red-600: #e50018;\n --red-700: #d30024;\n --red-800: #bd002c;\n --red-900: #a1002f;\n --orange-25: #fffbf8;\n --orange-50: #fff7f1;\n --orange-100: #fff3ea;\n --orange-200: #ffe1c9;\n --orange-300: #ffcca2;\n --orange-400: #ffb677;\n --orange-500: #fe9310;\n --orange-600: #f58700;\n --orange-700: #ea7c00;\n --orange-800: #dc6d00;\n --orange-900: #ca5b00;\n --brown-25: #fff8ef;\n --brown-50: #fff1df;\n --brown-100: #ffe9ce;\n --brown-200: #ebcca6;\n --brown-300: #cdaf8a;\n --brown-400: #af936f;\n --brown-500: #856a47;\n --brown-600: #7f5e34;\n --brown-700: #78511f;\n --brown-800: #6e4200;\n --brown-900: #593200;\n --yellow-25: #fffdf9;\n --yellow-50: #fffcf2;\n --yellow-100: #fffaec;\n --yellow-200: #fff2ce;\n --yellow-300: #ffe8ab;\n --yellow-400: #ffdf85;\n --yellow-500: #ffcf33;\n --yellow-600: #f1c000;\n --yellow-700: #dfb200;\n --yellow-800: #c9a000;\n --yellow-900: #ad8a00;\n --lime-25: #f4ffee;\n --lime-50: #e9ffdd;\n --lime-100: #ddffca;\n --lime-200: #a8fb6f;\n --lime-300: #94e659;\n --lime-400: #80d142;\n --lime-500: #63b215;\n --lime-600: #45a000;\n --lime-700: #268e00;\n --lime-800: #007417;\n --lime-900: #005321;\n --green-25: #f5fff5;\n --green-50: #ebffea;\n --green-100: #e0ffdf;\n --green-200: #a7ffa7;\n --green-300: #5afa65;\n --green-400: #45e953;\n --green-500: #17cf36;\n --green-600: #00b944;\n --green-700: #00a34a;\n --green-800: #008749;\n --green-900: #00653e;\n --teal-25: #f3ffff;\n --teal-50: #e6fffe;\n --teal-100: #d9fffe;\n --teal-200: #8dfffe;\n --teal-300: #57f4f4;\n --teal-400: #43e5e5;\n --teal-500: #17cfcf;\n --teal-600: #00c2c0;\n --teal-700: #00b5b1;\n --teal-800: #00a49e;\n --teal-900: #009087;\n --cyan-25: #f7fcff;\n --cyan-50: #eff8ff;\n --cyan-100: #e7f5ff;\n --cyan-200: #c2e6ff;\n --cyan-300: #95d5ff;\n --cyan-400: #61c4ff;\n --cyan-500: #13a7ec;\n --cyan-600: #069eda;\n --cyan-700: #0095c9;\n --cyan-800: #0088b2;\n --cyan-900: #0a7897;\n --blue-25: #f7faff;\n --blue-50: #eef5ff;\n --blue-100: #e5f1ff;\n --blue-200: #bfdbff;\n --blue-300: #92c2ff;\n --blue-400: #63a8ff;\n --blue-500: #0d80f2;\n --blue-600: #0077db;\n --blue-700: #006dc4;\n --blue-800: #0060a7;\n --blue-900: #005086;\n --indigo-25: #f8f7ff;\n --indigo-50: #f1efff;\n --indigo-100: #eae7ff;\n --indigo-200: #ccc3ff;\n --indigo-300: #ac99ff;\n --indigo-400: #916aff;\n --indigo-500: #63c;\n --indigo-600: #5a21b2;\n --indigo-700: #4e0b99;\n --indigo-800: #3b0071;\n --indigo-900: #220040;\n --purple-25: #fbf7ff;\n --purple-50: #f8f0ff;\n --purple-100: #f4e8ff;\n --purple-200: #e4c4ff;\n --purple-300: #d49aff;\n --purple-400: #c36aff;\n --purple-500: #a219e6;\n --purple-600: #9000c4;\n --purple-700: #7c009f;\n --purple-800: #600073;\n --purple-900: #3d0043;\n --magenta-25: #fff8fb;\n --magenta-50: #fff2f6;\n --magenta-100: #ffebf2;\n --magenta-200: #ffcddf;\n --magenta-300: #ffa8cb;\n --magenta-400: #ff7fb7;\n --magenta-500: #eb4799;\n --magenta-600: #da3689;\n --magenta-700: #c82179;\n --magenta-800: #b00065;\n --magenta-900: #8a004c;\n}\n@media (prefers-color-scheme: dark) {\n :host {\n --semantic-blue: var(--blue-700);\n --semantic-red: var(--red-400);\n --semantic-orange: var(--orange-400);\n --semantic-green: var(--green-700);\n --semantic-bg-blue: var(--blue-25);\n --semantic-bg-red: var(--red-25);\n --semantic-bg-orange: var(--orange-25);\n --semantic-bg-green: var(--green-25);\n --neutral-100: #121212;\n --neutral-200: #424242;\n --neutral-300: #616161;\n --neutral-400: #757575;\n --neutral-500: #9e9e9e;\n --neutral-600: #bdbdbd;\n --neutral-700: #e0e0e0;\n --neutral-800: #eeeeee;\n --neutral-900: #f5f5f5;\n }\n}\n:host([theme='dark']) {\n --semantic-blue: var(--blue-700);\n --semantic-red: var(--red-400);\n --semantic-orange: var(--orange-400);\n --semantic-green: var(--green-700);\n --semantic-bg-blue: var(--blue-25);\n --semantic-bg-red: var(--red-25);\n --semantic-bg-orange: var(--orange-25);\n --semantic-bg-green: var(--green-25);\n --neutral-100: #121212;\n --neutral-200: #424242;\n --neutral-300: #616161;\n --neutral-400: #757575;\n --neutral-500: #9e9e9e;\n --neutral-600: #bdbdbd;\n --neutral-700: #e0e0e0;\n --neutral-800: #eeeeee;\n --neutral-900: #f5f5f5;\n}\n/* @media (prefers-color-scheme: dark) {\n :host {\n --label-color: #fff;\n --active-label-color: #000;\n --menu-bg: #525252;\n --active-bg: #5898ff;\n --active-bg-dimmed: #5c5c5c;\n }\n} */\n:host {\n --ui-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,\n 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji',\n 'Segoe UI Emoji', 'Segoe UI Symbol';\n --ui-font-size: 14px;\n --ui-line-height: 1.5;\n --ui-letter-spacing: 0.007em;\n --mono-font-family: 'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono',\n 'Source Code Pro', Menlo, Monaco, 'Courier New', monospace;\n --ui-layer-1: var(--neutral-100);\n --ui-layer-2: var(--neutral-200);\n --ui-layer-3: var(--neutral-300);\n --ui-layer-4: var(--neutral-400);\n --ui-layer-5: var(--neutral-500);\n --ui-layer-6: var(--neutral-600);\n --ui-border-color: var(--primary-color);\n --ui-border-radius: 4px;\n --ui-text: var(--neutral-900);\n --ui-text-secondary: var(--neutral-700);\n --ui-text-placeholder: var(--neutral-500);\n --ui-text-muted: var(--neutral-300);\n /** A field is a UI element in which a user can type data, for\n * example an input or textarea element.\n */\n --ui-field-bg: var(--neutral-100);\n --ui-field-bg-hover: var(--neutral-100);\n --ui-field-bg-disabled: var(--neutral-300);\n --ui-field-bg-invalid: var(--red-100);\n --ui-field-bg-focus: var(--neutral-100);\n --ui-field-border: 0.5px solid var(--border-color);\n --ui-field-border-hover: 0.5px solid var(--border-color);\n --ui-field-border-disabled: 0.5px solid var(--border-color);\n --ui-field-border-invalid: 0.5px solid var(--border-color);\n --ui-field-border-focus: 0.5px solid var(--border-color);\n --ui-menu-bg: var(--neutral-100);\n --ui-menu-text: var(--neutral-900);\n --ui-menu-bg-hover: var(--neutral-200);\n --ui-menu-text-hover: var(--neutral-900);\n /** The `active` state is used for the state of menu items\n * when they are selected.\n */\n --ui-menu-bg-active: var(--primary-color);\n --ui-menu-text-active: var(--primary-color-reverse);\n /** The `active-muted` set is used for the state of\n * submenus when they are open.\n */\n --ui-menu-bg-active-muted: var(--neutral-300);\n --ui-menu-text-active-muted: var(--neutral-900);\n /* --ui-menu-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.302),\n0 2px 6px 2px rgba(60, 64, 67, 0.149); */\n --ui-menu-shadow: 0 0 2px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.2);\n --ui-menu-divider: 0.5px solid #c7c7c7;\n /* var(--neutral-300); */\n --ui-menu-z-index: 10000;\n --page-bg: var(--neutral-100);\n --content-bg: var(--neutral-200);\n}\n@media (prefers-color-scheme: dark) {\n :host {\n --ui-menu-bg: var(--neutral-200);\n }\n}\n:host([theme='dark']) {\n --ui-menu-bg: var(--neutral-200);\n}\n/* PingFang SC is a macOS font. Microsoft Yahei is a Windows font. \n Noto is a Linux/Android font.\n*/\n:lang(zh-cn),\n:lang(zh-sg),\n:lang(zh-my),\n:lang(zh) {\n --ui-font-family: -apple-system, system-ui, 'PingFang SC', 'Hiragino Sans GB',\n 'Noto Sans CJK SC', 'Noto Sans SC', 'Noto Sans', 'Microsoft Yahei UI',\n 'Microsoft YaHei New', 'Microsoft Yahei', '微软雅黑', SimSun, '宋体',\n STXihei, '华文细黑', sans-serif;\n}\n:lang(zh-tw),\n:lang(zh-hk),\n:lang(zh-mo) {\n --ui-font-family: -apple-system, system-ui, 'Noto Sans',\n 'Microsoft JhengHei UI', 'Microsoft JhengHei', '微軟正黑體', '新細明體',\n 'PMingLiU', '細明體', 'MingLiU', sans-serif;\n}\n:lang(ja),\n:lang(ja-jp),\n:lang(ja-jp-mac) {\n --ui-font-family: -apple-system, system-ui, 'Hiragino Sans',\n 'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', 'Noto Sans JP', 'Noto Sans',\n '游ゴシック', '游ゴシック体', YuGothic, 'Yu Gothic', 'メイリオ', Meiryo,\n 'MS Pゴシック', 'MS PGothic', sans-serif;\n}\n:lang(ko),\n:lang(ko-kr),\n:lang(ko-kr-std) {\n --ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',\n 'Noto Sans', 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo',\n '애플 SD 산돌고딕 Neo', 'Apple SD 산돌고딕 Neo', '돋움', Dotum, sans-serif;\n}\n:lang(ko-kr-apple) {\n --ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',\n 'Noto Sans', 'Apple SD Gothic Neo', '애플 SD 산돌고딕 Neo',\n 'Apple SD 산돌고딕 Neo', '돋움', Dotum, sans-serif;\n}\n:lang(zh-cn),\n:lang(zh-sg),\n:lang(zh-my),\n:lang(zh),\n:lang(zh-tw),\n:lang(zh-hk),\n:lang(zh-mo),\n:lang(ja),\n:lang(ja-jp),\n:lang(ja-jp-mac),\n:lang(ko),\n:lang(ko-kr),\n:lang(ko-kr-std),\n:lang(ko-kr-apple) {\n --ui-font-size: 1rem;\n --ui-line-height: 1.7;\n --ui-letter-spacing: 0;\n}\n:dir(rtl) {\n --ui-line-height: auto;\n --ui-letter-spacing: 0;\n}\n";break;case"menu":t=".ui-menu *,\n.ui-menu ::before,\n.ui-menu ::after {\n box-sizing: border-box;\n}\n.ui-menu {\n display: none;\n color-scheme: light dark;\n -webkit-user-select: none;\n /* Important: Safari iOS doesn't respect user-select */\n user-select: none;\n cursor: default;\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0 0 0 0);\n --active-label-color: #fff;\n /* ui-menu-text-active */\n --label-color: #121212;\n /* ui-menu-text */\n --menu-bg: #e2e2e2;\n /* ui-menu-background */\n --active-bg: #5898ff;\n /* ui-menu-background-active */\n --active-bg-dimmed: #c5c5c5;\n /* ui-menu-background-active-muted */\n}\n/** Use the :where pseudo selector to make the specificity of the\n * selector 0, so that it can be overridden by the user.\n */\n:where(.ui-menu-container) {\n position: absolute;\n overflow: visible;\n width: auto;\n height: auto;\n z-index: 10000;\n border-radius: 8px;\n background: var(--ui-menu-bg);\n box-shadow: var(--ui-menu-shadow);\n list-style: none;\n padding: 6px 0 6px 0;\n margin: 0;\n user-select: none;\n cursor: default;\n color: var(--ui-menu-text);\n font-weight: normal;\n font-style: normal;\n text-shadow: none;\n text-transform: none;\n letter-spacing: 0;\n outline: none;\n opacity: 1;\n /* The [popover] elements have a 1px solid black border. Ugh. */\n border: none;\n width: fit-content;\n height: fit-content;\n}\n:where(.ui-menu-container > li) {\n display: flex;\n flex-flow: row;\n align-items: center;\n padding: 1px 7px 1px 7px;\n margin-top: 0;\n margin-left: 6px;\n margin-right: 6px;\n border-radius: 4px;\n white-space: nowrap;\n position: relative;\n outline: none;\n fill: currentColor;\n user-select: none;\n cursor: default;\n text-align: left;\n color: inherit;\n font-family: var(--ui-font-family);\n font-size: var(--ui-font-size);\n line-height: var(--ui-line-height);\n letter-spacing: var(--ui-letter-spacing);\n}\n:where(.ui-menu-container > li > .label) {\n appearance: none;\n background: none;\n outline: none;\n width: 100%;\n margin: 0;\n padding: 1px 2px 1px 1px;\n overflow: visible;\n border: 1px solid transparent;\n white-space: nowrap;\n text-align: start;\n}\n:where(.ui-menu-container > li:has(.heading)) {\n margin-top: 0.5em;\n}\n:where(.ui-menu-container > li > .label.heading) {\n font-weight: bold;\n opacity: 0.4;\n}\n:where(.ui-menu-container > li.indent > .label) {\n margin-inline-start: 12px;\n}\n:where(.ui-menu-container > li > .label.indent) {\n margin-inline-start: 12px;\n}\n:where(.ui-menu-container > li[role='divider']) {\n border-bottom: 1px solid var(--ui-menu-divider);\n border-radius: 0;\n padding: 0;\n margin-left: 15px;\n margin-right: 15px;\n padding-top: 5px;\n margin-bottom: 5px;\n width: calc(100% - 30px);\n /** 100% - (margin-left + margin-right) */\n}\n:where(.ui-menu-container > li[aria-disabled='true']) {\n opacity: 0.5;\n}\n:where(.ui-menu-container > li.active) {\n background: var(--ui-menu-bg-active);\n background: -apple-system-control-accent;\n color: var(--ui-menu-text-active);\n}\n:where(.ui-menu-container > li.active.is-submenu-open) {\n background: var(--ui-menu-bg-active-muted);\n color: inherit;\n}\n:where(.ui-menu-container > li[aria-haspopup='true'] > .label) {\n padding-inline-end: 0;\n}\n:where(.ui-menu-container > li[aria-haspopup='true'].active::after) {\n color: var(--ui-menu-text-active);\n}\n/** Keyboard shortcut */\n:where(.ui-menu-container > li > kbd) {\n font-family: var(--ui-font-family);\n margin-inline-start: 12px;\n opacity: 0.4;\n}\n:where(.ui-menu-container > li.active > kbd) {\n opacity: 0.85;\n}\n.ui-trailing-chevron {\n display: flex;\n margin-inline-start: 24px;\n width: 10px;\n height: 10px;\n margin-bottom: 4px;\n}\n.ui-trailing-chevron:dir(rtl) {\n transform: scaleX(-1);\n}\n.ui-checkmark {\n display: flex;\n margin-inline-end: -11px;\n margin-inline-start: -4px;\n margin-top: 2px;\n width: 16px;\n height: 16px;\n}\n.ui-mixedmark {\n display: flex;\n margin-inline-end: -11px;\n margin-inline-start: -4px;\n margin-top: 2px;\n width: 16px;\n height: 16px;\n}\n"}return t}function us(e){return cs||(cs={}),cs[e]||(cs[e]=new CSSStyleSheet,cs[e].replaceSync(hs(e))),cs[e]}function ps(e){var t;if(!("adoptedStyleSheets"in document)){if(window.document.getElementById(`mathlive-style-${e}`))return;const t=window.document.createElement("style");return t.id=`mathlive-style-${e}`,t.append(window.document.createTextNode(hs(e))),void window.document.head.appendChild(t)}if(ds||(ds={}),0!==(null!=(t=ds[e])?t:0))ds[e]+=1;else{const t=us(e);document.adoptedStyleSheets=[...document.adoptedStyleSheets,t],ds[e]=1}}function ms(e){if("adoptedStyleSheets"in document&&(null==ds?void 0:ds[e])&&(ds[e]-=1,ds[e]<=0)){const t=cs[e];document.adoptedStyleSheets=document.adoptedStyleSheets.filter((e=>e!==t))}}var fs=class e extends za{constructor(e){var t;super(h(d({},e),{type:"accent",body:null!=(t=e.body)?t:void 0})),e.accentChar?this.accent=e.accentChar:this.svgAccent=null==e?void 0:e.svgAccent,this.skipBoundary=!0,this.captureSelection=!0}static fromJson(t){return new e(t)}toJson(){return h(d({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(e){var t;const n=new Ea({parent:e,mathstyle:"cramp"},this.style),i=null!=(t=za.createBox(n,this.body))?t:new da("▢",{style:this.style});let o=0;!this.hasEmptyBranch("body")&&2===this.body.length&&this.body[1].isCharacterBox()&&(o=i.skew);let r,a=Math.min(i.height,$r);if(this.svgAccent)r=ma(this.svgAccent),a=n.metrics.bigOpSpacing1-a;else if(this.accent){const e=new da(this.accent,{fontFamily:"Main-Regular"});e.italic=0;const t=8407===this.accent?" ML__accent-vec":"";r=new da(new da(e),{classes:"ML__accent-body"+t})}r=new ga({shift:0,children:[{box:new da(i)},-a,{box:r,marginLeft:i.left+2*o,classes:["ML__center"]}]});const s=new da(r,{type:"lift"});return this.caret&&(s.caret=this.caret),this.bind(n,s.wrap(n)),this.attachSupsub(n,{base:s})}},gs={"(":")","{":"}","[":"]","|":"|","\\lbrace":"\\rbrace","\\lparen":"\\rparen","\\{":"\\}","\\langle":"\\rangle","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\vert":"\\vert","\\lvert":"\\rvert","\\Vert":"\\Vert","\\lVert":"\\rVert","\\lbrack":"\\rbrack","\\ulcorner":"\\urcorner","\\llcorner":"\\lrcorner","\\lgroup":"\\rgroup","\\lmoustache":"\\rmoustache"},bs=Object.fromEntries(Object.entries(gs).map((([e,t])=>[t,e])));function ys(e){var t;return null!=(t={"[":91,"]":93,"(":40,")":41,"\\mid":8739,"|":8739,"∣":8739,"∥":8741,"\\|":8739,"\\{":123,"\\}":125,"\\lbrace":123,"\\rbrace":125,"\\lparen":40,"\\rparen":41,"\\lbrack":91,"\\rbrack":93,"\\vert":8739,"\\lvert":8739,"\\mvert":8739,"\\rvert":8739,"\\Vert":8741,"\\lVert":8741,"\\mVert":8741,"\\rVert":8741,"\\parallel":8741,"\\shortparallel":8741,"\\langle":10216,"\\rangle":10217,"\\lfloor":8970,"\\rfloor":8971,"\\lceil":8968,"\\rceil":8969,"\\ulcorner":9484,"\\urcorner":9488,"\\llcorner":9492,"\\lrcorner":9496,"\\lgroup":10222,"\\rgroup":10223,"\\lmoustache":9136,"\\rmoustache":9137,"\\surd":8730}[e])?t:e.codePointAt(0)}function vs(e,t,n,i,o){var r,a;const s=new Ea({parent:i,mathstyle:"textstyle"},null==o?void 0:o.style),l=new da(ys(e),{fontFamily:`Size${t}-Regular`,isSelected:o.isSelected,classes:(null!=(r=o.classes)?r:"")+` ML__delim-size${t}`,type:null!=(a=o.type)?a:"ignore"}).wrap(s);return n&&l.setTop((1-s.scalingFactor)*Br),l}function xs(e,t,n,i,o){var r;let a,s,l,c;a=l=c=ys(e),s=null;let u="Size1-Regular";"\\vert"===e||"\\lvert"===e||"\\rvert"===e||"\\mvert"===e||"\\mid"===e?l=a=c=8739:"\\Vert"===e||"\\lVert"===e||"\\rVert"===e||"\\mVert"===e||"\\|"===e?l=a=c=8741:"\\uparrow"===e?l=c=9168:"\\Uparrow"===e?l=c=8214:"\\downarrow"===e?a=l=9168:"\\Downarrow"===e?a=l=8214:"\\updownarrow"===e?(a=8593,l=9168,c=8595):"\\Updownarrow"===e?(a=8657,l=8214,c=8659):"["===e||"\\lbrack"===e?(a=9121,l=9122,c=9123,u="Size4-Regular"):"]"===e||"\\rbrack"===e?(a=9124,l=9125,c=9126,u="Size4-Regular"):"\\lfloor"===e||"⌊"===e?(l=a=9122,c=9123,u="Size4-Regular"):"\\lceil"===e||"⌈"===e?(a=9121,l=c=9122,u="Size4-Regular"):"\\rfloor"===e||"⌋"===e?(l=a=9125,c=9126,u="Size4-Regular"):"\\rceil"===e||"⌉"===e?(a=9124,l=c=9125,u="Size4-Regular"):"("===e||"\\lparen"===e?(a=9115,l=9116,c=9117,u="Size4-Regular"):")"===e||"\\rparen"===e?(a=9118,l=9119,c=9120,u="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(a=9127,s=9128,c=9129,l=9130,u="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(a=9131,s=9132,c=9133,l=9130,u="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(a=9127,c=9129,l=9130,u="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(a=9131,c=9133,l=9130,u="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(a=9127,c=9133,l=9130,u="Size4-Regular"):"\\rmoustache"===e||"⎱"===e?(a=9131,c=9129,l=9130,u="Size4-Regular"):"\\surd"===e?(a=57345,c=9143,l=57344,u="Size4-Regular"):"\\ulcorner"===e?(a=9484,l=c=32):"\\urcorner"===e?(a=9488,l=c=32):"\\llcorner"===e?(c=9492,l=a=32):"\\lrcorner"===e&&(a=9496,l=a=32);const p=Nr(a,u),m=p.height+p.depth,f=Nr(l,u),g=f.height+f.depth,b=Nr(c,u),y=b.height+b.depth;let v=0,x=1;if(null!==s){const e=Nr(s,u);v=e.height+e.depth,x=2}const w=m+y+v,_=Math.max(0,Math.ceil((t-w)/(x*g))),k=w+_*x*g;let M=Br;n&&(M*=i.scalingFactor);const S=k/2-M,L=[];L.push({box:new da(c,{fontFamily:u})}),L.push(-.008);const C=new da(l,{fontFamily:u});if(null===s)for(let e=0;e<_;e++)L.push({box:C});else{for(let e=0;e<_;e++)L.push({box:C});L.push(-.008),L.push({box:new da(s,{fontFamily:u})}),L.push(-.008);for(let e=0;e<_;e++)L.push({box:C})}L.push(-.008),L.push({box:new da(a,{fontFamily:u})});let E="";"Size1-Regular"===u?E=" delim-size1":"Size4-Regular"===u&&(E=" delim-size4");const K=new ga({bottom:S,children:L},{classes:E});return new da(K,h(d({},null!=o?o:{}),{classes:(null!=(r=null==o?void 0:o.classes)?r:"")+" ML__delim-mult"}))}var ws=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","⌊","⌋","⌈","⌉"]),_s=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","⟮","⟯","⎰","⎱"]),ks=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Ms=[0,1.2,1.8,2.4,3];var Ss=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Ls=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],Cs=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];function Es(e,t,n,i,o,r){if(!t||0===t.length||"."===t)return As(o);let a;"<"===t||"\\lt"===t?t="\\langle":">"!==t&&"\\gt"!==t||(t="\\rangle"),a=ks.has(t)?Ss:ws.has(t)?Cs:Ls;const s=function(e,t,n,i){for(let r={"-4":0,"-3":1,0:2}[i.mathstyle.sizeDelta];r<n.length&&"stack"!==n[r].type;r++){const a=Nr(e,"small"===(o=n[r]).type?"Main-Regular":"large"===o.type?"Size"+o.size+"-Regular":(console.assert("stack"===o.type),"Size4-Regular"));if(a.defaultMetrics)return{type:"small",mathstyle:"scriptstyle"};let s=a.height+a.depth;if("small"===n[r].type&&("scriptscriptstyle"===n[r].mathstyle?s*=Math.max(Or[Math.max(1,i.size-2)],i.minFontScale):"scriptstyle"===n[r].mathstyle&&(s*=Math.max(Or[Math.max(1,i.size-1)],i.minFontScale))),s>t)return n[r]}var o;return n[n.length-1]}(ys(t),n,a,o),l=new Ea({parent:o,mathstyle:s.mathstyle},null==r?void 0:r.style);return"small"===s.type?function(e,t,n,i){var o;const r=new da(ys(e),{fontFamily:"Main-Regular",isSelected:i.isSelected,classes:"ML__small-delim "+(null!=(o=i.classes)?o:"")}).wrap(t);return n&&r.setTop((1-t.scalingFactor)*Br),r}(t,l,i,h(d({},r),{type:e})):"large"===s.type?vs(t,s.size,i,l,h(d({},r),{type:e})):(console.assert("stack"===s.type),xs(t,n,i,l,h(d({},r),{type:e})))}function Ks(e,t,n,i,o,r){if("."===t)return As(o,null==r?void 0:r.classes);const a=Br*o.scalingFactor,s=Math.max(n-a,i+a);return Es(e,t,Math.max(s/500*901,2*s-.5),!0,o,r)}function As(e,t){const n=new da(null,{classes:" nulldelimiter "+(null!=t?t:""),type:"ignore"});return n.width=e.getRegisterAsEm("nulldelimiterspace"),n.wrap(new Ea({parent:e,mathstyle:"textstyle"}))}var Ds=class e extends za{constructor(e){var t;super({type:"placeholder",command:"\\placeholder",mode:null!=(t=null==e?void 0:e.mode)?t:"math",style:null==e?void 0:e.style}),this.captureSelection=!0}static fromJson(t){return new e(t)}toJson(){return super.toJson()}render(e){let t;return this.value=e.placeholderSymbol,t="function"==typeof e.renderPlaceholder?e.renderPlaceholder(e):this.createBox(e),this.caret&&(t.classes+=" ML__placeholder-selected"),t}_serialize(e){return e.skipPlaceholders?"":"\\placeholder{}"}},zs=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],Ts=["cases","dcases","rcases"],Bs=["align","align*","aligned","gather","gathered","split"],$s=["array","subequations","eqnarray"];function Ps(e){return zs.includes(e)}var Os=class e extends za{constructor(e,t,n,i={}){var o;super({type:"array"}),this.environmentName=e,this.rowGaps=n,i.mathstyleName&&(this.mathstyleName=i.mathstyleName),i.columns&&(0===i.columns.length?this.colFormat=[{align:"l"}]:this.colFormat=i.columns),this.colFormat||(this.colFormat=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}]),this.array=function(e,t,n){let i=0;for(const e of n)"align"in e&&(i+=1);let o=0;const r=[];for(const n of t){let t=0;for(o=Math.max(o,Math.min(n.length,i));t<n.length;){const o=[],a=Math.min(n.length,t+i);for(;t<a;){const i=n[t];0===i.length?o.push([new za({type:"first",mode:e.mode})]):"first"!==i[0].type?o.push([new za({type:"first",mode:e.mode}),...i]):(console.assert(!i.slice(1).some((e=>"first"===e.type))),o.push(i)),t+=1}r.push(o)}}r.length>0&&1===r[r.length-1].length&&1===r[r.length-1][0].length&&"first"===r[r.length-1][0][0].type&&r.pop();const a=[];for(const t of r){if(t.length!==o)for(let n=t.length;n<o;n++)t.push([new za({type:"first",mode:e.mode}),new Ds]);a.push(t)}let s=0,l=0;for(const t of a){l=0;for(const n of t){for(const t of n)t.parent=e,t.parentBranch=[s,l];l+=1}s+=1}return e.isDirty=!0,a}(this,t,this.colFormat),i.leftDelim&&(this.leftDelim=i.leftDelim),i.rightDelim&&(this.rightDelim=i.rightDelim),void 0!==i.arraycolsep&&(this.arraycolsep=i.arraycolsep),this.colSeparationType=i.colSeparationType,void 0!==i.arraystretch&&(this.arraystretch=i.arraystretch),this.minColumns=null!=(o=i.minColumns)?o:1}static fromJson(t){return new e(t.environmentName,t.array,t.rowGaps,t)}toJson(){const e=h(d({},super.toJson()),{environmentName:this.environmentName,array:this.array.map((e=>e.map((e=>e.map((e=>e.toJson())))))),rowGaps:this.rowGaps,columns:this.colFormat,colSeparationType:this.colSeparationType});return void 0!==this.arraystretch&&(e.arraystretch=this.arraystretch),void 0!==this.arraycolsep&&(e.arraycolsep=this.arraycolsep),this.leftDelim&&(e.leftDelim=this.leftDelim),this.rightDelim&&(e.rightDelim=this.rightDelim),e}branch(e){var t;if(Da(e))return null!=(t=this.array[e[0]][e[1]])?t:void 0}createBranch(e){var t;return Da(e)?(this.isDirty=!0,null!=(t=this.branch(e))?t:[]):[]}get rowCount(){return this.array.length}get colCount(){return this.array[0].length}get maxColumns(){return this.colFormat.filter((e=>Boolean(e.align))).length}removeBranch(e){if(Aa(e))return super.removeBranch(e);const t=this.branch(e);return this.array[e[0]][e[1]]=void 0,t.forEach((e=>{e.parent=void 0,e.parentBranch=void 0})),console.assert("first"===t[0].type),t.shift(),this.isDirty=!0,t}get hasChildren(){return this.children.length>0}get children(){const e=[];for(const t of this.array)for(const n of t)if(n)for(const t of n)e.push(...t.children),e.push(t);return[...e,...super.children]}render(e){var t,n,i,o,r,a;const s=new Ea({parent:e,mathstyle:this.mathstyleName},this.style),l=s.getRegisterAsEm("arrayrulewidth"),c=s.getRegisterAsEm("arraycolsep"),d=s.getRegisterAsEm("doublerulesep"),h=null!=(n=null!=(t=this.arraystretch)?t:s.getRegisterAsNumber("arraystretch"))?n:1;let u="number"==typeof this.arraycolsep?this.arraycolsep:c;if("small"===this.colSeparationType){u=new Ea({parent:e,mathstyle:"scriptstyle"}).scalingFactor/e.scalingFactor*.2778}const p=1.2*h,m=.7*p,f=.3*p;let g=0;const b=[];let y=0;const v=this.array.length;for(let e=0;e<v;++e){const t=this.array[e];y=Math.max(y,t.length);const n=new Ea({parent:s,mathstyle:this.mathstyleName},this.style);let r=m/n.scalingFactor,a=f/n.scalingFactor;const l={cells:[],height:0,depth:0,pos:0};for(const e of t){const t=null!=(i=za.createBox(n,e,{type:"ignore"}))?i:new da(null,{type:"ignore"});a=Math.max(a,t.depth),r=Math.max(r,t.height),l.cells.push(t)}let c=null!=(o=wa(this.rowGaps[e]))?o:0;c>0&&(c+=f,a=Math.max(a,c),c=0),e<v-1&&!Ps(this.environmentName)&&"cases"!==this.environmentName&&"array"!==this.environmentName&&(a+=s.getRegisterAsEm("jot")),l.height=r,l.depth=a,g+=r,l.pos=g,g+=a+c,b.push(l)}const x=g/2+Br,w=[];for(let e=0;e<y;e++){const t=[];for(const n of b){const i=n.cells[e];i.depth=n.depth,i.height=n.height,t.push({box:i,shift:n.pos-x})}t.length>0&&w.push(new ga({individualShift:t}))}const _=[];let k=!1,M=!1,S=0,L=!this.leftDelim;const{colFormat:C}=this;for(const t of C){if("align"in t&&S>=w.length)break;if("align"in t)k?_.push(Ns(2*u)):(M||L)&&_.push(Ns(u)),_.push(new da(w[S],{classes:"col-align-"+t.align})),S++,k=!0,M=!1,L=!1;else if("gap"in t){if("number"==typeof t.gap)_.push(Ns(t.gap));else{const n=Is(e,b,x,t.gap);n&&_.push(n)}k=!1,M=!1,L=!1}else if("separator"in t){const e=new da(null,{classes:"vertical-separator"});e.height=g,e.setStyle("height",g,"em"),e.setStyle("border-right",`${l}em ${t.separator} currentColor`),e.setStyle("vertical-align",-(g-x),"em");let n=0;M?n=d-l:k&&(n=u-l),e.left=n,_.push(e),k=!1,M=!0,L=!1}}k&&!this.rightDelim&&_.push(Ns(u));const E=new da(_,{classes:"mtable"});if(!(this.leftDelim&&"."!==this.leftDelim||this.rightDelim&&"."!==this.rightDelim))return this.caret&&(E.caret=this.caret),this.bind(e,E);const K=E.height,A=E.depth,D=this.bind(e,new da([this.bind(e,Ks("open",null!=(r=this.leftDelim)?r:".",K,A,s,{isSelected:this.isSelected})),E,this.bind(e,Ks("close",null!=(a=this.rightDelim)?a:".",K,A,s,{isSelected:this.isSelected}))],{type:"ord"}));return D?(D.setStyle("display","inline-block"),this.caret&&(D.caret=this.caret),this.bind(e,this.attachSupsub(e,{base:D}))):null}_serialize(e){var t;const n=[];if("lines"===this.environmentName?n.push("{\\displaylines"):n.push(`\\begin{${this.environmentName}}`),"array"===this.environmentName){if(n.push("{"),void 0!==this.colFormat)for(const e of this.colFormat)"align"in e&&"string"==typeof e.align?n.push(e.align):"separator"in e&&"solid"===e.separator?n.push("|"):"separator"in e&&"dashed"===e.separator&&n.push(":");n.push("}")}for(let i=0;i<this.array.length;i++){for(let t=0;t<this.array[i].length;t++)t>0&&n.push(" & "),n.push(za.serialize(this.array[i][t],e));if(i<this.array.length-1){const e=this.rowGaps[i];(null==e?void 0:e.dimension)?n.push(`\\\\[${e.dimension} ${null!=(t=e.unit)?t:"pt"}] `):n.push("\\\\ ")}}return"lines"===this.environmentName?n.push("}"):n.push(`\\end{${this.environmentName}}`),Yr(n)}getCell(e,t){return this.array[e][t]}setCell(e,t,n){console.assert("array"===this.type&&Array.isArray(this.array)&&void 0!==this.array[e][t]);for(const n of this.array[e][t])n.parent=void 0,n.parentBranch=void 0;let i=n;0!==n.length&&"first"===n[0].type||(i=[new za({type:"first",mode:this.mode}),...n]),this.array[e][t]=i;for(const n of i)n.parent=this,n.parentBranch=[e,t];this.isDirty=!0}addRowBefore(e){console.assert("array"===this.type&&Array.isArray(this.array));const t=[];for(let e=0;e<this.colCount;e++)t.push(qs(this));this.array.splice(e,0,t);for(let t=e;t<this.rowCount;t++)for(let e=0;e<this.colCount;e++){const n=this.array[t][e];if(n)for(const i of n)i.parentBranch=[t,e]}this.isDirty=!0}addRowAfter(e){console.assert("array"===this.type&&Array.isArray(this.array));const t=[];for(let e=0;e<this.colCount;e++)t.push(qs(this));this.array.splice(e+1,0,t);for(let t=e+1;t<this.rowCount;t++)for(let e=0;e<this.colCount;e++){const n=this.array[t][e];if(n)for(const i of n)i.parentBranch=[t,e]}this.isDirty=!0}removeRow(e){console.assert("array"===this.type&&Array.isArray(this.array)&&this.rowCount>e);const t=this.array.splice(e,1);for(const e of t)for(const t of e)if(t)for(const e of t)e.parent=void 0,e.parentBranch=void 0;for(let t=e;t<this.rowCount;t++)for(let e=0;e<this.colCount;e++){const n=this.array[t][e];if(n)for(const i of n)i.parentBranch=[t,e]}this.isDirty=!0}addColumnBefore(e){console.assert("array"===this.type&&Array.isArray(this.array));for(const t of this.array)t.splice(e,0,qs(this));for(let t=0;t<this.rowCount;t++)for(let n=e;n<this.colCount;n++){const e=this.array[t][n];if(e)for(const i of e)i.parentBranch=[t,n]}this.isDirty=!0}addColumnAfter(e){console.assert("array"===this.type&&Array.isArray(this.array));for(const t of this.array)t.splice(e+1,0,qs(this));for(let t=0;t<this.rowCount;t++)for(let n=e+1;n<this.colCount;n++){const e=this.array[t][n];if(e)for(const i of e)i.parentBranch=[t,n]}this.isDirty=!0}addColumn(){this.addColumnAfter(this.colCount-1)}removeColumn(e){console.assert("array"===this.type&&Array.isArray(this.array)&&this.colCount>e);for(const t of this.array){const n=t.splice(e,1);for(const e of n)if(e)for(const t of e)t.parent=void 0,t.parentBranch=void 0}for(let t=0;t<this.rowCount;t++)for(let n=e;n<this.colCount;n++){const e=this.array[t][n];if(e)for(const i of e)i.parentBranch=[t,n]}this.isDirty=!0}get cells(){const e=[];for(const t of this.array)for(const n of t)n&&e.push(n.filter((e=>"first"!==e.type)));return e}};function qs(e){const t=new za({type:"first",mode:e.mode});t.parent=e;const n=new Ds;return n.parent=e,[t,n]}function Ns(e){const t=new da(null,{classes:"arraycolsep"});return t.width=e,t}function Is(e,t,n,i){if(!i)return null;const o=[];for(const r of t){const t=za.createBox(e,i,{type:"ignore"});t&&(t.depth=r.depth,t.height=r.height,o.push({box:t,shift:r.pos-n}))}return new ga({individualShift:o}).wrap(e)}var Fs=class e extends za{constructor(e){super({mode:e.mode,command:e.command,style:e.style,body:e.body,type:"box"}),this.framecolor=e.framecolor,this.backgroundcolor=e.backgroundcolor,this.padding=e.padding,this.offset=e.offset,this.border=e.border}static fromJson(t){return new e(t)}toJson(){return h(d({},super.toJson()),{framecolor:this.framecolor,backgroundcolor:this.backgroundcolor,padding:this.padding,offset:this.offset,border:this.border})}render(e){var t,n,i,o;const r=za.createBox(e,this.body,{type:"lift"});if(!r)return null;const a=e.toEm(null!=(t=this.offset)?t:{dimension:0});r.depth+=a,r.setStyle("display","inline-block"),r.setStyle("position","relative"),r.setStyle("height",Math.floor(100*r.height+r.depth)/100,"em"),r.setStyle("vertical-align",-Math.floor(100*r.height)/100,"em");const s=new Ea({parent:e},this.style),l=s.toEm(null!=(n=this.padding)?n:{register:"fboxsep"}),c=new da(null,{classes:"ML__box"});c.height=r.height+l,c.depth=r.depth+l,c.setStyle("box-sizing","border-box"),c.setStyle("position","absolute"),c.setStyle("top",.3-l,"em"),c.setStyle("left",0),c.setStyle("height",c.height+c.depth,"em"),c.setStyle("width","100%"),this.backgroundcolor&&c.setStyle("background-color",null!=(i=s.toColor(this.backgroundcolor))?i:"transparent"),this.framecolor&&c.setStyle("border",`${s.getRegisterAsEm("fboxrule",2)}em solid ${null!=(o=s.toColor(this.framecolor))?o:"black"}`),this.border&&c.setStyle("border",this.border);const d=new da([c,r],{type:"lift"});return d.setStyle("display","inline-block"),d.setStyle("position","relative"),d.setStyle("line-height",0),d.height=r.height+l+(a>0?a:0),d.depth=r.depth+l+(a<0?-a:0),d.setStyle("padding-left",l,"em"),d.setStyle("padding-right",l,"em"),d.setStyle("height",Math.floor(100*(r.height+r.depth+2*l+Math.abs(a)))/100,"em"),d.setStyle("margin-top",-l,"em"),d.setStyle("top",Math.floor(100*(r.depth-r.height+2*l-a))/100,"em"),d.setStyle("vertical-align",Math.floor(100*(r.depth+2*l))/100,"em"),this.caret&&(d.caret=this.caret),this.attachSupsub(e,{base:d})}_serialize(e){return e.skipStyles?Yr([this.bodyToLatex(e),this.supsubToLatex(e)]):super._serialize(e)}},Rs=class e extends za{constructor(e,t){var n;super({type:"composition",mode:null!=(n=null==t?void 0:t.mode)?n:"math",value:e})}static fromJson(t){return new e(t.value,t)}toJson(){return super.toJson()}get computedStyle(){return{}}render(e){const t=new da(this.value,{classes:"ML__composition",type:"composition"});return this.bind(e,t),this.caret&&(t.caret=this.caret),t}_serialize(e){return""}},Vs=class e extends za{constructor(e){super({type:"error",value:e,command:e,mode:"math"}),this.verbatimLatex=e}static fromJson(t){return new e(t.command)}toJson(){return super.toJson()}render(e){const t=this.createBox(e,{classes:"ML__error"});return this.caret&&(t.caret=this.caret),t}},Hs=class e extends za{constructor(e,t,n){super({type:"group",mode:t,style:n}),this.body=e,this.boxType=e.length>1?"ord":"ignore",this.skipBoundary=!0,this.displayContainsHighlight=!1,e&&1===e.length&&","===e[0].command&&(this.captureSelection=!0)}static fromJson(t){return new e(t.body,t.mode,t.style)}render(e){const t=za.createBox(e,this.body,{type:this.boxType});return t?(this.caret&&(t.caret=this.caret),this.bind(e,t)):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const t=ae(this.command,this.mode);return(null==t?void 0:t.serialize)?t.serialize(this,e):`{${this.bodyToLatex(e)}}`}},Ws=class e extends za{constructor(e,t,n){super({type:"leftright",style:n.style,displayContainsHighlight:!0}),this.variant=e,this.body=t,this.leftDelim=n.leftDelim,this.rightDelim=n.rightDelim}static fromJson(t){var n;return new e(null!=(n=t.variant)?n:"",t.body,t)}toJson(){const e=super.toJson();return this.variant&&(e.variant=this.variant),this.leftDelim&&(e.leftDelim=this.leftDelim),this.rightDelim&&(e.rightDelim=this.rightDelim),e}_serialize(e){var t,n;const i=this.matchingRightDelim();return"left...right"===this.variant?Yr(["\\left",null!=(t=this.leftDelim)?t:".",this.bodyToLatex(e),"\\right",i]):"mleft...mright"===this.variant?Yr(["\\mleft",null!=(n=this.leftDelim)?n:".",this.bodyToLatex(e),"\\mright",i]):Yr([this.leftDelim&&"."!==this.leftDelim?this.leftDelim:"",this.bodyToLatex(e),i])}matchingRightDelim(){var e,t;if(this.rightDelim&&"?"!==this.rightDelim)return this.rightDelim;const n=null!=(e=this.leftDelim)?e:".";return null!=(t=gs[n])?t:n}render(e){var t,n;const i=new Ea({parent:e},this.style);console.assert(void 0!==this.body);const o=new Ea({parent:e,mathstyle:"textstyle"},this.style),r=null!=(t=za.createBox(i,this.body,{type:"inner"}))?t:new da(null,{type:"inner"}),a=r.height/o.scalingFactor,s=r.depth/o.scalingFactor,l=[];if(this.leftDelim&&l.push(this.bind(o,Ks("open",this.leftDelim,a,s,o,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),r&&(js(r.children,this,i,a,s),l.push(r)),this.rightDelim){let e=this.containsCaret?" ML__contains-caret":"",t=this.rightDelim;"?"===t&&(i.smartFence?(t=this.matchingRightDelim(),e+=" ML__smart-fence__close"):t="."),l.push(this.bind(o,Ks("close",t,a,s,o,{isSelected:this.isSelected,classes:e+" ML__close",mode:this.mode,style:this.style})))}let c="mleft...mright"===this.variant;const d=this.leftSibling;d&&(!c&&d.isFunction&&(c=!0),!c&&"subsup"===d.type&&(null==(n=d.leftSibling)?void 0:n.isFunction)&&(c=!0));const h=new da(l,{type:c?"close":"inner",classes:"left-right"});return h.setStyle("margin-top",-r.depth+"em"),h.setStyle("height",`${r.height+r.depth}em`),this.caret&&(h.caret=this.caret),this.bind(i,h.wrap(i))}};function js(e,t,n,i,o){if(e)for(let r=0;r<e.length;r++){const a=e[r];"middle"===a.type?(e[r]=t.bind(n,Ks("inner",a.value,i,o,n,{isSelected:t.isSelected})),e[r].caret=a.caret,e[r].isSelected=a.isSelected,e[r].cssId=a.cssId,e[r].htmlData=a.htmlData,e[r].htmlStyle=a.htmlStyle,e[r].attributes=a.attributes,e[r].cssProperties=a.cssProperties):a.children&&js(a.children,t,n,i,o)}}var Us=class e extends za{constructor(e,t){var n;super({type:"macro",command:e,style:t.style}),this.body=t.body,void 0===t.captureSelection?t.args?this.captureSelection=!1:this.captureSelection=!0:this.captureSelection=t.captureSelection,this.macroArgs=t.args,this.expand=null!=(n=t.expand)&&n}static fromJson(t){return new e(t.command,t)}toJson(){const e=super.toJson();return this.expand&&(e.expand=!0),void 0!==this.captureSelection&&(e.captureSelection=this.captureSelection),this.macroArgs&&(e.args=this.macroArgs),e}_serialize(e){var t;return e.expandMacro&&this.expand?this.bodyToLatex(e):this.command+(null!=(t=this.macroArgs)?t:"")}render(e){const t=za.createBox(e,this.body);return t?(this.caret&&(t.caret=this.caret),this.bind(e,t)):null}},Js=class e extends za{constructor(){super({type:"macro-argument"})}static fromJson(t){return new e}toJson(){return super.toJson()}_serialize(e){return""}render(e){return null}},Xs=class e extends za{constructor(e,t,n=!1,i,o){var r;super({type:"prompt",mode:null!=(r=null==o?void 0:o.mode)?r:"math",style:null==o?void 0:o.style,command:"\\placeholder"}),this.body=i,this.correctness=t,this.placeholderId=e,this.locked=n,this.captureSelection=this.locked}static fromJson(t){return new e(t.placeholderId,t.correctness,t.locked,t.body,t)}toJson(){const e=super.toJson();return this.placeholderId&&(e.placeholderId=this.placeholderId),this.body||delete e.body,this.body&&(e.body=this.body.filter((e=>"first"!==e.type)).map((e=>e.toJson()))),this.correctness&&(e.correctness=this.correctness),e.locked=this.locked,e}render(e){const t=new Ea({parent:e}),n=t.getRegisterAsEm("fboxsep"),i=n,o=n,r=za.createBox(e,this.body);if(!r)return null;r.height||(r.height=t.metrics.xHeight),r.setStyle("vertical-align",-r.height,"em"),"correct"===this.correctness?r.setStyle("color","var(--correct-color, var(--ML__correct-color))"):"incorrect"===this.correctness&&r.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");const a=new da(r,{type:"ord"});a.setStyle("display","inline-block"),a.setStyle("height",r.height+r.depth,"em"),a.setStyle("vertical-align",-o,"em");let s="ML__prompt ";this.locked?s+=" ML__lockedPromptBox ":s+=" ML__editablePromptBox ","correct"===this.correctness?s+=" ML__correctPromptBox ":"incorrect"===this.correctness&&(s+=" ML__incorrectPromptBox "),this.containsCaret&&(s+=" ML__focusedPromptBox ");const l=new da(null,{classes:s,attributes:{part:"prompt"}});l.height=a.height+o,l.depth=a.depth+o,l.width=a.width+2*i,l.setStyle("box-sizing","border-box"),l.setStyle("position","absolute"),l.setStyle("height",a.height+a.depth+2*o,"em"),0===i&&l.setStyle("width","100%"),0!==i&&(l.setStyle("width",`calc(100% + ${2*i}em)`),l.setStyle("top",n,"em"),l.setStyle("left",-i,"em")),this.body&&1!==this.body.length||(l.width=3*i,l.setStyle("width",`calc(100% + ${3*i}em)`),l.setStyle("left",-1.5*i,"em"));let c="";"incorrect"===this.correctness&&(c+='<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'),c&&(l.svgOverlay=c);const d=new da([l,a],{classes:"ML__prompt-atom"});return d.setStyle("position","relative"),d.setStyle("display","inline-block"),d.setStyle("line-height",0),d.height=a.height+o+.2,d.depth=a.depth+o,d.left=i,d.right=i,d.setStyle("height",a.height+o,"em"),d.setStyle("top",a.depth-a.height,"em"),d.setStyle("vertical-align",a.depth+o,"em"),d.setStyle("margin-left",.5,"em"),d.setStyle("margin-right",.5,"em"),this.caret&&(d.caret=this.caret),this.bind(t,this.attachSupsub(e,{base:d}))}_serialize(e){var t;const n=null!=(t=this.bodyToLatex(e))?t:"";if(e.skipPlaceholders)return n;let i="\\placeholder";return this.placeholderId&&(i+=`[${this.placeholderId}]`),"correct"===this.correctness?i+="[correct]":"incorrect"===this.correctness&&(i+="[incorrect]"),this.locked&&(i+="[locked]"),Qr(i,n)}},Gs=class e extends za{constructor(e){super({type:"subsup",style:null==e?void 0:e.style}),this.subsupPlacement="auto"}static fromJson(t){const n=new e(t);for(const e of Ka)t[e]&&n.setChildren(t[e],e);return n}render(e){var t;const n=new Ea({parent:e,isPhantom:!0}),i=this.leftSibling,o=null!=(t=i.render(n))?t:new da(null),r=new da(null);return r.height=o.height,r.depth=o.depth,this.attachSupsub(e,{base:r,isCharacterBox:i.isCharacterBox(),type:"ignore"})}_serialize(e){return this.supsubToLatex(e)}};function Zs(e){return!!e&&!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(e)}var Ys=class{constructor(e,t,n){var i,o,r,a;this.errors=[],this.index=0,this.endCount=0,null!=n||(n={}),this.tokens=e,this.context=t instanceof Ea&&!(null==n?void 0:n.parseMode)&&!n.mathstyle?t:new Ea({from:t,mathstyle:n.mathstyle},n.style),this.args=null!=(i=n.args)?i:void 0,this.smartFence=this.context.smartFence,this.parsingContext={parent:void 0,mathlist:[],style:null!=(o=n.style)?o:{},parseMode:null!=(r=n.parseMode)?r:"math",mathstyle:null!=(a=n.mathstyle)?a:"displaystyle",tabular:!1}}beginContext(e){var t,n,i;const o=this.parsingContext,r={parent:o,mathlist:[],style:d({},o.style),parseMode:null!=(t=null==e?void 0:e.mode)?t:o.parseMode,mathstyle:null!=(n=null==e?void 0:e.mathstyle)?n:o.mathstyle,tabular:null!=(i=null==e?void 0:e.tabular)&&i};this.parsingContext=r}endContext(){this.parsingContext=this.parsingContext.parent}onError(e){this.errors.push(d({before:ea(this.tokens.slice(this.index,this.index+10)),after:ea(this.tokens.slice(Math.max(0,this.index-10),this.index))},e))}get mathlist(){return this.parsingContext.mathlist}set mathlist(e){this.parsingContext.mathlist=e}get parseMode(){return this.parsingContext.parseMode}set parseMode(e){this.parsingContext.parseMode=e}get tabularMode(){return this.parsingContext.tabular}get style(){let e=this.parsingContext;for(;e;){if(e.style)return d({},e.style);e=e.parent}return{}}set style(e){this.parsingContext.style=e}end(){return this.endCount++,this.index>=this.tokens.length||this.endCount>1e3}next(){this.index+=1}get(){return this.endCount=0,this.index<this.tokens.length?this.tokens[this.index++]:""}peek(){return this.tokens[this.index]}match(e){return this.tokens[this.index]===e&&(this.index++,!0)}lastSubsupAtom(){let e;if(this.mathlist.length>0){if(e=this.mathlist[this.mathlist.length-1],"subsup"===e.type)return e;if(void 0!==e.subsupPlacement)return e}return e=new Gs({style:this.style}),this.mathlist.push(e),e}hasPattern(e){return e.test(this.tokens[this.index])}hasInfixCommand(){var e;const{index:t}=this;if(t<this.tokens.length&&this.tokens[t].startsWith("\\")){const n=ae(this.tokens[t],this.parseMode);return!(!n||"symbol"===n.definitionType)&&(!(n.ifMode&&!n.ifMode.includes(this.parseMode))&&(null!=(e=n.infix)&&e))}return!1}matchColumnSeparator(){if(!this.tabularMode)return!1;return"&"===this.peek()&&(this.index++,!0)}matchRowSeparator(){if(!this.tabularMode)return!1;const e=this.peek();return("\\\\"===e||"\\cr"===e||"\\tabularnewline"===e)&&(this.index++,!0)}placeholder(){var e;const t=null==(e=this.args)?void 0:e.call(this,"?");return t?Qs(t,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new Ds({mode:this.parseMode,style:this.style})]}skipWhitespace(){for(;this.match("<space>"););}skipUntilToken(e){let t=this.tokens[this.index];for(;t&&t!==e;)t=this.tokens[++this.index];t===e&&this.index++}skipFiller(){for(;this.match("\\relax")||this.match("<space>"););}matchKeyword(e){const t=this.index;let n=this.end(),i="";for(;!n;){const t=this.get();Zs(t)?(i+=t,n=this.end()||i.length>=e.length):n=!0}const o=e.toUpperCase()===i.toUpperCase();return o||(this.index=t),o}scanString(){let e="";for(;!this.end();){const t=this.peek();if("]"===t)return e;if("<space>"===t)e+=" ";else if(t.startsWith("\\"))this.onError({code:"unexpected-command-in-string"}),e+=t.substring(1);else{if(!Zs(t))return e;e+=t}this.next()}return e}scanBalancedString(){let e="",t=this.end(),n=1;for(;!t;){const i=this.get();"<space>"===i?e+=" ":"<{>"===i?(e+="{",n+=1):"<}>"===i?(n-=1,n>0?e+="}":this.index-=1):e+="<$>"===i?"$":"<$$>"===i?"$$":i,t=0===n||this.end()}return e}scanLiteralGroup(){var e;if(!this.match("<{>"))return"";let t="",n=1;for(;n>0&&!this.end();){const i=this.get();"<}>"===i?(n-=1,n>0&&(t+="}")):"<{>"===i?(n+=1,t+="{"):(/\\[a-zA-Z]+$/.test(t)&&/^[a-zA-Z]/.test(i)&&(t+=" "),t+=null!=(e={"<space>":" ","<$$>":"$$","<$>":"$"}[i])?e:i)}return t}scanNumber(e=!0){var t,n;let i=!1,o=this.peek();for(;"<space>"===o||"+"===o||"-"===o;)this.get(),"-"===o&&(i=!i),o=this.peek();e=Boolean(e);let r=10,a=/\d/;if(this.match("'"))r=8,a=/[0-7]/,e=!0;else if(this.match('"'))r=16,a=/[\dA-F]/,e=!0;else if(this.match("x"))r=16,a=/[\dA-Fa-f]/,e=!0;else if(this.match("`"))return o=this.get(),o?2===o.length&&o.startsWith("\\")?{number:(i?-1:1)*(null!=(t=o.codePointAt(1))?t:0),base:"alpha"}:{number:(i?-1:1)*(null!=(n=o.codePointAt(0))?n:0),base:"alpha"}:null;let s="";for(;this.hasPattern(a);)s+=this.get();if(!e&&(this.match(".")||this.match(",")))for(s+=".";this.hasPattern(a);)s+=this.get();const l=e?Number.parseInt(s,r):Number.parseFloat(s);return Number.isNaN(l)?null:{number:i?-l:l,base:16===r?"hexadecimal":8===r?"octal":"decimal"}}scanRegister(){var e;const t=this.index,n=this.scanNumber(!1);if(this.skipWhitespace(),this.match("\\relax"))return n;let i=!1;if(null===n)for(;;){const e=this.peek();if("-"===e)i=!i;else if("+"!==e)break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();const e=this.get();return e.startsWith("\\")?n?{register:e,global:!0,factor:(i?-1:1)*n.number}:i?{register:e,global:!0,factor:-1}:{register:e,global:!0}:(this.index=t,null)}let o=this.get();return(null==o?void 0:o.startsWith("\\"))?(o=o.substring(1),this.context.registers[o]?i&&null===n?{register:o}:{register:o,factor:(i?-1:1)*(null!=(e=null==n?void 0:n.number)?e:1)}:(this.index=t,null)):(this.index=t,null)}scanValue(){const e=this.scanRegister();if(e)return e;const t=this.index,n=this.scanGlueOrDimen();if(n&&("unit"in n||"glue"in n&&"unit"in n.glue))return n;this.index=t;const i=this.scanNumber();if(i)return i;if(this.end()||!Zs(this.peek()))return null;const o=this.scanString();return o.length>0?{string:o}:null}scanDimen(){const e=this.scanNumber(!1);if(null===e)return null;const t=e.number;let n;return this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace(),this.matchKeyword("pt")?n="pt":this.matchKeyword("mm")?n="mm":this.matchKeyword("cm")?n="cm":this.matchKeyword("ex")?n="ex":this.matchKeyword("px")?n="px":this.matchKeyword("em")?n="em":this.matchKeyword("bp")?n="bp":this.matchKeyword("dd")?n="dd":this.matchKeyword("pc")?n="pc":this.matchKeyword("in")?n="in":this.matchKeyword("mu")&&(n="mu"),n?{dimension:t,unit:n}:{dimension:t}}scanGlueOrDimen(){const e=this.scanDimen();if(null===e)return null;if(this.skipWhitespace(),this.match("\\relax"))return e;const t={glue:e};if(this.matchKeyword("plus")){const e=this.scanDimen();if(!e)return t;t.grow=e}if(this.skipWhitespace(),this.match("\\relax"))return t;if(this.skipWhitespace(),this.matchKeyword("minus")){const e=this.scanDimen();if(!e)return t;t.shrink=e}return t.grow||t.shrink?t:e}scanColspec(){this.skipWhitespace();const e=[];for(;!this.end()&&"<}>"!==this.peek()&&"]"!==this.peek();){const t=this.get();"c"===t||"r"===t||"l"===t?e.push({align:t}):"|"===t?e.push({separator:"solid"}):":"===t?e.push({separator:"dashed"}):"@"===t&&(this.match("<{>")&&(this.beginContext({mode:"math"}),e.push({gap:this.scan((e=>"<}>"===e))}),this.endContext()),this.match("<}>")||this.onError({code:"unbalanced-braces"}))}return e}scanModeSet(){let e;if(this.match("\\(")&&(e="textstyle"),!e&&this.match("\\[")&&(e="displaystyle"),!e)return null;this.beginContext({mode:"math",mathstyle:e});const t=this.scan((t=>t===("displaystyle"===e?"\\]":"\\)")));return this.match("displaystyle"===e?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),t}scanModeShift(){let e="";if(this.match("<$>")&&(e="<$>"),!e&&this.match("<$$>")&&(e="<$$>"),!e)return null;this.beginContext({mode:"math",mathstyle:"textstyle"});const t=this.scan((t=>t===e));return this.match(e)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),t}scanEnvironment(){if(!this.match("\\begin"))return null;const e=this.scanArgument("string");if(!e)return null;const t=null!=(n=H[e])?n:null;var n;if(!t)return this.onError({code:"unknown-environment",arg:e}),null;const i=[];if(t.params)for(const n of t.params)if(n.isOptional)i.push(this.scanOptionalArgument(n.type));else{const t=this.scanArgument(n.type);t||this.onError({code:"missing-argument",arg:e}),i.push(t)}this.beginContext({tabular:t.tabular});const o=[],r=[];let a=[],s=!1;do{if(this.end()&&(this.onError({code:"unbalanced-environment",arg:e}),s=!0),!s&&this.match("\\end")&&(this.scanArgument("string")!==e&&this.onError({code:"unbalanced-environment",arg:e}),s=!0),!s)if(this.matchColumnSeparator())a.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){a.push(this.mathlist),this.mathlist=[];let e=null;this.skipWhitespace(),this.match("[")&&(e=this.scanDimen(),this.skipWhitespace(),this.match("]")),r.push(null!=e?e:{dimension:0}),o.push(a),a=[]}else this.mathlist.push(...this.scan((e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(e))))}while(!s);return a.push(this.mathlist),a.length>0&&o.push(a),this.endContext(),t.createAtom(e,o,r,i)}scanExpression(){const e=this.mathlist;if(this.mathlist=[],this.parseExpression()){const t=this.mathlist;return this.mathlist=e,t}return this.mathlist=e,null}scan(e){this.beginContext(),e||(e=e=>"<}>"===e);let t,n="",i=null,o=[],r=null;for(;!this.end()&&!e(this.peek());)this.hasInfixCommand()&&!n?(n=this.get(),i=ae(n,"math"),i&&(o=this.scanArguments(i)[1]),r=this.mathlist,this.mathlist=[]):this.parseExpression();return n?(console.assert(Boolean(i)),o.unshift(this.mathlist),r&&o.unshift(r),t=[i.createAtom({command:n,args:o,style:this.style,mode:this.parseMode})]):t=this.mathlist,this.endContext(),t}scanGroup(){const e=this.index;if(!this.match("<{>"))return null;const t=this.scan((e=>"<}>"===e));this.match("<}>")||this.onError({code:"unbalanced-braces"});const n=new Hs(t,this.parseMode,this.style);return n.verbatimLatex=ea(this.tokens.slice(e,this.index)),n}scanSmartFence(){if(this.skipWhitespace(),!this.match("("))return null;this.beginContext();let e=1;for(;!this.end()&&0!==e;)this.match("(")&&(e+=1),this.match(")")&&(e-=1),0!==e&&this.parseExpression();const t=new Ws("",this.mathlist,{leftDelim:"(",rightDelim:0===e?")":"?"});return this.endContext(),t}scanDelim(){this.skipWhitespace();const e=this.peek();if(!e)return this.onError({code:"unexpected-end-of-string"}),null;if(!Zs(e)&&!e.startsWith("\\"))return null;this.next();const t=ae(e,"math");return t?"function"===t.definitionType&&t.ifMode&&!t.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:e}),null):"symbol"!==t.definitionType||"mopen"!==t.type&&"mclose"!==t.type?/^(\.|\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e)?e:(this.onError({code:"unexpected-delimiter",arg:e}),null):e:(this.onError({code:"unknown-command",arg:e}),null)}scanLeftRight(){var e;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new Vs("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new Vs("\\mright");let t="\\right";if(!this.match("\\left")){if(!this.match("\\mleft"))return null;t="\\mright"}const n=this.scanDelim();if(!n)return this.onError({code:"unexpected-delimiter"}),new Vs("\\right"===t?"\\left":"\\mleft");for(this.beginContext();!this.end()&&!this.match(t);)this.parseExpression();const i=this.mathlist;this.endContext();const o=null!=(e=this.scanDelim())?e:".";return new Ws("\\right"===t?"left...right":"mleft...mright",i,{leftDelim:n,rightDelim:o,style:this.style})}parseSupSub(){if("math"!==this.parseMode)return!1;let e=this.peek();if("^"!==e&&"_"!==e&&"'"!==e)return!1;const t=this.lastSubsupAtom();for(;"^"===e||"_"===e||"'"===e;)this.match("'")?this.match("'")?t.addChild(new za({type:"mord",command:"\\doubleprime",mode:"math",value:"′′"}),"superscript"):t.addChild(new za({type:"mord",command:"\\prime",mode:"math",value:"′"}),"superscript"):(this.match("^")||this.match("_"))&&t.addChildren(O(this.scanArgument("expression")),"_"===e?"subscript":"superscript"),e=this.peek();return!0}parseLimits(){if("math"!==this.parseMode)return!1;const e=this.match("\\limits"),t=!e&&this.match("\\nolimits"),n=!t&&!e&&this.match("\\displaylimits");if(!e&&!t&&!n)return!1;const i=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return null!==i&&(i.explicitSubsupPlacement=!0,e&&(i.subsupPlacement="over-under"),t&&(i.subsupPlacement="adjacent"),n&&(i.subsupPlacement="auto"),!0)}scanArguments(e){if(!(null==e?void 0:e.params))return[void 0,[]];let t;const n=[];let i=e.infix?2:0;for(;i<e.params.length;){const o=e.params[i];"rest"===o.type?n.push(this.scan((e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(e)))):o.isOptional?n.push(this.scanOptionalArgument(o.type)):o.type.endsWith("*")?t=o.type.slice(0,-1):n.push(this.scanArgument(o.type)),i+=1}return[t,n]}scanSymbolOrLiteral(){const e=this.peek();if(!e)return null;let t;if(this.next(),Zs(e)){const t=na.createAtom(this.parseMode,e,d({},this.style));return t?[t]:null}if(t=this.scanMacro(e),t)return[t];if(e.startsWith("\\")){const n=ae(e,this.parseMode);if(!n)return this.onError({code:"unknown-command",arg:e}),[new Vs(e)];if("symbol"===n.definitionType){const i=d({},this.style);n.variant&&(i.variant=n.variant),t=new za({type:n.type,command:e,style:i,value:String.fromCodePoint(n.codepoint),mode:this.parseMode,verbatimLatex:e})}else{if(n.applyMode||n.applyStyle||n.infix)return this.onError({code:"invalid-command",arg:e}),[new Vs(e)];n.createAtom&&(t=n.createAtom({command:e,args:[],style:this.style,mode:this.parseMode}))}}return t?[t]:null}scanArgument(e){var t;this.skipFiller();const n=this.parseMode;if("auto"===e&&(e=n),!this.match("<{>")){if("string"===e)return this.scanString();if("value"===e)return this.scanValue();if("delim"===e)return null!=(t=this.scanDelim())?t:".";if("expression"===e)return this.scanExpression();if("math"===e){e!==n&&this.beginContext({mode:"math"});const t=this.scanSymbolOrLiteral();return e!==n&&this.endContext(),t}if("text"===e){e!==n&&this.beginContext({mode:"text"});const t=this.scanSymbolOrLiteral();return e!==n&&this.endContext(),t}return"balanced-string"===e||console.assert(!1),null}if("text"===e){this.beginContext({mode:"text"});do{this.mathlist.push(...this.scan())}while(!this.match("<}>")&&!this.end());const e=this.mathlist;return this.endContext(),{group:e}}if("math"===e){this.beginContext({mode:"math"});do{this.mathlist.push(...this.scan())}while(!this.match("<}>")&&!this.end());const e=this.mathlist;return this.endContext(),{group:e}}let i=null;if("expression"===e){this.beginContext({mode:"math"});do{this.mathlist.push(...this.scan())}while(!this.match("<}>")&&!this.end());const e=this.mathlist;return this.endContext(),{group:e}}return"string"===e?i=this.scanString():"balanced-string"===e?i=this.scanBalancedString():"colspec"===e?i=this.scanColspec():"value"===e&&(i=this.scanValue()),this.skipUntilToken("<}>"),i}scanOptionalArgument(e){if(e="auto"===e?this.parseMode:e,this.skipFiller(),!this.match("["))return null;let t=null;for(;!this.end()&&!this.match("]");)if("string"===e)t=this.scanString();else if("value"===e)t=this.scanValue();else if("colspec"===e)t=this.scanColspec();else if("bbox"===e){const e={},n=this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const t of n){const n=t.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(n)e.padding={dimension:parseInt(n[1]),unit:n[2]};else{const n=t.match(/^\s*border\s*:\s*(.*)/);n?e.border=n[1]:e.backgroundcolor={string:t}}}t=e}else"math"===e&&(this.beginContext({mode:"math"}),t=this.mathlist.concat(this.scan((e=>"]"===e))),this.endContext());return t}scanSymbolOrCommand(e){var t,n,i;if("\\placeholder"===e){const e=this.scanOptionalArgument("string"),t=this.scanOptionalArgument("math"),n=za.serialize(t,{defaultMode:"math"});let i,o=[];i||"correct"!==n?i||"incorrect"!==n?""!==n&&(o=t):i="incorrect":i="correct";const r="locked"===this.scanOptionalArgument("string"),a=this.scanArgument("auto");let s;return s=a&&Array.isArray(a)&&a.length>0?a:a&&"object"==typeof a&&"group"in a?a.group:o,e?[new Xs(e,i,r,null!=s?s:o,{mode:this.parseMode,style:this.style})]:[new Ds({mode:this.parseMode,style:this.style})]}if("\\renewcommand"===e||"\\newcommand"===e||"\\providecommand"===e||"\\def"===e){const t=this.index,n=this.scanLiteralGroup()||this.next();if(!n)return null;if(this.context.registers[n.substring(1)]){const i=this.scanArgument("string");null!==i&&(this.context.registers[n.substring(1)]=i);const o=Yr([e,ea(this.tokens.slice(t,this.index))]);return[new za({type:"text",value:"",verbatimLatex:o})]}}let o=this.scanMacro(e);if(o)return[o];const r=ae(e,this.parseMode);if(!r)return"text"===this.parseMode?(/[a-zA-Z]/.test(null!=(t=this.peek())?t:"")&&(e+=" "),[...e].map((e=>new za({type:"text",value:e,mode:"text",style:this.style})))):(this.onError({code:"unknown-command",arg:e}),[new Vs(e)]);const a=this.index;if("symbol"===r.definitionType){const t=d({},this.style);r.variant&&(t.variant=r.variant),o=new za({type:r.type,command:e,style:t,value:String.fromCodePoint(r.codepoint),mode:this.parseMode})}else{if(r.ifMode&&!r.ifMode.includes(this.parseMode))return[];const t=this.parseMode;let a;r.applyMode&&(this.parseMode=r.applyMode);let s=[];if(r.parse?s=r.parse(this):[a,s]=this.scanArguments(r),this.parseMode=t,r.applyMode&&!r.applyStyle&&!r.createAtom)return O(s[0]);if(r.infix)return this.onError({code:"too-many-infix-commands",arg:e}),null;if("function"==typeof r.createAtom)o=r.createAtom({command:e,args:s,style:this.style,mode:this.parseMode}),a&&(o.body=O(this.scanArgument(a)));else if("function"==typeof r.applyStyle){const t=d(d({},this.style),r.applyStyle(e,s,this.context)),n=this.parseMode;if(r.applyMode&&(this.parseMode=r.applyMode),a){const e=this.style;this.style=t;const i=this.scanArgument(a);return this.style=e,this.parseMode=n,O(i)}this.style=t}else o=new za({type:"mord",command:null!=(n=r.command)?n:e,style:d({},this.style),value:e,mode:null!=(i=r.applyMode)?i:this.parseMode})}if(!o)return null;if(o instanceof za&&void 0===o.verbatimLatex&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){const t=Yr([e,ea(this.tokens.slice(a,this.index))]);t&&(o.verbatimLatex=t)}if(null===o.verbatimLatex&&(o.verbatimLatex=void 0),o.isFunction&&this.smartFence){const e=this.scanSmartFence();if(e)return[o,e]}return[o]}scanSymbolCommandOrLiteral(){const e=this.get();if(!e)return null;if(Zs(e)){const t=na.createAtom(this.parseMode,e,d({},this.style));if(!t)return null;if(t.isFunction&&this.smartFence){const e=this.scanSmartFence();if(e)return[t,e]}return[t]}return e.startsWith("\\")?this.scanSymbolOrCommand(e):"<space>"===e?"text"===this.parseMode?[new $a(" "," ",this.style)]:null:("<}>"===e?this.onError({latex:"",code:"unbalanced-braces"}):this.onError({latex:"",code:"unexpected-token",arg:e}),null)}scanMacro(e){var t;const n=this.context.getMacro(e);if(!n)return null;const i=this.index,o=n.args,r={"?":null==(t=this.args)?void 0:t.call(this,"?")};for(let e=1;e<=o;e++){let t=this.scanLiteralGroup();if(!t){const e=this.index;this.scanExpression(),t=ea(this.tokens.slice(e,this.index))}r[e]=t}return new Us(e,{expand:n.expand,captureSelection:n.captureSelection,args:i===this.index?null:ea(this.tokens.slice(i,this.index)),style:this.parsingContext.style,body:Qs(n.def,{context:this.context,parseMode:this.parseMode,args:e=>r[e],mathstyle:this.parsingContext.mathstyle,style:this.parsingContext.style})})}parseExpression(){var e,t,n,i;let o=null!=(i=null!=(n=null!=(t=null!=(e=this.scanEnvironment())?e:this.scanModeShift())?t:this.scanModeSet())?n:this.scanGroup())?i:this.scanLeftRight();if(null===o){if(this.parseSupSub())return!0;if(this.parseLimits())return!0;o=this.scanSymbolCommandOrLiteral()}return!!o&&(Array.isArray(o)?this.mathlist.push(...o):this.mathlist.push(o),!0)}};function Qs(e,t){var n,i,o,r;const a=null!=(n=null==t?void 0:t.args)?n:void 0,s=new Ys(Zr(e,a),null==t?void 0:t.context,{args:a,mathstyle:null!=(i=null==t?void 0:t.mathstyle)?i:"displaystyle",parseMode:null!=(o=null==t?void 0:t.parseMode)?o:"math",style:null!=(r=null==t?void 0:t.style)?r:{}}),l=[];for(;!s.end();)l.push(...s.scan((()=>!1)));return l}function el(e,t){var n;const i=new Ys(Zr(e,null),null==t?void 0:t.context,{mathstyle:"displaystyle",parseMode:null!=(n=null==t?void 0:t.parseMode)?n:"math"});for(;!i.end();)i.scan();return i.errors}var tl=class e extends za{constructor(e,t){super({type:"chem"},{command:e,mode:"math"});const n=il.go(nl.go(t,"\\pu"===e?"pu":"ce"),!1);this.body=Qs(n),this._verbatimLatex=e+"{"+t+"}",this.arg=t,this.captureSelection=!0}static fromJson(t){return new e(t.command,t.arg)}set verbatimLatex(e){}get verbatimLatex(){return this._verbatimLatex}toJson(){return h(d({},super.toJson()),{arg:this.arg})}render(e){const t=za.createBox(e,this.body,{type:"inner"});return this.caret&&(t.caret=this.caret),this.bind(e,t)}_serialize(e){return console.assert(void 0!==this.verbatimLatex),this.verbatimLatex}};ne(["ce","pu"],"{chemformula:balanced-string}",{createAtom:e=>{var t;return new tl(e.command,null!=(t=e.args[0])?t:"")}});var nl={go:function(e,t){if(!e)return[];void 0===t&&(t="ce");var n,i="0",o={};o.parenthesisLevel=0,e=(e=(e=e.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var r=10,a=[];;){n!==e?(r=10,n=e):r--;var s=nl.stateMachines[t],l=s.transitions[i]||s.transitions["*"];e:for(var c=0;c<l.length;c++){var d=nl.patterns.match_(l[c].pattern,e);if(d){for(var h=l[c].task,u=0;u<h.action_.length;u++){var p;if(s.actions[h.action_[u].type_])p=s.actions[h.action_[u].type_](o,d.match_,h.action_[u].option);else{if(!nl.actions[h.action_[u].type_])throw["MhchemBugA","mhchem bug A. Please report. ("+h.action_[u].type_+")"];p=nl.actions[h.action_[u].type_](o,d.match_,h.action_[u].option)}nl.concatArray(a,p)}if(i=h.nextState||i,!(e.length>0))return a;if(h.revisit||(e=d.remainder),!h.toContinue)break e}}if(r<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,t){if(t)if("[object Array]"===Object.prototype.toString.call(t))for(var n=0;n<t.length;n++)e.push(t[n]);else e.push(t)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.slice(1),remainder:e.substr(t[0].length)}:null},"(-)(9)^(-9)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return t&&t[0]?{match_:t.slice(1),remainder:e.substr(t[0].length)}:null},"state of aggregation $":function(e){var t=nl.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var n=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return n?{match_:n[0],remainder:e.substr(n[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return nl.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return nl.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return nl.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return nl.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return nl.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return nl.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return nl.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return nl.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return nl.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return nl.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return nl.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return nl.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return nl.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return nl.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return nl.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return nl.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return nl.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return nl.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return nl.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return nl.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return nl.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return nl.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return nl.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return nl.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return nl.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var t;if(t=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{match_:t[0],remainder:e.substr(t[0].length)};var n=nl.patterns.findObserveGroups(e,"","$","$","");return n&&(t=n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:t[0],remainder:e.substr(t[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var t=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:e.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,t,n,i,o,r,a,s,l,c){var d=function(e,t){if("string"==typeof t)return 0!==e.indexOf(t)?null:t;var n=e.match(t);return n?n[0]:null},h=d(e,t);if(null===h)return null;if(e=e.substr(h.length),null===(h=d(e,n)))return null;var u=function(e,t,n){for(var i=0;t<e.length;){var o=e.charAt(t),r=d(e.substr(t),n);if(null!==r&&0===i)return{endMatchBegin:t,endMatchEnd:t+r.length};if("{"===o)i++;else if("}"===o){if(0===i)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];i--}t++}return null}(e,h.length,i||o);if(null===u)return null;var p=e.substring(0,i?u.endMatchEnd:u.endMatchBegin);if(r||a){var m=this.findObserveGroups(e.substr(u.endMatchEnd),r,a,s,l);if(null===m)return null;var f=[p,m.match_];return{match_:c?f.join(""):f,remainder:m.remainder}}return{match_:p,remainder:e.substr(u.endMatchEnd)}},match_:function(e,t){var n=nl.patterns.patterns[e];if(void 0===n)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if("function"==typeof n)return nl.patterns.patterns[e](t);var i=t.match(n);return i?{match_:i[2]?[i[1],i[2]]:i[1]?i[1]:i[0],remainder:t.substr(i[0].length)}:null}},actions:{"a=":function(e,t){e.a=(e.a||"")+t},"b=":function(e,t){e.b=(e.b||"")+t},"p=":function(e,t){e.p=(e.p||"")+t},"o=":function(e,t){e.o=(e.o||"")+t},"q=":function(e,t){e.q=(e.q||"")+t},"d=":function(e,t){e.d=(e.d||"")+t},"rm=":function(e,t){e.rm=(e.rm||"")+t},"text=":function(e,t){e.text_=(e.text_||"")+t},insert:function(e,t,n){return{type_:n}},"insert+p1":function(e,t,n){return{type_:n,p1:t}},"insert+p1+p2":function(e,t,n){return{type_:n,p1:t[0],p2:t[1]}},copy:function(e,t){return t},rm:function(e,t){return{type_:"rm",p1:t||""}},text:function(e,t){return nl.go(t,"text")},"{text}":function(e,t){var n=["{"];return nl.concatArray(n,nl.go(t,"text")),n.push("}"),n},"tex-math":function(e,t){return nl.go(t,"tex-math")},"tex-math tight":function(e,t){return nl.go(t,"tex-math tight")},bond:function(e,t,n){return{type_:"bond",kind_:n||t}},"color0-output":function(e,t){return{type_:"color0",color:t[0]}},ce:function(e,t){return nl.go(t)},"1/2":function(e,t){var n=[];t.match(/^[+\-]/)&&(n.push(t.substr(0,1)),t=t.substr(1));var i=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return i[1]=i[1].replace(/\$/g,""),n.push({type_:"frac",p1:i[1],p2:i[2]}),i[3]&&(i[3]=i[3].replace(/\$/g,""),n.push({type_:"tex-math",p1:i[3]})),n},"9,9":function(e,t){return nl.go(t,"9,9")}},createTransitions:function(e){var t,n,i,o,r={};for(t in e)for(n in e[t])for(i=n.split("|"),e[t][n].stateArray=i,o=0;o<i.length;o++)r[i[o]]=[];for(t in e)for(n in e[t])for(i=e[t][n].stateArray||[],o=0;o<i.length;o++){var a=e[t][n];if(a.action_){a.action_=[].concat(a.action_);for(var s=0;s<a.action_.length;s++)"string"==typeof a.action_[s]&&(a.action_[s]={type_:a.action_[s]})}else a.action_=[];for(var l=t.split("|"),c=0;c<l.length;c++)if("*"===i[o])for(var d in r)r[d].push({pattern:l[c],task:a});else r[i[o]].push({pattern:l[c],task:a})}return r},stateMachines:{}};nl.stateMachines={ce:{transitions:nl.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,t){var n;if((e.d||"").match(/^[0-9]+$/)){var i=e.d;e.d=void 0,n=this.output(e),e.b=i}else n=this.output(e);return nl.actions["o="](e,t),n},"d= kv":function(e,t){e.d=t,e.dType="kv"},"charge or bond":function(e,t){if(e.beginsWithBond){var n=[];return nl.concatArray(n,this.output(e)),nl.concatArray(n,nl.actions.bond(e,t,"-")),n}e.d=t},"- after o/d":function(e,t,n){var i=nl.patterns.match_("orbital",e.o||""),o=nl.patterns.match_("one lowercase greek letter $",e.o||""),r=nl.patterns.match_("one lowercase latin letter $",e.o||""),a=nl.patterns.match_("$one lowercase latin letter$ $",e.o||""),s="-"===t&&(i&&""===i.remainder||o||r||a);!s||e.a||e.b||e.p||e.d||e.q||i||!r||(e.o="$"+e.o+"$");var l=[];return s?(nl.concatArray(l,this.output(e)),l.push({type_:"hyphen"})):(i=nl.patterns.match_("digits",e.d||""),n&&i&&""===i.remainder?(nl.concatArray(l,nl.actions["d="](e,t)),nl.concatArray(l,this.output(e))):(nl.concatArray(l,this.output(e)),nl.concatArray(l,nl.actions.bond(e,t,"-")))),l},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,t){return{type_:"state of aggregation",p1:nl.go(t,"o")}},comma:function(e,t){var n=t.replace(/\s*$/,"");return n!==t&&0===e.parenthesisLevel?{type_:"comma enumeration L",p1:n}:{type_:"comma enumeration M",p1:n}},output:function(e,t,n){var i,o,r;e.r?(o="M"===e.rdt?nl.go(e.rd,"tex-math"):"T"===e.rdt?[{type_:"text",p1:e.rd||""}]:nl.go(e.rd),r="M"===e.rqt?nl.go(e.rq,"tex-math"):"T"===e.rqt?[{type_:"text",p1:e.rq||""}]:nl.go(e.rq),i={type_:"arrow",r:e.r,rd:o,rq:r}):(i=[],(e.a||e.b||e.p||e.o||e.q||e.d||n)&&(e.sb&&i.push({type_:"entitySkip"}),e.o||e.q||e.d||e.b||e.p||2===n?e.o||e.q||e.d||!e.b&&!e.p?e.o&&"kv"===e.dType&&nl.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&"kv"===e.dType&&!e.q&&(e.dType=void 0):(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):(e.o=e.a,e.a=void 0),i.push({type_:"chemfive",a:nl.go(e.a,"a"),b:nl.go(e.b,"bd"),p:nl.go(e.p,"pq"),o:nl.go(e.o,"o"),q:nl.go(e.q,"pq"),d:nl.go(e.d,"oxidation"===e.dType?"oxidation":"bd"),dType:e.dType})));for(var a in e)"parenthesisLevel"!==a&&"beginsWithBond"!==a&&delete e[a];return i},"oxidation-output":function(e,t){var n=["{"];return nl.concatArray(n,nl.go(t,"oxidation")),n.push("}"),n},"frac-output":function(e,t){return{type_:"frac-ce",p1:nl.go(t[0]),p2:nl.go(t[1])}},"overset-output":function(e,t){return{type_:"overset",p1:nl.go(t[0]),p2:nl.go(t[1])}},"underset-output":function(e,t){return{type_:"underset",p1:nl.go(t[0]),p2:nl.go(t[1])}},"underbrace-output":function(e,t){return{type_:"underbrace",p1:nl.go(t[0]),p2:nl.go(t[1])}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:nl.go(t[1])}},"r=":function(e,t){e.r=t},"rdt=":function(e,t){e.rdt=t},"rd=":function(e,t){e.rd=t},"rqt=":function(e,t){e.rqt=t},"rq=":function(e,t){e.rq=t},operator:function(e,t,n){return{type_:"operator",kind_:n||t}}}},a:{transitions:nl.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:nl.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:nl.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var t={type_:"text",p1:e.text_};for(var n in e)delete e[n];return t}}}},pq:{transitions:nl.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,t){return{type_:"state of aggregation subscript",p1:nl.go(t,"o")}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:nl.go(t[1],"pq")}}}},bd:{transitions:nl.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,t){return{type_:"color",color1:t[0],color2:nl.go(t[1],"bd")}}}},oxidation:{transitions:nl.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,t){return{type_:"roman numeral",p1:t||""}}}},"tex-math":{transitions:nl.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var n in e)delete e[n];return t}}}},"tex-math tight":{transitions:nl.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,t){e.o=(e.o||"")+"{"+t+"}"},output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var n in e)delete e[n];return t}}}},"9,9":{transitions:nl.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:nl.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,t){var n=[];return"+-"===t[0]||"+/-"===t[0]?n.push("\\pm "):t[0]&&n.push(t[0]),t[1]&&(nl.concatArray(n,nl.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?nl.concatArray(n,nl.go(t[2],"pu-9,9")):n.push(t[2])),(t[3]||t[4])&&("e"===t[3]||"*"===t[4]?n.push({type_:"cdot"}):n.push({type_:"times"}))),t[5]&&n.push("10^{"+t[5]+"}"),n},"number^":function(e,t){var n=[];return"+-"===t[0]||"+/-"===t[0]?n.push("\\pm "):t[0]&&n.push(t[0]),nl.concatArray(n,nl.go(t[1],"pu-9,9")),n.push("^{"+t[2]+"}"),n},operator:function(e,t,n){return{type_:"operator",kind_:n||t}},space:function(){return{type_:"pu-space-1"}},output:function(e){var t,n=nl.patterns.match_("{(...)}",e.d||"");n&&""===n.remainder&&(e.d=n.match_);var i=nl.patterns.match_("{(...)}",e.q||"");if(i&&""===i.remainder&&(e.q=i.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var o={d:nl.go(e.d,"pu"),q:nl.go(e.q,"pu")};"//"===e.o?t={type_:"pu-frac",p1:o.d,p2:o.q}:(t=o.d,o.d.length>1||o.q.length>1?t.push({type_:" / "}):t.push({type_:"/"}),nl.concatArray(t,o.q))}else t=nl.go(e.d,"pu-2");for(var r in e)delete e[r];return t}}},"pu-2":{transitions:nl.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,t){e.rm+="^{"+t+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var t=[];if(e.rm){var n=nl.patterns.match_("{(...)}",e.rm||"");t=n&&""===n.remainder?nl.go(n.match_,"pu"):{type_:"rm",p1:e.rm}}for(var i in e)delete e[i];return t}}},"pu-9,9":{transitions:nl.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){var n=e.text_.length%3;0===n&&(n=3);for(var i=e.text_.length-3;i>0;i-=3)t.push(e.text_.substr(i,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(0,n)),t.reverse()}else t.push(e.text_);for(var o in e)delete e[o];return t},"output-o":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){for(var n=e.text_.length-3,i=0;i<n;i+=3)t.push(e.text_.substr(i,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(i))}else t.push(e.text_);for(var o in e)delete e[o];return t}}}};var il={go:function(e,t){if(!e)return"";for(var n="",i=!1,o=0;o<e.length;o++){var r=e[o];"string"==typeof r?n+=r:(n+=il._go2(r),"1st-level escape"===r.type_&&(i=!0))}return t||i||!n||(n="{"+n+"}"),n},_goInner:function(e){return e?il.go(e,!0):e},_go2:function(e){var t;switch(e.type_){case"chemfive":t="";var n={a:il._goInner(e.a),b:il._goInner(e.b),p:il._goInner(e.p),o:il._goInner(e.o),q:il._goInner(e.q),d:il._goInner(e.d)};n.a&&(n.a.match(/^[+\-]/)&&(n.a="{"+n.a+"}"),t+=n.a+"\\,"),(n.b||n.p)&&(t+="{\\vphantom{X}}",t+="^{\\hphantom{"+(n.b||"")+"}}_{\\hphantom{"+(n.p||"")+"}}",t+="{\\vphantom{X}}",t+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(n.b||"")+"}}",t+="_{\\vphantom{2}\\llap{\\smash[t]{"+(n.p||"")+"}}}"),n.o&&(n.o.match(/^[+\-]/)&&(n.o="{"+n.o+"}"),t+=n.o),"kv"===e.dType?((n.d||n.q)&&(t+="{\\vphantom{X}}"),n.d&&(t+="^{"+n.d+"}"),n.q&&(t+="_{\\smash[t]{"+n.q+"}}")):"oxidation"===e.dType?(n.d&&(t+="{\\vphantom{X}}",t+="^{"+n.d+"}"),n.q&&(t+="{\\vphantom{X}}",t+="_{\\smash[t]{"+n.q+"}}")):(n.q&&(t+="{\\vphantom{X}}",t+="_{\\smash[t]{"+n.q+"}}"),n.d&&(t+="{\\vphantom{X}}",t+="^{"+n.d+"}"));break;case"rm":case"roman numeral":t="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),t="\\mathrm{"+e.p1+"}"):t="\\text{"+e.p1+"}";break;case"state of aggregation":t="\\mskip2mu "+il._goInner(e.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+il._goInner(e.p1);break;case"bond":if(!(t=il._getBond(e.kind_)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var i="\\frac{"+e.p1+"}{"+e.p2+"}";t="\\mathchoice{\\textstyle"+i+"}{"+i+"}{"+i+"}{"+i+"}";break;case"pu-frac":var o="\\frac{"+il._goInner(e.p1)+"}{"+il._goInner(e.p2)+"}";t="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"tex-math":case"1st-level escape":t=e.p1+" ";break;case"frac-ce":t="\\frac{"+il._goInner(e.p1)+"}{"+il._goInner(e.p2)+"}";break;case"overset":t="\\overset{"+il._goInner(e.p1)+"}{"+il._goInner(e.p2)+"}";break;case"underset":t="\\underset{"+il._goInner(e.p1)+"}{"+il._goInner(e.p2)+"}";break;case"underbrace":t="\\underbrace{"+il._goInner(e.p1)+"}_{"+il._goInner(e.p2)+"}";break;case"color":t="{\\color{"+e.color1+"}{"+il._goInner(e.color2)+"}}";break;case"color0":t="\\color{"+e.color+"}";break;case"arrow":var r={rd:il._goInner(e.rd),rq:il._goInner(e.rq)},a=il._getArrow(e.r);r.rd||r.rq?"<=>"===e.r||"<=>>"===e.r||"<<=>"===e.r||"<--\x3e"===e.r?(a="\\long"+a,r.rd&&(a="\\overset{"+r.rd+"}{"+a+"}"),r.rq&&(a="<--\x3e"===e.r?"\\underset{\\lower2mu{"+r.rq+"}}{"+a+"}":"\\underset{\\lower6mu{"+r.rq+"}}{"+a+"}"),a=" {}\\mathrel{"+a+"}{} "):(r.rq&&(a+="[{"+r.rq+"}]"),a=" {}\\mathrel{\\x"+(a+="{"+r.rd+"}")+"}{} "):a=" {}\\mathrel{\\long"+a+"}{} ",t=a;break;case"operator":t=il._getOperator(e.kind_);break;case"space":t=" ";break;case"entitySkip":case"pu-space-1":t="~";break;case"pu-space-2":t="\\mkern3mu ";break;case"1000 separator":t="\\mkern2mu ";break;case"commaDecimal":t="{,}";break;case"comma enumeration L":t="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":t="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":t="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":t="\\text{-}";break;case"addition compound":t="\\,{\\cdot}\\,";break;case"electron dot":t="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":t="{\\times}";break;case"prime":t="\\prime ";break;case"cdot":t="\\cdot ";break;case"tight cdot":t="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":t="\\times ";break;case"circa":t="{\\sim}";break;case"^":t="uparrow";break;case"v":t="downarrow";break;case"ellipsis":t="\\ldots ";break;case"/":t="/";break;case" / ":t="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return t},_getArrow:function(e){switch(e){case"->":case"→":case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"leftrightarrows";case"<=>":case"⇌":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};var ol=class e extends za{constructor(e){super(h(d({},e),{type:"delim"})),this.value=e.delim,this.size=e.size}static fromJson(t){return new e(t)}toJson(){return h(d({},super.toJson()),{delim:this.value,size:this.size})}render(e){return new da(this.value,{type:"middle"})}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const t=ae(this.command,this.mode);return(null==t?void 0:t.serialize)?t.serialize(this,e):Qr(this.command,this.value)}},rl=class e extends za{constructor(e){super(h(d({},e),{type:"sizeddelim",value:e.delim})),this.delimType=e.delimType,this.size=e.size}static fromJson(t){return new e(t)}toJson(){return h(d({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(e){let t=function(e,t,n,i){return void 0===e||"."===e?As(n,i.classes):("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),ws.has(e)||ks.has(e)?vs(e,t,!1,n,i):_s.has(e)?xs(e,Ms[t],!1,n,i):(console.assert(!1,"Unknown delimiter '"+e+"'"),null))}(this.value,this.size,e,{classes:{open:"mopen",close:"mclose"}[this.delimType],type:this.delimType,isSelected:this.isSelected});return t?(t=this.bind(e,t),this.caret&&(t.caret=this.caret),t):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const t=ae(this.command,this.mode);return(null==t?void 0:t.serialize)?t.serialize(this,e):Qr(this.command,this.value)}},al=class e extends za{constructor(e,t,n,i){var o,r;super({type:"enclose",command:e,style:i.style}),this.body=t,this.backgroundcolor=i.backgroundcolor,n.updiagonalarrow&&(n.updiagonalstrike=!1),n.box&&(n.left=!1,n.right=!1,n.bottom=!1,n.top=!1),this.notation=n,this.shadow=null!=(o=i.shadow)?o:"none",this.strokeWidth=null!=(r=i.strokeWidth)?r:"0.06em",this.strokeWidth||(this.strokeWidth="0.06em"),this.strokeStyle=i.strokeStyle,this.svgStrokeStyle=i.svgStrokeStyle,this.strokeColor=i.strokeColor,this.borderStyle=i.borderStyle,this.padding=i.padding,this.captureSelection=!1}static fromJson(t){return new e(t.command,t.body,t.notation,t)}toJson(){return h(d({},super.toJson()),{notation:this.notation,shadow:this.shadow,strokeWidth:this.strokeWidth,strokeStyle:this.strokeStyle,svgStrokeStyle:this.svgStrokeStyle,strokeColor:this.strokeColor,borderStyle:this.borderStyle,padding:this.padding})}_serialize(e){var t;if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const n=ae(this.command,this.mode);if(null==n?void 0:n.serialize)return n.serialize(this,e);let i=null!=(t=this.command)?t:"";if("\\enclose"===this.command){i+="{"+Object.keys(this.notation).join(" ")+"}";let e="",t="";this.backgroundcolor&&"transparent"!==this.backgroundcolor&&(e+=t+'mathbackground="'+this.backgroundcolor+'"',t=","),this.shadow&&"auto"!==this.shadow&&(e+=t+'shadow="'+this.shadow+'"',t=","),this.strokeWidth||"solid"!==this.strokeStyle?(e+=t+this.borderStyle,t=","):this.strokeColor&&"currentColor"!==this.strokeColor&&(e+=t+'mathcolor="'+this.strokeColor+'"',t=","),e&&(i+=`[${e}]`)}return Qr(i,this.bodyToLatex(e))}render(e){const t=new Ea({parent:e},this.style),n=za.createBox(t,this.body);if(!n)return null;const i=function(e){if(!e)return"1px";const t=e.match(/([0-9][a-zA-Z\%]+)/);return null===t?"1px":t[1]}(this.borderStyle),o=t.toEm(this.padding&&"auto"!==this.padding?{string:this.padding}:{register:"fboxsep"});n.setStyle("position","relative"),n.setStyle("display","inline-block"),n.setStyle("top",o,"em"),n.setStyle("height",n.height+n.depth,"em"),n.setStyle("width",n.width,"em");const r=new da(null,{classes:"ML__notation"});let a=n.height+n.depth+2*o;const s=n.width+2*o;let l="";if(this.notation.horizontalstrike&&(l+=this.line(3,50,97,50)),this.notation.verticalstrike&&(l+=this.line(50,3,50,97)),this.notation.updiagonalstrike&&(l+=this.line(3,97,97,3)),this.notation.downdiagonalstrike&&(l+=this.line(3,3,97,97)),this.notation.updiagonalarrow){l+=this.line(o.toString(),(o+n.depth+n.height).toString(),(o+n.width).toString(),o.toString());const e=1,t=.03*Math.sqrt(s*s+a*a)*e,i=n.width*t,r=(n.depth+n.height)*t,c=o+n.width;let d=o;d+r-.4*i<0&&(d=.4*i-r),l+='<polygon points="',l+=`${c},${d} ${c-i-.4*r},${d+r-.4*i} `,l+=`${c-.7*i},${d+.7*r} ${c-i+.4*r},${d+r+.4*i} `,l+=`${c},${d}`,l+=`" stroke='none' fill="${this.strokeColor}"`,l+="/>"}let c=0;if(this.notation.phasorangle){const e=ll(t),i=(n.height+n.depth+2*e+o).toString(),r=(n.height+n.depth)/2;l+=this.line(o.toString(),i,(o+r+n.width).toString(),i),l+=this.line(o.toString(),i,(o+r).toString(),(o-e).toString()),a+=e,c=r,n.left+=a/2-o}if(this.notation.longdiv){const e=ll(t);a+=e,l+=this.line(o.toString(),o.toString(),(o+n.width).toString(),o.toString());const i=.3;c=i+e,n.left+=i+e,n.setTop(o+e),l+='<path d="',l+=`M ${o} ${o} a${i} ${(n.depth+n.height+2*e)/2}, 0, 1, 1, 0 ${n.depth+n.height+2*e} "`,l+=` stroke-width="${d=t,(Math.floor(100*d.metrics.sqrtRuleThickness/d.scalingFactor)/100/10).toString()+"em"}" stroke="${this.strokeColor}" fill="none"`,l+="/>"}var d;if(r.width=n.width+2*o+c,r.height=n.height+o,r.depth=n.depth+o,r.setStyle("box-sizing","border-box"),r.setStyle("left",`calc(-${i} / 2 )`),r.setStyle("height",Math.floor(100*a)/100+"em"),r.setStyle("top",`calc(${i} / 2 )`),this.backgroundcolor&&r.setStyle("background-color",this.backgroundcolor),this.notation.box&&r.setStyle("border","1px solid red"),this.notation.actuarial&&(r.setStyle("border-top",this.borderStyle),r.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(r.setStyle("border-bottom",this.borderStyle),r.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(r.setStyle("border-radius","8px"),r.setStyle("border",this.borderStyle)),this.notation.circle&&(r.setStyle("border-radius","50%"),r.setStyle("border",this.borderStyle)),this.notation.top&&r.setStyle("border-top",this.borderStyle),this.notation.left&&r.setStyle("border-left",this.borderStyle),this.notation.right&&r.setStyle("border-right",this.borderStyle),this.notation.bottom&&r.setStyle("border-bottom",this.borderStyle),l){let e="";"auto"===this.shadow&&(e+="filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"),"none"!==this.shadow&&(e+=`filter: drop-shadow(${this.shadow})`),e+=` stroke-width="${this.strokeWidth}" stroke="${this.strokeColor}"`,e+=' stroke-linecap="round"',this.svgStrokeStyle&&(e+=` stroke-dasharray="${this.svgStrokeStyle}"`),r.svgStyle=e,r.svgOverlay=l}const h=new da([r,n]);return h.setStyle("position","relative"),h.setStyle("vertical-align",o,"em"),h.setStyle("height",Math.floor(100*(n.height+n.depth+2*o))/100+"em"),h.setStyle("display","inline-block"),h.height=r.height,h.depth=r.depth,h.width=r.width-2*o,h.left=o,h.right=o,this.caret&&(h.caret=this.caret),h.wrap(t)}line(e,t,n,i){return`<line x1="${sl(e)}" y1="${sl(t)}" x2="${sl(n)}" y2="${sl(i)}" vector-effect="non-scaling-stroke"></line>`}};function sl(e){return"number"==typeof e?Math.floor(100*e)/100+"%":e}function ll(e){const t=e.isDisplayStyle?$r:e.metrics.defaultRuleThickness;return e.metrics.defaultRuleThickness+e.scalingFactor*t/4}var cl=class e extends za{constructor(e,t,n){var i,o;super(h(d({},n),{type:"genfrac",displayContainsHighlight:!0})),this.above=e,this.below=t,this.hasBarLine=null==(i=null==n?void 0:n.hasBarLine)||i,this.continuousFraction=null!=(o=null==n?void 0:n.continuousFraction)&&o,this.numerPrefix=null==n?void 0:n.numerPrefix,this.denomPrefix=null==n?void 0:n.denomPrefix,this.mathstyleName=null==n?void 0:n.mathstyleName,this.leftDelim=null==n?void 0:n.leftDelim,this.rightDelim=null==n?void 0:n.rightDelim,this.fractionNavigationOrder=null==n?void 0:n.fractionNavigationOrder}static fromJson(t){return new e(t.above,t.below,t)}toJson(){const e={};return this.continuousFraction&&(e.continuousFraction=!0),this.numerPrefix&&(e.numerPrefix=this.numerPrefix),this.denomPrefix&&(e.denomPrefix=this.denomPrefix),this.leftDelim&&(e.leftDelim=this.leftDelim),this.rightDelim&&(e.rightDelim=this.rightDelim),this.hasBarLine||(e.hasBarLine=!1),this.mathstyleName&&(e.mathstyleName=this.mathstyleName),this.fractionNavigationOrder&&(e.fractionNavigationOrder=this.fractionNavigationOrder),d(d({},super.toJson()),e)}get children(){if(this._children)return this._children;const e=[];if("denominator-numerator"===this.fractionNavigationOrder){for(const t of this.below)e.push(...t.children),e.push(t);for(const t of this.above)e.push(...t.children),e.push(t)}else{for(const t of this.above)e.push(...t.children),e.push(t);for(const t of this.below)e.push(...t.children),e.push(t)}return this._children=e,e}render(e){var t,n;const i=new Ea({parent:e,mathstyle:this.mathstyleName},this.style),o=i.metrics,r=new Ea({parent:i,mathstyle:this.continuousFraction?"":"numerator"},this.style),a=this.numerPrefix?new da([new da(this.numerPrefix),za.createBox(r,this.above)],{isTight:r.isTight,type:"ignore"}):null!=(t=za.createBox(r,this.above,{type:"ignore"}))?t:new da(null,{type:"ignore"}),s=new Ea({parent:i,mathstyle:this.continuousFraction?"":"denominator"},this.style),l=this.denomPrefix?new da([new da(this.denomPrefix),za.createBox(s,this.below,{type:"ignore"})]):null!=(n=za.createBox(s,this.below,{type:"ignore"}))?n:new da(null,{type:"ignore"}),c=this.hasBarLine?o.defaultRuleThickness:0;let d,h,u=0;i.isDisplayStyle?(d=r.metrics.num1,u=c>0?3*c:7*c,h=s.metrics.denom1):(c>0?(d=r.metrics.num2,u=c):(d=r.metrics.num3,u=3*o.defaultRuleThickness),h=s.metrics.denom2);const p=[];this.isSelected&&p.push("ML__selected");const m=a.depth,f=l.height;let g;if(c<=0){const e=d-m-(f-h);e<u&&(d+=(u-e)/2,h+=(u-e)/2),g=new ga({individualShift:[{box:a,shift:-d,classes:[...p,"ML__center"]},{box:l,shift:h,classes:[...p,"ML__center"]}]}).wrap(i)}else{const e=new da(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});e.softWidth=Math.max(a.width,l.width),e.height=c/2,e.depth=c/2;const t=Br+c/2;d<u+m+t&&(d=u+m+t);const n=Br-c/2;h<u+f-n&&(h=u+f-n),g=new ga({individualShift:[{box:l,shift:h,classes:[...p,"ML__center"]},{box:e,shift:-n,classes:p},{box:a,shift:-d,classes:[...p,"ML__center"]}]}).wrap(i)}const b=i.isDisplayStyle?o.delim1:o.delim2,y=this.leftDelim?this.bind(e,Es("open",this.leftDelim,b,!0,e,{style:this.style,mode:this.mode,isSelected:this.isSelected})):As(i,"open");let v=null;v=this.continuousFraction?new da(null,{type:"close"}):this.rightDelim?this.bind(e,Es("close",this.rightDelim,b,!0,e,{style:this.style,mode:this.mode,isSelected:this.isSelected})):As(i,"close");const x=new da([y,g,v],{isTight:i.isTight,type:"inner",classes:"mfrac"}),w=this.bind(e,x);return this.caret&&(w.caret=this.caret),this.attachSupsub(e,{base:w})}},dl=class e extends za{constructor(e,t){var n;super({type:"latex",value:e,mode:"latex"}),this.isSuggestion=null!=(n=null==t?void 0:t.isSuggestion)&&n,this.isError=!1}static fromJson(t){const n=new e(t.value);return t.isSuggestion&&(n.isSuggestion=!0),t.isError&&(n.isError=!0),n}toJson(){const e={};return this.isSuggestion&&(e.isSuggestion=!0),this.isError&&(e.isError=!0),d({type:"latex",value:this.value},e)}get computedStyle(){return{}}render(e){const t=new da(this.value,{classes:this.isSuggestion?"ML__suggestion":this.isError?"ML__error":"",type:"latex",maxFontSize:1});return t?(this.caret&&(t.caret=this.caret),this.bind(e,t)):null}},hl=class e extends za{constructor(e){super({type:"latexgroup",mode:"latex"}),this.body=[...e].map((e=>new dl(e))),this.skipBoundary=!1}static fromJson(t){return new e("")}toJson(){return super.toJson()}render(e){const t=za.createBox(e,this.body);return t?(this.caret&&(t.caret=this.caret),this.bind(e,t)):null}_serialize(e){var t,n;return null!=(n=null==(t=this.body)?void 0:t.map((e=>e.value)).join(""))?n:""}},ul=class e extends za{constructor(e,t){super(h(d({},t),{type:"extensible-symbol",isFunction:null==t?void 0:t.isFunction})),this.value=e,this.variant=null==t?void 0:t.variant,this.subsupPlacement=null==t?void 0:t.limits}static fromJson(t){return new e(t.symbol,t)}toJson(){const e=super.toJson();return this.variant&&(e.variant=this.variant),this.subsupPlacement&&(e.limits=this.subsupPlacement),this.isExtensibleSymbol&&(e.isExtensibleSymbol=!0),this.value&&(e.symbol=this.value),e}render(e){var t;const n=e.isDisplayStyle&&"\\smallint"!==this.value,i=new da(this.value,{fontFamily:n?"Size2-Regular":"Size1-Regular",classes:"op-symbol "+(n?"large-op":"small-op"),type:"op",maxFontSize:e.scalingFactor,isSelected:this.isSelected});if(!i)return null;i.right=i.italic;const o=(i.height-i.depth)/2-Br*e.scalingFactor,r=i.italic;i.setTop(o);let a=i;if(this.superscript||this.subscript){const n=null!=(t=this.subsupPlacement)?t:"auto";a="over-under"===n||"auto"===n&&e.isDisplayStyle?this.attachLimits(e,{base:i,baseShift:o,slant:r}):this.attachSupsub(e,{base:i})}return new da(this.bind(e,a),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(e)}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const t=ae(this.command,this.mode);if(null==t?void 0:t.serialize)return t.serialize(this,e);const n=[];return n.push(this.command),this.explicitSubsupPlacement&&("over-under"===this.subsupPlacement&&n.push("\\limits"),"adjacent"===this.subsupPlacement&&n.push("\\nolimits"),"auto"===this.subsupPlacement&&n.push("\\displaylimits")),n.push(this.supsubToLatex(e)),Yr(n)}},pl=class e extends za{constructor(e){const t=e.body;super(h(d({},e),{type:"overlap",body:"string"==typeof t?[new za({value:t})]:t,style:null==e?void 0:e.style})),this.skipBoundary=!0,this.align=null==e?void 0:e.align,this.boxType=null==e?void 0:e.boxType}static fromJson(t){return new e(t)}toJson(){const e={};return this.align&&(e.align=this.align),this.boxType&&(e.boxType=this.boxType),d(d({},super.toJson()),e)}render(e){const t=za.createBox(e,this.body,{classes:"inner"});return t?(this.caret&&(t.caret=this.caret),this.bind(e,new da([t,new da(null,{classes:"fix"})],{classes:"right"===this.align?"rlap":"llap",type:this.boxType}))):null}},ml=class e extends za{constructor(e){var t,n,i,o;super({type:"overunder",command:e.command,style:e.style,mode:e.mode,body:e.body,skipBoundary:null==(t=e.skipBoundary)||t}),this.subsupPlacement=e.supsubPlacement,this.svgAbove=e.svgAbove,this.svgBelow=e.svgBelow,this.svgBody=e.svgBody,this.above=e.above,this.below=e.below,this.boxType=null!=(n=e.boxType)?n:"ord",this.paddedBody=null!=(i=e.paddedBody)&&i,this.paddedLabels=null!=(o=e.paddedLabels)&&o}static fromJson(t){return new e(t)}toJson(){const e=super.toJson();return this.skipBoundary||(e.skipBoundary=!1),this.subsupPlacement&&(e.subsupPlacement=this.subsupPlacement),this.svgAbove&&(e.svgAbove=this.svgAbove),this.svgBelow&&(e.svgBelow=this.svgBelow),this.svgBody&&(e.svgBody=this.svgBody),"ord"!==this.boxType&&(e.boxType=this.boxType),this.paddedBody&&(e.paddedBody=!0),this.paddedLabels&&(e.paddedLabels=!0),e}render(e){let t=this.svgBody?ma(this.svgBody):za.createBox(e,this.body,{type:"ignore"});const n=new Ea({parent:e,mathstyle:"scriptstyle"},this.style);let i=null;this.svgAbove?i=ma(this.svgAbove):this.above&&(i=za.createBox(n,this.above,{type:"ignore"}));let o=null;this.svgBelow?o=ma(this.svgBelow):this.below&&(o=za.createBox(n,this.below,{type:"ignore"})),this.paddedBody&&(t=new da([As(e,"open"),t,As(e,"close")],{type:"ignore"}));let r=function(e,t){if(!t.base)return null;if(!t.above&&!t.below){const e=new da(t.base,{type:t.type});return e.setStyle("position","relative"),e}let n=0;t.above&&(n=e.metrics.bigOpSpacing5);let i=null;const o=t.base,r=0,a=["ML__center"];t.paddedAboveBelow&&a.push("ML__label_padding");if(t.below&&t.above){const s=e.metrics.bigOpSpacing5+t.below.height+t.below.depth+o.depth+r;i=new ga({bottom:s,children:[e.metrics.bigOpSpacing5,{box:t.below,classes:a},{box:o,classes:["ML__center"]},n,{box:t.above,classes:a},e.metrics.bigOpSpacing5]})}else t.below?i=new ga({top:o.height-r,children:[e.metrics.bigOpSpacing5,{box:t.below,classes:a},{box:o,classes:["ML__center"]}]}):t.above&&(i=new ga({bottom:o.depth+r,children:[{box:o,classes:["ML__center"]},n,{box:t.above,classes:a},e.metrics.bigOpSpacing5]}));return new da(i,{type:t.type})}(e,{base:t,above:i,below:o,type:"bin"===this.boxType||"rel"===this.boxType?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return r?(r="over-under"===this.subsupPlacement?this.attachLimits(e,{base:r,type:r.type}):this.attachSupsub(e,{base:r}),this.caret&&(r.caret=this.caret),this.bind(e,r)):null}};var fl=class e extends za{constructor(e){var t,n,i,o;super(h(d({},e),{type:"phantom"})),this.captureSelection=!0,this.isInvisible=null!=(t=e.isInvisible)&&t,this.smashDepth=null!=(n=e.smashDepth)&&n,this.smashHeight=null!=(i=e.smashHeight)&&i,this.smashWidth=null!=(o=e.smashWidth)&&o}static fromJson(t){return new e(t)}toJson(){const e={};return this.isInvisible&&(e.isInvisible=!0),this.smashDepth&&(e.smashDepth=!0),this.smashHeight&&(e.smashHeight=!0),this.smashWidth&&(e.smashWidth=!0),d(d({},super.toJson()),e)}render(e){const t=new Ea({parent:e,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return console.assert(this.isInvisible),za.createBox(t,this.body,{classes:"inner"});const n=za.createBox(this.isInvisible?t:e,this.body);if(!n)return null;if(this.smashWidth){const t=new da(null,{classes:"fix"});return new da([n,t],{classes:"rlap"}).wrap(e)}if(!this.smashHeight&&!this.smashDepth)return n;if(this.smashHeight&&(n.height=0),this.smashDepth&&(n.depth=0),n.children)for(const e of n.children)this.smashHeight&&(e.height=0),this.smashDepth&&(e.depth=0);return new ga({firstBaseline:[{box:n}]},{type:n.type}).wrap(e)}},gl=class e extends za{constructor(e){var t;super(d({type:"spacing"},e)),this.width=null==e?void 0:e.width,this._braced=null!=(t=null==e?void 0:e.braced)&&t}static fromJson(t){return new e(t)}toJson(){const e=super.toJson();return void 0!==this.width&&(e.width=this.width),this._braced&&(e.braced=!0),e}render(e){var t;if("space"===this.command)return new da("math"===this.mode?null:" ");let n;if(void 0!==this.width)n=new da(null,{classes:"mspace"}),n.left=e.toEm(this.width);else{const e=null!=(t={"\\qquad":"qquad","\\quad":"quad","\\enspace":"enspace","\\;":"thickspace","\\:":"mediumspace","\\>":"mediumspace","\\,":"thinspace","\\!":"negativethinspace"}[this.command])?t:"mediumspace";n=new da(null,{classes:e})}return n=this.bind(e,n),this.caret&&(n.caret=this.caret),n}_serialize(e){var t;if(!e.expandMacro&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const n=ae(this.command,this.mode);if(null==n?void 0:n.serialize)return n.serialize(this,e);const i=null!=(t=this.command)?t:"";return void 0===this.width?i:this._braced&&!("register"in this.width)?`${i}{${ka(this.width)}}`:`${i}${ka(this.width)}`}},bl=class e extends za{constructor(e){var t;super(h(d({},e),{type:"surd",mode:null!=(t=e.mode)?t:"math",style:e.style,displayContainsHighlight:!0,body:e.body})),this.above=e.index}static fromJson(t){return new e(h(d({},t),{index:t.above}))}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const t=ae(this.command,this.mode);if(null==t?void 0:t.serialize)return t.serialize(this,e);const n=this.command,i=this.bodyToLatex(e);return this.above&&!this.hasEmptyBranch("above")?Qr(`${n}[${this.aboveToLatex(e)}]`,i):/^[0-9]$/.test(i)?`${n}${i}`:Qr(n,i)}get children(){if(this._children)return this._children;const e=[];if(this.above)for(const t of this.above)e.push(...t.children),e.push(t);if(this.body)for(const t of this.body)e.push(...t.children),e.push(t);return this._children=e,e}render(e){var t;const n=new Ea({parent:e,mathstyle:"cramp"},this.style),i=null!=(t=za.createBox(n,this.body,{type:"inner"}))?t:new da(null),o=n.scalingFactor,r=n.metrics.defaultRuleThickness/o,a=e.isDisplayStyle?$r:r,s=new da(null,{classes:"ML__sqrt-line",style:this.style});s.height=r,s.softWidth=i.width;let l=o*(r+a/4);const c=Math.max(2*o*a,i.height+i.depth)+l+r,d=new Ea({parent:e},this.style),h=this.bind(d,new da(Es("inner","\\surd",c,!1,d,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!h)return null;const u=h.height+h.depth-r;u>i.height+i.depth+l&&(l=(l+u-(i.height+i.depth))/2),h.setTop(h.height-i.height-l);const p=this.bind(e,new ga({firstBaseline:[{box:new da(i)},l-2*r,{box:s},r]})),m=za.createBox(new Ea({parent:e,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!m){const t=new da([h,p],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return t.setStyle("display","inline-block"),t.setStyle("height",t.height+t.depth,"em"),this.caret&&(t.caret=this.caret),this.bind(e,t)}const f=new ga({shift:-.6*(Math.max(h.height,p.height)-Math.max(h.depth,p.depth)),children:[{box:m}]}),g=new da([new da(f,{classes:"ML__sqrt-index",type:"ignore"}),h,p],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return g.height=h.height,g.depth=h.depth,this.caret&&(g.caret=this.caret),this.bind(e,g)}},yl=class extends da{constructor(e){super(null,{type:"skip"}),this._width=e}toMarkup(){return`<span style="display:inline-block;width:${Math.ceil(100*this.width)/100}em"></span>`}};function vl(e,t){if(!e.parent)return;const n=e.parent.children,i=n.indexOf(e);let o=i-1;for(;o>=0&&"ignore"===n[o].type;)o-=1;o<0&&e.parent.parent&&"lift"===e.parent.type?vl(e.parent,t):i>0&&"skip"===n[i-1].type?n[i-1].width+=t:n.splice(i,0,new yl(t))}var xl={ord:{op:3,bin:4,rel:5,inner:3},op:{ord:3,op:3,rel:5,inner:3},bin:{ord:4,op:4,open:4,inner:4},rel:{ord:5,op:5,open:5,inner:5},close:{op:3,bin:4,rel:5,inner:3},punct:{ord:3,op:3,rel:3,open:3,punct:3,inner:3},inner:{ord:3,op:3,bin:4,rel:5,open:3,punct:3,inner:3}},wl={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function _l(e,t){if(!e.children)return e;const n=e.children;!function(e){kl(e,((e,t)=>{"bin"!==t.type||e&&!/^(middle|bin|op|rel|open|punct)$/.test(e.type)||(t.type="ord"),"bin"===(null==e?void 0:e.type)&&/^(rel|close|punct)$/.test(t.type)&&(e.type="ord"),"ignore"!==t.type&&(e=t)}))}(n);const i=t.getRegisterAsEm("thinmuskip"),o=t.getRegisterAsEm("medmuskip"),r=t.getRegisterAsEm("thickmuskip");return kl(n,((e,t)=>{var n,a,s;if(!e)return;const l=e.type,c=t.isTight?null!=(n=wl[l])?n:null:null!=(a=xl[l])?a:null,d=null!=(s=null==c?void 0:c[t.type])?s:null;3===d&&vl(t,i),4===d&&vl(t,o),5===d&&vl(t,r)})),e}function kl(e,t,n){if(!e)return n;e=[...e];for(const i of e)"lift"===i.type?n=kl(i.children,t,n):"ignore"===i.type?kl(i.children,t):(t(n,i),kl(i.children,t),n=i);return n}var Ml=class e extends za{constructor(e){super({type:"tooltip",command:e.command,mode:e.mode,style:e.style,body:e.body,displayContainsHighlight:!0}),this.tooltip=new za({type:"root",mode:e.content,body:e.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(t){return new e(h(d({},t),{tooltip:Ll(t.tooltip)}))}toJson(){var e;const t=null==(e=this.tooltip.body)?void 0:e.filter((e=>"first"!==e.type)).map((e=>e.toJson()));return h(d({},super.toJson()),{tooltip:t})}render(e){const t=za.createBox(new Ea,this.body);if(!t)return null;const n=new Ea({parent:e,mathstyle:"displaystyle"},{fontSize:5}),i=ua(_l(new da(this.tooltip.render(n),{classes:"ML__tooltip-content"}),n)),o=new da([i,t],{classes:"ML__tooltip-container"});return this.caret&&(o.caret=this.caret),this.bind(e,o)}},Sl=class e extends za{constructor(e,t){super(h(d({},t),{type:"operator",isFunction:null==t?void 0:t.isFunction})),this.value=e,this.variant=null==t?void 0:t.variant,this.variantStyle=null==t?void 0:t.variantStyle,this.subsupPlacement=null==t?void 0:t.limits}static fromJson(t){return new e(t.symbol,t)}toJson(){const e=super.toJson();return this.variant&&(e.variant=this.variant),this.variantStyle&&(e.variantStyle=this.variantStyle),this.subsupPlacement&&(e.limits=this.subsupPlacement),this.value&&(e.symbol=this.value),e}render(e){var t;const n=new da(this.value,{type:"op",mode:"math",maxFontSize:e.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:e.letterShapeStyle});let i=n;if(this.superscript||this.subscript){const o=null!=(t=this.subsupPlacement)?t:"auto";i="over-under"===o||"auto"===o&&e.isDisplayStyle?this.attachLimits(e,{base:n}):this.attachSupsub(e,{base:n})}return new da(this.bind(e,i),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(e)}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;const t=ae(this.command,this.mode);if(null==t?void 0:t.serialize)return t.serialize(this,e);const n=[this.command];return this.explicitSubsupPlacement&&("over-under"===this.subsupPlacement&&n.push("\\limits"),"adjacent"===this.subsupPlacement&&n.push("\\nolimits"),"auto"===this.subsupPlacement&&n.push("\\displaylimits")),n.push(this.supsubToLatex(e)),Yr(n)}};function Ll(e){if(m(e))return e.map((e=>Ll(e)));if("string"==typeof e)return za.fromJson(e);e=d({},e);for(const t of Ka)e[t]&&(e[t]=Ll(e[t]));e.args&&(e.args=function(e){return e&&Array.isArray(e)?e.map((e=>"<null>"===e?null:"object"==typeof e&&"group"in e?{group:e.group.map((e=>Ll(e)))}:"object"==typeof e&&"atoms"in e?e.atoms.map((e=>Ll(e))):e)):void 0}(e.args)),e.array&&(e.array=Ll(e.array));const t=e.type;let n;"accent"===t&&(n=fs.fromJson(e)),"array"===t&&(n=Os.fromJson(e)),"box"===t&&(n=Fs.fromJson(e)),"chem"===t&&(n=tl.fromJson(e)),"composition"===t&&(n=Rs.fromJson(e)),"delim"===t&&(n=ol.fromJson(e)),"enclose"===t&&(n=al.fromJson(e)),"error"===t&&(n=Vs.fromJson(e)),"extensible-symbol"===t&&(n=ul.fromJson(e)),"genfrac"===t&&(n=cl.fromJson(e)),"group"===t&&(n=Hs.fromJson(e)),"latex"===t&&(n=dl.fromJson(e)),"latexgroup"===t&&(n=hl.fromJson(e)),"leftright"===t&&(n=Ws.fromJson(e)),"macro"===t&&(n=Us.fromJson(e)),"macro-argument"===t&&(n=Js.fromJson(e)),"operator"===t&&(n=Sl.fromJson(e)),"overlap"===t&&(n=pl.fromJson(e)),"overunder"===t&&(n=ml.fromJson(e)),"placeholder"===t&&(n=Ds.fromJson(e)),"prompt"===t&&(n=Xs.fromJson(e)),"phantom"===t&&(n=fl.fromJson(e)),"sizeddelim"===t&&(n=rl.fromJson(e)),"spacing"===t&&(n=gl.fromJson(e)),"subsup"===t&&(n=Gs.fromJson(e)),"surd"===t&&(n=bl.fromJson(e)),"text"===t&&(n=$a.fromJson(e)),"tooltip"===t&&(n=Ml.fromJson(e)),n||(console.assert(!t||["first","mbin","mrel","mclose","minner","mop","mopen","mord","mpunct","root","space"].includes(t),`MathLive 0.98.5: an unexpected atom type "${t}" was encountered. Add new atom constructors to \`fromJson()\` in "atom.ts"`),n=za.fromJson(e));for(const t of Ka)e[t]&&n.setChildren(e[t],t);return void 0!==e.verbatimLatex&&(n.verbatimLatex=e.verbatimLatex),e.subsupPlacement&&(n.subsupPlacement=e.subsupPlacement),e.explicitSubsupPlacement&&(n.explicitSubsupPlacement=!0),e.isFunction&&(n.isFunction=!0),e.isExtensibleSymbol&&(n.isExtensibleSymbol=!0),e.skipBoundary&&(n.skipBoundary=!0),e.captureSelection&&(n.captureSelection=!0),n}var Cl={main:["Main-Regular","ML__cmr"],"main-italic":["Main-Italic","ML__cmr ML__it"],"main-bold":["Main-Bold","ML__cmr ML__bold"],"main-bolditalic":["Main-BoldItalic","ML__cmr ML__bold ML__it"],normal:["Main-Regular","ML__cmr"],"normal-bold":["Main-Bold","ML__mathbf"],"normal-italic":["Math-Italic","ML__mathit"],"normal-bolditalic":["Math-BoldItalic","ML__mathbfit"],ams:["AMS-Regular","ML__ams"],"ams-bold":["AMS-Regular","ML__ams"],"ams-italic":["AMS-Regular","ML__ams"],"ams-bolditalic":["AMS-Regular","ML__ams"],"sans-serif":["SansSerif-Regular","ML__sans"],"sans-serif-bold":["SansSerif-Regular","ML__sans ML__bold"],"sans-serif-italic":["SansSerif-Regular","ML__sans"],"sans-serif-bolditalic":["SansSerif-Regular","ML__sans"],calligraphic:["Caligraphic-Regular","ML__cal"],"calligraphic-bold":["Caligraphic-Regular","ML__cal ML__bold"],"calligraphic-italic":["Caligraphic-Regular","ML__cal ML__it"],"calligraphic-bolditalic":["Caligraphic-Regular","ML__cal ML__bold ML__it"],script:["Script-Regular","ML__script"],"script-bold":["Script-Regular","ML__script ML__bold"],"script-italic":["Script-Regular","ML__script ML__it"],"script-bolditalic":["Script-Regular","ML__script ML__bold ML__it"],fraktur:["Fraktur-Regular","ML__frak"],"fraktur-bold":["Fraktur-Regular","ML__frak"],"fraktur-italic":["Fraktur-Regular","ML__frak"],"fraktur-bolditalic":["Fraktur-Regular","ML__frak"],monospace:["Typewriter-Regular","ML__tt"],"monospace-bold":["Typewriter-Regular","ML__tt ML__bold"],"monospace-italic":["Typewriter-Regular","ML__tt ML__it"],"monospace-bolditalic":["Typewriter-Regular","ML__tt ML__bold ML__it"],"double-struck":["AMS-Regular","ML__bb"],"double-struck-bold":["AMS-Regular","ML__bb"],"double-struck-italic":["AMS-Regular","ML__bb"],"double-struck-bolditalic":["AMS-Regular","ML__bb"]},El={"double-struck":/^[A-Z ]$/,script:/^[A-Z ]$/,calligraphic:/^[\dA-Z ]$/,fraktur:/^[\dA-Za-z ]$|^[!"#$%&'()*+,\-./:;=?[]^’‘]$/,monospace:/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/,"sans-serif":/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/},Kl=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,Al=[/^[a-z]$/,/^[A-Z]$/,Kl,/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/],Dl={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]};function zl(e){if(!e)return"";const{style:t}=e;if(void 0===t.variant)return"";let n=t.variant;return!["calligraphic","fraktur","double-struck","script","monospace","sans-serif"].includes(t.variant)&&t.variantStyle&&"up"!==t.variantStyle&&(n+="-"+t.variantStyle),n}function Tl(e,t){return oa(e,"fontSeries").map((e=>{const n=function(e,t){return oa(e,"fontShape").map((e=>{const n=function(e,t){return e.map((e=>e._serialize(t)))}(e,t),{fontShape:i}=e[0].style;let o="";return"it"===i&&(o="\\textit"),"sl"===i&&(o="\\textsl"),"sc"===i&&(o="\\textsc"),"n"===i&&(o="\\textup"),!o&&i?`{${Qr("\\fontshape",i)}${Yr(n)}}`:o?Qr(o,Yr(n)):Yr(n)}))}(e,t),{fontSeries:i}=e[0].style;let o="";return"b"===i&&(o="\\textbf"),"l"===i&&(o="\\textlf"),"m"===i&&(o="\\textmd"),i&&!o?`{${Qr("\\fontseries",i)}${Yr(n)}}`:o?Qr(o,Yr(n)):Yr(n)}))}function Bl(e,t,n){return oa(e,"fontFamily").map((e=>{var i,o;const r=function(e,t){return oa(e,"fontSize").map((e=>{var n,i;const o=Tl(e,t),r=null!=(i=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][null!=(n=e[0].style.fontSize)?n:""])?i:"";return r?`${r} ${Yr(o)}`:Yr(o)}))}(e,t),a=null!=(o={roman:"textrm",monospace:"texttt","sans-serif":"textsf"}[null!=(i=e[0].style.fontFamily)?i:""])?o:"";return a?`\\${a}{${Yr(r)}}`:e[0].style.fontFamily?`{\\fontfamily{${e[0].style.fontFamily}} ${Yr(r)}}`:n?`\\text{${Yr(r)}}`:Yr(r)}))}new class extends na{constructor(){super("math")}createAtom(e,t,n){var i,o,r,a;if(null===t)return new za({type:"mord",mode:"math",command:e,value:e,style:n});const s=window.MathfieldElement.isFunction(null!=(i=t.command)?i:e);if("symbol"===t.definitionType){const i=new za({type:null!=(o=t.type)?o:"mord",mode:"math",command:null!=(r=t.command)?r:e,value:String.fromCodePoint(t.codepoint),style:n});return s&&(i.isFunction=!0),e.startsWith("\\")&&(i.verbatimLatex=e),i}const l=new za({type:"mord",mode:"math",command:null!=(a=t.command)?a:e,value:e,style:n});return s&&(l.isFunction=!0),e.startsWith("\\")&&(l.verbatimLatex=e),l}serialize(e,t){const n=function(e,t){const{parent:n}=e[0],i=zl(n);return oa(e,"variant").map((e=>{const n=zl(e[0]);let o="";n&&n!==i&&(o={calligraphic:"\\mathcal",fraktur:"\\mathfrak","double-struck":"\\mathbb",script:"\\mathscr",monospace:"\\mathtt","sans-serif":"\\mathsf",normal:"\\mathrm","normal-italic":"\\mathnormal","normal-bold":"\\mathbf","normal-bolditalic":"\\mathbfit",ams:"","ams-italic":"\\mathit","ams-bold":"\\mathbf","ams-bolditalic":"\\mathbfit",main:"","main-italic":"\\mathit","main-bold":"\\mathbf","main-bolditalic":"\\mathbfit"}[n],console.assert(void 0!==o));const r=Yr(e.map((e=>e._serialize(t))));return o?Qr(o,r):r}))}(e,h(d({},t),{defaultMode:"math"}));return 0===n.length||"text"!==t.defaultMode?n:["$ ",...n," $"]}getFont(e,t){console.assert(void 0!==t.variant);let{variant:n}=t,{variantStyle:i}=t;"normal"===n&&!i&&/[\u00A3\u0131\u0237]/.test(e.value)&&(n="main",i="italic"),"normal"!==n||i||1!==e.value.length||Al.forEach(((n,o)=>{var r;n.test(e.value)&&"it"===Dl[null!=(r=t.letterShapeStyle)?r:"tex"][o]&&(i="italic")})),"up"===i&&(i=void 0);const o=i?n+"-"+i:n;console.assert(void 0!==Cl[o]);const[r,a]=Cl[o];return El[n]&&!El[n].test(e.value)?(e.value=$(e.value,n,i),null):(Kl.test(e.value)&&(e.classes+=" lcGreek"),a&&(e.classes+=" "+a),r)}};var $l={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"};new class extends na{constructor(){super("text")}createAtom(e,t,n){return t&&"symbol"===t.definitionType?new $a(e,String.fromCodePoint(t.codepoint),null!=n?n:{}):null}serialize(e,t){return Bl(e,h(d({},t),{defaultMode:"text"}),"text"!==t.defaultMode)}getFont(e,t){var n,i,o,r,a;const{fontFamily:s}=t;if($l[s]?e.classes+=" "+$l[s]:s&&e.setStyle("font-family",s),t.fontShape&&(e.classes+=" ",e.classes+=null!=(n={it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"}[t.fontShape])?n:""),t.fontSeries){const n=t.fontSeries.match(/(.?[lbm])?(.?[cx])?/);n&&(e.classes+=" ",e.classes+=null!=(o={ul:"ML__series_ul",el:"ML__series_el",l:"ML__series_l",sl:"ML__series_sl",m:"",sb:"ML__series_sb",b:"ML__bold",eb:"ML__series_eb",ub:"ML__series_ub"}[null!=(i=n[1])?i:""])?o:"",e.classes+=" ",e.classes+=null!=(a={uc:"ML__series_uc",ec:"ML__series_ec",c:"ML__series_c",sc:"ML__series_sc",n:"",sx:"ML__series_sx",x:"ML__series_x",ex:"ML__series_ex",ux:"ML__series_ux"}[null!=(r=n[2])?r:""])?a:"")}return"Main-Regular"}};new class extends na{constructor(){super("latex")}createAtom(e){return new dl(e)}serialize(e,t){return e.filter((e=>e instanceof dl&&!e.isSuggestion)).map((e=>e.value))}getFont(){return null}};var Pl={id:"apple.en-intl",displayName:"English (international)",virtualLayout:"qwerty",platform:"apple",locale:"en",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","∫","ı"],KeyC:["c","C","ç","Ç"],KeyD:["d","D","∂","Î"],KeyE:["e","E","´","´"],KeyF:["f","F","ƒ","Ï"],KeyG:["g","G","©","˝"],KeyH:["h","H","˙","Ó"],KeyI:["i","I","ˆ","ˆ"],KeyJ:["j","J","∆","Ô"],KeyK:["k","K","˚",""],KeyL:["l","L","¬","Ò"],KeyM:["m","M","µ","Â"],KeyN:["n","N","˜","˜"],KeyO:["o","O","ø","Ø"],KeyP:["p","P","π","∏"],KeyQ:["q","Q","œ","Œ"],KeyR:["r","R","®","‰"],KeyS:["s","S","ß","Í"],KeyT:["t","T","†","ˇ"],KeyU:["u","U","¨","¨"],KeyV:["v","V","√","◊"],KeyW:["w","W","∑","„"],KeyX:["x","X","≈","˛"],KeyY:["y","Y","¥","Á"],KeyZ:["z","Z","Ω","¸"],Digit1:["1","!","¡","⁄"],Digit2:["2","@","™","€"],Digit3:["3","#","£","‹"],Digit4:["4","$","¢","›"],Digit5:["5","%","∞","fi"],Digit6:["6","^","§","fl"],Digit7:["7","&","¶","‡"],Digit8:["8","*","•","°"],Digit9:["9","(","ª","·"],Digit0:["0",")","º","‚"],Space:[" "," "," "," "],Minus:["-","_","–","—"],Equal:["=","+","≠","±"],BracketLeft:["[","{","“","”"],BracketRight:["]","}","‘","’"],Backslash:["\\","|","«","»"],Semicolon:[";",":","…","Ú"],Quote:["'",'"',"æ","Æ"],Backquote:["`","˜","`","`"],Comma:[",","<","≤","¯"],Period:[".",">","≥","˘"],Slash:["/","?","÷","¿"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["§","±","§","±"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},Ol={id:"windows.en-intl",displayName:"English (international)",platform:"windows",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","á","Á"],KeyB:["b","B","",""],KeyC:["c","C","©","¢"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","é","É"],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","í","Í"],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","ø","Ø"],KeyM:["m","M","µ",""],KeyN:["n","N","ñ","Ñ"],KeyO:["o","O","ó","Ó"],KeyP:["p","P","ö","Ö"],KeyQ:["q","Q","ä","Ä"],KeyR:["r","R","®",""],KeyS:["s","S","ß","§"],KeyT:["t","T","þ","Þ"],KeyU:["u","U","ú","Ú"],KeyV:["v","V","",""],KeyW:["w","W","å","Å"],KeyX:["x","X","",""],KeyY:["y","Y","ü","Ü"],KeyZ:["z","Z","æ","Æ"],Digit1:["1","!","¡","¹"],Digit2:["2","@","²",""],Digit3:["3","#","³",""],Digit4:["4","$","¤","£"],Digit5:["5","%","€",""],Digit6:["6","^","¼",""],Digit7:["7","&","½",""],Digit8:["8","*","¾",""],Digit9:["9","(","‘",""],Digit0:["0",")","’",""],Space:[" "," ","",""],Minus:["-","_","¥",""],Equal:["=","+","×","÷"],BracketLeft:["[","{","«",""],BracketRight:["]","}","»",""],Backslash:["\\","|","¬","¦"],Semicolon:[";",":","¶","°"],Quote:["'",'"',"´","¨"],Backquote:["`","~","",""],Comma:[",","<","ç","Ç"],Period:[".",">","",""],Slash:["/","?","¿",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["\\","|","",""]}},ql={id:"linux.en",displayName:"English",platform:"linux",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","a","A"],KeyB:["b","B","b","B"],KeyC:["c","C","c","C"],KeyD:["d","D","d","D"],KeyE:["e","E","e","E"],KeyF:["f","F","f","F"],KeyG:["g","G","g","G"],KeyH:["h","H","h","H"],KeyI:["i","I","i","I"],KeyJ:["j","J","j","J"],KeyK:["k","K","k","K"],KeyL:["l","L","l","L"],KeyM:["m","M","m","M"],KeyN:["n","N","n","N"],KeyO:["o","O","o","O"],KeyP:["p","P","p","P"],KeyQ:["q","Q","q","Q"],KeyR:["r","R","r","R"],KeyS:["s","S","s","S"],KeyT:["t","T","t","T"],KeyU:["u","U","u","U"],KeyV:["v","V","v","V"],KeyW:["w","W","w","W"],KeyX:["x","X","x","X"],KeyY:["y","Y","y","Y"],KeyZ:["z","Z","z","Z"],Digit1:["1","!","1","!"],Digit2:["2","@","2","@"],Digit3:["3","#","3","#"],Digit4:["4","$","4","$"],Digit5:["5","%","5","%"],Digit6:["6","^","6","^"],Digit7:["7","&","7","&"],Digit8:["8","*","8","*"],Digit9:["9","(","9","("],Digit0:["0",")","0",")"],Space:[" "," "," "," "],Minus:["-","_","-","_"],Equal:["=","+","=","+"],BracketLeft:["[","{","[","{"],BracketRight:["]","}","]","}"],Backslash:["\\","|","\\","|"],Semicolon:[";",":",";",":"],Quote:["'",'"',"'",'"'],Backquote:["`","~","`","~"],Comma:[",","<",",","<"],Period:[".",">",".",">"],Slash:["/","?","/","?"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","¦"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};function Nl(e){const t=e.split("+"),n={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:t.pop()};return t.includes("shift")&&(n.shift=!0),t.includes("alt")&&(n.alt=!0),t.includes("ctrl")&&(n.ctrl=!0),t.includes("cmd")&&(n.cmd=!0),t.includes("win")&&(n.win=!0),t.includes("meta")&&(n.meta=!0),n}function Il(e){let t="";return e.shift&&(t+="shift+"),e.alt&&(t+="alt+"),e.ctrl&&(t+="ctrl+"),e.cmd&&(t+="cmd+"),e.win&&(t+="win+"),e.meta&&(t+="meta+"),t+e.key}var Fl,Rl={enter:"[Enter]",escape:"[Escape]",backspace:"[Backspace]",tab:"[Tab]",space:"[Space]",pausebreak:"[Pause]",insert:"[Insert]",home:"[Home]",pageup:"[PageUp]",delete:"[Delete]",end:"[End]",pagedown:"[PageDown]",right:"[ArrowRight]",left:"[ArrowLeft]",down:"[ArrowDown]",up:"[ArrowUp]",numpad0:"[Numpad0]",numpad1:"[Numpad1]",numpad2:"[Numpad2]",numpad3:"[Numpad3]",numpad4:"[Numpad4]",numpad5:"[Numpad5]",numpad6:"[Numpad6]",numpad7:"[Numpad7]",numpad8:"[Numpad8]",numpad9:"[Numpad9]",numpad_divide:"[NumpadDivide]",numpad_multiply:"[NumpadMultiply]",numpad_subtract:"[NumpadSubtract]",numpad_add:"[NumpadAdd]",numpad_decimal:"[NumpadDecimal]",numpad_separator:"[NumpadComma]",capslock:"[Capslock]",f1:"[F1]",f2:"[F2]",f3:"[F3]",f4:"[F4]",f5:"[F5]",f6:"[F6]",f7:"[F7]",f8:"[F8]",f9:"[F9]",f10:"[F10]",f11:"[F11]",f12:"[F12]",f13:"[F13]",f14:"[F14]",f15:"[F15]",f16:"[F16]",f17:"[F17]",f18:"[F18]",f19:"[F19]"},Vl=[];function Hl(){switch(b()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function Wl(e){e.platform&&e.platform!==Hl()||Vl.push(e)}function jl(){return null!=Fl?Fl:Vl[0]}switch(Hl()){case"apple":Wl(Pl),Wl({id:"apple.french",locale:"fr",displayName:"French",platform:"apple",virtualLayout:"azerty",score:0,mapping:{KeyA:["q","Q","‡","Ω"],KeyB:["b","B","ß","∫"],KeyC:["c","C","©","¢"],KeyD:["d","D","∂","∆"],KeyE:["e","E","ê","Ê"],KeyF:["f","F","ƒ","·"],KeyG:["g","G","fi","fl"],KeyH:["h","H","Ì","Î"],KeyI:["i","I","î","ï"],KeyJ:["j","J","Ï","Í"],KeyK:["k","K","È","Ë"],KeyL:["l","L","¬","|"],KeyM:[",","?","∞","¿"],KeyN:["n","N","~","ı"],KeyO:["o","O","œ","Œ"],KeyP:["p","P","π","∏"],KeyQ:["a","A","æ","Æ"],KeyR:["r","R","®","‚"],KeyS:["s","S","Ò","∑"],KeyT:["t","T","†","™"],KeyU:["u","U","º","ª"],KeyV:["v","V","◊","√"],KeyW:["z","Z","Â","Å"],KeyX:["x","X","≈","⁄"],KeyY:["y","Y","Ú","Ÿ"],KeyZ:["w","W","‹","›"],Digit1:["&","1","","´"],Digit2:["é","2","ë","„"],Digit3:['"',"3","“","”"],Digit4:["'","4","‘","’"],Digit5:["(","5","{","["],Digit6:["§","6","¶","å"],Digit7:["è","7","«","»"],Digit8:["!","8","¡","Û"],Digit9:["ç","9","Ç","Á"],Digit0:["à","0","ø","Ø"],Space:[" "," "," "," "],Minus:[")","°","}","]"],Equal:["-","_","—","–"],BracketLeft:["^","¨","ô","Ô"],BracketRight:["$","*","€","¥"],Backslash:["`","£","@","#"],Semicolon:["m","M","µ","Ó"],Quote:["ù","%","Ù","‰"],Backquote:["<",">","≤","≥"],Comma:[";",".","…","•"],Period:[":","/","÷","\\"],Slash:["=","+","≠","±"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",".",",","."],IntlBackslash:["@","#","•","Ÿ"],NumpadEqual:["=","=","=","="]}}),Wl({id:"apple.spanish",locale:"es",displayName:"Spanish ISO",platform:"apple",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","ß",""],KeyC:["c","C","©"," "],KeyD:["d","D","∂","∆"],KeyE:["e","E","€","€"],KeyF:["f","F","ƒ","fi"],KeyG:["g","G","","fl"],KeyH:["h","H","™"," "],KeyI:["i","I"," "," "],KeyJ:["j","J","¶","¯"],KeyK:["k","K","§","ˇ"],KeyL:["l","L"," ","˘"],KeyM:["m","M","µ","˚"],KeyN:["n","N"," ","˙"],KeyO:["o","O","ø","Ø"],KeyP:["p","P","π","∏"],KeyQ:["q","Q","œ","Œ"],KeyR:["r","R","®"," "],KeyS:["s","S","∫"," "],KeyT:["t","T","†","‡"],KeyU:["u","U"," "," "],KeyV:["v","V","√","◊"],KeyW:["w","W","æ","Æ"],KeyX:["x","X","∑","›"],KeyY:["y","Y","¥"," "],KeyZ:["z","Z","Ω","‹"],Digit1:["1","!","|","ı"],Digit2:["2",'"',"@","˝"],Digit3:["3","·","#","•"],Digit4:["4","$","¢","£"],Digit5:["5","%","∞","‰"],Digit6:["6","&","¬"," "],Digit7:["7","/","÷","⁄"],Digit8:["8","(","“","‘"],Digit9:["9",")","”","’"],Digit0:["0","=","≠","≈"],Space:[" "," "," "," "],Minus:["'","?","´","¸"],Equal:["¡","¿","‚","˛"],BracketLeft:["`","^","[","ˆ"],BracketRight:["+","*","]","±"],Backslash:["ç","Ç","}","»"],Semicolon:["ñ","Ñ","~","˜"],Quote:["´","¨","{","«"],Backquote:["<",">","≤","≥"],Comma:[",",";","„",""],Period:[".",":","…","…"],Slash:["-","_","–","—"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[",",",",",",","],IntlBackslash:["º","ª","\\","°"]}}),Wl({id:"apple.german",locale:"de",displayName:"German",virtualLayout:"qwertz",platform:"apple",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","∫","‹"],KeyC:["c","C","ç","Ç"],KeyD:["d","D","∂","™"],KeyE:["e","E","€","‰"],KeyF:["f","F","ƒ","Ï"],KeyG:["g","G","©","Ì"],KeyH:["h","H","ª","Ó"],KeyI:["i","I","⁄","Û"],KeyJ:["j","J","º","ı"],KeyK:["k","K","∆","ˆ"],KeyL:["l","L","@","fl"],KeyM:["m","M","µ","˘"],KeyN:["n","N","~","›"],KeyO:["o","O","ø","Ø"],KeyP:["p","P","π","∏"],KeyQ:["q","Q","«","»"],KeyR:["r","R","®","¸"],KeyS:["s","S","‚","Í"],KeyT:["t","T","†","˝"],KeyU:["u","U","¨","Á"],KeyV:["v","V","√","◊"],KeyW:["w","W","∑","„"],KeyX:["x","X","≈","Ù"],KeyY:["z","Z","Ω","ˇ"],KeyZ:["y","Y","¥","‡"],Digit1:["1","!","¡","¬"],Digit2:["2",'"',"“","”"],Digit3:["3","§","¶","#"],Digit4:["4","$","¢","£"],Digit5:["5","%","[","fi"],Digit6:["6","&","]","^"],Digit7:["7","/","|","\\"],Digit8:["8","(","{","˜"],Digit9:["9",")","}","·"],Digit0:["0","=","≠","¯"],Space:[" "," "," "," "],Minus:["ß","?","¿","˙"],Equal:["´","`","'","˚"],BracketLeft:["ü","Ü","•","°"],BracketRight:["+","*","±",""],Backslash:["#","'","‘","’"],Semicolon:["ö","Ö","œ","Œ"],Quote:["ä","Ä","æ","Æ"],Backquote:["<",">","≤","≥"],Comma:[",",";","∞","˛"],Period:[".",":","…","÷"],Slash:["-","_","–","—"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",",",".","."],IntlBackslash:["^","°","„","“"],NumpadEqual:["=","=","=","="]}});break;case"windows":Wl(Ol),Wl({id:"windows.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"windows",score:0,mapping:{KeyA:["q","Q","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","€",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:[",","?","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["a","A","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["z","Z","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["w","W","",""],Digit1:["&","1","",""],Digit2:["é","2","~",""],Digit3:['"',"3","#",""],Digit4:["'","4","{",""],Digit5:["(","5","[",""],Digit6:["-","6","|",""],Digit7:["è","7","`",""],Digit8:["_","8","\\",""],Digit9:["ç","9","^",""],Digit0:["à","0","@",""],Space:[" "," ","",""],Minus:[")","°","]",""],Equal:["=","+","}",""],BracketLeft:["^","¨","",""],BracketRight:["$","£","¤",""],Backslash:["*","µ","",""],Semicolon:["m","M","",""],Quote:["ù","%","",""],Backquote:["²","","",""],Comma:[";",".","",""],Period:[":","/","",""],Slash:["!","§","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}}),Wl({id:"windows.spanish",locale:"es",displayName:"Spanish",platform:"windows",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","€",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["z","Z","",""],Digit1:["1","!","|",""],Digit2:["2",'"',"@",""],Digit3:["3","·","#",""],Digit4:["4","$","~",""],Digit5:["5","%","€",""],Digit6:["6","&","¬",""],Digit7:["7","/","",""],Digit8:["8","(","",""],Digit9:["9",")","",""],Digit0:["0","=","",""],Space:[" "," ","",""],Minus:["'","?","",""],Equal:["¡","¿","",""],BracketLeft:["`","^","[",""],BracketRight:["+","*","]",""],Backslash:["ç","Ç","}",""],Semicolon:["ñ","Ñ","",""],Quote:["´","¨","{",""],Backquote:["º","ª","\\",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}}),Wl({id:"windows.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","€",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","µ",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","@",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["z","Z","",""],KeyZ:["y","Y","",""],Digit1:["1","!","",""],Digit2:["2",'"',"²",""],Digit3:["3","§","³",""],Digit4:["4","$","",""],Digit5:["5","%","",""],Digit6:["6","&","",""],Digit7:["7","/","{",""],Digit8:["8","(","[",""],Digit9:["9",")","]",""],Digit0:["0","=","}",""],Space:[" "," ","",""],Minus:["ß","?","\\","ẞ"],Equal:["´","`","",""],BracketLeft:["ü","Ü","",""],BracketRight:["+","*","~",""],Backslash:["#","'","",""],Semicolon:["ö","Ö","",""],Quote:["ä","Ä","",""],Backquote:["^","°","",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","|",""]}});break;case"linux":Wl(ql),Wl({id:"linux.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"linux",score:0,mapping:{KeyA:["q","Q","@","Ω"],KeyB:["b","B","”","’"],KeyC:["c","C","¢","©"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","€","¢"],KeyF:["f","F","đ","ª"],KeyG:["g","G","ŋ","Ŋ"],KeyH:["h","H","ħ","Ħ"],KeyI:["i","I","→","ı"],KeyJ:["j","J","̉","̛"],KeyK:["k","K","ĸ","&"],KeyL:["l","L","ł","Ł"],KeyM:[",","?","́","̋"],KeyN:["n","N","n","N"],KeyO:["o","O","ø","Ø"],KeyP:["p","P","þ","Þ"],KeyQ:["a","A","æ","Æ"],KeyR:["r","R","¶","®"],KeyS:["s","S","ß","§"],KeyT:["t","T","ŧ","Ŧ"],KeyU:["u","U","↓","↑"],KeyV:["v","V","“","‘"],KeyW:["z","Z","«","<"],KeyX:["x","X","»",">"],KeyY:["y","Y","←","¥"],KeyZ:["w","W","ł","Ł"],Digit1:["&","1","¹","¡"],Digit2:["é","2","~","⅛"],Digit3:['"',"3","#","£"],Digit4:["'","4","{","$"],Digit5:["(","5","[","⅜"],Digit6:["-","6","|","⅝"],Digit7:["è","7","`","⅞"],Digit8:["_","8","\\","™"],Digit9:["ç","9","^","±"],Digit0:["à","0","@","°"],Enter:["\r","\r","\r","\r"],Escape:["","","",""],Backspace:["\b","\b","\b","\b"],Tab:["\t","","\t",""],Space:[" "," "," "," "],Minus:[")","°","]","¿"],Equal:["=","+","}","̨"],BracketLeft:["̂","̈","̈","̊"],BracketRight:["$","£","¤","̄"],Backslash:["*","µ","̀","̆"],Semicolon:["m","M","µ","º"],Quote:["ù","%","̂","̌"],Backquote:["²","~","¬","¬"],Comma:[";",".","─","×"],Period:[":","/","·","÷"],Slash:["!","§","̣","̇"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","¦"]}}),Wl({id:"linux.spanish",locale:"es",displayName:"Spanish",platform:"linux",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","æ","Æ"],KeyB:["b","B","”","’"],KeyC:["c","C","¢","©"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","€","¢"],KeyF:["f","F","đ","ª"],KeyG:["g","G","ŋ","Ŋ"],KeyH:["h","H","ħ","Ħ"],KeyI:["i","I","→","ı"],KeyJ:["j","J","̉","̛"],KeyK:["k","K","ĸ","&"],KeyL:["l","L","ł","Ł"],KeyM:["m","M","µ","º"],KeyN:["n","N","n","N"],KeyO:["o","O","ø","Ø"],KeyP:["p","P","þ","Þ"],KeyQ:["q","Q","@","Ω"],KeyR:["r","R","¶","®"],KeyS:["s","S","ß","§"],KeyT:["t","T","ŧ","Ŧ"],KeyU:["u","U","↓","↑"],KeyV:["v","V","“","‘"],KeyW:["w","W","ł","Ł"],KeyX:["x","X","»",">"],KeyY:["y","Y","←","¥"],KeyZ:["z","Z","«","<"],Digit1:["1","!","|","¡"],Digit2:["2",'"',"@","⅛"],Digit3:["3","·","#","£"],Digit4:["4","$","~","$"],Digit5:["5","%","½","⅜"],Digit6:["6","&","¬","⅝"],Digit7:["7","/","{","⅞"],Digit8:["8","(","[","™"],Digit9:["9",")","]","±"],Digit0:["0","=","}","°"],Enter:["\r","\r","\r","\r"],Escape:["","","",""],Backspace:["\b","\b","\b","\b"],Tab:["\t","","\t",""],Space:[" "," "," "," "],Minus:["'","?","\\","¿"],Equal:["¡","¿","̃","~"],BracketLeft:["̀","̂","[","̊"],BracketRight:["+","*","]","̄"],Backslash:["ç","Ç","}","̆"],Semicolon:["ñ","Ñ","~","̋"],Quote:["́","̈","{","{"],Backquote:["º","ª","\\","\\"],Comma:[",",";","─","×"],Period:[".",":","·","÷"],Slash:["-","_","̣","̇"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadEnter:["\r","\r","\r","\r"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","¦"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}}),Wl({id:"linux.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","æ","Æ"],KeyB:["b","B","“","‘"],KeyC:["c","C","¢","©"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","€","€"],KeyF:["f","F","đ","ª"],KeyG:["g","G","ŋ","Ŋ"],KeyH:["h","H","ħ","Ħ"],KeyI:["i","I","→","ı"],KeyJ:["j","J","̣","̇"],KeyK:["k","K","ĸ","&"],KeyL:["l","L","ł","Ł"],KeyM:["m","M","µ","º"],KeyN:["n","N","”","’"],KeyO:["o","O","ø","Ø"],KeyP:["p","P","þ","Þ"],KeyQ:["q","Q","@","Ω"],KeyR:["r","R","¶","®"],KeyS:["s","S","ſ","ẞ"],KeyT:["t","T","ŧ","Ŧ"],KeyU:["u","U","↓","↑"],KeyV:["v","V","„","‚"],KeyW:["w","W","ł","Ł"],KeyX:["x","X","«","‹"],KeyY:["z","Z","←","¥"],KeyZ:["y","Y","»","›"],Digit1:["1","!","¹","¡"],Digit2:["2",'"',"²","⅛"],Digit3:["3","§","³","£"],Digit4:["4","$","¼","¤"],Digit5:["5","%","½","⅜"],Digit6:["6","&","¬","⅝"],Digit7:["7","/","{","⅞"],Digit8:["8","(","[","™"],Digit9:["9",")","]","±"],Digit0:["0","=","}","°"],Enter:["\r","\r","\r","\r"],Escape:["","","",""],Backspace:["\b","\b","\b","\b"],Tab:["\t","","\t",""],Space:[" "," "," "," "],Minus:["ß","?","\\","¿"],Equal:["́","̀","̧","̨"],BracketLeft:["ü","Ü","̈","̊"],BracketRight:["+","*","~","¯"],Backslash:["#","'","’","̆"],Semicolon:["ö","Ö","̋","̣"],Quote:["ä","Ä","̂","̌"],Backquote:["̂","°","′","″"],Comma:[",",";","·","×"],Period:[".",":","…","÷"],Slash:["-","_","–","—"],PrintScreen:["","","",""],PageUp:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",",","",","],IntlBackslash:["<",">","|","̱"],AltRight:["\r","\r","\r","\r"],MetaRight:[".",".",".","."]}})}function Ul(e){var t;const n=/macos|ios/.test(b()),i=e.split("+");let o="";for(const e of i)o&&(o+=n?" ":'<span class="ML__shortcut-join">+</span>'),e.startsWith("[Key")?o+=e.slice(4,5):e.startsWith("Key")?o+=e.slice(3,4):e.startsWith("[Digit")?o+=e.slice(6,7):e.startsWith("Digit")?o+=e.slice(5,6):o+=null!=(t={cmd:"⌘",meta:n?"⌘":"Ctrl",shift:n?"⇧":"Shift",alt:n?"⌥":"Alt",ctrl:n?"⌃":"Ctrl","\n":n?"⏎":"Return","[return]":n?"⏎":"Return","[enter]":n?"⌤":"Enter","[tab]":n?"⇥":"Tab","[escape]":"Esc","[backspace]":n?"⌫":"Backspace","[delete]":n?"⌦":"Del","[pageup]":n?"⇞":"Page Up","[pagedown]":n?"⇟":"Page Down","[home]":n?"⤒":"Home","[end]":n?"⤓":"End","[space]":"Space","[equal]":"=","[minus]":"-","[comma]":",","[slash]":"/","[backslash]":"\\","[bracketleft]":"[","[bracketright]":"]",semicolon:";",period:".",comma:",",minus:"-",equal:"=",quote:"'",backslash:"\\",intlbackslash:"\\",backquote:"`",slash:"/",numpadmultiply:"* 🔢",numpaddivide:"/ 🔢",numpadsubtract:"- 🔢",numpadadd:"+ 🔢",numpaddecimal:". 🔢",numpadcomma:", 🔢",help:"help",left:"⇠",up:"⇡",right:"⇢",down:"⇣","[arrowleft]":"⇠","[arrowup]":"⇡","[arrowright]":"⇢","[arrowdown]":"⇣"}[e.toLowerCase()])?t:e.toUpperCase();return o}function Jl(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return{x:e.clientX,y:e.clientY};if(e instanceof TouchEvent){const t=[...e.touches].reduce(((e,t)=>({x:e.x+t.clientX,y:e.y+t.clientY})),{x:0,y:0}),n=e.touches.length;return{x:t.x/n,y:t.y/n}}}function Xl(e){const t={alt:!1,control:!1,shift:!1,meta:!1};return(e instanceof MouseEvent||e instanceof PointerEvent||e instanceof TouchEvent||e instanceof KeyboardEvent)&&(e.altKey&&(t.alt=!0),e.ctrlKey&&(t.control=!0),e.metaKey&&(t.meta=!0),e.shiftKey&&(t.shift=!0)),t}Wl({id:"dvorak",locale:"en",displayName:"Dvorak",virtualLayout:"dvorak",platform:"",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["x","X","≈","˛"],KeyC:["j","J","∆","Ô"],KeyD:["e","E","´","´"],KeyE:[".",">","≥","˘"],KeyF:["u","U","¨","¨"],KeyG:["i","I","ˆ","ˆ"],KeyH:["d","D","∂","Î"],KeyI:["c","C","ç","Ç"],KeyJ:["h","H","˙","Ó"],KeyK:["t","T","†","ˇ"],KeyL:["n","N","˜","˜"],KeyM:["m","M","µ","Â"],KeyN:["b","B","∫","ı"],KeyO:["r","R","®","‰"],KeyP:["l","L","¬","Ò"],KeyQ:["'",'"',"æ","Æ"],KeyR:["p","P","π","∏"],KeyS:["o","O","ø","Ø"],KeyT:["y","Y","¥","Á"],KeyU:["g","G","©","˝"],KeyV:["k","K","˚",""],KeyW:[",","<","≤","¯"],KeyX:["q","Q","œ","Œ"],KeyY:["f","F","ƒ","Ï"],KeyZ:[";",":","…","Ú"],Digit1:["1","!","¡","⁄"],Digit2:["2","@","™","€"],Digit3:["3","#","£","‹"],Digit4:["4","$","¢","›"],Digit5:["5","%","∞","fi"],Digit6:["6","^","§","fl"],Digit7:["7","&","¶","‡"],Digit8:["8","*","•","°"],Digit9:["9","(","ª","·"],Digit0:["0",")","º","‚"],Space:[" "," "," "," "],Minus:["[","{","“","”"],Equal:["]","}","‘","’"],BracketLeft:["/","?","÷","¿"],BracketRight:["=","+","≠","±"],Backslash:["\\","|","«","»"],Semicolon:["s","S","ß","Í"],Quote:["-","_","–","—"],Backquote:["`","~","`","`"],Comma:["w","W","∑","„"],Period:["v","V","√","◊"],Slash:["z","Z","Ω","¸"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["§","±","§","±"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}});var Gl=new Set(["Backquote","Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Minus","Equal","IntlYen","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Backslash","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","IntlBackslash","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","IntlRo","Space","Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadAdd","NumpadComma","NumpadDecimal","NumpadDivide","NumpadEqual","NumpadHash","NumpadMultiply","NumpadParenLeft","NumpadParenRight","NumpadStar","NumpadSubstract"]);function Zl(e){return!e.ctrlKey&&!e.metaKey&&(!["Dead","Process"].includes(e.key)&&(""===e.code||Gl.has(e.code)))}function Yl(){var e;let t=document.activeElement;for(;null==(e=null==t?void 0:t.shadowRoot)?void 0:e.activeElement;)t=t.shadowRoot.activeElement;return t}var Ql=class e{static get scrim(){return e._scrim||(e._scrim=new e),e._scrim}static open(t){e.scrim.open(t)}static close(){e.scrim.close()}static get state(){return e.scrim.state}static get element(){return e.scrim.element}constructor(e){var t,n;this.lightDismiss=null==(t=null==e?void 0:e.lightDismiss)||t,this.translucent=null!=(n=null==e?void 0:e.translucent)&&n,this.state="closed"}get element(){if(this._element)return this._element;const e=document.createElement("div");return e.setAttribute("role","presentation"),e.style.position="fixed",e.style.contain="content",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0",e.style.zIndex="var(--scrim-zindex, 10099)",e.style.outline="none",this.translucent?(e.style.background="rgba(255, 255, 255, .2)",e.style.backdropFilter="contrast(40%)"):e.style.background="transparent",this._element=e,e}open(e){var t;if("closed"!==this.state)return;this.state="opening",this.onDismiss=null==e?void 0:e.onDismiss,this.savedActiveElement=Yl();const{element:n}=this;(null!=(t=null==e?void 0:e.root)?t:document.body).appendChild(n),n.addEventListener("click",this),document.addEventListener("touchmove",this,!1),document.addEventListener("scroll",this,!1);const i=window.innerWidth-document.documentElement.clientWidth;this.savedMarginRight=document.body.style.marginRight,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden";const o=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${o+i}px`,(null==e?void 0:e.child)&&n.append(e.child),this.state="open"}close(){var e,t,n,i;if("open"!==this.state)return void console.assert(null!==this.element.parentElement);this.state="closing","function"==typeof this.onDismiss&&this.onDismiss(),this.onDismiss=void 0;const{element:o}=this;o.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),o.remove(),document.body.style.overflow=null!=(e=this.savedOverflow)?e:"",document.body.style.marginRight=null!=(t=this.savedMarginRight)?t:"",Yl()!==this.savedActiveElement&&(null==(i=null==(n=this.savedActiveElement)?void 0:n.focus)||i.call(n)),o.innerHTML="",this.state="closed"}handleEvent(e){this.lightDismiss&&(e.target===this._element&&"click"===e.type?(this.close(),e.preventDefault(),e.stopPropagation()):e.target!==document||"touchmove"!==e.type&&"scroll"!==e.type||(this.close(),e.preventDefault(),e.stopPropagation()))}};function ec(e){var t;if(!e||!Zl(e))return"";let n;return"Unidentified"===e.key&&e.target&&(n=e.target.value),n=null!=(t=null!=n?n:e.key)?t:e.code,/^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(n)&&(n=""),n}function tc(e){const t=[];return(e=function(e){if(e.code)return e;const t=Object.entries(jl().mapping);let n=!1,i=!1,o="";for(let r=0;r<4;r++){for(const[a,s]of t)if(s[r]===e.key){o=a,3===r?(n=!0,i=!0):2===r?n=!0:1===r&&(i=!0);break}if(o)break}return new KeyboardEvent(e.type,h(d({},e),{altKey:n,shiftKey:i,code:o}))}(e)).ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),0===t.length?`[${e.code}]`:(t.push(`[${e.code}]`),t.join("+"))}function nc(e){let t=e;return m(t)&&(t=t.length>0?t[0]+"("+t.slice(1).join("")+")":""),t}function ic(e,t){let n=[];if("string"==typeof t){const e=Qa[t];m(e)?n=e.slice():e&&n.push(e)}const i=nc(t),o=new RegExp("^"+i.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(const t of e)o.test(nc(t.command))&&n.push(t.key);return n.map(Ul)}function oc(e,t){if(e.ifPlatform&&!/^!?(macos|windows|android|ios|chromeos|other)$/.test(e.ifPlatform))throw new Error(`Unexpected platform "${e.ifPlatform}" for keybinding ${e.key}`);if(void 0!==e.ifLayout&&(0===t.score||!e.ifLayout.includes(t.id)))return;const n=Nl(e.key);let i=e.ifPlatform;if(n.cmd){if(i&&"macos"!==i&&"ios"!==i)throw new Error('Unexpected "cmd" modifier with platform "'+i+'"\n"cmd" modifier can only be used with macOS or iOS platform.');i||(i="ios"===b()?"ios":"macos"),n.win=!1,n.cmd=!1,n.meta=!0}if(n.win){if(i&&"windows"!==i)throw new Error('Unexpected "win" modifier with platform "'+i+'"\n"win" modifier can only be used with Windows platform.');i="windows",n.win=!1,n.cmd=!1,n.meta=!0}if(i&&!function(e){if(f()){const t=b(),n=e.startsWith("!"),i=e.endsWith(t);if(n&&!i)return!0;if(!n&&i)return!0}return"!other"!==e&&"other"===e}(i))return;if(/^\[.+\]$/.test(n.key))return h(d({},e),{key:Il(n)});const o=function(e,t){var n;const i={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:""};if(!e)return i;for(const[n,o]of Object.entries(t.mapping)){if(o[0]===e)return i.key=`[${n}]`,i;if(o[1]===e)return i.shift=!0,i.key=`[${n}]`,i;if(o[2]===e)return i.alt=!0,i.key=`[${n}]`,i;if(o[3]===e)return i.shift=!0,i.alt=!0,i.key=`[${n}]`,i}return i.key=null!=(n=Rl[e])?n:"",i}(n.key,t);if(!o)return h(d({},e),{key:Il(n)});if(o.shift&&n.shift||o.alt&&n.alt)throw new Error(`The keybinding ${e.key} (${rc(e.command)}) is conflicting with the key combination ${Il(o)} using the ${t.displayName} keyboard layout`);return o.shift=o.shift||n.shift,o.alt=o.alt||n.alt,o.meta=n.meta,o.ctrl=n.ctrl,h(d({},e),{key:Il(o)})}function rc(e){if(Array.isArray(e)){const t=[...e];return t.shift()+"("+t.map((e=>"string"==typeof e?`"${e}"`:e.toString())).join(", ")+")"}return e}function ac(e){var t,n;const i=e.atoms.find((e=>"latexgroup"===e.type));return i&&null!=(n=null==(t=i.body)?void 0:t.filter((e=>"latex"===e.type)))?n:[]}function sc(e,t){var n;let i=0,o=!1;const r=Number.isFinite(null==t?void 0:t.before)?null!=(n=null==t?void 0:t.before)?n:0:e.lastOffset;for(;i<=r&&!o;){const t=e.at(i);o=t instanceof dl&&t.isSuggestion,o||i++}if(!o)return[void 0,void 0];let a=i,s=!1;for(;a<=r&&!s;){const t=e.at(a);s=!(t instanceof dl&&t.isSuggestion),s||a++}return[i-1,a-1]}function lc(e){const t=ac(e.model).filter((e=>e.isSuggestion));if(0!==t.length){e.model.position=e.model.offsetOf(t[0].leftSibling);for(const e of t)e.parent.removeChild(e)}}function cc(e,t){var n;const{model:i}=e;lc(e);for(const e of ac(i))e.isError=!1;if(!i.selectionIsCollapsed||"off"===e.options.popoverPolicy)return void bc(e);const o=[];let r=i.at(i.position);for(;r&&r instanceof dl&&/^[a-zA-Z\*]$/.test(r.value);)r=r.leftSibling;if(r&&r instanceof dl&&"\\"===r.value)for(o.push(r),r=r.rightSibling;r&&r instanceof dl&&/^[a-zA-Z\*]$/.test(r.value);)o.push(r),r=r.rightSibling;const a=o.map((e=>e.value)).join(""),s=function(e,t){var n,i;if(0===t.length||"\\"===t||!t.startsWith("\\"))return[];const o=[];for(const e in V)e.startsWith(t)&&!V[e].infix&&o.push({match:e,frequency:null!=(n=V[e].frequency)?n:0});for(const e in F)e.startsWith(t)&&o.push({match:e,frequency:null!=(i=F[e].frequency)?i:0});const r=t.substring(1);for(const t of Object.keys(e.options.macros))t.startsWith(r)&&o.push({match:"\\"+t,frequency:0});return o.sort(((e,t)=>{var n,i;return e.frequency===t.frequency?e.match.length===t.match.length?e.match<t.match?-1:1:e.match.length-t.match.length:(null!=(n=t.frequency)?n:0)-(null!=(i=e.frequency)?i:0)})),o.map((e=>e.match))}(e,a);if(0===s.length){if(/^\\[a-zA-Z\*]+$/.test(a))for(const e of o)e.isError=!0;return void bc(e)}const l=null!=(n=null==t?void 0:t.atIndex)?n:0;e.suggestionIndex=l<0?s.length-1:l%s.length;const c=s[e.suggestionIndex];if(c!==a){const t=o[o.length-1];t.parent.addChildrenAfter([...c.slice(a.length-c.length)].map((e=>new dl(e,{isSuggestion:!0}))),t),Ec(e,{interactive:!0})}!function(e,t){var n;if(0===t.length)return void bc(e);let i="";for(const[n,o]of t.entries()){const t=o,r=mc(e,o),a=ic(e.keybindings,t).join("<br>");i+=`<li role="button" data-command="${t}" ${n===e.suggestionIndex?"class=ML__popover__current":""}><span class="ML__popover__latex">${t}</span><span class="ML__popover__command">${r}</span>`,a&&(i+=`<span class="ML__popover__keybinding">${a}</span>`),i+="</li>"}const o=function(e,t){let n=document.getElementById("mathlive-suggestion-popover");n||(n=uc("mathlive-suggestion-popover"),ps("suggestion-popover"),ps("core"),n.addEventListener("pointerdown",(e=>e.preventDefault())),n.addEventListener("click",(t=>{let n=t.target;for(;n&&!n.dataset.command;)n=n.parentElement;n&&(hc(e,"reject"),Za.insert(e.model,n.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),e.dirty=!0,e.focus())})));return n.innerHTML=window.MathfieldElement.createHTML(t),n}(e,`<ul>${i}</ul>`);fc()&&(null==(n=o.querySelector(".ML__popover__current"))||n.scrollIntoView({block:"nearest",inline:"nearest"}));setTimeout((()=>{var t;o&&!fc()&&(o.classList.add("is-visible"),gc(e),null==(t=o.querySelector(".ML__popover__current"))||t.scrollIntoView({block:"nearest",inline:"nearest"}))}),32)}(e,s)}function dc(e){const[t,n]=sc(e,{before:e.position});if(void 0===t||void 0===n)return!1;let i=!1;return e.getAtoms([t,n]).forEach((e=>{e.isSuggestion&&(e.isSuggestion=!1,i=!0)})),i}function hc(e,t="accept",n){var i,o;bc(e);const r=e.model.atoms.find((e=>"latexgroup"===e.type));if(!r)return!1;if("accept-suggestion"===t||"accept-all"===t){const n=ac(e.model).filter((e=>e.isSuggestion));if(0!==n.length){for(const e of n)e.isSuggestion=!1;e.model.position=e.model.offsetOf(n[n.length-1])}if("accept-suggestion"===t)return 0!==n.length}const a=ac(e.model).filter((e=>!e.isSuggestion)).map((e=>e.value)).join(""),s=r.leftSibling;return r.parent.removeChild(r),e.model.position=e.model.offsetOf(s),e.switchMode(null!=(i=null==n?void 0:n.mode)?i:"math"),"reject"===t||(Za.insert(e.model,a,{selectionMode:null!=(o=null==n?void 0:n.selectItem)&&o?"item":"placeholder",format:"latex",mode:"math"}),e.snapshot(),e.model.announce("replacement"),e.switchMode("math")),!0}function uc(e){var t;let n=document.getElementById(e);return n?n.dataset.refcount=Number(Number.parseInt(null!=(t=n.dataset.refcount)?t:"0")+1).toString():(n=document.createElement("div"),n.setAttribute("aria-hidden","true"),n.dataset.refcount="1",n.id=e,document.body.append(n)),n}function pc(e){var t;const n=document.getElementById(e);if(!n)return;const i=Number.parseInt(null!=(t=n.getAttribute("data-refcount"))?t:"0");i<=1?n.remove():n.dataset.refcount=Number(i-1).toString()}function mc(e,t){const n=new Ea({from:e.context}),i=new za({mode:"math",type:"root",body:Qs(t,{context:n})});return pa(ua(_l(new da(i.render(n),{classes:"ML__base"}),n)),{classes:"ML__latex"}).toMarkup()}function fc(){const e=document.getElementById("mathlive-suggestion-popover");return!!e&&e.classList.contains("is-visible")}function gc(e,t){var n;if(!e.element||e.element.mathfield!==e)return;if(!fc())return;if("latex"!==(null==(n=e.model.at(e.model.position))?void 0:n.type))return void bc(e);if(null==t?void 0:t.deferred)return void setTimeout((()=>gc(e)),32);const i=ts(e.field);if(!i)return;const o=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=window.innerWidth-document.documentElement.clientWidth,s=window.innerHeight-document.documentElement.clientHeight,l=window.mathVirtualKeyboard.boundingRect.height,c=document.getElementById("mathlive-suggestion-popover");i.x+c.offsetWidth/2>r-a?c.style.left=r-c.offsetWidth-a+"px":i.x-c.offsetWidth/2<0?c.style.left="0":c.style.left=i.x-c.offsetWidth/2+"px";const d=i.y-i.height;o-s-l-i.y<d?(c.classList.add("ML__popover--reverse-direction"),c.classList.remove("top-tip"),c.classList.add("bottom-tip"),c.style.top=i.y-i.height-c.offsetHeight-15+"px"):(c.classList.remove("ML__popover--reverse-direction"),c.classList.add("top-tip"),c.classList.remove("bottom-tip"),c.style.top=`${i.y+15}px`)}function bc(e){e.suggestionIndex=0;const t=document.getElementById("mathlive-suggestion-popover");t&&(t.classList.remove("is-visible"),t.innerHTML="")}new class extends Za{constructor(){super("latex")}createAtom(e){return new dl(e)}onPaste(e,t){if(!t)return!1;const n="string"==typeof t?t:t.getData("application/x-latex")||t.getData("text/plain");return!(!n||!e.model.contentWillChange({inputType:"insertFromPaste",data:n}))&&(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,n)&&(e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),Lc(e)),e.startRecording(),!0)}insert(e,t,n){if(!e.contentWillChange({data:t,inputType:"insertText"}))return!1;n||(n={}),n.insertionMode||(n.insertionMode="replaceSelection"),n.selectionMode||(n.selectionMode="placeholder");const{silenceNotifications:i}=e;n.silenceNotifications&&(e.silenceNotifications=!0);const o=e.silenceNotifications;e.silenceNotifications=!0,"replaceSelection"!==n.insertionMode||e.selectionIsCollapsed?"replaceAll"===n.insertionMode?(e.root.setChildren([],"body"),e.position=0):"insertBefore"===n.insertionMode?e.collapseSelection("backward"):"insertAfter"===n.insertionMode&&e.collapseSelection("forward"):e.deleteAtoms(Oa(e.selection));const r=[];for(const e of t)U.test(e)&&r.push(new dl(e));let a=e.at(e.position);if(a instanceof hl&&(a=a.lastChild),!(a.parent instanceof hl)){const e=new hl("");a.parent.addChildAfter(e,a),a=e.firstChild}const s=a.parent.addChildrenAfter(r,a);return e.silenceNotifications=o,"before"===n.selectionMode||("item"===n.selectionMode?e.setSelection(e.anchor,e.offsetOf(s)):s&&(e.position=e.offsetOf(s))),e.contentDidChange({data:t,inputType:"insertText"}),e.silenceNotifications=i,!0}};var yc,vc,xc=null,wc=(null==(vc=null==(yc=null==globalThis?void 0:globalThis.document)?void 0:yc.currentScript)?void 0:vc.src)||function(){const e=String((new Error).stack).replace(/^Error.*\n/,"").split("\n");if(0===e.length)return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${(new Error).stack}").`),"";let t=e[1],n=t.match(/http.*\.ts[\?:]/);return n&&(t=e[2]),n=t.match(/(https?:.*):[0-9]+:[0-9]+/),n||(n=t.match(/at (.*(\.ts))[\?:]/),n||(n=t.match(/at (.*(\.mjs|\.js))[\?:]/))),n?n[1]:(console.error(e),console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${t}").`),"")}();async function _c(e){if(/^(?:[a-z+]+:)?\/\//i.test(e))return new URL(e).href;if(null===xc)try{const e=await fetch(wc,{method:"HEAD"});200===e.status&&(xc=e.url)}catch(t){console.error(`Invalid URL "${e}" (relative to "${wc}")`)}return new URL(e,null!=xc?xc:wc).href}var kc="not-loaded";async function Mc(){var e;if("not-loaded"!==kc)return;kc="loading";if(null!=(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))&&e)kc="ready";else if(document.body.classList.remove("ML__fonts-did-not-load"),"fonts"in document){const e=["KaTeX_Main","KaTeX_Math","KaTeX_AMS","KaTeX_Caligraphic","KaTeX_Fraktur","KaTeX_SansSerif","KaTeX_Script","KaTeX_Typewriter","KaTeX_Size1","KaTeX_Size2","KaTeX_Size3","KaTeX_Size4"],t=Array.from(document.fonts).map((e=>e.family));if(e.every((e=>t.includes(e))))return void(kc="ready");if(!window.MathfieldElement.fontsDirectory)return void(kc="not-loaded");const n=await _c(window.MathfieldElement.fontsDirectory);if(!n)return document.body.classList.add("ML__fonts-did-not-load"),void(kc="error");const i=[["KaTeX_Main-Regular"],["KaTeX_Main-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_Main-Bold",{weight:"bold"}],["KaTeX_Main-Italic",{style:"italic"}],["KaTeX_Math-Italic",{style:"italic"}],["KaTeX_Math-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_AMS-Regular"],["KaTeX_Caligraphic-Regular"],["KaTeX_Caligraphic-Bold",{weight:"bold"}],["KaTeX_Fraktur-Regular"],["KaTeX_Fraktur-Bold",{weight:"bold"}],["KaTeX_SansSerif-Regular"],["KaTeX_SansSerif-Bold",{weight:"bold"}],["KaTeX_SansSerif-Italic",{style:"italic"}],["KaTeX_Script-Regular"],["KaTeX_Typewriter-Regular"],["KaTeX_Size1-Regular"],["KaTeX_Size2-Regular"],["KaTeX_Size3-Regular"],["KaTeX_Size4-Regular"]].map((e=>function(e,t,n={}){return new FontFace(e,`url(${t}.woff2) format('woff2')`,n)}(e[0].replace(/-[a-zA-Z]+$/,""),`${n}/${e[0]}`,e[1])));try{return(await Promise.all(i.map((e=>{try{return e.load()}catch(e){}})))).forEach((e=>document.fonts.add(e))),void(kc="ready")}catch(e){console.error(`MathLive 0.98.5: The math fonts could not be loaded from "${n}"`,{cause:e}),document.body.classList.add("ML__fonts-did-not-load")}kc="error"}}function Sc(e){let t=0;for(let n=0;n<e.length;n++)t=31*t+e.charCodeAt(n),t|=0;return Math.abs(t)}function Lc(e,t){e&&(e.dirty||(e.dirty=!0,requestAnimationFrame((()=>{es(e)&&e.dirty&&(e.atomBoundsCache=new Map,Ec(e,t),e.atomBoundsCache=void 0)}))))}function Cc(e,t){const{model:n}=e;n.root.caret=void 0,n.root.isSelected=!1,n.root.containsCaret=!0;for(const e of n.atoms)e.caret=void 0,e.isSelected=!1,e.containsCaret=!1;if(n.selectionIsCollapsed){const t=n.at(n.position);t.caret=e.model.mode;let i=t.parent;for(;i;)i.containsCaret=!0,i=i.parent}else{const e=n.getAtoms(n.selection,{includeChildren:!0});for(const t of e)t.isSelected=!0}const i=function(e,t){var n;t=null!=t?t:{};const i=new Ea({from:h(d({},e.context),{atomIdsSettings:{seed:t.forHighlighting?Sc(za.serialize([e.model.root],{expandMacro:!1,defaultMode:e.options.defaultMode})):"random",groupNumbers:null!=(n=t.forHighlighting)&&n},letterShapeStyle:e.options.letterShapeStyle}),mathstyle:"inline-math"===e.options.defaultMode?"textstyle":"displaystyle"});return pa(_l(e.model.root.render(i),i),{classes:e.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})}(e,t);return i.toMarkup()}function Ec(e,t){if(!es(e))return;null!=t||(t={});const n=e.element.querySelector("[part=virtual-keyboard-toggle]");n&&(n.style.display=e.hasEditableContent?"":"none");const i=e.field;if(!i)return;const o=e.isSelectionEditable&&e.hasFocus(),r=i.classList.contains("ML__focused");r&&!o?i.classList.remove("ML__focused"):!r&&o&&i.classList.add("ML__focused");let a=Cc(e,t);const s=e.element.querySelector("[part=menu-toggle]");if(s&&(e.model.atoms.length<=1||e.disabled||e.readOnly&&!e.hasEditableContent||"none"===e.userSelect?s.style.display="none":s.style.display=""),e.model.atoms.length<=1){const t=e.options.contentPlaceholder;t&&(a+=`<span part=placeholder class="ML__content-placeholder">${xu(t)}</span>`)}i.innerHTML=window.MathfieldElement.createHTML(a),Kc(e,t.interactive),e.dirty=!1}function Kc(e,t){const n=e.field;if(!n)return;for(const e of n.querySelectorAll(".ML__selection, .ML__contains-highlight"))e.remove();null!=t&&t||"error"===kc||"ready"===kc||setTimeout((()=>{"ready"===kc?Kc(e):setTimeout((()=>Kc(e)),128)}),32);const i=e.model,o=n.offsetWidth,r=n.getBoundingClientRect().width;let a=Math.floor(r)/o;if(a=isNaN(a)?1:a,i.selectionIsCollapsed){gc(e,{deferred:!0});let t=i.at(i.position);for(;t&&"prompt"!==t.type&&(!t.containsCaret||!t.displayContainsHighlight);)t=t.parent;if((null==t?void 0:t.containsCaret)&&t.displayContainsHighlight){const i=is(e,rs(e,t),a);if(i){i.left/=a,i.right/=a,i.top/=a,i.bottom/=a;const e=document.createElement("div");e.classList.add("ML__contains-highlight"),e.style.position="absolute",e.style.left=`${i.left+1}px`,e.style.top=`${Math.ceil(i.top)}px`,e.style.width=`${Math.ceil(i.right-i.left)}px`,e.style.height=`${Math.ceil(i.bottom-i.top)}px`,n.insertBefore(e,n.childNodes[0])}}}else for(const t of function(e){let t=[];for(const n of e){let e=!1;for(const i of t)if(n.left===i.left&&n.right===i.right&&n.top===i.top&&n.bottom===i.bottom){e=!0;break}e||t.push(n)}e=t,t=[];for(const n of e){let i=0;for(const t of e)if(n.left>=t.left&&n.right<=t.right&&n.top>=t.top&&n.bottom<=t.bottom&&(i+=1,i>1))break;1===i&&t.push(n)}return t}(as(e,{excludeAtomsWithBackground:!0}))){t.left/=a,t.right/=a,t.top/=a,t.bottom/=a;const e=document.createElement("div");e.classList.add("ML__selection"),e.style.position="absolute",e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${Math.ceil(t.right-t.left)}px`,e.style.height=`${Math.ceil(t.bottom-t.top-1)}px`,n.insertBefore(e,n.childNodes[0])}}var Ac;function Dc(e,t){t=d({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},null!=t?t:{}),Ac||(Ac={});for(const n of Object.keys(e))console.assert(!Ac[n],"Selector already defined: ",n),Ac[n]=h(d({},t),{fn:e[n]})}function zc(e){let t;if(Array.isArray(e)){if("performWithFeedback"===e[0])return zc(e[1]);t=e[0]}else t=e;return t=t.replace(/-\w/g,(e=>e[1].toUpperCase())),Ac[t]}function Tc(e){var t;return null==(t=zc(e))?void 0:t.target}Dc({performWithFeedback:(e,t)=>function(e,t){var n;if(!e)return!1;e.focus(),up.keypressVibration&&g()&&navigator.vibrate(3);const i=zc(t);window.MathfieldElement.playSound(null!=(n=null==i?void 0:i.audioFeedback)?n:"keypress");const o=e.executeCommand(t);return e.scrollIntoView(),o}(e,t)}),Dc({complete:hc},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),Dc({nextSuggestion:function(e){return cc(e,{atIndex:e.suggestionIndex+1}),!1},previousSuggestion:function(e){return cc(e,{atIndex:e.suggestionIndex-1}),!1}},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var Bc="mathlive#virtual-keyboard-message";function $c(e){var t;if("message"!==e.type)return!1;return(null==(t=e.data)?void 0:t.type)===Bc}var Pc,Oc=class e{constructor(){this.targetOrigin=window.origin,this.originValidator="none",this._boundingRect=new DOMRect(0,0,0,0),this._isShifted=!1,window.addEventListener("message",this),this.sendMessage("proxy-created"),this.listeners={}}static get singleton(){return this._singleton||(this._singleton=new e),this._singleton}set alphabeticLayout(e){this.sendMessage("update-setting",{alphabeticLayout:e})}set layouts(e){this.sendMessage("update-setting",{layouts:e})}get normalizedLayouts(){return[]}set editToolbar(e){this.sendMessage("update-setting",{editToolbar:e})}set actionKeycap(e){this.sendMessage("update-setting",{actionKeycap:e})}set shiftKeycap(e){this.sendMessage("update-setting",{shiftKeycap:e})}set backspaceKeycap(e){this.sendMessage("update-setting",{backspaceKeycap:e})}set tabKeycap(e){this.sendMessage("update-setting",{tabKeycap:e})}set container(e){throw new Error("Container inside an iframe cannot be changed")}show(e){this.sendMessage("show",e)}hide(e){this.sendMessage("hide",e)}get isShifted(){return this._isShifted}get visible(){return this._boundingRect.height>0}set visible(e){e?this.show():this.hide()}get boundingRect(){return this._boundingRect}executeCommand(e){return this.sendMessage("execute-command",{command:e}),!0}updateToolbar(e){this.sendMessage("update-toolbar",e)}update(e){this.sendMessage("update-setting",e)}connect(){this.sendMessage("connect")}disconnect(){this.sendMessage("disconnect")}addEventListener(e,t,n){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(t)||this.listeners[e].add(t)}dispatchEvent(e){return!this.listeners[e.type]||0===this.listeners[e.type].size||(this.listeners[e.type].forEach((t=>{"function"==typeof t?t(e):null==t||t.handleEvent(e)})),!e.defaultPrevented)}removeEventListener(e,t,n){this.listeners[e]&&this.listeners[e].delete(t)}handleEvent(e){if($c(e)){if(!ss(e.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");this.handleMessage(e.data)}}handleMessage(e){const{action:t}=e;if("execute-command"!==t)return"synchronize-proxy"===t?(this._boundingRect=e.boundingRect,void(this._isShifted=e.isShifted)):"geometry-changed"===t?(this._boundingRect=e.boundingRect,void this.dispatchEvent(new Event("geometrychange"))):void 0;{const{command:t}=e;"virtual-keyboard"===Tc(t)&&this.executeCommand(t)}}sendMessage(e,t={}){if(!window.top)throw new DOMException("A frame does not have access to the top window and can‘t communicate with the keyboard. Review virtualKeyboardTargetOrigin and originValidator on mathfields embedded in an iframe","SecurityError");window.top.postMessage(d({type:Bc,action:e},t),this.targetOrigin)}},qc={numeric:{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",rows:[[{latex:"x",shift:"y",variants:["y","z","t","r","x^2","x^n","x^{#?}","x_n","x_i","x_{#?}",{latex:"f(#?)",class:"small"},{latex:"g(#?)",class:"small"}]},{latex:"n",shift:"a",variants:["i","j","p","k","a","u"]},"[separator-5]","[7]","[8]","[9]","[/]","[separator-5]",{latex:"\\exponentialE",shift:"\\ln",variants:["\\exp","\\times 10^{#?}","\\ln","\\log_{10}","\\log"]},{latex:"\\imaginaryI",variants:["\\Re","\\Im","\\imaginaryJ","\\Vert #0 \\Vert"]},{latex:"\\pi",shift:"\\sin",variants:["\\prod",{latex:"\\theta",aside:"theta"},{latex:"\\rho",aside:"rho"},{latex:"\\tau",aside:"tau"},"\\sin","\\cos","\\tan"]}],[{label:"<",latex:"<",class:"hide-shift",shift:{latex:"\\le",label:"≤"}},{label:">",latex:">",class:"hide-shift",shift:{latex:"\\ge",label:"≥"}},"[separator-5]","[4]","[5]","[6]","[*]","[separator-5]",{class:"hide-shift",latex:"#@^2}",shift:"#@^{\\prime}}"},{latex:"#@^{#0}}",class:"hide-shift",shift:"#@_{#?}"},{class:"hide-shift",latex:"\\sqrt{#0}",shift:{latex:"\\sqrt[#0]{#?}}"}}],["[(]","[)]","[separator-5]","[1]","[2]","[3]","[-]","[separator-5]",{latex:"\\int^{\\infty}_{0}\\!#?\\,\\mathrm{d}x",class:"small hide-shift",shift:"\\int",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{class:"hide-shift",latex:"\\forall",shift:"\\exists"},{label:"[backspace]",width:1}],[{label:"[shift]",width:2},"[separator-5]","[0]","[.]","[=]","[+]","[separator-5]","[left]","[right]",{label:"[action]",width:1}]]},greek:{label:"αβγ",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"<i>φ</i>",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"<i>ς</i>",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"<i>ϵ</i>",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"espilon",shift:'\\char"0190'},{label:"<i>ρ</i>",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"<i>τ</i>",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"<i>υ</i>",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"<i>θ</i>",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"<i>ι</i>",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"<i>ο</i>",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"<i>π</i>",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"<i>α</i>",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"<i>σ</i>",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"<i>δ</i>",class:"MLK__tex hide-shift",insert:"\\delta",aside:"delta",shift:"\\Delta"},{latex:"\\phi",class:"MLK__tex hide-shift",insert:"\\phi",aside:"phi",shift:"\\Phi"},{label:"<i>γ</i>",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"<i>η</i>",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"<i>ξ</i>",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"<i>κ</i>",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"<i>λ</i>",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"<i>ζ</i>",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"<i>χ</i>",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"<i>ψ</i>",class:"MLK__tex hide-shift",insert:"\\psi",aside:"zeta",shift:"\\Psi"},{label:"<i>ω</i>",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"<i>β</i>",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"<i>ν</i>",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"<i>μ</i>",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"<i>ε</i>",class:"MLK__tex",insert:"\\varepsilon",aside:"espilon var."},{label:"<i>ϑ</i>",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"<i>ϰ</i>",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"<i>ϖ</i>",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"<i>ϱ</i>",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[action]"]]},symbols:{label:"∞≠∈",labelClass:"MLK__tex",tooltip:"keyboard.tooltip.symbols",rows:[[{latex:"\\sin",shift:"\\sin^{-1}",variants:[{class:"small",latex:"\\sinh"},{class:"small",latex:"\\sin^{-1}"},{class:"small",latex:"\\arsinh"}]},"\\ln",{latex:"\\mathrm{abs}",insert:"\\mathrm{abs}\\left(#0\\right)"},{latex:"\\rarr",shift:"\\rArr",variants:[{latex:"\\implies",aside:"implies"},{latex:"\\to",aside:"to"},"\\dashv",{latex:"\\roundimplies",aside:"round implies"}]},{latex:"\\exists",variants:["\\nexists"],shift:"\\nexists"},{latex:"\\in",shift:"\\notin",variants:["\\notin","\\owns"]},"\\cup",{latex:"\\overrightarrow{#@}",shift:"\\overleftarrow{#@}",variants:["\\overleftarrow{#@}","\\bar{#@}","\\vec{#@}","\\hat{#@}","\\check{#@}","\\dot{#@}","\\ddot{#@}","\\mathring{#@}","\\breve{#@}","\\acute{#@}","\\tilde{#@}","\\grave{#@}"]},{class:"small",latex:"\\lim_{#?}",shift:"\\lim_{x\\to\\infty}",variants:[{class:"small",latex:"\\liminf_{#?}"},{class:"small",latex:"\\limsup_{#?}"}]},"\\exponentialE"],[{latex:"\\cos",shift:"\\cos^{-1}",variants:[{class:"small",latex:"\\cosh"},{class:"small",latex:"\\cos^{-1}"},{class:"small",latex:"\\arcosh"}]},{latex:"\\log",shift:"\\log_{10}",variants:["\\log_{#0}","\\log_{10}"]},"\\left\\vert#0\\right\\vert",{latex:"\\larr",shift:"\\lArr",variants:[{latex:"\\impliedby",aside:"implied by"},{latex:"\\gets",aside:"gets"},"\\lArr","\\vdash",{latex:"\\models",aside:"models"}]},{latex:"\\forall",shift:"\\lnot",variants:[{latex:"\\land",aside:"and"},{latex:"\\lor",aside:"or"},{latex:"\\oplus",aside:"xor"},{latex:"\\lnot",aside:"not"},{latex:"\\downarrow",aside:"nor"},{latex:"\\uparrow",aside:"nand"},{latex:"\\curlywedge",aside:"nor"},{latex:"\\bar\\curlywedge",aside:"nand"}]},{latex:"\\ni",shift:"\\not\\owns"},"\\cap",{latex:"\\overline{#@}",shift:"\\underline{#@}",variants:["\\overbrace{#@}","\\overlinesegment{#@}","\\overleftrightarrow{#@}","\\overrightarrow{#@}","\\overleftarrow{#@}","\\overgroup{#@}","\\underbrace{#@}","\\underlinesegment{#@}","\\underleftrightarrow{#@}","\\underrightarrow{#@}","\\underleftarrow{#@}","\\undergroup{#@}"]},{class:"hide-shift",latex:"\\int",shift:"\\iint",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\smallint",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\intop","\\iiint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\ointctrclockwise","\\intctrclockwise"]},{latex:"\\pi",shift:"\\tau",variants:["\\tau"]}],[{latex:"\\tan",shift:"\\tan^{-1}",variants:[{class:"small",latex:"\\tanh"},{class:"small",latex:"\\tan^{-1}"},{class:"small",latex:"\\artanh"},{class:"small",latex:"\\arctan"},{class:"small",latex:"\\arctg"},{class:"small",latex:"\\tg"}]},{latex:"\\exp",insert:"\\exp\\left(#0\\right)",variants:["\\exponentialE^{#0}"]},"\\left\\Vert#0\\right\\Vert",{latex:"\\lrArr",shift:"\\leftrightarrow",variants:[{latex:"\\iff",aside:"if and only if"},"\\leftrightarrow","\\leftrightarrows","\\Leftrightarrow",{latex:"^\\biconditional",aside:"biconditional"}]},{latex:"\\vert",shift:"!"},{latex:"#@^{\\complement}",aside:"complement",variants:[{latex:"\\setminus",aside:"set minus"},{latex:"\\smallsetminus",aside:"small set minus"}]},{latex:"\\subset",shift:"\\subseteq",variants:["\\subset","\\subseteq","\\subsetneq","\\varsubsetneq","\\subsetneqq","\\nsubset","\\nsubseteq","\\supset","\\supseteq","\\supsetneq","\\supsetneqq","\\nsupset","\\nsupseteq"]},{latex:"#@^{\\prime}",shift:"#@^{\\doubleprime}",variants:["#@^{\\doubleprime}","#@\\degree"]},{latex:"\\mathrm{d}",shift:"\\partial",variants:["\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{latex:"\\infty",variants:["\\aleph_0","\\aleph_1","\\omega","\\mathfrak{m}"]}],[{label:"[shift]",width:2},{class:"box",latex:",",shift:";",variants:[";","?"]},{class:"box",latex:"\\colon",shift:"\\Colon",variants:[{latex:"\\Colon",aside:"such that",class:"box"},{latex:":",aside:"ratio",class:"box"},{latex:"\\vdots",aside:"",class:"box"},{latex:"\\ddots",aside:"",class:"box"},{latex:"\\ldotp",aside:"low dot",class:"box"},{latex:"\\cdotp",aside:"center dot",class:"box"},{latex:"\\ldots",aside:"low ellipsis",class:"box"},{latex:"\\cdots",aside:"center ellipsis",class:"box"},{latex:"\\therefore",aside:"therefore",class:"box"},{latex:"\\because",aside:"because",class:"box"}]},{class:"box",latex:"\\cdot",aside:"centered dot",shift:"\\ast",variants:["\\circ","\\bigcirc","\\bullet","\\odot","\\oslash","\\circledcirc","\\ast","\\star","\\times","\\doteq","\\doteqdot"]},"[separator]","[left]","[right]",{label:"[backspace]",width:1,class:"action hide-shift"},{label:"[action]",width:1}]]},compact:{label:"compact",rows:[["[+]","[-]","[*]","[/]","[=]","[.]","[(]","[)]","\\sqrt{#0}","#@^{#?}"],["[1]","[2]","[3]","[4]","[5]","[6]","[7]","[8]","[9]","[0]"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]},minimalist:{label:"minimalist",layers:[{style:"\n .minimalist-backdrop {\n display: flex;\n justify-content: center;\n } \n .minimalist-container {\n --keycap-height: 40px;\n --keycap-max-width: 53px;\n --keycap-small-font-size: 12px;\n background: var(--keyboard-background);\n padding: 20px;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border: 1px solid var(--keyboard-border);\n box-shadow: 0 0 32px rgb(0 0 0 / 30%);\n } \n ",backdrop:"minimalist-backdrop",container:"minimalist-container",rows:[["+","-","\\times",{latex:"\\frac{#@}{#0}",class:"small"},"=","[.]","(",")",{latex:"\\sqrt{#0}",class:"small"},{latex:"#@^{#?}",class:"small"}],["1","2","3","4","5","6","7","8","9","0"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]}]},"numeric-only":{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",id:"numeric-only",rows:[["7","8","9","[separator]",{label:"[backspace]",width:2}],["4","5","6","[separator]","[separator]","[separator]"],["1","2","3","[separator]","[separator]","[separator]"],["0",{label:"[.]",variants:[]},"-","[separator]","[left]","[right]"]]}},Nc={0:["\\varnothing","\\infty"],1:["\\frac{1}{#@}","#@^{-1}","\\times 10^{#?}","\\phi","\\imaginaryI"],2:["\\frac{1}{2}","#@^2","\\sqrt2","\\exponentialE"],3:["\\frac{1}{3}","#@^3","\\sqrt3","\\pi"],4:["\\frac{1}{4}","#@^4"],5:["\\frac{1}{5}","#@^5","\\sqrt5"],6:["\\frac{1}{6}","#@^6"],7:["\\frac{1}{7}","#@^7"],8:["\\frac{1}{8}","#@^8"],9:["\\frac{1}{9}","#@^9"],".":[".",",",";","\\colon"],",":["{,}",".",";","\\colon"],a:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"à","á","â","ä","æ"],b:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"},"ç"],d:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"},"è","é","ê","ë"],g:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"},"ì","í","î","ï"],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\mathbb{N}",aside:"set of natural numbers"},"ñ"],o:["ø","œ","ò","ó","ô","ö","œ"],p:[{latex:"\\mathbb{P}",aside:"set of primes"}],q:[{latex:"\\mathbb{Q}",aside:"set of rational numbers"}],r:[{latex:"\\mathbb{R}",aside:"set of real numbers"}],u:["ù","ú","û","ü"],z:[{latex:"\\mathbb{Z}",aside:"set of integers"}],y:["ý","ÿ"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space<br>⁻³⧸₁₈ em"},{latex:'\\char"203A\\,\\char"2039',insert:"\\,",aside:"thin space<br>³⧸₁₈ em"},{latex:'\\char"203A\\:\\char"2039',insert:"\\:",aside:"medium space<br>⁴⧸₁₈ em"},{latex:'\\char"203A\\;\\char"2039',insert:"\\;",aside:"thick space<br>⁵⧸₁₈ em"},{latex:'\\char"203A\\ \\char"2039',insert:"\\ ",aside:"⅓ em"},{latex:'\\char"203A\\enspace\\char"2039',insert:"\\enspace",aside:"½ em"},{latex:'\\char"203A\\quad\\char"2039',insert:"\\quad",aside:"1 em"},{latex:'\\char"203A\\qquad\\char"2039',insert:"\\qquad",aside:"2 em"}]};function Ic(e,t){var n,i,o;const r=ld.singleton;if(!r)return;const a=ad(e),s=null!=(i=null==(n=r.getKeycap(null==a?void 0:a.id))?void 0:n.variants)?i:"";if("string"==typeof s&&!Rc(s)||Array.isArray(s)&&0===s.length)return void(null==t||t());const l={};let c="";for(const e of function(e){var t;if("string"!=typeof e)return e;Nc[e]||(Nc[e]=null!=(t=function(e){if("foreground-color"===e){const e=[];for(const t of Object.keys(M))e.push({class:"swatch-button",label:'<span style="border: 3px solid '+M[t]+'"></span>',command:["applyStyle",{color:t}]});return e}if("background-color"===e){const e=[];for(const t of Object.keys(k))e.push({class:"swatch-button",label:'<span style="background:'+k[t]+'"></span>',command:["applyStyle",{backgroundColor:t}]});return e}return}(e))?t:[]);return Nc[e]}(s)){const t=td(e),n=Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36);l[n]=t;const[i,o]=Yc(t);c+=`<div id=${n} class="item ${o}">${i}</div>`}const d=document.createElement("div");d.setAttribute("aria-hidden","true"),d.className="MLK__variant-panel",d.style.height="auto";const h=Object.keys(l).length;let u=5;1===h?u=1:2===h||4===h?u=2:3===h||5===h||6===h?u=3:h>=7&&h<14&&(u=4),d.style.width=`calc(var(--variant-keycap-length) * ${u} + 12px)`,d.innerHTML=up.createHTML(c),Ql.open({root:null==(o=null==r?void 0:r.container)?void 0:o.querySelector(".ML__keyboard"),child:d}),Pc=new AbortController;const{signal:p}=Pc,m=null==e?void 0:e.getBoundingClientRect();if(m){m.top-d.clientHeight<0&&(d.style.width="auto",h<=6?d.style.height="56px":h<=12?d.style.height="108px":h<=18?d.style.height="205px":d.classList.add("compact"));const e=Math.max(0,Math.min(window.innerWidth-d.offsetWidth,(m.left+m.right-d.offsetWidth)/2)),n=m.top-d.clientHeight+5;d.style.transform=`translate(${e}px, ${n}px)`,d.classList.add("is-visible"),requestAnimationFrame((()=>{d.addEventListener("pointerup",(e=>{const n=ad(e.target);(null==n?void 0:n.id)&&l[n.id]&&(od(l[n.id]),Fc(),null==t||t(),e.preventDefault())}),{capture:!0,passive:!1,signal:p}),d.addEventListener("pointerenter",(e=>{const t=ad(e.target);(null==t?void 0:t.id)&&l[t.id]&&t.classList.add("is-active")}),{capture:!0,signal:p}),d.addEventListener("pointerleave",(e=>{const t=ad(e.target);(null==t?void 0:t.id)&&l[t.id]&&t.classList.remove("is-active")}),{capture:!0,signal:p}),window.addEventListener("pointercancel",(()=>{Fc(),null==t||t()}),{signal:p}),window.addEventListener("pointerup",(()=>{Fc(),null==t||t()}),{signal:p})}))}}function Fc(){null==Pc||Pc.abort(),Pc=null,"open"===Ql.state&&Ql.close()}function Rc(e){return void 0!==Nc[e]}function Vc(e){return Object.keys(e).map((t=>`${t} {${function(e){return"string"==typeof e?e:Object.entries(e).map((([e,t])=>`${e}:${t} !important`)).join(";")}(e[t])}}`)).join("")}function Hc(e){if(!e)return"";const t=new Ea,n=new za({mode:"math",type:"root",body:Qs(e,{context:t,args:e=>"@"===e?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})});return pa(ua(_l(new da(n.render(t),{classes:"ML__base"}),t)),{classes:"ML__latex"}).toMarkup()}function Wc(e){if(Array.isArray(e))return e.map((e=>Wc(e))).flat();const t="string"==typeof e?{markup:e}:e;return"rows"in t&&Array.isArray(t.rows)&&(t.rows=t.rows.map((e=>e.map((e=>td(e)))))),null!=t.id||(t.id="ML__layer_"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36)),[t]}function jc(e){if("alphabetic"===e)return function(){var e,t;let n=window.mathVirtualKeyboard.alphabeticLayout;if("auto"===n){const t=jl();t&&(n=t.virtualLayout),n&&"auto"!==n||(n=null!=(e={fr:"azerty",be:"azerty",al:"qwertz",ba:"qwertz",cz:"qwertz",de:"qwertz",hu:"qwertz",sk:"qwertz",ch:"qwertz"}[v.locale.slice(0,2)])?e:"qwerty")}const i={qwerty:["qwertyuiop"," asdfghjkl ","^zxcvbnm~"],azerty:["azertyuiop","qsdfghjklm","^ wxcvbn ~"],qwertz:["qwertzuiop"," asdfghjkl ","^yxcvbnm~"],dvorak:["^ pyfgcrl ","aoeuidhtns","qjkxbmwvz~"],colemak:[" qwfpgjluy ","arstdhneio","^zxcvbkm~"]},o=null!=(t=i[n])?t:i.qwerty,r="azerty"===n?[[{label:"1",variants:"1"},{label:"2",shift:{latex:"é"},variants:"2"},{label:"3",shift:{latex:"ù"},variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{label:"(",latex:"("},variants:"5"},{label:"6",shift:{label:")",latex:")"},variants:"6"},{label:"7",shift:{latex:"è"},variants:"7"},{label:"8",shift:{latex:"ê"},variants:"8"},{label:"9",shift:{latex:"ç"},variants:"9"},{label:"0",shift:{latex:"à"},variants:"0"}]]:[[{label:"1",variants:"1"},{label:"2",variants:"2"},{label:"3",variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{latex:"\\frac{#@}{#?}"},variants:"5"},{label:"6",shift:{latex:"#@^#?"},variants:"6"},{label:"7",variants:"7"},{label:"8",shift:{latex:"\\times"},variants:"8"},{label:"9",shift:{label:"(",latex:"("},variants:"9"},{label:"0",shift:{label:")",latex:")"},variants:"0"}]];for(const e of o){const t=[];for(const i of e)/[a-z]/.test(i)?t.push({label:i,class:"hide-shift",shift:{label:i.toUpperCase()},variants:Rc(i)?i:void 0}):"~"===i?"dvorak"!==n?t.push("[backspace]"):t.push({label:"[backspace]",width:1}):"^"===i?t.push("[shift]"):" "===i&&t.push("[separator-5]");r.push(t)}return r.push(["[-]","[+]","[=]",{label:" ",width:1.5},{label:",",shift:";",variants:".",class:"hide-shift"},"[.]","[left]","[right]",{label:"[action]",width:1.5}]),{label:"abc",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.alphabetic",layers:Wc({rows:r})}}();if("string"==typeof e)return console.assert(void 0!==qc[e],`MathLive 0.98.5: unknown keyboard layout "${e}"`),jc(qc[e]);let t;if("rows"in e&&Array.isArray(e.rows)){console.assert(!("layers"in e||"markup"in e),'MathLive 0.98.5: when providing a "rows" property, "layers" and "markup" are ignored');const n=e,{rows:i}=n,o=p(n,["rows"]);t=h(d({},o),{layers:Wc({rows:e.rows})})}else if("markup"in e&&"string"==typeof e.markup){const n=e,{markup:i}=n,o=p(n,["markup"]);t=h(d({},o),{layers:Wc(e.markup)})}else t=d({},e),"layers"in e?t.layers=Wc(e.layers):console.error('MathLive 0.98.5: provide either a "rows", "markup" or "layers" property');let n=!1,i=!1;for(const e of t.layers)if(e.rows)for(const t of e.rows.flat()){sd(t)&&(n=!0);const e=t.command;"string"==typeof e&&["undo","redo","cut","copy","paste"].includes(e)&&(i=!0)}return"displayShiftedKeycaps"in e&&void 0!==e.displayShiftedKeycaps||(t.displayShiftedKeycaps=n),"displayEditToolbar"in e&&void 0!==e.displayEditToolbar||(t.displayEditToolbar=!i),t}function Uc(e,t){var n,i;let o='<div class="left">';if(e.normalizedLayouts.length>1)for(const[r,a]of e.normalizedLayouts.entries()){const e=a,s=[r===t?"selected":"layer-switch"];e.tooltip&&s.push("MLK__tooltip"),e.labelClass&&s.push(...e.labelClass.split(" ")),o+=`<div class="${s.join(" ")}"`,e.tooltip&&(o+=" data-tooltip='"+(null!=(n=x(e.tooltip))?n:e.tooltip)+"' "),r!==t&&(o+=`data-layer="${e.layers[0].id}"`),o+=`>${null!=(i=e.label)?i:"untitled"}</div>`}return o+="</div>",o}function Jc(e,t){let n="";if("none"===e.editToolbar)return"";const i=[];t.selectionIsCollapsed?i.push("undo","redo","pasteFromClipboard"):i.push("cutToClipboard","copyToClipboard","pasteFromClipboard");const o={undo:`<div class='action ${!1===t.canUndo?"disabled":""}'\n data-command='"undo"'\n data-tooltip='${x("tooltip.undo")}'>\n <svg><use xlink:href='#svg-undo' /></svg>\n </div>`,redo:`<div class='action ${!1===t.canRedo?"disabled":""}'\n data-command='"redo"'\n data-tooltip='${x("tooltip.redo")}'>\n <svg><use xlink:href='#svg-redo' /></svg>\n </div>`,cutToClipboard:`\n <div class='action'\n data-command='"cutToClipboard"'\n data-tooltip='${x("tooltip.cut to clipboard")}'>\n <svg><use xlink:href='#svg-cut' /></svg>\n </div>\n `,copyToClipboard:`\n <div class='action'\n data-command='"copyToClipboard"'\n data-tooltip='${x("tooltip.copy to clipboard")}'>\n <svg><use xlink:href='#svg-copy' /></svg>\n </div>\n `,pasteFromClipboard:`\n <div class='action'\n data-command='"pasteFromClipboard"'\n data-tooltip='${x("tooltip.paste from clipboard")}'>\n <svg><use xlink:href='#svg-paste' /></svg>\n </div>\n `};return n+=i.map((e=>o[e])).join(""),n}function Xc(e){const t=ld.singleton;if(!t)return;const n={};if(!e.id){if(e.hasAttribute("data-label")&&(n.label=e.dataset.label),e.hasAttribute("data-latex")&&(n.latex=e.dataset.latex),e.hasAttribute("data-key")&&(n.key=e.dataset.key),e.hasAttribute("data-insert")&&(n.insert=e.dataset.insert),e.hasAttribute("data-variants")&&(n.variants=e.dataset.variants),e.hasAttribute("data-aside")&&(n.aside=e.dataset.aside),e.className&&(n.class=e.className),n.label||n.latex||n.key||n.insert||(n.latex=e.innerText,n.label=e.innerHTML),e.hasAttribute("data-command"))try{n.command=JSON.parse(e.dataset.command)}catch(e){}e.id=t.registerKeycap(n)}if(!e.innerHTML){const[t,i]=Yc(n);e.innerHTML=window.MathfieldElement.createHTML(t)}}function Gc(e){e.resetKeycapRegistry(),ps("virtual-keyboard"),ps("core"),Mc();const t=document.createElement("div");t.className="ML__keyboard";const n=document.createElement("div");n.className="MLK__plate",n.innerHTML=window.MathfieldElement.createHTML('<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">\n\n<symbol id="svg-delete-backward" viewBox="0 0 576 512">\n <path d="M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z"/>\n</symbol>\n\n<symbol id="svg-shift" viewBox="0 0 384 512">\n <path d="M2.438 252.3C7.391 264.2 19.06 272 32 272h80v160c0 26.51 21.49 48 48 48h64C250.5 480 272 458.5 272 432v-160H352c12.94 0 24.61-7.797 29.56-19.75c4.953-11.97 2.219-25.72-6.938-34.88l-160-176C208.4 35.13 200.2 32 192 32S175.6 35.13 169.4 41.38l-160 176C.2188 226.5-2.516 240.3 2.438 252.3zM192 86.63L313.4 224H224v208H160V224H70.63L192 86.63z"/>\n</symbol>\n\n<symbol id="svg-commit" viewBox="0 0 512 512">\n <path d="M135 432.1l-128-128C2.344 300.3 0 294.2 0 288s2.344-12.28 7.031-16.97l128-128c9.375-9.375 24.56-9.375 33.94 0s9.375 24.56 0 33.94L81.94 264H464v-208C464 42.75 474.8 32 488 32S512 42.75 512 56V288c0 13.25-10.75 24-24 24H81.94l87.03 87.03c9.375 9.375 9.375 24.56 0 33.94S144.4 442.3 135 432.1z"/>\n</symbol>\n\n\n<symbol id="circle-plus" viewBox="0 0 512 512"><path d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM232 344c0 13.3 10.7 24 24 24s24-10.7 24-24V280h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H280V168c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H168c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"/></symbol>\n\n<symbol id="svg-command" viewBox="0 0 640 512">\n <path d="M34.495 36.465l211.051 211.05c4.686 4.686 4.686 12.284 0 16.971L34.495 475.535c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L205.947 256 10.454 60.506c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.687 12.284-4.687 16.97 0zM640 468v-10c0-6.627-5.373-12-12-12H300c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h328c6.627 0 12-5.373 12-12z"/>\n</symbol>\n\n<symbol id="svg-undo" viewBox="0 0 512 512">\n <path d="M20 8h10c6.627 0 12 5.373 12 12v110.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H180c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V20c0-6.627 5.373-12 12-12z"/>\n</symbol>\n<symbol id="svg-redo" viewBox="0 0 512 512">\n <path d="M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z"/>\n</symbol>\n<symbol id="svg-arrow-left" viewBox="0 0 320 512">\n <path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/>\n</symbol>\n<symbol id="svg-arrow-right" viewBox="0 0 320 512">\n <path d="M113.3 47.41l183.1 191.1c4.469 4.625 6.688 10.62 6.688 16.59s-2.219 11.97-6.688 16.59l-183.1 191.1c-9.152 9.594-24.34 9.906-33.9 .7187c-9.625-9.125-9.938-24.38-.7187-33.91l168-175.4L78.71 80.6c-9.219-9.5-8.906-24.78 .7187-33.91C88.99 37.5 104.2 37.82 113.3 47.41z"/>\n</symbol>\n<symbol id="svg-tab" viewBox="0 0 448 512">\n <path d="M32 217.1c0-8.8 7.2-16 16-16h144v-93.9c0-7.1 8.6-10.7 13.6-5.7l143.5 143.1c6.3 6.3 6.3 16.4 0 22.7L205.6 410.4c-5 5-13.6 1.5-13.6-5.7v-93.9H48c-8.8 0-16-7.2-16-16v-77.7m-32 0v77.7c0 26.5 21.5 48 48 48h112v61.9c0 35.5 43 53.5 68.2 28.3l143.6-143c18.8-18.8 18.8-49.2 0-68L228.2 78.9c-25.1-25.1-68.2-7.3-68.2 28.3v61.9H48c-26.5 0-48 21.6-48 48zM436 64h-8c-6.6 0-12 5.4-12 12v360c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12z"/>\n</symbol>\n<symbol id="svg-paste" viewBox="0 0 512 512"><path d="M160 32c11.6 0 21.3 8.2 23.5 19.2C185 58.6 191.6 64 199.2 64H208c8.8 0 16 7.2 16 16V96H96V80c0-8.8 7.2-16 16-16h8.8c7.6 0 14.2-5.4 15.7-12.8C138.7 40.2 148.4 32 160 32zM64 64h2.7C65 69 64 74.4 64 80V96c0 17.7 14.3 32 32 32H224c17.7 0 32-14.3 32-32V80c0-5.6-1-11-2.7-16H256c17.7 0 32 14.3 32 32h32c0-35.3-28.7-64-64-64H210.6c-9-18.9-28.3-32-50.6-32s-41.6 13.1-50.6 32H64C28.7 32 0 60.7 0 96V384c0 35.3 28.7 64 64 64H192V416H64c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32zM288 480c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32h96v56c0 22.1 17.9 40 40 40h56V448c0 17.7-14.3 32-32 32H288zM416 165.3L474.7 224H424c-4.4 0-8-3.6-8-8V165.3zM448 512c35.3 0 64-28.7 64-64V235.9c0-12.7-5.1-24.9-14.1-33.9l-59.9-59.9c-9-9-21.2-14.1-33.9-14.1H288c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"/></symbol>\n<symbol id="svg-cut" viewBox="0 0 512 512"><path d="M485.6 444.2L333.6 314.9C326.9 309.2 326.1 299.1 331.8 292.4C337.5 285.6 347.6 284.8 354.4 290.5L506.4 419.8C513.1 425.5 513.9 435.6 508.2 442.4C502.5 449.1 492.4 449.9 485.6 444.2zM485.7 67.76C492.5 62.07 502.5 62.94 508.2 69.69C513.9 76.45 513.1 86.55 506.3 92.24L208.5 343.1C218.3 359.7 224 379.2 224 400C224 461.9 173.9 512 112 512C50.14 512 0 461.9 0 400C0 338.1 50.14 288 112 288C141.5 288 168.4 299.4 188.4 318.1L262.2 256L188.4 193.9C168.4 212.6 141.5 224 112 224C50.14 224 0 173.9 0 112C0 50.14 50.14 0 112 0C173.9 0 224 50.14 224 112C224 132.8 218.3 152.3 208.5 168.9L287 235.1L485.7 67.76zM32 112C32 156.2 67.82 192 112 192C156.2 192 192 156.2 192 112C192 67.82 156.2 32 112 32C67.82 32 32 67.82 32 112zM112 480C156.2 480 192 444.2 192 400C192 355.8 156.2 320 112 320C67.82 320 32 355.8 32 400C32 444.2 67.82 480 112 480z"/></symbol>\n<symbol id="svg-copy" viewBox="0 0 512 512"><path d="M272 416C263.2 416 256 423.2 256 432V448c0 17.67-14.33 32-32 32H64c-17.67 0-32-14.33-32-32V192c0-17.67 14.33-32 32-32h112C184.8 160 192 152.8 192 144C192 135.2 184.8 128 176 128H63.99c-35.35 0-64 28.65-64 64l.0098 256C0 483.3 28.65 512 64 512h160c35.35 0 64-28.65 64-64v-16C288 423.2 280.8 416 272 416zM502.6 86.63l-77.25-77.25C419.4 3.371 411.2 0 402.7 0H288C252.7 0 224 28.65 224 64v256c0 35.35 28.65 64 64 64h160c35.35 0 64-28.65 64-64V109.3C512 100.8 508.6 92.63 502.6 86.63zM416 45.25L466.7 96H416V45.25zM480 320c0 17.67-14.33 32-32 32h-160c-17.67 0-32-14.33-32-32V64c0-17.67 14.33-32 32-32h96l.0026 64c0 17.67 14.33 32 32 32H480V320z"/>\n</symbol>\n<symbol id="svg-angle-double-right" viewBox="0 0 512 512"><path d="M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/>\n</symbol>\n<symbol id="svg-angle-double-left" viewBox="0 0 512 512"><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/>\n</symbol>\n<symbol id="svg-trash" viewBox="0 0 448 512">\n <path d="M336 64l-33.6-44.8C293.3 7.1 279.1 0 264 0h-80c-15.1 0-29.3 7.1-38.4 19.2L112 64H24C10.7 64 0 74.7 0 88v2c0 3.3 2.7 6 6 6h26v368c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V96h26c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24h-88zM184 32h80c5 0 9.8 2.4 12.8 6.4L296 64H152l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm200 432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96h320v368zm-176-44V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm-80 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm160 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12z"/>\n</symbol>\n<symbol id="svg-keyboard-down" viewBox="0 0 576 512"><path d="M64 48c-8.8 0-16 7.2-16 16V240c0 8.8 7.2 16 16 16H512c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H512c35.3 0 64 28.7 64 64V240c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM159 359c9.4-9.4 24.6-9.4 33.9 0l95 95 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L305 505c-4.5 4.5-10.6 7-17 7s-12.5-2.5-17-7L159 393c-9.4-9.4-9.4-24.6 0-33.9zm1-167c0-8.8 7.2-16 16-16H400c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V192zM120 88h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H120c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H200c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H280c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H360c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H440c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16z"/></symbol>\n</svg>'+e.normalizedLayouts.map(((t,n)=>function(e,t,n){const i=[];if(!("layers"in t))return"";for(const o of t.layers)i.push(`<div tabindex="-1" class="MLK__layer" id="${o.id}">`),(e.normalizedLayouts.length>1||t.displayEditToolbar)&&(i.push("<div class='MLK__toolbar' role='toolbar'>"),i.push(Uc(e,n)),t.displayEditToolbar&&i.push('<div class="ML__edit-toolbar right"></div>'),i.push("</div>")),i.push(Zc(e,o)),i.push("</div>");return i.join("")}(e,t,n))).join(""));const i=document.createElement("div");i.className="MLK__backdrop",i.appendChild(n),t.appendChild(i),t.addEventListener("pointerdown",nd,{passive:!1});const o=t.querySelectorAll(".ML__edit-toolbar");if(o)for(const t of o)t.addEventListener("click",(t=>{var n,i;let o=t.target,r="";for(;o&&!r;)r=null!=(n=null==o?void 0:o.getAttribute("data-command"))?n:"",o=null!=(i=null==o?void 0:o.parentElement)?i:null;r&&e.executeCommand(JSON.parse(r))}));!function(e){for(const t of e)Xc(t)}(t.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"));const r=t.querySelectorAll(".MLK__layer");console.assert(r.length>0,"No virtual keyboards available");for(const e of r)e.addEventListener("pointerdown",(e=>e.preventDefault()));return e.currentLayer=e.latentLayer,t}function Zc(e,t){if("string"==typeof t)return t;let n="";if("string"==typeof t.style?n+=`<style>${t.style}</style>`:"object"==typeof t.style&&(n+=`<style>${Vc(t.style)}</style>`),t.backdrop&&(n+=`<div class='${t.backdrop}'>`),t.container&&(n+=`<div class='${t.container}'>`),t.rows){n+="<div class=MLK__rows>";for(const i of t.rows){n+="<div dir='ltr' class=MLK__row>";for(const t of i)if(t){const i=e.registerKeycap(t),[o,r]=Yc(t);/(^|\s)separator/.test(r)?n+=`<div class="${r}"`:n+=`<div tabindex="-1" id="${i}" class="${r}"`,t.tooltip&&(n+=` data-tooltip="${t.tooltip}"`),n+=`>${o}</div>`}n+="</div>"}n+="</div>"}else t.markup&&(n+=t.markup);return t.container&&(n+="</div>"),t.backdrop&&(n+="</div>"),n}function Yc(e,t={shifted:!1}){var n,i,o,r,a,s,l;let c="",d=null!=(n=e.class)?n:"";if(t.shifted&&sd(e)&&(d+=" is-active"),t.shifted&&"shift"in e)"string"==typeof e.shift?c=Hc(e.shift):"object"==typeof e.shift&&(c=e.shift.label?e.shift.label:null!=(i=Hc(e.shift.latex||e.shift.insert||"")||e.shift.key)?i:""),"object"==typeof e.shift&&(d=null!=(r=null!=(o=e.shift.class)?o:e.class)?r:"");else{if(c=e.label?e.label:null!=(a=Hc(e.latex||e.insert||"")||e.key)?a:"",e.shift){let t;t="string"==typeof e.shift?Hc(e.shift):e.shift.label?e.shift.label:null!=(s=Hc(e.shift.latex||e.shift.insert||"")||e.shift.key)?s:"",c+=`<span class="MLK__shift">${t}</span>`}e.aside&&(c+=`<aside>${e.aside}</aside>`)}return e.layer&&!/layer-switch/.test(d)&&(d+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(d)||(d+=" MLK__keycap"),!/\bw[0-9]+\b/.test(d)&&e.width&&(d+=null!=(l={0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"}[e.width])?l:""),[c,d||"MLK__keycap"]}var Qc,ed={"[left]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-left /></svg>",command:["performWithFeedback","moveToPreviousChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-left /></svg>",command:["performWithFeedback","extendSelectionBackward"]}},"[right]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-right /></svg>",command:["performWithFeedback","moveToNextChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-right /></svg>",command:["performWithFeedback","extendSelectionForward"]}},"[up]":{class:"action hide-shift",label:"↑",command:["performWithFeedback","moveUp"],shift:{label:"↟",command:["performWithFeedback","extendSelectionUpward"]}},"[down]":{class:"action hide-shift",label:"↓",command:["performWithFeedback","moveDown"],shift:{label:"↡",command:["performWithFeedback","extendSelectionDownward"]}},"[return]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[action]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{label:"<svg class=svg-glyph><use xlink:href=#circle-plus /></svg>",command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[hr]":{class:"separator horizontal-rule"},"[hide-keyboard]":{class:"action",command:["hideVirtualKeyboard"],width:1.5,label:"<svg class=svg-glyph-lg><use xlink:href=#svg-keyboard-down /></svg>"},"[.]":{variants:".",command:["performWithFeedback","insertDecimalSeparator"],shift:",",class:"big-op hide-shift",label:"."},"[,]":{variants:",",command:["performWithFeedback","insertDecimalSeparator"],shift:".",class:"big-op hide-shift",label:","},"[+]":{variants:[{latex:"\\sum_{#0}^{#0}",class:"small"},"\\oplus"],latex:"+",label:"+",class:"big-op hide-shift",shift:{latex:"\\sum",insert:"\\sum",class:"small"}},"[-]":{variants:["\\pm","\\ominus"],latex:"-",label:"−",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"÷"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"×",shift:{latex:"\\times"},class:"big-op hide-shift"},"[=]":{variants:["\\neq","\\equiv","\\varpropto","\\thickapprox","\\lt","\\gt","\\le","\\ge"],latex:"=",label:"=",shift:{label:"≠",latex:"\\ne"},class:"big-op hide-shift"},"[backspace]":{class:"action bottom right hide-shift",width:1.5,command:["performWithFeedback","deleteBackward"],label:"<svg class=svg-glyph><use xlink:href=#svg-delete-backward /></svg>",shift:{class:"action warning",label:"<svg class=svg-glyph><use xlink:href=#svg-trash /></svg>",command:"deleteAll"}},"[undo]":{class:"ghost if-can-undo",command:"undo",label:"<svg class=svg-glyph><use xlink:href=#svg-undo /></svg>",tooltip:"tooltip.undo"},"[redo]":{class:"ghost if-can-redo",command:"redo",label:"<svg class=svg-glyph><use xlink:href=#svg-redo /></svg>",tooltip:"tooltip.redo"},"[(]":{variants:[{latex:"\\lbrack",key:"["},"\\langle","\\lfloor","\\lceil",{latex:"\\lbrace",key:"{"}],key:"(",label:"(",shift:{label:"[",key:"["},class:"hide-shift"},"[)]":{variants:[{latex:"\\rbrack",key:"]"},"\\rangle","\\rfloor","\\rceil",{latex:"\\rbrace",key:"]"}],key:")",label:")",shift:{label:"]",latex:"\\rbrack"},class:"hide-shift"},"[0]":{variants:"0",latex:"0",label:"0",shift:"\\infty",class:"hide-shift"},"[1]":{variants:"1",latex:"1",label:"1",shift:"#@^{-1}",class:"hide-shift"},"[2]":{variants:"2",latex:"2",label:"2",shift:"#@^2",class:"hide-shift"},"[3]":{variants:"3",latex:"3",label:"3",shift:"#@^3",class:"hide-shift"},"[4]":{variants:"4",latex:"4",label:"4",shift:"#@^4",class:"hide-shift"},"[5]":{variants:"5",latex:"5",label:"5",shift:"#@^5",class:"hide-shift"},"[6]":{variants:"6",latex:"6",label:"6",shift:"#@^6",class:"hide-shift"},"[7]":{variants:"7",latex:"7",label:"7",shift:"#@^7",class:"hide-shift"},"[8]":{variants:"8",latex:"8",label:"8",shift:"#@^8",class:"hide-shift"},"[9]":{variants:"9",latex:"9",label:"9",shift:"#@^9",class:"hide-shift"},"[separator-5]":{class:"separator",width:.5},"[separator]":{class:"separator"},"[separator-10]":{class:"separator"},"[separator-15]":{class:"separator",width:1.5},"[separator-20]":{class:"separator",width:2},"[separator-50]":{class:"separator",width:5},"[shift]":{class:"shift bottom left",width:1.5,label:"<span class=caps-lock-indicator></span><svg class=svg-glyph><use xlink:href=#svg-shift /></svg>"},"[foreground-color]":{variants:"foreground-color",command:["applyStyle",{color:"red"}],label:"<span style='border-radius: 50%;width:22px;height:22px; border: 3px solid #cc2428; box-sizing: border-box'>"},"[background-color]":{variants:"background-color",command:["applyStyle",{backgroundColor:"yellow"}],label:"<span style='border-radius: 50%;width:22px;height:22px; background:#fff590; box-sizing: border-box'></span>"}};function td(e){var t;if("string"==typeof e){if("[.]"===e&&","===window.MathfieldElement.decimalSeparator&&(e="[,]"),!ed[e])return{latex:e};e={label:e}}let n;return"label"in e&&e.label&&ed[e.label]&&(n=h(d(d({},ed[e.label]),e),{label:ed[e.label].label})),"key"in e&&e.key&&ed[e.key]&&(n=h(d(d({},ed[e.key]),e),{key:ed[e.key].key})),n?("insertDecimalSeparator"===n.command&&(n.label=null!=(t=window.MathfieldElement.decimalSeparator)?t:"."),"[action]"===e.label&&(n=d(d({},n),window.mathVirtualKeyboard.actionKeycap)),"[shift]"===e.label&&(n=d(d({},n),window.mathVirtualKeyboard.shiftKeycap)),"[backspace]"===e.label&&(n=d(d({},n),window.mathVirtualKeyboard.backspaceKeycap)),"[tab]"===e.label&&(n=d(d({},n),window.mathVirtualKeyboard.tabKeycap)),n):e}function nd(e){var t;if(0!==e.button)return;const n=ld.singleton;if(!n)return;let i=e.target;for(;i&&!i.getAttribute("data-layer");)i=i.parentElement;if(i)return n.currentLayer=null!=(t=i.getAttribute("data-layer"))?t:"",void e.preventDefault();const o=ad(e.target);if(!(null==o?void 0:o.id))return;const r=n.getKeycap(o.id);if(!r)return;console.assert("pointerdown"===e.type);const a=new AbortController,s=a.signal;o.classList.add("is-pressed"),o.addEventListener("pointerenter",id(a),{capture:!0,signal:s}),o.addEventListener("pointerleave",id(a),{capture:!0,signal:s}),o.addEventListener("pointercancel",id(a),{signal:s}),o.addEventListener("pointerup",id(a),{signal:s}),sd(r)&&(o.classList.add("is-active"),n.shiftPressCount++),r.variants&&(Qc&&clearTimeout(Qc),Qc=setTimeout((()=>{o.classList.contains("is-pressed")&&(o.classList.remove("is-pressed"),o.classList.add("is-active"),e.target&&"releasePointerCapture"in e.target&&e.target.releasePointerCapture(e.pointerId),Ic(o,(()=>{a.abort(),null==o||o.classList.remove("is-active")})))}),300)),e.preventDefault()}function id(e){return t=>{const n=ad(t.target);if(!(null==n?void 0:n.id))return;const i=ld.singleton;if(!i)return;const o=i.getKeycap(n.id);if(o){if("pointerenter"===t.type&&t.target===n){t.isPrimary&&n.classList.add("is-pressed")}return"pointercancel"===t.type?(n.classList.remove("is-pressed"),sd(o)&&(i.shiftPressCount--,n.classList.toggle("is-active",i.isShifted)),void e.abort()):"pointerleave"===t.type&&t.target===n?(n.classList.remove("is-pressed"),void(sd(o)&&(i.shiftPressCount--,n.classList.toggle("is-active",i.isShifted)))):"pointerup"===t.type?(Qc&&clearTimeout(Qc),sd(o)?n.classList.toggle("is-active",i.isShifted):n.classList.contains("is-pressed")&&(n.classList.remove("is-pressed"),i.isShifted&&o.shift?"string"==typeof o.shift?i.executeCommand(["insert",o.shift,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]):od(o.shift):od(o),1!==i.shiftPressCount||t.shiftKey||(i.shiftPressCount=0)),e.abort(),void t.preventDefault()):void 0}}}function od(e){var t;let n=e.command;!n&&e.insert&&(n=["insert",e.insert,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),!n&&e.key&&(n=["typedText",e.key,{focus:!0,feedback:!0,simulateKeystroke:!0}]),!n&&e.latex&&(n=["insert",e.latex,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),n||(n=["typedText",e.label,{focus:!0,feedback:!0,simulateKeystroke:!0}]),null==(t=ld.singleton)||t.executeCommand(n)}function rd(e){if(1!==e.nodeType)return!1;const t=e.classList;return t.contains("MLK__keycap")||t.contains("shift")||t.contains("action")||t.contains("fnbutton")||t.contains("bigfnbutton")}function ad(e){if(!e)return;let t=e;for(;t&&!rd(t);)t=t.parentElement;return null!=t?t:void 0}function sd(e){return!!e.class&&/(^|\s)shift($|\s)/.test(e.class)}var ld=class e{constructor(){var e,t,n;this.originalContainerBottomPadding=null,this.keycapRegistry={},this._shiftPressCount=0,this.targetOrigin=window.origin,this.originValidator="none",this._alphabeticLayout="auto",this._layouts=Object.freeze(["default"]),this._editToolbar="default",this._container=null!=(t=null==(e=window.document)?void 0:e.body)?t:null,this._visible=!1,this._rebuilding=!1,this.observer=new ResizeObserver((e=>{this.adjustBoundingRect(),this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect})})),this.listeners={};try{null==(n=window.top)||n.addEventListener("message",this)}catch(e){window.addEventListener("message",this)}document.body.addEventListener("focusin",(e=>{const t=e.target;(null==t?void 0:t.isConnected)&&setTimeout((()=>{const e=cd();e&&!e.readOnly&&"auto"===e.mathVirtualKeyboardPolicy&&("matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0)&&this.show({animate:!0})}),300)})),document.addEventListener("focusout",(e=>{"manual"!==e.target.mathVirtualKeyboardPolicy&&setTimeout((()=>{cd()||this.hide()}),300)}))}get currentLayer(){var e,t,n;return null!=(n=null==(t=null==(e=this._element)?void 0:e.querySelector(".MLK__layer.is-visible"))?void 0:t.id)?n:""}set currentLayer(e){var t;if(!this._element)return void(this.latentLayer=e);let n=e?this._element.querySelector(`#${e}.MLK__layer`):null;n||(n=this._element.querySelector(".MLK__layer")),n&&(null==(t=this._element.querySelector(".MLK__layer.is-visible"))||t.classList.remove("is-visible"),n.classList.add("is-visible")),this.render()}get shiftPressCount(){return this._shiftPressCount}set shiftPressCount(e){var t;this._shiftPressCount=e>2||e<0?0:e,null==(t=this._element)||t.classList.toggle("is-caps-lock",2===this.shiftPressCount),this.render()}get isShifted(){return this._shiftPressCount>0}resetKeycapRegistry(){this.keycapRegistry={}}registerKeycap(e){const t="ML__k"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36);return this.keycapRegistry[t]=e,t}getKeycap(e){return e?this.keycapRegistry[e]:void 0}getLayer(e){const t=this.normalizedLayouts;for(const n of t)for(const t of n.layers)if(t.id===e)return t}get alphabeticLayout(){return this._alphabeticLayout}set alphabeticLayout(e){this._alphabeticLayout=e,this.rebuild()}get actionKeycap(){return this._actionKeycap}set actionKeycap(e){this._actionKeycap="string"==typeof e?{label:e}:e}get shiftKeycap(){return this._shiftKeycap}set shiftKeycap(e){this._shiftKeycap="string"==typeof e?{label:e}:e}get backspaceKeycap(){return this._backspaceKeycap}set backspaceKeycap(e){this._backspaceKeycap="string"==typeof e?{label:e}:e}get tabKeycap(){return this._tabKeycap}set tabKeycap(e){this._tabKeycap="string"==typeof e?{label:e}:e}get layouts(){return this._layouts}set layouts(e){this.updateNormalizedLayouts(e),this.rebuild()}updateNormalizedLayouts(e){const t=Array.isArray(e)?[...e]:[e],n=t.findIndex((e=>"default"===e));n>=0&&t.splice(n,1,"numeric","symbols","alphabetic","greek"),this._layouts=Object.freeze(t),this._normalizedLayouts=t.map((e=>jc(e)))}get normalizedLayouts(){return this._normalizedLayouts||this.updateNormalizedLayouts(this._layouts),this._normalizedLayouts}get editToolbar(){return this._editToolbar}set editToolbar(e){this._editToolbar=e,this.rebuild()}get container(){return this._container}set container(e){this._container=e,this.rebuild()}static get singleton(){if(void 0===this._singleton)try{this._singleton=new e}catch(e){this._singleton=null}return this._singleton}get style(){return this._style}addEventListener(e,t,n){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(t)||this.listeners[e].add(t)}dispatchEvent(e){return!this.listeners[e.type]||0===this.listeners[e.type].size||(this.listeners[e.type].forEach((t=>{"function"==typeof t?t(e):null==t||t.handleEvent(e)})),!e.defaultPrevented)}removeEventListener(e,t,n){this.listeners[e]&&this.listeners[e].delete(t)}get element(){return this._element}set element(e){var t;this._element!==e&&(null==(t=this._element)||t.remove(),this._element=e)}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get boundingRect(){var e;if(!this._visible)return new DOMRect;const t=null==(e=this._element)?void 0:e.getElementsByClassName("MLK__plate")[0];return t?t.getBoundingClientRect():new DOMRect}adjustBoundingRect(){var e,t;const n=this.boundingRect.height;if(this.container===document.body){null==(e=this._element)||e.style.setProperty("--_keyboard-height",`calc(${n}px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0))`);const t=n-1;this.container.style.paddingBottom=this.originalContainerBottomPadding?`calc(${this.originalContainerBottomPadding} + ${t}px)`:`${t}px`}else null==(t=this._element)||t.style.setProperty("--_keyboard-height",`${n}px`)}rebuild(){if(this._rebuilding||!this._element)return;this._rebuilding=!0;const e=this.currentLayer;requestAnimationFrame((()=>{this._rebuilding=!1,this._element&&(this._element.remove(),this._element=void 0),this.visible&&(this.buildAndAttachElement(),this.currentLayer=e,this.render(),this.adjustBoundingRect(),this._element.classList.add("is-visible"))}))}render(){if(!this._element)return;const e=this.getLayer(this.currentLayer);this._element.classList.toggle("backdrop-is-transparent",Boolean(e&&(e.backdrop||e.container)));const t=this._element.querySelectorAll(".MLK__layer.is-visible .MLK__keycap, .MLK__layer.is-visible .action, .fnbutton, .MLK__layer.is-visible .bigfnbutton, .MLK__layer.is-visible .shift");if(t)for(const e of t){const t=this.getKeycap(e.id);if(t){const[n,i]=Yc(t,{shifted:this.isShifted});e.innerHTML=window.MathfieldElement.createHTML(n),e.className=i}}}show(e){var t;if(this._visible)return;const n=this.container;if(n&&window.mathVirtualKeyboard&&this.stateWillChange(!0)){if(this._element||(this.buildAndAttachElement(),this.adjustBoundingRect()),!this._visible){const e=this._element.getElementsByClassName("MLK__plate")[0];if(e&&this.observer.observe(e),n===window.document.body){const t=n.style.paddingBottom;this.originalContainerBottomPadding=t;const i=e.offsetHeight-1;n.style.paddingBottom=t?`calc(${t} + ${i}px)`:`${i}px`}window.addEventListener("mouseup",this),window.addEventListener("blur",this),window.addEventListener("keydown",this,{capture:!0}),window.addEventListener("keyup",this,{capture:!0}),null==(t=this._element)||t.classList.toggle("is-caps-lock",2===this.shiftPressCount),this.currentLayer=this.latentLayer}this._visible=!0,(null==e?void 0:e.animate)?requestAnimationFrame((()=>{this._element&&(this._element.classList.add("animate"),this._element.addEventListener("transitionend",(()=>{var e;return null==(e=this._element)?void 0:e.classList.remove("animate")}),{once:!0}),this._element.classList.add("is-visible"),this.stateChanged())})):(this._element.classList.add("is-visible"),this.stateChanged())}}hide(e){var t;const n=this.container;if(n&&this._visible&&this.stateWillChange(!1)){if(this._visible=!1,this._element){this.latentLayer=this.currentLayer;const e=this._element.getElementsByClassName("MLK__plate")[0];e&&this.observer.unobserve(e),window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("keydown",this,{capture:!0}),window.removeEventListener("keyup",this,{capture:!0}),window.removeEventListener("contextmenu",this,{capture:!0}),Fc(),ms("core"),ms("virtual-keyboard"),null==(t=this._element)||t.remove(),this._element=void 0,null!==this.originalContainerBottomPadding&&(n.style.paddingBottom=this.originalContainerBottomPadding)}this.stateChanged()}}get height(){var e,t;return null!=(t=null==(e=this.element)?void 0:e.offsetHeight)?t:0}buildAndAttachElement(){var e;console.assert(!this.element),this.element=Gc(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",(e=>{e.shiftKey||((e.ctrlKey||2===e.button)&&Ic(e.target),e.preventDefault(),e.stopPropagation())}),{capture:!0}),null==(e=this.container)||e.appendChild(this.element)}handleEvent(e){if($c(e)){if(!ss(e.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");"disconnect"===e.data.action?this.connectedMathfieldWindow=void 0:"update-setting"!==e.data.action&&"proxy-created"!==e.data.action&&"execute-command"!==e.data.action&&(console.assert(void 0!==e.source),this.connectedMathfieldWindow=e.source),this.handleMessage(e.data,e.source)}if(this._element)switch(e.type){case"mouseup":case"blur":document.body.style.userSelect="",this.shiftPressCount=0;break;case"contextmenu":2!==e.button&&e.preventDefault();break;case"keydown":"Shift"!==e.key||e.repeat||(this.shiftPressCount=1);break;case"keyup":("Shift"===e.key||!e.getModifierState("Shift")&&2!==this.shiftPressCount)&&(this.shiftPressCount=0)}}handleMessage(e,t){const{action:n}=e;if("execute-command"!==n){if("connect"!==n&&"show"!==n||this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},t),"disconnect"!==n&&window===window.top)if("show"!==n){if("hide"!==n)return"update-setting"===n?(e.alphabeticLayout&&(this.alphabeticLayout=e.alphabeticLayout),e.layouts&&(this.layouts=e.layouts),void(e.editToolbar&&(this.editToolbar=e.editToolbar))):void("proxy-created"!==n||this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},t));void 0!==e.animate?this.hide({animate:e.animate}):this.hide()}else void 0!==e.animate?this.show({animate:e.animate}):this.show()}else{const{command:t}=e,n=Tc(t);if(void 0!==window.top&&"virtual-keyboard"!==n)return;this.executeCommand(t)}}sendMessage(e,t,n){if(n||(n=this.connectedMathfieldWindow),null!==this.targetOrigin&&"null"!==this.targetOrigin&&n!==window){if(n)n.postMessage(d({type:Bc,action:e},t),{targetOrigin:this.targetOrigin});else if(t.command&&this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command",{detail:t.command})),"execute-command"===e&&Array.isArray(t.command)&&"insert"===t.command[0]){const e=t.command[1].split("");for(const t of e)this.dispatchEvent(new KeyboardEvent("keydown",{key:t,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:t,bubbles:!0}))}}else window.dispatchEvent(new MessageEvent("message",{source:window,data:d({type:Bc,action:e},t)}))}stateWillChange(e){return this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle",{detail:{visible:e},bubbles:!0,cancelable:!0,composed:!0}))}stateChanged(){this.dispatchEvent(new Event("virtual-keyboard-toggle")),this._visible||(this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect}))}focus(){this.sendMessage("focus",{})}blur(){this.sendMessage("blur",{})}updateToolbar(e){const t=this._element;if(!t)return;t.classList.toggle("is-math-mode","math"===e.mode),t.classList.toggle("is-text-mode","text"===e.mode),t.classList.toggle("can-undo",e.canUndo),t.classList.toggle("can-redo",e.canRedo),t.classList.toggle("can-copy",!e.selectionIsCollapsed),t.classList.toggle("can-copy",!e.selectionIsCollapsed),t.classList.toggle("can-paste",!0);const n=t.querySelectorAll(".ML__edit-toolbar");if(n)for(const t of n)t.innerHTML=Jc(this,e)}update(e){this._style=e.style,this.updateToolbar(e)}connect(){this.connectedMathfieldWindow=window}disconnect(){this.connectedMathfieldWindow=void 0}executeCommand(e){let t,n=[],i=Tc(e);return m(e)?(t=e[0],"performWithFeedback"===t&&(i=Tc(e=e.slice(1))),n=e.slice(1)):t=e,t=t.replace(/-\w/g,(e=>e[1].toUpperCase())),"virtual-keyboard"===i?Ac[t].fn(void 0,...n):(this.sendMessage("execute-command",{command:e}),!1)}dispose(){window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("message",this)}};function cd(){var e,t;let n=Yl(),i=null;for(;n;){if("host"in n&&"math-field"===(null==(t=null==(e=n.host)?void 0:e.tagName)?void 0:t.toLowerCase())){i=n.host;break}n=n.parentNode}return i}if(f()&&!("mathVirtualKeyboard"in window))if(window===window.top){const e=ld.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e})}else Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>Oc.singleton,configurable:!0});function dd(e){const t={};for(const n of Object.keys(e))switch(n){case"scriptDepth":const i=e.scriptDepth;if(m(i))t.scriptDepth=[i[0],i[1]];else if("number"==typeof i)t.scriptDepth=[i,i];else{if("string"!=typeof i)throw new TypeError("Unexpected value for scriptDepth");{const[e,n]=i.split(",").map((e=>parseInt(e.trim())));t.scriptDepth=[e,n]}}break;case"mathVirtualKeyboardPolicy":let o=e.mathVirtualKeyboardPolicy.toLowerCase();if("sandboxed"===o){if(window!==window.top){const e=ld.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e})}o="manual"}t.mathVirtualKeyboardPolicy=o;break;case"letterShapeStyle":"auto"===e.letterShapeStyle?v.locale.startsWith("fr")?t.letterShapeStyle="french":t.letterShapeStyle="tex":t.letterShapeStyle=e.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(e.defaultMode)?t.defaultMode=e.defaultMode:(console.error('MathLive 0.98.5: valid values for defaultMode are "text", "math" or "inline-math"'),t.defaultMode="math");break;case"macros":t.macros=re(e.macros);break;default:m(e[n])?t[n]=[...e[n]]:"object"!=typeof e[n]||e[n]instanceof Element||"computeEngine"===n?t[n]=e[n]:t[n]=d({},e[n])}return t}function hd(e,t){let n;n="string"==typeof t?[t]:void 0===t?Object.keys(e):t;const i={};for(const t of n)null===e[t]?i[t]=null:m(e[t])?i[t]=[...e[t]]:"object"!=typeof e[t]||e[t]instanceof Element||"computeEngine"===t?i[t]=e[t]:i[t]=d({},e[t]);return"string"==typeof t?i[t]:i}function ud(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:C,backgroundColorMap:E,letterShapeStyle:v.locale.startsWith("fr")?"french":"tex",minFontScale:0,smartMode:!1,smartFence:!0,smartSuperscript:!0,scriptDepth:[1/0,1/0],removeExtraneousParentheses:!0,isImplicitFunction:e=>["\\sin","\\cos","\\tan","\\arcsin","\\arccos","\\arctan","\\arcsec","\\arccsc","\\arsinh","\\arcosh","\\artanh","\\arcsech","\\arccsch","\\arg","\\ch","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\sec","\\sinh","\\sh","\\tanh","\\tg","\\th","\\lg","\\lb","\\log","\\ln"].includes(e),mathModeSpace:"",placeholderSymbol:"▢",contentPlaceholder:"",popoverPolicy:"auto",environmentPopoverPolicy:"off",keybindings:Ya,inlineShortcuts:Ra,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",virtualKeyboardTargetOrigin:null==window?void 0:window.origin,originValidator:"none",onInlineShortcut:()=>"",onScrollIntoView:null,onExport:Xa,value:""}}function pd(e){return"inline-math"===e.defaultMode?"math":e.defaultMode}function md(e,t){e&&t&&(m(e)?e.forEach((e=>md(e,t))):"object"==typeof e&&(e.style.color||e.style.backgroundColor||e.style.fontFamily||e.style.fontShape||e.style.fontSeries||e.style.fontSize||e.style.variant||e.style.variantStyle||(e.applyStyle(t),md(e.body,t),md(e.above,t),md(e.below,t),md(e.subscript,t),md(e.superscript,t))))}function fd(e,t,n,i){function o(e,t){for(const n of r)if(n.style[e]!==t)return!1;return!0}if((t=e.normalizeRange(t))[0]===t[1])return!1;const r=e.getAtoms(t,{includeChildren:!0});"toggle"===i.operation&&(n.color&&o("color",n.color)&&(n.color="none",delete n.verbatimColor),n.backgroundColor&&o("backgroundColor",n.backgroundColor)&&(n.backgroundColor="none",delete n.verbatimBackgroundColor),n.fontFamily&&o("fontFamily",n.fontFamily)&&(n.fontFamily="none"),n.fontSeries&&o("fontSeries",n.fontSeries)&&(n.fontSeries="auto"),n.fontShape&&o("fontShape",n.fontShape)&&(n.fontShape="auto"),n.fontSize&&o("fontSize",n.fontSize)&&(n.fontSize=5),n.variant&&o("variant",n.variant)&&(n.variant="normal"),n.variantStyle&&o("variantStyle",n.variantStyle)&&(n.variantStyle=""));for(const e of r)e.applyStyle(n);return!0}function gd(e,t=1){return function(e){for(const t of e)for(const e of t)if(e.length>0)return!1;return!0}(e)?Array(t).fill([[new za({type:"first"}),new Ds]]):e.map((e=>0===e.length?[[new za({type:"first"})]]:e.map((e=>0===e.length?[new za({type:"first"})]:("first"!==e[0].type&&e.unshift(new za({type:"first"})),e)))))}function bd(e,t=[[[]]],n=[],i=[]){switch(t=gd(t,["split","align","align*","aligned","eqnarray"].includes(e)?2:1),e){case"math":case"displaymath":return new Os(e,t,n,{mathstyleName:"textstyle"});case"center":return new Os(e,t,n,{columns:[{align:"c"}]});case"multline":case"multline*":return new Os(e,t,n,{columns:[{align:"m"}],leftDelim:".",rightDelim:"."});case"split":return new Os(e,t,n,{columns:[{align:"r"},{align:"l"}],minColumns:2});case"gather":case"gathered":return new Os(e,t,n,{columns:[{gap:.25},{align:"c"},{gap:0}]});case"pmatrix":case"pmatrix*":return new Os(e,t,n,{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:yd(i[0])});case"bmatrix":case"bmatrix*":return new Os(e,t,n,{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:yd(i[0])});case"Bmatrix":case"Bmatrix*":return new Os(e,t,n,{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:yd(i[0])});case"vmatrix":case"vmatrix*":return new Os(e,t,n,{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:yd(i[0])});case"Vmatrix":case"Vmatrix*":return new Os(e,t,n,{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:yd(i[0])});case"matrix":case"matrix*":return new Os(e,t,n,{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:yd(null==i?void 0:i[0])});case"smallmatrix":case"smallmatrix*":return new Os(e,t,n,{mathstyleName:"scriptstyle",columns:yd(null==i?void 0:i[0]),colSeparationType:"small",arraystretch:.5});case"cases":case"dcases":return new Os(e,t,n,{mathstyleName:"dcases"===e?"displaystyle":"textstyle",arraystretch:1.2,leftDelim:"\\lbrace",rightDelim:".",columns:[{align:"l"},{gap:1},{align:"l"}]});case"rcases":return new Os(e,t,n,{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:[{align:"l"},{gap:1},{align:"l"}]});case"lines":return new Os(e,t,n,{leftDelim:".",rightDelim:".",columns:[{align:"l"}]});case"align":case"align*":case"aligned":case"eqnarray":{let i=0;for(const e of t)i=Math.max(i,e.length);const o=[{gap:0},{align:"r"},{gap:.25},{align:"l"}];let r=2;for(;r<i;)o.push({gap:1},{align:"r"},{gap:.25},{align:"l"}),r+=2;return o.push({gap:0}),new Os(e,t,n,{arraycolsep:0,columns:o,minColumns:2})}}return new Os(e,t,n,{mathstyleName:"textstyle"})}function yd(e){return null!=e?e:[{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"}]}function vd(e,t,n){const i=e.getCell(t,n);return!(!i||2!==i.length)&&"placeholder"===i[1].type}function xd(e,t,n,i){const o=function(e,t,n,i){const o=t.getCell(n,i);return o?[e.offsetOf(o[0]),e.offsetOf(o[o.length-1])]:-1}(e,t,n,i);"number"!=typeof o&&e.setSelection(o)}function wd(e,t,n,i,o){const r=t.getCell(n,i);r&&e.setPositionHandlingPlaceholder(e.offsetOf(r["start"===o?0:r.length-1]))}function _d(e,t){const[n,[i,o]]=function(e,t){let n=e.at(e.position);for(;n&&!(n.parent instanceof Os);)n=n.parent;n&&"array"===n.type&&n.environmentName;if(!(n&&n.parent instanceof Os)){const i=e.at(e.position);if(n=i,!n.parent.parent){let n,o=e.extractAtoms([e.position,e.lastOffset]),r=e.extractAtoms([0,e.position]);return 0===r.length&&(r=Cd()),0===o.length&&(o=Cd()),t.endsWith("column")?(n=bd("split",[[r,o]]),e.root=n,vd(n,0,0)?xd(e,n,0,0):vd(n,0,1)?xd(e,n,0,1):e.position=e.offsetOf(i)):(n=bd("lines",[[r],[o]]),e.root=n,vd(n,0,0)?xd(e,n,0,0):vd(n,1,0)?xd(e,n,1,0):e.position=e.offsetOf(i)),[void 0,[0,0]]}if(n.parent instanceof Ws){const i=n.parent;let o=e.extractAtoms([e.position,e.offsetOf(i.lastChild)]),r=e.extractAtoms([e.offsetOf(i.firstChild),e.position]);0===r.length&&(r=Cd()),0===o.length&&(o=Cd());let a="pmatrix";const s=i.leftDelim,l=i.rightDelim;"("!==s||")"!==l&&"?"!==l?"["!==s&&"\\lbrack"!==s||"]"!==l&&"\\rbrack"!==l&&"?"!==l?"\\vert"===s&&"\\vert"===l?a="vmatrix":"\\Vert"===s&&"\\Vert"===l?a="Vmatrix":"{"!==s&&"\\lbrace"!==s||"."!==l&&"?"!==l||(a="cases"):a="bmatrix":a="pmatrix";const c=bd(a,t.endsWith("column")?[[r,o]]:[[r],[o]]);return i.parent.addChildBefore(c,i),i.parent.removeChild(i),vd(c,0,0)?xd(e,c,0,0):t.endsWith("column")?vd(c,0,1)?xd(e,c,0,1):e.position=e.offsetOf(n):vd(c,1,0)?xd(e,c,1,0):e.position=e.offsetOf(n),[void 0,[0,0]]}}return n&&n.parent instanceof Os?[n.parent,n.parentBranch]:[void 0,[0,0]]}(e,t);if(n)switch(t){case"after row":n.addRowAfter(i),wd(e,n,i+1,0,"end");break;case"after column":if(n.maxColumns<=n.colCount)return void e.announce("plonk");n.addColumnAfter(o),wd(e,n,i,o+1,"end");break;case"before row":n.addRowBefore(i),wd(e,n,i,0,"start");break;case"before column":if(n.maxColumns<=n.colCount)return void e.announce("plonk");n.addColumnBefore(o),wd(e,n,i,o,"start")}}function kd(e){return!!e.contentWillChange({inputType:"insertText"})&&(_d(e,"after row"),e.contentDidChange({inputType:"insertText"}),!0)}function Md(e){return!!e.contentWillChange({inputType:"insertText"})&&(_d(e,"after column"),e.contentDidChange({inputType:"insertText"}),!0)}function Sd(e,t){if(!e.contentWillChange({}))return!1;e.mathfield.snapshot();let n=".",i=".";switch(t){case"pmatrix":case"pmatrix*":n="(",i=")";break;case"bmatrix":case"bmatrix*":n="[",i="]";break;case"Bmatrix":case"Bmatrix*":n="\\lbrace",i="\\rbrace";break;case"vmatrix":case"vmatrix*":n="\\vert",i="\\vert";break;case"Vmatrix":case"Vmatrix*":n="\\Vert",i="\\Vert";break;case"matrix":case"matrix*":n=".",i=".";break;case"cases":case"dcases":n="\\lbrace";break;case"rcases":i="\\rbrace"}const o=e.at(e.position),r="array"===o.type?o:e.parentEnvironment;return r.environmentName=t,r.leftDelim=n,r.rightDelim=i,e.contentDidChange({}),!0}function Ld(e,t){let n=e.at(e.position);for(;n&&!(Array.isArray(n.parentBranch)&&n.parent instanceof Os);)n=n.parent;if(Array.isArray(null==n?void 0:n.parentBranch)&&(null==n?void 0:n.parent)instanceof Os){const i=n.parent,o=n.parentBranch;let r;switch(t){case"row":if(i.rowCount>1){i.removeRow(o[0]);const t=i.getCell(Math.max(0,o[0]-1),o[1]);r=e.offsetOf(t[t.length-1])}break;case"column":if(i.colCount>i.minColumns){i.removeColumn(o[1]);const t=i.getCell(o[0],Math.max(0,o[1]-1));r=e.offsetOf(t[t.length-1])}}r&&e.setPositionHandlingPlaceholder(r)}}function Cd(){return[new Ds]}ee(["math","displaymath"],bd),ee("center",bd),ne("displaylines","",{parse:e=>{const t=[];let n=[];for(e.beginContext({tabular:!0});;){if(e.end())break;if(e.match("<}>"))break;e.matchColumnSeparator()||e.matchRowSeparator()?(t.push([n]),n=[]):n.push(...e.scan((e=>["<}>","&","\\cr","\\\\","\\tabularnewline"].includes(e))))}return e.endContext(),t.push([n]),t},createAtom:e=>new Os("lines",e.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}]})}),te("array","{columns:colspec}",((e,t,n,i)=>new Os(e,gd(t),n,{columns:i[0],mathstyleName:"textstyle"}))),te(["equation","equation*","subequations"],"",((e,t,n)=>new Os(e,gd(t),n,{columns:[{align:"c"}]}))),te(["multline","multline*"],"",bd),te(["align","align*","aligned","eqnarray"],"",bd),te("split","",bd),te(["gather","gathered"],"",bd),te(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",bd),te(["smallmatrix","smallmatrix*"],"[columns:colspec]",bd),te(["cases","dcases","rcases"],"",bd),Dc({addRowAfter:kd,addColumnAfter:Md,addRowBefore:function(e){return!!e.contentWillChange({inputType:"insertText"})&&(_d(e,"before row"),e.contentDidChange({inputType:"insertText"}),!0)},addColumnBefore:function(e){return!!e.contentWillChange({inputType:"insertText"})&&(_d(e,"before column"),e.contentDidChange({inputType:"insertText"}),!0)},removeRow:function(e){return!!e.contentWillChange({inputType:"deleteContent"})&&(Ld(e,"row"),e.contentDidChange({inputType:"deleteContent"}),!0)},removeColumn:function(e){return!!e.contentWillChange({inputType:"deleteContent"})&&(Ld(e,"column"),e.contentDidChange({inputType:"deleteContent"}),!0)},setEnvironment:Sd},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});var Ed=class e{constructor(e){this.recording=!1,this.model=e,this.reset()}reset(){this.stack=[],this.index=-1,this.lastOp=""}startRecording(){this.recording=!0}stopRecording(){this.recording=!1}canUndo(){return this.index-1>=0}canRedo(){return this.stack.length-1>this.index}stopCoalescing(e){e&&this.index>=0&&(this.stack[this.index].selection=e),this.lastOp=""}undo(){return!!this.canUndo()&&(this.model.setState(this.stack[this.index-1],{silenceNotifications:!1,type:"undo"}),this.index-=1,this.lastOp="",!0)}redo(){return!!this.canRedo()&&(this.index+=1,this.model.setState(this.stack[this.index],{silenceNotifications:!1,type:"redo"}),this.lastOp="",!0)}pop(){this.canUndo()&&(this.stack.splice(this.index,this.stack.length-this.index),this.index-=1)}snapshot(t){return!!this.recording&&(t&&t===this.lastOp&&this.pop(),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push(this.model.getState()),this.index+=1,this.stack.length>e.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=null!=t?t:"",!0)}};Ed.maximumDepth=1e3;var Kd=Ed;function Ad(e,t,n){if("text"!==e.at(t).mode)return t;const i="backward"===n?-1:1;let o;if(N.test(e.at(t).value)){let n,r=t;do{n="text"===e.at(r).mode&&N.test(e.at(r).value),r+=i}while(e.at(r)&&n);o=e.at(r)?r-2*i:r-i}else if(/\s/.test(e.at(t).value)){let n=t;for(;e.at(n)&&"text"===e.at(n).mode&&/\s/.test(e.at(n).value);)n+=i;if(e.at(n)){let t=!0;do{t="text"===e.at(n).mode&&!/\s/.test(e.at(n).value),n+=i}while(e.at(n)&&t);o=e.at(n)?n-2*i:n-i}else o=n-i}else{let n=t;for(;e.at(n)&&"text"===e.at(n).mode&&!/\s/.test(e.at(n).value);)n+=i;o=e.at(n)?n:n-i;let r=!0;for(;e.at(n)&&r;)r="text"===e.at(n).mode&&/\s/.test(e.at(n).value),r&&(o=n),n+=i;o=e.at(n)?n-2*i:n-i}return o-(i>0?0:1)}function Dd(e,t,n){var i,o,r,a,s,l,c;const d=e.position;null!=(i=null==n?void 0:n.extend)&&i||e.collapseSelection(t);let h=e.at(e.position);if("forward"===t&&("subsup"===h.type?(h=h.rightSibling,h||(h=e.at(e.position+1))):h=e.at(e.position+1)),!h)return e.announce("plonk"),!1;let u=e.offsetOf(h);if(h instanceof $a)u=Ad(e,u,t);else if(h instanceof dl)if(h.isSuggestion)for(console.assert("forward"===t);h&&h instanceof dl;)h.isSuggestion=!1,u=e.offsetOf(h),h=h.rightSibling;else if("forward"===t){if(h=h.rightSibling,!(h&&h instanceof dl))return e.announce("plonk"),!1;for(;h&&h instanceof dl&&/[a-zA-Z\*]/.test(h.value);)u=e.offsetOf(h),h=h.rightSibling}else{if(h=h.leftSibling,!(h&&h instanceof dl))return e.announce("plonk"),!1;for(;h&&h instanceof dl&&/[a-zA-Z\*]/.test(h.value);)u=e.offsetOf(h),h=h.leftSibling}else if("forward"===t&&"mopen"===h.type){let t=0;do{"mopen"===h.type?t+=1:"mclose"===h.type&&(t-=1),h=h.rightSibling}while(!h.isLastSibling&&0!==t);u=e.offsetOf(h.leftSibling)}else if("backward"===t&&"mclose"===h.type){let t=0;do{"mopen"===h.type?t+=1:"mclose"===h.type&&(t-=1),h=h.leftSibling}while(!h.isFirstSibling&&0!==t);u=e.offsetOf(h)}else if("backward"===t)if("first"===h.type)for(;u>0&&"first"===h.type;)u-=1,h=e.at(u);else{const t=h.type;"subsup"===h.type&&(u=e.offsetOf(e.at(u).leftSibling)),u-=1;let n=null==(o=e.at(u))?void 0:o.type;for(;u>=0&&n===t;)"subsup"===(null==(r=e.at(u))?void 0:r.type)?u=e.offsetOf(e.at(u).leftSibling):u-=1,n=e.at(u).type}else{const{type:t}=h;let n=null==(a=e.at(u))?void 0:a.type;const{lastOffset:i}=e;for(;u<=i&&(n===t||"subsup"===n);){for(;"subsup"===(null==(s=e.at(u).rightSibling)?void 0:s.type);)u=e.offsetOf(e.at(u).rightSibling);u+=1,n=null==(l=e.at(u))?void 0:l.type}u-=1}if(null!=(c=null==n?void 0:n.extend)&&c){if(!e.setSelection(e.anchor,u))return e.announce("plonk"),!1}else{if(u===e.position)return e.announce("plonk"),!1;e.position=u}return e.announce("move",d),e.mathfield.stopCoalescingUndo(),!0}function zd(e,t,n){var i,o;if(n=null!=n?n:{extend:!1},e.mathfield.adoptStyle="backward"===t?"right":"left","forward"!==t){const[t,n]=sc(e);void 0!==t&&void 0!==n&&e.deleteAtoms([t,n])}if("upward"===t)return function(e,t){var n,i;const o=null!=(n=null==t?void 0:t.extend)&&n;o||e.collapseSelection("backward");const r=()=>{var t,n;let i=!0;return e.silenceNotifications||(i=null==(n=null==(t=e.mathfield.host)?void 0:t.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))||n),e.announce(i?"plonk":"line"),i},a=e.at(e.position);let s=a;for(;s&&"below"!==s.parentBranch&&!(Array.isArray(s.parentBranch)&&s.parent instanceof Os);)s=s.parent;if(Array.isArray(null==s?void 0:s.parentBranch)&&s.parent instanceof Os){const t=s.parent;if(s.parentBranch[0]<1)return r();const n=s.parentBranch[0]-1,i=t.array[n][s.parentBranch[1]];if(!i.some((e=>"prompt"===e.type&&!e.captureSelection))&&e.mathfield.hasEditablePrompts)return r();$d(e,a,i,o,"up")}else{if(!s)return r();{const t=null!=(i=s.parent.branch("above"))?i:s.parent.createBranch("above");if(!t.some((e=>"prompt"===e.type&&e.placeholderId))&&e.mathfield.hasEditablePrompts)return r();$d(e,a,t,o,"up")}}return e.mathfield.stopCoalescingUndo(),!0}(e,n);if("downward"===t)return function(e,t){var n,i;const o=null!=(n=null==t?void 0:t.extend)&&n;o||e.collapseSelection("forward");const r=()=>{var t,n;let i=!0;return e.silenceNotifications||(i=null==(n=null==(t=e.mathfield.host)?void 0:t.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))||n),e.announce(i?"plonk":"line"),i},a=e.at(e.position);let s=a;for(;s&&"above"!==s.parentBranch&&!(Array.isArray(s.parentBranch)&&s.parent instanceof Os);)s=s.parent;if(Array.isArray(null==s?void 0:s.parentBranch)&&s.parent instanceof Os){const t=s.parent;if(s.parentBranch[0]+1>t.array.length-1)return r();const n=s.parentBranch[0]+1,i=t.array[n][s.parentBranch[1]];if(!i.some((e=>"prompt"===e.type&&!e.captureSelection))&&e.mathfield.hasEditablePrompts)return r();$d(e,a,i,o,"down")}else{if(!s)return r();{const t=null!=(i=s.parent.branch("below"))?i:s.parent.createBranch("below");if(!t.some((e=>"prompt"===e.type))&&e.mathfield.hasEditablePrompts)return r();$d(e,a,t,o,"down")}}return!0}(e,n);if(n.extend){let n=Td(e,e.position,t);n<0&&(n=0),n>e.lastOffset&&(n=e.lastOffset);const i=e.setSelection(e.anchor,n);return e.mathfield.stopCoalescingUndo(),i}if(e.selectionIsPlaceholder){e.collapseSelection(t);const n=zd(e,t);return e.mathfield.stopCoalescingUndo(),n}let r=e.position;const a=r;if(e.collapseSelection(t)?(r=e.position,Bd(e,r)||(r=Td(e,r,t))):r=Td(e,r,t),r<0||r>e.lastOffset){let n=!0;return e.silenceNotifications||(n=null==(o=null==(i=e.mathfield.host)?void 0:i.dispatchEvent(new CustomEvent("move-out",{detail:{direction:t},cancelable:!0,bubbles:!0,composed:!0})))||o),n&&e.announce("plonk"),n}return e.setPositionHandlingPlaceholder(r),e.mathfield.stopCoalescingUndo(),e.announce("move",a),!0}function Td(e,t,n){return(t+="forward"===n?1:-1)<0||t>e.lastOffset||Bd(e,t)?t:Td(e,t,n)}function Bd(e,t){var n;const i=e.at(t);let o=i.parent;for(;o&&!o.inCaptureSelection;)o=o.parent;if(null==o?void 0:o.inCaptureSelection)return!1;if(null==(n=i.parent)?void 0:n.skipBoundary){if(!i.isFirstSibling&&i.isLastSibling)return!1;if("first"===i.type)return!1}return!(e.mathfield.hasEditablePrompts&&!i.parentPrompt)}function $d(e,t,n,i,o){const r=e.mathfield.hasEditablePrompts,a=r?n.filter((e=>"prompt"===e.type&&!e.captureSelection)):n,s=ls(e.mathfield.getHTMLElement(t)).right,l=e.offsetOf(function(e,t,n){let i=1/0,o=0;for(;o<t.length;o++){const r=ls(e.getHTMLElement(t[o])).right,a=Math.abs(n-r);if(!(a<=i))break;i=a}return t[o-1]}(e.mathfield,a,s))-(r?1:0);if(i){const[t,n]=e.selection.ranges[0];let i;i=l<("up"===o?t:n)?{ranges:[[l,n]],direction:"backward"}:{ranges:[[t,l]],direction:"forward"},e.setSelection(i)}else e.setPositionHandlingPlaceholder(l);e.announce(`move ${o}`)}function Pd(e){const t=e.position,n=e.at(t).parent;return(null==n?void 0:n.parent)?(e.position=e.offsetOf(n),e.mathfield.stopCoalescingUndo(),e.announce("move",t),!0):(e.announce("plonk"),!1)}function Od(e){var t;if(e.collapseSelection(),function(e){let t=0,n=e.at(e.position),i=!1;for(;n;)n.hasEmptyBranch("superscript")&&n.hasEmptyBranch("subscript")||(t+=1),n.hasEmptyBranch("superscript")?n.hasEmptyBranch("subscript")||(i=!1):i=!0,n=n.parent;return i?t:0}(e)>=e.mathfield.options.scriptDepth[1])return e.announce("plonk"),!1;let n=e.at(e.position);return void 0===n.subsupPlacement&&("subsup"!==(null==(t=n.rightSibling)?void 0:t.type)&&n.parent.addChildAfter(new Gs({style:n.computedStyle}),n),n=n.rightSibling),n.createBranch("superscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(n.superscript[0]))),!0}function qd(e){var t;if(e.collapseSelection(),function(e){let t=0,n=e.at(e.position),i=!1;for(;n;)n.hasEmptyBranch("superscript")&&n.hasEmptyBranch("subscript")||(t+=1),n.hasEmptyBranch("superscript")?n.hasEmptyBranch("subscript")||(i=!0):i=!1,n=n.parent;return i?t:0}(e)>=e.mathfield.options.scriptDepth[0])return e.announce("plonk"),!1;let n=e.at(e.position);return void 0===n.subsupPlacement&&("subsup"!==(null==(t=e.at(e.position+1))?void 0:t.type)&&n.parent.addChildAfter(new Gs({style:e.at(e.position).computedStyle}),n),n=e.at(e.position+1)),n.createBranch("subscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(n.subscript[0]))),!0}function Nd(){function e(e){return!((n=e).disabled||"hidden"===n.type&&"INPUT"===n.tagName.toUpperCase()||function(e){if(!f()||e===document.activeElement||e.contains(document.activeElement))return!1;if("hidden"===getComputedStyle(e).visibility)return!0;const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n)||function(e){return"INPUT"===e.tagName.toUpperCase()&&"radio"===e.type&&!function(e){var t;if(!e.name)return!0;const n=null!=(t=e.form)?t:e.ownerDocument,i=n.querySelectorAll('input[type="radio"][name="'+e.name+'"]'),o=function(e,t){for(const n of e)if(n.checked&&n.form===t)return n;return null}(i,e.form);return!o||o===e}(e)}(e)||t(e)<0);var n}function t(e){var t;const n=Number.parseInt(null!=(t=e.getAttribute("tabindex"))?t:"NaN",10);return Number.isNaN(n)?"true"===e.contentEditable?0:"AUDIO"!==e.nodeName&&"VIDEO"!==e.nodeName||null!==e.getAttribute("tabindex")?e.tabIndex:0:n}return f()?function(n){const i=[],o=[];return[...n.querySelectorAll('input, select, textarea, a[href], button,\n [tabindex], audio[controls], video[controls],\n [contenteditable]:not([contenteditable="false"]), details>summary')].filter(e).forEach(((e,n)=>{const r=t(e);0===r?i.push(e):o.push({documentOrder:n,tabIndex:r,node:e})})),o.sort(((e,t)=>e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex)).map((e=>e.node)).concat(i)}(document.body):[]}function Id(e,t,n="forward"){const i=e.position;if(Array.isArray(t)){const o=e.offsetOf(t[0]),r=e.offsetOf(t[t.length-1]);return"forward"===n?e.setSelection(o,r):e.setSelection(r,o),e.announce("move",i),e.mathfield.stopCoalescingUndo(),!0}return Id(e,"forward"===n?[t.leftSibling,t]:[t,t.leftSibling])}function Fd(e,t){const n=e.position;if("number"==typeof t&&(t=e.at(t)),"prompt"===t.type)e.setSelection(e.offsetOf(t.firstChild),e.offsetOf(t.lastChild));else{const n=e.offsetOf(t);"placeholder"===t.type?e.setSelection(n-1,n):e.position=n}return e.announce("move",n),e.mathfield.stopCoalescingUndo(),!0}function Rd(e,t,n=!0){var i,o;const r="forward"===t?1:-1;let a;"placeholder"===e.at(e.anchor).type&&zd(e,t);const s=e.at(e.anchor).parentPrompt;a=s?"forward"===t?e.offsetOf(s)+1:e.offsetOf(s.leftSibling):Math.max(e.position+r,0);const l=Vd(e,a,t);if(!l||"forward"===t&&e.offsetOf(l)<a||"backward"===t&&e.offsetOf(l)>a){if(!n||!(null==(o=null==(i=e.mathfield.host)?void 0:i.dispatchEvent(new CustomEvent("move-out",{detail:{direction:t},cancelable:!0,bubbles:!0,composed:!0})))||o))return e.announce("plonk"),!1;const a=Nd();if(!document.activeElement||a.length<=1)return e.announce("plonk"),!1;let s=a.indexOf(document.activeElement)+r;return s<0&&(s=a.length-1),s>=a.length&&(s=0),a[s].focus(),e.mathfield.stopCoalescingUndo(),!0}return Fd(e,l),!0}function Vd(e,t=0,n="forward"){return e.findAtom((t=>"placeholder"===t.type||"prompt"===t.type||!e.mathfield.readOnly&&t.treeDepth>2&&t.isFirstSibling&&t.isLastSibling),t,n)}function Hd(e,t,n,i){if("forward"===i){let e=t.rightSibling;for(;e&&!n(e);)e=e.rightSibling;return e}let o=t.leftSibling;for(;o&&!n(o);)o=o.leftSibling;return o}function Wd(e,t,n){"function"==typeof t&&(n=t,t=1/0),void 0===t&&(t=1/0);let i=e.position,o=!1,r="";for(;!o;){const a=e.at(i);o=0===t||void 0===a||"first"===a.type||"math"!==a.mode||!(a.type&&/mord|mpunct|operator/.test(a.type)||"mop"===a.type&&/[a-zA-Z ]+/.test(a.value))||!a.hasEmptyBranch("superscript")||!a.hasEmptyBranch("subscript")||"function"==typeof n&&!n(a),o||(a.mode="text",a.command=a.value,a.verbatimLatex=void 0,r+=a.value),i-=1,t-=1}e.contentDidChange({data:r,inputType:"insertText"})}function jd(e,t,n){"function"==typeof t&&(n=t,t=1/0),void 0===t&&(t=1/0);let i=e.position,o=!1;const r=[];for(;!o;){const a=e.at(i);o=0===t||!a||"first"===a.type||a.isFirstSibling||"text"!==a.mode||" "===a.value||"function"==typeof n&&!n(a),o||(r.push(za.serialize([a],{defaultMode:"math"})),a.mode="math"),i-=1,t-=1}Ud(e),e.contentDidChange({data:Yr(r),inputType:"insertText"})}function Ud(e){var t;let n=e.position-1;for(;n>=0&&"math"===(null==(t=e.at(n))?void 0:t.mode);)n-=1;if(!(n<0)&&"text"===e.at(n).mode&&" "===e.at(n).value&&"math"===e.at(n-1).mode){e.at(n-1).parent.removeChild(e.at(n-1));const t=e.silenceNotifications;e.silenceNotifications=!0,e.position-=1,e.silenceNotifications=t,e.contentDidChange({inputType:"deleteContent"})}}function Jd(){const e=document.getElementById("mathlive-keystroke-caption-panel");return e||(ps("keystroke-caption"),ps("core"),uc("mathlive-keystroke-caption-panel"))}function Xd(e,t){var n,i,o;const{model:r}=e,a=tc(t);if(t.isTrusted){!function(e){var t,n;if(!e)return;if("Unidentified"===e.key)return;if("Dead"===e.key)return;const i=e.shiftKey&&e.altKey?3:e.altKey?2:e.shiftKey?1:0;for(const o of Vl)(null==(t=o.mapping[e.code])?void 0:t[i])===e.key?o.score+=1:(null==(n=o.mapping[e.code])?void 0:n[i])&&(o.score=0);Vl.sort(((e,t)=>t.score-e.score))}(t);const n=jl();e.keyboardLayout!==n.id&&(e.keyboardLayout=n.id,e._keybindings=void 0)}if(clearTimeout(e.inlineShortcutBufferFlushTimer),e.inlineShortcutBufferFlushTimer=0,function(e,t){if(!e.isSelectionEditable||!e.keystrokeCaptionVisible)return;const n=Jd(),i=e.element.getBoundingClientRect();n.style.left=`${i.left}px`,n.style.top=i.top-64+"px",n.innerHTML=window.MathfieldElement.createHTML("<span>"+(Ul(t)||t)+"</span>"+n.innerHTML),n.style.visibility="visible",setTimeout((()=>{n.childNodes.length>0&&n.childNodes[n.childNodes.length-1].remove(),0===n.childNodes.length&&(n.style.visibility="hidden")}),3e3)}(e,a),t.isTrusted&&t.defaultPrevented)return e.flushInlineShortcutBuffer(),!1;let s,l,c="";const d=e.inlineShortcutBuffer;if(e.isSelectionEditable){if("math"===r.mode)if("[Backspace]"===a)d.pop();else if(Zl(t)){const o=ec(t),a=[...null!=(i=null==(n=d[d.length-1])?void 0:n.keystrokes)?i:[],o];d.push({state:r.getState(),keystrokes:a,leftSiblings:Zd(e)});let c=0,h="";for(;!s&&c<a.length;)l=d.length-(a.length-c),h=a.slice(c).join(""),s=Fa(d[l].leftSiblings,h,e.options.inlineShortcuts),!s&&/^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(h)&&(s=e.options.onInlineShortcut(e,h)),c+=1;e.flushInlineShortcutBuffer({defer:!0})}else e.flushInlineShortcutBuffer();e.options.smartMode&&(s?e.switchMode("math"):function(e,t,n){const{model:i}=e;if("latex"===i.mode)return!1;if(!i.at(i.position).isLastSibling)return!1;if(!n||!Zl(n))return!1;const o=ec(n);if(!i.selectionIsCollapsed)return!("text"!==e.model.mode||!/[/_^]/.test(o));const r=function(e){let t="",n=e.position,i=!1;for(;!i;){const o=e.at(n);i=!(o&&("text"===o.mode||"math"===o.mode&&o.type&&/mord|mpunct/.test(o.type))),i||(t=o.value+t),n-=1}return t}(i)+o;if("text"===e.model.mode){if("Esc"===t||/[/\\]/.test(o))return!0;if(/[\^_]/.test(o))return/(^|\s)[a-zA-Z][^_]$/.test(r)&&jd(i,1),!0;const e={")":"(","}":"{","]":"["}[o],{parent:n}=i.at(i.position);if(e&&n instanceof Ws&&n.leftDelim===e)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(r))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(o))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z] $/.test(r))return jd(i,1),!1;if(/\D\.[^\d\s]$/.test(r)){jd(i,1);const e=i.at(i.position);return e.value="⋅",e.style.variant="normal",e.command="\\cdot",e.verbatimLatex=void 0,i.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(r))return jd(i,1),!0;if(/\.\d$/.test(r))return jd(i,1),!0;if(/\([\d+\-.]$/.test(r))return jd(i,1),!0;if(/\([a-z][,;]$/.test(r))return jd(i,2),!0;if(/[\d+\-=><*|]$/.test(o))return Ud(i),!0}else{if("[Space]"===t)return Wd(i,void 0,(e=>/[a-z][:,;.]$/.test(e.value))),!0;if(/[a-zA-Z]{3,}$/.test(r)&&!/(dxd|abc|xyz|uvw)$/.test(r))return Wd(i,void 0,(e=>/[a-zA-Z]/.test(e.value))),!0;if(/(^|\W)(if)$/i.test(r))return Wd(i,1),!0;if(/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(r)&&!/(αβγ)$/.test(r))return Wd(i,void 0,(e=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(e.value))),!0;if("?"===o)return!0;if("."===o&&!/[\d-+]\.$/.test(r))return!0}return!1}(e,a,t)&&(e.switchMode({math:"text",text:"math"}[r.mode]),c=""))}if(!s){if(c||(c=function(e,t,n){if(0===e.length)return"";const i=Il(Nl(tc(n))),o=Il({key:n.key,shift:n.shiftKey,alt:n.altKey,ctrl:n.ctrlKey,meta:n.metaKey||n.ctrlKey&&/macos|ios/.test(b()),cmd:!1,win:!1});for(let n=e.length-1;n>=0;n--)if(!(e[n].key!==i&&e[n].key!==o||e[n].ifMode&&e[n].ifMode!==t))return e[n].command;return""}(e.keybindings,r.mode,t)),!c&&("[Enter]"===a||"[Return]"===a)){let n=!1;return r.contentWillChange({inputType:"insertLineBreak"})&&(e.host&&(n=!e.host.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),n||t.preventDefault&&(t.preventDefault(),t.stopPropagation()),r.contentDidChange({inputType:"insertLineBreak"})),n}if((!c||"[Space]"===a)&&"math"===r.mode){if("[Space]"===a){if(e.adoptStyle="none",e.flushInlineShortcutBuffer(),e.options.mathModeSpace)return Za.insert(r,e.options.mathModeSpace,{format:"latex",mode:"math"}),e.snapshot("insert-space"),c="",e.dirty=!0,e.scrollIntoView(),t.preventDefault&&(t.preventDefault(),t.stopPropagation()),!1;const n=r.at(r.position+1),i=r.at(r.position-1);if("text"===(null==n?void 0:n.mode)||"text"===(null==i?void 0:i.mode))return Za.insert(r," ",{mode:"text"}),e.snapshot("insert-space"),e.dirty=!0,e.scrollIntoView(),!1}(null==(o=r.at(r.position))?void 0:o.isDigit())&&","===window.MathfieldElement.decimalSeparator&&","===ec(t)&&(c="insertDecimalSeparator")}}if(!s&&!c){if(r.mathfield.smartFence){if(Qd(r,ec(t),e.effectiveStyle))return e.dirty=!0,e.scrollIntoView(),t.preventDefault&&t.preventDefault(),!1}else{const{parent:n}=r.at(r.position);if(n instanceof Ws&&"?"===n.rightDelim&&r.at(r.position).isLastSibling&&/^[)}\]|]$/.test(a))return e.snapshot(),n.isDirty=!0,n.rightDelim=a,r.position+=1,r.selectionDidChange(),r.contentDidChange({data:ec(t),inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),t.preventDefault&&t.preventDefault(),!1;if(!r.selectionIsCollapsed){const n=ec(t);if("("===n||"{"===n||"["===n){const i={"(":"(","{":"\\lbrace","[":"\\lbrack"}[n],o={"(":")","{":"\\rbrace","[":"\\rbrack"}[n],[a,s]=Oa(r.selection);return e.snapshot(),r.position=s,Za.insert(r,o,{format:"latex"}),r.position=a,Za.insert(r,i,{format:"latex"}),r.setSelection(a+1,s+1),r.contentDidChange({data:n,inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),t.preventDefault&&t.preventDefault(),!1}}}return!0}const h=r.at(Math.max(r.position,r.anchor)),{parent:u}=h;if("moveAfterParent"===c&&"leftright"===(null==u?void 0:u.type)&&h.isLastSibling&&e.options.smartFence&&Qd(r,".",e.defaultStyle)&&(c="",Lc(e)),e.keyboardDelegate.cancelComposition(),c)e.executeCommand(c);else if(s){const t=e.effectiveStyle;r.setState(d[l].state);const n=d[d.length-1].keystrokes;for(const e of n)Za.insert(r,e,{silenceNotifications:!0,style:t});e.snapshot("insert-shortcut"),r.setState(d[l].state),r.deferNotifications({content:!0,selection:!0,data:s,type:"insertText"},(()=>(Za.insert(r,s,{format:"latex",style:t}),Ud(e.model),s.endsWith(" ")&&(e.switchMode("text"),Za.insert(r," ",{style:t,mode:"text"})),e.snapshot(),r.selectionIsCollapsed||e.flushInlineShortcutBuffer(),!0))),e.dirty=!0,r.announce("replacement")}return e.scrollIntoView(),t.preventDefault&&t.preventDefault(),!1}function Gd(e,t,n){const{model:i}=e;if(!e.isSelectionEditable)return void i.announce("plonk");null!=n||(n={}),n.focus&&e.focus(),n.feedback&&window.MathfieldElement.playSound("keypress"),"string"==typeof n.mode&&(e.switchMode(n.mode),e.snapshot());let o=Xr(t);const r=window.mathVirtualKeyboard;if((null==r?void 0:r.isShifted)&&(o="string"==typeof o?o.toUpperCase():o.map((e=>e.toUpperCase()))),n.simulateKeystroke){let t=!0;for(const n of o)Xd(e,new KeyboardEvent("keypress",{key:n}))&&(t=!1);if(t)return}const a=i.at(i.position),s=d(d({},a.computedStyle),e.defaultStyle);if(i.selectionIsCollapsed||(i.deleteAtoms(Oa(i.selection)),e.snapshot("delete")),"latex"===i.mode)i.deferNotifications({content:!0,selection:!0,data:t,type:"insertText"},(()=>{lc(e);for(const e of o)Za.insert(i,e);e.snapshot("insert-latex"),cc(e)}));else if("text"===i.mode){for(const e of o)Za.insert(i,e,{style:s});e.snapshot("insert-text")}else if("math"===i.mode)for(const t of o)Yd(e,t,s,a);e.dirty=!0,e.scrollIntoView()}function Zd(e){const t=e.model,n=[];let i=t.at(Math.min(t.position,t.anchor));for(;"first"!==i.type;)n.push(i),i=i.leftSibling;return n}function Yd(e,t,n,i){const o=e.model;let r={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[t];if(" "===t&&e.options.mathModeSpace&&(r=["insert",e.options.mathModeSpace]),r)e.executeCommand(r);else{if(/\d/.test(t)&&e.options.smartSuperscript&&"superscript"===i.parentBranch&&"mop"!==i.parent.type&&"operator"!==i.parent.type&&"extensible-symbol"!==i.parent.type&&i.hasNoSiblings)return function(e){e.selectionIsCollapsed||(e.deleteAtoms(Oa(e.selection)),e.mathfield.snapshot("delete"))}(o),Za.insert(o,t,{style:n}),e.snapshot(),Pd(o),void e.snapshot();if(/[a-zA-Z0-9]/.test(t)&&"none"!==e.adoptStyle){const t="left"===e.adoptStyle?i:i.parent?i.rightSibling:null;"mord"===(null==t?void 0:t.type)&&/[a-zA-Z0-9]/.test(t.value)&&(n=d({},n),t.style.variant&&(n.variant=t.style.variant),t.style.variantStyle&&(n.variantStyle=t.style.variantStyle))}Za.insert(o,t,{style:n}),e.snapshot(`insert-${o.at(o.position).type}`)}}function Qd(e,t,n){if(!t)return!1;if("math"!==e.mode)return!1;const i=e.at(e.position),{parent:o}=i,r={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[t];if(!r)return!1;const a=bs[r],s=gs[r];if(!e.selectionIsCollapsed){e.mathfield.snapshot();const[t,n]=Oa(e.selection),i=e.extractAtoms([t,n]),a=o.addChildrenAfter([new Ws("left...right",i,{leftDelim:r,rightDelim:s})],e.at(t));return e.setSelection(e.offsetOf(a.firstChild),e.offsetOf(a.lastChild)),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:r,inputType:"insertText"}),!0}if("|"===r){const t=o instanceof Ws?o.leftDelim+o.rightDelim:"";if("\\lbrace\\rbrace"===t||"\\{\\}"===t||"\\lbrace?"===t)return e.mathfield.snapshot(),Za.insert(e,"\\,\\middle\\vert\\,",{format:"latex",style:n}),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:r,inputType:"insertText"}),!0}if(s){if(o instanceof Ws&&o.firstChild===i&&("?"===o.leftDelim||"."===o.leftDelim))return o.leftDelim=r,o.isDirty=!0,e.mathfield.snapshot(),e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(!(o instanceof Ws)){let t=i;for(;t&&("mclose"!==t.type||t.value!==s);)t=t.rightSibling;if(t){e.mathfield.snapshot();const n=e.extractAtoms([e.offsetOf(i),e.offsetOf(t)]);return n.pop(),o.addChildrenAfter([new Ws("left...right",n,{leftDelim:r,rightDelim:s})],i),e.position=e.offsetOf(o.firstChild)+1,e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}}const t=e.offsetOf(i.lastSibling);let a;for(a=e.position;a<=t;a++){const t=e.at(a);if(t instanceof Ws&&("?"===t.leftDelim||"."===t.leftDelim)&&th(r,t.rightDelim))break}const l=e.at(a);if(a<=t&&l instanceof Ws){l.leftDelim=r,e.mathfield.snapshot();let t=e.extractAtoms([e.position,a-1]);return t=t.filter((e=>"first"!==e.type)),l.addChildren(t,l.parentBranch),e.position+=1,e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(o instanceof Ws&&("?"===o.leftDelim||"."===o.leftDelim)&&th(r,o.rightDelim)){o.isDirty=!0,o.leftDelim=r,e.mathfield.snapshot();const t=e.extractAtoms([e.offsetOf(i.firstSibling),e.position]);for(const e of t)o.parent.addChildBefore(e,o);return e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(!(o instanceof Ws&&"|"===o.leftDelim)){if(e.mathfield.snapshot(),Za.insert(e,`\\left${r}\\right?`,{format:"latex",style:n}),"first"!==i.lastSibling.type){const t=e.offsetOf(i.lastSibling),n=e.extractAtoms([e.position,t]);e.at(e.position).body=n,e.position-=1}return e.mathfield.snapshot("insert-fence"),!0}}if(a){let t=i;for(;t;){if("mopen"===t.type&&t.value===a){e.mathfield.snapshot();const n=t.leftSibling,s=e.extractAtoms([e.offsetOf(t.leftSibling),e.offsetOf(i)]);s.shift();const l=new Ws("left...right",s,{leftDelim:a,rightDelim:r});return o.addChildrenAfter([l],n),e.position=e.offsetOf(l),e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}t=t.leftSibling}if(o instanceof Ws&&i.isLastSibling&&eh(o.leftDelim,r))return e.mathfield.snapshot(),o.isDirty=!0,o.rightDelim=r,e.position+=1,e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const s=e.offsetOf(i.firstSibling);let l;for(l=e.position;l>=s;l--){const t=e.at(l);if(t instanceof Ws&&("?"===t.rightDelim||"."===t.rightDelim)&&eh(t.leftDelim,r))break}const c=e.at(l);if(l>=s&&c instanceof Ws)return e.mathfield.snapshot(),c.rightDelim=r,c.addChildren(e.extractAtoms([l,e.position]),c.parentBranch),e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(o instanceof Ws&&("?"===o.rightDelim||"."===o.rightDelim)&&eh(o.leftDelim,r))return e.mathfield.snapshot(),o.isDirty=!0,o.rightDelim=r,o.parent.addChildren(e.extractAtoms([e.position,e.offsetOf(i.lastSibling)]),o.parentBranch),e.position=e.offsetOf(o),e.contentDidChange({data:r,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const d=o.parent;return!(!(d instanceof Ws)||"?"!==d.rightDelim&&"."!==d.rightDelim||!e.at(e.position).isLastSibling)&&(e.position=e.offsetOf(d),Qd(e,r,n))}return!1}function eh(e,t){return!e||(["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(t):gs[e]===t)}function th(e,t){return!t||([")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(t)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e):bs[t]===e)}function nh(e,t){var n,i,o,r,a,s,l,c,d,h;const u={};if("string"==typeof t.color){const r=null!=(i=e.colorMap(null!=(n=t.color)?n:t.verbatimColor))?i:"none";r!==t.color&&(u.verbatimColor=null!=(o=t.verbatimColor)?o:t.color),u.color=r}if("string"==typeof t.backgroundColor){const n=null!=(a=e.backgroundColorMap(null!=(r=t.backgroundColor)?r:t.verbatimBackgroundColor))?a:"none";n!==t.backgroundColor&&(u.verbatimBackgroundColor=null!=(s=t.verbatimBackgroundColor)?s:t.backgroundColor),u.backgroundColor=n}"string"==typeof t.fontFamily&&(u.fontFamily=t.fontFamily),"string"==typeof t.series&&(u.fontSeries=t.series),"string"==typeof t.fontSeries&&(u.fontSeries=t.fontSeries.toLowerCase()),u.fontSeries&&(u.fontSeries=null!=(l={bold:"b",medium:"m",normal:"m"}[u.fontSeries])?l:u.fontSeries),"string"==typeof t.shape&&(u.fontShape=t.shape),"string"==typeof t.fontShape&&(u.fontShape=t.fontShape.toLowerCase()),u.fontShape&&(u.fontShape=null!=(c={italic:"it",up:"n",upright:"n",normal:"n"}[u.fontShape])?c:u.fontShape),t.variant&&(u.variant=t.variant.toLowerCase()),t.variantStyle&&(u.variantStyle=t.variantStyle.toLowerCase());const p=null!=(d=t.size)?d:t.fontSize;return"number"==typeof p?u.fontSize=Math.max(1,Math.min(10,p)):"string"==typeof p&&(u.fontSize=null!=(h={size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10}[p.toLowerCase()])?h:{tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10}[p]),u}function ih(e){let[t,n]=Oa(e.selection);if(t=oh(e,t,"backward"),n=oh(e,n,"forward"),t===n){const i=e.at(t);if("leftright"===i.type)return e.setSelection(e.offsetOf(i.firstChild)-1,n);if("first"===i.type&&("leftright"===i.parent.type||"surd"===i.parent.type))return e.setSelection(t-1,e.offsetOf(i.parent.lastChild)+1);e.setSelection(t-1,n)}else e.setSelection(t,n);return!0}function oh(e,t,n){var i,o,r;let a=e.at(t);if(!a)return t;const s="forward"===n?1:-1;if("text"===a.mode){for(;a&&"text"===a.mode&&N.test(a.value);)t+=s,a=e.at(t);return"backward"===n?t-1:t}if("latex"===a.mode){if(/[a-zA-Z\*]/.test(a.value))if("backward"===n)for(;a&&"latex"===a.mode&&"\\"!==a.value&&/[a-zA-Z]/.test(a.value);)t+=s,a=e.at(t);else for(;a&&"latex"===a.mode&&/[a-zA-Z\*]/.test(a.value);)t+=s,a=e.at(t);else{if("{"===a.value){if("forward"===n){for(;a&&"latex"===a.mode&&"}"!==a.value;)t+=s,a=e.at(t);return t}return t-1}if("}"===a.value){if("backward"===n){for(;a&&"latex"===a.mode&&"{"!==a.value;)t+=s,a=e.at(t);return t-1}return t}}return t-1}if("math"===a.mode){if(a.isDigit()){for(;null==(i=e.at(t+s))?void 0:i.isDigit();)t+=s;return"backward"===n?t-1:t}if(a.style.variant||a.style.variantStyle){let i=null==(o=e.at(t))?void 0:o.style;for(;i&&i.variant===a.style.variant&&i.variantStyle===a.style.variantStyle;)i=null==(r=e.at(t+s))?void 0:r.style,t+=s;return"backward"===n?t-1:t}return t}return t}Dc({moveToOpposite:e=>{const t=e.at(e.position),{parent:n}=t;if(!n)return e.announce("plonk"),!1;const i=t.parentBranch;let o;if("string"==typeof i&&(o={superscript:"subscript",subscript:"superscript",above:"below",below:"above"}[i]),!o){const n=t.subsupPlacement?qd(e):Od(e);return e.mathfield.stopCoalescingUndo(),n}n.branch(o)||n.createBranch(o);const r=e.setSelection(e.getBranchRange(e.offsetOf(n),o));return e.mathfield.stopCoalescingUndo(),r},moveBeforeParent:e=>{const{parent:t}=e.at(e.position);return t?(e.position=e.offsetOf(t),e.mathfield.stopCoalescingUndo(),!0):(e.announce("plonk"),!1)},moveAfterParent:e=>Pd(e),moveToNextChar:e=>zd(e,"forward"),moveToPreviousChar:e=>zd(e,"backward"),moveUp:e=>zd(e,"upward"),moveDown:e=>zd(e,"downward"),moveToNextWord:e=>Dd(e,"forward"),moveToPreviousWord:e=>Dd(e,"backward"),moveToGroupStart:e=>{const t=e.offsetOf(e.at(e.position).firstSibling);return t===e.position?(e.announce("plonk"),!1):(e.position=t,e.mathfield.stopCoalescingUndo(),!0)},moveToGroupEnd:e=>{const t=e.offsetOf(e.at(e.position).lastSibling);return t===e.position?(e.announce("plonk"),!1):(e.position=t,e.mathfield.stopCoalescingUndo(),!0)},moveToNextGroup:e=>{var t,n,i,o;if(e.position===e.lastOffset&&e.anchor===e.lastOffset)return Rd(e,"forward");const r=e.at(e.position);if("text"===r.mode){if(e.selectionIsCollapsed){let n=r;for(;n&&"text"===n.mode;)n=n.leftSibling;let i=r;for(;"text"===(null==(t=i.rightSibling)?void 0:t.mode);)i=i.rightSibling;if(n&&i)return Id(e,[n,i])}if("text"===r.rightSibling.mode){let t=r;for(;t&&"text"===t.mode;)t=t.rightSibling;return t?(Fd(e,null!=(n=t.leftSibling)?n:t),e.mathfield.switchMode("math"),!0):Fd(e,e.lastOffset)}}const a=e.at(e.anchor).parentPrompt,s=a?e.offsetOf(a)+1:Math.max(e.position+1,0),l=Vd(e,s,"forward");if(l)return Fd(e,l);const c=Hd(e,r,(e=>"leftright"===e.type||"text"===e.type),"forward");if(c){if("text"===c.mode){let t=c;for(;t&&"text"===t.mode;)t=t.rightSibling;return Id(e,[null!=(i=c.leftSibling)?i:c,null!=(o=t.leftSibling)?o:t])}return Id(e,c)}const d=r.parent;if(d){if("leftright"===d.type||"surd"===d.type)return Id(e,d);if("superscript"===r.parentBranch&&d.subscript)return Id(e,d.subscript);if("above"===r.parentBranch&&d.below)return Id(e,d.below);if("superscript"===r.parentBranch||"subscript"===r.parentBranch)return Fd(e,d);if("above"===r.parentBranch||"below"===r.parentBranch)return Id(e,d)}return Fd(e,e.lastOffset)},moveToPreviousGroup:e=>{var t;if(0===e.position&&0===e.anchor)return Rd(e,"backward");let n=e.at(e.position);const i=n.mode;if("text"===i){if(e.selectionIsCollapsed){let i=n;for(;i&&"text"===i.mode;)i=i.leftSibling;let o=n;for(;"text"===(null==(t=o.rightSibling)?void 0:t.mode);)o=o.rightSibling;if(i&&o)return Id(e,[i,o])}for(;n&&"text"===n.mode;)n=n.leftSibling;return Fd(e,n?n:0)}const o=e.at(e.anchor).parentPrompt,r=o?e.offsetOf(o.leftSibling):Math.max(e.position-1,0),a=Vd(e,r,"backward");if(a)return Fd(e,a);if("math"===i){const t=Hd(e,n,(e=>"leftright"===e.type||"text"===e.type),"backward");if(t){if("text"===t.mode){let n=t;for(;n&&"text"===n.mode;)n=n.leftSibling;return Id(e,[t,n])}return Id(e,t)}const i=n.parent;if(i){if("leftright"===i.type||"surd"===i.type)return Id(e,i);if("subscript"===n.parentBranch&&i.superscript)return Id(e,i.superscript);if("below"===n.parentBranch&&i.above)return Id(e,i.above);if("superscript"===n.parentBranch||"subscript"===n.parentBranch)return Fd(e,i);if("above"===n.parentBranch||"below"===n.parentBranch)return Id(e,i)}return Fd(e,0)}return!1},moveToMathfieldStart:e=>e.selectionIsCollapsed&&0===e.position?(e.announce("plonk"),!1):(e.position=0,e.mathfield.stopCoalescingUndo(),!0),moveToMathfieldEnd:e=>e.selectionIsCollapsed&&e.position===e.lastOffset?(e.announce("plonk"),!1):(e.position=e.lastOffset,e.mathfield.stopCoalescingUndo(),!0),moveToSuperscript:Od,moveToSubscript:qd},{target:"model",changeSelection:!0}),Dc({moveToNextPlaceholder:e=>Rd(e,"forward"),moveToPreviousPlaceholder:e=>Rd(e,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"}),Dc({undo:e=>(e.undo(),!0),redo:e=>(e.redo(),!0),scrollIntoView:e=>(e.scrollIntoView(),!0),scrollToStart:e=>(e.field.scroll(0,0),!0),scrollToEnd:e=>{const t=e.field.getBoundingClientRect();return e.field.scroll(t.left-window.scrollX,0),!0},toggleKeystrokeCaption:function(e){if(e.keystrokeCaptionVisible=!e.keystrokeCaptionVisible,e.keystrokeCaptionVisible){Jd().innerHTML=""}else{uc("mathlive-keystroke-caption-panel").style.visibility="hidden"}return!1},toggleContextMenu:e=>{const t=e.toggleContextMenu();return t||e.model.announce("plonk"),t},plonk:e=>(e.model.announce("plonk"),!0),switchMode:(e,t,n,i)=>(e.switchMode(t,n,i),!0),insert:(e,t,n)=>e.insert(t,n),typedText:(e,t,n)=>(Gd(e,t,n),!0),insertDecimalSeparator:e=>{const t=e.model;if("math"===t.mode&&","===window.MathfieldElement.decimalSeparator){if(t.at(Math.max(t.position,t.anchor)).isDigit())return e.insert("{,}",{format:"latex"}),e.snapshot("insert-mord"),!0}return e.insert("."),!0},commit:e=>{var t;return e.model.contentWillChange({inputType:"insertLineBreak"})&&(null==(t=e.host)||t.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),e.model.contentDidChange({inputType:"insertLineBreak"})),!0},insertPrompt:(e,t,n)=>{const i=e.getPrompts();let o="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36),r=0;for(;i.includes(o)&&r<100;){if(99===r)return console.error("could not find a unique ID after 100 tries"),!1;o="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36),r++}return e.insert(`\\placeholder[${null!=t?t:o}]{}`,n),!0}}),Dc({copyToClipboard:e=>(e.focus(),e.model.selectionIsCollapsed&&e.select(),"queryCommandSupported"in document&&document.queryCommandSupported("copy")?document.execCommand("copy"):e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy",{bubbles:!0,composed:!0})),!1)},{target:"mathfield"}),Dc({cutToClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("cut")?document.execCommand("cut"):e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut",{bubbles:!0,composed:!0})),!0),pasteFromClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("paste")?(document.execCommand("paste"),!0):(navigator.clipboard.readText().then((t=>{t&&e.model.contentWillChange({inputType:"insertFromPaste",data:t})?(e.stopCoalescingUndo(),e.stopRecording(),e.insert(t,{mode:e.model.mode})&&(cc(e),e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),Lc(e))):e.model.announce("plonk"),e.startRecording()})),!0))},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0}),Dc({applyStyle:function(e,t){e.flushInlineShortcutBuffer(),e.stopCoalescingUndo();const n=nh(e,t),{model:i}=e;return i.selectionIsCollapsed?(e.defaultStyle.fontSeries&&n.fontSeries===e.defaultStyle.fontSeries&&(n.fontSeries="auto"),n.fontShape&&n.fontShape===e.defaultStyle.fontShape&&(n.fontShape="auto"),n.color&&n.color===e.defaultStyle.color&&(n.color="none"),n.backgroundColor&&n.backgroundColor===e.defaultStyle.backgroundColor&&(n.backgroundColor="none"),n.fontSize&&n.fontSize===e.defaultStyle.fontSize&&(n.fontSize="auto"),e.defaultStyle=d(d({},e.defaultStyle),n)):e.model.deferNotifications({content:!0,type:"insertText"},(()=>{i.selection.ranges.forEach((e=>fd(i,e,n,{operation:"toggle"}))),e.snapshot("style-change")})),!0}},{target:"mathfield",canUndo:!0,changeContent:!0}),Dc({selectGroup:e=>{const t=ih(e);return t||e.announce("plonk"),t},selectAll:e=>e.setSelection(0,e.lastOffset),extendSelectionForward:e=>zd(e,"forward",{extend:!0}),extendSelectionBackward:e=>zd(e,"backward",{extend:!0}),extendToNextWord:e=>Dd(e,"forward",{extend:!0}),extendToPreviousWord:e=>Dd(e,"backward",{extend:!0}),extendSelectionUpward:e=>zd(e,"upward",{extend:!0}),extendSelectionDownward:e=>zd(e,"downward",{extend:!0}),extendToNextBoundary:e=>Dd(e,"forward",{extend:!0}),extendToPreviousBoundary:e=>Dd(e,"backward",{extend:!0}),extendToGroupStart:e=>{const t=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).firstSibling));return t||e.announce("plonk"),t},extendToGroupEnd:e=>{const t=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).lastSibling));return t||e.announce("plonk"),t},extendToMathFieldStart:e=>{const t=e.setSelection(e.anchor,0);return t||e.announce("plonk"),t},extendToMathFieldEnd:e=>{const t=e.setSelection(e.anchor,e.lastOffset);return t||e.announce("plonk"),t}},{target:"model",changeSelection:!0});var rh=null,ah=0,sh=class e{static start(t,n,i,o){var r;e.element=t,null==(r=e.controller)||r.abort(),e.controller=new AbortController;const a={signal:e.controller.signal};"PointerEvent"in window?(t.addEventListener("pointermove",i,a),t.addEventListener("pointerup",o,a),t.addEventListener("pointercancel",o,a),lh(n)&&(e.pointerId=n.pointerId,t.setPointerCapture(n.pointerId))):(window.addEventListener("mousemove",i,a),window.addEventListener("blur",o,a),window.addEventListener("mouseup",o,a))}static stop(){var t;null==(t=e.controller)||t.abort(),e.controller=void 0,"number"==typeof e.pointerId&&(e.element.releasePointerCapture(e.pointerId),e.pointerId=void 0)}};function lh(e){return null!==e&&void 0!==globalThis.PointerEvent&&e instanceof PointerEvent}function ch(e,t){var n;if(t.buttons>1)return;e.atomBoundsCache=new Map;const i=e;let o,r=!1,a=!1,s="none",l=!1,c=!1;const d=t.clientX,h=t.clientY,u=Date.now(),p=i.field,m=setInterval((()=>{l?p.scroll({top:0,left:p.scrollLeft-16}):c&&p.scroll({top:0,left:p.scrollLeft+16})}),32);function f(){sh.stop(),r=!1,clearInterval(m),e.element.classList.remove("tracking"),t&&t.preventDefault()}rh&&Math.abs(rh.x-d)<5&&Math.abs(rh.y-h)<5&&Date.now()<rh.time+500?(ah+=1,rh.time=u):(rh={x:d,y:h,time:u},ah=1);const g=p.getBoundingClientRect();if(d>=g.left&&d<=g.right&&h>=g.top&&h<=g.bottom){if(e.flushInlineShortcutBuffer(),e.adoptStyle="left",o=ph(e,d,h,{bias:0}),o>=0){if(e.element.classList.add("tracking"),t.shiftKey){const t=e.model.selectionIsCollapsed;e.model.extendSelectionTo(e.model.anchor,o),s=dc(e.model)||t?"all":"selection"}else"placeholder"===e.model.at(o).type?(e.model.setSelection(o-1,o),s="selection"):"placeholder"===(null==(n=e.model.at(o).rightSibling)?void 0:n.type)?(e.model.setSelection(o,o+1),s="selection"):(e.model.position=o,s=dc(e.model)?"all":"selection");e.defaultStyle={},3===t.detail||ah>2?(f(),3!==t.detail&&3!==ah||(e.model.selection={ranges:[[0,e.model.lastOffset]]},s="all")):r||(r=!0,sh.start(p,t,(function(t){if(!i.hasFocus())return void f();const n=t.clientX,r=t.clientY,s=lh(t)&&"touch"===t.pointerType?20:5;if(Date.now()<u+500&&Math.abs(d-n)<s&&Math.abs(h-r)<s)return t.preventDefault(),void t.stopPropagation();const m=p.getBoundingClientRect();c=n>m.right,l=n<m.left;let g=o;lh(t)&&(t.isPrimary||(g=ph(i,t.clientX,t.clientY,{bias:0})));const b=ph(i,n,r,{bias:n<=d?n===d?0:-1:1});g>=0&&b>=0&&(i.model.extendSelectionTo(g,b),Lc(e)),a&&ih(i.model)}),f),2!==t.detail&&2!==ah||(a=!0,ih(e.model),s="all"))}e.hasFocus()||(s="none",e.focus({preventScroll:!0}))}else rh=null;e.stopCoalescingUndo(),"none"!==s&&(e.model.selectionIsCollapsed&&(s="all"),Lc(e)),t.preventDefault()}function dh(e,t,n){if(e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom)return 0;const i=e-(n.left+n.right)/2,o=t-(n.top+n.bottom)/2;return i*i+o*o}function hh(e,t,n,i,o){if(!n.id)return[1/0,null];if(t.has(n.id))return t.get(n.id);const r=rs(e,n);if(!r)return[1/0,null];let a=[1/0,null];if(n.hasChildren&&!n.captureSelection&&i>=r.left&&i<=r.right)for(const r of n.children){const n=hh(e,t,r,i,o);n[0]<=a[0]&&(a=n)}return a[1]||(a=[dh(i,o,r),n]),t.set(n.id,a),a}function uh(e,t,n){const[,i]=hh(e,new Map,e.model.root,t,n);return i}function ph(e,t,n,i){var o;const r=e.field.querySelector(".ML__latex").getBoundingClientRect();if(!r)return 0;if(t>r.right||n>r.bottom+8)return e.model.lastOffset;if(t<r.left||n<r.top-8)return 0;(i=null!=i?i:{}).bias=null!=(o=i.bias)?o:0;let a=uh(e,t,n);const s=[];let l=a;for(;l;)s.unshift(l),l=l.parent;for(const e of s)if(e.captureSelection){a=e;break}let c=e.model.offsetOf(a);if(c<0)return-1;if(a.leftSibling)if(0===i.bias&&"placeholder"!==a.type){const n=rs(e,a);n&&t<(n.left+n.right)/2&&(c=e.model.offsetOf(a.leftSibling))}else i.bias<0&&(c=e.model.offsetOf(a.leftSibling));return c}function mh(e,t,n,i){var o;let r,a=[];if("string"!=typeof t||"math-json"===i.format){const n=window.MathfieldElement.computeEngine;if(!n)return["math-json",[]];[r,t]=["latex",n.box(t).latex],a=Qs(t,{context:e.mathfield.context})}else"string"==typeof t&&"ascii-math"===i.format?([r,t]=Va(t,{format:"ascii-math",inlineShortcuts:e.mathfield.options.inlineShortcuts}),a=Qs(t,{context:e.mathfield.context}),"latex"!==r&&e.mathfield.options.removeExtraneousParentheses&&gh(a)):("auto"===i.format||(null==(o=i.format)?void 0:o.startsWith("latex")))&&("auto"===i.format&&([r,t]=Va(t,{format:"auto",inlineShortcuts:e.mathfield.options.inlineShortcuts})),"latex"===i.format&&([,t]=Ja(t)),a=Qs(t,{context:e.mathfield.context,args:n}),"latex"!==i.format&&e.mathfield.options.removeExtraneousParentheses&&gh(a));return md(a,i.style),[null!=r?r:"latex",a]}function fh(e){if(!e)return null;if(console.assert("first"===e[0].type),e.length>1)return null;const t=e[0];return t instanceof Ws&&"("===t.leftDelim&&")"===t.rightDelim?t.removeBranch("body"):null}function gh(e){if(e){for(let t=0;e[t];t++){const n=e[t];if(n instanceof Ws&&"("===n.leftDelim){let i=0,o=0,r=0;for(let e=0;n.body[e];e++)"genfrac"===n.body[e].type&&(i++,o=e),r++;0===r&&1===i&&(e[t]=n.body[o])}}for(const t of e){for(const e of t.branches)if(!t.hasEmptyBranch(e)){gh(t.branch(e));const n=fh(t.branch(e));n&&t.setChildren(n,e)}if(t instanceof Os)for(const e of t.cells)gh(e)}}}function bh(e){return!!e.isDigit()||!(!e.type||!/^(mord|surd|subsup|leftright|mop|mclose)$/.test(e.type))&&!e.isExtensibleSymbol}new class extends Za{constructor(){super("math")}onPaste(e,t){if(!t)return!1;if(!e.model.contentWillChange({data:"string"==typeof t?t:null,dataTransfer:"string"==typeof t?null:t,inputType:"insertFromPaste"}))return!1;let n="",i="auto",o="string"!=typeof t?t.getData("application/json+mathlive"):"";if(o)try{const t=JSON.parse(o);if(t&&Array.isArray(t)){e.snapshot();const n=Ll(t),{model:i}=e;i.selectionIsCollapsed||i.deleteAtoms(Oa(i.selection));const o=i.at(i.position);if(o.parent instanceof Os){console.assert(void 0!==o.parentBranch);const e=[];let t=[];"first"===n[0].type&&n.shift(),"first"===n[n.length-1].type&&n.pop();for(const i of n)"first"===i.type&&t.length>0?(e.push(t),t=[i]):t.push(i);t.length>0&&e.push(t);let i=Number(o.parentBranch[0]),r=Number(o.parentBranch[1]);const a=o.parent.maxColumns;for(;o.parent.colCount-r<e.length&&o.parent.colCount<a;)o.parent.addColumn();o.parent.addChildrenAfter(e[0],o);for(let t=1;t<e.length;t++)r++,r>=a&&(r=0,o.parent.addRowAfter(i),i++),o.parent.setCell(i,r,e[t])}else o.parent.addChildrenAfter(n.filter((e=>"first"!==e.type)),o);return i.position=i.offsetOf(n[n.length-1]),i.contentDidChange({inputType:"insertFromPaste"}),Lc(e),!0}}catch(e){}if(o="string"!=typeof t?t.getData("application/json"):"",o&&window.MathfieldElement.computeEngine)try{const e=JSON.parse(o);if("object"==typeof e&&"latex"in e&&e.latex&&(n=e.latex),!n){const t=window.MathfieldElement.computeEngine.box(e);t&&!t.has("Error")&&(n=t.latex)}n||(i="latex")}catch(e){}if(n||"string"==typeof t||(n=t.getData("application/x-latex"),n&&(i="latex")),n||(n="string"==typeof t?t:t.getData("text/plain")),n){let t;return[t,n]=Ja(n),"auto"===i&&t&&(i="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,n,{format:i})&&(e.startRecording(),e.snapshot("paste"),Lc(e)),e.startRecording(),!0}return!1}insert(e,t,n){var i,o;const r="string"==typeof t?t:null!=(o=null==(i=window.MathfieldElement.computeEngine)?void 0:i.box(t).latex)?o:"";if(!n.silenceNotifications&&!e.contentWillChange({data:r,inputType:"insertText"}))return!1;n.insertionMode||(n.insertionMode="replaceSelection"),n.selectionMode||(n.selectionMode="placeholder"),n.format||(n.format="auto");const{silenceNotifications:a}=e;n.silenceNotifications&&(e.silenceNotifications=!0);const s=e.silenceNotifications;e.silenceNotifications=!0;const l={"?":"\\placeholder{}","@":"\\placeholder{}"};l[0]="replaceAll"===n.insertionMode?"":e.getValue(e.selection,"latex-unstyled"),"replaceSelection"!==n.insertionMode||e.selectionIsCollapsed?"replaceAll"===n.insertionMode?(e.root.setChildren([],"body"),e.position=0):"insertBefore"===n.insertionMode?e.collapseSelection("backward"):"insertAfter"===n.insertionMode&&e.collapseSelection("forward"):e.deleteAtoms(Oa(e.selection)),e.at(e.position).isLastSibling||"placeholder"!==e.at(e.position+1).type?"placeholder"===e.at(e.position).type&&e.deleteAtoms([e.position-1,e.position]):e.deleteAtoms([e.position,e.position+1]);let c=-1;l[0]?l["@"]=l[0]:"string"==typeof t&&/(^|[^\\])#@/.test(t)&&(c=function(e){let t=e.at(e.position);if("text"===t.mode){for(;!t.isFirstSibling&&"text"===t.mode;)t=t.leftSibling;return e.offsetOf(t)}const n=t;let i=!1;if("mclose"===t.type){const e=bs[t.value];for(;!t.isFirstSibling&&("mopen"!==t.type||t.value!==e);)t=t.leftSibling;t.isFirstSibling||(t=t.leftSibling),i=!0}else"leftright"===t.type&&(t=t.leftSibling,i=!0);if(i)for(;!t.isFirstSibling&&(t.isFunction||bh(t));)t=t.leftSibling;else{const e=[];for(;!t.isFirstSibling&&(bh(t)||e.length>0);)"mclose"===t.type&&e.unshift(t.value),"mopen"===t.type&&e.length>0&&t.value===bs[e[0]]&&e.shift(),t=t.leftSibling}return n===t?-1:e.offsetOf(t)}(e),c>=0&&(l["@"]=e.getValue(c,e.position,"latex"))),l[0]||(l[0]=l["?"]);let d=!1;const h=e=>(d=!0,l[e]);let[u,p]=mh(e,t,h,n);if(!p)return!1;const m=1===p.length&&"genfrac"===p[0].type;m&&c>=0&&"function"==typeof e.mathfield.options.isImplicitFunction&&e.mathfield.options.isImplicitFunction(e.at(e.position).command)?(l["@"]=l["?"],d=!1,[u,p]=mh(e,t,h,n)):c>=0&&e.deleteAtoms([c,e.position]);const{parent:f}=e.at(e.position),g=f.hasEmptyBranch("body");if(m&&"latex"!==u&&e.mathfield.options.removeExtraneousParentheses&&f instanceof Ws&&"("===f.leftDelim&&g){const e=f.parent,t=f.parentBranch;e.removeChild(f),e.setChildren(p,t)}const b=e.at(e.position);b.parent.addChildrenAfter(p,b),"latex"===u&&"string"==typeof t&&"root"===(null==f?void 0:f.type)&&g&&!d&&(f.verbatimLatex=t),e.silenceNotifications=s;const y=p[p.length-1];if("placeholder"===n.selectionMode){const t=p.flatMap((e=>[e,...e.children])).find((e=>"placeholder"===e.type));if(t){const n=e.offsetOf(t);e.setSelection(n-1,n),e.announce("move")}else y&&(e.position=e.offsetOf(y))}else"before"===n.selectionMode||("after"===n.selectionMode?y&&(e.position=e.offsetOf(y)):"item"===n.selectionMode&&e.setSelection(e.anchor,e.offsetOf(y)));return e.contentDidChange({data:r,inputType:"insertText"}),e.silenceNotifications=a,!0}};function yh(e){return{value:e.model.getValue(),selectionIsCollapsed:e.model.selectionIsCollapsed,canUndo:e.canUndo(),canRedo:e.canRedo(),style:e.selectionStyle,mode:e.model.mode}}new class extends Za{constructor(){super("text")}onPaste(e,t){if(!t)return!1;const n="string"==typeof t?t:t.getData("text/plain");return!(!n||!e.model.contentWillChange({inputType:"insertFromPaste",data:n}))&&(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,n)&&(e.model.contentDidChange({inputType:"insertFromPaste"}),e.startRecording(),e.snapshot("paste"),Lc(e)),e.startRecording(),!0)}insert(e,t,n={}){if(!e.contentWillChange({data:t,inputType:"insertText"}))return!1;n.insertionMode||(n.insertionMode="replaceSelection"),n.selectionMode||(n.selectionMode="placeholder"),n.format||(n.format="auto");const{silenceNotifications:i}=e;n.silenceNotifications&&(e.silenceNotifications=!0);const o=e.silenceNotifications;e.silenceNotifications=!0,"replaceSelection"!==n.insertionMode||e.selectionIsCollapsed?"replaceAll"===n.insertionMode?(e.root.setChildren([],"body"),e.position=0):"insertBefore"===n.insertionMode?e.collapseSelection("backward"):"insertAfter"===n.insertionMode&&e.collapseSelection("forward"):e.deleteAtoms(Oa(e.selection));const r=(a=t,s=e.mathfield.context,Qs(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=a.replace(/\\/g,"\\textbackslash ")).replace(/#/g,"\\#")).replace(/\$/g,"\\$")).replace(/%/g,"\\%")).replace(/&/g,"\\&")).replace(/_/g,"\\_")).replace(/{/g,"\\textbraceleft ")).replace(/}/g,"\\textbraceright ")).replace(/lbrace/g,"\\textbraceleft ")).replace(/rbrace/g,"\\textbraceright ")).replace(/\^/g,"\\textasciicircum ")).replace(/~/g,"\\textasciitilde ")).replace(/£/g,"\\textsterling "),{context:s,parseMode:"text"}));var a,s;if(md(r,n.style),!r)return!1;const l=e.at(e.position),c=l.parent.addChildrenAfter(r,l);return e.silenceNotifications=o,"before"===n.selectionMode||("item"===n.selectionMode?e.setSelection(e.anchor,e.offsetOf(c)):c&&(e.position=e.offsetOf(c))),e.contentDidChange({data:t,inputType:"insertText"}),e.silenceNotifications=i,!0}};var vh=20,xh=(e,t)=>`\n <line x1="${e+vh}" y1="${t+vh}" \n x2="${e>t?e+vh:180}" \n y2="${e<t?t+vh:180}"/>\n <svg id="plus" viewBox="0 0 40 40" x="${e}" y="${t}" width="40" height="40">\n <circle class="cls-2" cx="20" cy="20" r="20"/>\n <path class="font" d="m33.33,20c0,1.84-1.49,3.34-3.33,3.34h-6.67v6.66c0,1.84-1.49,3.34-3.33,3.34s-3.34-1.5-3.34-3.34v-6.66h-6.66c-1.84,0-3.34-1.5-3.34-3.34s1.5-3.33,3.34-3.33h6.66v-6.67c0-1.84,1.5-3.33,3.34-3.33s3.33,1.49,3.33,3.33v6.67h6.67c1.84,0,3.33,1.49,3.33,3.33Z"/>\n </svg>`,wh=(e,t)=>`\n <line x1="${e+vh}" y1="${t+vh}" \n x2="${e>t?e+vh:180}" \n y2="${e<t?t+vh:180}"/>\n <svg id="minus" viewBox="0 0 40 40" x="${e}" y="${t}" width="40" height="40">\n <circle class="cls-2" cx="20" cy="20" r="20"/>\n <path class="font" d="m33.33,20c0,1.84-1.49,3.33-3.33,3.33H10c-1.84,0-3.34-1.49-3.34-3.33s1.5-3.34,3.34-3.34h20c1.84,0,3.33,1.5,3.33,3.34Z"/>\n </svg>`,_h=(e,t,n)=>`\n <svg id="arrow" viewBox="0 0 40 40" x="${e}" y="${t}" width="40" height="40">\n <circle class="cls-2" cx="20" cy="20" r="20"/>\n <g transform="rotate(${n})" transform-origin="20 20">\n <path class="font" d="m17.7,7.23h4.6c.52,0,.94.42.94.94v13.82c0,.52.42.94.94.94h3.39c.83,0,1.25,1.01.66,1.6l-7.56,7.56c-.37.37-.96.37-1.32,0l-7.56-7.56c-.59-.59-.17-1.6.66-1.6h3.39c.52,0,.94-.42.94-.94v-13.82c0-.52.42-.94.94-.94Z"/>\n </g> \n </svg>`,kh=`\n<svg class="MLEP__array-buttons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" \nviewBox=\n"-2 -2 205 205">\n <rect \n class="MLEP__array-insert-background rows"\n x="0" \n y="52" \n height="144" \n width="48" \n rx="24"/>\n <rect \n class="MLEP__array-insert-background columns"\n x="52" \n y="0" \n height="48" \n width="144" \n rx="24"/>\n <g data-command='"moveDown"'>\n ${_h(104,152,0)}\n </g>\n <g data-command='"moveUp"'>\n ${_h(104,56,180)}\n </g>\n <g data-command='"moveToNextWord"'>\n ${_h(152,104,-90)}\n </g>\n <g data-command='"moveToPreviousWord"'>\n ${_h(56,104,90)}\n </g>\n <g>\n\n <g data-command='"addColumnBefore"'>\n ${xh(56,4)}\n </g>\n <g data-command='"removeColumn"'>\n ${wh(104,4)}\n </g>\n <g data-command='"addColumnAfter"'>\n ${xh(152,4)}\n </g>\n <g data-command='"addRowBefore"'>\n ${xh(4,56)}\n </g>\n <g data-command='"removeRow"'>\n ${wh(4,104)}\n </g>\n <g data-command='"addRowAfter"'>\n ${xh(4,152)}\n </g>\n</svg>`,Mh=e=>`\n<svg id="Bmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24" \n data-command='["setEnvironment","Bmatrix"]'>\n <rect class="cls-1" width="28" height="24"/>\n <path class="cls-2" d="m6,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>\n <path class="cls-2" d="m22,4c1.1,0,2,.9,2,2v3c0,1.66.9,3,2,3-1.1,0-2,1.34-2,3v3c0,1.1-.9,2-2,2"/>\n <circle cx="10" cy="8" r="1"/>\n <circle cx="14" cy="12" r="1"/>\n <circle cx="18" cy="16" r="1"/>\n</svg>`,Sh={matrix:e=>`\n<svg id="matrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24" \n data-command='["setEnvironment","matrix"]'>\n <rect class="cls-1" width="28" height="24"/>\n <circle cx="10" cy="8" r="1"/>\n <circle cx="14" cy="12" r="1"/>\n <circle cx="18" cy="16" r="1"/></svg>`,pmatrix:e=>`\n<svg id="pmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24" \ndata-command='["setEnvironment","pmatrix"]'>\n <rect class="cls-1" width="28" height="24"/>\n <path class="cls-2" d="m6,4c-3.96,4.6-3.96,11.4,0,16"/>\n <path class="cls-2" d="m22,4c3.96,4.6,3.96,11.4,0,16"/>\n <circle cx="10" cy="8" r="1"/>\n <circle cx="14" cy="12" r="1"/>\n <circle cx="18" cy="16" r="1"/></svg>`,bmatrix:e=>`\n<svg id="bmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24" \n data-command='["setEnvironment","bmatrix"]'>\n <rect class="cls-1" width="28" height="24"/>\n <path class="cls-2" d="m6,4h-3v16h3"/>\n <path class="cls-2" d="m22,4h3v16h-3"/>\n <circle cx="10" cy="8" r="1"/>\n <circle cx="14" cy="12" r="1"/>\n <circle cx="18" cy="16" r="1"/>\n</svg>`,Bmatrix:Mh,vmatrix:e=>`\n<svg id="vmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24" \n data-command='["setEnvironment","vmatrix"]'>\n <rect class="cls-1" width="28" height="24"/>\n <circle cx="10" cy="8" r="1"/>\n <circle cx="14" cy="12" r="1"/>\n <circle cx="18" cy="16" r="1"/>\n <line class="cls-2" x1="4" y1="4" x2="4" y2="20"/>\n <line class="cls-2" x1="24" y1="4" x2="24" y2="20"/>\n</svg>`,Vmatrix:e=>`\n<svg id="Vmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="-3.5 -3 35 30" \n data-command='["setEnvironment","Vmatrix"]'>\n <rect class="cls-1" width="28" height="24"/>\n <circle cx="10" cy="8" r="1"/>\n <circle cx="14" cy="12" r="1"/>\n <circle cx="18" cy="16" r="1"/>\n <line class="cls-2" x1="6" y1="4" x2="6" y2="20"/>\n <line class="cls-2" x1="22" y1="4" x2="22" y2="20"/>\n <line class="cls-2" x1="2" y1="4" x2="2" y2="20"/>\n <line class="cls-2" x1="26" y1="4" x2="26" y2="20"/>\n</svg>`},Lh={cases:e=>`\n<svg id="cases" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24" \n data-command='["setEnvironment","cases"]'>\n <rect class="cls-1" width="28" height="24"/>\n <path class="cls-2" d="m10,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>\n <circle cx="13" cy="8" r="1"/>\n <circle cx="13" cy="16" r="1"/>\n <circle cx="21" cy="8" r="1"/>\n <circle cx="21" cy="16" r="1"/>\n</svg>`,rcases:e=>`\n<svg id="rcases" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24" \n data-command='["setEnvironment","rcases"]'>\n <rect class="cls-1" width="28" height="24"/>\n <path class="cls-2" d="m18,20c1.1,0,2-.9,2-2v-3c0-1.66.9-3,2-3-1.1,0-2-1.34-2-3v-3c0-1.1-.9-2-2-2"/>\n <circle cx="15" cy="8" r="1"/>\n <circle cx="15" cy="16" r="1"/>\n <circle cx="7" cy="8" r="1"/>\n <circle cx="7" cy="16" r="1"/>\n</svg>`,Bmatrix:Mh};function Ch(e){var t,n;const i=null==(t=e.model.parentEnvironment)?void 0:t.array;if(!i)return;let o=0;i.forEach((e=>{(!o||e.length>o)&&(o=e.length)}));let r,a=document.getElementById("mathlive-environment-popover");a||(a=uc("mathlive-environment-popover"),ps("environment-popover"),ps("core"),a.setAttribute("aria-hidden","true"));const s=a.querySelector(".MLEP__environment-controls");s?r=s:(r=document.createElement("div"),a.innerHTML="",a.appendChild(r)),r.className="MLEP__environment-controls",r.style.display="flex",r.style.width="100%",r.style.height="100%",r.style.boxSizing="border-box",r.innerHTML=kh;let l=[],c="";const d=e.model.parentEnvironment.environmentName;if(Ps(d)){const e=function(e){return e.replace("*","")}(d);c=Sh[e]("active");const t=Sh,{[e]:n}=t,i=p(t,[u(e)]);l=Object.values(i).map((e=>e("inactive")))}else if(function(e){return Ts.includes(e)}(d)){const e=function(e){return"dcases"===e?"cases":e}(d);c=Lh[e]("active");const t=Lh,{[e]:n}=t,i=p(t,[u(e)]);l=Object.values(i).map((e=>e("inactive")))}else(function(e){return Bs.includes(e)})(d)&&(c=Sh.matrix("active"),l=Object.values(Lh).map((e=>e("inactive"))));const h=document.createElement("div");h.className="MLEP__environment-delimiter-controls",h.style.display="flex",h.style.flexDirection="column",h.innerHTML=`\n <div class='MLEP__array-delimiter-options'>\n ${c}\n ${l.join("")}\n </div>`,c&&r.appendChild(h);r.querySelectorAll("[data-command]").forEach((t=>{const n=t.dataset.command;let i=n;try{i=JSON.parse(n)}catch(e){}t.addEventListener("mousedown",(e=>e.preventDefault())),i&&t.addEventListener("click",(()=>e.executeCommand(i)))}));const m=null==(n=e.field)?void 0:n.getBoundingClientRect();m&&(a.style.top=`${window.scrollY+(m.top-a.clientHeight-15)}px`,a.style.left=`${m.left+20}px`,a.classList.add("is-visible"))}function Eh(){const e=document.getElementById("mathlive-environment-popover");null==e||e.classList.remove("is-visible")}function Kh(e){if(!e.hasFocus())return;let t=!1;if("math"===e.model.mode){const i=e.model.parentEnvironment;if((null==i?void 0:i.array)&&(n=i.environmentName,$s.concat(Bs).concat(Ts).concat(zs).includes(n))){const n=e.options.environmentPopoverPolicy;t="auto"===n||"on"===n}}var n;t?Ch(e):Eh()}function Ah(e){const t=getComputedStyle(e).direction;return"ltr"===t||"rtl"===t?t:"ltr"}function Dh(e,t,n){return"left"===t||"leading"===t&&"ltr"===n||"trailing"===t&&"rtl"===n?e.left:e.right}function zh(e,t,n,i){return"middle"===n?e-t/2:"start"===n&&"rtl"===i||"end"===n&&"ltr"===i||"top"===n||"right"===n?Math.max(0,e-t):e}function Th(e){return"submenu"in e}function Bh(e){return"type"in e&&"command"===e.type||"onMenuSelect"in e||"id"in e}function $h(e){return"type"in e&&"divider"===e.type}function Ph(e){return"type"in e&&"heading"===e.type}var Oh={};function qh(e){let t=Oh[e];if(!t){let n;switch(e){case"checkmark":n='<span aria-hidden="true" class="ui-checkmark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></svg>\n </span>';break;case"trailing-chevron":n='<span aria-hidden="true" class="ui-trailing-chevron"><svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg></span>';break;case"mixedmark":n='<span aria-hidden="true" class="ui-mixedmark"><svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H24c-13.3 0-24-10.7-24-24z"/></svg></span>'}if(n){const i=document.createElement("template");i.innerHTML=n,Oh[e]=i,t=i}}if(t){if("content"in t)return t.content.cloneNode(!0);const e=document.createElement("svg");return e.innerHTML=t.innerHTML,e}}var Nh=class{constructor(e,t){var n;this._element=null,this.parentMenu=t,this._declaration=e,Th(e)?(this.type="submenu",this.submenu=new Fh(e.submenu,{parentMenu:t,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=null!=(n=e.type)?n:"command",this.hasCheck=Bh(e)&&void 0!==e.checked}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var e,t;null==(e=this._abortController)||e.abort(),this._abortController=void 0,null==(t=this._element)||t.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var e;return null!=(e=this._label)?e:""}set label(e){void 0===e&&(e=""),e!==this._label&&(this._label=e,this.dirty=!0)}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.dirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.element&&(e?this.element.removeAttribute("aria-disabled"):this.element.setAttribute("aria-disabled","true")),this.dirty=!0}get checked(){return this._checked}set checked(e){this._checked=e,this.dirty=!0}get tooltip(){return this._tooltip}set tooltip(e){e!==this._tooltip&&(this._tooltip=e,this.dirty=!0)}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){e!==this._ariaLabel&&(this._ariaLabel=e,this.dirty=!0)}get active(){var e,t;return null!=(t=null==(e=this.element)?void 0:e.classList.contains("active"))&&t}set active(e){this.element&&this.element.classList.toggle("active",e)}updateState(e){var t,n,i;const o=this._declaration;if($h(o))return this.enabled=!1,void(this.checked=!1);Ph(o)&&(this.enabled=!1,this.checked=!1,this.visible=!0),Bh(o)&&(this.checked=Bh(o)&&null!=(t=Ih(o.checked,e))&&t),(Bh(o)||Th(o))&&(this.enabled=null==(n=Ih(o.enabled,e))||n,this.visible=null==(i=Ih(o.visible,e))||i,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),(Bh(o)||Ph(o)||Th(o))&&(this.label=Ih(o.label,e),this.tooltip=Ih(o.tooltip,e),this.ariaLabel=Ih(o.ariaLabel,e)),this._element&&this.updateElement()}set dirty(e){console.assert(!0===e),e&&this.parentMenu&&(this.parentMenu.dirty=!0)}updateElement(){if(!this.visible||!this.element)return;const e=this.element;e.textContent="",this.enabled?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true"),!0===this.checked?(e.setAttribute("aria-checked","true"),e.append(qh("checkmark"))):"mixed"===this.checked?(e.setAttribute("aria-checked","mixed"),e.append(qh("mixedmark"))):e.removeAttribute("aria-checked"),this.ariaLabel&&e.setAttribute("aria-label",this.ariaLabel);const t=document.createElement("span");if(t.className=this.parentMenu.hasCheck?"label indent":"label","heading"===this.type&&t.classList.add("heading"),t.innerHTML=this.label,e.append(t),this._tooltip&&e.setAttribute("data-tooltip",this._tooltip),Bh(this._declaration)&&this._declaration.keyboardShortcut){const t=document.createElement("kbd");t.innerHTML=Ul(this._declaration.keyboardShortcut),e.append(t)}"submenu"===this.type&&e.append(qh("trailing-chevron"))}get element(){if(this._element)return this._element;if($h(this._declaration)){const e=document.createElement("li");return e.setAttribute("part","menu-divider"),e.setAttribute("role","divider"),this._element=e,e}const e=document.createElement("li");this._element=e,(Bh(this._declaration)||Ph(this._declaration)||Th(this._declaration))&&this._declaration.class&&(e.className=this._declaration.class),e.setAttribute("part","menu-item"),e.setAttribute("tabindex","-1"),this.hasCheck?e.setAttribute("role","menuitemcheckbox"):e.setAttribute("role","menuitem"),"submenu"===this.type&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"));const t=this.abortController.signal;return e.addEventListener("pointerenter",this,{signal:t}),e.addEventListener("pointerleave",this,{signal:t}),e.addEventListener("pointerup",this,{signal:t}),e.addEventListener("click",this,{signal:t}),this._element}dispatchSelect(){if(!Bh(this._declaration))return;const e=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(e)&&"function"==typeof this._declaration.onMenuSelect&&this._declaration.onMenuSelect({modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(e){var t;if(this.visible&&this.enabled){if("click"===e.type)return"modal"===this.rootMenu.state&&this.select(),e.stopPropagation(),void e.preventDefault();if("pointerenter"===e.type){const n=e;return this.rootMenu.cancelDelayedOperation(),void(this.parentMenu.isSubmenuOpen&&(null==(t=this.parentMenu.activeMenuItem)?void 0:t.movingTowardSubmenu(n))?this.rootMenu.scheduleOperation((()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()})):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0})))}if("pointerleave"!==e.type)return"pointerup"===e.type?("modal"!==this.rootMenu.state&&this.select(),e.stopPropagation(),void e.preventDefault()):void 0;this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null)}}select(){this.rootMenu.cancelDelayedOperation(),"submenu"!==this.type?(this.active=!1,setTimeout((()=>{this.active=!0,setTimeout((()=>{this.rootMenu.hide(),this.dispatchSelect()}),80)}),80)):this.openSubmenu()}openSubmenu(e){var t;if("submenu"!==this.type||!this.element)return;if(null!=(t=null==e?void 0:e.withDelay)&&t)return void this.rootMenu.scheduleOperation((()=>this.openSubmenu()));const n=this.element.getBoundingClientRect(),i=Ah(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:Dh(n,"trailing",i),y:n.top-4},alternateLocation:{x:Dh(n,"leading",i),y:n.top-4}})}movingTowardSubmenu(e){if(!this.element)return!1;if("submenu"!==this.type)return!1;const t=this.rootMenu.lastMoveEvent;if(!t)return!1;const n=e.timeStamp-t.timeStamp;if(n>500)return!1;const i=e.clientX-t.clientX;var o,r,a;if((o=i,r=t.clientY-e.clientY,a=n,Math.hypot(o,r)/a)<=.2)return!1;let s="right";if(this.submenu.element){const e=this.submenu.element.getBoundingClientRect(),t=this.element.getBoundingClientRect();e.left<t.left+t.width/2&&(s="left")}return"right"===s?i>0:i<0}};function Ih(e,t){return void 0===e||"function"!=typeof e?e:(null!=t||(t={alt:!1,control:!1,shift:!1,meta:!1}),e(t))}var Fh=class e{constructor(e,t){var n,i;this._element=null,this._activeMenuItem=null,this._dirty=!0,this.parentMenu=null!=(n=null==t?void 0:t.parentMenu)?n:null,this._submenuClass=null==t?void 0:t.submenuClass,this.columnCount=null!=(i=null==t?void 0:t.columnCount)?i:1,this.isSubmenuOpen=!1,this.menuItems=e}get children(){return this._menuItems}set menuItems(e){const t=this.parentMenu;this.dispose(),this.parentMenu=t,e=[...e],this._menuItems=e.map((e=>e.onCreate?e.onCreate(e,this):new Nh(e,this))),this.hasCheck=void 0,this.dirty=!0}dispose(){var e;this.hide(),this._element&&this._element.remove(),this._abortController&&this._abortController.abort(),null==(e=this._menuItems)||e.forEach((e=>e.dispose())),this._menuItems=[],this._activeMenuItem=null,this.parentMenu=null}handleEvent(e){if("wheel"===e.type&&this._element){const t=e;this._element.scrollBy(0,t.deltaY),e.stopPropagation()}}dispatchEvent(e){return this.rootMenu.dispatchEvent(e)}get rootMenu(){return this.parentMenu.rootMenu}updateState(e){var t,n,i;this._menuItems.forEach((t=>t.updateState(e)));const o=this.hasCheck;let r;this.hasCheck=this._menuItems.some((e=>e.visible&&e.hasCheck)),this.hasCheck!==o&&this._menuItems.forEach((t=>t.updateState(e)));let a=0;for(const e of this._menuItems)"heading"===e.type?(r&&0===a&&(r.visible=!1),r=e,a=0):"divider"===e.type&&r?(r.visible=a>0,r=void 0,a=0):r&&e.visible&&(a+=1);r&&(r.visible=a>0);let s=!0;for(const e of this._menuItems)"divider"===e.type?(e.visible=!s,s=!0):e.visible&&(s=!1);(null==(t=this.activeMenuItem)?void 0:t.visible)||(this.activeMenuItem=null),(null==(n=this.activeMenuItem)?void 0:n.enabled)||"submenu"!==(null==(i=this.activeMenuItem)?void 0:i.type)||this._activeMenuItem.submenu.hide(),this._dirty=!1}get enabled(){return this.updateIfDirty(),this._menuItems.some((e=>"divider"!==e.type&&e.visible&&e.enabled))}get visible(){return this.updateIfDirty(),this._menuItems.some((e=>"divider"!==e.type&&e.visible))}set dirty(e){console.assert(!0===e),this._dirty!==e&&e&&this.parentMenu&&(this._dirty=!0,this.parentMenu.dirty=!0)}updateIfDirty(){this._dirty&&this.updateState(this.rootMenu.modifiers)}updateElement(){var e;if(this._element){this._element.textContent="";for(const{element:e,visible:t}of this._menuItems)e&&t&&this._element.append(e);null==(e=this._element.querySelector("li:first-of-type"))||e.setAttribute("tabindex","0")}}get element(){if(this._element)return this._element;const e=document.createElement("menu");e.setAttribute("role","menu"),e.setAttribute("tabindex","-1"),e.setAttribute("aria-orientation","vertical"),e.setAttribute("part","ui-menu-container"),this._submenuClass&&e.classList.add(this._submenuClass),e.classList.add("ui-menu-container"),this._abortController||(this._abortController=new AbortController);const t=this._abortController.signal;return e.addEventListener("focus",this,{signal:t}),e.addEventListener("wheel",this,{passive:!0,signal:t}),this._element=e,this.updateElement(),e}get activeMenuItem(){return this._activeMenuItem}set activeMenuItem(e){var t,n,i,o;if(this.rootMenu.cancelDelayedOperation(),e!==this._activeMenuItem){if(this.activeMenuItem){const e=this.activeMenuItem;e.active=!1,null==(t=e.submenu)||t.hide()}if(null!=(n=null==e?void 0:e.visible)&&!n)return void(this._activeMenuItem=null);this._activeMenuItem=e,e&&(e.active=!0)}e?null==(i=e.element)||i.focus({preventScroll:!0}):null==(o=this._element)||o.focus({preventScroll:!0})}get firstMenuItem(){this.updateIfDirty();let e=0,t=!1;const n=this._menuItems;for(;!t&&e<=n.length-1;){const i=n[e];t="divider"!==i.type&&i.visible&&i.enabled,e+=1}return t?n[e-1]:null}get lastMenuItem(){this.updateIfDirty();const e=this._menuItems;let t=e.length-1,n=!1;for(;!n&&t>=0;){const i=e[t];n="divider"!==i.type&&i.visible&&i.enabled,t-=1}return n?e[t+1]:null}nextMenuItem(e){if(0===e)return this._activeMenuItem;if(!this._activeMenuItem)return e>0?this.firstMenuItem:this.lastMenuItem;if(!this.firstMenuItem||!this.lastMenuItem||!this._activeMenuItem)return null;this.updateIfDirty();const t=this._menuItems.indexOf(this.firstMenuItem),n=this._menuItems.indexOf(this.lastMenuItem);let i=this._menuItems.indexOf(this._activeMenuItem),o=1;for(;i>=t&&i<=n;){i+=e>0?1:-1;const t=this._menuItems[i];if(!t)break;if(t.visible&&t.enabled){if(o===Math.abs(e))return this._menuItems[i];o+=1}}return e>0?this.lastMenuItem:this.firstMenuItem}getMenuItemColumn(e){this.updateIfDirty();const t=this._menuItems.filter((e=>e.visible&&e.enabled)).indexOf(e);return t<0?-1:t%this.columnCount}static get collator(){return e._collator||(e._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),e._collator}findMenuItem(t){var n;this.updateIfDirty();const i=this._menuItems.filter((e=>"divider"!==e.type&&e.visible&&e.enabled));if(0===i.length)return null;const o=Math.max(...i.map((e=>e.label.length)))-t.length;if(o<0)return null;let r=null,a=0;for(;a<o&&!r;)r=null!=(n=i.find((n=>0===e.collator.compare(t,n.label.substring(a,t.length)))))?n:null,a++;return r}show(e){return!(!this.visible||!e.container)&&(this.updateElement(),e.container.appendChild(this.element),y()&&(this.element.popover="manual",this.element.showPopover()),e.location&&function(e,t){var n,i,o;const r=null!=(n=Ah(e))?n:"ltr";e.style.position="fixed",e.style.left="",e.style.top="",e.style.right="",e.style.bottom="",e.style.height="",e.style.width="";const a=e.getBoundingClientRect(),s=Number.isFinite(t.maxHeight)?Math.min(t.maxHeight,window.innerHeight):window.innerHeight;let l=Math.min(s,null!=(i=t.height)?i:a.height),c=zh(t.location.y,l,t.verticalPos,r);c+l>window.innerHeight-8&&(t.alternateLocation?(c=zh(t.alternateLocation.y,l,t.verticalPos,r),c+l>window.innerHeight-8&&(c=void 0)):c=void 0),Number.isFinite(c)||(c=Math.max(8,window.innerHeight-8-l),8+l>window.innerHeight-8&&(e.style.bottom="8px")),l=Math.min(c+l,window.innerHeight-8)-c;const d=Number.isFinite(t.maxWidth)?Math.min(t.maxWidth,window.innerWidth):window.innerWidth;let h=Math.min(d,null!=(o=t.width)?o:a.width),u=zh(t.location.x,h,t.horizontalPos,r);u+h>window.innerWidth-8&&(t.alternateLocation?(u=function(e,t,n,i){return"middle"===n?e-t/2:"start"===n&&"ltr"===i||"end"===n&&"rtl"===i||"top"===n||"right"===n?e:e-t}(t.alternateLocation.x,h,t.verticalPos,r),u+h>window.innerWidth-8&&(u=void 0)):u=void 0),Number.isFinite(u)||(u=Math.max(8,window.innerWidth-8-h),8+h>window.innerWidth-8&&(e.style.right="8px")),h=Math.min(u+h,window.innerWidth-8)-u,"rtl"===r?e.style.right=`${Math.ceil(window.innerWidth-u-h).toString()}px`:e.style.left=`${Math.ceil(u).toString()}px`,e.style.top=`${Math.ceil(c).toString()}px`,l!==a.height&&(e.style.height=`${Math.ceil(l).toString()}px`),h!==a.width&&(e.style.width=`${Math.ceil(h).toString()}px`)}(this.element,{location:e.location,alternateLocation:e.alternateLocation,verticalPos:"bottom",horizontalPos:"start"}),this.element.focus({preventScroll:!0}),this.parentMenu&&(this.parentMenu.openSubmenu=this),!0)}hide(){var e,t,n,i,o;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),y()&&(null==(e=this._element)?void 0:e.popover)&&this.element.hidePopover(),null==(n=null==(t=this.parentMenu)?void 0:t.element)||n.focus(),null==(o=null==(i=this._element)?void 0:i.parentNode)||o.removeChild(this._element)}set openSubmenu(e){var t,n,i,o;const r=null!==e;"submenu"===(null==(t=this.activeMenuItem)?void 0:t.type)&&(null==(n=this.activeMenuItem.element)||n.setAttribute("aria-expanded",r.toString())),null==(o=null==(i=this.activeMenuItem)?void 0:i.element)||o.classList.toggle("is-submenu-open",r),this.isSubmenuOpen=r}},Rh=class e extends Fh{constructor(e,t){var n;super(e),this.state="closed",this.typingBufferResetTimer=0,this.hysteresisTimer=0,this._updating=!1,this._host=null!=(n=null==t?void 0:t.host)?n:null,this.isDynamic=e.some(Hh),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(e){var t,n;(t=this._modifiers,n=e,!t&&n||t&&!n||t&&n&&(t.alt!==n.alt||t.control!==n.control||t.shift!==n.shift||t.meta!==n.meta))&&(this._modifiers=e,this.dirty=!0)}get activeSubmenu(){let e=this;for(;e.isSubmenuOpen;)e=e.activeMenuItem.submenu;return e}set dirty(e){this._updating||(console.assert(!0===e),this._dirty!==e&&(this._dirty=!0,e&&setTimeout((()=>{this.updateState(this.modifiers),this.updateElement()}))))}updateState(e){this._updating=!0,this.modifiers=null!=e?e:this.modifiers,super.updateState(this.modifiers),this._updating=!1}handleKeyupEvent(e){this.isDynamic&&(this.modifiers=Xl(e)),e.stopImmediatePropagation()}handleKeydownEvent(e){var t,n,i;if("Tab"===e.key||"Escape"===e.key)return void this.hide();this.isDynamic&&(this.modifiers=Xl(e));let o=!0;const r=this.activeSubmenu,a=r.activeMenuItem;switch(e.key){case" ":case"Space":case"Return":case"Enter":null==a||a.select(Xl(e));break;case"ArrowRight":if("submenu"===(null==a?void 0:a.type))a.select(Xl(e)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(a){const e=null!=(t=r.getMenuItemColumn(a))?t:-1;if(e>=0&&e<(null!=(n=r.columnCount)?n:1)-1){const e=r.nextMenuItem(1);e&&(r.activeMenuItem=e)}}else r.activeMenuItem=r.firstMenuItem;break;case"ArrowLeft":if(r===this.rootMenu)a||(r.activeMenuItem=r.firstMenuItem);else{if((a&&null!=(i=r.getMenuItemColumn(a))?i:-1)<=0||!a){r.hide();const e=r.parentMenu.activeMenuItem;if(e){const{element:t}=e;null==t||t.focus(),null==t||t.classList.remove("is-submenu-open")}}else{const e=r.nextMenuItem(-1);e&&(r.activeMenuItem=e)}}break;case"ArrowDown":r.activeMenuItem=r.nextMenuItem(r.columnCount);break;case"ArrowUp":r.activeMenuItem=r.nextMenuItem(-r.columnCount);break;case"Home":case"PageUp":r.activeMenuItem=r.firstMenuItem;break;case"End":case"PageDown":r.activeMenuItem=r.lastMenuItem;break;case"Backspace":if(this.typingBuffer&&(this.typingBuffer=this.typingBuffer.slice(0,-1),this.typingBuffer)){clearTimeout(this.typingBufferResetTimer);const e=r.findMenuItem(this.typingBuffer);e&&(r.activeMenuItem=e),this.typingBufferResetTimer=setTimeout((()=>{this.typingBuffer=""}),500)}break;default:if(Zl(e)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=e.key;const t=r.findMenuItem(this.typingBuffer);t&&(r.activeMenuItem=t),this.typingBufferResetTimer=setTimeout((()=>{this.typingBuffer=""}),500)}else o=!1}o&&(e.preventDefault(),e.stopPropagation())}handleEvent(e){if("keydown"===e.type)this.handleKeydownEvent(e);else if("keyup"===e.type)this.handleKeyupEvent(e);else if("pointermove"===e.type)this.lastMoveEvent=e;else if("pointerup"===e.type&&e.target===this.scrim)Number.isFinite(this.rootMenu._openTimestamp)&&Date.now()-this.rootMenu._openTimestamp<120?this.state="modal":"modal"===this.state&&this.hide();else if("contextmenu"===e.type)return e.preventDefault(),void e.stopPropagation();super.handleEvent(e)}dispatchEvent(e){return!this._host||this._host.dispatchEvent(e)}get scrim(){return Ql.element}connectScrim(e){const t=this.scrim;t.addEventListener("pointerup",this),t.addEventListener("contextmenu",this),t.addEventListener("keydown",this),t.addEventListener("keyup",this),t.addEventListener("pointermove",this),Ql.open({root:e,onDismiss:()=>this.hide()})}disconnectScrim(){const e=this.scrim;e.removeEventListener("pointerup",this),e.removeEventListener("contextmenu",this),e.removeEventListener("keydown",this),e.removeEventListener("keyup",this),e.removeEventListener("pointermove",this),"open"===Ql.state&&Ql.scrim.close()}get rootMenu(){return this}show(e){return this._onDismiss=null==e?void 0:e.onDismiss,(null==e?void 0:e.modifiers)&&(this.modifiers=e.modifiers),this.updateState(),this.connectScrim(null==e?void 0:e.target),super.show(h(d({},e),{container:this.scrim}))?(this._openTimestamp=Date.now(),this.state="open",!0):(this.disconnectScrim(),!1)}hide(){this.cancelDelayedOperation(),void 0!==this.state&&("closed"!==this.state&&(this.activeMenuItem=null,Ql.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(t){this.cancelDelayedOperation();const n=e.SUBMENU_DELAY;n<=0?t():this.hysteresisTimer=setTimeout((()=>{this.hysteresisTimer=0,t()}),n)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};Rh.SUBMENU_DELAY=120;var Vh=Rh;function Hh(e){return!$h(e)&&("function"==typeof e.label||"function"==typeof e.ariaLabel||"function"==typeof e.tooltip||(!(!Bh(e)&&!Th(e)||"function"!=typeof e.enabled&&"function"!=typeof e.visible)||(!(!Bh(e)||"function"!=typeof e.checked)||!!Th(e)&&e.submenu.some(Hh))))}var Wh=class{};function jh(e){return new Promise(((t,n)=>{const i=Jl(e);i||t(!1);let o=i;const r=setTimeout((()=>{var e,n;a.abort(),t((e=o,n=i,Math.hypot(n.x-e.x,n.y-e.y)<Wh.MAX_DISTANCE))}),Wh.DELAY),a=new AbortController,s=a.signal;for(const e of["pointermove","pointerup","pointercancel"])window.addEventListener(e,(e=>{if("pointerup"===e.type||"pointercancel"===e.type)clearTimeout(r),a.abort(),t(!1);else if("pointermove"===e.type){const t=Jl(e);t&&(o=t)}}),{passive:!0,signal:s})}))}async function Uh(e,t,n){if("contextmenu"===e.type){const i=e;if(n.show({target:t,location:Jl(i),modifiers:Xl(i)}))return e.preventDefault(),e.stopPropagation(),!0}if("keydown"===e.type){const i=e;if("ContextMenu"===i.code||"F10"===i.code&&i.shiftKey){const o=null==t?void 0:t.getBoundingClientRect();if(o&&n.show({target:t,location:{x:Math.ceil(o.left+o.width/2),y:Math.ceil(o.top+o.height/2)},modifiers:Xl(i)}))return e.preventDefault(),e.stopPropagation(),!0}}if("pointerdown"===e.type&&"mouse"!==e.pointerType&&0===e.button){let i=e.target;for(;i&&t!==i;)i=i.parentNode;if(!i)return!1;if(!n.visible)return!1;const o=Jl(e);if(await jh(e))return"closed"===n.state&&(n.show({target:t,location:o}),!0)}return!1}Wh.DELAY=300,Wh.MAX_DISTANCE=10;var Jh={acute:714,grave:715,dot:729,ddot:168,mathring:730,tilde:126,bar:713,breve:728,check:711,hat:94,vec:8407};ne(Object.keys(Jh),"{body:auto}",{createAtom:e=>new fs(h(d({},e),{body:O(e.args[0]),accentChar:Jh[e.command.slice(1)]}))}),ne(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:e=>{const t=Q(O(e.args[0]));return new fs(h(d({},e),{body:O(e.args[0]),svgAccent:e.command.slice(1)+(t.length>5?"4":["1","1","2","2","3","3"][t.length])}))}}),ne(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:e=>new fs(h(d({},e),{body:O(e.args[0]),svgAccent:"overarc"}))}),ne(["underarc","underparen"],"{body:auto}",{createAtom:e=>new ml(h(d({},e),{body:O(e.args[0]),svgBelow:"underarc"}))}),ne("utilde","{body:auto}",{createAtom:e=>{const t=O(e.args[0]),n=Q(t),i="widetilde"+(n.length>5?"4":["1","1","2","2","3","3"][n.length]);return new ml(h(d({},e),{body:t,svgBelow:i,boxType:la(t)}))}}),ne("^","{:string}",{createAtom:e=>{var t;return new za(h(d({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(t={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"}[e.args[0]])?t:"^"}))}}),ne("`","{:string}",{createAtom:e=>{var t;return new za(h(d({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(t={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"}[e.args[0]])?t:"`"}))}}),ne("'","{:string}",{createAtom:e=>{var t;return new za(h(d({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(t={a:"á",e:"é",i:"í",o:"ó",u:"ú",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú"}[e.args[0]])?t:"'"}))}}),ne('"',"{:string}",{createAtom:e=>{var t,n;return new za(h(d({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(null==(t=e.args)?void 0:t[0])?null!=(n={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",A:"Ä",E:"Ë",I:"Ë",O:"Ö",U:"Ü"}[e.args[0]])?n:'"'+e.args[0]:'"'}))}}),ne(".","{:string}",{createAtom:e=>{var t,n;return new za(h(d({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(null==(t=e.args)?void 0:t[0])?null!=(n={a:"ȧ",e:"ė",i:"̇i",o:"ȯ",u:"̇u",A:"Ȧ",E:"Ė",I:"İ",O:"Ȯ",U:"̇U"}[e.args[0]])?n:"."+e.args[0]:"."}))}}),ne("=","{:string}",{createAtom:e=>{var t,n;return new za(h(d({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(null==(t=e.args)?void 0:t[0])?null!=(n={a:"ā",e:"ē",i:"ī",o:"ō",u:"ū",A:"Ā",E:"Ē",I:"Ī",O:"Ō",U:"Ū"}[e.args[0]])?n:"="+e.args[0]:"="}))}}),ne("~","{:string}",{createAtom:e=>{var t;return new za(h(d({type:"mord"},e),{isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(t={n:"ñ",N:"Ñ",a:"ã",o:"õ",A:"Ã",O:"Õ"}[e.args[0]])?t:"´"}))}}),ne("c","{:string}",{createAtom:e=>{var t;return new za(h(d({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(t={c:"ç",C:"Ç"}[e.args[0]])?t:""}))}}),ne("enclose","{notation:string}[style:string]{body:auto}",{createAtom:e=>{var t,n;const i=e.args,o={strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"none",svgStrokeStyle:void 0,borderStyle:void 0,style:null!=(t=e.style)?t:{}};if(i[1]){const e=i[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const t of e){const e=t.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(e)o.strokeWidth=e[1],o.strokeStyle=e[2],o.strokeColor=e[3];else{const e=t.match(/\s*([a-z]*)\s*=\s*"(.*)"/);e&&("mathbackground"===e[1]?o.backgroundcolor=e[2]:"mathcolor"===e[1]?o.strokeColor=e[2]:"padding"===e[1]?o.padding=e[2]:"shadow"===e[1]&&(o.shadow=e[2]))}}"dashed"===o.strokeStyle?o.svgStrokeStyle="5,5":"dotted"===o.strokeStyle&&(o.svgStrokeStyle="1,5")}o.borderStyle=`${o.strokeWidth} ${o.strokeStyle} ${o.strokeColor}`;const r={};return(null!=(n=i[0])?n:"").split(/[, ]/).filter((e=>e.length>0)).forEach((e=>{r[e.toLowerCase()]=!0})),new al(e.command,O(i[2]),r,o)}}),ne("cancel","{body:auto}",{createAtom:e=>{var t;return new al(e.command,O(e.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(t=e.style)?t:{}})}}),ne("bcancel","{body:auto}",{createAtom:e=>{var t;return new al(e.command,O(e.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(t=e.style)?t:{}})}}),ne("xcancel","{body:auto}",{createAtom:e=>{var t;return new al(e.command,O(e.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(t=e.style)?t:{}})}}),ne(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:e=>{var t;return new ml(h(d({},e),{body:O(null==(t=e.args)?void 0:t[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:e.command.slice(1)}))}}),ne("overbrace","{:auto}",{createAtom:e=>new ml(h(d({},e),{body:O(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:e.command.slice(1)}))}),ne(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:e=>new ml(h(d({},e),{body:O(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:e.command.slice(1)}))}),ne(["underbrace"],"{:auto}",{createAtom:e=>new ml(h(d({},e),{body:O(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:e.command.slice(1)}))}),ne(["xrightarrow","longrightarrow","xleftarrow","longleftarrow","xRightarrow","xLeftarrow","xleftharpoonup","xleftharpoondown","xrightharpoonup","xrightharpoondown","xlongequal","xtwoheadleftarrow","xtwoheadrightarrow","xleftrightarrow","longleftrightarrow","xLeftrightarrow","xrightleftharpoons","longrightleftharpoons","xleftrightharpoons","xhookleftarrow","xhookrightarrow","xmapsto","xtofrom","xleftrightarrows","longleftrightarrows","xRightleftharpoons","longRightleftharpoons","xLeftrightharpoons","longLeftrightharpoons"],"[:auto]{:auto}",{createAtom:e=>{var t,n,i,o,r;return new ml(h(d({},e),{svgBody:e.command.slice(1),above:0===(null==(n=O(null==(t=e.args)?void 0:t[1]))?void 0:n.length)?void 0:O(null==(i=e.args)?void 0:i[1]),below:null!=(r=O(null==(o=e.args)?void 0:o[0]))?r:null,skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,paddedLabels:!0,boxType:"rel"}))},serialize:(e,t)=>e.command+(e.hasEmptyBranch("below")?"":`[${e.belowToLatex(t)}]`)+`{${e.aboveToLatex(t)}}${e.supsubToLatex(t)}`}),ne(["arccos","arcsin","arctan","arctg","arcctg","arg","ch","cos","cosh","cot","cotg","coth","ctg","cth","csc","cosec","deg","dim","exp","gcd","hom","inf","ker","lb","lg","ln","log","Pr","sec","sh","sin","sinh","sup","tan","tanh","tg","th","arcsec","arccsc","arsinh","arcosh","artanh","arcsech","arccsch"],"",{isFunction:!0,ifMode:"math",createAtom:e=>new Sl(e.command.slice(1),h(d({},e),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),ne(["liminf","limsup"],"",{ifMode:"math",createAtom:e=>new Sl({"\\liminf":"lim inf","\\limsup":"lim sup"}[e.command],h(d({},e),{limits:"over-under",variant:"main"}))}),ne(["lim","mod"],"",{ifMode:"math",createAtom:e=>new Sl(e.command.slice(1),h(d({},e),{limits:"over-under",variant:"main"}))}),ne(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:e=>new Sl(e.command.slice(1),h(d({},e),{limits:"over-under",isFunction:!0,variant:"main"}))}),ne(["ang"],"{:math}",{ifMode:"math",createAtom:e=>new za(h(d({},e),{body:O(e.args[0])})),serialize:(e,t)=>`\\ang{${e.bodyToLatex(t)}}`,render:(e,t)=>{const n=e.createBox(t),i=n.caret;n.caret=void 0;const o=new da("°",{style:h(d({},e.style),{variant:"normal",variantStyle:"up"})});return new da([n,o],{type:"inner",isSelected:e.isSelected,caret:i})}}),ne("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:e=>new bl(h(d({},e),{body:O(e.args[1]),index:e.args[0]?O(e.args[0]):void 0}))}),ne(["frac","dfrac","tfrac","cfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:e=>{const t=d({},e),n=e.command,i=e.args;switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":t.hasBarLine=!0;break;case"\\atopfrac":t.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":t.hasBarLine=!1,t.leftDelim="(",t.rightDelim=")";break;case"\\cfrac":t.hasBarLine=!0,t.continuousFraction=!0}switch(n){case"\\dfrac":case"\\dbinom":t.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":t.mathstyleName="textstyle"}return new cl(i[0]?O(i[0]):[new Ds],i[1]?O(i[1]):[new Ds],t)},serialize:(e,t)=>{const n=e.aboveToLatex(t),i=e.belowToLatex(t);return/^[0-9]$/.test(n)&&/^[0-9]$/.test(i)?`${e.command}${n}${i}`:Qr(e.command,n,i)}}),ne(["brace","brack"],"",{infix:!0,createAtom:e=>new cl(O(e.args[0]),O(e.args[1]),h(d({},e),{hasBarLine:!1,leftDelim:"\\brace"===e.command?"\\lbrace":"\\lbrack",rightDelim:"\\brace"===e.command?"\\rbrace":"\\rbrack"})),serialize:(e,t)=>Yr([e.aboveToLatex(t),e.command,e.belowToLatex(t)])}),ne(["over","atop","choose"],"",{infix:!0,createAtom:e=>{let t,n;const i=e.args;return"\\choose"===e.command&&(t="(",n=")"),new cl(O(i[0]),O(i[1]),h(d({},e),{hasBarLine:"\\over"===e.command,leftDelim:t,rightDelim:n}))},serialize:(e,t)=>Yr([e.aboveToLatex(t),e.command,e.belowToLatex(t)])}),ne(["overwithdelims","atopwithdelims"],"{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}",{infix:!0,createAtom:e=>{var t,n;const i=e.args;return new cl(O(i[0]),O(i[1]),h(d({},e),{leftDelim:null!=(t=i[2])?t:".",rightDelim:null!=(n=i[3])?n:".",hasBarLine:!1}))},serialize:(e,t)=>`${e.aboveToLatex(t)} ${e.command}${e.leftDelim}${e.rightDelim}${e.belowToLatex(t)}`}),ne("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:e=>new cl(O(e.args[0]),O(e.args[1]),h(d({},e),{hasBarLine:!0,numerPrefix:"∂",denomPrefix:"∂"}))}),ne(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:e=>new ul({coprod:"∐",bigvee:"⋁",bigwedge:"⋀",biguplus:"⨄",bigcap:"⋂",bigcup:"⋃",intop:"∫",prod:"∏",sum:"∑",bigotimes:"⨂",bigoplus:"⨁",bigodot:"⨀",bigsqcup:"⨆",smallint:"∫"}[e.command.slice(1)],h(d({},e),{limits:"auto",variant:"main"}))}),ne("smallint","",{ifMode:"math",createAtom:e=>new Sl("∫",h(d({},e),{limits:"adjacent",variant:"main"}))});var Xh={int:"∫",iint:"∬",iiint:"∭",oint:"∮",oiint:"∯",oiiint:"∰",intclockwise:"∱",varointclockwise:"∲",ointctrclockwise:"∳",intctrclockwise:"⨑",sqcup:"⊔",sqcap:"⊓",uplus:"⊎",wr:"≀",amalg:"⨿",Cap:"⋒",Cup:"⋓",doublecap:"⋒",doublecup:"⋓"};ne(Object.keys(Xh),"",{ifMode:"math",createAtom:e=>{const t=e.command,n=Xh[t.slice(1)];return new ul(n,h(d({},e),{limits:"adjacent",variant:{"⋒":"ams","⋓":"ams"}[n]}))}}),ne(["Re","Im"],"",{ifMode:"math",createAtom:e=>new Sl({"\\Re":"ℜ","\\Im":"ℑ"}[e.command],h(d({},e),{limits:"adjacent",isFunction:!0,variant:"fraktur"}))}),ne("middle","{:delim}",{ifMode:"math",createAtom:e=>{var t;return new ol(h(d({},e),{delim:null!=(t=e.args[0])?t:"|",size:1}))}}),ne("the","{:value}",{createAtom:e=>new za(h(d({},e),{captureSelection:!0,verbatimLatex:null})),render:(e,t)=>{var n;const i=new Ea({parent:t},e.style);let o="";e.isSelected&&(o+=" ML__selected");const r=i.evaluate(e.args[0]);return new da((null!=(n=ka(r))?n:"").split("").map((t=>new da(t,{type:"ord",classes:o,mode:e.mode,isSelected:e.isSelected,style:d({variant:"main"},e.style)}))),{type:"lift",style:e.style,caret:e.caret,isSelected:e.isSelected,classes:o}).wrap(i)},serialize:e=>{var t;return`\\the${null!=(t=ka(e.args[0]))?t:"\\relax"}`}}),ne("mathtip","{:auto}{:math}",{createAtom:e=>new Ml(h(d({},e),{body:O(e.args[0]),tooltip:O(e.args[1]),content:"math"})),serialize:(e,t)=>t.skipStyles?e.bodyToLatex(t):`\\texttip{${e.bodyToLatex(t)}}{${za.serialize([e.tooltip],h(d({},t),{defaultMode:"math"}))}}`}),ne("texttip","{:auto}{:text}",{createAtom:e=>new Ml(h(d({},e),{body:O(e.args[0]),tooltip:O(e.args[1]),content:"text"})),serialize:(e,t)=>t.skipStyles?e.bodyToLatex(t):`\\texttip{${e.bodyToLatex(t)}}{${za.serialize([e.tooltip],h(d({},t),{defaultMode:"text"}))}}`}),ne("error","{:math}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[0])})),serialize:(e,t)=>`\\error{${e.bodyToLatex(t)}}`,render:(e,t)=>e.createBox(t,{classes:"ML__error"})}),ne("ensuremath","{:math}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[0])})),serialize:(e,t)=>`${e.command}{${e.bodyToLatex(h(d({},t),{defaultMode:"math"}))}}`}),ne("color","{:value}",{applyStyle:(e,t,n)=>{var i,o;return{verbatimColor:null!=(i=ka(t[0]))?i:void 0,color:n.toColor(null!=(o=t[0])?o:{string:"red"})}}}),ne("textcolor","{:value}{content:auto*}",{applyStyle:(e,t,n)=>{var i,o;return{verbatimColor:null!=(i=ka(t[0]))?i:void 0,color:n.toColor(null!=(o=t[0])?o:{string:"red"})}}}),ne("boxed","{content:math}",{createAtom:e=>new Fs(h(d({},e),{body:O(e.args[0]),framecolor:{string:"black"}}))}),ne("colorbox","{:value}{:text*}",{applyStyle:(e,t,n)=>{var i,o;return{verbatimBackgroundColor:null!=(i=ka(t[0]))?i:void 0,backgroundColor:n.toBackgroundColor(null!=(o=t[0])?o:{string:"yellow"})}}}),ne("fcolorbox","{frame-color:value}{background-color:value}{content:text}",{applyMode:"text",createAtom:e=>{var t,n;return new Fs(h(d({},e),{body:O(e.args[2]),framecolor:null!=(t=e.args[0])?t:{string:"blue"},backgroundcolor:null!=(n=e.args[1])?n:{string:"yellow"}}))},serialize:(e,t)=>{var n,i;return t.skipStyles?e.bodyToLatex(h(d({},t),{defaultMode:"text"})):Qr(e.command,null!=(n=ka(e.framecolor))?n:"",null!=(i=ka(e.backgroundcolor))?i:"",e.bodyToLatex(h(d({},t),{defaultMode:"text"})))}}),ne("bbox","[:bbox]{body:auto}",{createAtom:e=>{var t;const n=e.args[0],i=O(e.args[1]);return new Fs(h(d({},e),n?{body:i,padding:n.padding,border:n.border,backgroundcolor:null!=(t=n.backgroundcolor)?t:void 0}:{body:i}))},serialize:(e,t)=>{var n,i;if(t.skipStyles)return e.bodyToLatex(t);let o=e.command;if(Number.isFinite(e.padding)||void 0!==e.border||void 0!==e.backgroundcolor){const t=[];e.padding&&t.push(null!=(n=ka(e.padding))?n:""),e.border&&t.push(`border: ${e.border}`),e.backgroundcolor&&t.push(null!=(i=ka(e.backgroundcolor))?i:""),o+=`[${t.join(",")}]`}return Qr(o,e.bodyToLatex(t))}}),ne(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[0])})),render:(e,t)=>{const n=new Ea({parent:t,mathstyle:e.command.slice(1)},e.style),i=za.createBox(n,e.body,{type:"lift"});return e.caret&&(i.caret=e.caret),e.bind(t,i)},serialize:(e,t)=>t.skipStyles?e.bodyToLatex(t):`{${Yr([e.command,e.bodyToLatex(t)])}}`}),ne(["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"],"",{applyStyle:e=>({fontSize:{"\\tiny":1,"\\scriptsize":2,"\\footnotesize":3,"\\small":4,"\\normalsize":5,"\\large":6,"\\Large":7,"\\LARGE":8,"\\huge":9,"\\Huge":10}[e]})}),ne("fontseries","{:string}",{ifMode:"text",applyStyle:(e,t)=>{var n;return{fontSeries:null!=(n=t[0])?n:"auto"}}}),ne("fontshape","{:string}",{ifMode:"text",applyStyle:(e,t)=>{var n;return{fontShape:null!=(n=t[0])?n:"auto"}}}),ne("fontfamily","{:string}",{ifMode:"text",applyStyle:(e,t)=>{var n;return{fontFamily:null!=(n=t[0])?n:"roman"}}}),ne("selectfont","",{ifMode:"text",applyStyle:()=>({})}),ne("bf","{:rest}",{applyStyle:()=>({fontSeries:"b",fontShape:"n",fontFamily:"roman"})}),ne(["boldsymbol","bm"],"{:math}",{applyMode:"math",createAtom:e=>new za(h(d({},e),{body:O(e.args[0])})),serialize:(e,t)=>`${e.command}{${e.bodyToLatex(t)}}`,render:(e,t)=>e.createBox(t,{classes:"ML__boldsymbol"})}),ne("bold","{:math*}",{applyMode:"math",applyStyle:()=>({variantStyle:"bold"})}),ne("bfseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),ne("mdseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),ne("upshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),ne("slshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),ne("scshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),ne("textbf","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),ne("textmd","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),ne("textup","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),ne("textnormal","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n",fontSeries:"m"})}),ne("textsl","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),ne("textit","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"it"})}),ne("textsc","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),ne("textrm","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"roman"})}),ne("textsf","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"sans-serif"})}),ne("texttt","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"monospace"})}),ne("mathbf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"bold"})}),ne("mathit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"italic"})}),ne("mathnormal","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"italic"})}),ne("mathbfit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"bolditalic"})}),ne("mathrm","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"up"})}),ne("mathsf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"sans-serif",variantStyle:"up"})}),ne("mathtt","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"monospace",variantStyle:"up"})}),ne("it","{:rest}",{applyStyle:()=>({fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})}),ne("rmfamily","",{applyStyle:()=>({fontFamily:"roman"})}),ne("sffamily","",{applyStyle:()=>({fontFamily:"sans-serif"})}),ne("ttfamily","",{applyStyle:()=>({fontFamily:"monospace"})}),ne(["Bbb","mathbb"],"{:math*}",{applyStyle:()=>({variant:"double-struck",variantStyle:"up"})}),ne(["frak","mathfrak"],"{:math*}",{applyStyle:()=>({variant:"fraktur",variantStyle:"up"})}),ne("mathcal","{:math*}",{applyStyle:()=>({variant:"calligraphic",variantStyle:"up"})}),ne("mathscr","{:math*}",{applyStyle:()=>({variant:"script",variantStyle:"up"})}),ne("mbox","{:text}",{ifMode:"math",createAtom:e=>new za(h(d({},e),{type:"mord",body:O(e.args[0]),mode:"math"})),serialize:(e,t)=>Qr("\\mbox",e.bodyToLatex(h(d({},t),{defaultMode:"text"})))}),ne("text","{:text}",{ifMode:"math",applyMode:"text"}),ne(["class","htmlClass"],"{name:string}{content:auto}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[1])})),serialize:(e,t)=>!e.args[0]||t.skipStyles?e.bodyToLatex(t):`${e.command}{${e.args[0]}}{${e.bodyToLatex(t)}}`,render:(e,t)=>{var n;return e.createBox(t,{classes:null!=(n=e.args[0])?n:""})}}),ne(["cssId","htmlId"],"{id:string}{content:auto}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[1])})),serialize:(e,t)=>{var n;return!(null==(n=e.args)?void 0:n[0])||t.skipStyles?e.bodyToLatex(t):`${e.command}{${e.args[0]}}{${e.bodyToLatex(t)}}`},render:(e,t)=>{var n;const i=e.createBox(t);return i.cssId=null!=(n=e.args[0])?n:"",i}}),ne("htmlData","{data:string}{content:auto}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[1])})),serialize:(e,t)=>{var n;return!(null==(n=e.args)?void 0:n[0])||t.skipStyles?e.bodyToLatex(t):`\\htmlData{${e.args[0]}}{${e.bodyToLatex(t)}}`},render:(e,t)=>{var n;const i=e.createBox(t);return i.htmlData=null!=(n=e.args[0])?n:"",i}}),ne(["style","htmlStyle"],"{data:string}{content:auto}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[1])})),serialize:(e,t)=>{var n;return!(null==(n=e.args)?void 0:n[0])||t.skipStyles?e.bodyToLatex(t):`${e.command}{${e.args[0]}}{${e.bodyToLatex(t)}}`},render:(e,t)=>{var n;const i=e.createBox(t);return i.htmlStyle=null!=(n=e.args[0])?n:"",i}}),ne("em","{:rest}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[0])})),serialize:(e,t)=>t.skipStyles?e.bodyToLatex(t):`{\\em ${e.bodyToLatex(t)}}`,render:(e,t)=>e.createBox(t,{classes:"ML__emph",boxType:"lift"})}),ne("emph","{:auto}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[1])})),serialize:(e,t)=>t.skipStyles?e.bodyToLatex(t):`\\emph{${e.bodyToLatex(t)}}`,render:(e,t)=>e.createBox(t,{classes:"ML__emph",boxType:"lift"})});var Gh={"\\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}};ne(["bigl","Bigl","biggl","Biggl","bigr","Bigr","biggr","Biggr","bigm","Bigm","biggm","Biggm","big","Big","bigg","Bigg"],"{:delim}",{createAtom:e=>{var t;return new rl(h(d({},e),{delim:null!=(t=e.args[0])?t:".",size:Gh[e.command].size,delimType:Gh[e.command].mclass}))}}),ne(["hspace","hspace*"],"{width:value}",{createAtom:e=>{var t;return new gl(h(d({},e),{width:null!=(t=e.args[0])?t:{dimension:0}}))}}),ne(["mkern","kern","mskip","hskip","mspace"],"{width:value}",{createAtom:e=>{var t;return new gl(h(d({},e),{width:null!=(t=e.args[0])?t:{dimension:0}}))}}),ne("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:e=>new za(e),render:(e,t)=>{let n=0;const i=t.mathstyle.id;5!==i&&4!==i||(n=1),3!==i&&2!==i||(n=2),1!==i&&0!==i||(n=3);const o=O(e.args[n]);return za.createBox(t,o)},serialize:(e,t)=>`\\mathchoice{${za.serialize(e.args[0],t)}}{${za.serialize(e.args[1],t)}}{${za.serialize(e.args[2],t)}}{${za.serialize(e.args[3],t)}}`}),ne("mathop","{:auto}",{createAtom:e=>new za(h(d({},e),{type:"mop",body:O(e.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(e,t)=>{var n;let i=za.createBox(t,e.body);if(e.superscript||e.subscript){const o=null!=(n=e.subsupPlacement)?n:"auto";i="over-under"===o||"auto"===o&&t.isDisplayStyle?e.attachLimits(t,{base:i}):e.attachSupsub(t,{base:i})}return new da(e.bind(t,i),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,t)=>{const n=[Qr(e.command,e.bodyToLatex(t))];return e.explicitSubsupPlacement&&("over-under"===e.subsupPlacement&&n.push("\\limits"),"adjacent"===e.subsupPlacement&&n.push("\\nolimits"),"auto"===e.subsupPlacement&&n.push("\\displaylimits")),n.push(e.supsubToLatex(t)),Yr(n)}}),ne(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:e=>new za(h(d({},e),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[e.command],body:O(e.args[0])}))}),ne(["operatorname","operatorname*"],"{operator:math}",{createAtom:e=>{const t=O(e.args[0]).map((e=>{var t;return"first"!==e.type&&(e.type="mord",e.value=null!=(t={"∗":"*","−":"-"}[e.value])?t:e.value,e.isFunction=!1,e.style.variant||e.style.variantStyle||(e.style.variant="main",e.style.variantStyle="up")),e}));return new za(h(d({},e),{type:"mop",body:t,isFunction:!0,limits:"\\operatorname"===e.command?"adjacent":"over-under"}))},render:(e,t)=>{var n;let i=za.createBox(t,e.body);if(e.superscript||e.subscript){const o=null!=(n=e.subsupPlacement)?n:"auto";i="over-under"===o||"auto"===o&&t.isDisplayStyle?e.attachLimits(t,{base:i}):e.attachSupsub(t,{base:i})}return e.caret&&(i.caret=e.caret),new da(e.bind(t,i),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,t)=>{const n=[Qr(e.command,e.bodyToLatex(t))];return e.explicitSubsupPlacement&&("over-under"===e.subsupPlacement&&n.push("\\limits"),"adjacent"===e.subsupPlacement&&n.push("\\nolimits"),"auto"===e.subsupPlacement&&n.push("\\displaylimits")),n.push(e.supsubToLatex(t)),Yr(n)}}),ne(["char","unicode"],"{charcode:value}",{createAtom:e=>new za(h(d({},e),{type:"text"===e.mode?"text":"mord"})),serialize:e=>{var t;return`${e.command}${ka(null!=(t=e.args[0])?t:{number:10067,base:"hexadecimal"})}`},render:(e,t)=>{let n=t.evaluate(e.args[0]);return n&&"number"in n||(n={number:10067,base:"hexadecimal"}),e.value=String.fromCodePoint(n.number),e.createBox(t)}}),ne("rule","[raise:value]{width:value}{thickness:value}",{createAtom:e=>new za(e),render:(e,t)=>{var n,i,o;const r=new Ea({parent:t,mathstyle:"textstyle"},e.style),a=r.toEm(null!=(n=e.args[0])?n:{dimension:0}),s=r.toEm(null!=(i=e.args[1])?i:{dimension:10}),l=r.toEm(null!=(o=e.args[2])?o:{dimension:10}),c=new da(null,{classes:"rule",type:"ord"});return c.width=s,c.height=l+a,c.depth=-a,c.setStyle("border-right-width",s,"em"),c.setStyle("border-top-width",l,"em"),c.setStyle("border-color",e.style.color),c.setStyle("vertical-align",a,"em"),e.isSelected&&c.setStyle("opacity","50%"),e.bind(r,c),e.caret&&(c.caret=e.caret),c.wrap(t)},serialize:e=>`\\rule${e.args[0]?`[${ka(e.args[0])}]`:""}{${ka(e.args[1])}}{${ka(e.args[2])}}`}),ne(["overline","underline"],"{:auto}",{createAtom:e=>new za(h(d({},e),{body:O(e.args[0])})),render:(e,t)=>{const n=e.command.substring(1),i=new Ea({parent:t,mathstyle:"cramp"},e.style),o=za.createBox(i,e.body);if(!o)return null;const r=i.metrics.defaultRuleThickness/i.scalingFactor,a=new da(null,{classes:n+"-line"});let s;return a.height=r,a.maxFontSize=1.125*r*i.scalingFactor,s=new ga("overline"===n?{shift:0,children:[{box:o},3*r,{box:a},r]}:{top:o.height,children:[r,{box:a},3*r,{box:o}]}),e.caret&&(s.caret=e.caret),new da(s,{classes:n,type:"ignore"})}}),ne("overset","{:auto}{base:auto}",{createAtom:e=>{const t=O(e.args[1]);return new ml(h(d({},e),{above:O(e.args[0]),body:t,skipBoundary:!1,boxType:la(t)}))},serialize:(e,t)=>Qr(e.command,e.aboveToLatex(t),e.bodyToLatex(t))}),ne("underset","{:auto}{base:auto}",{createAtom:e=>{const t=O(e.args[1]);return new ml(h(d({},e),{below:O(e.args[0]),body:t,skipBoundary:!1,boxType:la(t)}))},serialize:(e,t)=>Qr(e.command,e.belowToLatex(t),e.bodyToLatex(t))}),ne("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:e=>{const t=O(e.args[2]);return new ml(h(d({},e),{above:O(e.args[0]),below:O(e.args[1]),body:t,skipBoundary:!1,boxType:la(t)}))},serialize:(e,t)=>Qr(e.command,e.belowToLatex(t),e.bodyToLatex(t))}),ne(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:e=>new ml(h(d({},e),{body:O(e.args[2]),above:O(e.args[1]),below:O(e.args[0]),skipBoundary:!1,boxType:"\\stackrel"===e.command?"rel":"bin"})),serialize:(e,t)=>Qr(e.command,e.aboveToLatex(t),e.bodyToLatex(t))}),ne("smash","[:string]{:auto}",{createAtom:e=>{var t,n,i,o;return new fl(h(d({},e),{body:O(e.args[1]),smashHeight:null==(n=null==(t=e.args[0])?void 0:t.includes("t"))||n,smashDepth:null==(o=null==(i=e.args[0])?void 0:i.includes("b"))||o}))}}),ne(["vphantom"],"{:auto}",{createAtom:e=>new fl(h(d({},e),{body:O(e.args[0]),isInvisible:!0,smashWidth:!0}))}),ne(["hphantom"],"{:auto}",{createAtom:e=>new fl(h(d({},e),{body:O(e.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),ne(["phantom"],"{:auto}",{createAtom:e=>new fl(h(d({},e),{body:O(e.args[0]),isInvisible:!0}))}),ne("not","{:math}",{createAtom:e=>{const t=O(e.args[0]);return 0===t.length?new za(h(d({},e),{type:"mrel",value:""})):new za(h(d({},e),{body:[new pl(h(d({},e),{body:"",align:"right"})),...t],captureSelection:!0}))},serialize:(e,t)=>{const n=e.args[0],i=n&&"object"==typeof n&&"group"in n;return""!==e.value?i?`\\not{${za.serialize(n.group,t)}}`:`\\not${za.serialize(n,t)}`:i?"\\not{}":"\\not"},render:(e,t)=>{if(e.value)return e.createBox(t);const n=e.args[0]&&"object"==typeof e.args[0]&&"group"in e.args[0]?"ord":la(O(e.args[0])),i=za.createBox(t,e.body,{type:n});return e.caret&&(i.caret=e.caret),e.bind(t,i)}}),ne(["ne","neq"],"",{createAtom:e=>new za(h(d({},e),{type:"mrel",body:[new pl(h(d({},e),{body:"",align:"right",boxType:"rel"})),new za(h(d({},e),{value:"="}))],captureSelection:!0})),serialize:e=>e.command}),ne("rlap","{:auto}",{createAtom:e=>new pl(h(d({},e),{body:O(e.args[0]),align:"right"}))}),ne("llap","{:auto}",{createAtom:e=>new pl(h(d({},e),{body:O(e.args[0]),align:"left"}))}),ne("mathrlap","{:math}",{createAtom:e=>new pl(h(d({},e),{body:O(e.args[0]),align:"left"}))}),ne("mathllap","{:math}",{createAtom:e=>new pl(h(d({},e),{body:O(e.args[0]),align:"left"}))}),ne("raisebox","{:value}{:text}",{createAtom:e=>{var t;return new Fs(h(d({},e),{body:O(e.args[1]),padding:{dimension:0},offset:null!=(t=e.args[0])?t:{dimension:0}}))},serialize:(e,t)=>{var n;return Qr("\\raisebox",null!=(n=ka(e.offset))?n:"0pt",e.bodyToLatex(t))}}),ne("raise","{:value}{:auto}",{createAtom:e=>{var t;return new Fs(h(d({},e),{body:O(e.args[1]),padding:{dimension:0},offset:null!=(t=e.args[0])?t:{dimension:0}}))},serialize:(e,t)=>{var n;return Qr("\\raise",null!=(n=ka(e.offset))?n:"0pt",e.bodyToLatex(t))}}),ne("lower","{:value}{:auto}",{createAtom:e=>{var t;return new Fs(h(d({},e),{body:O(e.args[1]),padding:{dimension:0},offset:null!=(t=Ma(e.args[0],-1))?t:{dimension:0}}))},serialize:(e,t)=>{var n,i;return Qr("\\lower",null!=(i=ka(Ma(null!=(n=e.offset)?n:{dimension:0},-1)))?i:"0pt",e.bodyToLatex(t))}}),X("0123456789/@.?!"),G(65,90),G(97,122),X([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),X([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),X([["\\backslash",92],["\\nabla",8711],["\\partial",8706],["\\ell",8467],["\\hbar",8463],["\\Q",81,"mord","double-struck"],["\\C",67,"mord","double-struck"],["\\P",80,"mord","double-struck"],["\\pounds",163],["\\euro",8364]]),X([["\\rightarrow",8594],["\\to",8594],["\\leftarrow",8592],["\\gets",8592],["\\Rightarrow",8658],["\\Leftarrow",8656],["\\longrightarrow",10230],["\\longleftarrow",10229],["\\Longrightarrow",10233],["\\implies",10233],["\\Longleftarrow",10232],["\\impliedby",10232],["\\longleftrightarrow",10231],["\\biconditional",10231],["\\Longleftrightarrow",10234],["\\mapsto",8614],["\\longmapsto",10236],["\\uparrow",8593],["\\downarrow",8595],["\\Uparrow",8657],["\\Downarrow",8659],["\\updownarrow",8597],["\\Updownarrow",8661],["\\hookrightarrow",8618],["\\hookleftarrow",8617],["\\rightharpoonup",8640],["\\leftharpoonup",8636],["\\rightharpoondown",8641],["\\leftharpoondown",8637],["\\searrow",8600],["\\nearrow",8599],["\\swarrow",8601],["\\nwarrow",8598],["\\originalof",8886],["\\laplace",8886],["\\imageof",8887],["\\Laplace",8887]],"mrel"),X([["\\mapsfrom",8612,"mrel"],["\\Mapsfrom",10502,"mrel"],["\\MapsTo",10503,"mrel"],["\\Yup",8516,"mord"],["\\lightning",8623,"mrel"],["\\leftarrowtriangle",8701,"mrel"],["\\rightarrowtriangle",8702,"mrel"],["\\leftrightarrowtriangle",8703,"mrel"],["\\boxdot",8865,"mbin"],["\\bigtriangleup",9651,"mbin"],["\\bigtriangledown",9661,"mbin"],["\\boxbar",9707,"mbin"],["\\Lbag",10181,"mopen"],["\\Rbag",10182,"mclose"],["\\llbracket",10214,"mopen"],["\\rrbracket",10215,"mclose"],["\\longmapsfrom",10235,"mrel"],["\\Longmapsfrom",10237,"mrel"],["\\Longmapsto",10238,"mrel"],["\\boxslash",10692,"mbin"],["\\boxbslash",10693,"mbin"],["\\boxast",10694,"mbin"],["\\boxcircle",10695,"mbin"],["\\boxbox",10696,"mbin"],["\\fatsemi",10783,"mop"],["\\leftslice",10918,"mrel"],["\\rightslice",10919,"mrel"],["\\interleave",10996,"mbin"],["\\biginterleave",11004,"mop"],["\\sslash",11005,"mbin"],["\\talloblong",11006,"mbin"]]),X([["\\lbrace",123,"mopen"],["\\rbrace",125,"mclose"],["\\lparen",40,"mopen"],["\\rparen",41,"mclose"],["\\langle",10216,"mopen"],["\\rangle",10217,"mclose"],["\\lfloor",8970,"mopen"],["\\rfloor",8971,"mclose"],["\\lceil",8968,"mopen"],["\\rceil",8969,"mclose"],["\\vert",8739],["\\lvert",8739,"mopen"],["\\rvert",8739,"mclose"],["\\|",8741],["\\Vert",8741],["\\mVert",8741],["\\lVert",8741,"mopen"],["\\rVert",8741,"mclose"],["\\lbrack",91,"mopen"],["\\rbrack",93,"mclose"],["\\{",123,"mopen"],["\\}",125,"mclose"],["(",40,"mopen"],[")",41,"mclose"],["[",91,"mopen"],["]",93,"mclose"],["\\ulcorner",9484,"mopen","ams"],["\\urcorner",9488,"mclose","ams"],["\\llcorner",9492,"mopen","ams"],["\\lrcorner",9496,"mclose","ams"],["\\lgroup",10222,"mopen"],["\\rgroup",10223,"mclose"],["\\lmoustache",9136,"mopen"],["\\rmoustache",9137,"mclose"]]),X([["\\dashrightarrow",8674],["\\dashleftarrow",8672],["\\Rrightarrow",8667],["\\Lleftarrow",8666],["\\leftrightarrows",8646],["\\rightleftarrows",8644],["\\curvearrowright",8631],["\\curvearrowleft",8630],["\\rightrightarrows",8649],["\\leftleftarrows",8647],["\\upuparrows",8648],["\\downdownarrows",8650],["\\vartriangle",9651],["\\triangleq",8796],["\\vartriangleleft",8882],["\\trianglelefteq",8884],["\\ntriangleleft",8938],["\\ntrianglelefteq",8940],["\\vartriangleright",8883],["\\trianglerighteq",8885],["\\ntriangleright",8939],["\\ntrianglerighteq",8941],["\\blacktriangleleft",9664],["\\blacktriangleright",9654],["\\leftarrowtail",8610],["\\rightarrowtail",8611],["\\looparrowright",8620],["\\looparrowleft",8619],["\\twoheadleftarrow",8606],["\\twoheadrightarrow",8608],["\\twoheadrightarrowtail",10518],["\\rightleftharpoons",8652],["\\leftrightharpoons",8651],["\\Rsh",8625],["\\Lsh",8624],["\\circlearrowright",8635],["\\circlearrowleft",8634],["\\restriction",8638],["\\upharpoonright",8638],["\\upharpoonleft",8639],["\\downharpoonright",8642],["\\downharpoonleft",8643],["\\rightsquigarrow",8669],["\\leadsto",8669],["\\leftrightsquigarrow",8621],["\\multimap",8888],["\\nleftarrow",8602],["\\nrightarrow",8603],["\\nRightarrow",8655],["\\nLeftarrow",8653],["\\nleftrightarrow",8622],["\\nLeftrightarrow",8654],["\\nvrightarrow",8696],["\\nvtwoheadrightarrow",10496],["\\nvrightarrowtail",10516],["\\nvtwoheadrightarrowtail",10519],["\\shortparallel",8741],["\\nless",8814],["\\nleqslant",57360],["\\lneq",10887],["\\lneqq",8808],["\\nleqq",57361],["\\lvertneqq",57356],["\\lnsim",8934],["\\lnapprox",10889],["\\nprec",8832],["\\npreceq",8928],["\\precnsim",8936],["\\precnapprox",10937],["\\nsim",8769],["\\nshortmid",57350],["\\nmid",8740],["\\nvdash",8876],["\\nvDash",8877],["\\ngtr",8815],["\\ngeqslant",57359],["\\ngeqq",57358],["\\gneq",10888],["\\gneqq",8809],["\\gvertneqq",57357],["\\gnsim",8935],["\\gnapprox",10890],["\\nsucc",8833],["\\nsucceq",8929],["\\succnsim",8937],["\\succnapprox",10938],["\\ncong",8774],["\\nshortparallel",57351],["\\nparallel",8742],["\\nVDash",8879],["\\nsupseteqq",57368],["\\supsetneq",8843],["\\varsupsetneq",57371],["\\supsetneqq",10956],["\\varsupsetneqq",57369],["\\nVdash",8878],["\\precneqq",10933],["\\succneqq",10934],["\\nsubseteqq",57366],["\\leqslant",10877],["\\geqslant",10878],["\\gtrsim",8819],["\\approxeq",8778],["\\thickapprox",8776],["\\lessapprox",10885],["\\gtrapprox",10886],["\\precapprox",10935],["\\succapprox",10936],["\\thicksim",8764],["\\succsim",8831],["\\precsim",8830],["\\backsim",8765],["\\eqsim",8770],["\\backsimeq",8909],["\\lesssim",8818],["\\nleq",8816],["\\ngeq",8817],["\\smallsmile",8995],["\\smallfrown",8994],["\\leqq",8806],["\\eqslantless",10901],["\\lll",8920],["\\lessgtr",8822],["\\lesseqgtr",8922],["\\lesseqqgtr",10891],["\\risingdotseq",8787],["\\fallingdotseq",8786],["\\subseteqq",10949],["\\Subset",8912],["\\sqsubset",8847],["\\preccurlyeq",8828],["\\curlyeqprec",8926],["\\vDash",8872],["\\Vvdash",8874],["\\bumpeq",8783],["\\Bumpeq",8782],["\\geqq",8807],["\\eqslantgtr",10902],["\\ggg",8921],["\\gtrless",8823],["\\gtreqless",8923],["\\gtreqqless",10892],["\\supseteqq",10950],["\\Supset",8913],["\\sqsupset",8848],["\\succcurlyeq",8829],["\\curlyeqsucc",8927],["\\Vdash",8873],["\\shortmid",8739],["\\between",8812],["\\pitchfork",8916],["\\varpropto",8733],["\\backepsilon",8717],["\\llless",8920],["\\gggtr",8921],["\\doteqdot",8785],["\\Doteq",8785],["\\eqcirc",8790],["\\circeq",8791],["\\therefore",8756],["\\because",8757]],"mrel","ams"),X([["+",43],["-",8722],["−",8722],["\\pm",177],["\\mp",8723],["*",8727],["\\times",215],["\\div",247],["\\divides",8739],["\\cdot",8901],["\\cap",8745],["\\cup",8746],["\\setminus",8726],["\\land",8743],["\\wedge",8743],["\\lor",8744],["\\vee",8744],["\\circ",8728],["\\bigcirc",9711],["\\bullet",8729],["\\oplus",8853],["\\ominus",8854],["\\otimes",8855],["\\odot",8857],["\\oslash",8856],["\\bigtriangleup",9651],["\\bigtriangledown",9661],["\\triangleleft",9667],["\\triangleright",9657],["\\And",38],["\\dagger",8224],["\\dag",8224],["\\ddag",8225],["\\ddagger",8225],["\\ast",8727],["\\star",8902],["\\bigstar",9733],["\\diamond",8900]],"mbin"),X([["\\lhd",8882],["\\rhd",8883],["\\lessdot",8918],["\\gtrdot",8919],["\\ltimes",8905],["\\rtimes",8906],["\\leftthreetimes",8907],["\\rightthreetimes",8908],["\\intercal",8890],["\\dotplus",8724],["\\doublebarwedge",10846],["\\divideontimes",8903],["\\centerdot",8901],["\\smallsetminus",8726],["\\barwedge",8892],["\\veebar",8891],["\\nor",8891],["\\curlywedge",8911],["\\curlyvee",8910],["\\boxminus",8863],["\\boxplus",8862],["\\boxtimes",8864],["\\boxdot",8865],["\\circleddash",8861],["\\circledast",8859],["\\circledcirc",8858],["\\unlhd",8884],["\\unrhd",8885]],"mbin","ams"),X([["\\surd",8730],["\\infty",8734],["\\prime",8242],["\\doubleprime",8243],["\\angle",8736],["`",8216],["\\$",36],["\\%",37],["\\_",95],["\\alpha",945],["\\beta",946],["\\gamma",947],["\\delta",948],["\\epsilon",1013],["\\varepsilon",949],["\\zeta",950],["\\eta",951],["\\theta",952],["\\vartheta",977],["\\iota",953],["\\kappa",954],["\\varkappa",1008,"mord","ams"],["\\lambda",955],["\\mu",956],["\\nu",957],["\\xi",958],["\\omicron",111],["\\pi",960],["\\varpi",982],["\\rho",961],["\\varrho",1009],["\\sigma",963],["\\varsigma",962],["\\tau",964],["\\phi",981],["\\varphi",966],["\\upsilon",965],["\\chi",967],["\\psi",968],["\\omega",969],["\\Gamma",915],["\\Delta",916],["\\Theta",920],["\\Lambda",923],["\\Xi",926],["\\Pi",928],["\\Sigma",931],["\\Upsilon",933],["\\Phi",934],["\\Psi",936],["\\Omega",937],["\\digamma",989,"mord","ams"],["\\emptyset",8709]]),X([["=",61],["<",60],["\\lt",60],[">",62],["\\gt",62],["\\le",8804],["\\leq",8804],["\\ge",8805],["\\geq",8805],["\\ll",8810],["\\gg",8811],["\\coloneq",8788],["\\coloneqq",8788],["\\colonequals",8788],["\\measeq",8797],["\\eqdef",8798],["\\questeq",8799],[":",58],["\\cong",8773],["\\equiv",8801],["\\prec",8826],["\\preceq",10927],["\\succ",8827],["\\succeq",10928],["\\perp",8869],["\\propto",8733],["\\Colon",8759],["\\smile",8995],["\\frown",8994],["\\sim",8764],["\\doteq",8784],["\\bowtie",8904],["\\Join",8904],["\\asymp",8781],["\\sqsubseteq",8849],["\\sqsupseteq",8850],["\\approx",8776],["\\~",126],["\\leftrightarrow",8596],["\\Leftrightarrow",8660],["\\models",8872],["\\vdash",8866],["\\dashv",8867],["\\roundimplies",10608],["\\in",8712],["\\notin",8713],["\\ni",8715],["\\owns",8715],["\\subset",8834],["\\supset",8835],["\\subseteq",8838],["\\supseteq",8839],["\\differencedelta",8710],["\\mvert",8739],["\\parallel",8741],["\\simeq",8771]],"mrel"),X([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),X([["\\wp",8472],["\\aleph",8501]]),X([["\\blacktriangle",9650],["\\hslash",8463],["\\Finv",8498],["\\Game",8513],["\\eth",240],["\\mho",8487],["\\Bbbk",107],["\\yen",165],["\\square",9633],["\\Box",9633],["\\blacksquare",9632],["\\circledS",9416],["\\circledR",174],["\\triangledown",9661],["\\blacktriangledown",9660],["\\checkmark",10003],["\\diagup",9585],["\\measuredangle",8737],["\\sphericalangle",8738],["\\backprime",8245],["\\backdoubleprime",8246],["\\Diamond",9674],["\\lozenge",9674],["\\blacklozenge",10731],["\\varnothing",8709],["\\complement",8705],["\\maltese",10016],["\\beth",8502],["\\daleth",8504],["\\gimel",8503]],"mord","ams"),X([["\\ ",160],["~",160]],"space"),ne(["!",",",":",";",">","enskip","enspace","quad","qquad"],"",{createAtom:e=>new gl(e)}),ne("space","",{createAtom:e=>new gl(e)}),X([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),X([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\mathellipsis",8230]],"minner"),X([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var Zh="<mo>⁡</mo>",Yh="<mo>⁢</mo>";function Qh(e){return e.replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function eu(e,t){return e&&t.generateID?` extid="${e}"`:""}function tu(e,t,n){var i,o,r,a,s,l,c,d,h,u,p;let m=!1;t=null!=t?t:e.atoms.length;let f="",g="",b=e.atoms[e.index];const y=null!=(o=null==(i=b.style)?void 0:i.variant)?o:"",v=null!=(a=null==(r=b.style)?void 0:r.variantStyle)?a:"";let x="";if(y||v){const t=$(b.value,null==(s=b.style)?void 0:s.variant,null==(l=b.style)?void 0:l.variantStyle);if(t!==b.value)return e.index+=1,f=`<mi${eu(b.id,n)}>${t}</mi>`,nu(f,e,n)||(e.mathML+=f,e.lastType="mi"),!0;x=null!=(c={upnormal:"normal",boldnormal:"bold",italicmain:"italic",bolditalicmain:"bold-italic","updouble-struck":"double-struck","double-struck":"double-struck",boldfraktur:"bold-fraktur",calligraphic:"script",upcalligraphic:"script",script:"script",boldscript:"bold-script",boldcalligraphic:"bold-script",fraktur:"fraktur","upsans-serif":"sans-serif","boldsans-serif":"bold-sans-serif","italicsans-serif":"sans-serif-italic","bolditalicsans-serif":"sans-serif-bold-italic",monospace:"monospace"}[v+y])?c:"",x=` mathvariant="${x}"`}const w={"\\exponentialE":"ⅇ","\\imaginaryI":"ⅈ","\\differentialD":"ⅆ","\\capitalDifferentialD":"ⅅ","\\alpha":"α","\\pi":"π","\\infty":"∞","\\forall":"∀","\\nexists":"∄","\\exists":"∃","\\hbar":"ℏ","\\cdotp":"⋅","\\ldots":"…","\\cdots":"⋯","\\ddots":"⋱","\\vdots":"⋮","\\ldotp":"."};if("!"===b.command)return e.index+=1,f="<mo>!</mo>",nu(f,e,n)||(e.mathML+=f,e.lastType="mo"),!0;if(w[b.command]){e.index+=1;let t=`<mi${eu(b.id,n)}${x}>${w[b.command]}</mi>`;return"mi"!==e.lastType&&"mn"!==e.lastType&&"mtext"!==e.lastType&&"fence"!==e.lastType||(t=Yh+t),nu(t,e,n)||(e.mathML+=t,e.lastType="mi"),!0}if("\\operatorname"===b.command)g=cu(b.body),e.index+=1;else if(y||v)for(;e.index<t&&("mord"===b.type||"macro"===b.type)&&!b.isDigit()&&y===(null!=(h=null==(d=b.style)?void 0:d.variant)?h:"")&&v===(null!=(p=null==(u=b.style)?void 0:u.variantStyle)?p:"");)g+=cu([b]),e.index+=1,b=e.atoms[e.index];else"mord"!==b.type&&"macro"!==b.type||b.isDigit()||(g+=cu([b]),e.index+=1);if(g.length>0){m=!0,f=`<mi${x}>${g}</mi>`;const t=e.lastType;f.endsWith(">f</mi>")||f.endsWith(">g</mi>")?(f+=Zh,e.lastType="applyfunction"):e.lastType=/^<mo>(.*)<\/mo>$/.test(f)?"mo":"mi",nu(f,e,n)||("mi"!==t&&"mn"!==t&&"mtext"!==t&&"fence"!==t||(f=Yh+f),e.mathML+=f)}return m}function nu(e,t,n){var i;let o=t.atoms[t.index-1];if(!o)return!1;if(!o.superscript&&!o.subscript){if("subsup"!==(null==(i=t.atoms[t.index])?void 0:i.type))return!1;o=t.atoms[t.index],t.index+=1}const r=t.lastType;t.lastType="";const a=su(o.superscript,n);t.lastType="";const s=su(o.subscript,n);if(t.lastType=r,!a&&!s)return!1;let l="";return a&&s?l=`<msubsup>${e}${s}${a}</msubsup>`:a?l=`<msup>${e}${a}</msup>`:s&&(l=`<msub>${e}${s}</msub>`),t.mathML+=l,t.lastType="",!0}function iu(e,t,n){t=null!=t?t:e.atoms.length;const i=e.index;let o="";for(;e.index<t&&"text"===e.atoms[e.index].mode;)o+=e.atoms[e.index].value?e.atoms[e.index].value:" ",e.index+=1;return o.length>0&&(e.mathML+=`<mtext ${eu(e.atoms[i].id,n)}>${o}</mtext>`,e.lastType="mtext",!0)}function ou(e,t,n){t=null!=t?t:e.atoms.length;const i=e.index;let o="",r=function(e){let t=-1,n=e.index,i=!1,o=!1;for(;n<e.atoms.length&&!i&&!o;){const t=e.atoms[n];i=!t.isDigit(),o=!i&&void 0!==t.superscript,n++}return o&&(t=n-1),t}(e);for(r>=0&&r<t&&(t=r);e.index<t&&e.atoms[e.index].isDigit();)o+=e.atoms[e.index].asDigit(),e.index+=1;return!(o.length<=0)&&(o="<mn"+eu(e.atoms[i].id,n)+">"+o+"</mn>",r<0&&function(e){return e.index<e.atoms.length&&e.atoms[e.index].superscript&&"subsup"===e.atoms[e.index].type}(e)&&(r=e.index,e.index+=1),nu(o,e,n)||(e.mathML+=o,e.lastType="mn"),!0)}function ru(e,t,n){let i=!1;t=null!=t?t:e.atoms.length;let o="",r="";if(e.index<t&&"mopen"===e.atoms[e.index].type){let a=!1,s=0;const l=e.index;let c=-1,d=l+1;for(;d<t&&!a;)"mopen"===e.atoms[d].type?s+=1:"mclose"===e.atoms[d].type&&(s-=1),-1===s&&(a=!0,c=d),d+=1;a&&(o="<mrow>",o+=lu(e.atoms[l],n),o+=su(e.atoms,n,l+1,c),o+=lu(e.atoms[c],n),o+="</mrow>",e.index=c+1,"mi"!==e.lastType&&"mn"!==e.lastType&&"mfrac"!==e.lastType&&"fence"!==e.lastType||(e.mathML+=Yh),nu(o,e,n)&&(i=!0,e.lastType="",o=""),r="fence")}return o.length>0&&(i=!0,e.mathML+=o,e.lastType=r),i}function au(e,t,n){let i=!1;t=null!=t?t:e.atoms.length;let o="",r="";const a=e.atoms[e.index];if(!a)return!1;const s={"\\ne":"≠","\\neq":"&neq;","\\pm":"±","\\times":"×","\\colon":":","\\vert":"|","\\Vert":"∥","\\mid":"∣","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lbrack":"[","\\rbrack":"]","\\lparen":"(","\\rparen":")","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉"};if(s[a.command]){e.index+=1;const t=`<mo${eu(a.id,n)}>${s[a.command]}</mo>`;return nu(t,e,n)||(e.mathML+=t,e.lastType="mo"),!0}if(e.index<t&&("mbin"===a.type||"mrel"===a.type))o+=du(e.atoms[e.index],n),e.index+=1,r="mo";else if(e.index<t&&("mop"===a.type||"operator"===a.type||"extensible-symbol"===a.type)){if("over-under"===a.subsupPlacement&&(a.superscript||a.subscript)){const t=lu(a,n);return a.superscript&&a.subscript?(o+="<munderover>"+t,o+=su(a.subscript,n),o+=su(a.superscript,n),o+="</munderover>"):a.superscript?(o+="<mover>"+t,o+=su(a.superscript,n),o+="</mover>"):a.subscript&&(o+="<munder>"+t,o+=su(a.subscript,n),o+="</munder>"),e.mathML+=o,e.lastType="mo",e.index+=1,!0}{const t=e.atoms[e.index],i="\\operatorname"===t.value,a=i?'<mi class="MathML-Unit"'+eu(t.id,n)+">"+cu(t.value)+"</mi>":lu(t,n);o+=a,i||/^<mo>(.*)<\/mo>$/.test(a)?r=i?"mi":"mo":(o+=Zh,r="applyfunction")}"mi"!==e.lastType&&"mn"!==e.lastType||/^<mo>(.*)<\/mo>$/.test(o)||(o=Yh+o),e.index+=1}return o.length>0&&(i=!0,nu(o,e,n)||(e.mathML+=o,e.lastType=r)),i}function su(e,t,n,i){null!=t||(t={});const o={atoms:[],index:null!=n?n:0,mathML:"",lastType:""};if("number"==typeof e||"boolean"==typeof e)o.mathML=e.toString();else if("string"==typeof e)o.mathML=e;else if(e instanceof za)o.mathML=du(e,t);else if(Array.isArray(e)){o.atoms=e;let n=0;for(i=i||(e?e.length:0);o.index<i;)if(iu(o,i,t)||ou(o,i,t)||tu(o,i,t)||au(o,i,t)||ru(o,i,t))n+=1;else if(o.index<i){let e=du(o.atoms[o.index],t);"mn"===o.lastType&&e.length>0&&"genfrac"===o.atoms[o.index].type&&(e="<mo>⁤</mo>"+e),"genfrac"===o.atoms[o.index].type?o.lastType="mfrac":o.lastType="",o.index+=1,nu(e,o,t)?n+=1:e.length>0&&(o.mathML+=e,n+=1)}n>1&&(o.mathML="<mrow>"+o.mathML+"</mrow>")}return o.mathML}function lu(e,t){let n="";const i=cu(e.value);return i&&(n="<mo"+eu(e.id,t)+">"+i+"</mo>"),n}function cu(e){if(!e)return"";if("string"==typeof e)return Qh(e);if(!Array.isArray(e)&&"string"==typeof e.body)return Qh(e.body);let t="";for(const n of e)"string"==typeof n.value&&(t+=n.value);return Qh(t)}function du(e,t){var n,i,o,r,a,s,l,c,d,h,u,p,m,f,g,b,y,v,x,w,_,k;if("text"===e.mode)return`<mi${eu(e.id,t)}>${e.value}</mi>`;const M={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",longleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",longrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",longrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xleftrightarrows:"⇄",xRightleftharpoons:"⇌",longRightleftharpoons:"⇌",xLeftrightharpoons:"⇋",longLeftrightharpoons:"⇋"},S={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let L,C,E,K,A,D,z="",T="";const{command:B}=e;if("\\error"===e.command)return`<merror${eu(e.id,t)}>${su(e.body,t)}</merror>`;const $={"\\vert":"|","\\Vert":"∥","\\mid":"∣","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉"},P={"\\vec":"⃗","\\acute":"´","\\grave":"`","\\dot":"˙","\\ddot":"¨","\\tilde":"~","\\bar":"¯","\\breve":"˘","\\check":"ˇ","\\hat":"^"};switch(e.type){case"first":case"line":case"overlap":case"subsup":case"phantom":case"composition":case"rule":case"chem":break;case"group":case"root":z=su(e.body,t);break;case"array":if((e.leftDelim&&"."!==e.leftDelim||e.rightDelim&&"."!==e.rightDelim)&&(z+="<mrow>",e.leftDelim&&"."!==e.leftDelim&&(z+="<mo>"+($[e.leftDelim]||e.leftDelim)+"</mo>")),z+="<mtable",e.colFormat){for(z+=' columnalign="',E=0;E<e.colFormat.length;E++)e.colFormat[E].align&&(z+={l:"left",c:"center",r:"right"}[e.colFormat[E].align]+" ");z+='"'}for(z+=">",C=0;C<e.array.length;C++){for(z+="<mtr>",L=0;L<e.array[C].length;L++)z+="<mtd>"+su(e.array[C][L],t)+"</mtd>";z+="</mtr>"}z+="</mtable>",(e.leftDelim&&"."!==e.leftDelim||e.rightDelim&&"."!==e.rightDelim)&&(e.rightDelim&&"."!==e.rightDelim&&(z+="<mo>"+($[e.leftDelim]||e.rightDelim)+"</mo>"),z+="</mrow>");break;case"genfrac":(e.leftDelim||e.rightDelim)&&(z+="<mrow>"),e.leftDelim&&"."!==e.leftDelim&&(z+="<mo"+eu(e.id,t)+">"+($[e.leftDelim]||e.leftDelim)+"</mo>"),e.hasBarLine?(z+="<mfrac>",z+=su(e.above,t)||"<mi> </mi>",z+=su(e.below,t)||"<mi> </mi>",z+="</mfrac>"):(z+="<mtable"+eu(e.id,t)+">",z+="<mtr>"+su(e.above,t)+"</mtr>",z+="<mtr>"+su(e.below,t)+"</mtr>",z+="</mtable>"),e.rightDelim&&"."!==e.rightDelim&&(z+="<mo"+eu(e.id,t)+">"+($[e.rightDelim]||e.rightDelim)+"</mo>"),(e.leftDelim||e.rightDelim)&&(z+="</mrow>");break;case"surd":e.hasEmptyBranch("above")?(z+="<msqrt"+eu(e.id,t)+">",z+=su(e.body,t),z+="</msqrt>"):(z+="<mroot"+eu(e.id,t)+">",z+=su(e.body,t),z+=su(e.above,t),z+="</mroot>");break;case"leftright":const O=e,q=O.leftDelim;z="<mrow>",q&&"."!==q&&(z+=`<mo${eu(e.id,t)}>${null!=(n=$[q])?n:q}</mo>`),e.body&&(z+=su(e.body,t));const N=O.matchingRightDelim();N&&"."!==N&&(z+=`<mo${eu(e.id,t)}>${null!=(i=$[N])?i:N}</mo>`),z+="</mrow>";break;case"sizeddelim":case"delim":z+=`<mo${eu(e.id,t)}>${$[e.value]||e.value}</mo>`;break;case"accent":z+='<mover accent="true"'+eu(e.id,t)+">",z+=su(e.body,t),z+="<mo>"+(P[B]||e.accent)+"</mo>",z+="</mover>";break;case"overunder":A=e.above,K=e.below,(e.svgAbove||A)&&(e.svgBelow||K)?D=e.body:A&&A.length>0?(D=e.body,(null==(r=null==(o=e.body)?void 0:o[0])?void 0:r.below)?(K=e.body[0].below,D=e.body[0].body):"first"===(null==(s=null==(a=e.body)?void 0:a[0])?void 0:s.type)&&(null==(c=null==(l=e.body)?void 0:l[1])?void 0:c.below)&&(K=e.body[1].below,D=e.body[1].body)):K&&K.length>0&&(D=e.body,(null==(h=null==(d=e.body)?void 0:d[0])?void 0:h.above)?(A=e.body[0].above,D=e.body[0].body):"first"===(null==(p=null==(u=e.body)?void 0:u[0])?void 0:p.type)&&(null==(f=null==(m=e.body)?void 0:m[1])?void 0:f.above)&&(A=e.body[1].overscript,D=e.body[1].body)),(e.svgAbove||A)&&(e.svgBelow||K)?(z+=`<munderover ${eu(e.id,t)}>`,z+=null!=(g=M[e.svgBody])?g:su(D,t),z+=null!=(b=M[e.svgBelow])?b:su(K,t),z+=null!=(y=M[e.svgAbove])?y:su(A,t),z+="</munderover>"):e.svgAbove||A?(z+=`<mover ${eu(e.id,t)}>`+(null!=(v=M[e.svgBody])?v:su(D,t)),z+=null!=(x=M[e.svgAbove])?x:su(A,t),z+="</mover>"):(e.svgBelow||K)&&(z+=`<munder ${eu(e.id,t)}>`+(null!=(w=M[e.svgBody])?w:su(D,t)),z+=null!=(_=M[e.svgBelow])?_:su(K,t),z+="</munder>");break;case"placeholder":z+="?";break;case"mord":{z="string"==typeof e.value?e.value:B,"\\char"===B?z="&#x"+("000000"+e.args[0].number.toString(16)).slice(-4)+";":z.length>0&&z.startsWith("\\")&&("string"==typeof e.value&&e.value.charCodeAt(0)>255?z="&#x"+("000000"+e.value.charCodeAt(0).toString(16)).slice(-4)+";":"string"==typeof e.value?z=e.value.charAt(0):(console.error("Did not expect this"),z=""));const n=/\d/.test(z)?"mn":"mi";z=`<${n}${eu(e.id,t)}>${Qh(z)}</${n}>`;break}case"mbin":case"mrel":case"minner":z=lu(e,t);break;case"mpunct":z='<mo separator="true"'+eu(e.id,t)+">"+B+"</mo>";break;case"mop":case"operator":case"extensible-symbol":""!==e.body&&(z="<mo"+eu(e.id,t)+">",z+="\\operatorname"===B?e.body:B||e.body,z+="</mo>");break;case"box":z='<menclose notation="box"',e.backgroundcolor&&(z+=' mathbackground="'+e.backgroundcolor+'"'),z+=eu(e.id,t)+">"+su(e.body,t)+"</menclose>";break;case"spacing":z+='<mspace width="'+(null!=(k=S[B])?k:0)+'em"/>';break;case"enclose":z='<menclose notation="';for(const t in e.notation)Object.prototype.hasOwnProperty.call(e.notation,t)&&e.notation[t]&&(z+=T+t,T=" ");z+=eu(e.id,t)+'">'+su(e.body,t)+"</menclose>";break;case"prompt":z='<menclose notation="roundexbox""">'+su(e.body,t)+"</menclose>";break;case"space":z+=" ";break;case"mopen":case"mclose":z+=lu(e,t);break;case"macro":{const n=e.command+cu(e.macroArgs);n&&(z+=`<mo ${eu(e.id,t)}>${n}</mo>`)}break;case"latexgroup":case"tooltip":z+=su(e.body,t);break;case"latex":z+="<mtext"+eu(e.id,t)+">"+e.value+"</mtext>";break;case"text":z+=`<mtext ${eu(e.id,t)}x>${e.value}</mtext>`;break;default:if("\\displaystyle"===e.command)return`<mrow ${eu(e.id,t)} displaystyle="true">${su(e.body,t)}</mrow>`;if("\\textstyle"===e.command)return`<mrow ${eu(e.id,t)} displaystyle="false">${su(e.body,t)}</mrow>`;console.info("Unexpected element in conversion to MathML:",e)}return z}var hu={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"imaginary eye ","\\imaginaryJ":"imaginary jay ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":'<break time="150ms"/> semi-colon <break time="150ms"/>',",":'<break time="150ms"/> comma <break time="150ms"/>',"|":'<break time="150ms"/>Vertical bar<break time="150ms"/>',"(":'<break time="150ms"/>Open paren. <break time="150ms"/>',")":'<break time="150ms"/> Close paren. <break time="150ms"/>',"=":"equals ","<":"is less than ","\\lt":"is less than ","<=":"is less than or equal to ","\\le":"is less than or equal to ","\\gt":"is greater than ",">":"is greater than ","\\pm":"plus or minus","\\mp":"minus or plus","\\ge":"is greater than or equal to ","\\geq":"is greater than or equal to ","\\leq":"is less than or equal to ","\\ne":"is not equal to ","\\neq":"is not equal to ","!":"factorial ","\\sin":"sine ","\\cos":"cosine ","":"","−":"minus ",":":'<break time="150ms"/> such that <break time="200ms"/> ',"\\colon":'<break time="150ms"/> such that <break time="200ms"/> ',"\\hbar":"etch bar ","\\iff":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\Longleftrightarrow":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\land":"and ","\\lor":"or ","\\neg":"not ","\\div":"divided by ","\\forall":"for all ","\\exists":"there exists ","\\nexists":"there does not exists ","\\in":"element of ","\\N":'the set <break time="150ms"/><say-as interpret-as="character">n</say-as>',"\\C":'the set <break time="150ms"/><say-as interpret-as="character">c</say-as>',"\\Z":'the set <break time="150ms"/><say-as interpret-as="character">z</say-as>',"\\Q":'the set <break time="150ms"/><say-as interpret-as="character">q</say-as>',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdot":"times ","\\cdots":"dot dot dot ","\\Rightarrow":"implies ","\\lparen":'<break time="150ms"/>open paren<break time="150ms"/>',"\\rparen":'<break time="150ms"/>close paren<break time="150ms"/>',"\\lbrace":'<break time="150ms"/>open brace<break time="150ms"/>',"\\{":'<break time="150ms"/>open brace<break time="150ms"/>',"\\rbrace":'<break time="150ms"/>close brace<break time="150ms"/>',"\\}":'<break time="150ms"/>close brace<break time="150ms"/>',"\\langle":'<break time="150ms"/>left angle bracket<break time="150ms"/>',"\\rangle":'<break time="150ms"/>right angle bracket<break time="150ms"/>',"\\lfloor":'<break time="150ms"/>open floor<break time="150ms"/>',"\\rfloor":'<break time="150ms"/>close floor<break time="150ms"/>',"\\lceil":'<break time="150ms"/>open ceiling<break time="150ms"/>',"\\rceil":'<break time="150ms"/>close ceiling<break time="150ms"/>',"\\vert":'<break time="150ms"/>vertical bar<break time="150ms"/>',"\\mvert":'<break time="150ms"/>divides<break time="150ms"/>',"\\lvert":'<break time="150ms"/>left vertical bar<break time="150ms"/>',"\\rvert":'<break time="150ms"/>right vertical bar<break time="150ms"/>',"\\lbrack":'<break time="150ms"/> open square bracket <break time="150ms"/>',"\\rbrack":'<break time="150ms"/> close square bracket <break time="150ms"/>',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"},uu={array:"array",matrix:"matrix",pmatrix:"parenthesis matrix",bmatrix:"square brackets matrix",Bmatrix:"braces matrix",vmatrix:"bars matrix",Vmatrix:"double bars matrix","matrix*":"matrix",smallmatrix:"small matrix"};function pu(e){let t=0;if(m(e))for(const n of e)"first"!==n.type&&(t+=1);return 1===t}function mu(e){let t="";if(m(e))for(const n of e)"first"!==n.type&&"string"==typeof n.value&&(t+=n.value);return t}function fu(e,t){var n,i,o,r,a;function s(e){return"<emphasis>"+e+"</emphasis>"}if(!t)return"";let l="";if(m(t)){let i=!1,o=!1;for(let r=0;r<t.length;r++)"first"!==t[r].type&&("text"!==t[r].mode&&(o=!1),r<t.length-2&&"mopen"===t[r].type&&"mclose"===t[r+2].type&&"mord"===t[r+1].type?(l+=" of ",l+=s(fu(e,t[r+1])),r+=2):"text"===t[r].mode?o?l+=null!=(n=t[r].value)?n:" ":(o=!0,l+=fu("text",t[r])):t[r].isDigit()?i?l+=t[r].asDigit():(i=!0,l+=fu(e,t[r])):(i=!1,l+=fu(e,t[r])))}else if("text"===t.mode)t.id&&"math"===e&&(l+='<mark name="'+t.id.toString()+'"/>'),l+=t.value;else{t.id&&"math"===e&&(l+='<mark name="'+t.id.toString()+'"/>');let n="",h="",u="",p=!1;const{command:f}=t;switch(f){case"\\vec":return"vector "+fu(e,t.body);case"\\acute":return fu(e,t.body)+" acute";case"\\grave":return fu(e,t.body)+" grave";case"\\dot":return"dot over"+fu(e,t.body);case"\\ddot":return"double dot over"+fu(e,t.body);case"\\mathring":return"ring over"+fu(e,t.body);case"\\tilde":case"\\widetilde":return"tilde over"+fu(e,t.body);case"\\bar":return fu(e,t.body)+" bar";case"\\breve":return fu(e,t.body)+" breve";case"\\check":case"\\widecheck":return"check over "+fu(e,t.body);case"\\hat":case"\\widehat":return"hat over"+fu(e,t.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+fu(e,t.body);case"\\underarc":case"\\underparen":return"arc under "+fu(e,t.body)}switch(t.type){case"prompt":l+=' <break time="300ms"/> '+(t.body.length>1?'start input . <break time="500ms"/> '+fu(e,t.body)+'. <break time="500ms"/> end input':"blank")+'. <break time="700ms"/>'+(null!=(i=t.correctness)?i:"")+' . <break time="700ms"/> ';break;case"array":const m=t.array,g=t.environmentName;if(Object.keys(uu).includes(g)){l+=` begin ${uu[g]} `;for(let e=0;e<m.length;e++){e>0&&(l+=","),l+=` row ${e+1} `;for(let t=0;t<m[e].length;t++)t>0&&(l+=","),l+=` column ${t+1}: `,l+=fu("math",m[e][t])}l+=` end ${uu[g]} `}break;case"group":"\\ne"===f?l+=" not equal ":"\\not"===f?(l+=" not ",l+=fu("math",t.body)):l+=fu("math",t.body);break;case"root":l+=fu("math",t.body);break;case"genfrac":if(n=fu("math",t.above),h=fu("math",t.below),pu(t.above)&&pu(t.below)){const e={"1/2":" half ","1/3":" one third ","2/3":" two third","1/4":" one quarter ","3/4":" three quarter ","1/5":" one fifth ","2/5":" two fifths ","3/5":" three fifths ","4/5":" four fifths ","1/6":" one sixth ","5/6":" five sixths ","1/8":" one eight ","3/8":" three eights ","5/8":" five eights ","7/8":" seven eights ","1/9":" one ninth ","2/9":" two ninths ","4/9":" four ninths ","5/9":" five ninths ","7/9":" seven ninths ","8/9":" eight ninths "}[mu(t.above)+"/"+mu(t.below)];e?l=e:l+=n+" over "+h}else l+=' the fraction <break time="150ms"/>'+n+' over <break time="150ms"/>'+h+'.<break time="150ms"/> End fraction.<break time="150ms"/>';break;case"surd":if(u=fu("math",t.body),t.hasEmptyBranch("above"))l+=pu(t.body)?" the square root of "+u+" , ":' the square root of <break time="200ms"/>'+u+'. <break time="200ms"/> End square root';else{let e=fu("math",t.above);e=e.trim();const n=e.replace(/<mark([^/]*)\/>/g,"");l+="3"===n?' the cube root of <break time="200ms"/>'+u+'. <break time="200ms"/> End cube root':"n"===n?' the nth root of <break time="200ms"/>'+u+'. <break time="200ms"/> End root':' the root with index: <break time="200ms"/>'+e+', of <break time="200ms"/>'+u+'. <break time="200ms"/> End root'}break;case"leftright":{const e=t;l+=null!=(o=e.leftDelim?hu[e.leftDelim]:void 0)?o:e.leftDelim,l+=fu("math",t.body),l+=null!=(r=e.rightDelim?hu[e.rightDelim]:void 0)?r:e.rightDelim}break;case"rule":case"overunder":case"overlap":case"space":case"spacing":break;case"macro":const b=f.replace(/^\\/g,""),y=ie()[b];y&&((null==y?void 0:y.expand)?l+=fu("math",t.body):l+=`${b} `);break;case"placeholder":l+="placeholder ";break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":{if("\\mathbin"===f||"\\mathrel"===f||"\\mathopen"===f||"\\mathclose"===f||"\\mathpunct"===f||"\\mathord"===f||"\\mathinner"===f){l=fu(e,t.body);break}let n=t.isDigit()?t.asDigit():t.value,i=t.command;if("delim"!==t.type&&"sizeddelim"!==t.type||(i=t.value,n=i),"text"===e)l+=n;else{if("mbin"===t.type&&(l+='<break time="150ms"/>'),n){const e=hu[n]||(i?hu[i.trim()]:"");if(e)l+=" "+e;else{const e=i?function(e){let t="";return e.startsWith("\\")&&(t=" "+e.replace("\\","")+" "),t}(i.trim()):"";l+=e||(d=n,window.MathfieldElement.textToSpeechMarkup?/[a-z]/.test(d)?` <say-as interpret-as="character">${d}</say-as>`:/[A-Z]/.test(d)?`capital <say-as interpret-as="character">${d.toLowerCase()}</say-as>`:d:/[a-z]/.test(d)?" '"+d.toUpperCase()+"'":/[A-Z]/.test(d)?" 'capital "+d.toUpperCase()+"'":d)}}else l+=fu("math",t.body);"mbin"===t.type&&(l+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if(""!==t.value){const e=t.command;if("\\sum"===e)if(t.hasEmptyBranch("superscript")||t.hasEmptyBranch("subscript"))if(t.hasEmptyBranch("subscript"))l+=" the summation of";else{let e=fu("math",t.subscript);e=e.trim(),l+=' the summation from <break time="200ms"/>'+e+'<break time="200ms"/> of <break time="150ms"/>',p=!0}else{let e=fu("math",t.superscript);e=e.trim();let n=fu("math",t.subscript);n=n.trim(),l+=' the summation from <break time="200ms"/>'+n+'<break time="200ms"/> to <break time="200ms"/>'+e+'<break time="200ms"/> of <break time="150ms"/>',p=!0}else if("\\prod"===e)if(t.hasEmptyBranch("superscript")||t.hasEmptyBranch("subscript"))if(t.hasEmptyBranch("subscript"))l+=" the product of ";else{let e=fu("math",t.subscript);e=e.trim(),l+=' the product from <break time="200ms"/>'+e+'<break time="200ms"/> of <break time="150ms"/>',p=!0}else{let e=fu("math",t.superscript);e=e.trim();let n=fu("math",t.subscript);n=n.trim(),l+=' the product from <break time="200ms"/>'+n+'<break time="200ms"/> to <break time="200ms"/>'+e+'<break time="200ms"/> of <break time="150ms"/>',p=!0}else if("\\int"===e)if(t.hasEmptyBranch("superscript")||t.hasEmptyBranch("subscript"))l+=' the integral of <break time="200ms"/> ';else{let e=fu("math",t.superscript);e=e.trim();let n=fu("math",t.subscript);n=n.trim(),l+=' the integral from <break time="200ms"/>'+s(n)+'<break time="200ms"/> to <break time="200ms"/>'+s(e)+' <break time="200ms"/> of ',p=!0}else if("string"==typeof t.value){const e=null!=(a=hu[t.value])?a:t.command?hu[t.command]:void 0;l+=e||" "+t.value}else t.command&&("\\mathop"===t.command?l+=fu("math",t.body):"\\operatorname"===t.command?l+=(c=t.body)?c.map((e=>e.value)).join(""):"":l+=t.command.startsWith("\\")?" "+t.command.slice(1):" "+t.command)}break;case"enclose":u=fu("math",t.body),l+=" crossed out "+u+". End crossed out."}if(!p&&!t.hasEmptyBranch("superscript")){let n=fu(e,t.superscript);n=n.trim();const i=n.replace(/<[^>]*>/g,"");if(pu(t.superscript)){if("math"===e){const e=function(e){if(m(e))for(const t of e)if("first"!==t.type&&t.id)return t.id.toString();return""}(t.superscript);e&&(l+='<mark name="'+e+'"/>')}"′"===i?l+=" prime ":"2"===i?l+=" squared ":"3"===i?l+=" cubed ":Number.isNaN(Number.parseInt(i))?l+=" to the "+n+"; ":l+=' to the <say-as interpret-as="ordinal">'+i+"</say-as> power; "}else Number.isNaN(Number.parseInt(i))?l+=" raised to the "+n+"; ":l+=' raised to the <say-as interpret-as="ordinal">'+i+"</say-as> power; "}if(!p&&!t.hasEmptyBranch("subscript")){let e=fu("math",t.subscript);e=e.trim(),l+=pu(t.subscript)?" sub "+e:" subscript "+e+". End subscript. "}}var c,d;return l}function gu(e){var t,n;if("sre"===window.MathfieldElement.textToSpeechRules&&("sre"in window||"SRE"in window)){const i=su(e);if(i){window.MathfieldElement.textToSpeechMarkup&&(window.MathfieldElement.textToSpeechRulesOptions=null!=(t=window.MathfieldElement.textToSpeechRulesOptions)?t:{},window.MathfieldElement.textToSpeechRulesOptions=h(d({},window.MathfieldElement.textToSpeechRulesOptions),{markup:window.MathfieldElement.textToSpeechMarkup}),"ssml"===window.MathfieldElement.textToSpeechRulesOptions.markup&&(window.MathfieldElement.textToSpeechRulesOptions=h(d({},window.MathfieldElement.textToSpeechRulesOptions),{markup:"ssml_step"})),window.MathfieldElement.textToSpeechRulesOptions=h(d({},window.MathfieldElement.textToSpeechRulesOptions),{rate:window.MathfieldElement.speechEngineRate}));const e=null!=(n=window.SRE)?n:window.sre.System.getInstance();window.MathfieldElement.textToSpeechRulesOptions&&e.setupEngine(window.MathfieldElement.textToSpeechRulesOptions);let o="";try{o=e.toSpeech(i)}catch(e){console.error("MathLive 0.98.5: `SRE.toSpeech()` runtime error",e)}return o}return""}let i=fu("math",e);if("ssml"===window.MathfieldElement.textToSpeechMarkup){let e="";window.MathfieldElement.speechEngineRate&&(e='<prosody rate="'+window.MathfieldElement.speechEngineRate+'">'),i='<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>'+e+"<p><s>"+i+"</s></p>"+(e?"</prosody>":"")+"</amazon:auto-breaths></speak>"}else i="mac"===window.MathfieldElement.textToSpeechMarkup&&"macos"===b()?i.replace(/<mark([^/]*)\/>/g,"").replace(/<emphasis>/g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(/<break time="(\d*)ms"\/>/g,"[[slc $1]]").replace(/<say-as[^>]*>/g,"").replace(/<\/say-as>/g,""):i.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return i}var bu={"\\ne":"≠","\\neq":"≠","−":"-","-":"-","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\delta":"delta","\\epsilon":"epsilon","\\varepsilon":"varepsilon","\\zeta":"zeta","\\eta":"eta","\\theta":"theta","\\vartheta":"vartheta","\\iota":"iota","\\kappa":"kappa","\\lambda":"lambda","\\mu":"mu","\\nu":"nu","\\xi":"xi","\\pi":"pi","\\rho":"rho","\\sigma":"sigma","\\tau":"tau","\\upsilon":"upsilon","\\phi":"phi","\\varphi":"varphi","\\chi":"chi","\\psi":"psi","\\omega":"omega","\\Gamma":"Gamma","\\Delta":"Delta","\\Theta":"Theta","\\Lambda":"Lambda","\\Xi":"Xi","\\Pi":"Pi","\\Sigma":"Sigma","\\Phi":"Phi","\\Psi":"Psi","\\Omega":"Omega","\\exponentialE":"e","\\imaginaryI":"i","\\imaginaryJ":"j","\\!":" ","\\,":" ","\\:":" ","\\>":" ","\\;":" ","\\enskip":" ","\\enspace":" ","\\qquad":" ","\\quad":" ","\\infty":"oo"},yu={"\\pm":"+-","\\colon":":","\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrack":"[","\\rbrack":"]","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"(:","\\rangle":":)","\\sum":" sum ","\\prod":" prod ","\\bigcap":" nnn ","\\bigcup":" uuu ","\\int":" int ","\\oint":" oint ","\\ge":">=","\\le":"<=","\\ne":"!=","\\neq":"!=","\\lt":"<","\\gt":">","\\gets":"<-","\\to":"->","\\land":" and ","\\lor":" or ","\\lnot":" not ","\\forall":" AA ","\\exists":" EE ","\\in":" in ","\\notin":" !in ","\\mapsto":"|->","\\implies":"=>","\\iff":"<=>","\\cdot":"*","\\ast":"**","\\star":"***","\\times":"xx","\\div":"-:","\\ltimes":"|><","\\rtimes":"><|","\\bowtie":"|><|","\\circ":"@"};function vu(e){var t,n,i,o,r,a,s,l,c,d,h,u,p;if(!e)return"";if(m(e)){if(0===e.length)return"";if("latex"===e[0].mode)return e.map(vu).join("");if("text"===e[0].mode){let n=0,i="";for(;"text"===(null==(t=e[n])?void 0:t.mode);)i+=e[n].body?vu(e[n].body):e[n].value,n++;return`"${i}" ${vu(e.slice(n))}`}let n=0;const i=[];for(;e[n]&&"math"===e[n].mode;){let t="";for(;e[n]&&"mord"===e[n].type&&/\d/.test(e[n].value);)t+=e[n++].value;t?i.push(t):i.push(vu(e[n++]))}return i.push(vu(e.slice(n))),function(e){let t="";for(const n of e){const e=t[t.length-1];void 0!==e&&/\d/.test(e)&&/^\d/.test(n)&&(t+=" "),t+=n}return t}(i)}if("text"===e.mode)return`"${e.value}"`;let f="";const{command:g}=e;let b;if("\\placeholder"===g)return`(${vu(e.body)})`;switch(e.type){case"accent":const t={"\\vec":"vec","\\dot":"dot","\\ddot":"ddot","\\bar":"bar","\\hat":"hat","\\acute":"acute;","\\grave":"grave","\\tilde":"tilde","\\breve":"breave","\\check":"check"}[g];f=`${null!=t?t:""} ${vu(e.body)} `;break;case"first":return"";case"latexgroup":return e.body.map((e=>e.value)).join("");case"group":case"root":f=null!=(n=bu[g])?n:vu(e.body);break;case"genfrac":{const t=e;(t.leftDelim||t.rightDelim)&&(f="."!==t.leftDelim&&t.leftDelim?t.leftDelim:"{:"),t.hasBarLine?(f+="(",f+=vu(t.above),f+=")/(",f+=vu(t.below),f+=")"):(f+="("+vu(t.above)+"),",f+="("+vu(t.below)+")"),(t.leftDelim||t.rightDelim)&&(f+="."!==t.rightDelim&&t.rightDelim?t.rightDelim:"{:")}break;case"surd":f+=e.hasEmptyBranch("above")?"sqrt("+vu(e.body)+")":"root("+vu(e.above)+")("+vu(e.body)+")";break;case"latex":case"sizeddelim":case"delim":case"mopen":case"mclose":f=e.value;break;case"leftright":{const t=e,n=t.leftDelim;f+="."!==n&&n?n:"{:",f+=vu(t.body);const i=t.matchingRightDelim();f+="."!==i&&i?i:":}"}break;case"overlap":case"overunder":case"box":break;case"mord":f=null!=(o=null!=(i=bu[g])?i:g)?o:"string"==typeof e.value?e.value:"",f.startsWith("\\")&&(f+=" "),b=g?g.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null,b?f=String.fromCodePoint(Number.parseInt("0x"+b[1])):f.length>0&&f.startsWith("\\")&&(f="string"==typeof e.value?e.value.charAt(0):e.command),f=function(e,t){if(!t)return e;let n=e;"double-struck"===t.variant&&(n=`bbb "${n}"`);"script"===t.variant&&(n=`cc "${n}"`);"fraktur"===t.variant&&(n=`fr "${n}"`);"sans-serif"===t.variant&&(n=`sf "${n}"`);"monospace"===t.variant&&(n=`tt "${n}"`);"bold"===t.variantStyle&&(n=`bb "${n}"`);return t.color?`color({${t.color}})(${n})`:n}(f,e.style);break;case"mbin":case"mrel":case"minner":f=null!=(a=null!=(r=bu[g])?r:yu[g])?a:e.value;break;case"mpunct":f=null!=(s=yu[g])?s:g;break;case"mop":case"operator":case"extensible-symbol":""!==e.value&&(f=yu[g]?yu[g]:"\\operatorname"===g?vu(e.body):null!=(l=e.value)?l:g,f+=" ");break;case"array":const m=e.array,y=e.environmentName,v=null!=(c={bmatrix:["[","]"],"bmatrix*":["[","]"]}[y])?c:["(",")"],x=[];for(const e of m){const t=[];for(const n of e)t.push(v[0]+vu(n)+v[1]);x.push(t.join(","))}const w=null!=(d={bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]}[y])?d:["(",")"];f=w[0]+x.join(",")+w[1];break;case"spacing":f=null!=(h=bu[g])?h:" ";break;case"enclose":f="("+vu(e.body)+")";break;case"space":f=" ";break;case"subsup":f="";break;case"macro":f=null!=(p=null!=(u=bu[g])?u:yu[g])?p:vu(e.body)}if(!e.hasEmptyBranch("subscript")){f+="_";const t=vu(e.subscript);f+=1!==t.length?`(${t})`:t}if(!e.hasEmptyBranch("superscript")){f+="^";const t=vu(e.superscript);f+=1!==t.length?`(${t})`:t}return f}function xu(e,t){var n,i;null!=t||(t={}),t.mathstyle=null!=(n=t.mathstyle)?n:"displaystyle";const o=new Ea({from:h(d({},Ca()),{renderPlaceholder:()=>new da(160,{maxFontSize:1}),letterShapeStyle:null!=(i=null==t?void 0:t.letterShapeStyle)?i:"tex"}),mathstyle:t.mathstyle}),r=new za({mode:"math",type:"root",body:Qs(e,{context:o,parseMode:"math",mathstyle:t.mathstyle})}).render(o);if(!r)return"";ua(_l(r,o));return pa(r,{classes:"ML__latex"}).toMarkup()}function wu(e){if("string"==typeof e){const t=function(e){if(!e)return;if("#"!==e[0])return;let t;(e=e.slice(1)).length<=4?(t={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},4===e.length&&(t.a=parseInt(e[3]+e[3],16)/255)):(t={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},8===e.length&&(t.a=parseInt(e[6]+e[7],16)/255));t&&void 0===t.a&&(t.a=1);return t}(e);if(!t)throw new Error(`Invalid color: ${e}`);return t}return"C"in e?Cu(ku(e)):"a"in e?Cu(e):e}function _u(e){return e<0?0:e>255?255:Math.round(e)}function ku(e){const[t,n,i]=[e.L,e.C,e.H],o=i*Math.PI/180,r={L:t,a:n*Math.cos(o),b:n*Math.sin(o)};return void 0!==e.alpha&&(r.alpha=e.alpha),r}function Mu(e){const[t,n,i]=[e.L,e.a,e.b],o=Math.pow(.9999999984505198*t+.39633779217376786*n+.2158037580607588*i,3),r=Math.pow(1.00000000888176*t-.10556134232365635*n-.0638541747717059*i,3),a=Math.pow(1.000000054672411*t-.0894841820949657*n-1.2914855378640917*i,3),s=-1.2684380040921763*o+2.6097574006633715*r-.3413193963102197*a,l=-.004196086541837188*o-.7034186144594493*r+1.7076147009309444*a,c=e=>{const t=Math.abs(e);return t<=.0031308?12.92*e:(Math.sign(e)||1)*(1.055*Math.pow(t,1/2.4)-.055)};return[c(4.076741661347994*o-3.307711590408193*r+.230969928729428*a),c(s),c(l)]}function Su(e){const[t,n,i]=e;return t>=0&&t<=1&&n>=0&&n<=1&&i>=0&&i<=1}function Lu(e,t){let[n,i,o]=e;return n=_u(255*n),i=_u(255*i),o=_u(255*o),void 0!==t?{r:n,g:i,b:o,alpha:t}:{r:n,g:i,b:o}}function Cu(e){let[t,n,i]=Mu(e);if(Su([t,n,i]))return Lu([t,n,i],e.alpha);const o=function(e){const[t,n,i]=[e.L,e.a,e.b],o={L:t,C:Math.sqrt(n*n+i*i),H:180*Math.atan2(i,n)/Math.PI};return void 0!==e.alpha&&(o.alpha=e.alpha),o}(e);if(o.C=0,[t,n,i]=Mu(ku(o)),!Su([t,n,i]))return Lu([t,n,i],e.alpha);let r=0,a=e.L,s=(r+a)/2;o.C=s;const l=.36/Math.pow(2,12);for(;a-r>l;)s=(r+a)/2,o.C=s,[t,n,i]=Mu(ku(o)),Su([t,n,i])?r=s:a=s;return Lu([t,n,i],e.alpha)}function Eu(e,t){const n=wu(e),i=wu(t);function o(e){return e>=.022?e:e+(.022-e)**1.414}function r(e){return(e<0?-1:1)*Math.pow(Math.abs(e),2.4)}const a=o(.2126729*r(i.r/255)+.7151522*r(i.g/255)+.072175*r(i.b/255)),s=o(.2126729*r(n.r/255)+.7151522*r(n.g/255)+.072175*r(n.b/255));let l,c,d;return Math.abs(s-a)<5e-4?c=0:s>a?(l=s**.56-a**.57,c=1.14*l):(l=s**.65-a**.62,c=1.14*l),d=Math.abs(c)<.1?0:c>0?c-.027:c+.027,100*d}function Ku(e,t,n){null!=n||(n="#fff"),null!=t||(t="#000");const i=Eu(e,n),o=Eu(e,t);return Math.abs(i)>Math.abs(o)?n:t}function Au(e){const t=wu(e);let n=((1<<24)+(_u(t.r)<<16)+(_u(t.g)<<8)+_u(t.b)).toString(16).slice(1);return void 0!==t.alpha&&t.alpha<1&&(n+=("00"+Math.round(255*t.alpha).toString(16)).slice(-2)),n[0]===n[1]&&n[2]===n[3]&&n[4]===n[5]&&n[6]===n[7]&&(n=n[0]+n[2]+n[4]+(void 0!==t.alpha&&t.alpha<1?n[6]:"")),"#"+n}function Du(e){const t=zu(e);let n="";for(const e of t){if("string"!=typeof e.value)return"";n+=e.value}return n}function zu(e){const t=e.model.selection.ranges;return 1!==t.length?[]:e.model.getAtoms(t[0])}function Tu(e){return[Vu(e,"double-struck","mathbb","tooltip.blackboard"),Vu(e,"fraktur","mathfrak","tooltip.fraktur"),Vu(e,"calligraphic","mathcal","tooltip.caligraphic"),Hu(e,"up","mathrm","tooltip.roman-upright"),Hu(e,"bold","mathbf","tooltip.bold"),Hu(e,"italic","mathit","tooltip.italic")]}function Bu(e){return[{label:()=>xu(`\\vec{${Du(e)}}`),visible:()=>1===Du(e).length,onMenuSelect:()=>e.insert("\\vec{#@}",{selectionMode:"item"})},{label:()=>xu(`\\overrightarrow{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{label:()=>xu(`\\overleftarrow{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{label:()=>xu(`\\dot{${Du(e)}}`),visible:()=>1===Du(e).length,onMenuSelect:()=>e.insert("\\dot{#@}",{selectionMode:"item"})},{label:()=>xu(`\\ddot{${Du(e)}}`),visible:()=>1===Du(e).length,onMenuSelect:()=>e.insert("\\ddot{#@}",{selectionMode:"item"})},{label:()=>xu(`\\bar{${Du(e)}}`),visible:()=>1===Du(e).length,onMenuSelect:()=>e.insert("\\bar{#@}",{selectionMode:"item"})},{label:()=>xu(`\\overline{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\overline{#@}",{selectionMode:"item"})},{label:()=>xu(`\\overgroup{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\overgroup{#@}",{selectionMode:"item"})},{label:()=>xu(`\\overbrace{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\overbrace{#@}",{selectionMode:"item"})},{label:()=>xu(`\\underline{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\underline{#@}",{selectionMode:"item"})},{label:()=>xu(`\\undergroup{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\undergroup{#@}",{selectionMode:"item"})},{label:()=>xu(`\\underbrace{${Du(e)}}`),visible:()=>Du(e).length>0,onMenuSelect:()=>e.insert("\\underbrace{#@}",{selectionMode:"item"})}]}function $u(e){return[{label:()=>xu(`\\boxed{${e.getValue(e.model.selection)}}}`),onMenuSelect:()=>e.insert("\\boxed{#@}",{selectionMode:"item"})},{label:()=>xu(`\\bbox[5px, border: 2px solid red]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{label:()=>xu(`\\bbox[5px, border: 2px dashed black]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}]}function Pu(e){const t=[];for(const n of Object.keys(k))t.push({class:("#000"===Au(Ku(k[n]))?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${k[n]} "></span>`,ariaLabel:()=>{var e;return null!=(e=x(n))?e:n},checked:()=>{var t;return{some:"mixed",all:!0}[null!=(t=e.queryStyle({backgroundColor:n}))&&t]},onMenuSelect:()=>{e.applyStyle({backgroundColor:n},{operation:"toggle"}),e.adoptStyle="none"}});return t}function Ou(e){const t=[];for(const n of Object.keys(M))t.push({class:("#000"===Ku(M[n])?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${M[n]} "></span>`,ariaLabel:()=>{var e;return null!=(e=x(n))?e:n},checked:()=>{var t;return{some:"mixed",all:!0}[null!=(t=e.queryStyle({color:n}))&&t]},onMenuSelect:()=>{e.applyStyle({color:n},{operation:"toggle"}),e.adoptStyle="none"}});return t}var qu=class extends Nh{constructor(e,t,n,i){super(e,t),this.row=n,this.col=i}set active(e){const t=this.parentMenu.children;if(e)for(const e of t)e.element.classList.toggle("active",e.row<=this.row&&e.col<=this.col);else for(const e of t)e.element.classList.remove("active")}};function Nu(e){const t=[];for(let n=1;n<=5;n++)for(let i=1;i<=5;i++)t.push({onCreate:(e,t)=>new qu(e,t,n,i),label:"☐",tooltip:()=>x("tooltip.row-by-col",n,i),data:{row:n,col:i},onMenuSelect:()=>{e.insert(`\\begin{pmatrix}${Array(n).fill(Array(i).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`,{selectionMode:"item"})}});return t}function Iu(e){return[{label:()=>x("menu.array.add row above"),id:"add-row-above",onMenuSelect:()=>e.executeCommand("addRowBefore"),visible:()=>Fu(e)},{label:()=>x("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>e.executeCommand("addRowAfter"),visible:()=>Fu(e)},{label:()=>x("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>e.executeCommand("addColumnBefore"),visible:()=>Fu(e),enabled:()=>{const t=e.model.parentEnvironment;if(!t)return!1;const[n,i]=function(e){var t;const n=null==(t=e.model.parentEnvironment)?void 0:t.array;return n?[n.length,n.reduce(((e,t)=>Math.max(e,t.length)),0)]:[0,0]}(e);return n<t.maxColumns}},{label:()=>x("menu.array.add column after"),id:"add-column-after",onMenuSelect:()=>e.executeCommand("addColumnAfter"),visible:()=>Fu(e)},{type:"divider"},{label:()=>x("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>e.executeCommand("removeRow"),visible:()=>Fu(e)},{label:()=>x("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>e.executeCommand("removeColumn"),visible:()=>Fu(e)},{type:"divider"},{label:()=>x("menu.borders"),visible:()=>(function(e){return"array"===e.model.at(e.model.position).type}(e)||Fu(e))&&e.isSelectionEditable,submenu:[{label:" ⋱ ",id:"environment-no-border",onMenuSelect:()=>Ru(e,"matrix")},{label:"(⋱)",id:"environment-parentheses",onMenuSelect:()=>Ru(e,"pmatrix")},{label:"[⋱]",id:"environment-brackets",onMenuSelect:()=>Ru(e,"bmatrix")},{label:"|⋱|",id:"environment-bar",onMenuSelect:()=>Ru(e,"vmatrix")},{label:"{⋱}",id:"environment-braces",onMenuSelect:()=>Ru(e,"Bmatrix")}],submenuClass:"border-submenu"},{type:"divider"},{label:()=>x("menu.insert matrix"),id:"insert-matrix",visible:()=>e.isSelectionEditable,submenu:Nu(e),submenuClass:"insert-matrix-submenu",columnCount:5},{label:()=>x("menu.mode"),id:"mode",visible:()=>e.isSelectionEditable&&e.model.selectionIsCollapsed,submenu:[{label:()=>x("menu.mode-math"),id:"mode-math",onMenuSelect:()=>{hc(e,"accept-all"),e.executeCommand(["switchMode","math"])},checked:()=>"math"===e.model.mode},{label:()=>x("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{hc(e,"accept-all"),e.executeCommand(["switchMode","text"])},checked:()=>"text"===e.model.mode},{label:()=>x("menu.mode-latex"),id:"mode-latex",onMenuSelect:()=>e.executeCommand(["switchMode","latex"]),checked:()=>"latex"===e.model.mode}]},{type:"divider"},{label:()=>x("menu.font-style"),id:"variant",visible:()=>e.isSelectionEditable,submenu:Tu(e),submenuClass:"variant-submenu"},{label:()=>x("menu.color"),id:"color",visible:()=>e.isSelectionEditable,submenu:Ou(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>x("menu.background-color"),id:"background-color",visible:()=>e.isSelectionEditable,submenu:Pu(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>x("menu.accent"),id:"accent",visible:()=>e.isSelectionEditable,submenu:Bu(e),submenuClass:"variant-submenu"},{label:()=>x("menu.decoration"),id:"decoration",visible:()=>e.isSelectionEditable&&Du(e).length>0,submenu:$u(e),submenuClass:"variant-submenu"},{type:"divider"},{label:()=>x("menu.evaluate"),id:"ce-evaluate",visible:()=>e.isSelectionEditable&&null!==window.MathfieldElement.computeEngine,onMenuSelect:()=>{const t=function(e){var t,n;let i;i=e.model.selectionIsCollapsed?null==(t=window.MathfieldElement.computeEngine)?void 0:t.parse(e.getValue(),{canonical:!1}):null==(n=window.MathfieldElement.computeEngine)?void 0:n.parse(e.getValue(e.model.selection),{canonical:!1});if(!i)return"";let o=i.evaluate();o.isSame(i)&&(o=i.N());return o.latex}(e);t?e.model.selectionIsCollapsed?(e.model.position=e.model.lastOffset,e.insert(`=${t}`,{insertionMode:"insertAfter",selectionMode:"item"})):e.insert(t,{insertionMode:"replaceSelection",selectionMode:"item"}):e.model.announce("plonk")}},{label:()=>x("menu.simplify"),id:"ce-simplify",visible:()=>e.isSelectionEditable&&null!==window.MathfieldElement.computeEngine,onMenuSelect:()=>{var t,n;if(e.model.selectionIsCollapsed){const n=null==(t=e.expression)?void 0:t.simplify();if(e.model.position=e.model.lastOffset,!n)return void e.model.announce("plonk");e.insert(`=${n.latex}`,{insertionMode:"insertAfter",selectionMode:"item"})}else{const t=null==(n=window.MathfieldElement.computeEngine)?void 0:n.parse(e.getValue(e.model.selection)).simplify();if(!t)return void e.model.announce("plonk");e.insert(t.latex,{insertionMode:"replaceSelection",selectionMode:"item"})}}},{label:()=>{var t;if(null===window.MathfieldElement.computeEngine)return"";const n=null==(t=e.expression)?void 0:t.unknowns[0];return n?x("menu.solve-for",xu(n)):x("menu.solve")},id:"ce-solve",visible:()=>{var t;return e.isSelectionEditable&&null!==window.MathfieldElement.computeEngine&&1===(null==(t=e.expression)?void 0:t.unknowns.length)&&"Nothing"!==e.expression.unknowns[0]},onMenuSelect:()=>{var t;const n=e.expression,i=null==n?void 0:n.unknowns[0],o=null==(t=n.solve(i))?void 0:t.map((e=>{var t;return null!=(t=e.simplify().latex)?t:""}));o?e.insert(`${i}=${1===o.length?o[0]:"\\left\\lbrace"+(null==o?void 0:o.join(", "))+"\\right\\rbrace"}`,{insertionMode:"replaceAll",selectionMode:"item"}):e.model.announce("plonk")}},{type:"divider"},{label:()=>x("menu.cut"),onMenuSelect:()=>e.executeCommand("cutToClipboard"),visible:()=>!e.options.readOnly&&e.isSelectionEditable,keyboardShortcut:"meta+X"},{label:()=>x("menu.copy"),id:"copy",submenu:[{label:()=>x("menu.copy-as-latex"),id:"copy-latex",onMenuSelect:()=>Za.copyToClipboard(e,"latex"),keyboardShortcut:"meta+C"},{label:()=>x("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>Za.copyToClipboard(e,"ascii-math")},{label:()=>x("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>Za.copyToClipboard(e,"math-ml")}]},{label:()=>x("menu.paste"),id:"paste",onMenuSelect:()=>e.executeCommand("pasteFromClipboard"),visible:()=>e.hasEditableContent,keyboardShortcut:"meta+V"},{label:()=>x("menu.select-all"),id:"select-all",keyboardShortcut:"meta+A",onMenuSelect:()=>e.executeCommand("selectAll")}]}function Fu(e){var t;return!!(null==(t=e.model.parentEnvironment)?void 0:t.array)}function Ru(e,t){lc(e),e.flushInlineShortcutBuffer(),Sd(e.model,t),Lc(e)}function Vu(e,t,n,i){return{label:()=>xu(`\\${n}{${Du(e)}}`),tooltip:()=>{var e;return null!=(e=x(i))?e:i},visible:()=>function(e,t){const n=zu(e);if(1!==n.length)return!1;const i=El[t];return!!i&&!!i.test(n[0].value)}(e,t),checked:()=>{var n;return{some:"mixed",all:!0}[null!=(n=e.queryStyle({variant:t}))&&n]},onMenuSelect:()=>{e.applyStyle({variant:t},{operation:"toggle"}),e.adoptStyle="none"}}}function Hu(e,t,n,i){return{label:()=>xu(`\\${n}{${Du(e)}}`),tooltip:()=>{var e;return null!=(e=x(i))?e:i},visible:()=>function(e,t){return Du(e).length>0}(e),checked:()=>{var n;return{some:"mixed",all:!0}[null!=(n=e.queryStyle({variantStyle:t}))&&n]},onMenuSelect:()=>{e.applyStyle({variantStyle:t},{operation:"toggle"}),e.adoptStyle="none"}}}function Wu(e,t){return e+gu(t)}function ju(e){var t;let n;if("prompt"===e.parent.type)"body"===e.parentBranch&&(n="prompt");else if("body"===e.parentBranch)n=e.type&&null!=(t={enclose:"cross out",leftright:"delimiter",surd:"square root",root:"math field",mop:"operator",first:"first"}[e.type])?t:"parent";else if("genfrac"===e.parent.type){if("above"===e.parentBranch)return"numerator";if("below"===e.parentBranch)return"denominator"}else"surd"===e.parent.type?"above"===e.parentBranch&&(n="index"):"superscript"===e.parentBranch?n="superscript":"subscript"===e.parentBranch&&(n="subscript");return n||console.log("unknown relationship"),null!=n?n:"parent"}function Uu(e,t,n,i){let o="";if("plonk"===t)window.MathfieldElement.playSound("plonk"),e.flushInlineShortcutBuffer();else if("delete"===t)o=Wu("deleted: ",i);else if("focus"===t||t.includes("move"))o=function(e,t){if(Number.isNaN(t))return"";const n=e.at(t);if(!n)return"";if(n.treeDepth<=e.at(e.position).treeDepth)return"";let i="",o=n.parent;const r=e.at(e.position).parent;for(;o!==e.root&&o!==r;)i+=`out of ${ju(o)};`,o=o.parent;return i}(e.model,n)+(e.model.selectionIsCollapsed?"":"selected: ")+function(e){if(!e.selectionIsCollapsed)return Wu("",e.getAtoms(e.selection));let t="";const n=e.at(e.position),i=ju(n);n.isFirstSibling&&(t=(i?"start of "+i:"unknown")+": ");n.isLastSibling?n.isFirstSibling||(t+=i?"end of "+i:"unknown"):t+=Wu("",n);return t}(e.model);else if("replacement"===t)o=Wu("",e.model.at(e.model.position));else if("line"===t){const t=Wu("",e.model.root);e.keyboardDelegate.setAriaLabel(t)}else o=i?Wu(t+" ",i):t;if(o){const t=e.ariaLiveText.textContent.includes(" ")?" ":" ";e.ariaLiveText.textContent=o+t}}Dc({speak:(e,t,n)=>function(e,t,n){var i,o;n=null!=n?n:{withHighlighting:!1};const{model:r}=e;function a(e){let t=null;switch(e){case"all":default:t=r.root;break;case"selection":t=r.getAtoms(r.selection);break;case"left":t=r.getAtoms(r.offsetOf(r.at(r.position).leftSibling),r.position);break;case"right":t=r.getAtoms(r.position,r.offsetOf(r.at(r.position).rightSibling));break;case"group":t=r.getAtoms(r.getSiblingsRange(r.position));break;case"parent":{const{parent:e}=r.at(r.position);t=(null==e?void 0:e.parent)?e:r.root;break}}return t}function s(e){let t="";switch(e){case"all":console.log("Internal failure: speak all failed");break;case"selection":t="no selection";break;case"left":t="at start";break;case"right":t="at end";break;case"group":console.log("Internal failure: speak group failed");break;case"parent":t="no parent";break;default:console.log('unknown speak_ param value: "'+e+'"')}return t}const l=a(t);if(null===l)return null==(o=(i=window.MathfieldElement).speakHook)||o.call(i,s(t)),!1;(n.withHighlighting||"amazon"===window.MathfieldElement.speechEngine)&&(window.MathfieldElement.textToSpeechMarkup=window.sre&&"sre"===window.MathfieldElement.textToSpeechRules?"ssml_step":"ssml");const c=gu(l);f()&&n.withHighlighting?(pp().readAloudMathfield=e,Ec(e,{forHighlighting:!0}),window.MathfieldElement.readAloudHook&&window.MathfieldElement.readAloudHook(e.field,c)):window.MathfieldElement.speakHook&&window.MathfieldElement.speakHook(c);return!1}(e,t,n)},{target:"mathfield"});function Ju(e,t,n,i){const o=e.offsetOf(t);if(o<n||o>i)return!1;if(!t.hasChildren)return!0;const r=e.offsetOf(t.firstChild);if(r>=n&&r<=i){const o=e.offsetOf(t.lastChild);if(o>=n&&o<=i)return!0}return!1}function Xu(e,t,n){if(!(null==t?void 0:t.hasChildren))return!1;const[i,o]=n,r=e.offsetOf(t.firstChild),a=e.offsetOf(t.lastChild);return r>=i&&r<=o&&a>=r&&a<=o}function Gu(e,t,n,i){var o,r,a,s,l,c;const d=n.parent;if(d&&n instanceof Ws){const o=!i&&"forward"===t||"body"===i&&"backward"===t;let r=o?e.offsetOf(n.firstChild):e.offsetOf(n.lastChild);return o?"?"!==n.rightDelim&&"."!==n.rightDelim?(n.leftDelim=".",n.isDirty=!0):(d.addChildrenAfter(n.removeBranch("body"),n),d.removeChild(n),r--):"?"!==n.leftDelim&&"."!==n.leftDelim?(n.rightDelim=".",n.isDirty=!0):(d.addChildrenAfter(n.removeBranch("body"),n),d.removeChild(n),r--),e.position=r,!0}if(d&&"surd"===n.type){if("forward"===t&&!i||"backward"===t&&"body"===i){const t=n.leftSibling;n.hasChildren&&d.addChildrenAfter(n.removeBranch("body"),n),d.removeChild(n),e.position=e.offsetOf(t)}else"forward"===t&&"body"===i?e.position=e.offsetOf(n):i||"backward"!==t?"above"===i&&(n.hasEmptyBranch("above")&&n.removeBranch("above"),e.position="backward"===t?e.offsetOf(n.leftSibling):e.offsetOf(n.body[0])):n.hasChildren?e.position=e.offsetOf(n.lastChild):(e.position=Math.max(0,e.offsetOf(n)-1),d.removeChild(n));return!0}if(d&&("box"===n.type||"enclose"===n.type)){const o=i&&"backward"===t||!i&&"forward"===t?n.leftSibling:n.lastChild;return d.addChildrenAfter(n.removeBranch("body"),n),d.removeChild(n),e.position=e.offsetOf(o),!0}if("genfrac"===n.type||"overunder"===n.type){if(!i)return("overunder"!==n.type||!n.hasEmptyBranch("body"))&&(("genfrac"!==n.type||!n.hasEmptyBranch("below")||!n.hasEmptyBranch("above"))&&(e.position=e.offsetOf("forward"===t?n.firstChild:n.lastChild),!0));const o="numerator-denominator"===rp.fractionNavigationOrder?"above":"below",r="above"===o?"below":"above";if(d&&("forward"===t&&i===o||"backward"===t&&i===r)){const t=n.removeBranch(o),i=n.removeBranch(r);return d.addChildrenAfter([...t,...i],n),d.removeChild(n),e.position=e.offsetOf(t.length>0?t[t.length-1]:i[0]),!0}return e.position="backward"===t?e.offsetOf(n.leftSibling):e.offsetOf(n),!0}if(n.isExtensibleSymbol||"subsup"===n.type){if(!i&&"forward"===t)return!1;if(!i){if(n.subscript||n.superscript){const i="forward"===t?null!=(a=null==(o=n.superscript)?void 0:o[0])?a:null==(r=n.subscript)?void 0:r[0]:null!=(c=null==(s=n.subscript)?void 0:s[0].lastSibling)?c:null==(l=n.superscript)?void 0:l[0].lastSibling;return i&&(e.position=e.offsetOf(i)),!0}return!1}if(!n.hasChildren&&"subsup"===n.type){const i="forward"===t?e.offsetOf(n):Math.max(0,e.offsetOf(n)-1);return n.parent.removeChild(n),e.position=i,!0}if("superscript"===i)if("backward"===t){const t=e.offsetOf(n.firstChild)-1;console.assert(t>=0),e.position=t}else n.subscript?e.position=e.offsetOf(n.subscript[0]):e.position=e.offsetOf(n);else"subscript"===i&&("backward"===t&&n.superscript?e.position=e.offsetOf(n.superscript[0].lastSibling):e.position="backward"===t?e.offsetOf(n.firstChild)-1:e.offsetOf(n));if(i&&n.hasEmptyBranch(i)&&(n.removeBranch(i),"subsup"===n.type&&!n.subscript&&!n.superscript)){const i="forward"===t?e.offsetOf(n):Math.max(0,e.offsetOf(n)-1);n.parent.removeChild(n),e.position=i}return!0}if("genfrac"===(null==d?void 0:d.type)&&!i&&"first"!==n.type){let t=e.offsetOf(n.leftSibling);return d.removeChild(n),d.hasEmptyBranch("above")&&d.hasEmptyBranch("below")?(t=e.offsetOf(d.leftSibling),d.parent.removeChild(d),e.announce("delete",void 0,[d]),e.position=t,!0):(e.announce("delete",void 0,[n]),e.position=t,!0)}if("backward"===t&&("\\ln"===(null==d?void 0:d.command)||"\\log"===(null==d?void 0:d.command))&&"body"!==n.parentBranch){const t=e.offsetOf(d.leftSibling);return d.parent.removeChild(d),e.announce("delete",void 0,[d]),e.position=t,!0}return!1}function Zu(e,t,n){const i=e.getAtoms(t);if(i.length>0&&i[0].parent){let o=i[0].parent.firstChild;"first"===o.type&&(o=o.rightSibling);const r=i[i.length-1].parent.lastChild;let a=i[0];"first"===a.type&&(a=a.rightSibling);const s=i[i.length-1];if(a===o&&s===r){const n=i[0].parent;n.parent&&"prompt"!==n.type&&(t=[e.offsetOf(n.leftSibling),e.offsetOf(n)])}if(1===i.length&&"placeholder"===i[0].type&&"genfrac"===i[0].parent.type){const t=i[0].parent,o="below"===i[0].parentBranch?"above":"below",r=e.offsetOf(t.leftSibling);return e.deferNotifications({content:!0,selection:!0,type:n},(()=>{var n,i;const a=t.removeBranch(o);if(1!==a.length||"placeholder"!==a[0].type){const i=t.parent.addChildrenAfter(a,t);null==(n=t.parent)||n.removeChild(t),e.position=e.offsetOf(i)}else null==(i=t.parent)||i.removeChild(t),e.position=Math.max(0,r)}))}}return e.deferNotifications({content:!0,selection:!0,type:n},(()=>e.deleteAtoms(t)))}Dc({deleteAll:e=>e.contentWillChange({inputType:"deleteContent"})&&Zu(e,[0,-1],"deleteContent"),deleteForward:e=>function(e){return!!e.mathfield.isSelectionEditable&&!!e.contentWillChange({inputType:"deleteContentForward"})&&(e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentForward"},(()=>{var t,n;let i=e.at(e.position).rightSibling;if(i&&Gu(e,"forward",i))return;if(i){if(e.at(e.position).isLastSibling&&Gu(e,"forward",i.parent,i.parentBranch))return}else{if(i=e.at(e.position),i.isLastSibling&&Gu(e,"forward",i.parent,i.parentBranch))return;i=void 0}if(e.position===e.lastOffset||!i)return void e.announce("plonk");i.parent.removeChild(i);let o=null==(t=e.at(e.position))?void 0:t.rightSibling;for(;"subsup"===(null==o?void 0:o.type);)o.parent.removeChild(o),o=null==(n=e.at(e.position))?void 0:n.rightSibling;e.announce("delete",void 0,[i])})):Zu(e,Oa(e.selection),"deleteContentForward"))}(e),deleteBackward:e=>function(e){return!!e.mathfield.isSelectionEditable&&!!e.contentWillChange({inputType:"deleteContentBackward"})&&(e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentBackward"},(()=>{let t=e.at(e.position);if(!t||!Gu(e,"backward",t)){if(null==t?void 0:t.isFirstSibling){if(Gu(e,"backward",t.parent,t.parentBranch))return;t=null}t?(e.position=e.offsetOf(t.leftSibling),t.parent.removeChild(t),e.announce("delete",void 0,[t])):e.announce("plonk")}})):Zu(e,Oa(e.selection),"deleteContentBackward"))}(e),deleteNextWord:e=>e.contentWillChange({inputType:"deleteWordForward"})&&Zu(e,[e.anchor,Ad(e,e.position,"forward")],"deleteWordForward"),deletePreviousWord:e=>e.contentWillChange({inputType:"deleteWordBackward"})&&Zu(e,[e.anchor,Ad(e,e.position,"backward")],"deleteWordBackward"),deleteToGroupStart:e=>e.contentWillChange({inputType:"deleteSoftLineBackward"})&&Zu(e,[e.anchor,e.offsetOf(e.at(e.position).firstSibling)],"deleteSoftLineBackward"),deleteToGroupEnd:e=>e.contentWillChange({inputType:"deleteSoftLineForward"})&&Zu(e,[e.anchor,e.offsetOf(e.at(e.position).lastSibling)],"deleteSoftLineForward"),deleteToMathFieldStart:e=>e.contentWillChange({inputType:"deleteHardLineBackward"})&&Zu(e,[e.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:e=>e.contentWillChange({inputType:"deleteHardLineForward"})&&Zu(e,[e.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var Yu=`<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${x("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`,Qu=`<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${x("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`;function ep(e){if(e&&(e.classList.remove("ML__highlight"),e.children))for(const t of e.children)ep(t)}function tp(e,t){var n;e&&(t&&(null==(n=e.dataset)?void 0:n.atomId)!==t?(e.classList.remove("ML__highlight"),e.children&&e.children.length>0&&[...e.children].forEach((e=>{e instanceof HTMLElement&&tp(e,t)}))):(e.classList.add("ML__highlight"),e.children&&e.children.length>0&&[...e.children].forEach((e=>{e instanceof HTMLElement&&tp(e)}))))}f()||console.error('MathLive 0.98.5: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');var np=new WeakMap,ip={letterShapeStyle:"mf.letterShapeStyle = ...",horizontalSpacingScale:'Removed. Use `"thinmuskip"`, `"medmuskip"`, and `"thickmuskip"` registers ',macros:"mf.macros = ...",registers:"mf.registers = ...",backgroundColorMap:"mf.backgroundColorMap = ...",colorMap:"mf.colorMap = ...",enablePopover:"mf.popoverPolicy = ...",mathModeSpace:"mf.mathModeSpace = ...",placeholderSymbol:"mf.placeholderSymbol = ...",readOnly:"mf.readOnly = ...",removeExtraneousParentheses:"mf.removeExtraneousParentheses = ...",scriptDepth:"mf.scriptDepth = ...",smartFence:"mf.smartFence = ...",smartMode:"mf.smartMode = ...",smartSuperscript:"mf.smartSuperscript = ...",inlineShortcutTimeout:"mf.inlineShortcutTimeout = ...",inlineShortcuts:"mf.inlineShortcuts = ...",keybindings:"mf.keybindings = ...",virtualKeyboardMode:"mf.mathVirtualKeyboardPolicy = ...",customVirtualKeyboardLayers:"mathVirtualKeyboard.layers = ...",customVirtualKeyboards:"mathVirtualKeyboard.layouts = ...",keypressSound:"mathVirtualKeyboard.keypressSound = ...",keypressVibration:"mathVirtualKeyboard.keypressVibration = ...",plonkSound:"mathVirtualKeyboard.plonkSound = ...",virtualKeyboardContainer:"mathVirtualKeyboard.container = ...",virtualKeyboardLayout:"mathVirtualKeyboard.alphabeticLayout = ...",virtualKeyboardTheme:"No longer supported",virtualKeyboardToggleGlyph:"No longer supported",virtualKeyboardToolbar:"mathVirtualKeyboard.editToolbar = ...",virtualKeyboards:"Use `mathVirtualKeyboard.layouts`",speechEngine:"`MathfieldElement.speechEngine`",speechEngineRate:"`MathfieldElement.speechEngineRate`",speechEngineVoice:"`MathfieldElement.speechEngineVoice`",textToSpeechMarkup:"`MathfieldElement.textToSpeechMarkup`",textToSpeechRules:"`MathfieldElement.textToSpeechRules`",textToSpeechRulesOptions:"`MathfieldElement.textToSpeechRulesOptions`",readAloudHook:"`MathfieldElement.readAloudHook`",speakHook:"`MathfieldElement.speakHook`",computeEngine:"`MathfieldElement.computeEngine`",fontsDirectory:"`MathfieldElement.fontsDirectory`",soundsDirectory:"`MathfieldElement.soundsDirectory`",createHTML:"`MathfieldElement.createHTML`",onExport:"`MathfieldElement.onExport`",onInlineShortcut:"`MathfieldElement.onInlineShortcut`",onScrollIntoView:"`MathfieldElement.onScrollIntoView`",locale:"MathfieldElement.locale = ...",strings:"MathfieldElement.strings = ...",decimalSeparator:"MathfieldElement.decimalSeparator = ...",fractionNavigationOrder:"MathfieldElement.fractionNavigationOrder = ..."},op=class e extends HTMLElement{static get formAssociated(){return lp()}static get optionsAttributes(){return{"default-mode":"string","letter-shape-style":"string","min-font-scale":"number","popover-policy":"string","math-mode-space":"string","read-only":"boolean","remove-extraneous-parentheses":"on/off","smart-fence":"on/off","smart-mode":"on/off","smart-superscript":"on/off","inline-shortcut-timeout":"string","script-depth":"string",placeholder:"string","virtual-keyboard-target-origin":"string","math-virtual-keyboard-policy":"string"}}static get observedAttributes(){return[...Object.keys(this.optionsAttributes),"contenteditable","disabled","readonly","read-only"]}static get fontsDirectory(){return this._fontsDirectory}static set fontsDirectory(e){e!==this._fontsDirectory&&(this._fontsDirectory=e,async function(){kc="not-loaded",Mc()}())}get fontsDirectory(){throw new Error("Use MathfieldElement.fontsDirectory instead")}set fontsDirectory(e){throw new Error("Use MathfieldElement.fontsDirectory instead")}static get soundsDirectory(){return this._soundsDirectory}static set soundsDirectory(e){this._soundsDirectory=e,this.audioBuffers={}}get soundsDirectory(){throw new Error("Use MathfieldElement.soundsDirectory instead")}set soundsDirectory(e){throw new Error("Use MathfieldElement.soundsDirectory instead")}static get keypressSound(){return this._keypressSound}static set keypressSound(e){var t,n,i;this.audioBuffers={},null===e?this._keypressSound={spacebar:null,return:null,delete:null,default:null}:"string"==typeof e?this._keypressSound={spacebar:e,return:e,delete:e,default:e}:"object"==typeof e&&"default"in e&&(this._keypressSound={spacebar:null!=(t=e.spacebar)?t:e.default,return:null!=(n=e.return)?n:e.default,delete:null!=(i=e.delete)?i:e.default,default:e.default})}static get plonkSound(){return this._plonkSound}static set plonkSound(e){this.audioBuffers={},this._plonkSound=e}static get audioContext(){return this._audioContext||(this._audioContext=new AudioContext),this._audioContext}static get speechEngine(){return this._speechEngine}static set speechEngine(e){this._speechEngine=e}static get speechEngineRate(){return this._speechEngineRate}static set speechEngineRate(e){this._speechEngineRate=e}static get speechEngineVoice(){return this._speechEngineVoice}static set speechEngineVoice(e){this._speechEngineVoice=e}static get textToSpeechMarkup(){return this._textToSpeechMarkup}static set textToSpeechMarkup(e){this._textToSpeechMarkup=e}static get textToSpeechRules(){return this._textToSpeechRules}static set textToSpeechRules(e){this._textToSpeechRules=e}static get textToSpeechRulesOptions(){return this._textToSpeechRulesOptions}static set textToSpeechRulesOptions(e){this._textToSpeechRulesOptions=e}static get locale(){return v.locale}static set locale(e){"auto"===e&&(e=navigator.language.slice(0,5)),v.locale=e}get locale(){throw new Error("Use MathfieldElement.locale instead")}set locale(e){throw new Error("Use MathfieldElement.locale instead")}static get strings(){return v.strings}static set strings(e){v.merge(e)}get strings(){throw new Error("Use MathfieldElement.strings instead")}set strings(e){throw new Error("Use MathfieldElement.strings instead")}static get decimalSeparator(){return this._decimalSeparator}static set decimalSeparator(e){this._decimalSeparator=e,this._computeEngine&&(this._computeEngine.latexOptions.decimalMarker=","===this.decimalSeparator?"{,}":".")}get decimalSeparator(){throw new Error("Use MathfieldElement.decimalSeparator instead")}set decimalSeparator(e){throw new Error("Use MathfieldElement.decimalSeparator instead")}static get computeEngine(){var e,t;if(void 0===this._computeEngine){const t=null==(e=window[Symbol.for("io.cortexjs.compute-engine")])?void 0:e.ComputeEngine;if(!t)return null;this._computeEngine=new t,this._computeEngine&&","===this.decimalSeparator&&(this._computeEngine.latexOptions.decimalMarker="{,}")}return null!=(t=this._computeEngine)?t:null}static set computeEngine(e){this._computeEngine=e}get computeEngine(){throw new Error("Use MathfieldElement.computeEngine instead")}set computeEngine(e){throw new Error("Use MathfieldElement.computeEngine instead")}static get isFunction(){return"function"!=typeof this._isFunction?()=>!1:this._isFunction}static set isFunction(e){this._isFunction=e}static async loadSound(e){delete this.audioBuffers[e];let t="";switch(e){case"keypress":t=this._keypressSound.default;break;case"return":t=this._keypressSound.return;break;case"spacebar":t=this._keypressSound.spacebar;break;case"delete":t=this._keypressSound.delete;break;case"plonk":t=this.plonkSound}if("string"!=typeof t)return;t=t.trim();const n=this.soundsDirectory;if(null!=n&&"null"!==n&&"none"!==t&&"null"!==t)try{const i=await fetch(await _c(`${n}/${t}`)),o=await i.arrayBuffer(),r=await this.audioContext.decodeAudioData(o);this.audioBuffers[e]=r}catch(e){}}static async playSound(e){if("suspended"!==this.audioContext.state&&"interrupted"!==this.audioContext.state||await this.audioContext.resume(),this.audioBuffers[e]||await this.loadSound(e),!this.audioBuffers[e])return;const t=this.audioContext.createBufferSource();t.buffer=this.audioBuffers[e];const n=this.audioContext.createGain();n.gain.value=.5,t.connect(n).connect(this.audioContext.destination),t.start()}constructor(e){if(super(),e){const t=[];for(const n of Object.keys(e))if(ip[n])if(ip[n].startsWith("mf."))if(ip[n].startsWith(`mf.${n}`))t.push(`Option \`${n}\` cannot be used as a constructor option. Use ${ip[n]}`);else{const e=ip[n].match(/([a-zA-Z]+) =/);t.push(`Option \`${n}\` has been renamed \`${e[1]}\``)}else t.push(`Option \`${n}\` cannot be used as a constructor option. Use ${ip[n]}`);if(t.length>0){console.group("%cMathLive 0.98.5: %cInvalid Options","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn("Some of the options passed to `new MathfieldElement(...)` are invalid. \n See https://cortexjs.io/mathlive/changelog/ for details.");for(const e of t)console.warn(e);console.groupEnd()}}if(lp()&&(this._internals=this.attachInternals(),this._internals.role="math",this._internals.ariaLabel="math input field",this._internals.ariaMultiLine="false"),this.attachShadow({mode:"open",delegatesFocus:!0}),this.shadowRoot&&"adoptedStyleSheets"in this.shadowRoot){this.shadowRoot.adoptedStyleSheets=[us("core"),us("mathfield"),us("mathfield-element"),us("ui"),us("menu")],this.shadowRoot.appendChild(document.createElement("span"));const e=document.createElement("slot");e.style.display="none",this.shadowRoot.appendChild(e)}else this.shadowRoot.innerHTML="<style>"+hs("core")+hs("mathfield")+hs("mathfield-element")+hs("ui")+hs("menu")+'</style><span></span><slot style="display:none"></slot>';e&&this._setOptions(e),this.shadowRoot.addEventListener("slotchange",(()=>{var e;const t=this.shadowRoot.querySelector("slot:not([name])");this.value=null!=(e=null==t?void 0:t.assignedNodes().map((e=>3===e.nodeType?e.textContent:"")).join("").trim())?e:""}))}showMenu(e){var t,n;return null!=(n=null==(t=this._mathfield)?void 0:t.showMenu(e))&&n}get mathVirtualKeyboard(){throw new Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.")}onPointerDown(){window.addEventListener("pointerup",(e=>{var t;e.target!==this||(null==(t=this._mathfield)?void 0:t.disabled)||this.dispatchEvent(new MouseEvent("click",{altKey:e.altKey,button:e.button,buttons:e.buttons,clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,movementX:e.movementX,movementY:e.movementY,relatedTarget:e.relatedTarget,screenX:e.screenX,screenY:e.screenY,shiftKey:e.shiftKey}))}),{once:!0})}getPromptValue(e,t){var n,i;return null!=(i=null==(n=this._mathfield)?void 0:n.getPromptValue(e,t))?i:""}setPromptValue(e,t,n){var i;null==(i=this._mathfield)||i.setPromptValue(e,t,n)}getPromptRange(e){var t,n;return null!=(n=null==(t=this._mathfield)?void 0:t.getPromptRange(e))?n:null}getPrompts(e){var t,n;return null!=(n=null==(t=this._mathfield)?void 0:t.getPrompts(e))?n:[]}get form(){var e;return null==(e=this._internals)?void 0:e.form}get name(){var e;return null!=(e=this.getAttribute("name"))?e:""}get type(){return this.localName}get mode(){var e,t;return null!=(t=null==(e=this._mathfield)?void 0:e.model.mode)?t:"text"===this.defaultMode?"text":"math"}set mode(e){var t;null==(t=this._mathfield)||t.switchMode(e)}get expression(){if(this._mathfield)return window[Symbol.for("io.cortexjs.compute-engine")]?this._mathfield.expression:(console.error('MathLive 0.98.5: The CortexJS Compute Engine library is not available.\n \n Load the library, for example with:\n \n import "https://unpkg.com/@cortex-js/compute-engine?module"'),null)}set expression(t){var n,i;if(!this._mathfield)return;const o=null!=(i=null==(n=e.computeEngine)?void 0:n.box(t).latex)?i:null;null!==o&&this._mathfield.setValue(o),window[Symbol.for("io.cortexjs.compute-engine")]||console.error('MathLive 0.98.5: The CortexJS Compute Engine library is not available.\n \n Load the library, for example with:\n \n import "https://unpkg.com/@cortex-js/compute-engine?module"')}get errors(){var e,t;return null!=(t=null==(e=this._mathfield)?void 0:e.errors)?t:[]}_getOptions(e){return this._mathfield?hd(this._mathfield.options,e):np.has(this)?d({},hd(d(d({},ud()),dd(np.get(this).options)),e)):null}getOptions(e){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOptions()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._mathfield?hd(this._mathfield.options,e):np.has(this)?hd(d(d({},ud()),dd(np.get(this).options)),e):null}reflectAttributes(){const t=ud(),n=this._getOptions();Object.keys(e.optionsAttributes).forEach((i=>{const o=ap(i);"on/off"===e.optionsAttributes[i]?t[o]!==n[o]?this.setAttribute(i,n[o]?"on":"off"):this.removeAttribute(i):t[o]!==n[o]&&("boolean"===e.optionsAttributes[i]?n[o]?this.setAttribute(i,""):this.removeAttribute(i):"string"!=typeof n[o]&&"number"!=typeof n[o]||this.setAttribute(i,n[o].toString()))}))}getOption(e){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOption()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._getOptions([e])[e]}_getOption(e){return this._getOptions([e])[e]}_setOptions(e){if(this._mathfield)this._mathfield.setOptions(e);else if(np.has(this)){const t=d(d({},np.get(this).options),e);np.set(this,h(d({},np.get(this)),{selection:{ranges:t.readOnly?[[0,0]]:[[0,-1]]},options:t}))}else np.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:e,menuItems:void 0});this.reflectAttributes()}setOptions(e){console.group("%cMathLive 0.98.5: %cDeprecated Usage","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn(" `mf.setOptions()` is deprecated. Set the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.");for(const t of Object.keys(e))ip[t]&&console.warn(`\`mf.setOptions({${t}:...})\` -> ${ip[t]}`);console.groupEnd(),this._setOptions(e)}executeCommand(e){var t,n;return null!=(n=null==(t=this._mathfield)?void 0:t.executeCommand(e))&&n}getValue(e,t,n){var i,o;if(this._mathfield)return this._mathfield.model.getValue(e,t,n);if(np.has(this)){let r,a,s;if(Ia(e)?([r,a]=e.ranges[0],s=t):Na(e)?([r,a]=e,s=t):qa(e)&&qa(t)?(r=e,a=t,s=n):(r=0,a=-1,s=e),(void 0===s||"latex"===s)&&0===r&&-1===a)return null!=(o=null!=(i=np.get(this).value)?i:this.textContent)?o:""}return""}setValue(e,t){if(this._mathfield&&void 0!==e)return null!=t||(t={silenceNotifications:!0,mode:"math"}),void this._mathfield.setValue(e,t);if(np.has(this)){const t=np.get(this).options;return void np.set(this,{value:e,selection:{ranges:[[-1,-1]],direction:"forward"},options:t,menuItems:void 0})}const n=sp(this);np.set(this,{value:e,selection:{ranges:[[-1,-1]],direction:"forward"},options:n,menuItems:void 0})}hasFocus(){var e,t;return null!=(t=null==(e=this._mathfield)?void 0:e.hasFocus())&&t}focus(){var e;null==(e=this._mathfield)||e.focus()}blur(){var e;null==(e=this._mathfield)||e.blur()}select(){var e;null==(e=this._mathfield)||e.select()}insert(e,t){var n,i;return null!=(i=null==(n=this._mathfield)?void 0:n.insert(e,t))&&i}applyStyle(e,t){var n;return null==(n=this._mathfield)?void 0:n.applyStyle(e,t)}queryStyle(e){var t,n;return null!=(n=null==(t=this._mathfield)?void 0:t.queryStyle(e))?n:"none"}get caretPoint(){var e,t;return null!=(t=null==(e=this._mathfield)?void 0:e.getCaretPoint())?t:null}set caretPoint(e){var t;e&&(null==(t=this._mathfield)||t.setCaretPoint(e.x,e.y))}setCaretPoint(e,t){var n,i;return null!=(i=null==(n=this._mathfield)?void 0:n.setCaretPoint(e,t))&&i}offsetFromPoint(e,t,n){return this._mathfield?ph(this._mathfield,e,t,n):-1}hitboxFromOffset(e){if(!this._mathfield)return null;const t=this._mathfield.model.at(e);if(!t)return null;const n=rs(this._mathfield,t);return n?new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top):null}resetUndo(){var e;null==(e=this._mathfield)||e.resetUndo()}canUndo(){return!!this._mathfield&&this._mathfield.canUndo()}canRedo(){return!!this._mathfield&&this._mathfield.canRedo()}handleEvent(e){var t,n,i,o;"closed"===Ql.state&&"closed"===(null==(n=null==(t=this._mathfield)?void 0:t.menu)?void 0:n.state)&&("pointerdown"===e.type&&this.onPointerDown(),"focus"===e.type&&(null==(i=this._mathfield)||i.focus()),"blur"===e.type&&(null==(o=this._mathfield)||o.blur()))}connectedCallback(){var t,n,i,o;const r=window.getComputedStyle(this),a=this.shadowRoot,s="none"!==r.userSelect;if(s)a.host.addEventListener("pointerdown",this,!0);else{a.querySelector("span").style.pointerEvents="none"}a.host.addEventListener("focus",this,!0),a.host.addEventListener("blur",this,!0),lp()||(this.hasAttribute("role")||this.setAttribute("role","math"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","math input field"),this.setAttribute("aria-multiline","false")),s&&!this.hasAttribute("contenteditable")&&this.setAttribute("contenteditable","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const l=a.querySelector("slot:not([name])");if(l)try{this._style=l.assignedElements().filter((e=>"style"===e.tagName.toLowerCase())).map((e=>e.textContent)).join("")}catch(e){console.error(e)}if(this._style){const e=document.createElement("style");e.textContent=this._style,a.appendChild(e)}let c="";if(c=this.hasAttribute("value")?this.getAttribute("value"):null!=(t=null==l?void 0:l.assignedNodes().map((e=>3===e.nodeType?e.textContent:"")).join("").trim())?t:"",this._mathfield=new class{constructor(e,t){var n,i,o;this.focusBlurInProgress=!1,this.options=d(h(d({},ud()),{macros:ie(),registers:La()}),dd(t)),this.eventController=new AbortController;const r=this.eventController.signal;t.eventSink&&(this.host=t.eventSink),this.element=e,e.mathfield=this,this.blurred=!0,this.keystrokeCaptionVisible=!1,this.suggestionIndex=0,this.inlineShortcutBuffer=[],this.inlineShortcutBufferFlushTimer=0,this.defaultStyle={},this.adoptStyle="left","inline-math"===this.options.defaultMode?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline"),this.dirty=!1;let a=null!=(i=null!=(n=t.value)?n:this.element.textContent)?i:"";a=a.trim();const s=pd(this.options),l=new za({type:"root",mode:s,body:Qs(a,{context:this.context})});this.model=new class{constructor(e,t,n){this.mathfield=e,this.mode=t,this.silenceNotifications=!1,this._selection={ranges:[[0,0]],direction:"none"},this._anchor=0,this._position=0,this.root=n}dispose(){this.mathfield=void 0}getState(){const e={ranges:[...this._selection.ranges]};return this.selection.direction&&"none"!==this.selection.direction&&(e.direction=this.selection.direction),{content:this.root.toJson(),selection:e,mode:this.mode}}setState(e,t){var n;const i=this.silenceNotifications;this.silenceNotifications=null==(n=null==t?void 0:t.silenceNotifications)||n;let o={};if("undo"===(null==t?void 0:t.type)&&(o={inputType:"historyUndo"}),"redo"===(null==t?void 0:t.type)&&(o={inputType:"historyRedo"}),this.contentWillChange(o)){const t=this.silenceNotifications;this.silenceNotifications=!0,this.mode=e.mode,this.root=Ll(e.content),this.selection=e.selection,this.silenceNotifications=t,this.contentDidChange(o)}this.silenceNotifications=i}get atoms(){return this.root.children}get selection(){return this._selection}set selection(e){this.setSelection(e)}setSelection(e,t){return!(!this.mathfield.contentEditable&&"none"===this.mathfield.userSelect)&&this.deferNotifications({selection:!0},(()=>{var n,i,o;const r=this.normalizeSelection(e,t);if(void 0===r)throw new TypeError("Invalid selection");if(1===r.ranges.length&&r.ranges[0][0]===r.ranges[0][1]){const e=r.ranges[0][0];return this.mathfield.dirty||(null==(n=this.at(e))?void 0:n.parentPrompt)||!this.mathfield.hasEditablePrompts?(this._anchor=e,this._position=e,void(this._selection=r)):(null==(i=this.at(e-1))?void 0:i.parentPrompt)?(this._anchor=this.normalizeOffset(e-1),this._position=this._anchor,void(this._selection=this.normalizeSelection(this._anchor))):(null==(o=this.at(e+1))?void 0:o.parentPrompt)?(this._anchor=this.normalizeOffset(e+1),this._position=this._anchor,void(this._selection=this.normalizeSelection(this._anchor))):(this._anchor=0,this._position=0,void(this._selection={ranges:[[0,0]]}))}const a=Oa(r);"backward"===r.direction?[this._position,this._anchor]=a:[this._anchor,this._position]=a;const s=this.at(a[0]+1),l=this.at(a[1]),c=za.commonAncestor(s,l);"array"===(null==c?void 0:c.type)&&s.parent===c&&l.parent,this._selection={ranges:[a],direction:r.direction},console.assert(this._position>=0&&this._position<=this.lastOffset)}))}setPositionHandlingPlaceholder(e){var t;const n=this.at(e);"placeholder"===(null==n?void 0:n.type)?this.setSelection(e-1,e):"placeholder"===(null==(t=null==n?void 0:n.rightSibling)?void 0:t.type)?this.setSelection(e,e+1):this.position=e,n instanceof dl&&n.isSuggestion&&(n.isSuggestion=!1),this.mathfield.stopCoalescingUndo()}get position(){return this._position}set position(e){this.setSelection(e,e)}get anchor(){return this._anchor}get selectionIsCollapsed(){return this._anchor===this._position}get selectionIsPlaceholder(){return 1===Math.abs(this._anchor-this._position)&&"placeholder"===this.at(Math.max(this._anchor,this._position)).type}collapseSelection(e="forward"){return this._anchor!==this._position&&(this.position="backward"===e?Math.min(this._anchor,this._position):Math.max(this._anchor,this._position),!0)}get lastOffset(){return this.atoms.length-1}at(e){return this.atoms[e]}offsetOf(e){return this.atoms.indexOf(e)}getSiblingsRange(e){const t=this.at(e),{parent:n}=t;if(!n)return[0,this.lastOffset];const i=t.parent.branch(t.parentBranch);return[this.offsetOf(i[0]),this.offsetOf(i[i.length-1])]}getBranchRange(e,t){const n=this.at(e).branch(t);return[this.offsetOf(n[0]),this.offsetOf(n[n.length-1])]}getAtoms(e,t,n){let i,o,r=null!=n?n:{};if(Ia(e)){if(r=null!=t?t:{},e.ranges.length>1)return e.ranges.reduce(((e,t)=>[...e,...this.getAtoms(t,r)]),[]);e=e.ranges[0]}if(qa(e)){if(i=e,!qa(t))return[];o=t}else[i,o]=e,r=null!=t?t:{};if(!Number.isFinite(i))return[];void 0===r.includeChildren&&(r.includeChildren=!1),i<0&&(i=this.lastOffset-i+1),o<0&&(o=this.lastOffset-o+1);const a=Math.min(i,o)+1,s=Math.max(i,o);if(!r.includeChildren&&1===a&&s===this.lastOffset)return[this.root];let l=[];for(let e=a;e<=s;e++){const t=this.atoms[e];Ju(this,t,a,s)&&l.push(t)}return r.includeChildren||(l=l.filter((e=>{let t=!1,{parent:n}=e;for(;n&&!t;)t=Ju(this,n,a,s),n=n.parent;return!t}))),l}getAllAtoms(e=0){const t=[],n=this.lastOffset;for(let i=e;i<=n;i++)t.push(this.atoms[i]);for(let n=0;n<e;n++)t.push(this.atoms[n]);return t}findAtom(e,t=0,n="forward"){let i;const o=this.lastOffset;if("forward"!==n){for(let n=t;n>=0;n--)if(i=this.atoms[n],e(i))return i;for(let n=o;n>t;n--)if(i=this.atoms[n],e(i))return i}else{for(let n=t;n<=o;n++)if(i=this.atoms[n],e(i))return i;for(let n=0;n<t;n++)if(i=this.atoms[n],e(i))return i}}extractAtoms(e){let t=this.getAtoms(e);if(1===t.length&&!t[0].parent){if("root"!==t[0].type)return t=this.root.cells.flat(),this.root=new za({type:"root",body:[]}),t;t=[...t[0].body],t.shift()}for(const e of t)e.parent.removeChild(e);return t}deleteAtoms(e){this.extractAtoms(e),this.position=e[0]}atomToString(e,t){const n=null!=t?t:"latex";if(n.startsWith("latex"))return za.serialize([e],{expandMacro:"latex-expanded"===n,skipStyles:"latex-unstyled"===n,skipPlaceholders:"latex-without-placeholders"===n,defaultMode:this.mathfield.options.defaultMode});if("math-ml"===n)return su(e);if("spoken"===n)return gu(e);if("spoken-text"===n){const t=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="";const n=gu(e);return window.MathfieldElement.textToSpeechMarkup=t,n}if("spoken-ssml"===n||"spoken-ssml-with-highlighting"===n){const t=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="ssml";const n=gu(e);return window.MathfieldElement.textToSpeechMarkup=t,n}return"ascii-math"===n?vu(e):(console.error(`MathLive 0.98.5: Unexpected format "${n}`),"")}getValue(e,t,n){if(void 0===e)return this.atomToString(this.root,"latex");if("string"==typeof e&&"math-json"!==e)return this.atomToString(this.root,e);let i,o;if(qa(e)&&qa(t)?(i=[this.normalizeRange([e,t])],o=n):Na(e)?(i=[this.normalizeRange(e)],o=t):Ia(e)?(i=e.ranges,o=t):(i=[this.normalizeRange([0,-1])],o=e),null!=o||(o="latex"),"math-json"===o){if(!window.MathfieldElement.computeEngine)return window[Symbol.for("io.cortexjs.compute-engine")]||console.error('The CortexJS Compute Engine library is not available.\nLoad the library, for example with:\nimport "https://unpkg.com/@cortex-js/compute-engine?module"'),'["Error", "compute-engine-not-available"]';const e=this.getValue({ranges:i},"latex-unstyled");try{const t=window.MathfieldElement.computeEngine.parse(e);return JSON.stringify(t.json)}catch(e){return JSON.stringify(["Error",`'${e.toString()}'`])}}if(o.startsWith("latex")){const e={expandMacro:"latex-expanded"===o,skipStyles:"latex-unstyled"===o,skipPlaceholders:"latex-without-placeholders"===o,defaultMode:this.mathfield.options.defaultMode};return Yr(i.map((t=>za.serialize(this.getAtoms(t),e))))}return i.map((e=>this.getAtoms(e).map((e=>this.atomToString(e,o))).join(""))).join("")}extendSelectionTo(e,t){return!(!this.mathfield.contentEditable&&"none"===this.mathfield.userSelect)&&this.deferNotifications({selection:!0},(()=>{const n=this.normalizeRange([e,t]);let[i,o]=n,{parent:r}=this.at(o);if(r&&("genfrac"===r.type||"subsup"===r.type))for(;r!==this.root&&Xu(this,r,[i,o]);)o=this.offsetOf(r),r=r.parent;for(r=this.at(i).parent;r!==this.root&&Xu(this,r,[i,o]);)i=this.offsetOf(r.leftSibling),r=r.parent;if(r=this.at(o).parent,"genfrac"===(null==r?void 0:r.type))for(;r!==this.root&&Xu(this,r,[i,o]);)o=this.offsetOf(r),console.assert(o>=0),r=r.parent;this._position=this.normalizeOffset(t),this._selection={ranges:[[i,o]],direction:"none"}}))}announce(e,t,n=[]){var i,o;(null==(o=null==(i=this.mathfield.host)?void 0:i.dispatchEvent(new CustomEvent("announce",{detail:{command:e,previousPosition:t,atoms:n},cancelable:!0,bubbles:!0,composed:!0})))||o)&&Uu(this.mathfield,e,t,n)}deferNotifications(e,t){const n=this._selection,i=this._anchor,o=this._position,r=this.silenceNotifications;this.silenceNotifications=!0;const a=this.root.changeCounter;t();const s=this.root.changeCounter!==a,l=i!==this._anchor||o!==this._position||"different"===function(e,t){if(e.direction===t.direction){const n=e.ranges.length;if(t.ranges.length===n){let i=0;for(;i<n&&"equal"===Pa(e.ranges[i],t.ranges[i]);)i++;return i===n?"equal":"different"}}return"different"}(this._selection,n);return this.silenceNotifications=r,e.content&&s&&this.contentDidChange({inputType:e.type}),e.selection&&l&&this.selectionDidChange(),s||l}normalizeOffset(e){return e>0?e=Math.min(e,this.lastOffset):e<0&&(e=this.lastOffset+e+1),e}normalizeRange(e){let[t,n]=e;return t=this.normalizeOffset(t),n=this.normalizeOffset(n),t<n?[t,n]:[n,t]}normalizeSelection(e,t){var n;let i;if(qa(e)){const n=this.normalizeOffset(e);if(qa(t)){const e=this.normalizeOffset(t);i=n<=e?{ranges:[[n,e]],direction:"none"}:{ranges:[[e,n]],direction:"backward"}}else i={ranges:[[n,n]],direction:"none"}}else if(Na(e)){const t=this.normalizeOffset(e[0]),n=this.normalizeOffset(e[1]);i=t<=n?{ranges:[[t,n]],direction:"none"}:{ranges:[[n,t]],direction:"backward"}}else Ia(e)&&(i={ranges:e.ranges.map((e=>this.normalizeRange(e))),direction:null!=(n=e.direction)?n:"none"});return console.assert(void 0!==i),i}get parentEnvironment(){let e=this.at(this.position).parent;if(e){for(;e.parent&&"array"!==e.type;)e=e.parent;if("array"===e.type)return e}}get cell(){var e;let t=this.at(this.position);if(t){for(;t&&"array"!==(null==(e=t.parent)?void 0:e.type);)t=t.parent;if((null==t?void 0:t.parent)&&"array"===t.parent.type)return t.parentBranch}}contentWillChange(e={}){if(this.silenceNotifications||!this.mathfield)return!0;const t=this.silenceNotifications;this.silenceNotifications=!0;const n=this.mathfield.onContentWillChange(e);return this.silenceNotifications=t,n}contentDidChange(e){var t;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(yh(this.mathfield)),this.silenceNotifications||!this.mathfield.host||!this.mathfield)return;const n=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.host.dispatchEvent(new InputEvent("input",h(d({},e),{data:e.data?e.data:null!=(t=e.inputType)?t:"",bubbles:!0,composed:!0}))),this.silenceNotifications=n}selectionDidChange(){if(!this.mathfield)return;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(yh(this.mathfield)),this.silenceNotifications)return;const e=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.onSelectionDidChange(),this.silenceNotifications=e}}(this,s,l),this.undoManager=new Kd(this.model);const c=[];if(c.push("<span contenteditable=true aria-multiline=false part=keyboard-sink class=ML__keyboard-sink autocapitalize=off autocomplete=off autocorrect=off spellcheck=false inputmode=none tabindex=0></span>"),c.push('<span part=container class=ML__container aria-hidden=true style="visibility:hidden">'),c.push("<span part=content class=ML__content>"),c.push(Cc(this)),c.push("</span>"),window.mathVirtualKeyboard&&(c.push(`<div part=virtual-keyboard-toggle class=ML__virtual-keyboard-toggle role=button ${this.hasEditableContent?"":'style="display:none;"'} data-l10n-tooltip="tooltip.toggle virtual keyboard">`),c.push(Yu),c.push("</div>")),c.push('<div part=menu-toggle class=ML__menu-toggle role=button data-l10n-tooltip="tooltip.menu">'),c.push(Qu),c.push("</div>"),c.push("</span>"),c.push("<span class=ML__sr-only>"),c.push("<span role=status aria-live=assertive aria-atomic=true></span>"),c.push("</span>"),this.element.innerHTML=window.MathfieldElement.createHTML(c.join("")),!this.element.children)return void console.error("%cMathLive 0.98.5: Something went wrong and the mathfield could not be created.%c\nIf you are using Vue, this may be because you are using the runtime-only build of Vue. Make sure to include `runtimeCompiler: true` in your Vue configuration. There may a warning from Vue in the log above.","color:red;font-family:system-ui;font-size:1.2rem;font-weight:bold","color:inherit;font-family:system-ui;font-size:inherit;font-weight:inherit");this._l10Subscription=v.subscribe((()=>v.update(this.element))),v.update(this.element),this.field=this.element.querySelector("[part=content]"),this.field.addEventListener("click",(e=>e.stopImmediatePropagation()),{capture:!1,signal:r}),this.field.addEventListener("wheel",this,{passive:!1,signal:r}),"PointerEvent"in window?this.field.addEventListener("pointerdown",this,{signal:r}):this.field.addEventListener("mousedown",this,{signal:r}),null==(o=this.element.querySelector("[part=virtual-keyboard-toggle]"))||o.addEventListener("click",(()=>{window.mathVirtualKeyboard.visible?window.mathVirtualKeyboard.hide():(window.mathVirtualKeyboard.show({animate:!0}),window.mathVirtualKeyboard.update(yh(this)))}),{signal:r}),this._menu=new Vh(Iu(this),{host:this.host}),this.field.addEventListener("contextmenu",this,{signal:r});const u=this.element.querySelector("[part=menu-toggle]");var p;null==u||u.addEventListener("pointerdown",(e=>{if(e.currentTarget!==u)return;if("closed"!==this._menu.state)return;this.element.classList.add("tracking");const t=u.getBoundingClientRect();this._menu.modifiers=Xl(e),this._menu.show({target:u,location:{x:t.left,y:t.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),e.preventDefault(),e.stopPropagation()}),{signal:r}),(this.model.atoms.length<=1||this.disabled||this.readOnly&&!this.hasEditableContent||"none"===this.userSelect)&&(u.style.display="none"),this.ariaLiveText=this.element.querySelector("[role=status]"),this.keyboardDelegate=function(e,t,n){let i=null,o=null,r=!1,a=!1,s=!1;const l=new AbortController,c=l.signal;return e.addEventListener("keydown",(t=>{r||"Process"===t.key||"CapsLock"===t.code||/(Control|Meta|Alt|Shift)(Left|Right)/.test(t.code)?i=null:(i=t,o=null,n.onKeystroke(t)?e.textContent="":i=null)}),{capture:!0,signal:c}),e.addEventListener("keypress",(e=>{r||(i&&o&&n.onKeystroke(i),o=e)}),{capture:!0,signal:c}),e.addEventListener("compositionstart",(t=>{e.textContent="",r=!0,n.onCompositionStart(t.data)}),{capture:!0,signal:c}),e.addEventListener("compositionupdate",(e=>{r&&n.onCompositionUpdate(e.data)}),{capture:!0,signal:c}),e.addEventListener("compositionend",(t=>{e.textContent="",r&&(r=!1,n.onCompositionEnd(t.data))}),{capture:!0,signal:c}),e.addEventListener("beforeinput",(e=>e.stopImmediatePropagation()),{signal:c}),e.addEventListener("input",(t=>{var i;if(!r&&(e.textContent="","insertCompositionText"!==t.inputType)){if("insertFromPaste"===t.inputType)return t.preventDefault(),void t.stopPropagation();n.onInput(null!=(i=t.data)?i:""),t.preventDefault(),t.stopPropagation()}}),{signal:c}),e.addEventListener("paste",(t=>{e.focus({preventScroll:!0}),e.textContent="",n.onPaste(t)||t.preventDefault(),t.stopImmediatePropagation()}),{signal:c}),e.addEventListener("cut",(e=>n.onCut(e)),{capture:!0,signal:c}),e.addEventListener("copy",(e=>n.onCopy(e)),{capture:!0,signal:c}),e.addEventListener("blur",(r=>{var l,c;if((null==(c=null==(l=r.relatedTarget)?void 0:l._mathfield)?void 0:c.element)===t)return e.focus({preventScroll:!0}),r.preventDefault(),void r.stopPropagation();const d=Ql.state;return"open"===d||"opening"===d||r.relatedTarget===r.target.getRootNode().host?(r.preventDefault(),void r.stopPropagation()):void(s||a||(s=!0,i=null,o=null,n.onBlur(),s=!1))}),{capture:!0,signal:c}),e.addEventListener("focus",(e=>{s||a||(a=!0,n.onFocus(),a=!1)}),{capture:!0,signal:c}),{dispose:()=>l.abort(),cancelComposition:()=>{r&&(e.blur(),requestAnimationFrame((()=>e.focus({preventScroll:!0}))))},blur:()=>{"function"==typeof e.blur&&e.blur()},focus:()=>{a||"function"!=typeof e.focus||e.focus({preventScroll:!0})},hasFocus:()=>Yl()===e,setAriaLabel:t=>e.setAttribute("aria-label",t),setValue:t=>{var n;e.textContent=t,e.style.left="-1000px",null==(n=window.getSelection())||n.selectAllChildren(e)},moveTo:(t,n)=>{e.style.top=`${n}px`,e.style.left=`${t}px`}}}(this.element.querySelector(".ML__keyboard-sink"),this.element,this),window.addEventListener("resize",this,{signal:r}),document.addEventListener("scroll",this,{signal:r}),this.resizeObserver=new ResizeObserver((()=>Lc(this))),this.resizeObserver.observe(this.field),window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle",this,{signal:r}),Fl&&!v.locale.startsWith(Fl.locale)&&(p=v.locale,Fl=Vl.find((e=>p.startsWith(e.locale)))),"ready"!==kc&&document.fonts.ready.then((()=>Kc(this))),e.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value")}get defaultStyle(){return this._defaultStyle}set defaultStyle(e){this._defaultStyle=e}get effectiveStyle(){if("none"===this.adoptStyle)return this.defaultStyle;const e=this.model.at(this.model.position),t="right"===this.adoptStyle?e.rightSibling:e;if(!t)return this.defaultStyle;if("group"===t.type){const e=t.branch("body");return!e||e.length<2?{}:"right"===this.adoptStyle?e[1].computedStyle:e[e.length-1].computedStyle}return t.computedStyle}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(yh(this)),Kh(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,Eh())}showMenu(e){var t,n;const i=null!=(n=null!=(t=null==e?void 0:e.location)?t:ts(this.field))?n:void 0,o=null==e?void 0:e.modifiers,r=this.element.querySelector("[part=container]");return this._menu.show({target:r,location:i,modifiers:o})}get colorMap(){return e=>{var t,n,i;return null!=(i=null==(n=(t=this.options).colorMap)?void 0:n.call(t,e))?i:C(e)}}get backgroundColorMap(){return e=>{var t,n,i,o,r,a;return null!=(a=null!=(r=null==(n=(t=this.options).backgroundColorMap)?void 0:n.call(t,e))?r:null==(o=(i=this.options).colorMap)?void 0:o.call(i,e))?a:E(e)}}get smartFence(){var e;return null!=(e=this.options.smartFence)&&e}get readOnly(){var e;return null!=(e=this.options.readOnly)&&e}get disabled(){var e,t;return null!=(t=null==(e=this.host)?void 0:e.disabled)&&t}get contentEditable(){return!!this.host&&"false"!==this.host.getAttribute("contenteditable")}get userSelect(){if(!this.host)return"";const e=getComputedStyle(this.host);return e.getPropertyValue("user-select")||e.getPropertyValue("-webkit-user-select")}get hasEditableContent(){return!(this.disabled||!this.contentEditable)&&(!this.readOnly||this.hasEditablePrompts)}get hasEditablePrompts(){return this.readOnly&&!this.disabled&&this.contentEditable&&void 0!==this.model.findAtom((e=>"prompt"===e.type&&!e.locked))}get isSelectionEditable(){if(this.disabled||!this.contentEditable)return!1;if(!this.readOnly)return!0;const e=this.model.at(this.model.anchor),t=this.model.at(this.model.position),n=za.commonAncestor(e,t);return!("prompt"!==(null==n?void 0:n.type)&&!(null==n?void 0:n.parentPrompt))}get letterShapeStyle(){var e;return null!=(e=this.options.letterShapeStyle)?e:"tex"}get minFontScale(){return this.options.minFontScale}get selectionStyle(){if(this.model.selectionIsCollapsed)return this.effectiveStyle;const e=this.model.getAtoms(this.model.selection);if(0===e.length)return{};const t=d({},e[0].style);for(const n of e)for(const[e,i]of Object.entries(n.style))t[e]!==i&&delete t[e];return t}queryStyle(e){const t=nh(this,e);"verbatimColor"in t&&delete t.verbatimColor,"verbatimBackgroundColor"in t&&delete t.verbatimBackgroundColor;const n=Object.keys(t).length;if(0===n)return"all";if(n>1){for(const e of Object.keys(t)){const n=this.queryStyle({[e]:t[e]});if("none"===n)return"none";if("some"===n)return"some"}return"all"}const i=Object.keys(t)[0],o=t[i];if(this.model.selectionIsCollapsed)return this.effectiveStyle[i]===o?"all":"none";const r=this.model.getAtoms(this.model.selection,{includeChildren:!0});let a=r.length;if(0===a)return"none";let s=0;for(const e of r)"first"!==e.type?e.style[i]===o&&(s+=1):a-=1;return 0===s?"none":s===a?"all":"some"}get keybindings(){var e,t;if(this._keybindings)return this._keybindings;const[n,i]=function(e,t){const n=[],i=[];for(const o of e)try{const e=oc(o,t);if(!e)continue;const n=i.find((t=>t.key===e.key&&t.ifMode===e.ifMode));if(n)throw new Error(`Ambiguous key binding ${o.key} (${rc(o.command)}) matches ${n.key} (${rc(n.command)}) with the ${t.displayName} keyboard layout`);i.push(e)}catch(e){e instanceof Error&&n.push(e.message)}return[i,n]}(this.options.keybindings,null!=(e=jl())?e:function(){switch(Hl()){case"apple":return Pl;case"windows":return Ol;case"linux":return ql}return Pl}());return(null==(t=jl())?void 0:t.score)>0&&(this._keybindings=n,i.length>0&&console.error("MathLive 0.98.5: Invalid keybindings for current keyboard layout",i)),n}get menu(){return this._menu}setOptions(e){var t;this.options=d(d({},this.options),dd(e)),this._keybindings=void 0,"inline-math"===this.options.defaultMode?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline");let n=this.options.defaultMode;"inline-math"===n&&(n="math"),(null==(t=this.model.root.firstChild)?void 0:t.mode)!==n&&(this.model.root.firstChild.mode=n),this.options.readOnly&&this.hasFocus()&&window.mathVirtualKeyboard.visible&&this.executeCommand("hideVirtualKeyboard");const i=za.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==i)&&Za.insert(this.model,i,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",silenceNotifications:!0,mode:"math"}),("value"in e||"macros"in e||"registers"in e||"colorMap"in e||"backgroundColorMap"in e||"letterShapeStyle"in e||"minFontScale"in e||"readOnly"in e||"placeholderSymbol"in e)&&Lc(this)}getOptions(e){return hd(this.options,e)}getOption(e){return hd(this.options,e)}async handleEvent(e){var t;if(es(this))if($c(e)){if(!ss(e.origin,null!=(t=this.options.originValidator)?t:"none"))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");const{action:n}=e.data;if("execute-command"===n){const t=e.data.command;if("virtual-keyboard"===Tc(t))return;this.executeCommand(t)}else"update-state"===n||("focus"===n?this.focus({preventScroll:!0}):"blur"===n&&this.blur())}else switch(e.type){case"focus":this.onFocus();break;case"blur":this.onBlur();break;case"mousedown":"none"!==this.userSelect&&ch(this,e);break;case"pointerdown":"none"!==this.userSelect&&(ch(this,e),!1===e.shiftKey&&await Uh(e,this.element.querySelector("[part=container]"),this._menu)&&sh.stop());break;case"contextmenu":"none"!==this.userSelect&&!1===e.shiftKey&&await Uh(e,this.element.querySelector("[part=container]"),this._menu)&&sh.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&Kh(this);break;case"resize":case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame((()=>es(this)&&this.onGeometryChange()));break;case"wheel":this.onWheel(e);break;default:console.warn("Unexpected event type",e.type)}}dispose(){es(this)&&(v.unsubscribe(this._l10Subscription),this.keyboardDelegate.dispose(),this.keyboardDelegate=void 0,this.eventController.abort(),this.eventController=void 0,this.resizeObserver.disconnect(),window.mathVirtualKeyboard.removeEventListener("virtual-keyboard-toggle",this),this.disconnectFromVirtualKeyboard(),this.model.dispose(),delete this.element.mathfield,this.element=void 0,this.host=void 0,this.field=void 0,this.ariaLiveText=void 0,document.getElementById("mathlive-keystroke-caption-panel")&&(pc("mathlive-keystroke-caption-panel"),ms("core"),ms("keystroke-caption")),document.getElementById("mathlive-suggestion-popover")&&(pc("mathlive-suggestion-popover"),ms("suggestion-popover"),ms("core")),document.getElementById("mathlive-environment-popover")&&(pc("mathlive-environment-popover"),ms("environment-popover"),ms("core")))}flushInlineShortcutBuffer(e){if(null!=e||(e={defer:!1}),!e.defer)return this.inlineShortcutBuffer=[],clearTimeout(this.inlineShortcutBufferFlushTimer),void(this.inlineShortcutBufferFlushTimer=0);this.options.inlineShortcutTimeout>0&&(clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=setTimeout((()=>this.flushInlineShortcutBuffer()),this.options.inlineShortcutTimeout))}executeCommand(e){return"virtual-keyboard"===Tc(e)?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame((()=>window.mathVirtualKeyboard.update(yh(this)))),!1):function(e,t){var n;if(!t)return!1;let i,o=[],r=!1,a=!1;m(t)?(i=t[0],o=t.slice(1)):i=t,i=i.replace(/-\w/g,(e=>e[1].toUpperCase()));const s=Ac[i],l=null==s?void 0:s.target;if("model"===l){if(!e.isSelectionEditable&&(null==s?void 0:s.changeContent))return e.model.announce("plonk"),!1;/^(delete|add)/.test(i)&&("deleteBackward"!==i&&e.flushInlineShortcutBuffer(),e.snapshot(i)),/^complete/.test(i)||lc(e),Ac[i].fn(e.model,...o),cc(e),a=!0,r=!0}else if("virtual-keyboard"===l)a=null!=(n=window.mathVirtualKeyboard.executeCommand(t))&&n,r=!0;else{if(!Ac[i])throw new Error(`Unknown command "${i}"`);if(!e.isSelectionEditable&&(null==s?void 0:s.changeContent))return e.model.announce("plonk"),!1;/^(undo|redo)/.test(i)&&e.flushInlineShortcutBuffer(),a=Ac[i].fn(e,...o),r=!0}return"virtual-keyboard"!==l&&(!e.model.selectionIsCollapsed||(null==s?void 0:s.changeSelection)&&"deleteBackward"!==t)&&(e.flushInlineShortcutBuffer(),(null==s?void 0:s.changeContent)||e.stopCoalescingUndo(),e.defaultStyle={}),a&&Lc(e),r}(this,e)}get errors(){return el(this.model.getValue(),{context:this.context})}getValue(e,t,n){return this.model.getValue(e,t,n)}setValue(e,t){var n;void 0===(t=null!=t?t:{mode:"math"}).insertionMode&&(t.insertionMode="replaceAll"),void 0!==t.format&&"auto"!==t.format||(t.format="latex"),void 0!==t.mode&&"auto"!==t.mode||(t.mode=null!=(n=function(e,t){const n=e.at(t);let i;if(n){i=n.mode;let e=n.parent;for(;!i&&e;)e&&(i=e.mode),e=e.parent}return i}(this.model,this.model.position))?n:"math");const i=this.undoManager.canUndo();Za.insert(this.model,e,t)&&(Lc(this),i||this.undoManager.reset(),this.undoManager.snapshot("set-value"))}get expression(){const e=window.MathfieldElement.computeEngine;return e?e.box(e.parse(this.model.getValue("latex-unstyled"))):(console.error("MathLive 0.98.5: no compute engine available. Make sure the Compute Engine library is loaded."),null)}scrollIntoView(){var e;if(!this.element)return;if(this.host)if(this.options.onScrollIntoView)this.options.onScrollIntoView(this);else if(this.host.scrollIntoView({block:"nearest",inline:"nearest"}),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.container===window.document.body){const t=window.mathVirtualKeyboard.boundingRect,n=this.host.getBoundingClientRect();n.bottom>t.top&&(null==(e=window.document.scrollingElement)||e.scrollBy(0,n.bottom-t.top+8))}this.dirty&&Ec(this,{interactive:!0});const t=this.field.getBoundingClientRect();let n=null;if(this.model.selectionIsCollapsed)n=ts(this.field);else{const e=as(this);if(e.length>0){let i=-1/0,o=-1/0;for(const t of e)t.right>i&&(i=t.right),t.top<o&&(o=t.top);n={x:i+t.left-this.field.scrollLeft,y:o+t.top-this.field.scrollTop,height:0}}}if(this.host&&n){const e=this.host.getBoundingClientRect(),t=n.y;let i=this.host.scrollTop;t<e.top?i=t-e.top+this.host.scrollTop:t>e.bottom&&(i=t-e.bottom+this.host.scrollTop+n.height),this.host.scroll({top:i,left:0})}if(n){const e=n.x-window.scrollX;let i=this.field.scrollLeft;e<t.left?i=e-t.left+this.field.scrollLeft-20:e>t.right&&(i=e-t.right+this.field.scrollLeft+20),this.field.scroll({top:this.field.scrollTop,left:i})}}insert(e,t){return!("string"!=typeof e||0===e.length&&("insertBefore"===(null==t?void 0:t.insertionMode)||"insertAfter"===(null==t?void 0:t.insertionMode))||0===e.length&&this.model.selectionIsCollapsed||(this.flushInlineShortcutBuffer(),(t=null!=t?t:{mode:"math"}).focus&&this.focus(),t.feedback&&(window.MathfieldElement.keypressVibration&&g()&&navigator.vibrate(3),window.MathfieldElement.playSound("keypress")),"\\\\"===e?kd(this.model):"&"===e?Md(this.model):this.model.selectionIsCollapsed?Za.insert(this.model,e,d({style:this.model.at(this.model.position).computedStyle},t)):Za.insert(this.model,e,t),this.snapshot(`insert-${this.model.at(this.model.position).type}`),Lc(this),t.scrollIntoView&&this.scrollIntoView(),0))}switchMode(e,t="",n=""){var i;if(this.model.mode===e||!this.hasEditableContent||!this.contentEditable||this.disabled)return;const o=this.model.mode;if(this.model.mode=e,!(null==(i=this.host)?void 0:i.dispatchEvent(new Event("mode-change",{bubbles:!0,composed:!0,cancelable:!0}))))return void(this.model.mode=o);const r=this.model.mode,{model:a}=this;a.deferNotifications({content:Boolean(n)||Boolean(t),selection:!0,type:"insertText"},(()=>{let i=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),t&&"latex"!==e){const n=Qs(t,{context:this.context,parseMode:e});a.collapseSelection("forward");const o=a.at(a.position);a.position=a.offsetOf(o.parent.addChildrenAfter(n,o)),i=!0}if(this.model.mode=e,"latex"===e){let e,n=a.selectionIsCollapsed;hc(this,"accept");let i=a.at(a.position);if(n)e="\\";else{const o=Oa(a.selection);e=this.model.getValue(o,"latex");const r=this.model.extractAtoms(o);1===r.length&&"placeholder"===r[0].type&&(e=t,n=!0),i=a.at(o[0])}const o=new hl(e);i.parent.addChildAfter(o,i),n?a.position=a.offsetOf(o.lastChild):a.setSelection(a.offsetOf(o.firstChild),a.offsetOf(o.lastChild))}else ac(a).forEach((e=>{e.isError=!1}));if(n){const e=Qs(n,{context:this.context,parseMode:r});a.collapseSelection("forward");const t=a.at(a.position);a.position=a.offsetOf(t.parent.addChildrenAfter(e,t)),i=!0}return Lc(this),this.undoManager.snapshot("latex"===e?"insert-latex":"insert"),i})),this.model.mode=e,window.mathVirtualKeyboard.update(yh(this))}hasFocus(){return!this.blurred}focus(e){var t;this.hasFocus()||(this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),this.onFocus(),this.model.announce("line")),null!=(t=null==e?void 0:e.preventScroll)&&t||this.scrollIntoView()}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(e,t={}){var n,i;const o={operation:"set",silenceNotifications:!1};Na(t)?o.range=t:("toggle"===t.operation&&(o.operation="toggle"),o.range=t.range,o.silenceNotifications=null!=(n=t.silenceNotifications)&&n);const r=nh(this,e),a=null!=(i=o.operation)?i:"set";if(void 0===o.range&&this.model.selectionIsCollapsed){if("set"===a)return void(this.defaultStyle=d(d({},this.defaultStyle),r));const e=d({},this.defaultStyle);for(const t of Object.keys(r))e[t]===r[t]?("color"===t&&delete e.verbatimColor,"backgroundColor"===t&&delete e.verbatimBackgroundColor,delete e[t]):e[t]=r[t];this.defaultStyle=e}else this.model.deferNotifications({content:!o.silenceNotifications,type:"insertText"},(()=>{if(void 0===o.range)for(const e of this.model.selection.ranges)fd(this.model,e,r,{operation:a});else fd(this.model,o.range,r,{operation:a})})),Lc(this)}toggleContextMenu(){var e;return!!this._menu.visible&&("open"===this._menu.state?(this._menu.hide(),!0):(this._menu.show({target:this.element.querySelector("[part=container]"),location:null!=(e=this.getCaretPoint())?e:void 0,onDismiss:()=>{var e;return null==(e=this.element)?void 0:e.focus()}}),!0))}getCaretPoint(){const e=ts(this.field);return e?{x:e.x,y:e.y}:null}setCaretPoint(e,t){const n=ph(this,e,t,{bias:0});if(n<0)return!1;const i=this.model.position;return this.model.position=n,this.model.announce("move",i),Lc(this),!0}getPrompt(e){const t=this.model.findAtom((t=>"prompt"===t.type&&t.placeholderId===e));return console.assert(void 0!==t,"MathLive 0.98.5: no prompts with matching ID found"),t}getPromptValue(e,t){const n=this.getPrompt(e);if(!n)return"";const i=this.model.offsetOf(n.firstChild),o=this.model.offsetOf(n.lastChild);return this.model.getValue(i,o,t)}getPrompts(e){return this.model.getAllAtoms().filter((t=>!("prompt"!==t.type||e&&(e.id&&t.placeholderId!==e.id||e.locked&&t.locked!==e.locked||"undefined"===e.correctness&&t.correctness||e.correctness&&t.correctness!==e.correctness)))).map((e=>e.placeholderId))}setPromptValue(e,t,n){if(void 0!==t){const i=this.getPrompt(e);if(!i)return void console.error(`MathLive 0.98.5: unknown prompt ${e}`);const o=this.model.getBranchRange(this.model.offsetOf(i),"body");this.model.setSelection(o),this.insert(t,h(d({},n),{insertionMode:"replaceSelection"}))}(null==n?void 0:n.silenceNotifications)&&(this.valueOnFocus=this.getValue()),Lc(this)}setPromptState(e,t,n){const i=this.getPrompt(e);i?("undefined"===t?i.correctness=void 0:"string"==typeof t&&(i.correctness=t),"boolean"==typeof n&&(i.locked=n,i.captureSelection=n),Lc(this)):console.error(`MathLive 0.98.5: unknown prompt ${e}`)}getPromptState(e){const t=this.getPrompt(e);return t?[t.correctness,t.locked]:(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[void 0,!0])}getPromptRange(e){const t=this.getPrompt(e);return t?this.model.getBranchRange(this.model.offsetOf(t),"body"):(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[0,0])}canUndo(){return this.undoManager.canUndo()}canRedo(){return this.undoManager.canRedo()}popUndoStack(){this.undoManager.pop()}snapshot(e){var t;this.undoManager.snapshot(e)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(yh(this)),null==(t=this.host)||t.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"snapshot"}})))}stopCoalescingUndo(){this.undoManager.stopCoalescing(this.model.selection)}stopRecording(){this.undoManager.stopRecording()}startRecording(){this.undoManager.startRecording()}undo(){var e;this.undoManager.undo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(yh(this)),null==(e=this.host)||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var e;this.undoManager.redo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(yh(this)),null==(e=this.host)||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}resetUndo(){var e;null==(e=this.undoManager)||e.reset()}onSelectionDidChange(){var e,t;const n=this.model;this.keyboardDelegate.setValue(n.getValue(this.model.selection,"latex-expanded"));{const t=n.at(n.position),i=null!=(e=t.mode)?e:pd(this.options);this.model.mode!==i&&("latex"===this.model.mode?(hc(this,"accept",{mode:i}),n.position=n.offsetOf(t)):this.switchMode(i))}null==(t=this.host)||t.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(yh(this)),Kh(this)}onContentWillChange(e){var t,n,i;return null==(i=null==(n=this.host)?void 0:n.dispatchEvent(new InputEvent("beforeinput",h(d({},e),{data:e.data?e.data:null!=(t=e.inputType)?t:"",cancelable:!0,bubbles:!0,composed:!0}))))||i}onFocus(){!this.focusBlurInProgress&&this.blurred&&(this.focusBlurInProgress=!0,this.blurred=!1,this.keyboardDelegate.focus(),this.stopCoalescingUndo(),Ec(this,{interactive:!0}),this.valueOnFocus=this.model.getValue(),this.hasEditablePrompts&&!this.model.at(this.model.anchor).parentPrompt&&this.executeCommand("moveToNextPlaceholder"),this.focusBlurInProgress=!1)}onBlur(){var e,t,n;if(this.focusBlurInProgress||this.blurred)return;this.focusBlurInProgress=!0,this.stopCoalescingUndo(),this.blurred=!0,this.ariaLiveText.textContent="",bc(this),this.model.getValue()!==this.valueOnFocus&&(null==(e=this.host)||e.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),this.disconnectFromVirtualKeyboard(),null==(t=this.host)||t.dispatchEvent(new Event("blur",{bubbles:!1,composed:!0})),null==(n=this.host)||n.dispatchEvent(new UIEvent("focusout",{bubbles:!0,composed:!0})),Lc(this),this.focusBlurInProgress=!1,Eh();const i=new AbortController,o=i.signal;document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&document.addEventListener("visibilitychange",(()=>{es(this)&&"visible"===document.visibilityState&&this.focus({preventScroll:!0})}),{once:!0,signal:o})}),{once:!0,signal:o}),setTimeout((()=>i.abort()),100)}onInput(e){Gd(this,e)}onKeystroke(e){return Xd(this,e)}onCompositionStart(e){this.model.deleteAtoms(Oa(this.model.selection));const t=ts(this.field);t&&requestAnimationFrame((()=>{Ec(this),this.keyboardDelegate.moveTo(t.x,t.y-t.height)}))}onCompositionUpdate(e){!function(e,t){const n=e.at(e.position);if("composition"===n.type)n.value=t;else{const{caret:i}=n;n.caret=void 0;const o=new Rs(t,{mode:n.mode});o.caret=i,n.parent.addChildAfter(o,n),e.position+=1}}(this.model,e),Lc(this)}onCompositionEnd(e){!function(e){const t=e.at(e.position);"composition"===t.type&&(t.parent.removeChild(t),e.position-=1)}(this.model),Gd(this,e,{simulateKeystroke:!0})}onCut(e){this.isSelectionEditable?this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),Za.onCopy(this,e),Zu(this.model,Oa(this.model.selection),"deleteByCut"),this.snapshot("cut"),Lc(this)):this.model.announce("plonk")}onCopy(e){Za.onCopy(this,e)}onPaste(e){let t=this.isSelectionEditable;return t&&(t=Za.onPaste(this.model.at(this.model.position).mode,this,e.clipboardData)),t||this.model.announce("plonk"),e.preventDefault(),e.stopPropagation(),t}onGeometryChange(){this._menu.hide(),gc(this),Kh(this)}onWheel(e){const t=5*e.deltaX;if(!Number.isFinite(t)||0===t)return;const n=this.field;t<0&&0===n.scrollLeft||t>0&&n.offsetWidth+n.scrollLeft>=n.scrollWidth||(n.scrollBy({top:0,left:t}),e.preventDefault(),e.stopPropagation())}getHTMLElement(e){let t=e;for(;!t.id&&t.hasChildren;)t=e.children[0];return this.field.querySelector(`[data-atom-id="${t.id}"]`)}get context(){var e,t;return{registers:null!=(e=this.options.registers)?e:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,placeholderSymbol:null!=(t=this.options.placeholderSymbol)?t:"▢",colorMap:e=>this.colorMap(e),backgroundColorMap:e=>this.backgroundColorMap(e),getMacro:e=>se(e,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}}(a.querySelector(":host > span"),h(d({},null!=(i=null==(n=np.get(this))?void 0:n.options)?i:sp(this)),{eventSink:this,value:c})),!np.has(this)){this.upgradeProperty("disabled"),this.upgradeProperty("readonly");for(const t of Object.keys(e.optionsAttributes))this.upgradeProperty(ap(t))}if(null==(o=this._mathfield)?void 0:o.model){if(np.has(this)){const e=this._mathfield,t=np.get(this),n=t.menuItems;e.model.deferNotifications({content:!1,selection:!1},(()=>{const n=t.value;void 0!==n&&e.setValue(n),e.model.selection=t.selection,np.delete(this)})),n&&(this.menuItems=n)}window.queueMicrotask((()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))})),Mc()}else this._mathfield=null}disconnectedCallback(){var t,n;if(this.shadowRoot.host.removeEventListener("pointerdown",this,!0),!this._mathfield)return;window.queueMicrotask((()=>this.dispatchEvent(new Event("unmount",{cancelable:!1,bubbles:!0,composed:!0}))));const i=hd(this._mathfield.options,Object.keys(e.optionsAttributes).map((e=>ap(e))));np.set(this,{value:this._mathfield.getValue(),selection:this._mathfield.model.selection,menuItems:null!=(n=null==(t=this._mathfield.menu)?void 0:t.menuItems)?n:void 0,options:i}),this._mathfield.dispose(),this._mathfield=null}upgradeProperty(e){if(this.hasOwnProperty(e)){const t=this[e];delete this[e],"readonly"!==e&&"read-only"!==e||(e="readOnly"),this[e]=t}}attributeChangedCallback(e,t,n){if(t===n)return;const i=null!==n;switch(e){case"contenteditable":Lc(this._mathfield);break;case"disabled":this.disabled=i;break;case"read-only":case"readonly":this.readOnly=i}}get readonly(){return this.hasAttribute("readonly")||this.hasAttribute("read-only")}set readonly(e){const t=Boolean(e);t?(this.setAttribute("readonly",""),lp()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(lp()?this._internals.ariaReadOnly="false":this.removeAttribute("aria-readonly"),this.removeAttribute("readonly"),this.removeAttribute("read-only")),this._setOptions({readOnly:t})}get disabled(){return this.hasAttribute("disabled")}set disabled(e){var t;const n=Boolean(e);n?this.setAttribute("disabled",""):this.removeAttribute("disabled"),lp()?this._internals.ariaDisabled=n?"true":"false":this.setAttribute("aria-disabled",n?"true":"false"),n&&(null==(t=this._mathfield)?void 0:t.hasFocus)&&window.mathVirtualKeyboard.visible&&this._mathfield.executeCommand("hideVirtualKeyboard")}get value(){return this.getValue()}set value(e){this.setValue(e)}get defaultMode(){return this._getOption("defaultMode")}set defaultMode(e){this._setOptions({defaultMode:e})}get macros(){return this._getOption("macros")}set macros(e){this._setOptions({macros:e})}get registers(){const e=this;return new Proxy({},{get:(t,n)=>{if("string"==typeof n)return e._getOption("registers")[n]},set(t,n,i){return"string"==typeof n&&(e._setOptions({registers:h(d({},e._getOption("registers")),{[n]:i})}),!0)}})}set registers(e){this._setOptions({registers:e})}get colorMap(){return this._getOption("colorMap")}set colorMap(e){this._setOptions({colorMap:e})}get backgroundColorMap(){return this._getOption("backgroundColorMap")}set backgroundColorMap(e){this._setOptions({backgroundColorMap:e})}get letterShapeStyle(){return this._getOption("letterShapeStyle")}set letterShapeStyle(e){this._setOptions({letterShapeStyle:e})}get minFontScale(){return this._getOption("minFontScale")}set minFontScale(e){this._setOptions({minFontScale:e})}get smartMode(){return this._getOption("smartMode")}set smartMode(e){this._setOptions({smartMode:e})}get smartFence(){return this._getOption("smartFence")}set smartFence(e){this._setOptions({smartFence:e})}get smartSuperscript(){return this._getOption("smartSuperscript")}set smartSuperscript(e){this._setOptions({smartSuperscript:e})}get scriptDepth(){return this._getOption("scriptDepth")}set scriptDepth(e){this._setOptions({scriptDepth:e})}get removeExtraneousParentheses(){return this._getOption("removeExtraneousParentheses")}set removeExtraneousParentheses(e){this._setOptions({removeExtraneousParentheses:e})}get mathModeSpace(){return this._getOption("mathModeSpace")}set mathModeSpace(e){this._setOptions({mathModeSpace:e})}get placeholderSymbol(){return this._getOption("placeholderSymbol")}set placeholderSymbol(e){this._setOptions({placeholderSymbol:e})}get popoverPolicy(){return this._getOption("popoverPolicy")}set popoverPolicy(e){this._setOptions({popoverPolicy:e})}get environmentPopoverPolicy(){return this._getOption("environmentPopoverPolicy")}set environmentPopoverPolicy(e){this._setOptions({environmentPopoverPolicy:e})}get menuItems(){var e,t,n;return this._mathfield?null!=(e=this._mathfield.menu._menuItems.map((e=>e.menuItem)))?e:[]:null!=(n=null==(t=np.get(this))?void 0:t.menuItems)?n:[]}set menuItems(e){var t;if(this._mathfield){const n=null==(t=this._mathfield.element)?void 0:t.querySelector("[part=menu-toggle]");n&&(n.style.display=0===e.length?"none":""),this._mathfield.menu.menuItems=e}np.has(this)?np.set(this,h(d({},np.get(this)),{menuItems:e})):np.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:sp(this),menuItems:e})}get mathVirtualKeyboardPolicy(){return this._getOption("mathVirtualKeyboardPolicy")}set mathVirtualKeyboardPolicy(e){this._setOptions({mathVirtualKeyboardPolicy:e})}get inlineShortcuts(){return this._getOption("inlineShortcuts")}set inlineShortcuts(e){this._setOptions({inlineShortcuts:e})}get inlineShortcutTimeout(){return this._getOption("inlineShortcutTimeout")}set inlineShortcutTimeout(e){this._setOptions({inlineShortcutTimeout:e})}get keybindings(){return this._getOption("keybindings")}set keybindings(e){this._setOptions({keybindings:e})}get onInlineShortcut(){return this._getOption("onInlineShortcut")}set onInlineShortcut(e){this._setOptions({onInlineShortcut:e})}get onScrollIntoView(){return this._getOption("onScrollIntoView")}set onScrollIntoView(e){this._setOptions({onScrollIntoView:e})}get onExport(){return this._getOption("onExport")}set onExport(e){this._setOptions({onExport:e})}get readOnly(){return this._getOption("readOnly")}set readOnly(e){this._setOptions({readOnly:e})}get isSelectionEditable(){var e,t;return null!=(t=null==(e=this._mathfield)?void 0:e.isSelectionEditable)&&t}setPromptState(e,t,n){var i;null==(i=this._mathfield)||i.setPromptState(e,t,n)}getPromptState(e){var t,n;return null!=(n=null==(t=this._mathfield)?void 0:t.getPromptState(e))?n:[void 0,!0]}get virtualKeyboardTargetOrigin(){return this._getOption("virtualKeyboardTargetOrigin")}set virtualKeyboardTargetOrigin(e){this._setOptions({virtualKeyboardTargetOrigin:e})}get selection(){return this._mathfield?this._mathfield.model.selection:np.has(this)?np.get(this).selection:{ranges:[[0,0]],direction:"forward"}}set selection(e){if("number"==typeof e&&(e={ranges:[[e,e]]}),this._mathfield)return this._mathfield.model.selection=e,void Lc(this._mathfield);np.has(this)?np.set(this,h(d({},np.get(this)),{selection:e})):np.set(this,{value:void 0,selection:e,options:sp(this),menuItems:void 0})}get selectionIsCollapsed(){const e=this.selection;return 1===e.ranges.length&&e.ranges[0][0]===e.ranges[0][1]}get position(){return this._mathfield?this._mathfield.model.position:np.has(this)?np.get(this).selection.ranges[0][0]:0}set position(e){this._mathfield&&(this._mathfield.model.position=e,Lc(this._mathfield)),np.has(this)?np.set(this,h(d({},np.get(this)),{selection:{ranges:[[e,e]]}})):np.set(this,{value:void 0,selection:{ranges:[[e,e]]},options:sp(this),menuItems:void 0})}getOffsetDepth(e){var t,n;return this._mathfield?(null!=(n=null==(t=this._mathfield.model.at(e))?void 0:t.treeDepth)?n:2)-2:0}get lastOffset(){var e,t;return null!=(t=null==(e=this._mathfield)?void 0:e.model.lastOffset)?t:-1}};op.version="0.98.5",op._fontsDirectory="./fonts",op._soundsDirectory="./sounds",op.keypressVibration=!0,op._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},op._plonkSound="plonk.wav",op.audioBuffers={},op.createHTML=e=>e,op._speechEngineRate="100%",op._speechEngineVoice="Joanna",op._textToSpeechMarkup="",op._textToSpeechRules="mathlive",op._textToSpeechRulesOptions={},op.speakHook=function(e){var t,n;if(f())if(window.MathfieldElement.speechEngine&&"local"!==window.MathfieldElement.speechEngine)if("amazon"===window.MathfieldElement.speechEngine)if("AWS"in window){const i=new window.AWS.Polly({apiVersion:"2016-06-10"}),o={OutputFormat:"mp3",VoiceId:null!=(t=window.MathfieldElement.speechEngineVoice)?t:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes(null!=(n=window.MathfieldElement.speechEngineVoice)?n:"Joanna")?"neural":"standard",Text:e,TextType:"ssml"};i.synthesizeSpeech(o,((e,t)=>{if(e)console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${e}`);else if(null==t?void 0:t.AudioStream){const e=new Uint8Array(t.AudioStream),n=new Blob([e.buffer],{type:"audio/mpeg"}),i=URL.createObjectURL(n);new Audio(i).play().catch((e=>console.log(e)))}else console.log("polly.synthesizeSpeech():",t)}))}else console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else"google"===window.MathfieldElement.speechEngine&&console.error("MathLive 0.98.5: The Google speech engine is not supported yet. Please come again.");else{const t=new SpeechSynthesisUtterance(e);window.speechSynthesis.speak(t)}else console.log("Speak:",e)},op.readAloudHook=function(e,t){var n;if(!f())return;if("amazon"!==window.MathfieldElement.speechEngine)return console.error("MathLive 0.98.5: Use Amazon TTS Engine for synchronized highlighting"),void("function"==typeof window.MathfieldElement.speakHook&&window.MathfieldElement.speakHook(t));if(!window.AWS)return void console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");const i=new window.AWS.Polly({apiVersion:"2016-06-10"}),o={OutputFormat:"json",VoiceId:null!=(n=window.MathfieldElement.speechEngineVoice)?n:"Joanna",Engine:"standard",Text:t,TextType:"ssml",SpeechMarkTypes:["ssml"]};pp().readAloudElement=e,i.synthesizeSpeech(o,((e,n)=>{if(e)return void console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${e}`);if(!(null==n?void 0:n.AudioStream))return void console.log("polly.synthesizeSpeech():",n);const r=new TextDecoder("utf-8").decode(new Uint8Array(n.AudioStream));pp().readAloudMarks=r.split("\n").map((e=>e?JSON.parse(e):{})),pp().readAloudTokens=[];for(const e of pp().readAloudMarks)e.value&&pp().readAloudTokens.push(e.value);pp().readAloudCurrentMark="",o.OutputFormat="mp3",o.SpeechMarkTypes=[],i.synthesizeSpeech(o,((e,n)=>{if(e)return void console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech("${t}") error:${e}`);if(!(null==n?void 0:n.AudioStream))return;const i=new Uint8Array(n.AudioStream),o=new Blob([i.buffer],{type:"audio/mpeg"}),r=URL.createObjectURL(o),a=pp();a.readAloudAudio?a.readAloudAudio.pause():(a.readAloudAudio=new Audio,a.readAloudAudio.addEventListener("ended",(()=>{const e=a.readAloudMathfield;a.readAloudStatus="ended",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),e?(Ec(e),a.readAloudElement=null,a.readAloudMathfield=null,a.readAloudTokens=[],a.readAloudMarks=[],a.readAloudCurrentMark=""):ep(a.readAloudElement)})),a.readAloudAudio.addEventListener("timeupdate",(()=>{let e="";const t=1e3*a.readAloudAudio.currentTime+100;for(const n of a.readAloudMarks)n.time<t&&(e=n.value);a.readAloudCurrentMark!==e&&(a.readAloudCurrentToken=e,e&&e===a.readAloudFinalToken?a.readAloudAudio.pause():(a.readAloudCurrentMark=e,tp(a.readAloudElement,a.readAloudCurrentMark)))}))),a.readAloudAudio.src=r,a.readAloudStatus="playing",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),a.readAloudAudio.play()}))}))},op._decimalSeparator=".",op.fractionNavigationOrder="numerator-denominator",op._isFunction=e=>{var t,n;const i=window.MathfieldElement.computeEngine;return null!=(n=null==(t=null==i?void 0:i.parse(e).domain)?void 0:t.isFunction)&&n};var rp=op;function ap(e){return e.replace(/[^a-zA-Z\d]+(.)/g,((e,t)=>t.toUpperCase()))}function sp(e){const t={readOnly:!1},n=rp.optionsAttributes;return Object.keys(n).forEach((i=>{if(e.hasAttribute(i)){const o=e.getAttribute(i);"placeholder"===i?t.contentPlaceholder=null!=o?o:"":"boolean"===n[i]?t[ap(i)]=!0:"on/off"===n[i]?t[ap(i)]="on"===o||"off"!==o&&void 0:"number"===n[i]?t[ap(i)]=Number.parseFloat(null!=o?o:"0"):t[ap(i)]=o}})),t}function lp(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals)&&"role"in window.ElementInternals.prototype}var cp,dp,hp,up=rp;if(f()&&!(null==(cp=window.customElements)?void 0:cp.get("math-field"))){null!=window[dp=Symbol.for("io.cortexjs.mathlive")]||(window[dp]={});window[Symbol.for("io.cortexjs.mathlive")].version="0.98.5",window.MathfieldElement=rp,null==(hp=window.customElements)||hp.define("math-field",rp)}function pp(){var e;return null!=globalThis[e=Symbol.for("io.cortexjs.mathlive")]||(globalThis[e]={}),globalThis[Symbol.for("io.cortexjs.mathlive")]}Dc({switchKeyboardLayer:function(e,t){const n=ld.singleton;return!!n&&(n.show(),Fc(),n.currentLayer=t,n.render(),n.focus(),!0)},toggleVirtualKeyboard:function(){const e=window.mathVirtualKeyboard;return e.visible?e.hide({animate:!0}):e.show({animate:!0}),!1},hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"})}}]); |