@pie-players/pie-section-player 0.3.72 → 0.3.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +198 -37
  2. package/dist/browser/assets/evaluation-worker-DkU_wGh3.js +155241 -0
  3. package/dist/browser/chunks/ItemToolBar-wr2myaah-2ce4b643.js +1 -0
  4. package/dist/browser/chunks/PUA-tLuTiQ7--f2b27953.js +1 -0
  5. package/dist/browser/chunks/ToolCoordinator-cc2dc319.js +1 -0
  6. package/dist/browser/chunks/accents-BTUYmhn9-cafeb96e.js +1 -0
  7. package/dist/browser/chunks/accents-b-i-CngHZsLL-e0eb98fd.js +1 -0
  8. package/dist/browser/chunks/arabic-BzEHMVZD-30ac1ade.js +1 -0
  9. package/dist/browser/chunks/arrows-VjxlU-jv-2e17c192.js +1 -0
  10. package/dist/browser/chunks/base-dfd67c41.js +1 -0
  11. package/dist/browser/chunks/braille-BeWC_Ruq-a3bb8ef9.js +1 -0
  12. package/dist/browser/chunks/braille-d-Dk6J96GO-d832bfbf.js +1 -0
  13. package/dist/browser/chunks/browser-a3c32178.js +36 -0
  14. package/dist/browser/chunks/calculator-element-271c142f.js +9 -0
  15. package/dist/browser/chunks/calligraphic-Cew9cU3x-04cf0735.js +1 -0
  16. package/dist/browser/chunks/cherokee-Cny3FYho-4da7d2f3.js +1 -0
  17. package/dist/browser/chunks/classPrivateFieldGet2-338e0179.js +1 -0
  18. package/dist/browser/chunks/custom-element-define-2a92deb0.js +1 -0
  19. package/dist/browser/chunks/cyrillic-CfCDulXU-5550df0b.js +1 -0
  20. package/dist/browser/chunks/cyrillic-ss-lU7bNGG9-12eb0188.js +1 -0
  21. package/dist/browser/chunks/defineProperty-a20a667d.js +1 -0
  22. package/dist/browser/chunks/devanagari-CDIz2h-r-18c38725.js +1 -0
  23. package/dist/browser/chunks/dist-41b39e7f.js +1 -0
  24. package/dist/browser/chunks/dist-59132a53.js +1 -0
  25. package/dist/browser/chunks/dist-60d7afef.js +1 -0
  26. package/dist/browser/chunks/dist-ca9b9622.js +1 -0
  27. package/dist/browser/chunks/double-struck-BpJEQk8y-500ce8dd.js +1 -0
  28. package/dist/browser/chunks/en-5ff22e17.js +1 -0
  29. package/dist/browser/chunks/es-a0ba6cb6.js +1 -0
  30. package/dist/browser/chunks/focus-trap-44913bf3.js +1 -0
  31. package/dist/browser/chunks/fraktur-rLEq9DEH-44cc14d8.js +1 -0
  32. package/dist/browser/chunks/greek-BlraJTyL-90ce8924.js +1 -0
  33. package/dist/browser/chunks/greek-ss-D-EN2PK0-91610739.js +1 -0
  34. package/dist/browser/chunks/hebrew-GiQZeybp-b583f555.js +1 -0
  35. package/dist/browser/chunks/latin-b-BhEnC7R2-d13e06ff.js +1 -0
  36. package/dist/browser/chunks/latin-bi-DqiIKv3U-1dec8705.js +1 -0
  37. package/dist/browser/chunks/latin-i-B1xtwaE1-21637466.js +1 -0
  38. package/dist/browser/chunks/latin-xfWFlLkD-5bcea5cf.js +1 -0
  39. package/dist/browser/chunks/logger-8b07fb72.js +1 -0
  40. package/dist/browser/chunks/marrows-DD1NgMQi-15b63755.js +1 -0
  41. package/dist/browser/chunks/math-DpWn1mbG-38eeb914.js +1 -0
  42. package/dist/browser/chunks/math-rendering-ready-9a0fd90a.js +1 -0
  43. package/dist/browser/chunks/mathjax-D2JHb_R_-64780dc5.js +232 -0
  44. package/dist/browser/chunks/module-0191e321.js +74 -0
  45. package/dist/browser/chunks/module-shim-58659a86.js +0 -0
  46. package/dist/browser/chunks/module-shim-b4470740.js +12 -0
  47. package/dist/browser/chunks/monospace-D116QD2a-98d484fd.js +1 -0
  48. package/dist/browser/chunks/monospace-ex-DcXpouKS-456b403c.js +1 -0
  49. package/dist/browser/chunks/monospace-l-Ct5wkMDs-f34a4a9e.js +1 -0
  50. package/dist/browser/chunks/mshapes-DCp86WSX-c0055952.js +1 -0
  51. package/dist/browser/chunks/nds-icon-button-d602f784.js +194 -0
  52. package/dist/browser/chunks/nl-NL-364d61b9.js +1 -0
  53. package/dist/browser/chunks/nl-NL-8b7e6d4b.js +1 -0
  54. package/dist/browser/chunks/overlay-containment-edaaff13.js +1 -0
  55. package/dist/browser/chunks/overlay-placement-e8058232.js +1 -0
  56. package/dist/browser/chunks/phonetics-BwOCw2Y9-d2e3af59.js +1 -0
  57. package/dist/browser/chunks/phonetics-ss-CRtMn02f-579b6135.js +1 -0
  58. package/dist/browser/chunks/pie-api-client-687c319a.js +1 -0
  59. package/dist/browser/chunks/pie-tool-calculator-cortex-0626bc24.js +9 -0
  60. package/dist/browser/chunks/pie-tool-calculator-geogebra-561236cb.js +9 -0
  61. package/dist/browser/chunks/pointer-gesture-ce75f0a7.js +1 -0
  62. package/dist/browser/chunks/preload-helper-6ad28da3.js +1 -0
  63. package/dist/browser/chunks/provider-4c704118.js +1 -0
  64. package/dist/browser/chunks/rolldown-runtime-1287ba31.js +1 -0
  65. package/dist/browser/chunks/runtime-C7H1jS4E-64772f5e.js +8413 -0
  66. package/dist/browser/chunks/sanitize-svg-icon-b9082bba.js +3 -0
  67. package/dist/browser/chunks/sans-serif-BYPZKlE9-2efdbcd9.js +1 -0
  68. package/dist/browser/chunks/sans-serif-b-B0kRKiC--b5530dce.js +1 -0
  69. package/dist/browser/chunks/sans-serif-bi-DXWul6mu-5370dba4.js +1 -0
  70. package/dist/browser/chunks/sans-serif-ex-Boux1kMP-aa178f31.js +1 -0
  71. package/dist/browser/chunks/sans-serif-i-676RFaSO-2db54474.js +1 -0
  72. package/dist/browser/chunks/sans-serif-r-DrN9xdZt-0fc72eea.js +1 -0
  73. package/dist/browser/chunks/script-0ohehnXc-526904f4.js +1 -0
  74. package/dist/browser/chunks/shapes-BG47NodJ-d59b0eca.js +1 -0
  75. package/dist/browser/chunks/src-BcptuNS5-ed25d7fd.js +191 -0
  76. package/dist/browser/chunks/sre-engine-wf9s43gg-f09289c5.js +53 -0
  77. package/dist/browser/chunks/symbols-BqnUxf_t-83087e87.js +1 -0
  78. package/dist/browser/chunks/symbols-b-i-eg9k5hmF-9c461ac2.js +1 -0
  79. package/dist/browser/chunks/tool-annotation-toolbar-997438b4.js +248 -0
  80. package/dist/browser/chunks/tool-answer-eliminator-35483abd.js +13 -0
  81. package/dist/browser/chunks/tool-color-scheme-b7de5cdf.js +26 -0
  82. package/dist/browser/chunks/tool-dictionary-cecff3b4.js +7 -0
  83. package/dist/browser/chunks/tool-graph-cb0338e8.js +11 -0
  84. package/dist/browser/chunks/tool-host-contract-b93b482c.js +1 -0
  85. package/dist/browser/chunks/tool-line-reader-f8ef3c6a.js +62 -0
  86. package/dist/browser/chunks/tool-periodic-table-43b133b8.js +153 -0
  87. package/dist/browser/chunks/tool-picture-dictionary-33721e91.js +4 -0
  88. package/dist/browser/chunks/tool-protractor-23f77028.js +17 -0
  89. package/dist/browser/chunks/tool-ruler-1d9a03a6.js +15 -0
  90. package/dist/browser/chunks/tool-tts-inline-98c2ce7a.js +179 -0
  91. package/dist/browser/chunks/variants-2LRNhOUP-966fc49d.js +1 -0
  92. package/dist/browser/chunks/versioned-tag-54a76be9.js +1 -0
  93. package/dist/browser/pie-section-player.js +1613 -0
  94. package/dist/browser.d.ts +10 -0
  95. package/dist/chunks/ItemToolBar-wr2myaah-1287ba31.js +28 -0
  96. package/dist/chunks/module-shim-58659a86.js +2129 -0
  97. package/dist/chunks/{nl-NL-9312c316.js → nl-NL-364d61b9.js} +8 -2
  98. package/dist/chunks/sre-engine-wf9s43gg-f09289c5.js +8 -0
  99. package/dist/components/shared/composition.d.ts +0 -1
  100. package/dist/components/shared/layout-host-methods.d.ts +400 -0
  101. package/dist/components/shared/missing-tool-providers.d.ts +16 -0
  102. package/dist/components/shared/player-preload.d.ts +14 -10
  103. package/dist/contracts/host-hooks.d.ts +4 -5
  104. package/dist/contracts/host-hooks.js +0 -0
  105. package/dist/contracts/layout-contract.js +0 -0
  106. package/dist/contracts/layout-parity-metadata.js +87 -0
  107. package/dist/contracts/public-events.d.ts +14 -15
  108. package/dist/contracts/public-events.js +12 -0
  109. package/dist/contracts/runtime-host-contract.js +0 -0
  110. package/dist/controllers/SectionController.d.ts +21 -0
  111. package/dist/controllers/toolkit-section-contracts.d.ts +1 -17
  112. package/dist/controllers/types.d.ts +17 -10
  113. package/dist/pie-section-player.js +19353 -37273
  114. package/dist/policies/index.d.ts +9 -2
  115. package/dist/policies/index.js +25 -0
  116. package/package.json +34 -29
  117. package/dist/chunks/module-a516757f.js +0 -73997
  118. package/dist/chunks/nl-NL-ef6dd604.js +0 -505
  119. package/dist/chunks/pie-api-client-22de9d9c.js +0 -161
  120. package/dist/chunks/rolldown-runtime-1287ba31.js +0 -20
  121. package/dist/chunks/sre-0162a7a9.js +0 -17637
  122. package/dist/contracts/stages.d.ts +0 -10
  123. package/dist/utils/z-index.d.ts +0 -5
@@ -0,0 +1,53 @@
1
+ import{i as nf,r as hi,t as rf}from"./rolldown-runtime-1287ba31.js";import{n as of}from"./ItemToolBar-wr2myaah-2ce4b643.js";var sf=rf(((No,bs)=>{(function(_r,dn){typeof No=="object"&&typeof bs=="object"?bs.exports=dn():typeof define=="function"&&define.amd?define([],dn):typeof No=="object"?No.SRE=dn():_r.SRE=dn()})(No,()=>(()=>{var _r,dn,al={112(Oe,R){"use strict";function ge(Ve){try{typeof Ve!="function"&&(Ve=RegExp);var et=new Ve("𝌆","u").exec("𝌆");return!!et&&et[0].length===2}catch{}return!1}var Z=ge();function x(Ve){if(Ve.source[0]!=="[")throw new Error(Ve+" can not be used with chars");return Ve.source.slice(1,Ve.source.lastIndexOf("]"))}function Te(Ve,et){if(Ve.source[0]!=="[")throw new Error("/"+Ve.source+"/ can not be used with chars_without");if(!et||typeof et!="string")throw new Error(JSON.stringify(et)+" is not a valid search");if(Ve.source.indexOf(et)===-1)throw new Error('"'+et+'" is not is /'+Ve.source+"/");if(et==="-"&&Ve.source.indexOf(et)!==1)throw new Error('"'+et+'" is not at the first postion of /'+Ve.source+"/");return new RegExp(Ve.source.replace(et,""),Z?"u":"")}function ne(Ve){var et=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(ye){var je=typeof ye=="string";if(je&&et===void 0&&ye==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return je?ye:ye.source}).join(""),Z?"mu":"m")}function ee(Ve){if(arguments.length===0)throw new Error("no parameters provided");return ne.apply(ee,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var we=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Z&&(we=ne("[",x(we),"\\u{10000}-\\u{10FFFF}","]"));var ft=new RegExp("[^"+x(we)+"]",Z?"u":""),Me=/[\x20\x09\x0D\x0A]/,ie=x(Me),F=ne(Me,"+"),me=ne(Me,"*"),B=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Z&&(B=ne("[",x(B),"\\u{10000}-\\u{10FFFF}","]"));var Xe=ne("[",x(B),x(/[-.0-9\xB7]/),x(/[\u0300-\u036F\u203F-\u2040]/),"]"),Ie=ne(B,Xe,"*"),ke=ne(Xe,"+"),Re=ee(ne("&",Ie,";"),"|",ee(/&#[0-9]+;|&#x[0-9a-fA-F]+;/)),Pe=ne("%",Ie,";"),Se=ee(ne('"',ee(/[^%&"]/,"|",Pe,"|",Re),"*",'"'),"|",ne("'",ee(/[^%&']/,"|",Pe,"|",Re),"*","'")),St=ee('"',ee(/[^<&"]/,"|",Re),"*",'"',"|","'",ee(/[^<&']/,"|",Re),"*","'"),G=ne(Te(B,":"),Te(Xe,":"),"*"),z=ne(G,ee(":",G),"?"),w=ne("^",z,"$"),O=ne("(",z,")"),V=ee(/"[^"]*"|'[^']*'/),D=ne(/^<\?/,"(",Ie,")",ee(F,"(",we,"*?)"),"?",/\?>/),oe=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,H=ee('"',oe,'*"',"|","'",Te(oe,"'"),"*'"),le="<!--",re=ne(le,ee(Te(we,"-"),"|",ne("-",Te(we,"-"))),"*","-->"),_="#PCDATA",te=ee("EMPTY","|","ANY","|",ee(ne(/\(/,me,_,ee(me,/\|/,me,z),"*",me,/\)\*/),"|",ne(/\(/,me,_,me,/\)/)),"|",ne(/\([^>]+\)/,/[?*+]?/)),K=ne("<!ELEMENT",F,ee(z,"|",Pe),F,ee(te,"|",Pe),me,">"),ve=ne("<!ATTLIST",F,Ie,ee(F,Ie,F,ee(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ee(ne("NOTATION",F,/\(/,me,Ie,ee(me,/\|/,me,Ie),"*",me,/\)/),"|",ne(/\(/,me,ke,ee(me,/\|/,me,ke),"*",me,/\)/))),F,ee(/#REQUIRED|#IMPLIED/,"|",ee(ee("#FIXED",F),"?",St))),"*",me,">"),ue="about:legacy-compat",L=ee('"'+ue+'"',"|","'"+ue+"'"),ce="SYSTEM",Be="PUBLIC",De=ee(ee(ce,F,V),"|",ee(Be,F,H,F,V)),Ce=ne("^",ee(ee(ce,F,"(?<SystemLiteralOnly>",V,")"),"|",ee(Be,F,"(?<PubidLiteral>",H,")",F,"(?<SystemLiteral>",V,")"))),ct=ne("^",H,"$"),lt=ne("^",V,"$"),he=ee(F,"NDATA",F,Ie),ot="<!ENTITY",Ae=ee(ne(ot,F,Ie,F,ee(Se,"|",ee(De,he,"?")),me,">"),"|",ne(ot,F,"%",F,Ie,F,ee(Se,"|",De),me,">")),Ge=ne("<!NOTATION",F,Ie,F,ee(De,"|",ne(Be,F,H)),me,">"),He=ne(me,"=",me),k=/1[.]\d+/,xe=ne(F,"version",He,ee("'",k,"'","|",'"',k,'"')),j=/[A-Za-z][-A-Za-z0-9._]*/,q=ne(/^<\?xml/,xe,ee(F,"encoding",He,ee('"',j,'"',"|","'",j,"'")),"?",ee(F,"standalone",He,ee("'",ee("yes","|","no"),"'","|",'"',ee("yes","|","no"),'"')),"?",me,/\?>/),ut=ne(/<!\[CDATA\[/,ne(we,"*?",/\]\]>/));R.chars=x,R.chars_without=Te,R.detectUnicodeSupport=ge,R.reg=ne,R.regg=ee,R.ABOUT_LEGACY_COMPAT=ue,R.ABOUT_LEGACY_COMPAT_SystemLiteral=L,R.AttlistDecl=ve,R.CDATA_START="<![CDATA[",R.CDATA_END="]]>",R.CDSect=ut,R.Char=we,R.Comment=re,R.COMMENT_START=le,R.COMMENT_END="-->",R.DOCTYPE_DECL_START="<!DOCTYPE",R.elementdecl=K,R.EntityDecl=Ae,R.EntityValue=Se,R.ExternalID=De,R.ExternalID_match=Ce,R.Name=Ie,R.NotationDecl=Ge,R.Reference=Re,R.PEReference=Pe,R.PI=D,R.PUBLIC=Be,R.PubidLiteral=H,R.PubidLiteral_match=ct,R.QName=z,R.QName_exact=w,R.QName_group=O,R.S=F,R.SChar_s=ie,R.S_OPT=me,R.SYSTEM=ce,R.SystemLiteral=V,R.SystemLiteral_match=lt,R.InvalidChar=ft,R.UNICODE_REPLACEMENT_CHARACTER="�",R.UNICODE_SUPPORT=Z,R.XMLDecl=q},309(Oe,R,ge){"use strict";var Z=ge(981),x=ge(112),Te=ge(918),ne=Z.isHTMLEscapableRawTextElement,ee=Z.isHTMLMimeType,we=Z.isHTMLRawTextElement,ft=Z.hasOwn,Me=Z.NAMESPACE,ie=Te.ParseError,F=Te.DOMException;function me(){}me.prototype={parse:function(w,O,V){var D=this.domBuilder;D.startDocument(),Pe(O,O=Object.create(null)),(function(oe,H,le,re,_){var te=ee(re.mimeType);oe.indexOf(x.UNICODE_REPLACEMENT_CHARACTER)>=0&&_.warning("Unicode replacement character detected, source encoding issues?");function K(de){if(de>65535){var Lt=55296+((de-=65536)>>10),Bt=56320+(1023&de);return String.fromCharCode(Lt,Bt)}return String.fromCharCode(de)}function ve(de){var Lt=de[de.length-1]===";"?de:de+";";if(!te&&Lt!==de)return _.error("EntityRef: expecting ;"),de;var Bt=x.Reference.exec(Lt);if(!Bt||Bt[0].length!==Lt.length)return _.error("entity not matching Reference production: "+de),de;var Ue=Lt.slice(1,-1);return ft(le,Ue)?le[Ue]:Ue.charAt(0)==="#"?K(parseInt(Ue.substring(1).replace("x","0x"))):(_.error("entity not found:"+de),de)}function ue(de){if(de>he){var Lt=oe.substring(he,de).replace(B,ve);De&&Ce(he),re.characters(Lt,0,de-he),he=de}}var L=0,ce=0,Be=/\r\n?|\n|$/g,De=re.locator;function Ce(de,Lt){for(;de>=ce&&(Lt=Be.exec(oe));)L=ce,ce=Lt.index+Lt[0].length,De.lineNumber++;De.columnNumber=de-L+1}for(var ct=[{currentNSMap:H}],lt=[],he=0;;){try{var ot=oe.indexOf("<",he);if(ot<0){if(!te&&lt.length>0)return _.fatalError("unclosed xml tag(s): "+lt.join(", "));if(!oe.substring(he).match(/^\s*$/)){var Ae=re.doc,Ge=Ae.createTextNode(oe.substring(he));if(Ae.documentElement)return _.error("Extra content at the end of the document");Ae.appendChild(Ge),re.currentElement=Ge}return}if(ot>he){var He=oe.substring(he,ot);te||lt.length!==0||(He=He.replace(new RegExp(x.S_OPT.source,"g"),""))&&_.error("Unexpected content outside root element: '"+He+"'"),ue(ot)}switch(oe.charAt(ot+1)){case"/":var k=oe.indexOf(">",ot+2),xe=oe.substring(ot+2,k>0?k:void 0);if(!xe)return _.fatalError("end tag name missing");var j=k>0&&x.reg("^",x.QName_group,x.S_OPT,"$").exec(xe);if(!j)return _.fatalError('end tag name contains invalid characters: "'+xe+'"');if(!re.currentElement&&!re.doc.documentElement)return;var q=lt[lt.length-1]||re.currentElement.tagName||re.doc.documentElement.tagName||"";if(q!==j[1]){var ut=j[1].toLowerCase();if(!te||q.toLowerCase()!==ut)return _.fatalError('Opening and ending tag mismatch: "'+q+'" != "'+xe+'"')}var Ve=ct.pop();lt.pop();var et=Ve.localNSMap;if(re.endElement(Ve.uri,Ve.localName,q),et)for(var ye in et)ft(et,ye)&&re.endPrefixMapping(ye);k++;break;case"?":De&&Ce(ot),k=G(oe,ot,re,_);break;case"!":De&&Ce(ot),k=St(oe,ot,re,_,te);break;default:De&&Ce(ot);var je=new z,ht=ct[ct.length-1].currentNSMap,at=(k=Ie(oe,ot,je,ht,ve,_,te),je.length);if(je.closed||(te&&Z.isHTMLVoidElement(je.tagName)?je.closed=!0:lt.push(je.tagName)),De&&at){for(var Tn=Xe(De,{}),Q=0;Q<at;Q++){var Rt=je[Q];Ce(Rt.offset),Rt.locator=Xe(De,{})}re.locator=Tn,ke(je,re,ht)&&ct.push(je),re.locator=De}else ke(je,re,ht)&&ct.push(je);te&&!je.closed?k=Re(oe,k,je.tagName,ve,re):k++}}catch(de){if(de instanceof ie)throw de;if(de instanceof F)throw new ie(de.name+": "+de.message,re.locator,de);_.error("element parse error: "+de),k=-1}k>he?he=k:ue(Math.max(ot,he)+1)}})(w,O,V,D,this.errorHandler),D.endDocument()}};var B=/&#?\w+;?/g;function Xe(w,O){return O.lineNumber=w.lineNumber,O.columnNumber=w.columnNumber,O}function Ie(w,O,V,D,oe,H,le){function re(L,ce,Be){return ft(V.attributeNames,L)?H.fatalError("Attribute "+L+" redefined"):!le&&ce.indexOf("<")>=0?H.fatalError("Unescaped '<' not allowed in attributes values"):void V.addValue(L,ce.replace(/[\t\n\r]/g," ").replace(B,oe),Be)}for(var _,te=++O,K=0;;){var ve=w.charAt(te);switch(ve){case"=":if(K===1)_=w.slice(O,te),K=3;else{if(K!==2)throw new Error("attribute equal must after attrName");K=3}break;case"'":case'"':if(K===3||K===1){if(K===1&&(H.warning('attribute value must after "="'),_=w.slice(O,te)),O=te+1,!((te=w.indexOf(ve,O))>0))throw new Error("attribute value no end '"+ve+"' match");re(_,ue=w.slice(O,te),O-1),K=5}else{if(K!=4)throw new Error('attribute value must after "="');re(_,ue=w.slice(O,te),O),H.warning('attribute "'+_+'" missed start quot('+ve+")!!"),O=te+1,K=5}break;case"/":switch(K){case 0:V.setTagName(w.slice(O,te));case 5:case 6:case 7:K=7,V.closed=!0;case 4:case 1:break;case 2:V.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return H.error("unexpected end of input"),K==0&&V.setTagName(w.slice(O,te)),te;case">":switch(K){case 0:V.setTagName(w.slice(O,te));case 5:case 6:case 7:break;case 4:case 1:(ue=w.slice(O,te)).slice(-1)==="/"&&(V.closed=!0,ue=ue.slice(0,-1));case 2:K===2&&(ue=_),K==4?(H.warning('attribute "'+ue+'" missed quot(")!'),re(_,ue,O)):(le||H.warning('attribute "'+ue+'" missed value!! "'+ue+'" instead!!'),re(ue,ue,O));break;case 3:if(!le)return H.fatalError(`AttValue: ' or " expected`)}return te;case"€":ve=" ";default:if(ve<=" ")switch(K){case 0:V.setTagName(w.slice(O,te)),K=6;break;case 1:_=w.slice(O,te),K=2;break;case 4:var ue=w.slice(O,te);H.warning('attribute "'+ue+'" missed quot(")!!'),re(_,ue,O);case 5:K=6}else switch(K){case 2:le||H.warning('attribute "'+_+'" missed value!! "'+_+'" instead2!!'),re(_,_,O),O=te,K=1;break;case 5:H.warning('attribute space is required"'+_+'"!!');case 6:K=1,O=te;break;case 3:K=4,O=te;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}te++}}function ke(w,O,V){for(var D=w.tagName,oe=null,H=w.length;H--;){var le=w[H],re=le.qName,_=le.value;if((ue=re.indexOf(":"))>0)var te=le.prefix=re.slice(0,ue),K=re.slice(ue+1),ve=te==="xmlns"&&K;else K=re,te=null,ve=re==="xmlns"&&"";le.localName=K,ve!==!1&&(oe??(oe=Object.create(null),Pe(V,V=Object.create(null))),V[ve]=oe[ve]=_,le.uri=Me.XMLNS,O.startPrefixMapping(ve,_))}for(H=w.length;H--;)(le=w[H]).prefix&&(le.prefix==="xml"&&(le.uri=Me.XML),le.prefix!=="xmlns"&&(le.uri=V[le.prefix]));var ue;(ue=D.indexOf(":"))>0?(te=w.prefix=D.slice(0,ue),K=w.localName=D.slice(ue+1)):(te=null,K=w.localName=D);var L=w.uri=V[te||""];if(O.startElement(L,K,D,w),!w.closed)return w.currentNSMap=V,w.localNSMap=oe,!0;if(O.endElement(L,K,D),oe)for(te in oe)ft(oe,te)&&O.endPrefixMapping(te)}function Re(w,O,V,D,oe){var H=ne(V);if(H||we(V)){var le=w.indexOf("</"+V+">",O),re=w.substring(O+1,le);return H&&(re=re.replace(B,D)),oe.characters(re,0,re.length),le}return O+1}function Pe(w,O){for(var V in w)ft(w,V)&&(O[V]=w[V])}function Se(w,O){var V=O;function D(le){return le=le||0,w.charAt(V+le)}function oe(le){V+=le=le||1}function H(){return w.substring(V)}return{char:D,getIndex:function(){return V},getMatch:function(le){var re=x.reg("^",le).exec(H());return re?(oe(re[0].length),re[0]):null},getSource:function(){return w},skip:oe,skipBlanks:function(){for(var le=0;V<w.length;){var re=D();if(re!==" "&&re!==`
2
+ `&&re!==" "&&re!=="\r")return le;le++,oe()}return-1},substringFromIndex:H,substringStartsWith:function(le){return w.substring(V,V+le.length)===le},substringStartsWithCaseInsensitive:function(le){return w.substring(V,V+le.length).toUpperCase()===le.toUpperCase()}}}function St(w,O,V,D,oe){var H=Se(w,O);switch(oe?H.char(2).toUpperCase():H.char(2)){case"-":var le=H.getMatch(x.Comment);return le?(V.comment(le,x.COMMENT_START.length,le.length-x.COMMENT_START.length-x.COMMENT_END.length),H.getIndex()):D.fatalError("comment is not well-formed at position "+H.getIndex());case"[":var re=H.getMatch(x.CDSect);return re?oe||V.currentElement?(V.startCDATA(),V.characters(re,x.CDATA_START.length,re.length-x.CDATA_START.length-x.CDATA_END.length),V.endCDATA(),H.getIndex()):D.fatalError("CDATA outside of element"):D.fatalError("Invalid CDATA starting at position "+O);case"D":if(V.doc&&V.doc.documentElement)return D.fatalError("Doctype not allowed inside or after documentElement at position "+H.getIndex());if(oe?!H.substringStartsWithCaseInsensitive(x.DOCTYPE_DECL_START):!H.substringStartsWith(x.DOCTYPE_DECL_START))return D.fatalError("Expected "+x.DOCTYPE_DECL_START+" at position "+H.getIndex());if(H.skip(x.DOCTYPE_DECL_START.length),H.skipBlanks()<1)return D.fatalError("Expected whitespace after "+x.DOCTYPE_DECL_START+" at position "+H.getIndex());var _={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(_.name=H.getMatch(x.Name),!_.name)return D.fatalError("doctype name missing or contains unexpected characters at position "+H.getIndex());if(oe&&_.name.toLowerCase()!=="html"&&D.warning("Unexpected DOCTYPE in HTML document at position "+H.getIndex()),H.skipBlanks(),H.substringStartsWith(x.PUBLIC)||H.substringStartsWith(x.SYSTEM)){var te=x.ExternalID_match.exec(H.substringFromIndex());if(!te)return D.fatalError("doctype external id is not well-formed at position "+H.getIndex());te.groups.SystemLiteralOnly!==void 0?_.systemId=te.groups.SystemLiteralOnly:(_.systemId=te.groups.SystemLiteral,_.publicId=te.groups.PubidLiteral),H.skip(te[0].length)}else if(oe&&H.substringStartsWithCaseInsensitive(x.SYSTEM)){if(H.skip(x.SYSTEM.length),H.skipBlanks()<1)return D.fatalError("Expected whitespace after "+x.SYSTEM+" at position "+H.getIndex());if(_.systemId=H.getMatch(x.ABOUT_LEGACY_COMPAT_SystemLiteral),!_.systemId)return D.fatalError("Expected "+x.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+x.SYSTEM+" at position "+H.getIndex())}return oe&&_.systemId&&!x.ABOUT_LEGACY_COMPAT_SystemLiteral.test(_.systemId)&&D.warning("Unexpected doctype.systemId in HTML document at position "+H.getIndex()),oe||(H.skipBlanks(),_.internalSubset=(function(K,ve){function ue(Ce,ct){var lt=x.PI.exec(Ce.substringFromIndex());return lt?lt[1].toLowerCase()==="xml"?ct.fatalError("xml declaration is only allowed at the start of the document, but found at position "+Ce.getIndex()):(Ce.skip(lt[0].length),lt[0]):ct.fatalError("processing instruction is not well-formed at position "+Ce.getIndex())}var L=K.getSource();if(K.char()==="["){K.skip(1);for(var ce=K.getIndex();K.getIndex()<L.length;){if(K.skipBlanks(),K.char()==="]"){var Be=L.substring(ce,K.getIndex());return K.skip(1),Be}var De=null;if(K.char()==="<"&&K.char(1)==="!")switch(K.char(2)){case"E":K.char(3)==="L"?De=K.getMatch(x.elementdecl):K.char(3)==="N"&&(De=K.getMatch(x.EntityDecl));break;case"A":De=K.getMatch(x.AttlistDecl);break;case"N":De=K.getMatch(x.NotationDecl);break;case"-":De=K.getMatch(x.Comment)}else if(K.char()==="<"&&K.char(1)==="?")De=ue(K,ve);else{if(K.char()!=="%")return ve.fatalError("Error detected in Markup declaration");De=K.getMatch(x.PEReference)}if(!De)return ve.fatalError("Error in internal subset at position "+K.getIndex())}return ve.fatalError("doctype internal subset is not well-formed, missing ]")}})(H,D)),H.skipBlanks(),H.char()!==">"?D.fatalError("doctype not terminated with > at position "+H.getIndex()):(H.skip(1),V.startDTD(_.name,_.publicId,_.systemId,_.internalSubset),V.endDTD(),H.getIndex());default:return D.fatalError('Not well-formed XML starting with "<!" at position '+O)}}function G(w,O,V,D){var oe=w.substring(O).match(x.PI);if(!oe)return D.fatalError("Invalid processing instruction starting at position "+O);if(oe[1].toLowerCase()==="xml"){if(O>0)return D.fatalError("processing instruction at position "+O+" is an xml declaration which is only at the start of the document");if(!x.XMLDecl.test(w.substring(O)))return D.fatalError("xml declaration is not well-formed")}return V.processingInstruction(oe[1],oe[2]),O+oe[0].length}function z(){this.attributeNames=Object.create(null)}z.prototype={setTagName:function(w){if(!x.QName_exact.test(w))throw new Error("invalid tagName:"+w);this.tagName=w},addValue:function(w,O,V){if(!x.QName_exact.test(w))throw new Error("invalid attribute:"+w);this.attributeNames[w]=this.length,this[this.length++]={qName:w,value:O,offset:V}},length:0,getLocalName:function(w){return this[w].localName},getLocator:function(w){return this[w].locator},getQName:function(w){return this[w].qName},getURI:function(w){return this[w].uri},getValue:function(w){return this[w].value}},R.XMLReader=me,R.parseUtils=Se,R.parseDoctypeCommentOrCData=St},334(Oe,R,ge){"use strict";var Z=ge(981).freeze;R.XML_ENTITIES=Z({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),R.HTML_ENTITIES=Z({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
3
+ `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),R.entityMap=R.HTML_ENTITIES},553(Oe,R,ge){"use strict";var Z=ge(981),x=Z.find,Te=Z.hasDefaultHTMLNamespace,ne=Z.hasOwn,ee=Z.isHTMLMimeType,we=Z.isHTMLRawTextElement,ft=Z.isHTMLVoidElement,Me=Z.MIME_TYPE,ie=Z.NAMESPACE,F=Symbol(),me=ge(918),B=me.DOMException,Xe=me.DOMExceptionName,Ie=ge(112);function ke(h){if(h!==F)throw new TypeError("Illegal constructor")}function Re(h){return h!==""}function Pe(h,m){return ne(h,m)||(h[m]=!0),h}function Se(h){if(!h)return[];var m=(function(S){return S?S.split(/[\t\n\f\r ]+/).filter(Re):[]})(h);return Object.keys(m.reduce(Pe,{}))}function St(h){if(!Ie.QName_exact.test(h))throw new B(B.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+h+'"')}function G(h,m){St(m),h=h||null;var S=null,b=m;if(m.indexOf(":")>=0){var M=m.split(":");S=M[0],b=M[1]}if(S!==null&&h===null)throw new B(B.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(S==="xml"&&h!==Z.NAMESPACE.XML)throw new B(B.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((S==="xmlns"||m==="xmlns")&&h!==Z.NAMESPACE.XMLNS)throw new B(B.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(h===Z.NAMESPACE.XMLNS&&S!=="xmlns"&&m!=="xmlns")throw new B(B.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[h,S,b]}function z(h,m){for(var S in h)ne(h,S)&&(m[S]=h[S])}function w(h,m){var S=h.prototype;if(!(S instanceof m)){let b=function(){};b.prototype=m.prototype,z(S,b=new b),h.prototype=S=b}S.constructor!=h&&(typeof h!="function"&&console.error("unknown Class:"+h),S.constructor=h)}var O={},V=O.ELEMENT_NODE=1,D=O.ATTRIBUTE_NODE=2,oe=O.TEXT_NODE=3,H=O.CDATA_SECTION_NODE=4,le=O.ENTITY_REFERENCE_NODE=5,re=O.ENTITY_NODE=6,_=O.PROCESSING_INSTRUCTION_NODE=7,te=O.COMMENT_NODE=8,K=O.DOCUMENT_NODE=9,ve=O.DOCUMENT_TYPE_NODE=10,ue=O.DOCUMENT_FRAGMENT_NODE=11,L=O.NOTATION_NODE=12,ce=Z.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Be(h,m){if(m.length<h.length)return Be(m,h);var S=null;for(var b in h){if(h[b]!==m[b])return S;S=h[b]}return S}function De(h){return h.guid||(h.guid=Math.random()),h.guid}function Ce(){}function ct(h,m){this._node=h,this._refresh=m,lt(this)}function lt(h){var m=h._node._inc||h._node.ownerDocument._inc;if(h._inc!==m){var S=h._refresh(h._node);if(Pt(h,"length",S.length),!h.$$length||S.length<h.$$length)for(var b=S.length;b in h;b++)ne(h,b)&&delete h[b];z(S,h),h._inc=m}}function he(){}function ot(h,m){for(var S=0;S<h.length;){if(h[S]===m)return S;S++}}function Ae(h,m,S,b){if(b?m[ot(m,b)]=S:(m[m.length]=S,m.length++),h){S.ownerElement=h;var M=h.ownerDocument;M&&(b&&Ve(M,h,b),(function(X,P,Le){X&&X._inc++,Le.namespaceURI===ie.XMLNS&&(P._nsMap[Le.prefix?Le.localName:""]=Le.value)})(M,h,S))}}function Ge(h,m,S){var b=ot(m,S);if(b>=0){for(var M=m.length-1;b<=M;)m[b]=m[++b];if(m.length=M,h){var X=h.ownerDocument;X&&Ve(X,h,S),S.ownerElement=null}}}function He(){}function k(h){ke(h)}function xe(h){return(h=="<"?"&lt;":h==">"&&"&gt;")||h=="&"&&"&amp;"||h=='"'&&"&quot;"||"&#"+h.charCodeAt()+";"}function j(h,m){q(h,null,{enter:function(S){return!m(S)||q.STOP}})}function q(h,m,S){for(var b=[{node:h,context:m,phase:q.ENTER}];b.length>0;){var M=b.pop();if(M.phase===q.ENTER){var X=S.enter(M.node,M.context);if(X===q.STOP)return q.STOP;if(b.push({node:M.node,context:X,phase:q.EXIT}),X==null)continue;for(var P=M.node.lastChild;P;)b.push({node:P,context:X,phase:q.ENTER}),P=P.previousSibling}else S.exit&&S.exit(M.node,M.context)}}function ut(h,m){ke(h);var S=m||{};this.ownerDocument=this,this.contentType=S.contentType||Me.XML_APPLICATION,this.type=ee(this.contentType)?"html":"xml"}function Ve(h,m,S,b){h&&h._inc++,S.namespaceURI===ie.XMLNS&&delete m._nsMap[S.prefix?S.localName:""]}function et(h,m,S){if(h&&h._inc){h._inc++;var b=m.childNodes;if(S&&!S.nextSibling)b[b.length++]=S;else{for(var M=m.firstChild,X=0;M;)b[X++]=M,M=M.nextSibling;b.length=X,delete b[b.length]}}}function ye(h,m){if(h!==m.parentNode)throw new B(B.NOT_FOUND_ERR,"child's parent is not parent");var S=m.previousSibling,b=m.nextSibling;return S?S.nextSibling=b:h.firstChild=b,b?b.previousSibling=S:h.lastChild=S,et(h.ownerDocument,h),m.parentNode=null,m.previousSibling=null,m.nextSibling=null,m}function je(h){return h&&h.nodeType===k.DOCUMENT_TYPE_NODE}function ht(h){return h&&h.nodeType===k.ELEMENT_NODE}function at(h){return h&&h.nodeType===k.TEXT_NODE}function Tn(h,m){var S=h.childNodes||[];if(x(S,ht)||je(m))return!1;var b=x(S,je);return!(m&&b&&S.indexOf(b)>S.indexOf(m))}function Q(h,m){var S=h.childNodes||[];if(x(S,function(M){return ht(M)&&M!==m}))return!1;var b=x(S,je);return!(m&&b&&S.indexOf(b)>S.indexOf(m))}function Rt(h,m,S){if(!(function(b){return b&&(b.nodeType===k.DOCUMENT_NODE||b.nodeType===k.DOCUMENT_FRAGMENT_NODE||b.nodeType===k.ELEMENT_NODE)})(h))throw new B(B.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+h.nodeType);if(S&&S.parentNode!==h)throw new B(B.NOT_FOUND_ERR,"child not in parent");if(!(function(b){return b&&(b.nodeType===k.CDATA_SECTION_NODE||b.nodeType===k.COMMENT_NODE||b.nodeType===k.DOCUMENT_FRAGMENT_NODE||b.nodeType===k.DOCUMENT_TYPE_NODE||b.nodeType===k.ELEMENT_NODE||b.nodeType===k.PROCESSING_INSTRUCTION_NODE||b.nodeType===k.TEXT_NODE)})(m)||je(m)&&h.nodeType!==k.DOCUMENT_NODE)throw new B(B.HIERARCHY_REQUEST_ERR,"Unexpected node type "+m.nodeType+" for parent node type "+h.nodeType)}function de(h,m,S){var b=h.childNodes||[],M=m.childNodes||[];if(m.nodeType===k.DOCUMENT_FRAGMENT_NODE){var X=M.filter(ht);if(X.length>1||x(M,at))throw new B(B.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(X.length===1&&!Tn(h,S))throw new B(B.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ht(m)&&!Tn(h,S))throw new B(B.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(je(m)){if(x(b,je))throw new B(B.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var P=x(b,ht);if(S&&b.indexOf(P)<b.indexOf(S))throw new B(B.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!S&&P)throw new B(B.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Lt(h,m,S){var b=h.childNodes||[],M=m.childNodes||[];if(m.nodeType===k.DOCUMENT_FRAGMENT_NODE){var X=M.filter(ht);if(X.length>1||x(M,at))throw new B(B.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(X.length===1&&!Q(h,S))throw new B(B.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ht(m)&&!Q(h,S))throw new B(B.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(je(m)){if(x(b,function(Y){return je(Y)&&Y!==S}))throw new B(B.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var P=x(b,ht);if(S&&b.indexOf(P)<b.indexOf(S))throw new B(B.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function Bt(h,m,S,b){Rt(h,m,S),h.nodeType===k.DOCUMENT_NODE&&(b||de)(h,m,S);var M=m.parentNode;if(M&&M.removeChild(m),m.nodeType===ue){var X=m.firstChild;if(X==null)return m;var P=m.lastChild}else X=P=m;var Le=S?S.previousSibling:h.lastChild;X.previousSibling=Le,P.nextSibling=S,Le?Le.nextSibling=X:h.firstChild=X,S==null?h.lastChild=P:S.previousSibling=P;do X.parentNode=h;while(X!==P&&(X=X.nextSibling));return et(h.ownerDocument||h,h,m),m.nodeType==ue&&(m.firstChild=m.lastChild=null),m}function Ue(h){ke(h),this._nsMap=Object.create(null)}function tt(h){ke(h),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function wt(h){ke(h)}function Yt(h){ke(h)}function Gt(h){ke(h)}function l(h){ke(h)}function on(h){ke(h)}function d(h){ke(h)}function Dn(h){ke(h)}function be(h){ke(h)}function Vt(h){ke(h)}function Ye(h){ke(h)}function Jn(){}function _t(h){var m=typeof h=="function"?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:h}:h!=null?{requireWellFormed:!!h.requireWellFormed,splitCDATASections:h.splitCDATASections!==!1,nodeFilter:h.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null},S=[],b=this.nodeType===K&&this.documentElement||this,M=b.prefix,X=b.namespaceURI;if(X&&M==null&&(M=b.lookupPrefix(X))==null)var P=[{namespace:X,prefix:null}];return In(this,S,P,m),S.join("")}function $e(h,m,S){var b=h.prefix||"",M=h.namespaceURI;if(!M||b==="xml"&&M===ie.XML||M===ie.XMLNS)return!1;for(var X=S.length;X--;){var P=S[X];if(P.prefix===b)return P.namespace!==M}return!0}function _e(h,m,S){h.push(" ",m,'="',S.replace(/[<>&"\t\n\r]/g,xe),'"')}function In(h,m,S,b){S||(S=[]);var M=b.nodeFilter,X=b.requireWellFormed,P=b.splitCDATASections,Le=(h.nodeType===K?h:h.ownerDocument).type==="html";q(h,{ns:S},{enter:function(Y,pt){var mt=pt.ns;if(M){if(!(Y=M(Y)))return null;if(typeof Y=="string")return m.push(Y),null}switch(Y.nodeType){case V:var Qe=Y.attributes,xt=Qe.length,yt=Y.tagName,sn=yt;if(!Le&&!Y.prefix&&Y.namespaceURI){for(var Tt,An=0;An<Qe.length;An++)if(Qe.item(An).name==="xmlns"){Tt=Qe.item(An).value;break}if(!Tt){for(var dt=mt.length-1;dt>=0;dt--)if((bn=mt[dt]).prefix===""&&bn.namespace===Y.namespaceURI){Tt=bn.namespace;break}}if(Tt!==Y.namespaceURI)for(dt=mt.length-1;dt>=0;dt--){var bn;if((bn=mt[dt]).namespace===Y.namespaceURI){bn.prefix&&(sn=bn.prefix+":"+yt);break}}}m.push("<",sn);for(var Wt=mt.slice(),Kt=0;Kt<xt;Kt++)(zt=Qe.item(Kt)).prefix=="xmlns"?Wt.push({prefix:zt.localName,namespace:zt.value}):zt.nodeName=="xmlns"&&Wt.push({prefix:"",namespace:zt.value});for(Kt=0;Kt<xt;Kt++){var zt;if($e(zt=Qe.item(Kt),0,Wt)){var wn=zt.prefix||"",en=zt.namespaceURI;_e(m,wn?"xmlns:"+wn:"xmlns",en),Wt.push({prefix:wn,namespace:en})}var It=M?M(zt):zt;It&&(typeof It=="string"?m.push(It):_e(m,It.name,It.value))}if(yt===sn&&$e(Y,0,Wt)){var Pn=Y.prefix||"";en=Y.namespaceURI,_e(m,Pn?"xmlns:"+Pn:"xmlns",en),Wt.push({prefix:Pn,namespace:en})}var tn=!Y.firstChild;if(tn&&(Le||Y.namespaceURI===ie.HTML)&&(tn=ft(yt)),tn)return m.push("/>"),null;if(m.push(">"),Le&&we(yt)){for(var At=Y.firstChild;At;)At.data?m.push(At.data):In(At,m,Wt.slice(),b),At=At.nextSibling;return m.push("</",sn,">"),null}return{ns:Wt,tag:sn};case K:case ue:if(X&&Y.nodeType===K&&Y.documentElement==null)throw new B("The Document has no documentElement",Xe.InvalidStateError);return{ns:mt};case D:return _e(m,Y.name,Y.value),null;case oe:if(X&&Ie.InvalidChar.test(Y.data))throw new B("The Text node data contains characters outside the XML Char production",Xe.InvalidStateError);return m.push(Y.data.replace(/[<&>]/g,xe)),null;case H:if(X&&Y.data.indexOf("]]>")!==-1)throw new B('The CDATASection data contains "]]>"',Xe.InvalidStateError);return P?m.push(Ie.CDATA_START,Y.data.replace(/]]>/g,"]]]]><![CDATA[>"),Ie.CDATA_END):m.push(Ie.CDATA_START,Y.data,Ie.CDATA_END),null;case te:if(X){if(Ie.InvalidChar.test(Y.data))throw new B("The comment node data contains characters outside the XML Char production",Xe.InvalidStateError);if(Y.data.indexOf("--")!==-1||Y.data[Y.data.length-1]==="-")throw new B('The comment node data contains "--" or ends with "-"',Xe.InvalidStateError)}return m.push(Ie.COMMENT_START,Y.data,Ie.COMMENT_END),null;case ve:var fn=Y.publicId,Ht=Y.systemId;if(X){if(fn&&!Ie.PubidLiteral_match.test(fn))throw new B("DocumentType publicId is not a valid PubidLiteral",Xe.InvalidStateError);if(Ht&&Ht!=="."&&!Ie.SystemLiteral_match.test(Ht))throw new B("DocumentType systemId is not a valid SystemLiteral",Xe.InvalidStateError);if(Y.internalSubset&&Y.internalSubset.indexOf("]>")!==-1)throw new B('DocumentType internalSubset contains "]>"',Xe.InvalidStateError)}return m.push(Ie.DOCTYPE_DECL_START," ",Y.name),fn?(m.push(" ",Ie.PUBLIC," ",fn),Ht&&Ht!=="."&&m.push(" ",Ht)):Ht&&Ht!=="."&&m.push(" ",Ie.SYSTEM," ",Ht),Y.internalSubset&&m.push(" [",Y.internalSubset,"]"),m.push(">"),null;case _:if(X){if(Y.target.indexOf(":")!==-1||Y.target.toLowerCase()==="xml")throw new B("The ProcessingInstruction target is not well-formed",Xe.InvalidStateError);if(Ie.InvalidChar.test(Y.data))throw new B("The ProcessingInstruction data contains characters outside the XML Char production",Xe.InvalidStateError);if(Y.data.indexOf("?>")!==-1)throw new B('The ProcessingInstruction data contains "?>"',Xe.InvalidStateError)}return m.push("<?",Y.target," ",Y.data,"?>"),null;case le:return m.push("&",Y.nodeName,";"),null;default:return m.push("??",Y.nodeName),null}},exit:function(Y,pt){pt&&pt.tag&&m.push("</",pt.tag,">")}})}function qn(h,m,S){var b;return q(m,null,{enter:function(M,X){var P=new M.constructor(F);for(var Le in M)if(ne(M,Le)){var Y=M[Le];typeof Y!="object"&&Y!=P[Le]&&(P[Le]=Y)}M.childNodes&&(P.childNodes=new Ce),P.ownerDocument=h;var pt=S;switch(P.nodeType){case V:var mt=M.attributes,Qe=P.attributes=new he,xt=mt.length;Qe._ownerElement=P;for(var yt=0;yt<xt;yt++)P.setAttributeNode(qn(h,mt.item(yt),!0));break;case D:pt=!0}return X!==null?X.appendChild(P):b=P,pt?P:null}}),b}function Pt(h,m,S){h[m]=S}function I(h){for(var m=[],S=h.firstChild;S;)S.nodeType===V&&m.push(S),S=S.nextSibling;return m}Ce.prototype={length:0,item:function(h){return h>=0&&h<this.length?this[h]:null},toString:function(h){for(var m=typeof h=="function"?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:h}:h?{requireWellFormed:!!h.requireWellFormed,splitCDATASections:h.splitCDATASections!==!1,nodeFilter:h.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null},S=[],b=0;b<this.length;b++)In(this[b],S,null,m);return S.join("")},filter:function(h){return Array.prototype.filter.call(this,h)},indexOf:function(h){return Array.prototype.indexOf.call(this,h)}},Ce.prototype[Symbol.iterator]=function(){var h=this,m=0;return{next:function(){return m<h.length?{value:h[m++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},ct.prototype.item=function(h){return lt(this),this[h]||null},w(ct,Ce),he.prototype={length:0,item:Ce.prototype.item,getNamedItem:function(h){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(h=h.toLowerCase());for(var m=0;m<this.length;){var S=this[m];if(S.nodeName===h)return S;m++}return null},setNamedItem:function(h){var m=h.ownerElement;if(m&&m!==this._ownerElement)throw new B(B.INUSE_ATTRIBUTE_ERR);var S=this.getNamedItemNS(h.namespaceURI,h.localName);return S===h?h:(Ae(this._ownerElement,this,h,S),S)},setNamedItemNS:function(h){return this.setNamedItem(h)},removeNamedItem:function(h){var m=this.getNamedItem(h);if(!m)throw new B(B.NOT_FOUND_ERR,h);return Ge(this._ownerElement,this,m),m},removeNamedItemNS:function(h,m){var S=this.getNamedItemNS(h,m);if(!S)throw new B(B.NOT_FOUND_ERR,h?h+" : "+m:m);return Ge(this._ownerElement,this,S),S},getNamedItemNS:function(h,m){h||(h=null);for(var S=0;S<this.length;){var b=this[S];if(b.localName===m&&b.namespaceURI===h)return b;S++}return null}},he.prototype[Symbol.iterator]=function(){var h=this,m=0;return{next:function(){return m<h.length?{value:h[m++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},He.prototype={hasFeature:function(h,m){return!0},createDocument:function(h,m,S){var b=Me.XML_APPLICATION;h===ie.HTML?b=Me.XML_XHTML_APPLICATION:h===ie.SVG&&(b=Me.XML_SVG_IMAGE);var M=new ut(F,{contentType:b});if(M.implementation=this,M.childNodes=new Ce,M.doctype=S||null,S&&M.appendChild(S),m){var X=M.createElementNS(h,m);M.appendChild(X)}return M},createDocumentType:function(h,m,S,b){St(h);var M=new on(F);return M.name=h,M.nodeName=h,M.publicId=m||"",M.systemId=S||"",M.internalSubset=b||"",M.childNodes=new Ce,M},createHTMLDocument:function(h){var m=new ut(F,{contentType:Me.HTML});if(m.implementation=this,m.childNodes=new Ce,h!==!1){m.doctype=this.createDocumentType("html"),m.doctype.ownerDocument=m,m.appendChild(m.doctype);var S=m.createElement("html");m.appendChild(S);var b=m.createElement("head");if(S.appendChild(b),typeof h=="string"){var M=m.createElement("title");M.appendChild(m.createTextNode(h)),b.appendChild(M)}S.appendChild(m.createElement("body"))}return m}},k.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var h=this.getRootNode();return h&&h.nodeType===h.DOCUMENT_NODE},contains:function(h){if(!h)return!1;var m=h;do{if(this===m)return!0;m=m.parentNode}while(m);return!1},getRootNode:function(h){var m=this;do{if(!m.parentNode)return m;m=m.parentNode}while(m)},isEqualNode:function(h){if(!h)return!1;for(var m=[{node:this,other:h}];m.length>0;){var S=m.pop(),b=S.node,M=S.other;if(b.nodeType!==M.nodeType)return!1;switch(b.nodeType){case b.DOCUMENT_TYPE_NODE:if(b.name!==M.name||b.publicId!==M.publicId||b.systemId!==M.systemId)return!1;break;case b.ELEMENT_NODE:if(b.namespaceURI!==M.namespaceURI||b.prefix!==M.prefix||b.localName!==M.localName||b.attributes.length!==M.attributes.length)return!1;for(var X=0;X<b.attributes.length;X++){var P=b.attributes.item(X),Le=M.getAttributeNodeNS(P.namespaceURI,P.localName);if(!Le)return!1;m.push({node:P,other:Le})}break;case b.ATTRIBUTE_NODE:if(b.namespaceURI!==M.namespaceURI||b.localName!==M.localName||b.value!==M.value)return!1;break;case b.PROCESSING_INSTRUCTION_NODE:if(b.target!==M.target||b.data!==M.data)return!1;break;case b.TEXT_NODE:case b.CDATA_SECTION_NODE:case b.COMMENT_NODE:if(b.data!==M.data)return!1}if(b.childNodes.length!==M.childNodes.length)return!1;for(X=b.childNodes.length-1;X>=0;X--)m.push({node:b.childNodes[X],other:M.childNodes[X]})}return!0},isSameNode:function(h){return this===h},insertBefore:function(h,m){return Bt(this,h,m)},replaceChild:function(h,m){Bt(this,h,m,Lt),m&&this.removeChild(m)},removeChild:function(h){return ye(this,h)},appendChild:function(h){return this.insertBefore(h,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(h){return qn(this.ownerDocument||this,this,h)},normalize:function(){q(this,null,{enter:function(h){for(var m=h.firstChild;m;){var S=m.nextSibling;S!==null&&S.nodeType===oe&&m.nodeType===oe?(h.removeChild(S),m.appendData(S.data)):m=S}return!0}})},isSupported:function(h,m){return this.ownerDocument.implementation.hasFeature(h,m)},lookupPrefix:function(h){for(var m=this;m;){var S=m._nsMap;if(S){for(var b in S)if(ne(S,b)&&S[b]===h)return b}m=m.nodeType==D?m.ownerDocument:m.parentNode}return null},lookupNamespaceURI:function(h){for(var m=this;m;){var S=m._nsMap;if(S&&ne(S,h))return S[h];m=m.nodeType==D?m.ownerDocument:m.parentNode}return null},isDefaultNamespace:function(h){return this.lookupPrefix(h)==null},compareDocumentPosition:function(h){if(this===h)return 0;var m=h,S=this,b=null,M=null;if(m instanceof tt&&(m=(b=m).ownerElement),S instanceof tt&&(S=(M=S).ownerElement,b&&m&&S===m))for(var X,P=0;X=S.attributes[P];P++){if(X===b)return ce.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ce.DOCUMENT_POSITION_PRECEDING;if(X===M)return ce.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ce.DOCUMENT_POSITION_FOLLOWING}if(!m||!S||S.ownerDocument!==m.ownerDocument)return ce.DOCUMENT_POSITION_DISCONNECTED+ce.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(De(S.ownerDocument)>De(m.ownerDocument)?ce.DOCUMENT_POSITION_FOLLOWING:ce.DOCUMENT_POSITION_PRECEDING);if(M&&m===S)return ce.DOCUMENT_POSITION_CONTAINS+ce.DOCUMENT_POSITION_PRECEDING;if(b&&m===S)return ce.DOCUMENT_POSITION_CONTAINED_BY+ce.DOCUMENT_POSITION_FOLLOWING;for(var Le=[],Y=m.parentNode;Y;){if(!M&&Y===S)return ce.DOCUMENT_POSITION_CONTAINED_BY+ce.DOCUMENT_POSITION_FOLLOWING;Le.push(Y),Y=Y.parentNode}Le.reverse();for(var pt=[],mt=S.parentNode;mt;){if(!b&&mt===m)return ce.DOCUMENT_POSITION_CONTAINS+ce.DOCUMENT_POSITION_PRECEDING;pt.push(mt),mt=mt.parentNode}pt.reverse();var Qe=Be(Le,pt);for(var xt in Qe.childNodes){var yt=Qe.childNodes[xt];if(yt===S)return ce.DOCUMENT_POSITION_FOLLOWING;if(yt===m)return ce.DOCUMENT_POSITION_PRECEDING;if(pt.indexOf(yt)>=0)return ce.DOCUMENT_POSITION_FOLLOWING;if(Le.indexOf(yt)>=0)return ce.DOCUMENT_POSITION_PRECEDING}return 0}},z(O,k),z(O,k.prototype),z(ce,k),z(ce,k.prototype),q.STOP=Symbol("walkDOM.STOP"),q.ENTER=0,q.EXIT=1,ut.prototype={implementation:null,nodeName:"#document",nodeType:K,doctype:null,documentElement:null,_inc:1,insertBefore:function(h,m){if(h.nodeType===ue){for(var S=h.firstChild;S;){var b=S.nextSibling;this.insertBefore(S,m),S=b}return h}return Bt(this,h,m),h.ownerDocument=this,this.documentElement===null&&h.nodeType===V&&(this.documentElement=h),h},removeChild:function(h){var m=ye(this,h);return m===this.documentElement&&(this.documentElement=null),m},replaceChild:function(h,m){Bt(this,h,m,Lt),h.ownerDocument=this,m&&this.removeChild(m),ht(h)&&(this.documentElement=h)},importNode:function(h,m){return(function(S,b,M){var X;return q(b,null,{enter:function(P,Le){var Y=P.cloneNode(!1);return Y.ownerDocument=S,Y.parentNode=null,Le===null?X=Y:Le.appendChild(Y),P.nodeType===D||M?Y:null}}),X})(this,h,m)},getElementById:function(h){var m=null;return j(this.documentElement,function(S){if(S.nodeType==V&&S.getAttribute("id")==h)return m=S,!0}),m},createElement:function(h){var m=new Ue(F);return m.ownerDocument=this,this.type==="html"&&(h=h.toLowerCase()),Te(this.contentType)&&(m.namespaceURI=ie.HTML),m.nodeName=h,m.tagName=h,m.localName=h,m.childNodes=new Ce,(m.attributes=new he)._ownerElement=m,m},createDocumentFragment:function(){var h=new Vt(F);return h.ownerDocument=this,h.childNodes=new Ce,h},createTextNode:function(h){var m=new Yt(F);return m.ownerDocument=this,m.childNodes=new Ce,m.appendData(h),m},createComment:function(h){var m=new Gt(F);return m.ownerDocument=this,m.childNodes=new Ce,m.appendData(h),m},createCDATASection:function(h){if(h.indexOf("]]>")!==-1)throw new B(B.INVALID_CHARACTER_ERR,'data contains "]]>"');var m=new l(F);return m.ownerDocument=this,m.childNodes=new Ce,m.appendData(h),m},createProcessingInstruction:function(h,m){var S=new Ye(F);return S.ownerDocument=this,S.childNodes=new Ce,S.nodeName=S.target=h,S.nodeValue=S.data=m,S},createAttribute:function(h){if(!Ie.QName_exact.test(h))throw new B(B.INVALID_CHARACTER_ERR,'invalid character in name "'+h+'"');return this.type==="html"&&(h=h.toLowerCase()),this._createAttribute(h)},_createAttribute:function(h){var m=new tt(F);return m.ownerDocument=this,m.childNodes=new Ce,m.name=h,m.nodeName=h,m.localName=h,m.specified=!0,m},createEntityReference:function(h){if(!Ie.Name.test(h))throw new B(B.INVALID_CHARACTER_ERR,'not a valid xml name "'+h+'"');if(this.type==="html")throw new B("document is an html document",Xe.NotSupportedError);var m=new be(F);return m.ownerDocument=this,m.childNodes=new Ce,m.nodeName=h,m},createElementNS:function(h,m){var S=G(h,m),b=new Ue(F),M=b.attributes=new he;return b.childNodes=new Ce,b.ownerDocument=this,b.nodeName=m,b.tagName=m,b.namespaceURI=S[0],b.prefix=S[1],b.localName=S[2],M._ownerElement=b,b},createAttributeNS:function(h,m){var S=G(h,m),b=new tt(F);return b.ownerDocument=this,b.childNodes=new Ce,b.nodeName=m,b.name=m,b.specified=!0,b.namespaceURI=S[0],b.prefix=S[1],b.localName=S[2],b}},w(ut,k),Ue.prototype={nodeType:V,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===ie.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(h){return!!this.getAttributeNode(h)},getAttribute:function(h){var m=this.getAttributeNode(h);return m?m.value:null},getAttributeNode:function(h){return this._isInHTMLDocumentAndNamespace()&&(h=h.toLowerCase()),this.attributes.getNamedItem(h)},setAttribute:function(h,m){this._isInHTMLDocumentAndNamespace()&&(h=h.toLowerCase());var S=this.getAttributeNode(h);S?S.value=S.nodeValue=""+m:((S=this.ownerDocument._createAttribute(h)).value=S.nodeValue=""+m,this.setAttributeNode(S))},removeAttribute:function(h){var m=this.getAttributeNode(h);m&&this.removeAttributeNode(m)},setAttributeNode:function(h){return this.attributes.setNamedItem(h)},setAttributeNodeNS:function(h){return this.attributes.setNamedItemNS(h)},removeAttributeNode:function(h){return this.attributes.removeNamedItem(h.nodeName)},removeAttributeNS:function(h,m){var S=this.getAttributeNodeNS(h,m);S&&this.removeAttributeNode(S)},hasAttributeNS:function(h,m){return this.getAttributeNodeNS(h,m)!=null},getAttributeNS:function(h,m){var S=this.getAttributeNodeNS(h,m);return S?S.value:null},setAttributeNS:function(h,m,S){var b=G(h,m)[2],M=this.getAttributeNodeNS(h,b);M?M.value=M.nodeValue=""+S:((M=this.ownerDocument.createAttributeNS(h,m)).value=M.nodeValue=""+S,this.setAttributeNode(M))},getAttributeNodeNS:function(h,m){return this.attributes.getNamedItemNS(h,m)},getElementsByClassName:function(h){var m=Se(h);return new ct(this,function(S){var b=[];return m.length>0&&j(S,function(M){if(M!==S&&M.nodeType===V){var X=M.getAttribute("class");if(X){var P=h===X;if(!P){var Le=Se(X);P=m.every((Y=Le,function(pt){return Y&&Y.indexOf(pt)!==-1}))}P&&b.push(M)}}var Y}),b})},getElementsByTagName:function(h){var m=(this.nodeType===K?this:this.ownerDocument).type==="html",S=h.toLowerCase();return new ct(this,function(b){var M=[];return j(b,function(X){X!==b&&X.nodeType===V&&(h==="*"||X.getQualifiedName()===(m&&X.namespaceURI===ie.HTML?S:h))&&M.push(X)}),M})},getElementsByTagNameNS:function(h,m){return new ct(this,function(S){var b=[];return j(S,function(M){M===S||M.nodeType!==V||h!=="*"&&M.namespaceURI!==h||m!=="*"&&M.localName!=m||b.push(M)}),b})}},ut.prototype.getElementsByClassName=Ue.prototype.getElementsByClassName,ut.prototype.getElementsByTagName=Ue.prototype.getElementsByTagName,ut.prototype.getElementsByTagNameNS=Ue.prototype.getElementsByTagNameNS,w(Ue,k),tt.prototype.nodeType=D,w(tt,k),wt.prototype={data:"",substringData:function(h,m){return this.data.substring(h,h+m)},appendData:function(h){h=this.data+h,this.nodeValue=this.data=h,this.length=h.length},insertData:function(h,m){this.replaceData(h,0,m)},deleteData:function(h,m){this.replaceData(h,m,"")},replaceData:function(h,m,S){S=this.data.substring(0,h)+S+this.data.substring(h+m),this.nodeValue=this.data=S,this.length=S.length}},w(wt,k),Yt.prototype={nodeName:"#text",nodeType:oe,splitText:function(h){var m=this.data,S=m.substring(h);m=m.substring(0,h),this.data=this.nodeValue=m,this.length=m.length;var b=this.ownerDocument.createTextNode(S);return this.parentNode&&this.parentNode.insertBefore(b,this.nextSibling),b}},w(Yt,wt),Gt.prototype={nodeName:"#comment",nodeType:te},w(Gt,wt),l.prototype={nodeName:"#cdata-section",nodeType:H},w(l,Yt),on.prototype.nodeType=ve,w(on,k),d.prototype.nodeType=L,w(d,k),Dn.prototype.nodeType=re,w(Dn,k),be.prototype.nodeType=le,w(be,k),Vt.prototype.nodeName="#document-fragment",Vt.prototype.nodeType=ue,w(Vt,k),Ye.prototype.nodeType=_,w(Ye,wt),Jn.prototype.serializeToString=function(h,m){return _t.call(h,m)},k.prototype.toString=_t;try{Object.defineProperty&&(Object.defineProperty(ct.prototype,"length",{get:function(){return lt(this),this.$$length}}),Object.defineProperty(k.prototype,"textContent",{get:function(){if(this.nodeType===V||this.nodeType===ue){var h=[];return q(this,null,{enter:function(m){return m.nodeType===V||m.nodeType===ue||(m.nodeType===_||m.nodeType===te?null:void h.push(m.nodeValue))}}),h.join("")}return this.nodeValue},set:function(h){switch(this.nodeType){case V:case ue:for(;this.firstChild;)this.removeChild(this.firstChild);(h||String(h))&&this.appendChild(this.ownerDocument.createTextNode(h));break;default:this.data=h,this.value=h,this.nodeValue=h}}}),Object.defineProperty(Ue.prototype,"children",{get:function(){return new ct(this,I)}}),Object.defineProperty(ut.prototype,"children",{get:function(){return new ct(this,I)}}),Object.defineProperty(Vt.prototype,"children",{get:function(){return new ct(this,I)}}),Pt=function(h,m,S){h["$$"+m]=S})}catch{}R._updateLiveList=lt,R.Attr=tt,R.CDATASection=l,R.CharacterData=wt,R.Comment=Gt,R.Document=ut,R.DocumentFragment=Vt,R.DocumentType=on,R.DOMImplementation=He,R.Element=Ue,R.Entity=Dn,R.EntityReference=be,R.LiveNodeList=ct,R.NamedNodeMap=he,R.Node=k,R.NodeList=Ce,R.Notation=d,R.Text=Yt,R.ProcessingInstruction=Ye,R.walkDOM=q,R.XMLSerializer=Jn},841(Oe,R,ge){"use strict";var Z=ge(981);R.assign=Z.assign,R.hasDefaultHTMLNamespace=Z.hasDefaultHTMLNamespace,R.isHTMLMimeType=Z.isHTMLMimeType,R.isValidMimeType=Z.isValidMimeType,R.MIME_TYPE=Z.MIME_TYPE,R.NAMESPACE=Z.NAMESPACE;var x=ge(918);R.DOMException=x.DOMException,R.DOMExceptionName=x.DOMExceptionName,R.ExceptionCode=x.ExceptionCode,R.ParseError=x.ParseError;var Te=ge(553);R.Attr=Te.Attr,R.CDATASection=Te.CDATASection,R.CharacterData=Te.CharacterData,R.Comment=Te.Comment,R.Document=Te.Document,R.DocumentFragment=Te.DocumentFragment,R.DocumentType=Te.DocumentType,R.DOMImplementation=Te.DOMImplementation,R.Element=Te.Element,R.Entity=Te.Entity,R.EntityReference=Te.EntityReference,R.LiveNodeList=Te.LiveNodeList,R.NamedNodeMap=Te.NamedNodeMap,R.Node=Te.Node,R.NodeList=Te.NodeList,R.Notation=Te.Notation,R.ProcessingInstruction=Te.ProcessingInstruction,R.Text=Te.Text,R.XMLSerializer=Te.XMLSerializer;var ne=ge(985);R.DOMParser=ne.DOMParser,R.normalizeLineEndings=ne.normalizeLineEndings,R.onErrorStopParsing=ne.onErrorStopParsing,R.onWarningStopParsing=ne.onWarningStopParsing},918(Oe,R,ge){"use strict";function Z(F,me){F.prototype=Object.create(Error.prototype,{constructor:{value:F},name:{value:F.name,enumerable:!0,writable:me}})}var x=ge(981).freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),Te=Object.keys(x);function ne(F){return typeof F=="number"&&F>=1&&F<=25}function ee(F,me){var B;ne(F)?(this.name=Te[F],this.message=me||""):(this.message=F,this.name=typeof(B=me)=="string"&&B.substring(B.length-x.Error.length)===x.Error?me:x.Error),Error.captureStackTrace&&Error.captureStackTrace(this,ee)}Z(ee,!0),Object.defineProperties(ee.prototype,{code:{enumerable:!0,get:function(){var F=Te.indexOf(this.name);return ne(F)?F:0}}});for(var we={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},ft=Object.entries(we),Me=0;Me<ft.length;Me++)ee[ft[Me][0]]=ft[Me][1];function ie(F,me){this.message=F,this.locator=me,Error.captureStackTrace&&Error.captureStackTrace(this,ie)}Z(ie),R.DOMException=ee,R.DOMExceptionName=x,R.ExceptionCode=we,R.ParseError=ie},981(Oe,R){"use strict";function ge(ie,F){return F===void 0&&(F=Object),F&&typeof F.getOwnPropertyDescriptors=="function"&&(ie=F.create(null,F.getOwnPropertyDescriptors(ie))),F&&typeof F.freeze=="function"?F.freeze(ie):ie}function Z(ie,F){return Object.prototype.hasOwnProperty.call(ie,F)}var x=ge({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0}),Te=ge({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ne=ge({script:!1,style:!1,textarea:!0,title:!0});function ee(ie){return ie===we.HTML}var we=ge({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),ft=Object.keys(we).map(function(ie){return we[ie]}),Me=ge({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});R.assign=function(ie,F){if(ie===null||typeof ie!="object")throw new TypeError("target is not an object");for(var me in F)Z(F,me)&&(ie[me]=F[me]);return ie},R.find=function(ie,F,me){if(me===void 0&&(me=Array.prototype),ie&&typeof me.find=="function")return me.find.call(ie,F);for(var B=0;B<ie.length;B++)if(Z(ie,B)){var Xe=ie[B];if(F.call(void 0,Xe,B,ie))return Xe}},R.freeze=ge,R.HTML_BOOLEAN_ATTRIBUTES=x,R.HTML_RAW_TEXT_ELEMENTS=ne,R.HTML_VOID_ELEMENTS=Te,R.hasDefaultHTMLNamespace=function(ie){return ee(ie)||ie===we.XML_XHTML_APPLICATION},R.hasOwn=Z,R.isHTMLBooleanAttribute=function(ie){return Z(x,ie.toLowerCase())},R.isHTMLRawTextElement=function(ie){var F=ie.toLowerCase();return Z(ne,F)&&!ne[F]},R.isHTMLEscapableRawTextElement=function(ie){var F=ie.toLowerCase();return Z(ne,F)&&ne[F]},R.isHTMLMimeType=ee,R.isHTMLVoidElement=function(ie){return Z(Te,ie.toLowerCase())},R.isValidMimeType=function(ie){return ft.indexOf(ie)>-1},R.MIME_TYPE=we,R.NAMESPACE=Me},985(Oe,R,ge){"use strict";var Z=ge(981),x=ge(553),Te=ge(918),ne=ge(334),ee=ge(309),we=x.DOMImplementation,ft=Z.hasDefaultHTMLNamespace,Me=Z.isHTMLMimeType,ie=Z.isValidMimeType,F=Z.MIME_TYPE,me=Z.NAMESPACE,B=Te.ParseError,Xe=ee.XMLReader;function Ie(G){return G.replace(/\r[\n\u0085]/g,`
4
+ `).replace(/[\r\u0085\u2028\u2029]/g,`
5
+ `)}function ke(G){if((G=G||{}).locator===void 0&&(G.locator=!0),this.assign=G.assign||Z.assign,this.domHandler=G.domHandler||Re,this.onError=G.onError||G.errorHandler,G.errorHandler&&typeof G.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");G.errorHandler&&G.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=G.normalizeLineEndings||Ie,this.locator=!!G.locator,this.xmlns=this.assign(Object.create(null),G.xmlns)}function Re(G){var z=G||{};this.mimeType=z.mimeType||F.XML_APPLICATION,this.defaultNamespace=z.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=z.onError}function Pe(G,z){z.lineNumber=G.lineNumber,z.columnNumber=G.columnNumber}function Se(G,z,w){return typeof G=="string"?G.substr(z,w):G.length>=z+w||z?new java.lang.String(G,z,w)+"":G}function St(G,z){G.currentElement?G.currentElement.appendChild(z):G.doc.appendChild(z)}ke.prototype.parseFromString=function(G,z){if(!ie(z))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+z+'" is not valid.');var w=this.assign(Object.create(null),this.xmlns),O=ne.XML_ENTITIES,V=w[""]||null;ft(z)?(O=ne.HTML_ENTITIES,V=me.HTML):z===F.XML_SVG_IMAGE&&(V=me.SVG),w[""]=V,w.xml=w.xml||me.XML;var D=new this.domHandler({mimeType:z,defaultNamespace:V,onError:this.onError}),oe=this.locator?{}:void 0;this.locator&&D.setDocumentLocator(oe);var H=new Xe;return H.errorHandler=D,H.domBuilder=D,!Z.isHTMLMimeType(z)&&typeof G!="string"&&H.errorHandler.fatalError("source is not a string"),H.parse(this.normalizeLineEndings(String(G)),w,O),D.doc.documentElement||H.errorHandler.fatalError("missing root element"),D.doc},Re.prototype={startDocument:function(){var G=new we;this.doc=Me(this.mimeType)?G.createHTMLDocument(!1):G.createDocument(this.defaultNamespace,"")},startElement:function(G,z,w,O){var V=this.doc,D=V.createElementNS(G,w||z),oe=O.length;St(this,D),this.currentElement=D,this.locator&&Pe(this.locator,D);for(var H=0;H<oe;H++){G=O.getURI(H);var le=O.getValue(H),re=(w=O.getQName(H),V.createAttributeNS(G,w));this.locator&&Pe(O.getLocator(H),re),re.value=re.nodeValue=le,D.setAttributeNode(re)}},endElement:function(G,z,w){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(G,z){},endPrefixMapping:function(G){},processingInstruction:function(G,z){var w=this.doc.createProcessingInstruction(G,z);this.locator&&Pe(this.locator,w),St(this,w)},ignorableWhitespace:function(G,z,w){},characters:function(G,z,w){if(G=Se.apply(this,arguments)){if(this.cdata)var O=this.doc.createCDATASection(G);else O=this.doc.createTextNode(G);this.currentElement?this.currentElement.appendChild(O):/^\s*$/.test(G)&&this.doc.appendChild(O),this.locator&&Pe(this.locator,O)}},skippedEntity:function(G){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(G){G&&(G.lineNumber=0),this.locator=G},comment:function(G,z,w){G=Se.apply(this,arguments);var O=this.doc.createComment(G);this.locator&&Pe(this.locator,O),St(this,O)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(G,z,w,O){var V=this.doc.implementation;if(V&&V.createDocumentType){var D=V.createDocumentType(G,z,w,O);this.locator&&Pe(this.locator,D),St(this,D),this.doc.doctype=D}},reportError:function(G,z){if(typeof this.onError=="function")try{this.onError(G,z,this)}catch(w){throw new B("Reporting "+G+' "'+z+'" caused '+w,this.locator)}else console.error("[xmldom "+G+"] "+z,(function(w){if(w)return`
6
+ @#[line:`+w.lineNumber+",col:"+w.columnNumber+"]"})(this.locator))},warning:function(G){this.reportError("warning",G)},error:function(G){this.reportError("error",G)},fatalError:function(G){throw this.reportError("fatalError",G),new B(G,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(G){Re.prototype[G]=function(){return null}}),R.__DOMHandler=Re,R.DOMParser=ke,R.normalizeLineEndings=Ie,R.onErrorStopParsing=function(G){if(G==="error")throw"onErrorStopParsing"},R.onWarningStopParsing=function(){throw"onWarningStopParsing"}},999(Oe,R,ge){(function(){"use strict";var Z=this;function x(a){return typeof a=="string"}function Te(a,u,f){return a.call.apply(a.bind,arguments)}function ne(a,u,f){if(!a)throw Error();if(2<arguments.length){var N=Array.prototype.slice.call(arguments,2);return function(){var A=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(A,N),a.apply(u,A)}}return function(){return a.apply(u,arguments)}}function ee(a,u,f){return(ee=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?Te:ne).apply(null,arguments)}function we(a){var u=Rt;function f(){}f.prototype=u.prototype,a.G=u.prototype,a.prototype=new f,a.prototype.constructor=a,a.F=function(N,A,y){for(var se=Array(arguments.length-2),$=2;$<arguments.length;$++)se[$-2]=arguments[$];return u.prototype[A].apply(N,se)}}var ft=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function Me(a,u){return a.indexOf(u)!=-1}function ie(a,u){return a<u?-1:a>u?1:0}var F,me=Array.prototype.indexOf?function(a,u,f){return Array.prototype.indexOf.call(a,u,f)}:function(a,u,f){if(f=f==null?0:0>f?Math.max(0,a.length+f):f,x(a))return x(u)&&u.length==1?a.indexOf(u,f):-1;for(;f<a.length;f++)if(f in a&&a[f]===u)return f;return-1},B=Array.prototype.forEach?function(a,u,f){Array.prototype.forEach.call(a,u,f)}:function(a,u,f){for(var N=a.length,A=x(a)?a.split(""):a,y=0;y<N;y++)y in A&&u.call(f,A[y],y,a)},Xe=Array.prototype.filter?function(a,u,f){return Array.prototype.filter.call(a,u,f)}:function(a,u,f){for(var N=a.length,A=[],y=0,se=x(a)?a.split(""):a,$=0;$<N;$++)if($ in se){var We=se[$];u.call(f,We,$,a)&&(A[y++]=We)}return A},Ie=Array.prototype.reduce?function(a,u,f,N){return N&&(u=ee(u,N)),Array.prototype.reduce.call(a,u,f)}:function(a,u,f,N){var A=f;return B(a,function(y,se){A=u.call(N,A,y,se,a)}),A},ke=Array.prototype.some?function(a,u,f){return Array.prototype.some.call(a,u,f)}:function(a,u,f){for(var N=a.length,A=x(a)?a.split(""):a,y=0;y<N;y++)if(y in A&&u.call(f,A[y],y,a))return!0;return!1};e:{var Re=Z.navigator;if(Re){var Pe=Re.userAgent;if(Pe){F=Pe;break e}}F=""}var Se,St,G=Me(F,"Opera")||Me(F,"OPR"),z=Me(F,"Trident")||Me(F,"MSIE"),w=Me(F,"Edge"),O=Me(F,"Gecko")&&!(Me(F.toLowerCase(),"webkit")&&!Me(F,"Edge"))&&!(Me(F,"Trident")||Me(F,"MSIE"))&&!Me(F,"Edge"),V=Me(F.toLowerCase(),"webkit")&&!Me(F,"Edge");function D(){var a=Z.document;return a?a.documentMode:void 0}e:{var oe="",H=(St=F,O?/rv\:([^\);]+)(\)|;)/.exec(St):w?/Edge\/([\d\.]+)/.exec(St):z?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(St):V?/WebKit\/(\S+)/.exec(St):G?/(?:Version)[ \/]?(\S+)/.exec(St):void 0);if(H&&(oe=H?H[1]:""),z){var le=D();if(le!=null&&le>parseFloat(oe)){Se=String(le);break e}}Se=oe}var re={};function _(a){if(!re[a]){for(var u=0,f=ft(String(Se)).split("."),N=ft(String(a)).split("."),A=Math.max(f.length,N.length),y=0;u==0&&y<A;y++){var se=f[y]||"",$=N[y]||"",We=/(\d*)(\D*)/g,gt=/(\d*)(\D*)/g;do{var Ct=We.exec(se)||["","",""],kt=gt.exec($)||["","",""];if(Ct[0].length==0&&kt[0].length==0)break;u=ie(Ct[1].length==0?0:parseInt(Ct[1],10),kt[1].length==0?0:parseInt(kt[1],10))||ie(Ct[2].length==0,kt[2].length==0)||ie(Ct[2],kt[2])}while(u==0)}re[a]=0<=u}}var te=Z.document,K=te&&z?D()||(te.compatMode=="CSS1Compat"?parseInt(Se,10):5):void 0,ve=z&&!(9<=Number(K)),ue=z&&!(8<=Number(K));function L(a,u,f,N){this.a=a,this.nodeName=f,this.nodeValue=N,this.nodeType=2,this.parentNode=this.ownerElement=u}function ce(a,u){var f=ue&&u.nodeName=="href"?a.getAttribute(u.nodeName,2):u.nodeValue;return new L(u,a,u.nodeName,f)}function Be(a){var u=null;if((f=a.nodeType)==1&&(u=(u=(u=a.textContent)==null||u==null?a.innerText:u)==null||u==null?"":u),typeof u!="string")if(ve&&a.nodeName.toLowerCase()=="title"&&f==1)u=a.text;else if(f==9||f==1){a=f==9?a.documentElement:a.firstChild;var f=0,N=[];for(u="";a;){do a.nodeType!=1&&(u+=a.nodeValue),ve&&a.nodeName.toLowerCase()=="title"&&(u+=a.text),N[f++]=a;while(a=a.firstChild);for(;f&&!(a=N[--f].nextSibling););}}else u=a.nodeValue;return""+u}function De(a,u,f){if(u===null)return!0;try{if(!a.getAttribute)return!1}catch{return!1}return ue&&u=="class"&&(u="className"),f==null?!!a.getAttribute(u):a.getAttribute(u,2)==f}function Ce(a,u,f,N,A){return(ve?ct:lt).call(null,a,u,x(f)?f:null,x(N)?N:null,A||new q)}function ct(a,u,f,N,A){if(a instanceof M||a.b==8||f&&a.b===null){var y=u.all;if(!y||(a=Ge(a))!="*"&&!(y=u.getElementsByTagName(a)))return A;if(f){for(var se=[],$=0;u=y[$++];)De(u,f,N)&&se.push(u);y=se}for($=0;u=y[$++];)a=="*"&&u.tagName=="!"||ye(A,u);return A}return Ae(a,u,f,N,A),A}function lt(a,u,f,N,A){return u.getElementsByName&&N&&f=="name"&&!z?(u=u.getElementsByName(N),B(u,function(y){a.a(y)&&ye(A,y)})):u.getElementsByClassName&&N&&f=="class"?(u=u.getElementsByClassName(N),B(u,function(y){y.className==N&&a.a(y)&&ye(A,y)})):a instanceof _e?Ae(a,u,f,N,A):u.getElementsByTagName&&(u=u.getElementsByTagName(a.f()),B(u,function(y){De(y,f,N)&&ye(A,y)})),A}function he(a,u,f,N,A){var y;if((a instanceof M||a.b==8||f&&a.b===null)&&(y=u.childNodes)){var se=Ge(a);return(se=="*"||(y=Xe(y,function($){return $.tagName&&$.tagName.toLowerCase()==se}),y))&&(f&&(y=Xe(y,function($){return De($,f,N)})),B(y,function($){se=="*"&&($.tagName=="!"||se=="*"&&$.nodeType!=1)||ye(A,$)})),A}return ot(a,u,f,N,A)}function ot(a,u,f,N,A){for(u=u.firstChild;u;u=u.nextSibling)De(u,f,N)&&a.a(u)&&ye(A,u);return A}function Ae(a,u,f,N,A){for(u=u.firstChild;u;u=u.nextSibling)De(u,f,N)&&a.a(u)&&ye(A,u),Ae(a,u,f,N,A)}function Ge(a){if(a instanceof _e){if(a.b==8)return"!";if(a.b===null)return"*"}return a.f()}function He(a,u){if(!a||!u)return!1;if(a.contains&&u.nodeType==1)return a==u||a.contains(u);if(a.compareDocumentPosition!==void 0)return a==u||!!(16&a.compareDocumentPosition(u));for(;u&&a!=u;)u=u.parentNode;return u==a}function k(a,u){if(a==u)return 0;if(a.compareDocumentPosition)return 2&a.compareDocumentPosition(u)?1:-1;if(z&&!(9<=Number(K))){if(a.nodeType==9)return-1;if(u.nodeType==9)return 1}if("sourceIndex"in a||a.parentNode&&"sourceIndex"in a.parentNode){var f=a.nodeType==1,N=u.nodeType==1;if(f&&N)return a.sourceIndex-u.sourceIndex;var A=a.parentNode,y=u.parentNode;return A==y?j(a,u):!f&&He(A,u)?-1*xe(a,u):!N&&He(y,a)?xe(u,a):(f?a.sourceIndex:A.sourceIndex)-(N?u.sourceIndex:y.sourceIndex)}return(f=(N=a.nodeType==9?a:a.ownerDocument||a.document).createRange()).selectNode(a),f.collapse(!0),(N=N.createRange()).selectNode(u),N.collapse(!0),f.compareBoundaryPoints(Z.Range.START_TO_END,N)}function xe(a,u){var f=a.parentNode;if(f==u)return-1;for(var N=u;N.parentNode!=f;)N=N.parentNode;return j(N,a)}function j(a,u){for(var f=u;f=f.previousSibling;)if(f==a)return-1;return 1}function q(){this.b=this.a=null,this.l=0}function ut(a){this.node=a,this.a=this.b=null}function Ve(a,u){if(!a.a)return u;if(!u.a)return a;for(var f=a.a,N=u.a,A=null,y=null,se=0;f&&N;){y=f.node;var $=N.node;y==$||y instanceof L&&$ instanceof L&&y.a==$.a?(y=f,f=f.a,N=N.a):0<k(f.node,N.node)?(y=N,N=N.a):(y=f,f=f.a),(y.b=A)?A.a=y:a.a=y,A=y,se++}for(y=f||N;y;)y.b=A,A=A.a=y,se++,y=y.a;return a.b=A,a.l=se,a}function et(a,u){var f=new ut(u);f.a=a.a,a.b?a.a.b=f:a.a=a.b=f,a.a=f,a.l++}function ye(a,u){var f=new ut(u);f.b=a.b,a.a?a.b.a=f:a.a=a.b=f,a.b=f,a.l++}function je(a){return(a=a.a)?a.node:null}function ht(a){return(a=je(a))?Be(a):""}function at(a,u){return new Tn(a,!!u)}function Tn(a,u){this.f=a,this.b=(this.c=u)?a.b:a.a,this.a=null}function Q(a){var u=a.b;if(u==null)return null;var f=a.a=u;return a.b=a.c?u.b:u.a,f.node}function Rt(a){this.i=a,this.b=this.g=!1,this.f=null}function de(a){return`
7
+ `+a.toString().split(`
8
+ `).join(`
9
+ `)}function Lt(a,u){a.g=u}function Bt(a,u){a.b=u}function Ue(a,u){var f=a.a(u);return f instanceof q?+ht(f):+f}function tt(a,u){var f=a.a(u);return f instanceof q?ht(f):""+f}function wt(a,u){var f=a.a(u);return f instanceof q?!!f.l:!!f}function Yt(a,u,f){Rt.call(this,a.i),this.c=a,this.h=u,this.o=f,this.g=u.g||f.g,this.b=u.b||f.b,this.c==Dn&&(f.b||f.g||f.i==4||f.i==0||!u.f?u.b||u.g||u.i==4||u.i==0||!f.f||(this.f={name:f.f.name,s:u}):this.f={name:u.f.name,s:f})}function Gt(a,u,f,N,A){var y;if(u=u.a(N),f=f.a(N),u instanceof q&&f instanceof q){for(N=Q(u=at(u));N;N=Q(u))for(y=Q(A=at(f));y;y=Q(A))if(a(Be(N),Be(y)))return!0;return!1}if(u instanceof q||f instanceof q){u instanceof q?(A=u,N=f):(A=f,N=u);for(var se=typeof N,$=Q(y=at(A));$;$=Q(y)){switch(se){case"number":$=+Be($);break;case"boolean":$=!!Be($);break;case"string":$=Be($);break;default:throw Error("Illegal primitive type for comparison.")}if(A==u&&a($,N)||A==f&&a(N,$))return!0}return!1}return A?typeof u=="boolean"||typeof f=="boolean"?a(!!u,!!f):typeof u=="number"||typeof f=="number"?a(+u,+f):a(u,f):a(+u,+f)}function l(a,u,f,N){this.a=a,this.w=u,this.i=f,this.m=N}!O&&!z||z&&9<=Number(K)||O&&_("1.9.1"),z&&_("9"),we(Yt),Yt.prototype.a=function(a){return this.c.m(this.h,this.o,a)},Yt.prototype.toString=function(){return"Binary Expression: "+this.c+de(this.h)+de(this.o)},l.prototype.toString=function(){return this.a};var on={};function d(a,u,f,N){if(on.hasOwnProperty(a))throw Error("Binary operator already created: "+a);return a=new l(a,u,f,N),on[a.toString()]=a}d("div",6,1,function(a,u,f){return Ue(a,f)/Ue(u,f)}),d("mod",6,1,function(a,u,f){return Ue(a,f)%Ue(u,f)}),d("*",6,1,function(a,u,f){return Ue(a,f)*Ue(u,f)}),d("+",5,1,function(a,u,f){return Ue(a,f)+Ue(u,f)}),d("-",5,1,function(a,u,f){return Ue(a,f)-Ue(u,f)}),d("<",4,2,function(a,u,f){return Gt(function(N,A){return N<A},a,u,f)}),d(">",4,2,function(a,u,f){return Gt(function(N,A){return N>A},a,u,f)}),d("<=",4,2,function(a,u,f){return Gt(function(N,A){return N<=A},a,u,f)}),d(">=",4,2,function(a,u,f){return Gt(function(N,A){return N>=A},a,u,f)});var Dn=d("=",3,2,function(a,u,f){return Gt(function(N,A){return N==A},a,u,f,!0)});function be(a,u,f){this.a=a,this.b=u||1,this.f=f||1}function Vt(a,u){if(u.a.length&&a.i!=4)throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");Rt.call(this,a.i),this.c=a,this.h=u,this.g=a.g,this.b=a.b}function Ye(a,u){if(u.length<a.A)throw Error("Function "+a.j+" expects at least"+a.A+" arguments, "+u.length+" given");if(a.v!==null&&u.length>a.v)throw Error("Function "+a.j+" expects at most "+a.v+" arguments, "+u.length+" given");a.B&&B(u,function(f,N){if(f.i!=4)throw Error("Argument "+N+" to function "+a.j+" is not of type Nodeset: "+f)}),Rt.call(this,a.i),this.h=a,this.c=u,Lt(this,a.g||ke(u,function(f){return f.g})),Bt(this,a.D&&!u.length||a.C&&!!u.length||ke(u,function(f){return f.b}))}function Jn(a,u,f,N,A,y,se,$,We){this.j=a,this.i=u,this.g=f,this.D=N,this.C=A,this.m=y,this.A=se,this.v=$!==void 0?$:se,this.B=!!We}d("!=",3,2,function(a,u,f){return Gt(function(N,A){return N!=A},a,u,f,!0)}),d("and",2,2,function(a,u,f){return wt(a,f)&&wt(u,f)}),d("or",1,2,function(a,u,f){return wt(a,f)||wt(u,f)}),we(Vt),Vt.prototype.a=function(a){return a=this.c.a(a),Qe(this.h,a)},Vt.prototype.toString=function(){return"Filter:"+de(this.c)+de(this.h)},we(Ye),Ye.prototype.a=function(a){return this.h.m.apply(null,(function(u){return Array.prototype.concat.apply(Array.prototype,arguments)})(a,this.c))},Ye.prototype.toString=function(){var a="Function: "+this.h;if(this.c.length){var u=Ie(this.c,function(f,N){return f+de(N)},"Arguments:");a=a+de(u)}return a},Jn.prototype.toString=function(){return this.j};var _t={};function $e(a,u,f,N,A,y,se,$){if(_t.hasOwnProperty(a))throw Error("Function already created: "+a+".");_t[a]=new Jn(a,u,f,N,!1,A,y,se,$)}function _e(a,u){switch(this.h=a,this.c=u!==void 0?u:null,this.b=null,a){case"comment":this.b=8;break;case"text":this.b=3;break;case"processing-instruction":this.b=7;break;case"node":break;default:throw Error("Unexpected argument")}}function In(a){return a=="comment"||a=="text"||a=="processing-instruction"||a=="node"}function qn(a){this.b=a,this.a=0}$e("boolean",2,!1,!1,function(a,u){return wt(u,a)},1),$e("ceiling",1,!1,!1,function(a,u){return Math.ceil(Ue(u,a))},1),$e("concat",3,!1,!1,function(a,u){return Ie((function(f,N,A){return 2>=arguments.length?Array.prototype.slice.call(f,N):Array.prototype.slice.call(f,N,A)})(arguments,1),function(f,N){return f+tt(N,a)},"")},2,null),$e("contains",2,!1,!1,function(a,u,f){return Me(tt(u,a),tt(f,a))},2),$e("count",1,!1,!1,function(a,u){return u.a(a).l},1,1,!0),$e("false",2,!1,!1,function(){return!1},0),$e("floor",1,!1,!1,function(a,u){return Math.floor(Ue(u,a))},1),$e("id",4,!1,!1,function(a,u){function f($){if(ve){var We=N.all[$];if(We){if(We.nodeType&&$==We.id)return We;if(We.length)return(function(gt,Ct){var kt;e:{kt=gt.length;for(var Vr=x(gt)?gt.split(""):gt,Mt=0;Mt<kt;Mt++)if(Mt in Vr&&Ct.call(void 0,Vr[Mt],Mt,gt)){kt=Mt;break e}kt=-1}return 0>kt?null:x(gt)?gt.charAt(kt):gt[kt]})(We,function(gt){return $==gt.id})}return null}return N.getElementById($)}var N=(A=a.a).nodeType==9?A:A.ownerDocument,A=tt(u,a).split(/\s+/),y=[];B(A,function($){!($=f($))||0<=me(y,$)||y.push($)}),y.sort(k);var se=new q;return B(y,function($){ye(se,$)}),se},1),$e("lang",2,!1,!1,function(){return!1},1),$e("last",1,!0,!1,function(a){if(arguments.length!=1)throw Error("Function last expects ()");return a.f},0),$e("local-name",3,!1,!0,function(a,u){var f=u?je(u.a(a)):a.a;return f?f.localName||f.nodeName.toLowerCase():""},0,1,!0),$e("name",3,!1,!0,function(a,u){var f=u?je(u.a(a)):a.a;return f?f.nodeName.toLowerCase():""},0,1,!0),$e("namespace-uri",3,!0,!1,function(){return""},0,1,!0),$e("normalize-space",3,!1,!0,function(a,u){return(u?tt(u,a):Be(a.a)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},0,1),$e("not",2,!1,!1,function(a,u){return!wt(u,a)},1),$e("number",1,!1,!0,function(a,u){return u?Ue(u,a):+Be(a.a)},0,1),$e("position",1,!0,!1,function(a){return a.b},0),$e("round",1,!1,!1,function(a,u){return Math.round(Ue(u,a))},1),$e("starts-with",2,!1,!1,function(a,u,f){return u=tt(u,a),a=tt(f,a),u.lastIndexOf(a,0)==0},2),$e("string",3,!1,!0,function(a,u){return u?tt(u,a):Be(a.a)},0,1),$e("string-length",1,!1,!0,function(a,u){return(u?tt(u,a):Be(a.a)).length},0,1),$e("substring",3,!1,!1,function(a,u,f,N){if(f=Ue(f,a),isNaN(f)||f==1/0||f==-1/0||(N=N?Ue(N,a):1/0,isNaN(N)||N===-1/0))return"";f=Math.round(f)-1;var A=Math.max(f,0);return a=tt(u,a),N==1/0?a.substring(A):a.substring(A,f+Math.round(N))},2,3),$e("substring-after",3,!1,!1,function(a,u,f){return u=tt(u,a),a=tt(f,a),(f=u.indexOf(a))==-1?"":u.substring(f+a.length)},2),$e("substring-before",3,!1,!1,function(a,u,f){return u=tt(u,a),a=tt(f,a),(a=u.indexOf(a))==-1?"":u.substring(0,a)},2),$e("sum",1,!1,!1,function(a,u){for(var f=at(u.a(a)),N=0,A=Q(f);A;A=Q(f))N+=+Be(A);return N},1,1,!0),$e("translate",3,!1,!1,function(a,u,f,N){u=tt(u,a),f=tt(f,a);var A=tt(N,a);for(a={},N=0;N<f.length;N++){var y=f.charAt(N);y in a||(a[y]=A.charAt(N))}for(f="",N=0;N<u.length;N++)f+=(y=u.charAt(N))in a?a[y]:y;return f},3),$e("true",2,!1,!1,function(){return!0},0),_e.prototype.a=function(a){return this.b===null||this.b==a.nodeType},_e.prototype.f=function(){return this.h},_e.prototype.toString=function(){var a="Kind Test: "+this.h;return this.c===null||(a+=de(this.c)),a};var Pt=/\$?(?:(?![0-9-\.])(?:\*|[\w-\.]+):)?(?![0-9-\.])(?:\*|[\w-\.]+)|\/\/|\.\.|::|\d+(?:\.\d*)?|\.\d+|"[^"]*"|'[^']*'|[!<>]=|\s+|./g,I=/^\s/;function h(a,u){return a.b[a.a+(u||0)]}function m(a){return a.b[a.a++]}function S(a){return a.b.length<=a.a}function b(a){Rt.call(this,3),this.c=a.substring(1,a.length-1)}function M(a,u){var f;this.j=a.toLowerCase(),f=this.j=="*"?"*":"http://www.w3.org/1999/xhtml",this.c=u?u.toLowerCase():f}function X(a,u){if(Rt.call(this,a.i),this.h=a,this.c=u,this.g=a.g,this.b=a.b,this.c.length==1){var f=this.c[0];f.u||f.c!=An||(f=f.o).f()!="*"&&(this.f={name:f.f(),s:null})}}function P(){Rt.call(this,4)}function Le(){Rt.call(this,4)}function Y(a){return a=="/"||a=="//"}function pt(a){Rt.call(this,4),this.c=a,Lt(this,ke(this.c,function(u){return u.g})),Bt(this,ke(this.c,function(u){return u.b}))}function mt(a,u){this.a=a,this.b=!!u}function Qe(a,u,f){for(f=f||0;f<a.a.length;f++)for(var N,A=a.a[f],y=at(u),se=u.l,$=0;N=Q(y);$++){var We=a.b?se-$:$+1;if(typeof(N=A.a(new be(N,We,se)))=="number")We=We==N;else if(typeof N=="string"||typeof N=="boolean")We=!!N;else{if(!(N instanceof q))throw Error("Predicate.evaluate returned an unexpected type.");We=0<N.l}if(!We){if(N=(We=y).f,!(Ct=We.a))throw Error("Next must be called at least once before remove.");var gt=Ct.b,Ct=Ct.a;gt?gt.a=Ct:N.a=Ct,Ct?Ct.b=gt:N.b=gt,N.l--,We.a=null}}return u}function xt(a,u,f,N){Rt.call(this,4),this.c=a,this.o=u,this.h=f||new mt([]),this.u=!!N,u=0<(u=this.h).a.length?u.a[0].f:null,a.b&&u&&(a=u.name,a=ve?a.toLowerCase():a,this.f={name:a,s:u.s});e:{for(a=this.h,u=0;u<a.a.length;u++)if((f=a.a[u]).g||f.i==1||f.i==0){a=!0;break e}a=!1}this.g=a}function yt(a,u,f,N){this.j=a,this.f=u,this.a=f,this.b=N}we(b),b.prototype.a=function(){return this.c},b.prototype.toString=function(){return"Literal: "+this.c},M.prototype.a=function(a){var u=a.nodeType;return(u==1||u==2)&&(u=a.localName!==void 0?a.localName:a.nodeName,(this.j=="*"||this.j==u.toLowerCase())&&(this.c=="*"||this.c==(a.namespaceURI?a.namespaceURI.toLowerCase():"http://www.w3.org/1999/xhtml")))},M.prototype.f=function(){return this.j},M.prototype.toString=function(){return"Name Test: "+(this.c=="http://www.w3.org/1999/xhtml"?"":this.c+":")+this.j},we(X),we(P),P.prototype.a=function(a){var u=new q;return(a=a.a).nodeType==9?ye(u,a):ye(u,a.ownerDocument),u},P.prototype.toString=function(){return"Root Helper Expression"},we(Le),Le.prototype.a=function(a){var u=new q;return ye(u,a.a),u},Le.prototype.toString=function(){return"Context Helper Expression"},X.prototype.a=function(a){var u=this.h.a(a);if(!(u instanceof q))throw Error("Filter expression must evaluate to nodeset.");for(var f=0,N=(a=this.c).length;f<N&&u.l;f++){var A,y=a[f],se=at(u,y.c.a);if(y.g||y.c!=Wt)if(y.g||y.c!=zt)for(A=Q(se),u=y.a(new be(A));(A=Q(se))!=null;)u=Ve(u,A=y.a(new be(A)));else A=Q(se),u=y.a(new be(A));else{for(A=Q(se);(u=Q(se))&&(!A.contains||A.contains(u))&&8&u.compareDocumentPosition(A);A=u);u=y.a(new be(A))}}return u},X.prototype.toString=function(){var a="Path Expression:"+de(this.h);if(this.c.length){var u=Ie(this.c,function(f,N){return f+de(N)},"Steps:");a+=de(u)}return a},we(pt),pt.prototype.a=function(a){var u=new q;return B(this.c,function(f){if(!((f=f.a(a))instanceof q))throw Error("Path expression must evaluate to NodeSet.");u=Ve(u,f)}),u},pt.prototype.toString=function(){return Ie(this.c,function(a,u){return a+de(u)},"Union Expression:")},mt.prototype.toString=function(){return Ie(this.a,function(a,u){return a+de(u)},"Predicates:")},we(xt),xt.prototype.a=function(a){var u=a.a,f=null,N=null,A=null,y=0;if((f=this.f)&&(N=f.name,A=f.s?tt(f.s,a):null,y=1),this.u)if(this.g||this.c!=dt)if(u=Q(a=at(new xt(bn,new _e("node")).a(a))))for(f=this.m(u,N,A,y);(u=Q(a))!=null;)f=Ve(f,this.m(u,N,A,y));else f=new q;else f=Ce(this.o,u,N,A),f=Qe(this.h,f,y);else f=this.m(a.a,N,A,y);return f},xt.prototype.m=function(a,u,f,N){return a=this.c.f(this.o,a,u,f),Qe(this.h,a,N)},xt.prototype.toString=function(){var a="Step:"+de("Operator: "+(this.u?"//":"/"));if(this.c.j&&(a+=de("Axis: "+this.c)),a+=de(this.o),this.h.a.length){var u=Ie(this.h.a,function(f,N){return f+de(N)},"Predicates:");a+=de(u)}return a},yt.prototype.toString=function(){return this.j};var sn={};function Tt(a,u,f,N){if(sn.hasOwnProperty(a))throw Error("Axis already created: "+a);return u=new yt(a,u,f,!!N),sn[a]=u}Tt("ancestor",function(a,u){for(var f=new q,N=u;N=N.parentNode;)a.a(N)&&et(f,N);return f},!0),Tt("ancestor-or-self",function(a,u){var f=new q,N=u;do a.a(N)&&et(f,N);while(N=N.parentNode);return f},!0);var An=Tt("attribute",function(a,u){var f=new q;if((y=a.f())=="style"&&ve&&u.style)return ye(f,new L(u.style,u,"style",u.style.cssText)),f;var N=u.attributes;if(N)if(a instanceof _e&&a.b===null||y=="*")for(var A,y=0;A=N[y];y++)ve?A.nodeValue&&ye(f,ce(u,A)):ye(f,A);else(A=N.getNamedItem(y))&&(ve?A.nodeValue&&ye(f,ce(u,A)):ye(f,A));return f},!1),dt=Tt("child",function(a,u,f,N,A){return(ve?he:ot).call(null,a,u,x(f)?f:null,x(N)?N:null,A||new q)},!1,!0);Tt("descendant",Ce,!1,!0);var bn=Tt("descendant-or-self",function(a,u,f,N){var A=new q;return De(u,f,N)&&a.a(u)&&ye(A,u),Ce(a,u,f,N,A)},!1,!0),Wt=Tt("following",function(a,u,f,N){var A=new q;do for(var y=u;y=y.nextSibling;)De(y,f,N)&&a.a(y)&&ye(A,y),A=Ce(a,y,f,N,A);while(u=u.parentNode);return A},!1,!0);Tt("following-sibling",function(a,u){for(var f=new q,N=u;N=N.nextSibling;)a.a(N)&&ye(f,N);return f},!1),Tt("namespace",function(){return new q},!1);var Kt=Tt("parent",function(a,u){var f=new q;if(u.nodeType==9)return f;if(u.nodeType==2)return ye(f,u.ownerElement),f;var N=u.parentNode;return a.a(N)&&ye(f,N),f},!1),zt=Tt("preceding",function(a,u,f,N){var A=new q,y=[];do y.unshift(u);while(u=u.parentNode);for(var se=1,$=y.length;se<$;se++){var We=[];for(u=y[se];u=u.previousSibling;)We.unshift(u);for(var gt=0,Ct=We.length;gt<Ct;gt++)De(u=We[gt],f,N)&&a.a(u)&&ye(A,u),A=Ce(a,u,f,N,A)}return A},!0,!0);Tt("preceding-sibling",function(a,u){for(var f=new q,N=u;N=N.previousSibling;)a.a(N)&&et(f,N);return f},!0);var wn=Tt("self",function(a,u){var f=new q;return a.a(u)&&ye(f,u),f},!1);function en(a){Rt.call(this,1),this.c=a,this.g=a.g,this.b=a.b}function It(a){Rt.call(this,1),this.c=a}function Pn(a,u){this.a=a,this.b=u}function tn(a){for(var u,f=[];;){At(a,"Missing right hand side of binary expression."),u=To(a);var N=m(a.a);if(!N)break;var A=(N=on[N]||null)&&N.w;if(!A){a.a.a--;break}for(;f.length&&A<=f[f.length-1].w;)u=new Yt(f.pop(),f.pop(),u);f.push(u,N)}for(;f.length;)u=new Yt(f.pop(),f.pop(),u);return u}function At(a,u){if(S(a.a))throw Error(u)}function fn(a,u){var f=m(a.a);if(f!=u)throw Error("Bad token, expected: "+u+" got: "+f)}function Ht(a){if((a=m(a.a))!=")")throw Error("Bad token: "+a)}function an(a){if(2>(a=m(a.a)).length)throw Error("Unclosed literal string");return new b(a)}function So(a){var u,f,N=[];if(Y(h(a.a))){if(u=m(a.a),f=h(a.a),u=="/"&&(S(a.a)||f!="."&&f!=".."&&f!="@"&&f!="*"&&!/(?![0-9])[\w]/.test(f)))return new P;f=new P,At(a,"Missing next location step."),u=kr(a,u),N.push(u)}else{e:{switch(f=(u=h(a.a)).charAt(0)){case"$":throw Error("Variable reference not allowed in HTML XPath");case"(":m(a.a),u=tn(a),At(a,'unclosed "("'),fn(a,")");break;case'"':case"'":u=an(a);break;default:if(isNaN(+u)){if(In(u)||!/(?![0-9])[\w]/.test(f)||h(a.a,1)!="("){u=null;break e}for(u=m(a.a),u=_t[u]||null,m(a.a),f=[];h(a.a)!=")"&&(At(a,"Missing function argument list."),f.push(tn(a)),h(a.a)==",");)m(a.a);At(a,"Unclosed function argument list."),Ht(a),u=new Ye(u,f)}else u=new It(+m(a.a))}h(a.a)=="["&&(u=new Vt(u,f=new mt(fr(a))))}if(u){if(!Y(h(a.a)))return u;f=u}else u=kr(a,"/"),f=new Le,N.push(u)}for(;Y(h(a.a));)u=m(a.a),At(a,"Missing next location step."),u=kr(a,u),N.push(u);return new X(f,N)}function kr(a,u){var f,N,A,y;if(u!="/"&&u!="//")throw Error('Step op should be "/" or "//"');if(h(a.a)==".")return N=new xt(wn,new _e("node")),m(a.a),N;if(h(a.a)=="..")return N=new xt(Kt,new _e("node")),m(a.a),N;if(h(a.a)=="@")y=An,m(a.a),At(a,"Missing attribute name");else if(h(a.a,1)=="::"){if(!/(?![0-9])[\w]/.test(h(a.a).charAt(0)))throw Error("Bad token: "+m(a.a));if(f=m(a.a),!(y=sn[f]||null))throw Error("No axis with name: "+f);m(a.a),At(a,"Missing node name")}else y=dt;if(f=h(a.a),!/(?![0-9])[\w\*]/.test(f.charAt(0)))throw Error("Bad token: "+m(a.a));if(h(a.a,1)=="("){if(!In(f))throw Error("Invalid node type: "+f);if(!In(f=m(a.a)))throw Error("Invalid type name: "+f);fn(a,"("),At(a,"Bad nodetype");var se=null;(A=h(a.a).charAt(0))!='"'&&A!="'"||(se=an(a)),At(a,"Bad nodetype"),Ht(a),f=new _e(f,se)}else if((A=(f=m(a.a)).indexOf(":"))==-1)f=new M(f);else{var $;if((se=f.substring(0,A))=="*")$="*";else if(!($=a.b(se)))throw Error("Namespace prefix not declared: "+se);f=new M(f=f.substr(A+1),$)}return A=new mt(fr(a),y.a),N||new xt(y,f,A,u=="//")}function fr(a){for(var u=[];h(a.a)=="[";){m(a.a),At(a,"Missing predicate expression.");var f=tn(a);u.push(f),At(a,"Unclosed predicate expression."),fn(a,"]")}return u}function To(a){if(h(a.a)=="-")return m(a.a),new en(To(a));var u=So(a);if(h(a.a)!="|")a=u;else{for(u=[u];m(a.a)=="|";)At(a,"Missing next union location path."),u.push(So(a));a.a.a--,a=new pt(u)}return a}function pr(a){switch(a.nodeType){case 1:return(function(u,f){var N=Array.prototype.slice.call(arguments,1);return function(){var A=N.slice();return A.push.apply(A,arguments),u.apply(this,A)}})(jt,a);case 9:return pr(a.documentElement);case 11:case 10:case 6:case 12:return Br;default:return a.parentNode?pr(a.parentNode):Br}}function Br(){return null}function jt(a,u){if(a.prefix==u)return a.namespaceURI||"http://www.w3.org/1999/xhtml";var f=a.getAttributeNode("xmlns:"+u);return f&&f.specified?f.value||null:a.parentNode&&a.parentNode.nodeType!=9?jt(a.parentNode,u):null}function mr(a,u){if(!a.length)throw Error("Empty XPath expression.");var f=(function(A){A=A.match(Pt);for(var y=0;y<A.length;y++)I.test(A[y])&&A.splice(y,1);return new qn(A)})(a);if(S(f))throw Error("Invalid XPath expression.");u?(function(A){var y=typeof A;if(y=="object"){if(!A)return"null";if(A instanceof Array)return"array";if(A instanceof Object)return y;var se=Object.prototype.toString.call(A);if(se=="[object Window]")return"object";if(se=="[object Array]"||typeof A.length=="number"&&A.splice!==void 0&&A.propertyIsEnumerable!==void 0&&!A.propertyIsEnumerable("splice"))return"array";if(se=="[object Function]"||A.call!==void 0&&A.propertyIsEnumerable!==void 0&&!A.propertyIsEnumerable("call"))return"function"}else if(y=="function"&&A.call===void 0)return"object";return y})(u)=="function"||(u=ee(u.lookupNamespaceURI,u)):u=function(){return null};var N=tn(new Pn(f,u));if(!S(f))throw Error("Bad token: "+m(f));this.evaluate=function(A,y){return new $t(N.a(new be(A)),y)}}function $t(a,u){if(u==0)if(a instanceof q)u=4;else if(typeof a=="string")u=2;else if(typeof a=="number")u=1;else{if(typeof a!="boolean")throw Error("Unexpected evaluation result.");u=3}if(u!=2&&u!=1&&u!=3&&!(a instanceof q))throw Error("value could not be converted to the specified type");var f;switch(this.resultType=u,u){case 2:this.stringValue=a instanceof q?ht(a):""+a;break;case 1:this.numberValue=a instanceof q?+ht(a):+a;break;case 3:this.booleanValue=a instanceof q?0<a.l:!!a;break;case 4:case 5:case 6:case 7:var N=at(a);f=[];for(var A=Q(N);A;A=Q(N))f.push(A instanceof L?A.a:A);this.snapshotLength=a.l,this.invalidIteratorState=!1;break;case 8:case 9:N=je(a),this.singleNodeValue=N instanceof L?N.a:N;break;default:throw Error("Unknown XPathResult type.")}var y=0;this.iterateNext=function(){if(u!=4&&u!=5)throw Error("iterateNext called with wrong result type");return y>=f.length?null:f[y++]},this.snapshotItem=function(se){if(u!=6&&u!=7)throw Error("snapshotItem called with wrong result type");return se>=f.length||0>se?null:f[se]}}function Qt(a){this.lookupNamespaceURI=pr(a)}function Gr(a,u){var f=a||Z,N=f.Document&&f.Document.prototype||f.document;N.evaluate&&!u||(f.XPathResult=$t,N.evaluate=function(A,y,se,$){return new mr(A,se).evaluate(y,$)},N.createExpression=function(A,y){return new mr(A,y)},N.createNSResolver=function(A){return new Qt(A)})}we(en),en.prototype.a=function(a){return-Ue(this.c,a)},en.prototype.toString=function(){return"Unary Expression: -"+de(this.c)},we(It),It.prototype.a=function(){return this.c},It.prototype.toString=function(){return"Number: "+this.c},$t.ANY_TYPE=0,$t.NUMBER_TYPE=1,$t.STRING_TYPE=2,$t.BOOLEAN_TYPE=3,$t.UNORDERED_NODE_ITERATOR_TYPE=4,$t.ORDERED_NODE_ITERATOR_TYPE=5,$t.UNORDERED_NODE_SNAPSHOT_TYPE=6,$t.ORDERED_NODE_SNAPSHOT_TYPE=7,$t.ANY_UNORDERED_NODE_TYPE=8,$t.FIRST_ORDERED_NODE_TYPE=9;var xn,Fn=["wgxpath","install"],On=Z;for((Fn[0]in On)||!On.execScript||On.execScript("var "+Fn[0]);Fn.length&&(xn=Fn.shift());)Fn.length||Gr===void 0?On=On[xn]?On[xn]:On[xn]={}:On[xn]=Gr;Oe.exports.install=Gr,Oe.exports.XPathResultType={ANY_TYPE:0,NUMBER_TYPE:1,STRING_TYPE:2,BOOLEAN_TYPE:3,UNORDERED_NODE_ITERATOR_TYPE:4,ORDERED_NODE_ITERATOR_TYPE:5,UNORDERED_NODE_SNAPSHOT_TYPE:6,ORDERED_NODE_SNAPSHOT_TYPE:7,ANY_UNORDERED_NODE_TYPE:8,FIRST_ORDERED_NODE_TYPE:9}}).call(ge.g)}},Os={};function st(Oe){var R=Os[Oe];if(R!==void 0)return R.exports;var ge=Os[Oe]={exports:{}};return al[Oe](ge,ge.exports,st),ge.exports}dn=Object.getPrototypeOf?Oe=>Object.getPrototypeOf(Oe):Oe=>Oe.__proto__,st.t=function(Oe,R){if(1&R&&(Oe=this(Oe)),8&R||typeof Oe=="object"&&Oe&&(4&R&&Oe.__esModule||16&R&&typeof Oe.then=="function"))return Oe;var ge=Object.create(null);st.r(ge);var Z={};_r=_r||[null,dn({}),dn([]),dn(dn)];for(var x=2&R&&Oe;(typeof x=="object"||typeof x=="function")&&!~_r.indexOf(x);x=dn(x))Object.getOwnPropertyNames(x).forEach(Te=>Z[Te]=()=>Oe[Te]);return Z.default=()=>Oe,st.d(ge,Z),ge},st.d=(Oe,R)=>{for(var ge in R)st.o(R,ge)&&!st.o(Oe,ge)&&Object.defineProperty(Oe,ge,{enumerable:!0,get:R[ge]})},st.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})(),st.o=(Oe,R)=>Object.prototype.hasOwnProperty.call(Oe,R),st.r=Oe=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Oe,"__esModule",{value:!0})};var di={};return(()=>{"use strict";st.r(di),st.d(di,{cli:()=>Jd,engineReady:()=>uo,engineSetup:()=>Wa,exit:()=>Lr,file:()=>ge,localeLoader:()=>za,move:()=>tl,number:()=>Qc,numericOrdinal:()=>qc,ordinal:()=>Jc,resetEngine:()=>Ka,setupEngine:()=>Ln,toDescription:()=>Wc,toEnriched:()=>Kc,toJson:()=>Xc,toSemantic:()=>$c,toSpeech:()=>jc,toSpeechStructure:()=>zc,toVis:()=>Yc,variables:()=>qd,version:()=>Ts,vulgar:()=>Zc,walk:()=>el,worker:()=>R});var Oe={};st.r(Oe),st.d(Oe,{NodeType:()=>He,cloneNode:()=>Rt,createElement:()=>ut,createElementNS:()=>Ve,createTextNode:()=>et,formatXml:()=>ye,parseInput:()=>Ge,querySelectorAll:()=>Tn,querySelectorAllByAttr:()=>ht,querySelectorAllByAttrValue:()=>at,replaceNode:()=>q,serializeXml:()=>de,tagName:()=>Q,toArray:()=>Ae});var R={};st.r(R),st.d(R,{localePreferences:()=>Hd,nextRules:()=>Gd,nextStyle:()=>Vd,relevantPreferences:()=>jd,speech:()=>Bd});var ge={};st.r(ge),st.d(ge,{localePath:()=>Qd,processFile:()=>dr,toDescription:()=>Kd,toEnriched:()=>zd,toJson:()=>Wd,toSemantic:()=>Yd,toSpeech:()=>Xd});var Z={};st.r(Z),st.d(Z,{engineReady:()=>uo,engineSetup:()=>Wa,exit:()=>Lr,file:()=>ge,localeLoader:()=>za,move:()=>tl,number:()=>Qc,numericOrdinal:()=>qc,ordinal:()=>Jc,resetEngine:()=>Ka,setupEngine:()=>Ln,toDescription:()=>Wc,toEnriched:()=>Kc,toJson:()=>Xc,toSemantic:()=>$c,toSpeech:()=>jc,toSpeechStructure:()=>zc,toVis:()=>Yc,version:()=>Ts,vulgar:()=>Zc,walk:()=>el,worker:()=>R});class x{static ensureLocale(e,n){return x.LOCALES.get(e)?e:(console.error(`Locale ${e} does not exist! Using ${x.LOCALES.get(n)} instead.`),n)}}x.VERSION="5.0.0-rc.4",x.LOCALES=new Map([["af","Afrikaans"],["ca","Catalan"],["da","Danish"],["de","German"],["en","English"],["es","Spanish"],["euro","Euro"],["fr","French"],["hi","Hindi"],["it","Italian"],["ko","Korean"],["nb","Bokmål"],["nn","Nynorsk"],["sv","Swedish"],["nemeth","Nemeth"]]),x.mathjaxVersion="4.1.2",x.url="https://cdn.jsdelivr.net/npm/speech-rule-engine@"+x.VERSION+"/lib/mathmaps";var Te=st(841),ne=st.t(Te,2),ee=st(999),we=st.t(ee,2);const ft=ne,Me=new ft.DOMImplementation().createDocument("",""),ie=(we==null?void 0:ee.install)||window.wgxpath.install,F=(function(){const t={document:{},XPathResult:{}};return ie(t),t.document.XPathResult=t.XPathResult,t.document})(),me={currentDocument:Me,evaluate:F.evaluate,result:F.XPathResult,createNSResolver:F.createNSResolver},B=!(typeof window>"u"),Xe=B&&window.document!==void 0,Ie=!(typeof DedicatedWorkerGlobalScope>"u"),ke=()=>{var t;return typeof hi<"u"||typeof process<"u"&&((t=process.versions)===null||t===void 0?void 0:t.node)!=null&&typeof hi<"u"?hi:e=>null},Re={extRequire:t=>typeof process<"u"&&typeof hi<"u"?ke()(t):null,windowSupported:B,documentSupported:Xe,webworker:Ie,xmldom:ft,document:Me,fs:Xe||Ie?null:ke()("fs"),url:x.url,jsonPath:(function(){if(Xe||Ie)return x.url;if({}.SRE_JSON_PATH||st.g.SRE_JSON_PATH)return{}.SRE_JSON_PATH||st.g.SRE_JSON_PATH;try{return ke().resolve("speech-rule-engine").replace(/sre\.js$/,"")+"mathmaps"}catch{}try{return ke().resolve(".").replace(/sre\.js$/,"")+"mathmaps"}catch{}return typeof __dirname<"u"?__dirname+(__dirname.match(/lib?$/)?"/mathmaps":"/lib/mathmaps"):process.cwd()+"/lib/mathmaps"})(),xpath:me};var Pe,Se;(function(t){t.SYNC="sync",t.ASYNC="async",t.HTTP="http"})(Pe||(Pe={})),(function(t){t.PITCH="pitch",t.RATE="rate",t.VOLUME="volume",t.PAUSE="pause",t.JOIN="join",t.LAYOUT="layout"})(Se||(Se={}));const St=[Se.PITCH,Se.RATE,Se.VOLUME,Se.PAUSE,Se.JOIN];var G,z;(function(t){t.NONE="none",t.SHALLOW="shallow",t.DEEP="deep"})(G||(G={})),(function(t){t.NONE="none",t.LAYOUT="layout",t.COUNTING="counting",t.PUNCTUATION="punctuation",t.SSML="ssml",t.ACSS="acss",t.SABLE="sable",t.VOICEXML="voicexml"})(z||(z={}));const w={mathspeak:"default",clearspeak:"default"};var O;(function(t){t.DOMAIN="domain",t.STYLE="style",t.LOCALE="locale",t.TOPIC="topic",t.MODALITY="modality"})(O||(O={}));class V{static createProp(...e){const n=D.DEFAULT_ORDER,r={};for(let o=0,i=e.length,s=n.length;o<i&&o<s;o++)r[n[o]]=e[o];return new V(r)}constructor(e,n=Object.keys(e)){this.properties=e,this.order=n}getProperties(){return this.properties}getOrder(){return this.order}getAxes(){return this.order}getProperty(e){return this.properties[e]}updateProperties(e){this.properties=e}allProperties(){const e=[];return this.order.forEach(n=>e.push(this.getProperty(n).slice())),e}toString(){const e=[];return this.order.forEach(n=>e.push(n+": "+this.getProperty(n).toString())),e.join(`
10
+ `)}}class D extends V{static createCstr(...e){const n=D.DEFAULT_ORDER,r={};for(let o=0,i=e.length,s=n.length;o<i&&o<s;o++)r[n[o]]=e[o];return new D(r)}static defaultCstr(){return D.createCstr.apply(null,D.DEFAULT_ORDER.map(function(e){return D.DEFAULT_VALUES[e]}))}static validOrder(e){const n=D.DEFAULT_ORDER.slice();return e.every(r=>{const o=n.indexOf(r);return o!==-1&&n.splice(o,1)})}constructor(e,n){const r={};for(const[o,i]of Object.entries(e))r[o]=[i];super(r,n),this.components=e}getComponents(){return this.components}getValue(e){return this.components[e]}getValues(){return this.order.map(e=>this.getValue(e))}allProperties(){const e=super.allProperties();for(let n,r,o=0;n=e[o],r=this.order[o];o++){const i=this.getValue(r);n.indexOf(i)===-1&&n.unshift(i)}return e}toString(){return this.getValues().join(".")}equal(e){const n=e.getAxes();if(this.order.length!==n.length)return!1;for(let r,o=0;r=n[o];o++){const i=this.getValue(r);if(!i||e.getValue(r)!==i)return!1}return!0}}D.DEFAULT_ORDER=[O.LOCALE,O.MODALITY,O.DOMAIN,O.STYLE,O.TOPIC],D.BASE_LOCALE="base",D.DEFAULT_VALUE="default",D.DEFAULT_VALUES={[O.LOCALE]:"en",[O.DOMAIN]:D.DEFAULT_VALUE,[O.STYLE]:D.DEFAULT_VALUE,[O.TOPIC]:D.DEFAULT_VALUE,[O.MODALITY]:"speech"};class oe{constructor(e){this.order=e}parse(e){const n=e.split("."),r={};if(n.length>this.order.length)throw new Error("Invalid dynamic constraint: "+r);let o=0;for(let i,s=0;i=this.order[s],n.length;s++,o++){const c=n.shift();r[i]=c}return new D(r,this.order.slice(0,o))}}class H{constructor(e,n=new V(e.getProperties(),e.getOrder())){this.reference=e,this.fallback=n,this.order=this.reference.getOrder()}getReference(){return this.reference}setReference(e,n){this.reference=e,this.fallback=n||new V(e.getProperties(),e.getOrder()),this.order=this.reference.getOrder()}match(e){const n=e.getAxes();return n.length===this.reference.getAxes().length&&n.every(r=>{const o=e.getValue(r);return o===this.reference.getValue(r)||this.fallback.getProperty(r).indexOf(o)!==-1})}compare(e,n){let r=!1;for(let o,i=0;o=this.order[i];i++){const s=e.getValue(o),c=n.getValue(o);if(!r){const C=this.reference.getValue(o);if(C===s&&C!==c)return-1;if(C===c&&C!==s)return 1;if(C===s&&C===c)continue;C!==s&&C!==c&&(r=!0)}const p=this.fallback.getProperty(o),E=p.indexOf(s),T=p.indexOf(c);if(E<T)return-1;if(T<E)return 1}return 0}toString(){return this.reference.toString()+`
11
+ `+this.fallback.toString()}}function le(t){return t.match("/$")?t:t+"/"}function re(t,e="json"){return le(Re.jsonPath)+t+(e.match(/^\./)?e:"."+e)}class _{static getInstance(){return _.instance=_.instance||new _,_.instance}init(e){return e&&this.startDebugFile_(e),this.isActive_=!0,this.fileHandle}output(...e){this.isActive_&&this.output_(e)}generate(e){this.isActive_&&this.output_(e.apply(e,[]))}exit(e=()=>{}){this.stream_&&this.fileHandle.then(()=>{this.isActive_&&this.stream_&&(this.stream_.end("","",e),this.stream_=null)}),this.isActive_=!1}constructor(){this.isActive_=!1,this.fileHandle=Promise.resolve(),this.stream_=null}startDebugFile_(e){this.fileHandle=Re.fs.promises.open(e,"w"),this.fileHandle=this.fileHandle.then(n=>{this.stream_=n.createWriteStream(e),this.outputFunction=function(...r){this.stream_.write(r.join(" ")),this.stream_.write(`
12
+ `)}.bind(this),this.stream_.on("error",function(r){console.info("Invalid log file. Debug information sent to console."),this.outputFunction=console.info}.bind(this)),this.stream_.on("finish",function(){console.info("Finalizing debug file.")})})}output_(e){this.stream_?this.fileHandle.then(()=>this.outputFunction.apply(this.outputFunction,["Speech Rule Engine Debugger:"].concat(e))):console.info(...["Speech Rule Engine Debugger:"].concat(e))}}class te{constructor(e={}){this.delay=!1,this.domain="clearspeak",this.style=D.DEFAULT_VALUES[O.STYLE],this.locale=D.DEFAULT_VALUES[O.LOCALE],this.subiso="",this.modality=D.DEFAULT_VALUES[O.MODALITY],this.speech=G.NONE,this.markup=z.NONE,this.mark=!0,this.automark=!1,this.character=!0,this.cleanpause=!0,this.cayleyshort=!0,this.linebreaks=!1,this.rate="100",this.walker="Table",this.structure=!1,this.aria=!1,this.tree=!1,this.strict=!1,this.pprint=!1,this.rules="",this.prune="",this.set(e)}set(e){this.ensureDomain(e);for(const[n,r]of Object.entries(e))(te.BINARY_FEATURES.includes(n)||te.STRING_FEATURES.includes(n))&&(this[n]=r)}json(){const e={};return[].concat(te.STRING_FEATURES,te.BINARY_FEATURES).forEach(n=>e[n]=this[n]),e}ensureDomain(e){if(e.modality&&e.modality!=="speech"||!e.modality&&this.modality!=="speech"||!e.domain&&!e.locale)return;if(e.domain==="default")return void(e.domain="mathspeak");const n=e.locale||this.locale,r=e.domain||this.domain;K.indexOf(n)===-1||r==="mathspeak"?n!=="en"?r!=="mathspeak"&&r!=="clearspeak"&&(e.domain="mathspeak"):ve.indexOf(r)===-1&&(e.domain="mathspeak"):e.domain="mathspeak"}}te.BINARY_FEATURES=["automark","mark","character","cleanpause","strict","structure","aria","pprint","cayleyshort","linebreaks","tree"],te.STRING_FEATURES=["markup","style","domain","speech","walker","locale","delay","modality","rate","rules","subiso","prune"];const K=["ca","da","es"],ve=["chromevox","clearspeak","mathspeak","emacspeak","html"];class ue extends Error{constructor(e=""){super(),this.message=e,this.name="SRE Error"}}class L{set defaultLocale(e){this._defaultLocale=x.ensureLocale(e,this._defaultLocale)}get defaultLocale(){return this._defaultLocale}static getInstance(){return L.instance=L.instance||new L,L.instance}static defaultEvaluator(e,n){return e}static evaluateNode(e){return L.nodeEvaluator(e)}getRate(){const e=parseInt(this.options.rate,10);return isNaN(e)?100:e}setDynamicCstr(e){if(this.defaultLocale&&(D.DEFAULT_VALUES[O.LOCALE]=this.defaultLocale),e){const s=Object.keys(e);for(let c=0;c<s.length;c++){const p=s[c];if(D.DEFAULT_ORDER.indexOf(p)!==-1){const E=e[p];this.options[p]=E}}}const n=[this.options.locale,this.options.modality,this.options.domain,this.options.style].join("."),r=V.createProp([D.DEFAULT_VALUES[O.LOCALE]],[D.DEFAULT_VALUES[O.MODALITY]],[D.DEFAULT_VALUES[O.DOMAIN]],[D.DEFAULT_VALUES[O.STYLE]]),o=this.comparators[this.options.domain],i=this.parsers[this.options.domain];this.parser=i||this.defaultParser,this.dynamicCstr=this.parser.parse(n),this.dynamicCstr.updateProperties(r.getProperties()),this.comparator=o?o():new H(this.dynamicCstr)}constructor(){this.options=new te,this.config=!1,this.customLoader=null,this.parsers={},this.comparator=null,this.mode=Pe.SYNC,this.init=!0,this.comparators={},this._defaultLocale=D.DEFAULT_VALUES[O.LOCALE],this.options.locale=this.defaultLocale,this.evaluator=L.defaultEvaluator,this.defaultParser=new oe(D.DEFAULT_ORDER),this.parser=this.defaultParser,this.dynamicCstr=D.defaultCstr()}configurate(e){this.mode!==Pe.HTTP||Re.webworker||this.config||((function(n){const r=document.documentElement.querySelectorAll('script[type="text/x-sre-config"]');for(let o=0,i=r.length;o<i;o++){let s;try{s=r[o].innerHTML;const c=JSON.parse(s);for(const[p,E]of Object.entries(c))n[p]=E}catch{_.getInstance().output("Illegal configuration ",s)}}})(e),this.config=!0),(function(n){if(typeof SREfeature<"u")for(const[r,o]of Object.entries(SREfeature))n[r]=o})(e)}setCustomLoader(e){e&&(this.customLoader=e)}setup(e){e.mode!==void 0&&(this.mode=e.mode),this.configurate(e),this.options.set(e),e.json&&(Re.jsonPath=le(e.json)),this.setCustomLoader(e.custom)}json(){return Object.assign({mode:this.mode},this.options.json())}reset(){this.options=new te}}L.nodeEvaluator=function(t){return[]};class ce{static get(e=L.getInstance().options.locale){return ce.promises[e]||Promise.resolve("")}static getall(){return Promise.all(Object.values(ce.promises))}}ce.loaded={},ce.promises={};const Be=Re.xpath,De={xhtml:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",mml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Ce(t){return De[t]||null}class ct{constructor(){this.lookupNamespaceURI=Ce}}function lt(t,e,n){return Be.evaluate(t,e,new ct,n,null)}function he(t,e){let n;try{n=lt(t,e,Be.result.ORDERED_NODE_ITERATOR_TYPE)}catch{return[]}const r=[];for(let o=n.iterateNext();o;o=n.iterateNext())r.push(o);return r}function ot(t){if(L.getInstance().mode!==Pe.HTTP)return;let e=t;for(;e&&!e.evaluate;)e=e.parentNode;e&&e.evaluate?Be.currentDocument=e:t.ownerDocument&&(Be.currentDocument=t.ownerDocument)}function Ae(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}function Ge(t){const e=new Re.xmldom.DOMParser,n=(function(o){return(o=o.replace(/&nbsp;/g," ")).replace(/>[ \f\n\r\t\v\u200b]+</g,"><").trim()})(t),r=!!n.match(/&(?!lt|gt|amp|quot|apos)\w+;/g);if(!n)throw new ue("Empty input!");try{const o=e.parseFromString(n,r?"text/html":"text/xml");return L.getInstance().mode===Pe.HTTP?(Be.currentDocument=o,r?o.body.childNodes[0]:o.documentElement):o.documentElement}catch(o){throw new ue("Illegal input: "+o.message)}}var He,k,xe,j;function q(t,e){t.parentNode&&(t.parentNode.insertBefore(e,t),t.parentNode.removeChild(t))}function ut(t){return Re.document.createElement(t)}function Ve(t,e){return Re.document.createElementNS(t,e)}function et(t){return Re.document.createTextNode(t)}function ye(t){let e="",n=/(>)(<)(\/*)/g,r=0,o=(t=t.replace(n,`$1\r
13
+ $2$3`)).split(`\r
14
+ `);for(n=/(\.)*(<)(\/*)/g,o=o.map(i=>i.replace(n,`$1\r
15
+ $2$3`).split(`\r
16
+ `)).reduce((i,s)=>i.concat(s),[]);o.length;){let i=o.shift();if(!i)continue;let s=0;if(i.match(/^<\w[^>/]*>[^>]+$/)){const c=je(i,o[0]);c[0]?c[1]?(i+=o.shift().slice(0,-c[1].length),c[1].trim()&&o.unshift(c[1])):i+=o.shift():s=1}else if(i.match(/^<\/\w/))r!==0&&(r-=1);else if(i.match(/^<\w[^>]*[^/]>.*$/))s=1;else if(i.match(/^<\w[^>]*\/>.+$/)){const c=i.indexOf(">")+1,p=i.slice(c);p.trim()&&o.unshift(),i=i.slice(0,c)+p}else s=0;e+=new Array(r+1).join(" ")+i+`\r
17
+ `,r+=s}return e}function je(t,e){if(!e)return[!1,""];const n=t.match(/^<([^> ]+).*>/),r=e.match(/^<\/([^>]+)>(.*)/);return n&&r&&n[1]===r[1]?[!0,r[2]]:[!1,""]}function ht(t,e){return t.querySelectorAll?Ae(t.querySelectorAll(`[${e}]`)):he(`.//*[@${e}]`,t)}function at(t,e,n){return t.querySelectorAll?Ae(t.querySelectorAll(`[${e}="${n}"]`)):he(`.//*[@${e}="${n}"]`,t)}function Tn(t,e){return t.querySelectorAll?Ae(t.querySelectorAll(e)):he(`.//${e}`,t)}function Q(t){return t.tagName.toUpperCase()}function Rt(t){return t.cloneNode(!0)}function de(t){return new Re.xmldom.XMLSerializer().serializeToString(t)}function Lt(t){const e=t.toString(16).toUpperCase();return e.length>3?e:("000"+e).slice(-4)}function Bt([t,e],n){const r=parseInt(t,16),o=parseInt(e,16),i=[];for(let s=r;s<=o;s++){let c=Lt(s);n[c]!==!1&&(c=n[c]||c,i.push(c))}return i}function Ue(t,e={}){return Bt(t,e).map(n=>String.fromCodePoint(parseInt(n,16)))}(function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t[t.NOTATION_NODE=12]="NOTATION_NODE"})(He||(He={})),(function(t){t.BOLD="bold",t.BOLDFRAKTUR="bold-fraktur",t.BOLDITALIC="bold-italic",t.BOLDSCRIPT="bold-script",t.DOUBLESTRUCK="double-struck",t.DOUBLESTRUCKITALIC="double-struck-italic",t.FULLWIDTH="fullwidth",t.FRAKTUR="fraktur",t.ITALIC="italic",t.MONOSPACE="monospace",t.NORMAL="normal",t.SCRIPT="script",t.SANSSERIF="sans-serif",t.SANSSERIFITALIC="sans-serif-italic",t.SANSSERIFBOLD="sans-serif-bold",t.SANSSERIFBOLDITALIC="sans-serif-bold-italic"})(k||(k={})),(function(t){t.SUPER="super",t.SUB="sub",t.CIRCLED="circled",t.PARENTHESIZED="parenthesized",t.PERIOD="period",t.NEGATIVECIRCLED="negative-circled",t.DOUBLECIRCLED="double-circled",t.CIRCLEDSANSSERIF="circled-sans-serif",t.NEGATIVECIRCLEDSANSSERIF="negative-circled-sans-serif",t.COMMA="comma",t.SQUARED="squared",t.NEGATIVESQUARED="negative-squared"})(xe||(xe={})),(function(t){t.LATINCAP="latinCap",t.LATINSMALL="latinSmall",t.GREEKCAP="greekCap",t.GREEKSMALL="greekSmall",t.DIGIT="digit"})(j||(j={}));const tt=[{interval:["1D400","1D419"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.BOLD},{interval:["1D41A","1D433"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.BOLD},{interval:["1D56C","1D585"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.BOLDFRAKTUR},{interval:["1D586","1D59F"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.BOLDFRAKTUR},{interval:["1D468","1D481"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.BOLDITALIC},{interval:["1D482","1D49B"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.BOLDITALIC},{interval:["1D4D0","1D4E9"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.BOLDSCRIPT},{interval:["1D4EA","1D503"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.BOLDSCRIPT},{interval:["1D538","1D551"],base:j.LATINCAP,subst:{"1D53A":"2102","1D53F":"210D","1D545":"2115","1D547":"2119","1D548":"211A","1D549":"211D","1D551":"2124"},capital:!0,category:"Lu",font:k.DOUBLESTRUCK},{interval:["1D552","1D56B"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.DOUBLESTRUCK},{interval:["1D504","1D51D"],base:j.LATINCAP,subst:{"1D506":"212D","1D50B":"210C","1D50C":"2111","1D515":"211C","1D51D":"2128"},capital:!0,category:"Lu",font:k.FRAKTUR},{interval:["1D51E","1D537"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.FRAKTUR},{interval:["FF21","FF3A"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.FULLWIDTH},{interval:["FF41","FF5A"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.FULLWIDTH},{interval:["1D434","1D44D"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.ITALIC},{interval:["1D44E","1D467"],base:j.LATINSMALL,subst:{"1D455":"210E"},capital:!1,category:"Ll",font:k.ITALIC},{interval:["1D670","1D689"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.MONOSPACE},{interval:["1D68A","1D6A3"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.MONOSPACE},{interval:["0041","005A"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.NORMAL},{interval:["0061","007A"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.NORMAL},{interval:["1D49C","1D4B5"],base:j.LATINCAP,subst:{"1D49D":"212C","1D4A0":"2130","1D4A1":"2131","1D4A3":"210B","1D4A4":"2110","1D4A7":"2112","1D4A8":"2133","1D4AD":"211B"},capital:!0,category:"Lu",font:k.SCRIPT},{interval:["1D4B6","1D4CF"],base:j.LATINSMALL,subst:{"1D4BA":"212F","1D4BC":"210A","1D4C4":"2134"},capital:!1,category:"Ll",font:k.SCRIPT},{interval:["1D5A0","1D5B9"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.SANSSERIF},{interval:["1D5BA","1D5D3"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.SANSSERIF},{interval:["1D608","1D621"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.SANSSERIFITALIC},{interval:["1D622","1D63B"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.SANSSERIFITALIC},{interval:["1D5D4","1D5ED"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.SANSSERIFBOLD},{interval:["1D5EE","1D607"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.SANSSERIFBOLD},{interval:["1D63C","1D655"],base:j.LATINCAP,subst:{},capital:!0,category:"Lu",font:k.SANSSERIFBOLDITALIC},{interval:["1D656","1D66F"],base:j.LATINSMALL,subst:{},capital:!1,category:"Ll",font:k.SANSSERIFBOLDITALIC},{interval:["0391","03A9"],base:j.GREEKCAP,subst:{"03A2":"03F4"},capital:!0,category:"Lu",font:k.NORMAL},{interval:["03B0","03D0"],base:j.GREEKSMALL,subst:{"03B0":"2207","03CA":"2202","03CB":"03F5","03CC":"03D1","03CD":"03F0","03CE":"03D5","03CF":"03F1","03D0":"03D6"},capital:!1,category:"Ll",font:k.NORMAL},{interval:["1D6A8","1D6C0"],base:j.GREEKCAP,subst:{},capital:!0,category:"Lu",font:k.BOLD},{interval:["1D6C1","1D6E1"],base:j.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:k.BOLD},{interval:["1D6E2","1D6FA"],base:j.GREEKCAP,subst:{},capital:!0,category:"Lu",font:k.ITALIC},{interval:["1D6FB","1D71B"],base:j.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:k.ITALIC},{interval:["1D71C","1D734"],base:j.GREEKCAP,subst:{},capital:!0,category:"Lu",font:k.BOLDITALIC},{interval:["1D735","1D755"],base:j.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:k.BOLDITALIC},{interval:["1D756","1D76E"],base:j.GREEKCAP,subst:{},capital:!0,category:"Lu",font:k.SANSSERIFBOLD},{interval:["1D76F","1D78F"],base:j.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:k.SANSSERIFBOLD},{interval:["1D790","1D7A8"],base:j.GREEKCAP,subst:{},capital:!0,category:"Lu",font:k.SANSSERIFBOLDITALIC},{interval:["1D7A9","1D7C9"],base:j.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:k.SANSSERIFBOLDITALIC},{interval:["0030","0039"],base:j.DIGIT,subst:{},offset:0,category:"Nd",font:k.NORMAL},{interval:["2070","2079"],base:j.DIGIT,subst:{2071:"00B9",2072:"00B2",2073:"00B3"},offset:0,category:"No",font:xe.SUPER},{interval:["2080","2089"],base:j.DIGIT,subst:{},offset:0,category:"No",font:xe.SUB},{interval:["245F","2473"],base:j.DIGIT,subst:{"245F":"24EA"},offset:0,category:"No",font:xe.CIRCLED},{interval:["3251","325F"],base:j.DIGIT,subst:{},offset:21,category:"No",font:xe.CIRCLED},{interval:["32B1","32BF"],base:j.DIGIT,subst:{},offset:36,category:"No",font:xe.CIRCLED},{interval:["2474","2487"],base:j.DIGIT,subst:{},offset:1,category:"No",font:xe.PARENTHESIZED},{interval:["2487","249B"],base:j.DIGIT,subst:{2487:"1F100"},offset:0,category:"No",font:xe.PERIOD},{interval:["2775","277F"],base:j.DIGIT,subst:{2775:"24FF"},offset:0,category:"No",font:xe.NEGATIVECIRCLED},{interval:["24EB","24F4"],base:j.DIGIT,subst:{},offset:11,category:"No",font:xe.NEGATIVECIRCLED},{interval:["24F5","24FE"],base:j.DIGIT,subst:{},offset:1,category:"No",font:xe.DOUBLECIRCLED},{interval:["277F","2789"],base:j.DIGIT,subst:{"277F":"1F10B"},offset:0,category:"No",font:xe.CIRCLEDSANSSERIF},{interval:["2789","2793"],base:j.DIGIT,subst:{2789:"1F10C"},offset:0,category:"No",font:xe.NEGATIVECIRCLEDSANSSERIF},{interval:["FF10","FF19"],base:j.DIGIT,subst:{},offset:0,category:"Nd",font:k.FULLWIDTH},{interval:["1D7CE","1D7D7"],base:j.DIGIT,subst:{},offset:0,category:"Nd",font:k.BOLD},{interval:["1D7D8","1D7E1"],base:j.DIGIT,subst:{},offset:0,category:"Nd",font:k.DOUBLESTRUCK},{interval:["1D7E2","1D7EB"],base:j.DIGIT,subst:{},offset:0,category:"Nd",font:k.SANSSERIF},{interval:["1D7EC","1D7F5"],base:j.DIGIT,subst:{},offset:0,category:"Nd",font:k.SANSSERIFBOLD},{interval:["1D7F6","1D7FF"],base:j.DIGIT,subst:{},offset:0,category:"Nd",font:k.MONOSPACE},{interval:["1F101","1F10A"],base:j.DIGIT,subst:{},offset:0,category:"No",font:xe.COMMA},{interval:["24B6","24CF"],base:j.LATINCAP,subst:{},capital:!0,category:"So",font:xe.CIRCLED},{interval:["24D0","24E9"],base:j.LATINSMALL,subst:{},capital:!1,category:"So",font:xe.CIRCLED},{interval:["1F110","1F129"],base:j.LATINCAP,subst:{},capital:!0,category:"So",font:xe.PARENTHESIZED},{interval:["249C","24B5"],base:j.LATINSMALL,subst:{},capital:!1,category:"So",font:xe.PARENTHESIZED},{interval:["1F130","1F149"],base:j.LATINCAP,subst:{},capital:!0,category:"So",font:xe.SQUARED},{interval:["1F170","1F189"],base:j.LATINCAP,subst:{},capital:!0,category:"So",font:xe.NEGATIVESQUARED},{interval:["1F150","1F169"],base:j.LATINCAP,subst:{},capital:!0,category:"So",font:xe.NEGATIVECIRCLED}],wt=new Map;function Yt(t,e){return t+e.split("-").map(n=>n[0].toUpperCase()+n.slice(1)).join("")}for(const t of tt){const e=Yt(t.base,t.font),n=Ue(t.interval,t.subst);let r=wt.get(e);r?r.unicode=r.unicode.concat(n):(r=t,r.unicode=n,wt.set(e,r))}var Gt;(function(t){t.PUNCTUATION="punctuation",t.FENCE="fence",t.NUMBER="number",t.IDENTIFIER="identifier",t.TEXT="text",t.OPERATOR="operator",t.RELATION="relation",t.LARGEOP="largeop",t.FUNCTION="function",t.ACCENT="accent",t.FENCED="fenced",t.FRACTION="fraction",t.PUNCTUATED="punctuated",t.RELSEQ="relseq",t.MULTIREL="multirel",t.INFIXOP="infixop",t.PREFIXOP="prefixop",t.POSTFIXOP="postfixop",t.APPL="appl",t.INTEGRAL="integral",t.BIGOP="bigop",t.SQRT="sqrt",t.ROOT="root",t.LIMUPPER="limupper",t.LIMLOWER="limlower",t.LIMBOTH="limboth",t.SUBSCRIPT="subscript",t.SUPERSCRIPT="superscript",t.UNDERSCORE="underscore",t.OVERSCORE="overscore",t.TENSOR="tensor",t.TABLE="table",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.ROW="row",t.LINE="line",t.CELL="cell",t.ENCLOSE="enclose",t.INFERENCE="inference",t.RULELABEL="rulelabel",t.CONCLUSION="conclusion",t.PREMISES="premises",t.UNKNOWN="unknown",t.EMPTY="empty"})(Gt||(Gt={}));const l=Object.assign({},Gt);var on;(function(t){t.COMMA="comma",t.SEMICOLON="semicolon",t.ELLIPSIS="ellipsis",t.FULLSTOP="fullstop",t.QUESTION="question",t.EXCLAMATION="exclamation",t.QUOTES="quotes",t.DASH="dash",t.TILDE="tilde",t.PRIME="prime",t.DEGREE="degree",t.VBAR="vbar",t.COLON="colon",t.OPENFENCE="openfence",t.CLOSEFENCE="closefence",t.APPLICATION="application",t.DUMMY="dummy",t.UNIT="unit",t.LABEL="label",t.OPEN="open",t.CLOSE="close",t.TOP="top",t.BOTTOM="bottom",t.NEUTRAL="neutral",t.METRIC="metric",t.LATINLETTER="latinletter",t.GREEKLETTER="greekletter",t.OTHERLETTER="otherletter",t.NUMBERSET="numbersetletter",t.INTEGER="integer",t.FLOAT="float",t.OTHERNUMBER="othernumber",t.INFTY="infty",t.MIXED="mixed",t.MULTIACCENT="multiaccent",t.OVERACCENT="overaccent",t.UNDERACCENT="underaccent",t.UNDEROVER="underover",t.SUBSUP="subsup",t.LEFTSUB="leftsub",t.LEFTSUPER="leftsuper",t.RIGHTSUB="rightsub",t.RIGHTSUPER="rightsuper",t.LEFTRIGHT="leftright",t.ABOVEBELOW="abovebelow",t.INTERVAL="interval",t.SETEMPTY="set empty",t.SETEXT="set extended",t.SETSINGLE="set singleton",t.SETCOLLECT="set collection",t.STRING="string",t.SPACE="space",t.ANNOTATION="annotation",t.TEXT="text",t.SEQUENCE="sequence",t.ENDPUNCT="endpunct",t.STARTPUNCT="startpunct",t.NEGATIVE="negative",t.POSITIVE="positive",t.NEGATION="negation",t.MULTIOP="multiop",t.PREFIXOP="prefix operator",t.POSTFIXOP="postfix operator",t.LIMFUNC="limit function",t.INFIXFUNC="infix function",t.PREFIXFUNC="prefix function",t.POSTFIXFUNC="postfix function",t.SIMPLEFUNC="simple function",t.COMPFUNC="composed function",t.SUM="sum",t.INTEGRAL="integral",t.GEOMETRY="geometry",t.BOX="box",t.BLOCK="block",t.ADDITION="addition",t.MULTIPLICATION="multiplication",t.SUBTRACTION="subtraction",t.IMPLICIT="implicit",t.DIVISION="division",t.VULGAR="vulgar",t.EQUALITY="equality",t.INEQUALITY="inequality",t.ARROW="arrow",t.ELEMENT="element",t.NONELEMENT="nonelement",t.REELEMENT="reelement",t.RENONELEMENT="renonelement",t.SET="set",t.DETERMINANT="determinant",t.ROWVECTOR="rowvector",t.BINOMIAL="binomial",t.SQUAREMATRIX="squarematrix",t.CYCLE="cycle",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.TABLE="table",t.CAYLEY="cayley",t.PROOF="proof",t.LEFT="left",t.RIGHT="right",t.UP="up",t.DOWN="down",t.FINAL="final",t.SINGLE="single",t.HYP="hyp",t.AXIOM="axiom",t.LOGIC="logic",t.UNKNOWN="unknown",t.MGLYPH="mglyph"})(on||(on={}));const d=Object.assign({},on);var Dn;(function(t){t.CALIGRAPHIC="caligraphic",t.CALIGRAPHICBOLD="caligraphic-bold",t.OLDSTYLE="oldstyle",t.OLDSTYLEBOLD="oldstyle-bold",t.UNKNOWN="unknown"})(Dn||(Dn={}));const be=Object.assign(Object.assign(Object.assign({},k),Dn),xe);var Vt;(function(t){t.ALLLETTERS="allLetters",t.D="d",t.BAR="bar",t.TILDE="tilde",t.CURLY="curly",t.PAREN="paren",t.BRACKET="bracket",t.FLOOR="floor",t.CEIL="ceil"})(Vt||(Vt={}));const Ye=Object.assign(Object.assign({},j),Vt);function Jn(t,e){return t.toString()}function _t(t){return t.toString()}function $e(t,e){return t+e.toLowerCase()}const _e={};function In(t,e=""){if(!t.childNodes||!t.childNodes[0]||!t.childNodes[0].childNodes||t.childNodes[0].childNodes.length<2||t.childNodes[0].childNodes[0].tagName!==l.NUMBER||t.childNodes[0].childNodes[0].getAttribute("role")!==d.INTEGER||t.childNodes[0].childNodes[1].tagName!==l.NUMBER||t.childNodes[0].childNodes[1].getAttribute("role")!==d.INTEGER)return{convertible:!1,content:t.textContent};const n=t.childNodes[0].childNodes[1].textContent,r=t.childNodes[0].childNodes[0].textContent,o=Number(n),i=Number(r);return isNaN(o)||isNaN(i)?{convertible:!1,content:`${r} ${e} ${n}`}:{convertible:!0,enumerator:i,denominator:o}}function qn(t,e,n){const r=In(t);if(r.convertible){const o=r.enumerator,i=r.denominator;return o>0&&o<e&&i>0&&i<n}return!1}function Pt(t={}){return Object.assign({zero:"zero",ones:[],tens:[],large:[],special:{},wordOrdinal:_t,numericOrdinal:_t,numberToWords:_t,numberToOrdinal:Jn,vulgarSep:" ",numSep:" "},t)}_e.identityCombiner=function(t,e,n){return t+e+n},_e.prefixCombiner=function(t,e,n){return t=n?n+" "+t:t,e?e+" "+t:t},_e.postfixCombiner=function(t,e,n){return t=n?n+" "+t:t,e?t+" "+e:t},_e.romanceCombiner=function(t,e,n){return t=n?t+" "+n:t,e?t+" "+e:t};const I=h();function h(){return{FUNCTIONS:{fracNestDepth:t=>qn(t,10,100),radicalNestDepth:t=>"",combineRootIndex:function(t,e){return t},combineNestedFraction:_e.identityCombiner,combineNestedRadical:_e.identityCombiner,fontRegexp:function(t){return new RegExp("^"+t.split(/ |-/).join("( |-)")+"( |-)")},si:$e,plural:_t},MESSAGES:{MS:{},MSroots:{},font:{},embellish:{},role:{},enclose:{},navigate:{},regexp:{},unitTimes:""},ALPHABETS:{latinSmall:[],latinCap:[],greekSmall:[],greekCap:[],capPrefix:{default:""},smallPrefix:{default:""},digitPrefix:{default:""},languagePrefix:{},digitTrans:{default:_t,mathspeak:_t,clearspeak:_t},letterTrans:{default:_t},combiner:(t,e,n)=>t},NUMBERS:Pt(),COMBINERS:{},CORRECTIONS:{},SUBISO:{default:"",current:"",all:[]}}}function m(t){switch(t){case 1:return I.MESSAGES.MS.ONCE||"";case 2:return I.MESSAGES.MS.TWICE;default:return t.toString()}}function S(t,e){return t===I.MESSAGES.MS.ROOTINDEX||t===I.MESSAGES.MS.INDEX?t:t+" "+e}function b(t){return M(I.MESSAGES.font[t],t)}function M(t,e){return t===void 0?e:typeof t=="string"?t:t[0]}const X="grammar";class P{static getInstance(){return P.instance=P.instance||new P,P.instance}static parseInput(e){const n={},r=e.split(":");for(const o of r){const i=o.split("="),s=i[0].trim();i[1]?n[s]=i[1].trim():s.match(/^!/)?n[s.slice(1)]=!1:n[s]=!0}return n}static parseState(e){const n={},r=e.split(" ");for(const o of r){const i=o.split(":"),s=i[0];n[s]=i[1]||!0}return n}static translateString(e){if(e.match(/:unit$/))return P.translateUnit(e);const n=L.getInstance();let r=n.evaluator(e,n.dynamicCstr);return r=r===null?e:r,P.getInstance().getParameter("plural")&&(r=I.FUNCTIONS.plural(r)),r}static translateUnit(e){e=P.prepareUnit(e);const n=L.getInstance(),r=P.getInstance().getParameter("plural"),o=n.options.strict,i=`${n.options.locale}.${n.options.modality}.default`;let s,c;return n.options.strict=!0,r&&(s=n.defaultParser.parse(i+".plural"),c=n.evaluator(e,s)),c?(n.options.strict=o,c):(s=n.defaultParser.parse(i+".default"),c=n.evaluator(e,s),n.options.strict=o,c?(r&&(c=I.FUNCTIONS.plural(c)),c):P.cleanUnit(e))}static prepareUnit(e){const n=e.match(/:unit$/);return n?e.slice(0,n.index).replace(/\s+/g," ")+e.slice(n.index):e}static cleanUnit(e){return e.match(/:unit$/)?e.replace(/:unit$/,""):e}clear(){this.parameters_={},this.stateStack_=[]}setParameter(e,n){const r=this.parameters_[e];return n?this.parameters_[e]=n:delete this.parameters_[e],r}getParameter(e){return this.parameters_[e]}setCorrection(e,n){this.corrections_[e]=n}setPreprocessor(e,n){this.preprocessors_[e]=n}getCorrection(e){return this.corrections_[e]}getState(){const e=[];for(const[n,r]of Object.entries(this.parameters_))e.push(typeof r=="string"?n+":"+r:n);return e.join(" ")}processSingles(){const e={};for(const n of this.singles)e[n]=!1;this.singles=[],this.pushState(e)}pushState(e){for(let[n,r]of Object.entries(e))n.match(/^\?/)&&(delete e[n],n=n.slice(1),this.singles.push(n)),e[n]=this.setParameter(n,r);this.stateStack_.push(e)}popState(){const e=this.stateStack_.pop();for(const[n,r]of Object.entries(e))this.setParameter(n,r)}setAttribute(e){if(e&&e.nodeType===He.ELEMENT_NODE){const n=this.getState();n&&e.setAttribute(X,n)}}preprocess(e){return this.runProcessors(e,this.preprocessors_)}correct(e){return this.runProcessors(e,this.corrections_)}apply(e,n){return this.currentFlags=n||{},e=this.currentFlags.adjust||this.currentFlags.preprocess?P.getInstance().preprocess(e):e,(this.parameters_.translate||this.currentFlags.translate)&&(e=P.translateString(e)),e=this.currentFlags.adjust||this.currentFlags.correct?P.getInstance().correct(e):e,this.currentFlags={},e}runProcessors(e,n){for(const[r,o]of Object.entries(this.parameters_)){const i=n[r];i&&(e=o===!0?i(e):i(e,o))}return e}constructor(){this.currentFlags={},this.parameters_={},this.corrections_={},this.preprocessors_={},this.stateStack_=[],this.singles=[]}}function Le(t,e){if(!e||!t)return t;const n=I.FUNCTIONS.fontRegexp(b(e));return t.replace(n,"")}function Y(t){let e=t%1e3,n="",r=Qe.ones[Math.floor(e/100)];if(n+=r?r+Qe.numSep+"honderd":"",e%=100,e)if(n+=n?Qe.numSep:"",r=Qe.ones[e],r)n+=r;else{const o=Qe.tens[Math.floor(e/10)];r=Qe.ones[e%10],n+=r?r+"-en-"+o:o}return n}function pt(t){if(t===0)return Qe.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){if(t%1e3){const r=Y(t%1e3);if(e){const o=Qe.large[e];n=r+Qe.numSep+o+(n?Qe.numSep+n:"")}else n=r+(n?Qe.numSep+n:"")}t=Math.floor(t/1e3),e++}return n}function mt(t){return t===1?"eerste":t===3?"derde":t===8?"agste":t===9?"negende":pt(t)+(t<19?"de":"ste")}P.getInstance().setCorrection("localFont",b),P.getInstance().setCorrection("localRole",function(t){return M(I.MESSAGES.role[t],t)}),P.getInstance().setCorrection("localEnclose",function(t){return M(I.MESSAGES.enclose[t],t)}),P.getInstance().setCorrection("ignoreFont",Le),P.getInstance().setPreprocessor("annotation",function(t,e){return t+":"+e}),P.getInstance().setPreprocessor("noTranslateText",function(t){return t.match(new RegExp("^["+I.MESSAGES.regexp.TEXT+"]+$"))&&(P.getInstance().currentFlags.translate=!1),t}),P.getInstance().setCorrection("ignoreCaps",function(t){let e=I.ALPHABETS.capPrefix[L.getInstance().options.domain];return e===void 0&&(e=I.ALPHABETS.capPrefix.default),Le(t,e)}),P.getInstance().setPreprocessor("numbers2alpha",function(t){return t.match(/\d+/)?I.NUMBERS.numberToWords(parseInt(t,10)):t});const Qe=Pt({wordOrdinal:mt,numericOrdinal:function(t){return t.toString()+"."},numberToWords:pt,numberToOrdinal:function(t,e){return t===1?"enkel":t===2?e?"helftes":"helfte":t===4?e?"kwarte":"kwart":mt(t)+(e?"s":"")}}),xt=function(t,e,n){return t=n?n+" "+t:t,e?t+" "+e:t};let yt=null;function sn(t){const e=t%1e3,n=Math.floor(e/100),r=n?n===1?"cent":dt.ones[n]+"-cents":"",o=(function(i){const s=i%100;if(s<20)return dt.ones[s];const c=Math.floor(s/10),p=dt.tens[c],E=dt.ones[s%10];return p&&E?p+(c===2?"-i-":"-")+E:p||E})(e%100);return r&&o?r+dt.numSep+o:r||o}function Tt(t){if(t===0)return dt.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){const r=t%(e>1?1e6:1e3);if(r){let o=dt.large[e];if(e)if(e===1)n=(r===1?"":sn(r)+dt.numSep)+o+(n?dt.numSep+n:"");else{const i=Tt(r);o=r===1?o:o.replace(/\u00f3$/,"ons"),n=i+dt.numSep+o+(n?dt.numSep+n:"")}else n=sn(r)}t=Math.floor(t/(e>1?1e6:1e3)),e++}return n}function An(t){const e=P.getInstance().getParameter("gender");return t.toString()+(e==="f"?"a":"n")}const dt=Pt({numericOrdinal:An,numberToWords:Tt,numberToOrdinal:function(t,e){if(t>1999)return An(t);if(t<=10)return dt.special.onesOrdinals[t-1];const n=Tt(t);return n.match(/mil$/)?n.replace(/mil$/,"mil·lèsima"):n.match(/u$/)?n.replace(/u$/,"vena"):n.match(/a$/)?n.replace(/a$/,"ena"):n+(n.match(/e$/)?"na":"ena")}}),bn=function(t,e,n){return t="sans serif "+(n?n+" "+t:t),e?t+" "+e:t};let Wt=null;function Kt(t,e=!1){return t===It.ones[1]?e?"et":"en":t}function zt(t,e=!1){let n=t%1e3,r="",o=It.ones[Math.floor(n/100)];if(r+=o?Kt(o,!0)+" hundrede":"",n%=100,n)if(r+=r?" og ":"",o=e?It.special.smallOrdinals[n]:It.ones[n],o)r+=o;else{const i=e?It.special.tensOrdinals[Math.floor(n/10)]:It.tens[Math.floor(n/10)];o=It.ones[n%10],r+=o?Kt(o)+"og"+i:i}return r}function wn(t,e=!1){if(t===0)return It.zero;if(t>=Math.pow(10,36))return t.toString();let n=0,r="";for(;t>0;){const o=t%1e3;if(o){const i=zt(o,e&&!n);if(n){const s=It.large[n],c=o>1?"er":"";r=Kt(i,n<=1)+" "+s+c+(r?" og ":"")+r}else r=Kt(i)+r}t=Math.floor(t/1e3),n++}return r}function en(t){if(t%100)return wn(t,!0);const e=wn(t);return e.match(/e$/)?e:e+"e"}const It=Pt({wordOrdinal:en,numericOrdinal:function(t){return t.toString()+"."},numberToWords:wn,numberToOrdinal:function(t,e){return t===1?e?"hel":"hele":t===2?e?"halv":"halve":en(t)+(e?"dele":"del")}});let Pn=null;function tn(t,e=!1){return t===an.ones[1]?e?"eine":"ein":t}function At(t){let e=t%1e3,n="",r=an.ones[Math.floor(e/100)];if(n+=r?tn(r)+"hundert":"",e%=100,e)if(n+=n?an.numSep:"",r=an.ones[e],r)n+=r;else{const o=an.tens[Math.floor(e/10)];r=an.ones[e%10],n+=r?tn(r)+"und"+o:o}return n}function fn(t){if(t===0)return an.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){const r=t%1e3;if(r){const o=At(t%1e3);if(e){const i=an.large[e],s=e>1&&r>1?i.match(/e$/)?"n":"en":"";n=tn(o,e>1)+i+s+n}else n=tn(o,e>1)+n}t=Math.floor(t/1e3),e++}return n.replace(/ein$/,"eins")}function Ht(t){return t===1?"erste":t===3?"dritte":t===7?"siebte":t===8?"achte":fn(t)+(t<19?"te":"ste")}const an=Pt({wordOrdinal:Ht,numericOrdinal:function(t){return t.toString()+"."},numberToWords:fn,numberToOrdinal:function(t,e){return t===1?"eintel":t===2?e?"halbe":"halb":Ht(t)+"l"}}),So=function(t,e,n){return n==="s"&&(e=e.split(" ").map(function(r){return r.replace(/s$/,"")}).join(" "),n=""),t=n?n+" "+t:t,e?e+" "+t:t},kr=function(t,e,n){return t=n&&n!=="s"?n+" "+t:t,e?t+" "+e:t};let fr=null;function To(t){let e=t%1e3,n="";return n+=jt.ones[Math.floor(e/100)]?jt.ones[Math.floor(e/100)]+jt.numSep+"hundred":"",e%=100,e&&(n+=n?jt.numSep:"",n+=jt.ones[e]||jt.tens[Math.floor(e/10)]+(e%10?jt.numSep+jt.ones[e%10]:"")),n}function pr(t){if(t===0)return jt.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;)t%1e3&&(n=To(t%1e3)+(e?"-"+jt.large[e]+"-":"")+n),t=Math.floor(t/1e3),e++;return n.replace(/-$/,"")}function Br(t){let e=pr(t);return e.match(/one$/)?e=e.slice(0,-3)+"first":e.match(/two$/)?e=e.slice(0,-3)+"second":e.match(/three$/)?e=e.slice(0,-5)+"third":e.match(/five$/)?e=e.slice(0,-4)+"fifth":e.match(/eight$/)?e=e.slice(0,-5)+"eighth":e.match(/nine$/)?e=e.slice(0,-4)+"ninth":e.match(/twelve$/)?e=e.slice(0,-6)+"twelfth":e.match(/ty$/)?e=e.slice(0,-2)+"tieth":e+="th",e}const jt=Pt({wordOrdinal:Br,numericOrdinal:function(t){const e=t%100,n=t.toString();if(e>10&&e<20)return n+"th";switch(t%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd";default:return n+"th"}},numberToWords:pr,numberToOrdinal:function(t,e){if(t===1)return e?"oneths":"oneth";if(t===2)return e?"halves":"half";const n=Br(t);return e?n+"s":n}});let mr=null;function $t(t){const e=t%1e3,n=Math.floor(e/100),r=Qt.special.hundreds[n],o=(function(i){const s=i%100;if(s<30)return Qt.ones[s];const c=Qt.tens[Math.floor(s/10)],p=Qt.ones[s%10];return c&&p?c+" y "+p:c||p})(e%100);return n===1?o?r+"to "+o:r:r&&o?r+" "+o:r||o}const Qt=Pt({numericOrdinal:function(t){const e=P.getInstance().getParameter("gender");return t.toString()+(e==="f"?"a":"o")},numberToWords:function(t){if(t===0)return Qt.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){const r=t%1e3;if(r){let o=Qt.large[e];const i=$t(r);e?r===1?(o=o.match("/^mil( |$)/")?o:"un "+o,n=o+(n?" "+n:"")):(o=o.replace(/\u00f3n$/,"ones"),n=$t(r)+" "+o+(n?" "+n:"")):n=i}t=Math.floor(t/1e3),e++}return n},numberToOrdinal:function(t,e){if(t>1999)return t.toString()+"a";if(t<=12)return Qt.special.onesOrdinals[t-1];const n=[];if(t>=1e3&&(t-=1e3,n.push("milésima")),!t)return n.join(" ");let r=0;return r=Math.floor(t/100),r>0&&(n.push(Qt.special.hundredsOrdinals[r-1]),t%=100),t<=12?n.push(Qt.special.onesOrdinals[t-1]):(r=Math.floor(t/10),r>0&&(n.push(Qt.special.tensOrdinals[r-1]),t%=10),t>0&&n.push(Qt.special.onesOrdinals[t-1])),n.join(" ")}}),Gr=function(t,e,n){return t="sans serif "+(n?n+" "+t:t),e?t+" "+e:t};let xn=null,Fn=null;function On(t){let e=t%1e3,n="";if(n+=N.ones[Math.floor(e/100)]?N.ones[Math.floor(e/100)]+"-cent":"",e%=100,e){n+=n?"-":"";let o=N.ones[e];if(o)n+=o;else{const i=N.tens[Math.floor(e/10)];i.match(/-dix$/)?(o=N.ones[e%10+10],n+=i.replace(/-dix$/,"")+"-"+o):n+=i+(e%10?"-"+N.ones[e%10]:"")}}const r=n.match(/s-\w+$/);return r?n.replace(/s-\w+$/,r[0].slice(1)):n.replace(/-un$/,"-et-un")}function a(t){if(t===0)return N.zero;if(t>=Math.pow(10,36))return t.toString();N.special["tens-"+L.getInstance().options.subiso]&&(N.tens=N.special["tens-"+L.getInstance().options.subiso]);let e=0,n="";for(;t>0;){const r=t%1e3;if(r){let o=N.large[e];const i=On(r);if(o&&o.match(/^mille /)){const s=o.replace(/^mille /,"");n=n.match(RegExp(s))?i+(e?"-mille-":"")+n:n.match(RegExp(s.replace(/s$/,"")))?i+(e?"-mille-":"")+n.replace(s.replace(/s$/,""),s):i+(e?"-"+o+"-":"")+n}else o=r===1&&o?o.replace(/s$/,""):o,n=i+(e?"-"+o+"-":"")+n}t=Math.floor(t/1e3),e++}return n.replace(/-$/,"")}const u={1:"unième",2:"demi",3:"tiers",4:"quart"};function f(t){if(t===1)return"première";let e=a(t);return e.match(/^neuf$/)?e=e.slice(0,-1)+"v":e.match(/cinq$/)?e+="u":e.match(/trois$/)?e+="":(e.match(/e$/)||e.match(/s$/))&&(e=e.slice(0,-1)),e+="ième",e}const N=Pt({wordOrdinal:f,numericOrdinal:function(t){const e=P.getInstance().getParameter("gender");return t===1?t.toString()+(e==="m"?"er":"re"):t.toString()+"e"},numberToWords:a,numberToOrdinal:function(t,e){const n=u[t]||f(t);return t===3?n:e?n+"s":n}});let A=null;function y(t){if(t===0)return $.zero;if(t>=Math.pow(10,32))return t.toString();let e=0,n="";const r=(function(o){let i=o%1e3,s="";return s+=$.ones[Math.floor(i/100)]?$.ones[Math.floor(i/100)]+$.numSep+$.special.hundred:"",i%=100,i&&(s+=s?$.numSep:"",s+=$.ones[i]),s})(t%1e3);if(!(t=Math.floor(t/1e3)))return r;for(;t>0;){const o=t%100;o&&(n=$.ones[o]+$.numSep+$.large[e]+(n?$.numSep+n:"")),t=Math.floor(t/100),e++}return r?n+$.numSep+r:n}function se(t){const e=P.getInstance().getParameter("gender");return t<=0?t.toString():t<10?e==="f"?$.special.ordinalsFeminine[t]:$.special.ordinalsMasculine[t]:y(t)+(e==="f"?"वीं":"वाँ")}const $=Pt({wordOrdinal:se,numericOrdinal:function(t){const e=P.getInstance().getParameter("gender");return t>0&&t<10?e==="f"?$.special.simpleSmallOrdinalsFeminine[t]:$.special.simpleSmallOrdinalsMasculine[t]:t.toString().split("").map(function(n){const r=parseInt(n,10);return isNaN(r)?"":$.special.simpleNumbers[r]}).join("")+(e==="f"?"वीं":"वाँ")},numberToWords:y,numberToOrdinal:function(t,e){return t<=10?$.special.smallDenominators[t]:se(t)+" अंश"}});let We=null;function gt(t){let e=t%1e4,n="";return n+=Mt.ones[Math.floor(e/1e3)]?Math.floor(e/1e3)===1?"천":Mt.ones[Math.floor(e/1e3)]+"천":"",e%=1e3,e&&(n+=Mt.ones[Math.floor(e/100)]?Math.floor(e/100)===1?"백":Mt.ones[Math.floor(e/100)]+"백":"",e%=100,n+=Mt.tens[Math.floor(e/10)]+(e%10?Mt.ones[e%10]:"")),n}function Ct(t){if(t===0)return Mt.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;)t%1e4&&(n=gt(t%1e4)+(e?Mt.large[e]+Mt.numSep:"")+n),t=Math.floor(t/1e4),e++;return n.replace(/ $/,"")}function kt(t,e){return t===1?"첫번째":Vr(t)+"번째"}function Vr(t){const e=Ct(t),n=Ct(t%=100);if(!n||!t)return e;const r=t===20?"스무":Mt.tens[10+Math.floor(t/10)],o=Mt.ones[10+Math.floor(t%10)];return e.slice(0,-n.length)+r+o}const Mt=Pt({wordOrdinal:Vr,numericOrdinal:function(t){return kt(t)},numberToWords:Ct,numberToOrdinal:kt});let fi=null;function cl(t){let e=t%1e3,n="";if(n+=cn.ones[Math.floor(e/100)]?cn.ones[Math.floor(e/100)]+cn.numSep+"cento":"",e%=100,e){n+=n?cn.numSep:"";const r=cn.ones[e];if(r)n+=r;else{let o=cn.tens[Math.floor(e/10)];const i=e%10;i!==1&&i!==8||(o=o.slice(0,-1)),n+=o,n+=i?cn.numSep+cn.ones[e%10]:""}}return n}function Rs(t){if(t===0)return cn.zero;if(t>=Math.pow(10,36))return t.toString();if(t===1&&P.getInstance().getParameter("fraction"))return"un";let e=0,n="";for(;t>0;)t%1e3&&(n=cl(t%1e3)+(e?"-"+cn.large[e]+"-":"")+n),t=Math.floor(t/1e3),e++;return n.replace(/-$/,"")}function ys(t){const e=P.getInstance().getParameter("gender")==="m"?"o":"a";let n=cn.special.onesOrdinals[t];return n?n.slice(0,-1)+e:(n=Rs(t),n.slice(0,-1)+"esim"+e)}const cn=Pt({wordOrdinal:ys,numericOrdinal:function(t){const e=P.getInstance().getParameter("gender");return t.toString()+(e==="m"?"o":"a")},numberToWords:Rs,numberToOrdinal:function(t,e){if(t===2)return e?"mezzi":"mezzo";const n=ys(t);if(!e)return n;const r=n.match(/o$/)?"i":"e";return n.slice(0,-1)+r}}),ll=function(t,e,n){return t.match(/^[a-zA-Z]$/)&&(e=e.replace("cerchiato","cerchiata")),t=n?t+" "+n:t,e?t+" "+e:t};let pi=null;function ul(t,e=!1){let n=t%1e3,r="";const o=Math.floor(n/100),i=Je.ones[o];if(r+=i?(o===1?"":i)+"hundre":"",n%=100,n){if(r+=r?"og":"",e){const s=Je.special.smallOrdinals[n];if(s)return r+s;if(n%10)return r+Je.tens[Math.floor(n/10)]+Je.special.smallOrdinals[n%10]}r+=Je.ones[n]||Je.tens[Math.floor(n/10)]+(n%10?Je.ones[n%10]:"")}return e?Cs(r):r}function Cs(t){const e=Je.special.endOrdinal[0];return e==="a"&&t.match(/en$/)?t.slice(0,-2)+Je.special.endOrdinal:t.match(/(d|n)$/)||t.match(/hundre$/)?t+"de":t.match(/i$/)?t+Je.special.endOrdinal:e==="a"&&t.match(/e$/)?t.slice(0,-1)+Je.special.endOrdinal:(t.match(/e$/),t+"nde")}function Ls(t){return vs(t,!0)}const Je=Pt({wordOrdinal:Ls,numericOrdinal:function(t){return t.toString()+"."},numberToWords:vs,numberToOrdinal:function(t,e){return Ls(t)}});function Ms(t,e=!1){return t===Je.ones[1]?t==="ein"?"eitt ":e?"et":"ett":t}function hl(t,e=!1){let n=t%1e3,r="",o=Je.ones[Math.floor(n/100)];if(r+=o?Ms(o)+"hundre":"",n%=100,n){if(r+=r?"og":"",e){const i=Je.special.smallOrdinals[n];if(i)return r+i}if(o=Je.ones[n],o)r+=o;else{const i=Je.tens[Math.floor(n/10)];o=Je.ones[n%10],r+=o?o+"og"+i:i}}return e?Cs(r):r}function vs(t,e=!1){return L.getInstance().options.subiso==="alt"?(function(n,r=!1){if(n===0)return r?Je.special.smallOrdinals[0]:Je.zero;if(n>=Math.pow(10,36))return n.toString();let o=0,i="";for(;n>0;){const s=n%1e3;if(s){const c=hl(n%1e3,!o&&r);!o&&r&&(r=!r),i=(o===1?Ms(c,!0):c)+(o>1?Je.numSep:"")+(o?Je.large[o]+(o>1&&s>1?"er":""):"")+(o>1&&i?Je.numSep:"")+i}n=Math.floor(n/1e3),o++}return r?i+(i.match(/tusen$/)?"de":"te"):i})(t,e):(function(n,r=!1){if(n===0)return r?Je.special.smallOrdinals[0]:Je.zero;if(n>=Math.pow(10,36))return n.toString();let o=0,i="";for(;n>0;){const s=n%1e3;if(s){const c=ul(n%1e3,!o&&r);!o&&r&&(r=!r),i=c+(o?" "+Je.large[o]+(o>1&&s>1?"er":"")+(i?" ":""):"")+i}n=Math.floor(n/1e3),o++}return r?i+(i.match(/tusen$/)?"de":"te"):i})(t,e)}let mi=null;function Ds(t){return t.toString().split("").map(function(e){return gi.ones[parseInt(e,10)]}).join("")}const gi=Pt({numberToWords:Ds,numberToOrdinal:Ds}),gr=function(t){return t.match(RegExp("^"+Io.ALPHABETS.languagePrefix.english))?t.slice(1):t},dl=function(t,e,n){return t=gr(t),e?t+e:t},fl=function(t,e,n){return e+gr(t)},pl=function(t,e,n){return e+(n||"")+(t=gr(t))+"⠻"},ml=function(t,e,n){return e+(n||"")+(t=gr(t))+"⠻⠻"},gl=function(t,e,n){return e+(t=gr(t))+"⠾"};let Io=null,Ei=null;function El(t){let e=t%1e3,n="";const r=Math.floor(e/100);return n+=ln.ones[r]?(r===1?"":ln.ones[r]+ln.numSep)+"hundra":"",e%=100,e&&(n+=n?ln.numSep:"",n+=ln.ones[e]||ln.tens[Math.floor(e/10)]+(e%10?ln.numSep+ln.ones[e%10]:"")),n}function ws(t,e=!1){if(t===0)return ln.zero;if(t>=Math.pow(10,36))return t.toString();let n=0,r="";for(;t>0;){const o=t%1e3;if(o){const i=ln.large[n],s=o>1&&n>1&&!e?"er":"";r=(n===1&&o===1?"":(n>1&&o===1?"en":El(t%1e3))+(n>1?" ":""))+(n?i+s+(n>1?" ":""):"")+r}t=Math.floor(t/1e3),n++}return r.replace(/ $/,"")}function Ps(t){let e=ws(t,!0);return e.match(/^noll$/)?e="nollte":e.match(/ett$/)?e=e.replace(/ett$/,"första"):e.match(/tv\xe5$/)?e=e.replace(/tv\xe5$/,"andra"):e.match(/tre$/)?e=e.replace(/tre$/,"tredje"):e.match(/fyra$/)?e=e.replace(/fyra$/,"fjärde"):e.match(/fem$/)?e=e.replace(/fem$/,"femte"):e.match(/sex$/)?e=e.replace(/sex$/,"sjätte"):e.match(/sju$/)?e=e.replace(/sju$/,"sjunde"):e.match(/\xe5tta$/)?e=e.replace(/\xe5tta$/,"åttonde"):e.match(/nio$/)?e=e.replace(/nio$/,"nionde"):e.match(/tio$/)?e=e.replace(/tio$/,"tionde"):e.match(/elva$/)?e=e.replace(/elva$/,"elfte"):e.match(/tolv$/)?e=e.replace(/tolv$/,"tolfte"):e.match(/tusen$/)?e=e.replace(/tusen$/,"tusonde"):e.match(/jard$/)||e.match(/jon$/)?e+="te":e+="de",e}const ln=Pt({wordOrdinal:Ps,numericOrdinal:function(t){const e=t.toString();return e.match(/11$|12$/)?e+":e":e+(e.match(/1$|2$/)?":a":":e")},numberToWords:ws,numberToOrdinal:function(t,e){if(t===1)return"hel";if(t===2)return e?"halva":"halv";let n=Ps(t);return n=n.match(/de$/)?n.replace(/de$/,""):n,n+(e?"delar":"del")}});let Ni=null;const Si={af:function(){return yt||(yt=(function(){const t=h();return t.NUMBERS=Qe,t.COMBINERS.germanPostfix=xt,t.FUNCTIONS.radicalNestDepth=m,t.FUNCTIONS.plural=e=>/.*s$/.test(e)?e:e+"s",t.FUNCTIONS.fontRegexp=function(e){return new RegExp("((^"+e+" )|( "+e+"$))")},t.ALPHABETS.combiner=_e.prefixCombiner,t.ALPHABETS.digitTrans.default=Qe.numberToWords,t.CORRECTIONS.article=e=>P.getInstance().getParameter("noArticle")?"":e,t})()),yt},ca:function(){return Wt||(Wt=(function(){const t=h();return t.NUMBERS=dt,t.COMBINERS.sansserif=bn,t.FUNCTIONS.fracNestDepth=e=>!1,t.FUNCTIONS.combineRootIndex=S,t.FUNCTIONS.combineNestedRadical=(e,n,r)=>e+r,t.FUNCTIONS.fontRegexp=e=>RegExp("^"+e+" "),t.FUNCTIONS.plural=e=>/.*os$/.test(e)?e+"sos":/.*s$/.test(e)?e+"os":/.*ga$/.test(e)?e.slice(0,-2)+"gues":/.*\xe7a$/.test(e)?e.slice(0,-2)+"ces":/.*ca$/.test(e)?e.slice(0,-2)+"ques":/.*ja$/.test(e)?e.slice(0,-2)+"ges":/.*qua$/.test(e)?e.slice(0,-3)+"qües":/.*a$/.test(e)?e.slice(0,-1)+"es":/.*(e|i)$/.test(e)?e+"ns":/.*\xed$/.test(e)?e.slice(0,-1)+"ins":e+"s",t.FUNCTIONS.si=(e,n)=>(n.match(/^metre/)&&(e=e.replace(/a$/,"à").replace(/o$/,"ò").replace(/i$/,"í")),e+n),t.ALPHABETS.combiner=_e.prefixCombiner,t})()),Wt},da:function(){return Pn||(Pn=(function(){const t=h();return t.NUMBERS=It,t.FUNCTIONS.radicalNestDepth=m,t.FUNCTIONS.fontRegexp=e=>e===t.ALPHABETS.capPrefix.default?RegExp("^"+e+" "):RegExp(" "+e+"$"),t.ALPHABETS.combiner=_e.postfixCombiner,t.ALPHABETS.digitTrans.default=It.numberToWords,t})()),Pn},de:function(){return fr||(fr=(function(){const t=h();return t.NUMBERS=an,t.COMBINERS.germanPostfix=kr,t.ALPHABETS.combiner=So,t.FUNCTIONS.radicalNestDepth=e=>e>1?t.NUMBERS.numberToWords(e)+"fach":"",t.FUNCTIONS.combineRootIndex=(e,n)=>{const r=n?n+"wurzel":"";return e.replace("Wurzel",r)},t.FUNCTIONS.combineNestedRadical=(e,n,r)=>{const o=(n?n+" ":"")+(e=r.match(/exponent$/)?e+"r":e);return r.match(/ /)?r.replace(/ /," "+o+" "):o+" "+r},t.FUNCTIONS.fontRegexp=function(e){return e=e.split(" ").map(function(n){return n.replace(/s$/,"(|s)")}).join(" "),new RegExp("((^"+e+" )|( "+e+"$))")},t.CORRECTIONS.correctOne=e=>e.replace(/^eins$/,"ein"),t.CORRECTIONS.localFontNumber=e=>b(e).split(" ").map(function(n){return n.replace(/s$/,"")}).join(" "),t.CORRECTIONS.lowercase=e=>e.toLowerCase(),t.CORRECTIONS.article=e=>{const n=P.getInstance().getParameter("case"),r=P.getInstance().getParameter("plural");return n==="dative"?{der:"dem",die:r?"den":"der",das:"dem"}[e]:e},t.CORRECTIONS.masculine=e=>P.getInstance().getParameter("case")==="dative"?e+"n":e,t})()),fr},en:function(){return mr||(mr=(function(){const t=h();return t.NUMBERS=jt,t.FUNCTIONS.radicalNestDepth=m,t.FUNCTIONS.plural=e=>/.*s$/.test(e)?e:e+"s",t.ALPHABETS.combiner=_e.prefixCombiner,t.ALPHABETS.digitTrans.default=jt.numberToWords,t.CORRECTIONS.article=e=>P.getInstance().getParameter("noArticle")?"":e,t})()),mr},es:function(){return xn||(xn=(function(){const t=h();return t.NUMBERS=Qt,t.COMBINERS.sansserif=Gr,t.FUNCTIONS.fracNestDepth=e=>!1,t.FUNCTIONS.combineRootIndex=S,t.FUNCTIONS.combineNestedRadical=(e,n,r)=>e+r,t.FUNCTIONS.fontRegexp=e=>RegExp("^"+e+" "),t.FUNCTIONS.plural=e=>/.*(a|e|i|o|u)$/.test(e)?e+"s":/.*z$/.test(e)?e.slice(0,-1)+"ces":/.*c$/.test(e)?e.slice(0,-1)+"ques":/.*g$/.test(e)?e+"ues":/.*\u00f3n$/.test(e)?e.slice(0,-2)+"ones":e+"es",t.FUNCTIONS.si=(e,n)=>(n.match(/^metro/)&&(e=e.replace(/a$/,"á").replace(/o$/,"ó").replace(/i$/,"í")),e+n),t.ALPHABETS.combiner=_e.prefixCombiner,t})()),xn},euro:function(){return Fn||(Fn=h()),Fn},fr:function(){return A||(A=(function(){const t=h();return t.NUMBERS=N,t.FUNCTIONS.radicalNestDepth=m,t.FUNCTIONS.combineRootIndex=S,t.FUNCTIONS.combineNestedFraction=(e,n,r)=>r.replace(/ $/g,"")+n+e,t.FUNCTIONS.combineNestedRadical=(e,n,r)=>r+" "+e,t.FUNCTIONS.fontRegexp=e=>RegExp(" (en |)"+e+"$"),t.FUNCTIONS.plural=e=>/.*s$/.test(e)?e:e+"s",t.CORRECTIONS.article=e=>P.getInstance().getParameter("noArticle")?"":e,t.ALPHABETS.combiner=_e.romanceCombiner,t.SUBISO={default:"fr",current:"fr",all:["fr","be","ch"]},t})()),A},hi:function(){return We||(We=(function(){const t=h();return t.NUMBERS=$,t.ALPHABETS.combiner=_e.prefixCombiner,t.FUNCTIONS.radicalNestDepth=m,t})()),We},it:function(){return pi||(pi=(function(){const t=h();return t.NUMBERS=cn,t.COMBINERS.italianPostfix=ll,t.FUNCTIONS.radicalNestDepth=m,t.FUNCTIONS.combineRootIndex=S,t.FUNCTIONS.combineNestedFraction=(e,n,r)=>r.replace(/ $/g,"")+n+e,t.FUNCTIONS.combineNestedRadical=(e,n,r)=>r+" "+e,t.FUNCTIONS.fontRegexp=e=>RegExp(" (en |)"+e+"$"),t.ALPHABETS.combiner=_e.romanceCombiner,t})()),pi},ko:function(){return fi||(fi=(function(){const t=h();return t.NUMBERS=Mt,t.FUNCTIONS.radicalNestDepth=m,t.FUNCTIONS.plural=function(e){return e},t.FUNCTIONS.si=(e,n)=>e+n,t.FUNCTIONS.combineRootIndex=function(e,n){return e+n},t.ALPHABETS.combiner=_e.prefixCombiner,t.ALPHABETS.digitTrans.default=Mt.numberToWords,t.CORRECTIONS.postposition=e=>{if(["같다","는","와","를","로"].includes(e))return e;const n=e.slice(-1);let r=(n.charCodeAt(0)-44032)%28>0;return n.match(/[r,l,n,m,1,3,6,7,8,0]/i)&&(r=!0),P.getInstance().setParameter("final",r),e},t.CORRECTIONS.article=e=>{const n=P.getInstance().getParameter("final");n&&P.getInstance().setParameter("final",!1),e==="같다"&&(e="는");const r={는:"은",와:"과",를:"을",로:"으로"}[e];return r!==void 0&&n?r:e},t})()),fi},nb:function(){return mi||(mi=(function(){const t=h();return t.NUMBERS=Je,t.ALPHABETS.combiner=_e.prefixCombiner,t.ALPHABETS.digitTrans.default=Je.numberToWords,t.FUNCTIONS.radicalNestDepth=m,t})()),mi},nn:function(){return Ei||(Ei=(function(){const t=h();return t.NUMBERS=Je,t.ALPHABETS.combiner=_e.prefixCombiner,t.ALPHABETS.digitTrans.default=Je.numberToWords,t.FUNCTIONS.radicalNestDepth=m,t.SUBISO={default:"",current:"",all:["","alt"]},t})()),Ei},sv:function(){return Ni||(Ni=(function(){const t=h();return t.NUMBERS=ln,t.FUNCTIONS.radicalNestDepth=m,t.FUNCTIONS.fontRegexp=function(e){return new RegExp("((^"+e+" )|( "+e+"$))")},t.ALPHABETS.combiner=_e.prefixCombiner,t.ALPHABETS.digitTrans.default=ln.numberToWords,t.CORRECTIONS.correctOne=e=>e.replace(/^ett$/,"en"),t})()),Ni},nemeth:function(){return Io||(Io=(function(){const t=h();return t.NUMBERS=gi,t.COMBINERS={postfixCombiner:dl,germanCombiner:fl,embellishCombiner:pl,doubleEmbellishCombiner:ml,parensCombiner:gl},t.FUNCTIONS.fracNestDepth=e=>!1,t.FUNCTIONS.fontRegexp=e=>RegExp("^"+e),t.FUNCTIONS.si=_t,t.ALPHABETS.combiner=(e,n,r)=>n?n+r+e:gr(e),t.ALPHABETS.digitTrans={default:gi.numberToWords},t})()),Io}};function Ti(){const t=(function(){const e=x.ensureLocale(L.getInstance().options.locale,L.getInstance().defaultLocale);return L.getInstance().options.locale=e,Si[e]()})();if((function(e){const n=L.getInstance().options.subiso;e.SUBISO.all.indexOf(n)===-1&&(L.getInstance().options.subiso=e.SUBISO.default),e.SUBISO.current=L.getInstance().options.subiso})(t),t){for(const e of Object.getOwnPropertyNames(t))I[e]=t[e];for(const[e,n]of Object.entries(t.CORRECTIONS))P.getInstance().setCorrection(e,n)}}var Nl=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};const Rn={functionApplication:String.fromCodePoint(8289),invisibleTimes:String.fromCodePoint(8290),invisibleComma:String.fromCodePoint(8291),invisiblePlus:String.fromCodePoint(8292)};class Sl extends Map{get(e){return super.get(e)||{role:d.UNKNOWN,type:l.UNKNOWN,font:be.UNKNOWN}}}class Tl extends Map{set(e,n,r=""){return super.set(this.secKey(n,e),r||n),this}has(e,n){return super.has(this.secKey(n,e))}get(e,n){return super.get(this.secKey(n,e))}secKey(e,n){return n?`${e} ${n}`:`${e}`}}const Fe={Meaning:new Sl,Secondary:new Tl,FencesHoriz:new Map,FencesVert:new Map,FencesSecondary:new Map,LatexCommands:new Map};function Un(t,e){for(const n of t)Fe.Meaning.set(n,{role:e.role||d.UNKNOWN,type:e.type||l.UNKNOWN,font:e.font||be.UNKNOWN}),e.secondary&&Fe.Secondary.set(n,e.secondary)}function Hr(t,e,n=1){const r={},o=(function(i){let s=[];for(const c of i)Array.isArray(c)?s=s.concat(Bt(c,{}).map(p=>parseInt(p,16))):s.push(parseInt(c,16));return s})(e);for(const i of o)r[i]||(t.set(String.fromCodePoint(i),String.fromCodePoint(i+n)),r[i]=!0,r[i+n]=!0)}const Il=["0028","0029","207D","207E","208D","208E","2768","2769","276A","276B","27EE","27EF","FE59","FE5A","FF08","FF09"],Al=["005B","005D","2045","2046","298B","298C","298D","298E","298F","2990","FF3B","FF3D"],bl=["007B","007D","2774","2775","FE5B","FE5C","FF5B","FF5D"],Ol=["2308","2309","2E22","2E23","300C","300E","FF62"],Rl=["230A","230B","2E24","2E25","300D","300F","FF63"];function jr(t,e){for(const n of t){const r=String.fromCodePoint(parseInt(n,16));Fe.Secondary.set(r,e),Fe.FencesSecondary.set(r,e)}}const yl=["cos","cot","csc","sec","sin","tan","arccos","arccot","arccsc","arcsec","arcsin","arctan"].concat(["cosh","coth","csch","sech","sinh","tanh","arcosh","arcoth","arcsch","arsech","arsinh","artanh"],["deg","det","dim","hom","ker","Tr"],["log","ln","lg","exp","gcd","lcm","arg","im","re","Pr"]);function Cl(t,e){Un(e,Fe.Meaning.get(t)||{type:l.FUNCTION,role:d.PREFIXFUNC})}function $r(t,e,n,r,o,i=[],s={},c={}){const p=wt.get(Yt(t,r));p&&(p.unicode.forEach(E=>{Fe.Meaning.set(E,{type:e,role:n,font:o}),i.forEach(T=>Fe.Secondary.set(E,T))}),(function(E,T){for(const[C,pe]of Object.entries(T)){const Ne=E[C];Ne!==void 0&&Fe.Meaning.set(Ne,pe)}})(p.unicode,s),(function(E,T){for(const[C,pe]of Object.entries(T)){const Ne=E[C];Ne!==void 0&&Fe.Secondary.set(Ne,pe)}})(p.unicode,c))}[{set:["23","26","40","5c","a1","a7","b6","bf","2017",["2022","2025"],"2027","203b","203c",["2041","2043"],["2047","2049"],["204b","204d"],"2050","2055","2056",["2058","205e"],"2234","2235","fe45","fe46","fe5f","fe60","fe68","fe6b","ff03","ff06","ff0f","ff20","ff3c"],type:l.PUNCTUATION,role:d.UNKNOWN},{set:["22","ab","bb","2dd",["2018","201f"],"2039","203a",["301d","301f"],"fe10","ff02","ff07"],type:l.PUNCTUATION,role:d.QUOTES},{set:["3b","204f","2a1f","2a3e","fe14","fe54","ff1b"],type:l.PUNCTUATION,role:d.SEMICOLON},{set:["3f","203d","fe16","fe56","ff1f"],type:l.PUNCTUATION,role:d.QUESTION},{set:["21","fe15","fe57","ff01"],type:l.PUNCTUATION,role:d.EXCLAMATION},{set:["5e","60","a8","aa","b4","ba","2c7",["2d8","2da"],"2040","207a","207d","207e","ff3e","ff40"],type:l.PUNCTUATION,role:d.OVERACCENT},{set:["b8","2db","2038","203f","2054","208a","208d","208e"],type:l.PUNCTUATION,role:d.UNDERACCENT},{set:["3a","2982","fe13","fe30","fe55","ff1a"],type:l.PUNCTUATION,role:d.COLON},{set:["2c","2063","fe50","ff0c"],type:l.PUNCTUATION,role:d.COMMA},{set:["2026",["22ee","22f1"],"fe19"],type:l.PUNCTUATION,role:d.ELLIPSIS},{set:["2e","fe52","ff0e"],type:l.PUNCTUATION,role:d.FULLSTOP},{set:["2d","207b","208b","2212","2796","fe63","ff0d"],type:l.OPERATOR,role:d.DASH,secondary:Ye.BAR},{set:["5f","af",["2010","2015"],"203e","208b",["fe49","fe4f"],"fe58","ff3f","ffe3"],type:l.PUNCTUATION,role:d.DASH,secondary:Ye.BAR},{set:["7e","2dc","2f7","303","330","334","2053","223c","223d","301c","ff5e"],type:l.OPERATOR,role:d.TILDE,secondary:Ye.TILDE},{set:["27","2b9","2ba",["2032","2037"],"2057"],type:l.PUNCTUATION,role:d.PRIME},{set:["b0"],type:l.PUNCTUATION,role:d.DEGREE},{set:["2b","b1","2064","2213","2214","2228","222a",["228c","228e"],"2294","2295","229d","229e","22bb","22bd","22c4","22ce","22d3","2304","271b","271c","2795","27cf","29fa","29fb","29fe",["2a22","2a28"],"2a2d","2a2e","2a39","2a42","2a45","2a46","2a48","2a4a","2a4c","2a4f","2a50","2a52","2a54","2a56","2a57","2a59","2a5b","2a5d",["2a61","2a63"],"2adc","2add","fe62","ff0b"],type:l.OPERATOR,role:d.ADDITION},{set:["2a","b7","d7","2020","2021","204e","2051","2062",["2217","2219"],"2227","2229","2240","2293","2297",["2299","229b"],"22a0","22a1","22b9","22bc",["22c5","22cc"],"22cf","22d2","22d4","2303","2305","2306","25cb","2715","2716","27ce","27d1",["29d1","29d7"],"29e2","2a1d",["2a2f","2a37"],["2a3b","2a3d"],"2a40","2a43","2a44","2a47","2a49","2a4b","2a4d","2a4e","2a51","2a53","2a55","2a58","2a5a","2a5c",["2a5e","2a60"],"2ada","2adb","fe61","ff0a"],type:l.OPERATOR,role:d.MULTIPLICATION},{set:["2d","af","2010","2011","2052","207b","208b","2212","2216","2238","2242","2296","229f","2796","29ff",["2a29","2a2c"],"2a3a","2a41","fe63","ff0d"],type:l.OPERATOR,role:d.SUBTRACTION},{set:["2f","f7","2044","2215","2298","2797","27cc","29bc",["29f5","29f9"],"2a38"],type:l.OPERATOR,role:d.DIVISION},{set:["25","2030","2031","ff05","fe6a"],type:l.OPERATOR,role:d.POSTFIXOP},{set:["ac","2200","2201","2203","2204","2206",["221a","221c"],"2310","ffe2"],type:l.OPERATOR,role:d.PREFIXOP},{set:["2320","2321","23aa","23ae","23af","23b2","23b3","23b6","23b7"],type:l.OPERATOR,role:d.PREFIXOP},{set:["1d7ca","1d7cb"],type:l.OPERATOR,role:d.PREFIXOP,font:be.BOLD},{set:["3d","7e","207c","208c","221d","2237",["223a","223f"],"2243","2245","2248",["224a","224e"],["2251","225f"],"2261","2263","229c","22cd","22d5","29e4","29e6","2a66","2a67",["2a6a","2a6c"],["2a6c","2a78"],"fe66","ff1d"],type:l.RELATION,role:d.EQUALITY},{set:["3c","3e","2241","2242","2244","2246","2247","2249","224f","2250","2260","2262",["2264","2281"],"22b0","22b1",["22d6","22e1"],["22e6","22e9"],["2976","2978"],"29c0","29c1","29e1","29e3","29e5",["2a79","2abc"],["2af7","2afa"],"fe64","fe65","ff1c","ff1e"],type:l.RELATION,role:d.INEQUALITY},{set:[["2282","228b"],["228f","2292"],["22b2","22b8"],"22d0","22d1",["22e2","22e5"],["22ea","22ed"],"27c3","27c4",["27c7","27c9"],["27d5","27d7"],"27dc",["2979","297b"],"29df",["2abd","2ad8"]],type:l.RELATION,role:d.SET},{set:["2236",["27e0","27e5"],"292b","292c",["29b5","29bb"],"29be","29bf",["29c2","29d0"]],type:l.RELATION,role:d.UNKNOWN},{set:["2205",["29b0","29b4"]],type:l.IDENTIFIER,role:d.SETEMPTY},{set:["1ab2","221e",["29dc","29de"]],type:l.IDENTIFIER,role:d.INFTY},{set:["22a2","22a3",["22a6","22af"],"27da","27db","27dd","27de","2ade",["2ae2","2ae6"],"2aec","2aed"],type:l.RELATION,role:d.LOGIC},{set:["22a4","22a5","22ba","27d8","27d9","27df","2adf","2ae0",["2ae7","2aeb"],"2af1"],type:l.IDENTIFIER,role:d.LOGIC},{set:[["2190","21ff"],"2301","2324","238b","2794",["2798","27af"],["27b1","27be"],["27f0","27ff"],["2900","292a"],["292d","2975"],["297c","297f"],["2b00","2b11"],["2b30","2b4c"],["ffe9","ffec"]],type:l.RELATION,role:d.ARROW},{set:["2208","220a",["22f2","22f9"],"22ff","27d2","2ad9"],type:l.OPERATOR,role:d.ELEMENT},{set:["2209"],type:l.OPERATOR,role:d.NONELEMENT},{set:["220b","220d",["22fa","22fe"]],type:l.OPERATOR,role:d.REELEMENT},{set:["220c"],type:l.OPERATOR,role:d.RENONELEMENT},{set:[["220f","2211"],["22c0","22c3"],["2a00","2a0b"],"2a3f","2afc","2aff"],type:l.LARGEOP,role:d.SUM},{set:["2140"],type:l.LARGEOP,role:d.SUM,font:be.DOUBLESTRUCK},{set:[["222b","2233"],["2a0c","2a17"],["2a17","2a1c"]],type:l.LARGEOP,role:d.INTEGRAL},{set:[["2500","257F"]],type:l.RELATION,role:d.BOX},{set:[["2580","259F"]],type:l.IDENTIFIER,role:d.BLOCK},{set:[["25A0","25FF"],["2B12","2B2F"],["2B50","2B59"]],type:l.RELATION,role:d.GEOMETRY},{set:["220e","2300","2302","2311","29bd","29e0",["29e8","29f3"],"2a1e","2afe","ffed","ffee"],type:l.OPERATOR,role:d.GEOMETRY},{set:[["221f","2222"],"22be","22bf",["2312","2314"],"237c","27c0",["299b","29af"]],type:l.OPERATOR,role:d.GEOMETRY},{set:["24",["a2","a5"],"b5","2123",["2125","2127"],"212a","212b","fe69","ff04","ffe0","ffe1","ffe5","ffe6"],type:l.IDENTIFIER,role:d.UNKNOWN},{set:["a9","ae","210f","2114","2116","2117",["211e","2122"],"212e","2132",["2139","213b"],["2141","2144"],"214d","214e",["1f12a","1f12c"],"1f18a"],type:l.IDENTIFIER,role:d.OTHERLETTER},{set:["2224","2226","2239","2307","27b0","27bf","27c1","27c2","27ca","27cb","27cd","27d0","27d3","27d4","2981","2999","299a","29e7","29f4","2a20","2a21","2a64","2a65","2a68","2a69","2ae1",["2aee","2af0"],"2af2","2af3","2af5","2af6","2afb","2afd"],type:l.OPERATOR,role:d.UNKNOWN},{set:["2605","2606","26aa","26ab",["2720","274d"]],type:l.OPERATOR,role:d.UNKNOWN},{set:[["2145","2149"]],type:l.IDENTIFIER,role:d.LATINLETTER,font:be.DOUBLESTRUCKITALIC,secondary:Ye.ALLLETTERS},{set:[["213c","213f"]],type:l.IDENTIFIER,role:d.GREEKLETTER,font:be.DOUBLESTRUCK,secondary:Ye.ALLLETTERS},{set:["3d0","3d7","3f6",["1d26","1d2a"],"1d5e","1d60",["1d66","1d6a"]],type:l.IDENTIFIER,role:d.GREEKLETTER,font:be.NORMAL,secondary:Ye.ALLLETTERS},{set:[["2135","2138"]],type:l.IDENTIFIER,role:d.OTHERLETTER,font:be.NORMAL,secondary:Ye.ALLLETTERS},{set:["131","237"],type:l.IDENTIFIER,role:d.LATINLETTER,font:be.NORMAL},{set:["1d6a4","1d6a5"],type:l.IDENTIFIER,role:d.LATINLETTER,font:be.ITALIC},{set:["2113","2118"],type:l.IDENTIFIER,role:d.LATINLETTER,font:be.SCRIPT},{set:[["c0","d6"],["d8","f6"],["f8","1bf"],["1c4","2af"],["1d00","1d25"],["1d6b","1d9a"],["1e00","1ef9"],["363","36f"],["1dd3","1de6"],["1d62","1d65"],"1dca","2071","207f",["2090","209c"],"2c7c"],type:l.IDENTIFIER,role:d.LATINLETTER,font:be.NORMAL},{set:[["00bc","00be"],["2150","215f"],"2189"],type:l.NUMBER,role:d.FLOAT},{set:["23E8",["3248","324f"]],type:l.NUMBER,role:d.INTEGER},{set:[["214A","214C"],"2705","2713","2714","2717","2718"],type:l.IDENTIFIER,role:d.UNKNOWN},{set:["20","a0","ad",["2000","200f"],["2028","202f"],["205f","2060"],"206a","206b","206e","206f","feff",["fff9","fffb"]],type:l.TEXT,role:d.SPACE},{set:["7c","a6","2223","23b8","23b9","23d0","2758",["fe31","fe34"],"ff5c","ffe4","ffe8"],type:l.FENCE,role:d.NEUTRAL},{set:["2016","2225","2980","2af4"],type:l.FENCE,role:d.METRIC}].forEach(t=>{var{set:e}=t,n=Nl(t,["set"]);return Un((function(r){let o=[];for(const i of r)Array.isArray(i)?o=o.concat(Ue(i)):o.push(String.fromCodePoint(parseInt(i,16)));return o})(e),n)}),Hr(Fe.FencesVert,["23b4",["23dc","23e1"],["fe35","fe44"],"fe47"]),Hr(Fe.FencesHoriz,["28","2045","207D","208D",["2308","230f"],["231c","231f"],"2329","23b0",["2768","2775"],"27c5",["27e6","27ef"],["2983","2998"],["29d8","29db"],"29fc",["2e22","2e29"],["3008","3011"],["3014","301b"],"fd3e","fe17",["fe59","fe5e"],"ff08","ff5f","ff62"]),Hr(Fe.FencesHoriz,["5b","7b","ff3b","ff5b"],2),Hr(Fe.FencesHoriz,[["239b","23a6"]],3),Hr(Fe.FencesHoriz,[["23a7","23a9"]],4),Un([...Fe.FencesHoriz.keys()],{type:l.FENCE,role:d.OPEN}),Un([...Fe.FencesHoriz.values()],{type:l.FENCE,role:d.CLOSE}),Un([...Fe.FencesVert.keys()],{type:l.FENCE,role:d.TOP}),Un([...Fe.FencesVert.values()],{type:l.FENCE,role:d.BOTTOM}),jr(Il,Ye.PAREN),jr(bl,Ye.CURLY),jr(Al,Ye.BRACKET),jr(Ol,Ye.CEIL),jr(Rl,Ye.FLOOR),(function(){for(const[t,e]of Object.entries(be)){const n=xe[t]?be.UNKNOWN:e===be.FULLWIDTH?be.NORMAL:e;$r(j.LATINCAP,l.IDENTIFIER,d.LATINLETTER,e,n,[Ye.ALLLETTERS]),$r(j.LATINSMALL,l.IDENTIFIER,d.LATINLETTER,e,n,[Ye.ALLLETTERS],{},{3:Ye.D}),$r(j.GREEKCAP,l.IDENTIFIER,d.GREEKLETTER,e,n,[Ye.ALLLETTERS]),$r(j.GREEKSMALL,l.IDENTIFIER,d.GREEKLETTER,e,n,[Ye.ALLLETTERS],{0:{type:l.OPERATOR,role:d.PREFIXOP,font:n},26:{type:l.OPERATOR,role:d.PREFIXOP,font:n}}),$r(j.DIGIT,l.NUMBER,d.INTEGER,e,n)}})(),Un(["inf","lim","liminf","limsup","max","min","sup","injlim","projlim"],{type:l.FUNCTION,role:d.LIMFUNC}),Un(yl,{type:l.FUNCTION,role:d.PREFIXFUNC}),Un(["mod","rem"],{type:l.OPERATOR,role:d.PREFIXFUNC});class Ao{constructor(){this.rules=new Map}static parseUnicode(e){const n=parseInt(e,16);return String.fromCodePoint(n)}static testDynamicConstraints_(e,n){return L.getInstance().options.strict?n.cstr.equal(e):L.getInstance().comparator.match(n.cstr)}defineRulesFromMappings(e,n,r){for(const[o,i]of Object.entries(r))for(const[s,c]of Object.entries(i))this.defineRuleFromStrings(e,n,o,s,c)}getRules(e){let n=this.rules.get(e);return n||(n=[],this.rules.set(e,n)),n}defineRuleFromStrings(e,n,r,o,i){let s=this.getRules(e);const c=L.getInstance().parsers[r]||L.getInstance().defaultParser,p=L.getInstance().comparators[r],E=`${e}.${n}.${r}.${o}`,T=c.parse(E),C=p?p():L.getInstance().comparator,pe=C.getReference();C.setReference(T);const Ne={cstr:T,action:i};s=s.filter(ae=>!T.equal(ae.cstr)),s.push(Ne),this.rules.set(e,s),C.setReference(pe)}lookupRule(e,n){let r=this.getRules(n.getValue(O.LOCALE));return r=r.filter(function(o){return Ao.testDynamicConstraints_(n,o)}),r.length===1?r[0]:r.length?r.sort((o,i)=>L.getInstance().comparator.compare(o.cstr,i.cstr))[0]:null}}let _n=D.DEFAULT_VALUES[O.LOCALE],Xr=D.DEFAULT_VALUES[O.MODALITY];function Yr(t){return!(!t.locale&&!t.modality)&&(_n=t.locale||_n,Xr=t.modality||Xr,!0)}let Ii={};function Ll(t){Ii=t}const Wr=new Map,Er=new Map;function xs(t,e){let n=Wr.get(e);return n||(n=new Ao,n.base=Er.get(t),Wr.set(e,n),n)}function Fs(t){const e=Er.get(t.key);if(!e)return;const n=t.names;Object.assign(t,e),n&&e.names&&(t.names=t.names.concat(n))}function Us(t,e,n){xs(t,e).defineRulesFromMappings(_n,Xr,n)}function _s(t,e,n,r){xs(n,n).defineRuleFromStrings(_n,Xr,t,e,r)}function Ml(t){if(!Yr(t))for(const[e,n]of Object.entries(t))_s("default","default",e,n)}function Ai(t){for(let e,n=0;e=t.names[n];n++)Us(t.key,e,t.mappings)}function vl(t){for(const e of Object.keys(Ii)){const n=Object.assign({},t);n.mappings={};const r=Ii[e];n.names=n.names.map(function(o){return e+o});for(const o of Object.keys(t.mappings)){n.mappings[o]={};for(const i of Object.keys(t.mappings[o]))n.mappings[o][i]=Si[_n]().FUNCTIONS.si(r,t.mappings[o][i])}Ai(n)}}function Kr(t){const e=Wr.get(t);return e?.base?e.base.category:""}function ks(t={}){for(const e of Wr.values())for(const[,n]of e.rules.entries())for(const{cstr:r}of n)t=Bs(r.getValues(),t);return t}function Bs(t,e){return e=e||{},t.length&&(e[t[0]]=Bs(t.slice(1),e[t[0]])),e}L.getInstance().evaluator=function(t,e){const n=(function(r,o){const i=Wr.get(r);return i?i.lookupRule(null,o):null})(t,e);return n?n.action:null};class W{constructor(e,n){this.speech=e,this.attributes=n}static empty(){return new W("",{})}static stringEmpty(e){return new W(e,{})}static stringAttr(e,n){return new W(e,n)}static singleton(e,n={}){return[W.stringAttr(e,n)]}static node(e,n,r={}){const o=W.getAttributes(n);return Object.assign(o,r),new W(e,o)}static getAttributes(e){const n={};for(const r of W.attributeList)e.hasAttribute(r)&&(n[r]=e.getAttribute(r));return n}}W.attributeList=["id","extid"];class bi{constructor(e=null){this.data=e,this.prev=null,this.next=null}}class Dl extends Set{constructor(e){super(),this.annotations=[],this.anchor=new bi,this.anchor.next=this.anchor,this.anchor.prev=this.anchor,e.forEach(n=>{const r=new bi(n);n.annotation&&this.annotations.push(r),this.push(r)})}first(){return this.empty?null:this.anchor.next}last(){return this.empty?null:this.anchor.prev}push(e){e.next=this.anchor,e.prev=this.anchor.prev,e.prev.next=e,this.anchor.prev=e,super.add(e)}pop(){const e=this.last();return e?(this.delete(e),e):null}delete(e){return!!this.has(e)&&(super.delete(e),e.prev.next=e.next,e.next=e.prev,!0)}insertAfter(e,n){this.insertBefore(e,n.next)}insertBefore(e,n){const r=new bi(e);n&&this.has(n)?(n.prev.next=r,r.prev=n.prev,r.next=n,n.prev=r):this.push(r)}prevText(e){do e=e.prev;while(e!==this.anchor&&!e.data.text);return e===this.anchor?null:e}*[Symbol.iterator](){let e=this.anchor.next;for(;e!==this.anchor;)yield e,e=e.next}nextText(e){for(;e!==this.anchor&&!e.data.text;)e=e.next;return e}clear(){this.anchor.next=this.anchor,this.anchor.prev=this.anchor,super.clear()}empty(){return this.anchor.prev===this.anchor&&this.anchor===this.anchor.next}toList(){const e=[];let n=this.anchor.next;for(;n!==this.anchor;)e.push(n.data),n=n.next;return e}}class Ke{static create(e,n={}){return e.text=P.getInstance().apply(e.text,n),new Ke(e)}constructor({context:e,text:n,userValue:r,annotation:o,attributes:i,personality:s,layout:c}){this.context=e||"",this.text=n||"",this.userValue=r||"",this.annotation=o||"",this.attributes=i||{},this.personality=s||{},this.layout=c||""}isEmpty(){return this.context.length===0&&this.text.length===0&&this.userValue.length===0&&this.annotation.length===0}clone(){let e,n;if(this.personality){e={};for(const[r,o]of Object.entries(this.personality))e[r]=o}if(this.attributes){n={};for(const[r,o]of Object.entries(this.attributes))n[r]=o}return new Ke({context:this.context,text:this.text,userValue:this.userValue,annotation:this.annotation,personality:e,attributes:n,layout:this.layout})}toString(){return'AuditoryDescription(context="'+this.context+'" text="'+this.text+'" userValue="'+this.userValue+'" annotation="'+this.annotation+'")'}descriptionString(){return this.context&&this.text?this.context+" "+this.text:this.context||this.text}descriptionSpan(){return W.stringAttr(this.descriptionString(),this.attributes)}equals(e){return this.context===e.context&&this.text===e.text&&this.userValue===e.userValue&&this.annotation===e.annotation}}const zr=new Map;function pn(t,e,n){const r={};if(e){const o=zr.get(e)||{};Object.assign(r,o)}zr.set(t,Object.assign(r,n))}function Gs(t,e){const n=t.length;let r=0,o=e;return e||(o=""),function(){return r<n&&(r+=1),o+" "+r}}function wl(t,e){const n=parseFloat(e),r=isNaN(n)?e:n;return function(){return[Ke.create({text:"",personality:{pause:r}})]}}function bo(t,e){let n;return n=t.length>0?he("../../content/*",t[0]):[],function(){const r=n.shift(),o=e?[Ke.create({text:e},{translate:!0})]:[];if(!r)return o;const i=L.evaluateNode(r);return o.concat(i)}}function Pl(t,e){const n=e.split("-"),r=Gs(t,n[0]||""),o=n[1]||"",i=n[2]||"";let s=!0;return function(){const c=r();return s?(s=!1,i+c+o):c+o}}function xl(t){if((function(r){if(!r.hasAttribute("annotation"))return!1;const o=r.getAttribute("annotation");return!!/clearspeak:simple$|clearspeak:simple;/.exec(o)})(t))return!0;if(t.tagName!==l.SUBSCRIPT)return!1;const e=t.childNodes[0].childNodes,n=e[1];return e[0].tagName===l.IDENTIFIER&&(Vs(n)||n.tagName===l.INFIXOP&&n.hasAttribute("role")&&n.getAttribute("role")===d.IMPLICIT&&(function(r){return he("children/*",r).every(o=>Vs(o)||o.tagName===l.IDENTIFIER)})(n))}function Vs(t){return t.tagName===l.NUMBER&&t.hasAttribute("role")&&t.getAttribute("role")===d.INTEGER}function Fl(t){return he(t.tagName===l.MATRIX?"children/row/children/cell/children/*":"children/line/children/*",t).every(xl)?[t]:[]}function Ul(t){return qn(t,20,11)?[t]:[]}function _l(t){const e=parseInt(t.textContent,10);return[W.stringEmpty(isNaN(e)?t.textContent:e>10?I.NUMBERS.numericOrdinal(e):I.NUMBERS.wordOrdinal(e))]}let Hs=null;function kl(t){let e=0;const n=t.textContent,r=t.getAttribute("role")==="open"?0:1;let o=t.parentNode;for(;o;)o.tagName===l.FENCED&&o.childNodes[0].childNodes[r].textContent===n&&e++,o=o.parentNode;return Hs=e>1?I.NUMBERS.wordOrdinal(e):"",[W.stringEmpty(Hs)]}function Bl(t){const e=t.previousSibling;let n,r;return e?(n=e,r=t):(n=t,r=t.nextSibling),r&&(function(o,i){const s=Fe.Meaning.get(o);return s.type===l.FENCE&&(s.role===d.NEUTRAL||s.role===d.METRIC?o===i:Fe.FencesHoriz.get(o)===i||Fe.FencesVert.get(o)===i)})(n.textContent,r.textContent)?[t]:[]}function Gl(t){const e=Ae(t.parentNode.childNodes),n=he("../../children/*",t),r=e.indexOf(t);return $s(n[r])||$s(n[r+1])?[t]:[]}function Vl(t){const e=Ae(t.parentNode.childNodes),n=he("../../children/*",t),r=e.indexOf(t);return js(n[r])&&n[r+1]&&(js(n[r+1])||n[r+1].tagName===l.ROOT||n[r+1].tagName===l.SQRT||n[r+1].tagName===l.SUPERSCRIPT&&n[r+1].childNodes[0].childNodes[0]&&(n[r+1].childNodes[0].childNodes[0].tagName===l.NUMBER||n[r+1].childNodes[0].childNodes[0].tagName===l.IDENTIFIER)&&(n[r+1].childNodes[0].childNodes[1].textContent==="2"||n[r+1].childNodes[0].childNodes[1].textContent==="3"))?[t]:[]}function js(t){return!!t&&(t.tagName===l.NUMBER||t.tagName===l.IDENTIFIER||t.tagName===l.FUNCTION||t.tagName===l.APPL||t.tagName===l.FRACTION)}function $s(t){return t&&(t.tagName===l.FENCED||t.hasAttribute("role")&&t.getAttribute("role")===d.LEFTRIGHT||(function(e){return!!e&&(e.tagName===l.MATRIX||e.tagName===l.VECTOR)})(t))}function Hl(t){return[W.stringEmpty(I.NUMBERS.wordOrdinal(parseInt(t.textContent,10)))]}function jl(t){return Kr(t.textContent+":unit")?[t]:[]}function Oo(t,e){const n=[];for(;t.length||e.length;)t.length&&n.push(t.shift()),e.length&&n.push(e.shift());return n}function Oi(t,e){return t?e?t.filter(n=>e.indexOf(n)<0):t:[]}P.getInstance().setCorrection("insertNesting",function(t,e){if(!e||!t)return t;const n=t.match(/^(open|close) /);return n?n[0]+e+" "+t.substring(n[0].length):e+" "+t});const fe={factory:null,options:new te,updateFactory:function(t){fe.factory=t},heuristics:new Map,flags:{combine_juxtaposition:!0,convert_juxtaposition:!0,multioperator:!0},blacklist:{},add:function(t){const e=t.name;fe.heuristics.set(e,t),fe.flags[e]||(fe.flags[e]=!1)},run:function(t,e,n){const r=fe.heuristics.get(t);return r&&!fe.blacklist[t]&&(fe.flags[t]||r.applicable(e))?r.apply(e):n?n(e):e}},Xs=[];function Ys(t,e){for(let n,r=0;n=Xs[r];r++){const o=n.compare(t,e);if(o!==0)return o}return 0}function $l(t){if(t.length<=1)return t;const e=t.slice();(function(o){o.sort(Ys)})(e);const n=[];let r;do r=e.pop(),n.push(r);while(r&&e.length&&Ys(e[e.length-1],r)===0);return n}function Qr(t,e){return t.match(/^.+:.+$/)||!e?t:t+":"+e}new class{constructor(t,e=null){this.comparator=t,this.type=e,(function(n){Xs.push(n)})(this)}compare(t,e){return this.type&&this.type===t.type&&this.type===e.type?this.comparator(t,e):0}}(function(t,e){return t.role===d.SIMPLEFUNC?1:e.role===d.SIMPLEFUNC?-1:0},l.IDENTIFIER);class Ws extends Map{set(e,n){return super.set(Qr(e,n.font),n),this}setNode(e){this.set(e.textContent,e.meaning())}get(e,n=null){return super.get(Qr(e,n))}getNode(e){return this.get(e.textContent,e.font)}}class Ks extends Map{add(e,n){const r=this.get(e);r?r.push(n):super.set(e,[n])}get(e,n=null){return super.get(Qr(e,n))}getNode(e){return this.get(e.textContent,e.font)}minimize(){for(const[e,n]of this)n.length===1&&this.delete(e)}isMultiValued(){for(const e of this.values())if(e.length>1)return!0;return!1}}class Xl extends Ks{add(e,n){super.add(Qr(e,n.font),n)}addNode(e){this.add(e.textContent,e)}toString(){const e=[];for(const[n,r]of this){const o=Array(n.length+3).join(" "),i=r.map(s=>s.toString()).join(`
18
+ `+o);e.push(n+": "+i)}return e.join(`
19
+ `)}collateMeaning(){const e=new Yl;for(const[n,r]of this)e.set(n,r.map(o=>o.meaning()));return e}}class Yl extends Ks{add(e,n){const r=this.get(e,n.font);r&&r.find(function(o){return s=n,(i=o).type===s.type&&i.role===s.role&&i.font===s.font;var i,s})||super.add(Qr(e,n.font),n)}addNode(e){this.add(e.textContent,e.meaning())}toString(){const e=[];for(const[n,r]of this){const o=Array(n.length+3).join(" "),i=r.map(s=>`{type: ${s.type}, role: ${s.role}, font: ${s.font}}`).join(`
20
+ `+o);e.push(n+": "+i)}return e.join(`
21
+ `)}reduce(){for(const[e,n]of this)n.length!==1&&this.set(e,$l(n))}default(){const e=new Ws;for(const[n,r]of this)r.length===1&&e.set(n,r[0]);return e}newDefault(){const e=this.default();this.reduce();const n=this.default();return e.size!==n.size?n:null}}var v;(function(t){t.ANNOTATION="ANNOTATION",t.ANNOTATIONXML="ANNOTATION-XML",t.MACTION="MACTION",t.MALIGNGROUP="MALIGNGROUP",t.MALIGNMARK="MALIGNMARK",t.MATH="MATH",t.MENCLOSE="MENCLOSE",t.MERROR="MERROR",t.MFENCED="MFENCED",t.MFRAC="MFRAC",t.MGLYPH="MGLYPH",t.MI="MI",t.MLABELEDTR="MLABELEDTR",t.MMULTISCRIPTS="MMULTISCRIPTS",t.MN="MN",t.MO="MO",t.MOVER="MOVER",t.MPADDED="MPADDED",t.MPHANTOM="MPHANTOM",t.MPRESCRIPTS="MPRESCRIPTS",t.MROOT="MROOT",t.MROW="MROW",t.MS="MS",t.MSPACE="MSPACE",t.MSQRT="MSQRT",t.MSTYLE="MSTYLE",t.MSUB="MSUB",t.MSUBSUP="MSUBSUP",t.MSUP="MSUP",t.MTABLE="MTABLE",t.MTD="MTD",t.MTEXT="MTEXT",t.MTR="MTR",t.MUNDER="MUNDER",t.MUNDEROVER="MUNDEROVER",t.NONE="NONE",t.SEMANTICS="SEMANTICS"})(v||(v={}));const Wl=Object.values(v),Kl=[v.MO,v.MI,v.MN,v.MTEXT,v.MS,v.MSPACE],zs=[v.MERROR,v.MPHANTOM,v.MALIGNGROUP,v.MALIGNMARK,v.MPRESCRIPTS,v.ANNOTATION,v.ANNOTATIONXML],Qs=[v.MATH,v.MROW,v.MPADDED,v.MACTION,v.NONE,v.MSTYLE,v.SEMANTICS],zl=[v.MFRAC,v.MSUP,v.MSUB,v.MSUBSUP,v.MOVER,v.MUNDER,v.MUNDEROVER,v.MROOT,v.MMULTISCRIPTS],Ql=[v.MROOT,v.MSQRT],Jl=["aria-label","exact-speech","alt"];function Ro(t){return!!t&&Q(t)===v.MATH}function Ri(t){return!!t&&(zs.includes(Q(t))||!Wl.includes(Q(t)))}function Xn(t){return!!t&&Qs.includes(Q(t))}function ql(t){return!!t&&Q(t)===v.MGLYPH&&!(function(e){return!!e&&Kl.includes(Q(e))})(t.parentNode)}function Zl(t){return zl.includes(Q(t))}const Jr=1e4;function qr(t,e){let n=0;return()=>{if(++n>t)throw new ue(typeof e=="function"?e():e)}}function Nr(t,e){if(!t)return!1;const n=qr(Jr,"isDescendant cycle");let r=t.parentNode;for(;r;){if(n(),r===e)return!0;r=r.parentNode}return!1}function Sr(t){const e=[];for(let n,r=0;n=t[r];r++){if(n.nodeType!==He.ELEMENT_NODE)continue;const o=Q(n);zs.includes(o)||Qs.includes(o)&&n.childNodes.length===0||e.push(n)}return e}function yi(t,e){var n;if(!((n=e.attributes)===null||n===void 0)&&n.length){const r=e.attributes;for(let o=r.length-1;o>=0;o--){const i=r[o].name;i.match(/^ext/)&&(t.attributes[i]=r[o].value,t.nobreaking=!0),Jl.includes(i)&&(t.attributes["ext-speech"]=r[o].value,t.nobreaking=!0),i==="href"&&(t.attributes.href=r[o].value,t.nobreaking=!0),i.toLowerCase()!=="data-latex"&&i.toLowerCase()!=="latex"||(t.attributes.latex=r[o].value),i.match(/texclass$/)&&(t.attributes.texclass=r[o].value),i!=="color"&&i!=="mathcolor"||(t.attributes.color=r[o].value)}}}function Yn(t){return t&&t.embellished&&t.childNodes.length>0?Yn(t.childNodes[0]):t}function kn(t,e,n){n&&t.reverse();const r=[];for(let o,i=0;o=t[i];i++){if(e(o))return n?{head:t.slice(i+1).reverse(),div:o,tail:r.reverse()}:{head:r,div:o,tail:t.slice(i+1)};r.push(o)}return n?{head:[],div:null,tail:r.reverse()}:{head:r,div:null,tail:[]}}function nn(t,e){let n=t;const r=[],o=[];let i=null;do i=kn(n,e),o.push(i.head),r.push(i.div),n=i.tail;while(i.div);return r.pop(),{rel:r,comp:o}}function Js(t,e){if(t.mathmlTree)return;const n=new Set;if(e.forEach(r=>{var o;return n.add(((o=r.mathmlTree)===null||o===void 0?void 0:o.parentElement)||null)}),n.size===1&&!n.has(null)){const r=[...n][0];Xn(r)&&r.childNodes.length===e.length&&(t.mathmlTree=r);return}if(n.has(null)&&n.size<=2&&(n.delete(null),e.forEach(r=>{if(!r.mathmlTree){const o=new Set(r.mathml);r.mathml.forEach(i=>{i.parentElement&&!(function(s,c){let p=s.parentElement;for(;p;){if(c.has(p))return!0;p=p.parentElement}return!1})(i,o)&&n.add(i.parentElement)})}})),n.size===1&&!n.has(null)){const r=[...n][0];if(Xn(r)&&Ae(r.childNodes).every(o=>t.mathml.includes(o)))return void(t.mathmlTree=r)}}function qs(t){if(!t||Q(t)!==v.MSPACE)return!1;const e=t.getAttribute("width"),n=e&&e.match(/[a-z]*$/);if(!n)return!1;const r=n[0],o=parseFloat(e.slice(0,n.index)),i={cm:.4,pc:.5,em:.5,ex:1,in:.15,pt:5,mm:5}[r];return!(!i||isNaN(o)||o<i)}var Jt;(function(t){t.EMBELLISHED="embellished",t.FENCEPOINTER="fencepointer",t.FONT="font",t.ID="id",t.ANNOTATION="annotation",t.ROLE="role",t.TYPE="type",t.CHILDREN="children",t.CONTENT="content",t.TEXT="$t"})(Jt||(Jt={}));class un{static fromXml(e){const n=parseInt(e.getAttribute("id"),10),r=new un(n);return r.type=e.tagName,un.setAttribute(r,e,"role"),un.setAttribute(r,e,"font"),un.setAttribute(r,e,"embellished"),un.setAttribute(r,e,"fencepointer","fencePointer"),e.getAttribute("annotation")&&r.parseAnnotation(e.getAttribute("annotation")),yi(r,e),un.processChildren(r,e),r}static setAttribute(e,n,r,o){o=o||r;const i=n.getAttribute(r);i&&(e[o]=i)}static processChildren(e,n){for(const r of Ae(n.childNodes)){if(r.nodeType===He.TEXT_NODE){e.textContent=r.textContent;continue}const o=Ae(r.childNodes).map(un.fromXml);o.forEach(i=>i.parent=e),Q(r)==="CONTENT"?e.contentNodes=o:e.childNodes=o}}constructor(e){this.id=e,this.mathml=[],this.parent=null,this.type=l.UNKNOWN,this.role=d.UNKNOWN,this.font=be.UNKNOWN,this.embellished=null,this.fencePointer="",this.childNodes=[],this.textContent="",this.mathmlTree=null,this.contentNodes=[],this.annotation={},this.attributes={},this.nobreaking=!1,this.noupdate=!1}querySelectorAll(e){let n=[];for(let r,o=0;r=this.childNodes[o];o++)n=n.concat(r.querySelectorAll(e));for(let r,o=0;r=this.contentNodes[o];o++)n=n.concat(r.querySelectorAll(e));return e(this)&&n.unshift(this),n}xml(e,n){const r=function(i,s){const c=s.map(function(E){return E.xml(e,n)}),p=e.createElementNS("",i);for(let E,T=0;E=c[T];T++)p.appendChild(E);return p},o=e.createElementNS("",this.type);return n||this.xmlAttributes(o),o.textContent=this.textContent,this.contentNodes.length>0&&o.appendChild(r(Jt.CONTENT,this.contentNodes)),this.childNodes.length>0&&o.appendChild(r(Jt.CHILDREN,this.childNodes)),o}toString(e=!1){const n=Ge("<snode/>");return de(this.xml(n.ownerDocument,e))}allAttributes(){const e=[];return e.push([Jt.ROLE,this.role]),this.font!==be.UNKNOWN&&e.push([Jt.FONT,this.font]),Object.keys(this.annotation).length&&e.push([Jt.ANNOTATION,this.annotationXml()]),this.embellished&&e.push([Jt.EMBELLISHED,this.embellished]),this.fencePointer&&e.push([Jt.FENCEPOINTER,this.fencePointer]),e.push([Jt.ID,this.id.toString()]),e}annotationXml(){const e=[];for(const[n,r]of Object.entries(this.annotation))r.forEach(o=>e.push(n+":"+o));return e.join(";")}attributesXml(){const e=[];for(const[n,r]of Object.entries(this.attributes))e.push(n+":"+un.escapeValue(r));return e.join(";")}toJson(){const e={};e[Jt.TYPE]=this.type;const n=this.allAttributes();for(let r,o=0;r=n[o];o++)e[r[0]]=r[1].toString();return this.textContent&&(e[Jt.TEXT]=this.textContent),this.childNodes.length&&(e[Jt.CHILDREN]=this.childNodes.map(function(r){return r.toJson()})),this.contentNodes.length&&(e[Jt.CONTENT]=this.contentNodes.map(function(r){return r.toJson()})),e}updateContent(e,n){const r=n?e.replace(/^[ \f\n\r\t\v\u200b]*/,"").replace(/[ \f\n\r\t\v\u200b]*$/,""):e.trim();if(e=e&&!r?e:r,this.textContent===e)return;const o=Fe.Meaning.get(e.replace(/\s/g," "));this.textContent=e,this.role=o.role,this.type=o.type,this.font=o.font}addMathmlNodes(e){for(let n,r=0;n=e[r];r++)this.mathml.indexOf(n)===-1&&this.mathml.push(n)}appendChild(e){this.childNodes.push(e),this.addMathmlNodes(e.mathml),e.parent=this}replaceChild(e,n){const r=this.childNodes.indexOf(e);if(r===-1)return;e.parent=null,n.parent=this,this.childNodes[r]=n;const o=e.mathml.filter(function(s){return n.mathml.indexOf(s)===-1}),i=n.mathml.filter(function(s){return e.mathml.indexOf(s)===-1});this.removeMathmlNodes(o),this.addMathmlNodes(i)}appendContentNode(e){e&&(this.contentNodes.push(e),this.addMathmlNodes(e.mathml),e.parent=this)}removeContentNode(e){if(e){const n=this.contentNodes.indexOf(e);n!==-1&&this.contentNodes.slice(n,1)}}equals(e){if(!e||this.type!==e.type||this.role!==e.role||this.textContent!==e.textContent||this.childNodes.length!==e.childNodes.length||this.contentNodes.length!==e.contentNodes.length)return!1;for(let n,r,o=0;n=this.childNodes[o],r=e.childNodes[o];o++)if(!n.equals(r))return!1;for(let n,r,o=0;n=this.contentNodes[o],r=e.contentNodes[o];o++)if(!n.equals(r))return!1;return!0}displayTree(){console.info(this.displayTree_(0))}addAnnotation(e,n){n&&this.addAnnotation_(e,n)}getAnnotation(e){return this.annotation[e]||[]}hasAnnotation(e,n){const r=this.annotation[e];return!!r&&r.indexOf(n)!==-1}parseAnnotation(e){const n=e.split(";");for(let r=0,o=n.length;r<o;r++){const i=n[r].split(":");this.addAnnotation(i[0],i[1])}}meaning(){return{type:this.type,role:this.role,font:this.font}}xmlAttributes(e){const n=this.allAttributes();for(let r,o=0;r=n[o];o++)e.setAttribute(r[0],r[1]);this.addExternalAttributes(e)}addExternalAttributes(e){for(const[n,r]of Object.entries(this.attributes))e.setAttribute(n,r)}static escapeValue(e){return e.replace(/;/g,"\\0003B")}parseAttributes(e){if(!e)return;const n=e.split(";");for(let r=0,o=n.length;r<o;r++){const[i,...s]=n[r].split(":");i&&(this.attributes[i]=s.join(":").replace(/\\0003B/g,";"))}}removeMathmlNodes(e){const n=this.mathml;for(let r,o=0;r=e[o];o++){const i=n.indexOf(r);i!==-1&&n.splice(i,1)}this.mathml=n}displayTree_(e){e++;const n=Array(e).join(" ");let r="";r+=`
22
+ `+n+this.toString(),r+=`
23
+ `+n+"MathmlTree:",r+=`
24
+ `+n+this.mathmlTreeString(),r+=`
25
+ `+n+"MathML:";for(let o,i=0;o=this.mathml[i];i++)r+=`
26
+ `+n+o.toString();return r+=`
27
+ `+n+"Begin Content",this.contentNodes.forEach(function(o){r+=o.displayTree_(e)}),r+=`
28
+ `+n+"End Content",r+=`
29
+ `+n+"Begin Children",this.childNodes.forEach(function(o){r+=o.displayTree_(e)}),r+=`
30
+ `+n+"End Children",r}mathmlTreeString(){return this.mathmlTree?this.mathmlTree.toString():"EMPTY"}addAnnotation_(e,n){const r=this.annotation[e];r&&!r.includes(n)?r.push(n):this.annotation[e]=[n]}}class Ci{constructor(){this.leafMap=new Xl,this.defaultMap=new Ws,this.idCounter_=-1}makeNode(e){return this.createNode_(e)}makeUnprocessed(e){const n=this.createNode_();return n.addMathmlNodes([e]),n.mathmlTree=e,n}makeEmptyNode(){const e=this.createNode_();return e.type=l.EMPTY,e}makeContentNode(e){const n=this.createNode_();return n.updateContent(e),n}makeMultipleContentNodes(e,n){const r=[];for(let o=0;o<e;o++)r.push(this.makeContentNode(n));return r}makeLeafNode(e,n){if(!e)return this.makeEmptyNode();const r=this.makeContentNode(e);r.font=n||r.font;const o=this.defaultMap.getNode(r);return o&&(r.type=o.type,r.role=o.role,r.font=o.font),this.leafMap.addNode(r),r}makeBranchNode(e,n,r,o){const i=this.createNode_();return o&&i.updateContent(o),i.type=e,i.childNodes=n,i.contentNodes=r,n.concat(r).forEach(function(s){s.parent=i,i.addMathmlNodes(s.mathml)}),i}createNode_(e){return e!==void 0?this.idCounter_=Math.max(this.idCounter_,e):e=++this.idCounter_,new un(e)}}function J(t,e){return t.type===e}function yo(t,e){return t.embellished===e}function qe(t,e){return t.role===e}function Tr(t){return J(t,l.FENCE)||J(t,l.PUNCTUATION)||J(t,l.OPERATOR)||J(t,l.RELATION)}function eu(t){return Zn(t)&&!qe(t,d.DIVISION)||J(t,l.APPL)||Mi(t)}function Zs(t){return Zn(t)||Mi(t)}function ea(t,e){return!!e&&J(e,l.IDENTIFIER)&&Fe.Secondary.has(t.textContent,Ye.D)}function Li(t){if(J(t,l.IDENTIFIER)){const e=t.textContent[0];return e&&t.textContent[1]&&Fe.Secondary.has(e,Ye.D)}return!1}function Mi(t){return na(t)||Co(t)}function ta(t){return t.embellished?t.embellished:(e=t.type)===l.OPERATOR||e===l.RELATION||e===l.FENCE||e===l.PUNCTUATION?t.type:null;var e}function Zn(t){return J(t,l.OPERATOR)||yo(t,l.OPERATOR)}function na(t){return J(t,l.RELATION)||yo(t,l.RELATION)}function Co(t){return J(t,l.PUNCTUATION)||yo(t,l.PUNCTUATION)}function ra(t){return J(t,l.FENCE)||yo(t,l.FENCE)}function tu(t){return!(!t||!ra(t))&&(!t.embellished||oa(t))}function oa(t){return!t.embellished||!(function(e){return J(e,l.TENSOR)&&(!J(e.childNodes[1],l.EMPTY)||!J(e.childNodes[2],l.EMPTY))&&(!J(e.childNodes[3],l.EMPTY)||!J(e.childNodes[4],l.EMPTY))})(t)&&(!qe(t,d.CLOSE)||!J(t,l.TENSOR))&&(!qe(t,d.OPEN)||!J(t,l.SUBSCRIPT)&&!J(t,l.SUPERSCRIPT))&&oa(t.childNodes[0])}function ia(t){return!!t&&(J(t,l.TABLE)||J(t,l.MULTILINE))}function nu(t){return!!t&&sa(t)&&ia(t.childNodes[0])}function sa(t){return!!t&&J(t,l.FENCED)&&(qe(t,d.LEFTRIGHT)||yn(t))&&t.childNodes.length===1}function ru(t,e){return e.length>0&&qe(e[e.length-1],d.OPENFENCE)}function aa(t){return t.childNodes.every(function(e){return e.childNodes.length<=1})}function ca(t){return J(t,l.LINE)&&t.contentNodes.length&&qe(t.contentNodes[0],d.LABEL)}function la(t){return J(t,l.LARGEOP)||J(t,l.LIMBOTH)||J(t,l.LIMLOWER)||J(t,l.LIMUPPER)||J(t,l.FUNCTION)&&qe(t,d.LIMFUNC)||(J(t,l.OVERSCORE)||J(t,l.UNDERSCORE))&&la(t.childNodes[0])}function ua(t,e,n){return e.length===1&&(t[n].type===l.PUNCTUATION||t[n].embellished===l.PUNCTUATION)&&t[n]===e[0]}function ou(t){return J(t,l.IDENTIFIER)&&qe(t,d.SIMPLEFUNC)}const iu=[l.PUNCTUATION,l.PUNCTUATED,l.RELSEQ,l.MULTIREL,l.TABLE,l.MULTILINE,l.CASES,l.INFERENCE],su=[l.LIMUPPER,l.LIMLOWER,l.LIMBOTH,l.SUBSCRIPT,l.SUPERSCRIPT,l.UNDERSCORE,l.OVERSCORE,l.TENSOR];function vi(t){const e=t.type;return iu.indexOf(e)===-1&&(e!==l.INFIXOP||t.role===d.IMPLICIT)&&(e===l.FENCED?t.role!==d.LEFTRIGHT||vi(t.childNodes[0]):su.indexOf(e)===-1||vi(t.childNodes[0]))}function ha(t){return(function(e){return e.type===l.NUMBER&&(e.role===d.INTEGER||e.role===d.FLOAT)})(t)||t.role===d.VULGAR||t.role===d.MIXED}function Di(t){const e=t.childNodes;return t.role===d.UNIT&&(!e.length||e[0].role===d.UNIT)}function da(t){const e=t.childNodes;return t.type===l.INFIXOP&&(t.role===d.MULTIPLICATION||t.role===d.IMPLICIT)&&e.length&&(Di(e[0])||ha(e[0]))&&t.childNodes.slice(1).every(Di)}function er(t){return t.type===l.INFIXOP&&(t.role===d.IMPLICIT||t.role===d.UNIT&&!!t.contentNodes.length&&t.contentNodes[0].textContent===Rn.invisibleTimes)}function Zr(t){return t.type===l.INFIXOP&&t.role===d.IMPLICIT}function yn(t){return t.role===d.NEUTRAL||t.role===d.METRIC}function wi(t,e){return yn(t)&&yn(e)&&Yn(t).textContent===Yn(e).textContent}function fa(t){return!!yn(t)&&(!t.embellished||t.type!==l.SUPERSCRIPT&&t.type!==l.SUBSCRIPT&&(t.type!==l.TENSOR||t.childNodes[3].type===l.EMPTY&&t.childNodes[4].type===l.EMPTY))}function pa(t){return!!yn(t)&&(!t.embellished||t.type!==l.TENSOR||t.childNodes[1].type===l.EMPTY&&t.childNodes[2].type===l.EMPTY)}function ma(t){return[d.ELEMENT,d.NONELEMENT,d.REELEMENT,d.RENONELEMENT].includes(t.role)}class g{static getInstance(){return g.instance=g.instance||new g,g.instance}static tableToMultiline(e){if(!aa(e))return fe.run("rewrite_subcases",e,g.classifyTable);e.type=l.MULTILINE;for(let n,r=0;n=e.childNodes[r];r++)g.rowToLine_(n,d.MULTILINE);return e.childNodes.length===1&&!ca(e.childNodes[0])&&sa(e.childNodes[0].childNodes[0])&&g.tableToMatrixOrVector_(g.rewriteFencedLine_(e)),g.classifyMultiline(e)}static number(e){e.type!==l.UNKNOWN&&e.type!==l.IDENTIFIER||(e.type=l.NUMBER),g.meaningFromContent(e,g.numberRole_),g.exprFont_(e)}static classifyMultiline(e){return g.binomialForm_(e),g.classifyMultiline_(e),e}static classifyMultiline_(e){let n=0;const r=e.childNodes.length;let o;for(;n<r&&(!(o=e.childNodes[n])||!o.childNodes.length);)n++;if(n>=r)return;const i=o.childNodes[0].role;i!==d.UNKNOWN&&e.childNodes.every(function(s){const c=s.childNodes[0];return!c||c.role===i&&(J(c,l.RELATION)||J(c,l.RELSEQ))})&&(e.role=i)}static classifyTable(e){const n=g.computeColumns_(e);return g.classifyByColumns_(e,n,d.EQUALITY)||g.classifyByColumns_(e,n,d.INEQUALITY,[d.EQUALITY])||g.classifyByColumns_(e,n,d.ARROW)||g.detectCaleyTable(e),e}static detectCaleyTable(e){if(!e.mathmlTree)return!1;const n=e.mathmlTree,r=n.getAttribute("columnlines"),o=n.getAttribute("rowlines");return!(!r||!o)&&!(!g.cayleySpacing(r)||!g.cayleySpacing(o))&&(e.role=d.CAYLEY,!0)}static cayleySpacing(e){const n=e.split(" ");return(n[0]==="solid"||n[0]==="dashed")&&n.slice(1).every(r=>r==="none")}static proof(e,n,r){const o=g.separateSemantics(n);return g.getInstance().proof(e,o,r)}static findSemantics(e,n,r){const o=r??null,i=g.getSemantics(e);return!!i&&!!i[n]&&(o==null||i[n]===o)}static getSemantics(e){const n=e.getAttribute("semantics");return n?g.separateSemantics(n):null}static removePrefix(e){const[,...n]=e.split("_");return n.join("_")}static separateSemantics(e){const n={};return e.split(";").forEach(function(r){const[o,i]=r.split(":");n[g.removePrefix(o)]=i}),n}static matchSpaces_(e,n){for(let r,o=0;r=n[o];o++){const i=e[o].mathmlTree,s=e[o+1].mathmlTree;if(!i||!s)continue;const c=i.nextSibling;if(!c||c===s)continue;const p=g.getSpacer_(c);p&&p!==s&&(r.addMathmlNodes([p]),r.mathmlTree=p,r.role=d.SPACE)}}static getSpacer_(e){if(Q(e)===v.MSPACE)return e;for(;Xn(e)&&e.childNodes.length===1;)if(Q(e=e.childNodes[0])===v.MSPACE)return e;return null}static fenceToPunct_(e){const n=g.FENCE_TO_PUNCT_[e.role];if(n){for(;e.embellished;)e.embellished=l.PUNCTUATION,qe(e,d.SUBSUP)||qe(e,d.UNDEROVER)||(e.role=n),e=e.childNodes[0];e.type=l.PUNCTUATION,e.role=n}}static classifyFunction_(e,n){if(e.type===l.APPL||e.type===l.BIGOP||e.type===l.INTEGRAL)return"";if(n[0]&&n[0].textContent===Rn.functionApplication){g.getInstance().funcAppls[e.id]=n.shift();let o=d.SIMPLEFUNC;return fe.run("simple2prefix",e),e.role!==d.PREFIXFUNC&&e.role!==d.LIMFUNC||(o=e.role),g.propagateFunctionRole_(e,o),"prefix"}return g.CLASSIFY_FUNCTION_[e.role]||((r=e).type===l.IDENTIFIER||r.role===d.LATINLETTER||r.role===d.GREEKLETTER||r.role===d.OTHERLETTER?"simple":"");var r}static propagateFunctionRole_(e,n){if(e){if(e.type===l.INFIXOP)return;qe(e,d.SUBSUP)||qe(e,d.UNDEROVER)||(e.role=n),g.propagateFunctionRole_(e.childNodes[0],n)}}static getFunctionOp_(e,n){if(n(e))return e;for(let r,o=0;r=e.childNodes[o];o++){const i=g.getFunctionOp_(r,n);if(i)return i}return null}static tableToMatrixOrVector_(e){const n=e.childNodes[0];J(n,l.MULTILINE)?g.tableToVector_(e):g.tableToMatrix_(e),e.contentNodes.forEach(n.appendContentNode.bind(n));for(let r,o=0;r=n.childNodes[o];o++)g.assignRoleToRow_(r,g.getComponentRoles_(n));return n.parent=null,n}static tableToVector_(e){const n=e.childNodes[0];n.type=l.VECTOR,n.childNodes.length!==1?g.binomialForm_(n):g.tableToSquare_(e)}static binomialForm_(e){qe(e,d.UNKNOWN)&&e.childNodes.length===2&&(e.role=d.BINOMIAL,e.childNodes[0].role=d.BINOMIAL,e.childNodes[1].role=d.BINOMIAL)}static tableToMatrix_(e){const n=e.childNodes[0];n.type=l.MATRIX,n.childNodes&&n.childNodes.length>0&&n.childNodes[0].childNodes&&n.childNodes.length===n.childNodes[0].childNodes.length?g.tableToSquare_(e):n.childNodes&&n.childNodes.length===1&&(n.role=d.ROWVECTOR)}static tableToSquare_(e){const n=e.childNodes[0];qe(n,d.UNKNOWN)&&(yn(e)?n.role=d.DETERMINANT:n.role=d.SQUAREMATRIX)}static getComponentRoles_(e){const n=e.role;return n&&n!==d.UNKNOWN?n:e.type.toLowerCase()||d.UNKNOWN}static tableToCases_(e,n){for(let r,o=0;r=e.childNodes[o];o++)g.assignRoleToRow_(r,d.CASES);return e.type=l.CASES,e.appendContentNode(n),aa(e)&&g.binomialForm_(e),e}static rewriteFencedLine_(e){const n=e.childNodes[0],r=e.childNodes[0].childNodes[0],o=e.childNodes[0].childNodes[0].childNodes[0];return r.parent=e.parent,e.parent=r,o.parent=n,r.childNodes=[e],n.childNodes=[o],r}static rowToLine_(e,n){const r=n||d.UNKNOWN;J(e,l.ROW)&&(e.type=l.LINE,e.role=r,e.childNodes.length===1&&J(e.childNodes[0],l.CELL)&&(e.childNodes=e.childNodes[0].childNodes,e.childNodes.forEach(function(o){o.parent=e})))}static assignRoleToRow_(e,n){J(e,l.LINE)?e.role=n:J(e,l.ROW)&&(e.role=n,e.childNodes.forEach(function(r){J(r,l.CELL)&&(r.role=n)}))}static nextSeparatorFunction_(e){let n;if(e){if(e.match(/^\s+$/))return null;n=e.replace(/\s/g,"").split("").filter(function(r){return r})}else n=[","];return function(){return n.length>1?n.shift():n[0]}}static meaningFromContent(e,n){const r=[...e.textContent].filter(o=>o.match(/[^\s]/));n(e,r,r.map(o=>Fe.Meaning.get(o)))}static numberRole_(e,n,r){if(e.role===d.UNKNOWN)return r.every(function(o){return o.type===l.NUMBER&&o.role===d.INTEGER||o.type===l.PUNCTUATION&&o.role===d.COMMA})?(e.role=d.INTEGER,void(n[0]==="0"&&e.addAnnotation("general","basenumber"))):void(r.every(function(o){return o.type===l.NUMBER&&o.role===d.INTEGER||o.type===l.PUNCTUATION})?e.role=d.FLOAT:e.role=d.OTHERNUMBER)}static exprFont_(e){e.font===be.UNKNOWN&&g.compSemantics(e,"font",be)}static compSemantics(e,n,r){const o=[...e.textContent].map(i=>Fe.Meaning.get(i)).reduce(function(i,s){return i&&s[n]&&s[n]!==r.UNKNOWN&&s[n]!==i?i===r.UNKNOWN?s[n]:null:i},r.UNKNOWN);o&&(e[n]=o)}static purgeFences_(e){const n=e.rel,r=e.comp,o=[],i=[];for(;n.length>0;){const s=n.shift();let c=r.shift();tu(s)?(o.push(s),i.push(c)):(g.fenceToPunct_(s),c.push(s),c=c.concat(r.shift()),r.unshift(c))}return i.push(r.shift()),{rel:o,comp:i}}static rewriteFencedNode_(e){const n=e.contentNodes[0],r=e.contentNodes[1];let o=g.rewriteFence_(e,n);return e.contentNodes[0]=o.fence,o=g.rewriteFence_(o.node,r),e.contentNodes[1]=o.fence,e.contentNodes[0].parent=e,e.contentNodes[1].parent=e,(function(i){const s=Fe.FencesSecondary.get(i.contentNodes[0].textContent);s===Fe.FencesSecondary.get(i.contentNodes[1].textContent)&&i.addAnnotation("fences",s)})(e),o.node.parent=null,o.node}static rewriteFence_(e,n){if(!n.embellished)return{node:e,fence:n};const r=n.childNodes[0],o=g.rewriteFence_(e,r);return J(n,l.SUPERSCRIPT)||J(n,l.SUBSCRIPT)||J(n,l.TENSOR)?(qe(n,d.SUBSUP)||(n.role=e.role),r!==o.node&&(n.replaceChild(r,o.node),r.parent=e),g.propagateFencePointer_(n,r),{node:n,fence:o.fence}):(n.replaceChild(r,o.fence),n.mathmlTree&&n.mathml.indexOf(n.mathmlTree)===-1&&n.addMathmlNodes([n.mathmlTree]),{node:o.node,fence:n})}static propagateFencePointer_(e,n){e.fencePointer=n.fencePointer||n.id.toString(),e.embellished=null}static classifyByColumns_(e,n,r,o=[]){const i=[r].concat(o);return!!(n.length===3&&g.testColumns_(n,1,s=>g.isPureRelation_(s,i))||n.length===2&&(g.testColumns_(n,1,s=>g.isEndRelation_(s,i)||g.isPureRelation_(s,i))||g.testColumns_(n,0,s=>g.isEndRelation_(s,i,!0)||g.isPureRelation_(s,i))))&&(e.role=r,!0)}static isEndRelation_(e,n,r){const o=r?e.childNodes.length-1:0;return J(e,l.RELSEQ)&&n.some(i=>qe(e,i))&&J(e.childNodes[o],l.EMPTY)}static isPureRelation_(e,n){return J(e,l.RELATION)&&n.some(r=>qe(e,r))}static computeColumns_(e){const n=[];for(let r,o=0;r=e.childNodes[o];o++)for(let i,s=0;i=r.childNodes[s];s++)n[s]?n[s].push(i):n[s]=[i];return n}static testColumns_(e,n,r){const o=e[n];return!!o&&o.some(function(i){return i.childNodes.length&&r(i.childNodes[0])})&&o.every(function(i){return!i.childNodes.length||r(i.childNodes[0])})}setNodeFactory(e){g.getInstance().factory_=e,fe.updateFactory(g.getInstance().factory_)}getNodeFactory(){return g.getInstance().factory_}identifierNode(e,n,r){if(r!=="MathML-Unit"||(o=e,[d.DEGREE].includes(o.role)||[].includes(o.type))){if(!n&&e.textContent.length===1&&(e.role===d.INTEGER||e.role===d.LATINLETTER||e.role===d.GREEKLETTER)&&e.font===be.NORMAL)return e.font=be.ITALIC,fe.run("simpleNamedFunction",e)}else e.type=l.IDENTIFIER,e.role=d.UNIT;var o;return e.type===l.UNKNOWN&&(e.type=l.IDENTIFIER),g.exprFont_(e),fe.run("simpleNamedFunction",e)}implicitNode(e){if(e=g.getInstance().getMixedNumbers_(e),e=g.getInstance().combineUnits_(e),(e=g.getInstance().combineScripts_(e)).length===1)return e[0];const n=g.getInstance().implicitNode_(e);return fe.run("combine_juxtaposition",n)}text(e,n){if(g.exprFont_(e),e.type=l.TEXT,n===v.ANNOTATIONXML)return e.role=d.ANNOTATION,e;if(n===v.MS)return e.role=d.STRING,e;if(n===v.MSPACE||e.textContent.match(/^\s*$/))return e.role=d.SPACE,e;if(/\s/.exec(e.textContent))return e.role=d.TEXT,e;const r=[...e.textContent];if(r.length!==1)return e.role=d.UNKNOWN,e;const o=Fe.Meaning.get(r[0]);return o.type===l.UNKNOWN||o.type===l.IDENTIFIER||(e.type=o.type,e.role=o.role,e.font=o.font,e.addAnnotation("general","text")),e}row(e,n=!1){return(e=e.filter(function(r){return!J(r,l.EMPTY)||r.hasAnnotation("empty","MFENCED")||n})).length===0?g.getInstance().factory_.makeEmptyNode():(e=g.getInstance().getFencesInRow_(e),e=g.getInstance().tablesInRow(e),e=g.getInstance().getPunctuationInRow_(e),e=g.getInstance().getTextInRow_(e),e=g.getInstance().getFunctionsInRow_(e),g.getInstance().relationsInRow_(e))}limitNode(e,n){if(!n.length)return g.getInstance().factory_.makeEmptyNode();let r=n[0];const{length:o}=g.MML_TO_LIMIT_[e];if(n=n.slice(0,o+1),[e,n]=g.getInstance().cleanLimitNode(e,n,o),!n[1])return r;let{type:i,length:s}=g.MML_TO_LIMIT_[e];if(s===1&&n[1].role===d.DEGREE)return g.getInstance().row([n[0],n[1]]);if(fe.run("op_with_limits",n),la(r)){if(s===1&&Tr(n[1])||s===2&&Tr(n[1])&&Tr(n[2])){const p=g.MML_TO_BOUNDS_[e];return g.getInstance().accentNode_(r,n,p.type,p.length,p.accent)}if(s===2){if(Tr(n[1]))return r=g.getInstance().accentNode_(r,[r,n[1]],{MSUBSUP:l.SUBSCRIPT,MUNDEROVER:l.UNDERSCORE}[e],1,!0),n[2]?g.getInstance().makeLimitNode_(r,[r,n[2]],null,l.LIMUPPER):r;if(n[2]&&Tr(n[2]))return r=g.getInstance().accentNode_(r,[r,n[2]],{MSUBSUP:l.SUPERSCRIPT,MUNDEROVER:l.OVERSCORE}[e],1,!0),g.getInstance().makeLimitNode_(r,[r,n[1]],null,l.LIMLOWER);n[s]||(i=l.LIMLOWER)}return g.getInstance().makeLimitNode_(r,n,null,i)}const c=g.MML_TO_BOUNDS_[e];return g.getInstance().accentNode_(r,n,c.type,c.length,c.accent)}cleanLimitNode(e,n,r){const o=c=>(p=>!p||J(p,l.EMPTY))(c)||(p=>p&&J(p,l.TEXT)&&qe(p,d.SPACE))(c);if(r===1)return o(n[1])?(n[0].noupdate=!0,[e,[Pi([e],n[0])]]):[e,n];const i=n[1],s=n[2];return o(i)&&o(s)?(n[0].noupdate=!0,[e,[Pi([e],n[0])]]):o(i)?[e===v.MSUBSUP?v.MSUP:v.MOVER,[n[0],s]]:o(s)?[e===v.MSUBSUP?v.MSUB:v.MUNDER,[n[0],i]]:[e,n]}tablesInRow(e){let n=nn(e,nu),r=[];for(let o,i=0;o=n.rel[i];i++)r=r.concat(n.comp.shift()),r.push(g.tableToMatrixOrVector_(o));r=r.concat(n.comp.shift()),n=nn(r,ia),r=[];for(let o,i=0;o=n.rel[i];i++){const s=n.comp.shift();ru(0,s)&&g.tableToCases_(o,s.pop()),r=r.concat(s),(r.length||n.comp[0].length)&&(o=g.rewriteTrivialTable(o)),r.push(o)}return r.concat(n.comp.shift())}mfenced(e,n,r,o){if(r&&o.length>0){const i=g.nextSeparatorFunction_(r),s=[o.shift()];o.forEach(c=>{s.push(g.getInstance().factory_.makeContentNode(i())),s.push(c)}),o=s}return e&&n?g.getInstance().horizontalFencedNode_(g.getInstance().factory_.makeContentNode(e),g.getInstance().factory_.makeContentNode(n),o):(e&&o.unshift(g.getInstance().factory_.makeContentNode(e)),n&&o.push(g.getInstance().factory_.makeContentNode(n)),g.getInstance().row(o))}fractionLikeNode(e,n,r,o){let i;if(!o&&(function(s){if(!s)return!1;if(["negativeveryverythinmathspace","negativeverythinmathspace","negativethinmathspace","negativemediummathspace","negativethickmathspace","negativeverythickmathspace","negativeveryverythickmathspace"].includes(s))return!0;const c=s.match(/[0-9.]+/);return!!c&&parseFloat(c[0])===0})(r)){const s=g.getInstance().factory_.makeBranchNode(l.LINE,[e],[]),c=g.getInstance().factory_.makeBranchNode(l.LINE,[n],[]);return i=g.getInstance().factory_.makeBranchNode(l.MULTILINE,[s,c],[]),g.classifyMultiline(i)}return i=g.getInstance().fractionNode_(e,n),o&&i.addAnnotation("general","bevelled"),i}tensor(e,n,r,o,i){const s=g.getInstance().factory_.makeBranchNode(l.TENSOR,[e,g.getInstance().scriptNode_(n,d.LEFTSUB),g.getInstance().scriptNode_(r,d.LEFTSUPER),g.getInstance().scriptNode_(o,d.RIGHTSUB),g.getInstance().scriptNode_(i,d.RIGHTSUPER)],[]);return s.role=e.role,s.embellished=ta(e),s}pseudoTensor(e,n,r){const o=E=>!J(E,l.EMPTY),i=n.filter(o).length,s=r.filter(o).length;if(!i&&!s)return e;const c=i?s?v.MSUBSUP:v.MSUB:v.MSUP,p=[e];return i&&p.push(g.getInstance().scriptNode_(n,d.RIGHTSUB,!0)),s&&p.push(g.getInstance().scriptNode_(r,d.RIGHTSUPER,!0)),g.getInstance().limitNode(c,p)}font(e){return g.MATHJAX_FONTS[e]||e}proof(e,n,r){if(n.inference||n.axiom||console.log("Noise"),n.axiom){const i=g.getInstance().cleanInference(e.childNodes),s=i.length?g.getInstance().factory_.makeBranchNode(l.INFERENCE,r(i),[]):g.getInstance().factory_.makeEmptyNode();return s.role=d.AXIOM,s.mathmlTree=e,s}const o=g.getInstance().inference(e,n,r);return n.proof&&(o.role=d.PROOF,o.childNodes[0].role=d.FINAL),o}inference(e,n,r){if(n.inferenceRule){const E=g.getInstance().getFormulas(e,[],r);return g.getInstance().factory_.makeBranchNode(l.INFERENCE,[E.conclusion,E.premises],[])}const o=n.labelledRule,i=Ae(e.childNodes),s=[];o!=="left"&&o!=="both"||s.push(g.getInstance().getLabel(e,i,r,d.LEFT)),o!=="right"&&o!=="both"||s.push(g.getInstance().getLabel(e,i,r,d.RIGHT));const c=g.getInstance().getFormulas(e,i,r),p=g.getInstance().factory_.makeBranchNode(l.INFERENCE,[c.conclusion,c.premises],s);return p.mathmlTree=e,p}getLabel(e,n,r,o){const i=g.getInstance().findNestedRow(n,"prooflabel",o),s=g.getInstance().factory_.makeBranchNode(l.RULELABEL,r(Ae(i.childNodes)),[]);return s.role=o,s.mathmlTree=i,s}getFormulas(e,n,r){const o=n.length?g.getInstance().findNestedRow(n,"inferenceRule"):e,i=g.getSemantics(o).inferenceRule==="up",s=i?o.childNodes[1]:o.childNodes[0],c=i?o.childNodes[0]:o.childNodes[1],p=s.childNodes[0].childNodes[0],E=Ae(p.childNodes[0].childNodes),T=[];let C=1;for(const Nt of E)C%2&&T.push(Nt.childNodes[0]),C++;const pe=r(T),Ne=r(Ae(c.childNodes[0].childNodes))[0],ae=g.getInstance().factory_.makeBranchNode(l.PREMISES,pe,[]);ae.mathmlTree=p;const rt=g.getInstance().factory_.makeBranchNode(l.CONCLUSION,[Ne],[]);return rt.mathmlTree=c.childNodes[0].childNodes[0],{conclusion:rt,premises:ae}}findNestedRow(e,n,r){return g.getInstance().findNestedRow_(e,n,0,r)}cleanInference(e){return Ae(e).filter(function(n){return Q(n)!=="MSPACE"})}operatorNode(e){return e.type===l.UNKNOWN&&(e.type=l.OPERATOR),fe.run("multioperator",e)}static rewriteTrivialTable(e){return J(n=e,l.MULTILINE)&&n.childNodes.length===1&&n.childNodes[0].childNodes.length&&!ca(n.childNodes[0])?g.getInstance().unwrapTrivialTable(e):e;var n}unwrapTrivialTable(e){if(!e.childNodes[0].childNodes.length)return g.getInstance().factory_.makeEmptyNode();const n=e.childNodes[0].childNodes[0];return n.parent=null,Pi([v.MTD,v.MTR,v.MTABLE],n),n}constructor(){this.funcAppls={},this.splitRoles=new Map([[d.SUBTRACTION,d.NEGATIVE],[d.ADDITION,d.POSITIVE]]),this.splitOps=["−","-","‐","‑","+"],this.factory_=new Ci,fe.updateFactory(this.factory_)}implicitNode_(e){const n=g.getInstance().factory_.makeMultipleContentNodes(e.length-1,Rn.invisibleTimes);g.matchSpaces_(e,n);const r=g.getInstance().infixNode_(e,n[0]);return r.role=d.IMPLICIT,n.forEach(function(o){o.parent=r}),r.contentNodes=n,r}infixNode_(e,n){let r=g.getInstance().factory_.makeBranchNode(l.INFIXOP,e,[n],Yn(n).textContent);return r.role=n.role,r=fe.run("propagateInterval",r),fe.run("propagateSimpleFunction",r)}explicitMixed_(e){const n=nn(e,function(o){return o.textContent===Rn.invisiblePlus});if(!n.rel.length)return e;let r=[];for(let o,i=0;o=n.rel[i];i++){const s=n.comp[i],c=n.comp[i+1],p=s.length-1;if(s[p]&&c[0]&&J(s[p],l.NUMBER)&&!qe(s[p],d.MIXED)&&J(c[0],l.FRACTION)){const E=g.getInstance().factory_.makeBranchNode(l.NUMBER,[s[p],c[0]],[]);E.role=d.MIXED,r=r.concat(s.slice(0,p)),r.push(E),c.shift()}else r=r.concat(s),r.push(o)}return r.concat(n.comp[n.comp.length-1])}concatNode_(e,n,r){if(n.length===0)return e;const o=n.map(function(s){return Yn(s).textContent}).join(" "),i=g.getInstance().factory_.makeBranchNode(r,[e],n,o);return n.length>1&&(i.role=d.MULTIOP),Js(i,[e,...n]),i}multiopNode_(e){const n=g.getInstance().factory_.makeBranchNode(l.OPERATOR,e,[]);return n.role=d.MULTIOP,Js(n,e),n}prefixNode_(e,n){const r=this.splitSingles(n);let o=e;for(;r.length>0;){const i=r.pop();o=g.getInstance().concatNode_(o,i,l.PREFIXOP),i.length===1&&this.splitOps.indexOf(i[0].textContent)!==-1&&(o.role=this.splitRoles.get(i[0].role))}return o}splitSingles(e){let n=0;const r=[];let o=0;for(;o<e.length;){const i=e[o];!this.splitRoles.has(i.role)||e[o-1]&&e[o-1].role===i.role||e[o+1]&&e[o+1].role===i.role||this.splitOps.indexOf(i.textContent)===-1||(r.push(e.slice(n,o)),r.push(e.slice(o,o+1)),n=o+1),o++}return n<o&&r.push(e.slice(n,o)),r}postfixNode_(e,n){return n.length?g.getInstance().concatNode_(e,n,l.POSTFIXOP):e}combineScripts_(e){const n=nn(e,o=>J(o,l.SUPERSCRIPT)&&J(o.childNodes[0],l.EMPTY)||J(o,l.SUBSCRIPT)&&J(o.childNodes[0],l.EMPTY));if(!n.rel.length)return e;let r=[];do{const o=n.comp.shift(),i=n.rel.shift();if(!o.length){r.push(i);continue}const s=o.pop();J(s,l.NUMBER)||J(s,l.IDENTIFIER)?(i.childNodes[0]=s,s.parent=i,i.role=s.type.toLowerCase(),i.addAnnotation("collapsed",s.type.toLowerCase()),r=r.concat(o),r.push(i)):J(s,l.SUBSCRIPT)&&J(i,l.SUPERSCRIPT)?(i.childNodes[0]=s,s.parent=i,i.role=s.type.toLowerCase(),i.addAnnotation("collapsed",s.type.toLowerCase()),s.role=d.SUBSUP,r=r.concat(o),r.push(i)):(r=r.concat(o),r.push(s),r.push(i))}while(n.rel.length);return r=r.concat(n.comp.pop()),r}combineUnits_(e){const n=nn(e,function(s){return!qe(s,d.UNIT)});if(e.length===n.rel.length)return n.rel;const r=[];let o,i;do{const s=n.comp.shift();o=n.rel.shift();let c=null;i=r.pop(),i&&(s.length&&ha(i)?s.unshift(i):r.push(i)),s.length===1&&(c=s.pop()),s.length>1&&(c=g.getInstance().implicitNode_(s),c.role=d.UNIT),c&&r.push(c),o&&r.push(o)}while(o);return r}getMixedNumbers_(e){const n=nn(e,function(o){return J(o,l.FRACTION)&&qe(o,d.VULGAR)});if(!n.rel.length)return e;let r=[];for(let o,i=0;o=n.rel[i];i++){const s=n.comp[i],c=s.length-1;if(s[c]&&J(s[c],l.NUMBER)&&(qe(s[c],d.INTEGER)||qe(s[c],d.FLOAT))){const p=g.getInstance().factory_.makeBranchNode(l.NUMBER,[s[c],o],[]);p.role=d.MIXED,r=r.concat(s.slice(0,c)),r.push(p)}else r=r.concat(s),r.push(o)}return r.concat(n.comp[n.comp.length-1])}getTextInRow_(e){if(e.length===0)return e;if(e.length===1)return e[0].type===l.TEXT&&e[0].role===d.UNKNOWN&&(e[0].role=d.ANNOTATION),e;const{rel:n,comp:r}=nn(e,s=>J(s,l.TEXT)&&!s.annotation.factor);if(n.length===0)return e;const o=[];let i=r.shift();for(;n.length>0;){let s=n.shift(),c=r.shift();const p=[];for(;!c.length&&n.length&&s.role!==d.SPACE&&n[0].role!==d.SPACE;)p.push(s),s=n.shift(),c=r.shift();if(p.length&&(p.push(s),s=g.getInstance().dummyNode_(p)),s.role!==d.UNKNOWN){const C=ga(i,s,c);if(C){i=C;continue}i.length&&o.push(g.getInstance().row(i)),o.push(s),i=c;continue}const E=Fe.Meaning.get(s.textContent);if(E.type!==l.UNKNOWN){s.type=E.type,s.role=E.role,s.font=E.font,s.addAnnotation("general","text"),i.push(s),i=i.concat(c);continue}if(g.meaningFromContent(s,(C,pe,Ne)=>{if(C.role===d.UNKNOWN){if(g.numberRole_(C,pe,Ne),C.role===d.OTHERNUMBER)return Ne.some(ae=>ae.type!==l.NUMBER&&ae.type!==l.IDENTIFIER)?(C.type=l.TEXT,void(C.role=d.ANNOTATION)):void(C.role=d.UNKNOWN);C.type=l.NUMBER}}),s.role===d.UNKNOWN&&(n.length||c.length?c.length&&c[0].type===l.FENCED?(s.type=l.FUNCTION,s.role=d.PREFIXFUNC):s.role=d.TEXT:(s.type=l.IDENTIFIER,s.role=d.UNIT)),s.type!==l.TEXT){i.push(s),i=i.concat(c);continue}const T=ga(i,s,c);T?i=T:(i.length&&o.push(g.getInstance().row(i)),o.push(s),i=c)}return i.length>0&&o.push(g.getInstance().row(i)),o.length>1?[g.getInstance().dummyNode_(o)]:o}relationsInRow_(e){const n=nn(e,na),r=n.rel[0];if(!r)return g.getInstance().operationsInRow_(e);if(e.length===1)return e[0];const o=n.comp.map(g.getInstance().operationsInRow_);let i;return n.rel.some(function(s){return!s.equals(r)})?(i=g.getInstance().factory_.makeBranchNode(l.MULTIREL,o,n.rel),n.rel.every(function(s){return s.role===r.role})&&(i.role=r.role),i):(i=g.getInstance().factory_.makeBranchNode(l.RELSEQ,o,n.rel,Yn(r).textContent),i.role=r.role,i)}operationsInRow_(e){if(e.length===0)return g.getInstance().factory_.makeEmptyNode();if((e=g.getInstance().explicitMixed_(e)).length===1)return e[0];const n=[];for(;e.length>0&&Zn(e[0]);)n.push(e.shift());if(e.length===0)return g.getInstance().multiopNode_(n);if(e.length===1)return g.getInstance().prefixNode_(e[0],n);const r=kn(e=fe.run("convert_juxtaposition",e),Zn),o=g.getInstance().wrapFactor(n,r);return g.getInstance().addFactor(o,r)}wrapPostfix(e){var n;((n=e.div)===null||n===void 0?void 0:n.role)===d.POSTFIXOP&&(e.tail.length&&e.tail[0].type!==l.OPERATOR?e.div.role=d.DIVISION:(e.head=[g.getInstance().postfixNode_(g.getInstance().implicitNode(e.head),[e.div])],e.div=e.tail.shift(),g.getInstance().wrapPostfix(e)))}wrapFactor(e,n){return g.getInstance().wrapPostfix(n),g.getInstance().prefixNode_(g.getInstance().implicitNode(n.head),e)}addFactor(e,n){return n.div?g.getInstance().operationsTree_(n.tail,e,n.div):(da(e)&&(e.role=d.UNIT),e)}operationsTree_(e,n,r,o=[]){if(e.length===0){if(o.unshift(r),n.type===l.INFIXOP){const p=g.getInstance().postfixNode_(n.childNodes.pop(),o);return n.appendChild(p),n}return g.getInstance().postfixNode_(n,o)}const i=kn(e,Zn);if(i.head.length===0)return o.push(i.div),g.getInstance().operationsTree_(i.tail,n,r,o);const s=g.getInstance().wrapFactor(o,i),c=g.getInstance().appendOperand_(n,r,s);return g.getInstance().addFactor(c,i)}appendOperand_(e,n,r){return e.type!==l.INFIXOP?g.getInstance().infixNode_([e,r],n):g.getInstance().appendDivisionOp_(e,n,r)||(g.getInstance().appendExistingOperator_(e,n,r)?e:n.role===d.MULTIPLICATION?g.getInstance().appendMultiplicativeOp_(e,n,r):g.getInstance().appendAdditiveOp_(e,n,r))}appendDivisionOp_(e,n,r){return n.role===d.DIVISION?er(e)?g.getInstance().infixNode_([e,r],n):g.getInstance().appendLastOperand_(e,n,r):e.role===d.DIVISION?g.getInstance().infixNode_([e,r],n):null}appendLastOperand_(e,n,r){let o=e,i=e.childNodes[e.childNodes.length-1];for(;i&&i.type===l.INFIXOP&&!er(i);)o=i,i=o.childNodes[o.childNodes.length-1];const s=g.getInstance().infixNode_([o.childNodes.pop(),r],n);return o.appendChild(s),e}appendMultiplicativeOp_(e,n,r){if(er(e))return g.getInstance().infixNode_([e,r],n);let o=e,i=e.childNodes[e.childNodes.length-1];for(;i&&i.type===l.INFIXOP&&!er(i);)o=i,i=o.childNodes[o.childNodes.length-1];const s=g.getInstance().infixNode_([o.childNodes.pop(),r],n);return o.appendChild(s),e}appendAdditiveOp_(e,n,r){return g.getInstance().infixNode_([e,r],n)}appendExistingOperator_(e,n,r){return!(!e||e.type!==l.INFIXOP||er(e))&&(e.contentNodes[0].equals(n)?(e.appendContentNode(n),e.appendChild(r),!0):g.getInstance().appendExistingOperator_(e.childNodes[e.childNodes.length-1],n,r))}getFencesInRow_(e){let n=nn(e,ra);n=g.purgeFences_(n);const r=n.comp.shift();return g.getInstance().fences_(n.rel,n.comp,[],[r])}fences_(e,n,r,o){if(e.length===0&&r.length===0)return o[0];const i=fe.run("bracketed_interval",[e[0],e[1],...n[0]||[]],()=>null);if(i){e.shift(),e.shift(),n.shift();const T=o.pop()||[];return o.push([...T,i,...n.shift()]),g.getInstance().fences_(e,n,r,o)}const s=T=>qe(T,d.OPEN);if(e.length===0){const T=o.shift();for(;r.length>0;){if(s(r[0])){const C=r.shift();g.fenceToPunct_(C),T.push(C)}else{const C=kn(r,s),pe=C.head.length-1,Ne=g.getInstance().neutralFences_(C.head,o.slice(0,pe));o=o.slice(pe),T.push(...Ne),C.div&&C.tail.unshift(C.div),r=C.tail}T.push(...o.shift())}return T}const c=r[r.length-1],p=e[0].role;if(p===d.OPEN||yn(e[0])&&(!c||!wi(e[0],c))){r.push(e.shift());const T=n.shift();return T&&o.push(T),g.getInstance().fences_(e,n,r,o)}if(c&&p===d.CLOSE&&c.role===d.OPEN){const T=g.getInstance().horizontalFencedNode_(r.pop(),e.shift(),o.pop());return o.push(o.pop().concat([T],n.shift())),g.getInstance().fences_(e,n,r,o)}if(c&&wi(e[0],c)){if(!fa(c)||!pa(e[0])){r.push(e.shift());const C=n.shift();return C&&o.push(C),g.getInstance().fences_(e,n,r,o)}const T=g.getInstance().horizontalFencedNode_(r.pop(),e.shift(),o.pop());return o.push(o.pop().concat([T],n.shift())),g.getInstance().fences_(e,n,r,o)}if(c&&p===d.CLOSE&&yn(c)&&r.some(s)){const T=kn(r,s,!0),C=o.pop(),pe=o.length-T.tail.length+1,Ne=g.getInstance().neutralFences_(T.tail,o.slice(pe));o=o.slice(0,pe);const ae=g.getInstance().horizontalFencedNode_(T.div,e.shift(),o.pop().concat(Ne,C));return o.push(o.pop().concat([ae],n.shift())),g.getInstance().fences_(e,n,T.head,o)}const E=e.shift();return g.fenceToPunct_(E),o.push(o.pop().concat([E],n.shift())),g.getInstance().fences_(e,n,r,o)}neutralFences_(e,n){if(e.length===0)return e;if(e.length===1)return g.fenceToPunct_(e[0]),e;const r=e.shift();if(!fa(r)){g.fenceToPunct_(r);const s=n.shift();return s.unshift(r),s.concat(g.getInstance().neutralFences_(e,n))}const o=kn(e,function(s){return wi(s,r)});if(!o.div){g.fenceToPunct_(r);const s=n.shift();return s.unshift(r),s.concat(g.getInstance().neutralFences_(e,n))}if(!pa(o.div))return g.fenceToPunct_(o.div),e.unshift(r),g.getInstance().neutralFences_(e,n);const i=g.getInstance().combineFencedContent_(r,o.div,o.head,n);if(o.tail.length>0){const s=i.shift(),c=g.getInstance().neutralFences_(o.tail,i);return s.concat(c)}return i[0]}combineFencedContent_(e,n,r,o){if(r.length===0){const C=g.getInstance().horizontalFencedNode_(e,n,o.shift());return o.length>0?o[0].unshift(C):o=[[C]],o}const i=o.shift(),s=r.length-1,c=o.slice(0,s),p=(o=o.slice(s)).shift(),E=g.getInstance().neutralFences_(r,c);i.push(...E),i.push(...p);const T=g.getInstance().horizontalFencedNode_(e,n,i);return o.length>0?o[0].unshift(T):o=[[T]],o}horizontalFencedNode_(e,n,r){var o;const i=g.getInstance().row(r),s=(o=e.mathmlTree)===null||o===void 0?void 0:o.nextSibling;J(i,l.EMPTY)&&!i.mathmlTree&&e.mathmlTree&&n.mathmlTree!==s&&!Nr(n.mathmlTree,s)&&(i.mathmlTree=s,i.addMathmlNodes([s]));let c=g.getInstance().factory_.makeBranchNode(l.FENCED,[i],[e,n]);return e.role===d.OPEN?(g.getInstance().classifyHorizontalFence_(c),c=fe.run("propagateComposedFunction",c)):c.role=e.role,c=fe.run("detect_cycle",c),g.rewriteFencedNode_(c)}classifyHorizontalFence_(e){if(fe.run("interval_heuristic",e),e.role===d.INTERVAL)return;e.role=d.LEFTRIGHT;const n=e.childNodes;if(!(function(i){return(function(s){return!!s&&["{","﹛","{"].indexOf(s.textContent)!==-1})(Yn(i.contentNodes[0]))&&(function(s){return!!s&&["}","﹜","}"].indexOf(s.textContent)!==-1})(Yn(i.contentNodes[1]))})(e)||n.length>1)return;if(n.length===0||n[0].type===l.EMPTY)return void(e.role=d.SETEMPTY);const r=n[0].type;if(n.length===1&&vi(n[0]))return void(e.role=d.SETSINGLE);const o=n[0].role;if(r===l.PUNCTUATED&&o===d.SEQUENCE){if(n[0].contentNodes[0].role!==d.COMMA)return n[0].contentNodes.length!==1||n[0].contentNodes[0].role!==d.VBAR&&n[0].contentNodes[0].role!==d.COLON?void 0:(e.role=d.SETEXT,void g.getInstance().setExtension_(e));e.role=d.SETCOLLECT}}setExtension_(e){const n=e.childNodes[0].childNodes[0];n&&n.type===l.INFIXOP&&n.contentNodes.length===1&&ma(n.contentNodes[0])&&(n.addAnnotation("set","intensional"),n.contentNodes[0].addAnnotation("set","intensional"))}getPunctuationInRow_(e){if(e.length<=1)return e;const n=c=>{const p=c.type;return p==="punctuation"||p==="text"||p==="operator"||p==="relation"},r=nn(e,function(c){if(!Co(c))return!1;if(Co(c)&&!qe(c,d.ELLIPSIS))return!0;const p=e.indexOf(c);if(p===0)return!e[1]||!n(e[1]);const E=e[p-1];if(p===e.length-1)return!n(E);const T=e[p+1];return!n(E)||!n(T)});if(r.rel.length===0)return e;let o=[],i=r.comp.shift();i.length>0&&o.push(g.getInstance().row(i));let s=0;for(;r.comp.length>0;){let c=[];const p=s;do c.push(r.rel[s++]),i=r.comp.shift();while(r.rel[s]&&i&&i.length===0);c=fe.run("ellipses",c),r.rel.splice(p,s-p,...c),s=p+c.length,o=o.concat(c),i&&i.length>0&&o.push(g.getInstance().row(i))}return o.length===1&&r.rel.length===1?o:[g.getInstance().punctuatedNode_(o,r.rel)]}punctuatedNode_(e,n){const r=g.getInstance().factory_.makeBranchNode(l.PUNCTUATED,e,n);if(n.length===e.length){const i=n[0].role;if(i!==d.UNKNOWN&&n.every(function(s){return s.role===i}))return r.role=i,r}const o=n[0];return ua(e,n,0)?r.role=o.childNodes.length&&!o.embellished?o.role:d.STARTPUNCT:ua(e,n,e.length-1)?r.role=o.childNodes.length&&!o.embellished?o.role:d.ENDPUNCT:n.every(i=>qe(i,d.DUMMY))?r.role=d.TEXT:n.every(i=>qe(i,d.SPACE))?r.role=d.SPACE:r.role=d.SEQUENCE,r}dummyNode_(e){const n=g.getInstance().factory_.makeMultipleContentNodes(e.length-1,Rn.invisibleComma);return n.forEach(function(r){r.role=d.DUMMY}),g.getInstance().punctuatedNode_(e,n)}accentRole_(e,n){if(!Tr(e))return!1;const r=e.textContent,o=Fe.Secondary.get(r,Ye.BAR)||Fe.Secondary.get(r,Ye.TILDE)||e.role;return e.role=n===l.UNDERSCORE?d.UNDERACCENT:d.OVERACCENT,e.addAnnotation("accent",o),!0}accentNode_(e,n,r,o,i){const s=(n=n.slice(0,o+1))[1],c=n[2];let p;if(!i&&c&&(p=g.getInstance().factory_.makeBranchNode(l.SUBSCRIPT,[e,s],[]),p.role=d.SUBSUP,n=[p,c],r=l.SUPERSCRIPT),i){const E=g.getInstance().accentRole_(s,r);c&&(g.getInstance().accentRole_(c,l.OVERSCORE)&&!E?(p=g.getInstance().factory_.makeBranchNode(l.OVERSCORE,[e,c],[]),n=[p,s],r=l.UNDERSCORE):(p=g.getInstance().factory_.makeBranchNode(l.UNDERSCORE,[e,s],[]),n=[p,c],r=l.OVERSCORE),p.role=d.UNDEROVER)}return g.getInstance().makeLimitNode_(e,n,p,r)}makeLimitNode_(e,n,r,o){if(o===l.LIMUPPER&&e.type===l.LIMLOWER)return e.childNodes.push(n[1]),n[1].parent=e,e.type=l.LIMBOTH,e;if(o===l.LIMLOWER&&e.type===l.LIMUPPER)return e.childNodes.splice(1,-1,n[1]),n[1].parent=e,e.type=l.LIMBOTH,e;const i=g.getInstance().factory_.makeBranchNode(o,n,[]),s=ta(e);return r&&(r.embellished=s),i.embellished=s,i.role=e.role,i}getFunctionsInRow_(e,n){const r=n||[];if(e.length===0)return r;const o=e.shift(),i=g.classifyFunction_(o,e);if(!i)return r.push(o),g.getInstance().getFunctionsInRow_(e,r);const s=g.getInstance().getFunctionsInRow_(e,[]),c=g.getInstance().getFunctionArgs_(o,s,i);return r.concat(c)}getFunctionArgs_(e,n,r){let o,i,s;switch(r){case"integral":{const c=g.getInstance().getIntegralArgs_(n);if(!c.intvar&&!c.integrand.length)return c.rest.unshift(e),c.rest;const p=g.getInstance().row(c.integrand);return s=g.getInstance().integralNode_(e,p,c.intvar),fe.run("intvar_from_fraction",s),c.rest.unshift(s),c.rest}case"prefix":if(n[0]&&n[0].type===l.FENCED){const c=n.shift();return yn(c)||(c.role=d.LEFTRIGHT),s=g.getInstance().functionNode_(e,c),n.unshift(s),n}if(o=kn(n,eu),o.head.length)i=g.getInstance().row(o.head),o.div&&o.tail.unshift(o.div);else{if(!o.div||!J(o.div,l.APPL))return n.unshift(e),n;i=o.div}return s=g.getInstance().functionNode_(e,i),o.tail.unshift(s),o.tail;case"bigop":return o=kn(n,Zs),o.head.length?(i=g.getInstance().row(o.head),s=g.getInstance().bigOpNode_(e,i),o.div&&o.tail.unshift(o.div),o.tail.unshift(s),o.tail):(n.unshift(e),n);default:{if(n.length===0)return[e];const c=n[0];return c.type===l.FENCED&&!yn(c)&&(function(p){const E=p.childNodes;if(E.length===0)return!0;if(E.length>1)return!1;const T=E[0];return!(T.type===l.INFIXOP&&(T.role!==d.IMPLICIT||T.childNodes.some(C=>J(C,l.INFIXOP))))})(c)?(c.role=d.LEFTRIGHT,g.propagateFunctionRole_(e,d.SIMPLEFUNC),s=g.getInstance().functionNode_(e,n.shift()),n.unshift(s),n):(n.unshift(e),n)}}}getIntegralArgs_(e,n=[]){if(e.length===0){const o=kn(n,Zs);return o.div&&o.tail.unshift(o.div),{integrand:o.head,intvar:null,rest:o.tail}}fe.run("intvar_from_implicit",e);const r=e[0];if(Mi(r)){const{integrand:o,rest:i}=g.getInstance().getIntegralArgs_(n);return{integrand:o,intvar:null,rest:i.concat(e)}}if(Li(r))return r.role=d.INTEGRAL,{integrand:n,intvar:r,rest:e.slice(1)};if(e[1]&&ea(r,e[1])){const o=g.getInstance().prefixNode_(e[1],[r]);return o.role=d.INTEGRAL,{integrand:n,intvar:o,rest:e.slice(2)}}return n.push(e.shift()),g.getInstance().getIntegralArgs_(e,n)}functionNode_(e,n){const r=g.getInstance().factory_.makeContentNode(Rn.functionApplication),o=g.getInstance().funcAppls[e.id];o&&(r.mathmlTree=o.mathmlTree,r.addMathmlNodes(o.mathml),r.annotation=o.annotation,r.attributes=o.attributes,delete g.getInstance().funcAppls[e.id]),r.type=l.PUNCTUATION,r.role=d.APPLICATION;const i=g.getFunctionOp_(e,function(s){return J(s,l.FUNCTION)||J(s,l.IDENTIFIER)&&qe(s,d.SIMPLEFUNC)});return g.getInstance().functionalNode_(l.APPL,[e,n],i,[r])}bigOpNode_(e,n){const r=g.getFunctionOp_(e,o=>J(o,l.LARGEOP));return g.getInstance().functionalNode_(l.BIGOP,[e,n],r,[])}integralNode_(e,n,r){n=n||g.getInstance().factory_.makeEmptyNode(),r=r||g.getInstance().factory_.makeEmptyNode();const o=g.getFunctionOp_(e,i=>J(i,l.LARGEOP));return g.getInstance().functionalNode_(l.INTEGRAL,[e,n,r],o,[])}functionalNode_(e,n,r,o){const i=n[0];let s;r&&(s=r.parent,o.push(r));const c=g.getInstance().factory_.makeBranchNode(e,n,o);return c.role=i.role,s&&(r.parent=s),c}fractionNode_(e,n){const r=g.getInstance().factory_.makeBranchNode(l.FRACTION,[e,n],[]);return r.role=r.childNodes.every(function(o){return J(o,l.NUMBER)&&qe(o,d.INTEGER)})?d.VULGAR:r.childNodes.every(Di)?d.UNIT:d.DIVISION,fe.run("propagateSimpleFunction",r)}scriptNode_(e,n,r){let o;switch(e.length){case 0:o=g.getInstance().factory_.makeEmptyNode();break;case 1:if(o=e[0],r)return o;break;default:o=g.getInstance().dummyNode_(e),o.addAnnotation("general","script")}return o.role=n,o}findNestedRow_(e,n,r,o){if(r>3)return null;for(let i,s=0;i=e[s];s++){const c=Q(i);if(c!==v.MSPACE){if(c===v.MROW)return g.getInstance().findNestedRow_(Ae(i.childNodes),n,r+1,o);if(g.findSemantics(i,n,o))return i}}return null}}function ga(t,e,n){const r=t[t.length-1];if(r&&(r.type===l.RELATION||r.type===l.OPERATOR))return e.addAnnotation("factor",r.type),[...t,e,...n];const o=n[0];return!o||o.type!==l.RELATION&&o.type!==l.OPERATOR?null:(e.addAnnotation("factor",o.type),[...t,e,...n])}function Pi(t,e){return t.forEach(n=>e.addAnnotation("empty",n)),e}g.FENCE_TO_PUNCT_={[d.METRIC]:d.METRIC,[d.NEUTRAL]:d.VBAR,[d.OPEN]:d.OPENFENCE,[d.CLOSE]:d.CLOSEFENCE},g.MML_TO_LIMIT_={[v.MSUB]:{type:l.LIMLOWER,length:1},[v.MUNDER]:{type:l.LIMLOWER,length:1},[v.MSUP]:{type:l.LIMUPPER,length:1},[v.MOVER]:{type:l.LIMUPPER,length:1},[v.MSUBSUP]:{type:l.LIMBOTH,length:2},[v.MUNDEROVER]:{type:l.LIMBOTH,length:2}},g.MML_TO_BOUNDS_={[v.MSUB]:{type:l.SUBSCRIPT,length:1,accent:!1},[v.MSUP]:{type:l.SUPERSCRIPT,length:1,accent:!1},[v.MSUBSUP]:{type:l.SUBSCRIPT,length:2,accent:!1},[v.MUNDER]:{type:l.UNDERSCORE,length:1,accent:!0},[v.MOVER]:{type:l.OVERSCORE,length:1,accent:!0},[v.MUNDEROVER]:{type:l.UNDERSCORE,length:2,accent:!0}},g.CLASSIFY_FUNCTION_={[d.INTEGRAL]:"integral",[d.SUM]:"bigop",[d.PREFIXFUNC]:"prefix",[d.LIMFUNC]:"prefix",[d.SIMPLEFUNC]:"prefix",[d.COMPFUNC]:"prefix"},g.MATHJAX_FONTS={"-tex-caligraphic":be.CALIGRAPHIC,"-tex-caligraphic-bold":be.CALIGRAPHICBOLD,"-tex-calligraphic":be.CALIGRAPHIC,"-tex-calligraphic-bold":be.CALIGRAPHICBOLD,"-tex-oldstyle":be.OLDSTYLE,"-tex-oldstyle-bold":be.OLDSTYLEBOLD,"-tex-mathit":be.ITALIC};let Ir={};function au(t){return Array.from(t.textContent).map(W.stringEmpty)}function Ea(t,e){const n=Array.from(t.textContent),r=[],o=g.getInstance(),i=t.ownerDocument;for(let s,c=0;s=n[c];c++){const p=o.getNodeFactory().makeLeafNode(s,be.UNKNOWN),E=o.identifierNode(p,be.UNKNOWN,"");e(E),r.push(E.xml(i))}return r}function Na(t){return Ea(t,function(e){e.textContent.match(/\W/)||(e.type=l.NUMBER)})}function cu(t){return Ea(t,function(e){e.font=be.UNKNOWN,e.type=l.IDENTIFIER})}const eo=[l.CASES,l.CELL,l.INTEGRAL,l.LINE,l.MATRIX,l.MULTILINE,l.OVERSCORE,l.ROOT,l.ROW,l.SQRT,l.SUBSCRIPT,l.SUPERSCRIPT,l.TABLE,l.UNDERSCORE,l.VECTOR];function lu(t){return Ir={},[t]}function Lo(t,e,n,r,o,i){r=r||eo,o=o||{},i=i||function(p){return!1};const s=de(e);if(Ir[t]||(Ir[t]={}),Ir[t][s])return Ir[t][s];if(i(e)||n.indexOf(e.tagName)<0)return 0;const c=Sa(e,n,Oi(r,n),o,i,0);return Ir[t][s]=c,c}function Sa(t,e,n,r,o,i){if(o(t)||n.indexOf(t.tagName)>-1||(function(c,p){if(!c.attributes)return!1;const E=Ae(c.attributes);for(let T,C=0;T=E[C];C++)if(p[T.nodeName]===T.nodeValue)return!0;return!1})(t,r)||(e.indexOf(t.tagName)>-1&&i++,!t.childNodes||t.childNodes.length===0))return i;const s=Ae(t.childNodes);return Math.max.apply(null,s.map(function(c){return Sa(c,e,n,r,o,i)}))}function rn(t){return Lo("fraction",t,["fraction"],eo,{},I.FUNCTIONS.fracNestDepth)}function to(t,e,n){const r=rn(t),o=Array(r).fill(e);return n&&o.push(n),o.join(I.MESSAGES.regexp.JOINER_FRAC)}function uu(t){return W.singleton(to(t,I.MESSAGES.MS.START,I.MESSAGES.MS.FRAC_V))}function hu(t){return W.singleton(to(t,I.MESSAGES.MS.END,I.MESSAGES.MS.FRAC_V),{kind:"LAST"})}function du(t){return W.singleton(to(t,I.MESSAGES.MS.FRAC_OVER),{})}function fu(t){return W.singleton(to(t,I.MESSAGES.MS.START,I.MESSAGES.MS.FRAC_B))}function pu(t){return W.singleton(to(t,I.MESSAGES.MS.END,I.MESSAGES.MS.FRAC_B),{kind:"LAST"})}function mu(t){const e=rn(t);return W.singleton(e===1?I.MESSAGES.MS.FRAC_S:I.FUNCTIONS.combineNestedFraction(I.MESSAGES.MS.NEST_FRAC,I.FUNCTIONS.radicalNestDepth(e-1),I.MESSAGES.MS.FRAC_S))}function gu(t){const e=rn(t);return W.singleton(e===1?I.MESSAGES.MS.ENDFRAC:I.FUNCTIONS.combineNestedFraction(I.MESSAGES.MS.NEST_FRAC,I.FUNCTIONS.radicalNestDepth(e-1),I.MESSAGES.MS.ENDFRAC),{kind:"LAST"})}function Eu(t){const e=rn(t);return W.singleton(e===1?I.MESSAGES.MS.FRAC_OVER:I.FUNCTIONS.combineNestedFraction(I.MESSAGES.MS.NEST_FRAC,I.FUNCTIONS.radicalNestDepth(e-1),I.MESSAGES.MS.FRAC_OVER))}function Ta(t){return I.FUNCTIONS.fracNestDepth(t)?[t]:[]}function tr(t,e,n){for(;t.parentNode;){const r=t.parentNode,o=r.parentNode;if(!o)break;const i=t.getAttribute&&t.getAttribute("role");(o.tagName===l.SUBSCRIPT&&t===r.childNodes[1]||o.tagName===l.TENSOR&&i&&(i===d.LEFTSUB||i===d.RIGHTSUB))&&(e=n.sub+I.MESSAGES.regexp.JOINER_SUBSUPER+e),(o.tagName===l.SUPERSCRIPT&&t===r.childNodes[1]||o.tagName===l.TENSOR&&i&&(i===d.LEFTSUPER||i===d.RIGHTSUPER))&&(e=n.sup+I.MESSAGES.regexp.JOINER_SUBSUPER+e),t=o}return e.trim()}function no(t){return W.singleton(tr(t,I.MESSAGES.MS.SUBSCRIPT,{sup:I.MESSAGES.MS.SUPER,sub:I.MESSAGES.MS.SUB}))}function Mo(t){return W.singleton(tr(t,I.MESSAGES.MS.SUB,{sup:I.MESSAGES.MS.SUP,sub:I.MESSAGES.MS.SUB}))}function ro(t){return W.singleton(tr(t,I.MESSAGES.MS.SUPERSCRIPT,{sup:I.MESSAGES.MS.SUPER,sub:I.MESSAGES.MS.SUB}))}function vo(t){return W.singleton(tr(t,I.MESSAGES.MS.SUP,{sup:I.MESSAGES.MS.SUP,sub:I.MESSAGES.MS.SUB}))}function xi(t){const e=tr(t,"",{sup:I.MESSAGES.MS.SUPER,sub:I.MESSAGES.MS.SUB});return W.singleton(e?e.replace(new RegExp(I.MESSAGES.MS.SUB+"$"),I.MESSAGES.MS.SUBSCRIPT).replace(new RegExp(I.MESSAGES.MS.SUPER+"$"),I.MESSAGES.MS.SUPERSCRIPT):I.MESSAGES.MS.BASELINE)}function Ia(t){const e=tr(t,"",{sup:I.MESSAGES.MS.SUP,sub:I.MESSAGES.MS.SUB});return W.singleton(e||I.MESSAGES.MS.BASE)}function Aa(t){return Lo("radical",t,["sqrt","root"],eo,{})}function Wn(t,e,n){const r=Aa(t),o=(function(i){const s=i.tagName==="sqrt"?"2":he("children/*[1]",i)[0].textContent.trim();return I.MESSAGES.MSroots[s]||""})(t);return n=o?I.FUNCTIONS.combineRootIndex(n,o):n,r===1?n:I.FUNCTIONS.combineNestedRadical(e,I.FUNCTIONS.radicalNestDepth(r-1),n)}function Nu(t){return W.singleton(Wn(t,I.MESSAGES.MS.NESTED,I.MESSAGES.MS.STARTROOT))}function Su(t){return W.singleton(Wn(t,I.MESSAGES.MS.NESTED,I.MESSAGES.MS.ENDROOT))}function Tu(t){return W.singleton(Wn(t,I.MESSAGES.MS.NESTED,I.MESSAGES.MS.ROOTINDEX))}function Iu(t){return W.singleton(Wn(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.STARTROOT))}function Au(t){return W.singleton(Wn(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.ENDROOT))}function bu(t){return W.singleton(Wn(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.ROOTINDEX))}function Ou(t){return W.singleton(Wn(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.ROOT))}function Ru(t){return W.singleton(Wn(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.INDEX))}function yu(t){const e=(function(n){return Lo("underscore",n,["underscore"],eo,{},function(r){return r.tagName&&r.tagName===l.UNDERSCORE&&r.childNodes[0].childNodes[1].getAttribute("role")===d.UNDERACCENT})})(t);return W.singleton(Array(e).join(I.MESSAGES.MS.UNDER)+I.MESSAGES.MS.UNDERSCRIPT)}function Cu(t){return W.singleton(I.MESSAGES.MS.ENDSCRIPTS)}function Lu(t){const e=(function(n){return Lo("overscore",n,["overscore"],eo,{},function(r){return r.tagName&&r.tagName===l.OVERSCORE&&r.childNodes[0].childNodes[1].getAttribute("role")===d.OVERACCENT})})(t);return W.singleton(Array(e).join(I.MESSAGES.MS.OVER)+I.MESSAGES.MS.OVERSCRIPT)}function Mu(t){if(t.tagName!==l.MATRIX||t.getAttribute("role")!==d.DETERMINANT)return[];const e=he("children/row/children/cell/children/*",t);for(let n,r=0;n=e[r];r++)if(n.tagName!==l.NUMBER){if(n.tagName===l.IDENTIFIER){const o=n.getAttribute("role");if(o===d.LATINLETTER||o===d.GREEKLETTER||o===d.OTHERLETTER)continue}return[]}return[t]}function vu(){const t=s=>s.map(c=>"ancestor::"+c),e=s=>"not("+s+")",n=e(t(["subscript","superscript","tensor"]).join(" or ")),r=t(["relseq","multrel"]),o=t(["fraction","punctuation","fenced","sqrt","root"]);let i=[];for(let s,c=0;s=o[c];c++)i=i.concat(r.map(function(p){return s+"/"+p}));return[["ancestor::*/following-sibling::*",n,e(i.join(" | "))].join(" and ")]}function Du(t){if(!t.childNodes.length||!t.childNodes[0].childNodes.length||!t.childNodes[0].childNodes[0].childNodes.length)return W.singleton("");const e=t.childNodes[0].childNodes[0].childNodes[0].textContent;return W.singleton(e.match(/^\(.+\)$/)?e.slice(1,-1):e)}const ba=new Map([[3,"CSFleftsuperscript"],[4,"CSFleftsubscript"],[2,"CSFbaseline"],[1,"CSFrightsubscript"],[0,"CSFrightsuperscript"]]),wu=new Map([[4,2],[3,3],[2,1],[1,4],[0,5]]);function Pu(t){const e=[];let n="",r="",o=parseInt(t,2);for(let i=0;i<5;i++){const s="children/*["+wu.get(i)+"]";if(1&o){const c=ba.get(i%5);n="[t] "+c+"Verbose; [n] "+s+";"+n,r="[t] "+c+"Brief; [n] "+s+";"+r}else e.unshift("name("+s+')="empty"');o>>=1}return[e,n,r]}function Oa(t,e=!0){for(const n of["11111","11110","11101","11100","10111","10110","10101","10100","01111","01110","01101","01100"]){let r="tensor"+n,[o,i,s]=Pu(n);if(t.defineRule(r,"default",i,"self::tensor",...o),e&&(t.defineRule(r,"brief",s,"self::tensor",...o),t.defineRule(r,"sbrief",s,"self::tensor",...o)),!(3&parseInt(n,2)))continue;const c=ba.get(2);i+="; [t]"+c+"Verbose",s+="; [t]"+c+"Brief",r+="-baseline";const p="((.//*[not(*)])[last()]/@id)!=(((.//ancestor::fraction|ancestor::root|ancestor::sqrt|ancestor::cell|ancestor::line|ancestor::stree)[1]//*[not(*)])[last()]/@id)";t.defineRule(r,"default",i,"self::tensor",p,...o),e&&(t.defineRule(r,"brief",s,"self::tensor",p,...o),t.defineRule(r,"sbrief",s,"self::tensor",p,...o))}}function xu(t){let e=Object.keys(I.MESSAGES.MSroots).length;if(!e)return[];if(e++,!t.childNodes||t.childNodes.length===0||!t.childNodes[0].childNodes)return[];const n=t.childNodes[0].childNodes[0].textContent;if(!/^\d+$/.test(n))return[];const r=parseInt(n,10);return r>1&&r<=e?[t]:[]}function Fu(t,e){let n=0;return function(){return I.NUMBERS.numericOrdinal(++n)+" "+e}}function Uu(t,e){let n=0;return function(){return I.NUMBERS.numberToOrdinal(++n,!1)+" "+e}}function Fi(t){const e=In(t,I.MESSAGES.MS.FRAC_OVER);return e.convertible&&e.enumerator&&e.denominator?[W.node(I.NUMBERS.numberToWords(e.enumerator),t.childNodes[0].childNodes[0],{separator:""}),W.stringAttr(I.NUMBERS.vulgarSep,{separator:""}),W.node(I.NUMBERS.numberToOrdinal(e.denominator,e.enumerator!==1),t.childNodes[0].childNodes[1])]:[W.node(e.content||"",t)]}function _u(t){const e=Ae(t.parentNode.childNodes);return W.singleton(I.NUMBERS.numericOrdinal(e.indexOf(t)+1).toString())}function ku(t){const e=xi(t);return e[0].speech=e[0].speech.replace(/-$/,""),e}function Bu(t){const e=Ia(t);return e[0].speech=e[0].speech.replace(/-$/,""),e}function Gu(t){const e=ro(t);return e[0].speech=e[0].speech.replace(/^exposant/,"exposant gauche"),e}function Vu(t){const e=no(t);return e[0].speech=e[0].speech.replace(/^indice/,"indice gauche"),e}function Hu(t){const e=vo(t);return e[0].speech=e[0].speech.replace(/^sup/,"sup gauche"),e}function ju(t){const e=Mo(t);return e[0].speech=e[0].speech.replace(/^sub/,"sub gauche"),e}function Do(t,e,n){const r=rn(t),o=[...Array(r)].map(i=>e);return n&&o.unshift(n),o.join(I.MESSAGES.regexp.JOINER_FRAC)}function $u(t){return W.singleton(Do(t,I.MESSAGES.MS.START,I.MESSAGES.MS.FRAC_V))}function Xu(t){return W.singleton(Do(t,I.MESSAGES.MS.END,I.MESSAGES.MS.FRAC_V))}function Yu(t){return W.singleton(Do(t,I.MESSAGES.MS.START,I.MESSAGES.MS.FRAC_B))}function Wu(t){return W.singleton(Do(t,I.MESSAGES.MS.END,I.MESSAGES.MS.FRAC_B))}function Ku(t){const e=rn(t);return e===1?W.singleton(I.MESSAGES.MS.FRAC_S):W.singleton(I.FUNCTIONS.combineNestedFraction(I.FUNCTIONS.radicalNestDepth(e-1),I.MESSAGES.MS.NEST_FRAC,I.MESSAGES.MS.FRAC_S))}function zu(t){const e=rn(t);return e===1?W.singleton(I.MESSAGES.MS.ENDFRAC):W.singleton(I.FUNCTIONS.combineNestedFraction(I.FUNCTIONS.radicalNestDepth(e-1),I.MESSAGES.MS.NEST_FRAC,I.MESSAGES.MS.ENDFRAC))}function Qu(t){const e=rn(t);return e===1?W.singleton(I.MESSAGES.MS.FRAC_OVER):W.singleton(I.FUNCTIONS.combineNestedFraction(I.FUNCTIONS.radicalNestDepth(e-1),I.MESSAGES.MS.NEST_FRAC,I.MESSAGES.MS.FRAC_OVER))}function Ju(t){return he("children/*[1]",t)[0].toString().match(/[^>\u2062>]+<\/[^>]*>/g).length===1?[t]:[]}function oo(t,e,n){const r=Aa(t);return r===1?n:I.FUNCTIONS.combineNestedRadical(I.FUNCTIONS.radicalNestDepth(r-1),e,n)}function qu(t){return W.singleton(oo(t,I.MESSAGES.MS.NESTED,I.MESSAGES.MS.STARTROOT))}function Zu(t){return W.singleton(oo(t,I.MESSAGES.MS.NESTED,I.MESSAGES.MS.ENDROOT))}function eh(t){return W.singleton(oo(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.STARTROOT))}function th(t){return W.singleton(oo(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.ENDROOT))}function nh(t){return W.singleton(oo(t,I.MESSAGES.MS.NEST_ROOT,I.MESSAGES.MS.ROOT))}function Ui(t,e){return(function(n){const r=he("children/*[1]",n)[0].textContent.trim();return I.MESSAGES.MSroots[r]||r+"제곱근"})(t)||e}function rh(t){return W.singleton(Ui(t,I.MESSAGES.MS.ROOTINDEX))}function oh(t){return W.singleton(Ui(t,I.MESSAGES.MS.ROOTINDEX))}function ih(t){return W.singleton(Ui(t,I.MESSAGES.MS.INDEX))}function sh(t){const e=he("children/*",t);return W.singleton(I.NUMBERS.wordOrdinal(e.length))}function ah(t){const e=he("children/*",t);return W.singleton(I.NUMBERS.wordOrdinal(e.length-1))}function ch(t){const e=he("children/*",t),n=he("content/*",t);return W.singleton(I.NUMBERS.wordOrdinal(e.length-n.length))}function lh(t,e){const n=t;let r=0;return function(){const o=Ke.create({text:hh(n[r])&&dh(n[r+1])?I.MESSAGES.unitTimes:""},{});return r++,[o]}}const uh=[l.SUPERSCRIPT,l.SUBSCRIPT,l.OVERSCORE,l.UNDERSCORE];function hh(t){for(;t;){if(t.getAttribute("role")==="unit")return!0;const e=t.tagName,n=he("children/*",t);t=uh.indexOf(e)!==-1?n[0]:n[n.length-1]}return!1}function dh(t){for(;t;){if(t.getAttribute("role")==="unit")return!0;t=he("children/*",t)[0]}return!1}function fh(t){for(;t;){if(t.tagName==="number"&&t.textContent==="1")return[t];if(t.tagName!=="infixop"||t.getAttribute("role")!=="multiplication"&&t.getAttribute("role")!=="implicit")return[];t=he("children/*",t)[0]}return[]}function ph(t){const e=rn(t);return W.singleton(new Array(e).join(I.MESSAGES.MS.FRACTION_REPEAT)+I.MESSAGES.MS.FRACTION_START)}function mh(t){const e=rn(t);return W.singleton(new Array(e).join(I.MESSAGES.MS.FRACTION_REPEAT)+I.MESSAGES.MS.FRACTION_END)}function gh(t){const e=rn(t);return W.singleton(new Array(e).join(I.MESSAGES.MS.FRACTION_REPEAT)+I.MESSAGES.MS.FRACTION_OVER)}function Eh(t){const e=rn(t);return W.singleton(new Array(e).join(I.MESSAGES.MS.FRACTION_REPEAT)+"⠸"+I.MESSAGES.MS.FRACTION_OVER)}function Nh(t){return I.MESSAGES.regexp.HYPER===rn(t).toString()?[t]:[]}function _i(t,e){const n=Ra(t);return W.singleton(n===1?e:new Array(n).join(I.MESSAGES.MS.NESTED)+e)}function Ra(t,e){const n=e||0;return t.parentNode?Ra(t.parentNode,t.tagName==="root"||t.tagName==="sqrt"?n+1:n):n}function Sh(t){return _i(t,I.MESSAGES.MS.STARTROOT)}function Th(t){return _i(t,I.MESSAGES.MS.ENDROOT)}function Ih(t){return _i(t,I.MESSAGES.MS.ROOTINDEX)}function Ah(t,e){var n;const r=t.slice(0);let o=!0;const i=t[0].parentNode.parentNode,s=(n=i.getAttribute("annotation"))===null||n===void 0?void 0:n.match(/depth:(\d+)/),c=s?s[1]:"";let p;return p=t.length>0?he("./content/*",i):[],function(){const E=p.shift(),T=r.shift(),C=r[0],pe=e?[Ke.create({text:e},{translate:!0})]:[];if(!E)return pe;const Ne=T?tr(T,"",{sup:I.MESSAGES.MS.SUPER,sub:I.MESSAGES.MS.SUB}):"",ae=T&&Q(T)!=="EMPTY"||o&&i&&i.previousSibling?[Ke.create({text:I.MESSAGES.regexp.SPACE+Ne},{})]:[],rt=C&&Q(C)!=="EMPTY"||!p.length&&i&&i.nextSibling?[Ke.create({text:I.MESSAGES.regexp.SPACE},{})]:[],Nt=L.evaluateNode(E);return Nt.unshift(new Ke({text:"",layout:`beginrel${c}`})),Nt.push(new Ke({text:"",layout:`endrel${c}`})),o=!1,pe.concat(ae,Nt,rt)}}function bh(t,e){const n=t.slice(0);let r;return r=t.length>0?he("../../content/*",t[0]):[],function(){const o=n.shift(),i=n[0],s=r.shift(),c=e?[Ke.create({text:e},{translate:!0})]:[];if(!s)return c;const p=o&&Q(o)==="NUMBER",E=i&&Q(i)==="NUMBER";return c.concat(p&&E&&s.getAttribute("role")===d.SPACE?[Ke.create({text:I.MESSAGES.regexp.SPACE},{})]:[])}}function Oh(t,e){var n;const r=bo(t,e),o=(n=t[0].parentNode.parentNode.getAttribute("annotation"))===null||n===void 0?void 0:n.match(/depth:(\d+)/),i=o?o[1]:"";return function(){const s=r();return s.unshift(new Ke({text:"",layout:`beginrel${i}`})),s.push(new Ke({text:"",layout:`endrel${i}`})),s}}P.getInstance().setCorrection("enlargeFence",function(t){if(t.length===1)return"⠠"+t;const n=t.split("");return n.every(function(r){return r==="⠳"})?"⠠"+n.join("⠠"):t.slice(0,-1)+"⠠"+t.slice(-1)}),P.getInstance().setCorrection("ignoreEnglish",function(t){return Le(t,I.ALPHABETS.languagePrefix.english)}),P.getInstance().setCorrection("literal",function(t){return Array.from(t).map(e=>L.getInstance().evaluator(e,L.getInstance().dynamicCstr)).join("")});let ya=!1;function Rh(){ya||(pn(D.BASE_LOCALE+".speech.mathspeak","",{CQFspaceoutNumber:Na,CQFspaceoutIdentifier:cu,CSFspaceoutText:au,CSFopenFracVerbose:uu,CSFcloseFracVerbose:hu,CSFoverFracVerbose:du,CSFopenFracBrief:fu,CSFcloseFracBrief:pu,CSFopenFracSbrief:mu,CSFcloseFracSbrief:gu,CSFoverFracSbrief:Eu,CSFvulgarFraction:Fi,CQFvulgarFractionSmall:Ta,CSFopenRadicalVerbose:Nu,CSFcloseRadicalVerbose:Su,CSFindexRadicalVerbose:Tu,CSFopenRadicalBrief:Iu,CSFcloseRadicalBrief:Au,CSFindexRadicalBrief:bu,CSFopenRadicalSbrief:Ou,CSFindexRadicalSbrief:Ru,CQFisSmallRoot:xu,CSFsuperscriptVerbose:ro,CSFsuperscriptBrief:vo,CSFsubscriptVerbose:no,CSFsubscriptBrief:Mo,CSFbaselineVerbose:xi,CSFbaselineBrief:Ia,CSFleftsuperscriptVerbose:ro,CSFleftsubscriptVerbose:no,CSFrightsuperscriptVerbose:ro,CSFrightsubscriptVerbose:no,CSFleftsuperscriptBrief:vo,CSFleftsubscriptBrief:Mo,CSFrightsuperscriptBrief:vo,CSFrightsubscriptBrief:Mo,CSFunderscript:yu,CSFoverscript:Lu,CSFendscripts:Cu,CTFordinalCounter:Fu,CTFwordCounter:Uu,CTFcontentIterator:bo,CQFdetIsSimple:Mu,CSFRemoveParens:Du,CQFresetNesting:lu,CGFbaselineConstraint:vu,CGFtensorRules:Oa}),pn("es.speech.mathspeak",D.BASE_LOCALE+".speech.mathspeak",{CTFunitMultipliers:lh,CQFoneLeft:fh}),pn("fr.speech.mathspeak",D.BASE_LOCALE+".speech.mathspeak",{CSFbaselineVerbose:ku,CSFbaselineBrief:Bu,CSFleftsuperscriptVerbose:Gu,CSFleftsubscriptVerbose:Vu,CSFleftsuperscriptBrief:Hu,CSFleftsubscriptBrief:ju}),pn("ko.speech.mathspeak",D.BASE_LOCALE+".speech.mathspeak",{CSFopenFracVerbose:$u,CSFcloseFracVerbose:Xu,CSFopenFracBrief:Yu,CSFcloseFracBrief:Wu,CSFopenFracSbrief:Ku,CSFoverFracSbrief:Qu,CSFcloseFracSbrief:zu,CQFisSimpleIndex:Ju,CSFindexRadicalVerbose:rh,CSFindexRadicalBrief:oh,CSFindexRadicalSbrief:ih,CSFopenRadicalVerbose:qu,CSFcloseRadicalVerbose:Zu,CSFopenRadicalBrief:eh,CSFcloseRadicalBrief:th,CSFopenRadicalSbrief:nh}),pn(D.BASE_LOCALE+".speech.clearspeak","",{CTFpauseSeparator:wl,CTFnodeCounter:Pl,CTFcontentIterator:bo,CSFvulgarFraction:Fi,CQFvulgarFractionSmall:Ul,CQFcellsSimple:Fl,CSFordinalExponent:_l,CSFwordOrdinal:Hl,CQFmatchingFences:Bl,CSFnestingDepth:kl,CQFfencedArguments:Gl,CQFsimpleArguments:Vl,CQFspaceoutNumber:Na,CQFisUnit:jl}),pn("en.prefix.default","",{CSFordinalPosition:_u}),pn("en.speech.chromevox","",{CTFnodeCounter:Gs,CTFcontentIterator:bo}),pn("en.speech.emacspeak","en.speech.chromevox",{CQFvulgarFractionSmall:Ta,CSFvulgarFraction:Fi}),pn("ko.summary.","ko.speech.mathspeak",{CSFordinalConversion:sh,CSFdecreasedOrdinalConversion:ah,CSFlistOrdinalConversion:ch}),pn("nemeth.braille.default",D.BASE_LOCALE+".speech.mathspeak",{CSFopenFraction:ph,CSFcloseFraction:mh,CSFoverFraction:gh,CSFoverBevFraction:Eh,CQFhyperFraction:Nh,CSFopenRadical:Sh,CSFcloseRadical:Th,CSFindexRadical:Ih,CSFsubscript:no,CSFsuperscript:ro,CSFbaseline:xi,CGFtensorRules:t=>Oa(t,!1),CTFcontentIterator:Oh,CTFrelationIterator:Ah,CTFimplicitIterator:bh}),pn("euro.braille.default","nemeth.braille.default",{}),ya=!0)}class ki{constructor(e,n,r){this.domain=e,this.name=n,this.func=r,this.active=!1}annotate(e){e.childNodes.forEach(this.annotate.bind(this)),e.contentNodes.forEach(this.annotate.bind(this)),e.addAnnotation(this.domain,this.func(e))}}class Bi{constructor(e,n,r,o={}){this.domain=e,this.name=n,this.func=r,this.def=o,this.active=!1}visit(e,n){let r=this.func(e,n);e.addAnnotation(this.domain,r[0]);for(let o,i=0;o=e.childNodes[i];i++)r=this.visit(o,r[1]);for(let o,i=0;o=e.contentNodes[i];i++)r=this.visit(o,r[1]);return r}}const Gi=new Map,Vi=new Map;function wo(t){const e=t.domain+":"+t.name;t instanceof ki?Gi.set(e,t):Vi.set(e,t)}function Ar(t,e){const n=t+":"+e,r=Gi.get(n)||Vi.get(n);r&&(r.active=!0)}class io{constructor(e,n,r,o){this.name=e,this.dynamicCstr=n,this.precondition=r,this.action=o,this.context=null}toString(){return this.name+" | "+this.dynamicCstr.toString()+" | "+this.precondition.toString()+" ==> "+this.action.toString()}}var vt,Dt;function yh(t){switch(t){case"[n]":return vt.NODE;case"[m]":return vt.MULTI;case"[t]":return vt.TEXT;case"[p]":return vt.PERSONALITY;default:throw"Parse error: "+t}}(function(t){t.NODE="NODE",t.MULTI="MULTI",t.TEXT="TEXT",t.PERSONALITY="PERSONALITY"})(vt||(vt={}));class so{static grammarFromString(e){return P.parseInput(e)}static fromString(e){const n={type:yh(e.substring(0,3))};let r=e.slice(3).trim();if(!r)throw new rr("Missing content.");switch(n.type){case vt.TEXT:if(r[0]==='"'){const o=Hi(r,"\\(")[0].trim();if(o.slice(-1)!=='"')throw new rr("Invalid string syntax.");n.content=o,r=r.slice(o.length).trim(),r.indexOf("(")===-1&&(r="");break}case vt.NODE:case vt.MULTI:{const o=r.indexOf(" (");if(o===-1){n.content=r.trim(),r="";break}n.content=r.substring(0,o).trim(),r=r.slice(o).trim()}}if(r){const o=so.attributesFromString(r);o.grammar&&(n.grammar=o.grammar,delete o.grammar),Object.keys(o).length&&(n.attributes=o)}return new so(n)}static attributesFromString(e){if(e[0]!=="("||e.slice(-1)!==")")throw new rr("Invalid attribute expression: "+e);const n={},r=Hi(e.slice(1,-1),",");for(const o of r){const i=o.indexOf(":");if(i===-1)n[o.trim()]="true";else{const s=o.substring(0,i).trim(),c=o.slice(i+1).trim();n[s]=s===X?so.grammarFromString(c):c}}return n}constructor({type:e,content:n,attributes:r,grammar:o}){this.type=e,this.content=n,this.attributes=r,this.grammar=o}toString(){let e="";e+=(function(r){switch(r){case vt.NODE:return"[n]";case vt.MULTI:return"[m]";case vt.TEXT:return"[t]";case vt.PERSONALITY:return"[p]";default:throw"Unknown type error: "+r}})(this.type),e+=this.content?" "+this.content:"";const n=this.attributesToString();return e+=n?" "+n:"",e}grammarToString(){return this.getGrammar().join(":")}getGrammar(){if(!this.grammar)return[];const e=[];for(const[n,r]of Object.entries(this.grammar))e.push(r===!0?n:r===!1?`!${n}`:`${n}=${r}`);return e}attributesToString(){const e=this.getAttributes(),n=this.grammarToString();return n&&e.push("grammar:"+n),e.length>0?"("+e.join(", ")+")":""}getAttributes(){if(!this.attributes)return[];const e=[];for(const[n,r]of Object.entries(this.attributes))e.push(r==="true"?n:`${n}:${r}`);return e}}class nr{static fromString(e){const n=Hi(e,";").filter(function(o){return o.match(/\S/)}).map(function(o){return o.trim()}),r=[];for(let o=0,i=n.length;o<i;o++){const s=so.fromString(n[o]);s&&r.push(s)}return nr.naiveSpan(r),new nr(r)}static naiveSpan(e){var n;let r=!1;for(let o,i=0;o=e[i];i++){if(r&&(o.type!==vt.TEXT||o.content[0]!=='"'&&!o.content.match(/^CSF/))||!r&&o.type===vt.PERSONALITY)continue;if(!r){r=!0;continue}if(!((n=o.attributes)===null||n===void 0)&&n.span)continue;const s=e[i+1];s&&s.type!==vt.NODE||nr.addNaiveSpan(o,s?s.content:"LAST")}}static addNaiveSpan(e,n){e.attributes||(e.attributes={}),e.attributes.span=n}constructor(e){this.components=e}toString(){return this.components.map(function(e){return e.toString()}).join("; ")}}class Kn{static constraintValue(e,n){for(let r,o=0;r=n[o];o++)if(e.match(r))return++o;return 0}toString(){const e=this.constraints.join(", ");return`${this.query}, ${e} (${this.priority}, ${this.rank})`}constructor(e,...n){this.query=e,this.constraints=n;const[r,o]=this.presetPriority();this.priority=r?o:this.calculatePriority()}calculatePriority(){const e=Kn.constraintValue(this.query,Kn.queryPriorities);if(!e)return 0;const n=this.query.match(/^self::.+\[(.+)\]/);let r=0;if(n?.length&&n[1]){const o=n[1];r=Kn.constraintValue(o,Kn.attributePriorities)}return 100*e+10*r}presetPriority(){if(!this.constraints.length)return[!1,0];const e=this.constraints[this.constraints.length-1].match(/^priority=(.*$)/);if(!e)return[!1,0];this.constraints.pop();const n=parseFloat(e[1]);return[!0,isNaN(n)?0:n]}}Kn.queryPriorities=[/^self::\*$/,/^self::[\w-]+$/,/^self::\*\[.+\]$/,/^self::[\w-]+\[.+\]$/],Kn.attributePriorities=[/^@[\w-]+$/,/^@[\w-]+!=".+"$/,/^not\(contains\(@[\w-]+,\s*".+"\)\)$/,/^contains\(@[\w-]+,".+"\)$/,/^@[\w-]+=".+"$/];class rr extends ue{constructor(e){super(e),this.name="RuleError"}}function Hi(t,e){const n=[];let r="";for(;t!=="";){const o=t.search(e);if(o===-1){if((t.match(/"/g)||[]).length%2!=0)throw new rr("Invalid string in expression: "+t);n.push(r+t),r="",t=""}else if((t.substring(0,o).match(/"/g)||[]).length%2==0)n.push(r+t.substring(0,o)),r="",t=t.substring(o+1);else{const i=t.substring(o).search('"');if(i===-1)throw new rr("Invalid string in expression: "+t);r+=t.substring(0,o+i+1),t=t.substring(o+i+1)}}return r&&n.push(r),n}class Po{constructor(e,n){this.prefix=e,this.store=n}add(e,n){this.checkCustomFunctionSyntax_(e)&&(this.store[e]=n)}addStore(e){const n=Object.keys(e.store);for(let r,o=0;r=n[o];o++)this.add(r,e.store[r])}lookup(e){return this.store[e]}checkCustomFunctionSyntax_(e){const n=new RegExp("^"+this.prefix);return!!e.match(n)||(console.error("FunctionError: Invalid function name. Expected prefix "+this.prefix),!1)}}class Ch extends Po{constructor(){super("CQF",{})}}class Lh extends Po{constructor(){super("CSF",{})}}class Mh extends Po{constructor(){super("CTF",{})}}class vh extends Po{constructor(){super("CGF",{})}}class Dh{constructor(){this.customQueries=new Ch,this.customStrings=new Lh,this.contextFunctions=new Mh,this.customGenerators=new vh}applyCustomQuery(e,n){const r=this.customQueries.lookup(n);return r?r(e):null}applySelector(e,n){return this.applyCustomQuery(e,n)||he(n,e)}applyQuery(e,n){const r=this.applySelector(e,n);return r.length>0?r[0]:null}applyConstraint(e,n){return!!this.applyQuery(e,n)||(function(r,o){let i;try{i=lt(r,o,Be.result.BOOLEAN_TYPE)}catch{return!1}return i.booleanValue})(n,e)}constructString(e,n){const r=this.constructString_(e,n);return Array.isArray(r)?r.map(o=>o.speech).join(""):r}constructSpan(e,n,r){const o=this.constructString_(e,n);if(Array.isArray(o)){const i=o[o.length-1];return i.attributes=Object.assign({},r,i.attributes),o}return[W.node(o,e,r)]}constructString_(e,n){if(!n)return"";if(n.charAt(0)==='"')return n.slice(1,-1);const r=this.customStrings.lookup(n);return r?r(e):(function(o,i){let s;try{s=lt(o,i,Be.result.STRING_TYPE)}catch{return""}return s.stringValue})(n,e)}parse(e){const n=Array.isArray(e)?e:Object.entries(e);for(const r of n)switch(r[0].slice(0,3)){case"CQF":this.customQueries.add(r[0],r[1]);break;case"CSF":this.customStrings.add(r[0],r[1]);break;case"CTF":this.contextFunctions.add(r[0],r[1]);break;case"CGF":this.customGenerators.add(r[0],r[1]);break;default:console.error("FunctionError: Invalid function name "+r[0])}}}class xo{static compareStaticConstraints_(e,n){if(e.length!==n.length)return!1;for(let r,o=0;r=e[o];o++)if(n.indexOf(r)===-1)return!1;return!0}static comparePreconditions_(e,n){const r=e.precondition,o=n.precondition;return r.query===o.query&&xo.compareStaticConstraints_(r.constraints,o.constraints)}constructor(){this.context=new Dh,this.parseOrder=D.DEFAULT_ORDER,this.parser=new oe(this.parseOrder),this.locale=D.DEFAULT_VALUES[O.LOCALE],this.modality=D.DEFAULT_VALUES[O.MODALITY],this.domain="",this.initialized=!1,this.inherits=null,this.kind="standard",this.customTranscriptions={},this.preconditions=new Map,this.speechRules_=[],this.rank=0,this.parseMethods={Rule:this.defineRule,Generator:this.generateRules,Action:this.defineAction,Precondition:this.definePrecondition,Ignore:this.ignoreRules}}defineRule(e,n,r,o,...i){const s=this.parseAction(r),c=this.parsePrecondition(o,i),p=this.parseCstr(n);if(!(s&&c&&p))return console.error(`Rule Error: ${o}, (${n}): ${r}`),null;const E=new io(e,p,c,s);return E.precondition.rank=this.rank++,this.addRule(E),E}addRule(e){e.context=this.context,this.speechRules_.unshift(e)}deleteRule(e){const n=this.speechRules_.indexOf(e);n!==-1&&this.speechRules_.splice(n,1)}findRule(e){for(let n,r=0;n=this.speechRules_[r];r++)if(e(n))return n;return null}findAllRules(e){return this.speechRules_.filter(e)}evaluateDefault(e){const n=e.textContent.slice(0);return n.match(/^\s+$/)?this.evaluateWhitespace(n):this.evaluateString(n)}evaluateWhitespace(e){return[]}evaluateCustom(e){const n=this.customTranscriptions[e];return n!==void 0?Ke.create({text:n},{adjust:!0,translate:!1}):null}evaluateCharacter(e){return this.evaluateCustom(e)||Ke.create({text:e},{adjust:!0,translate:!0})}removeDuplicates(e){for(let n,r=this.speechRules_.length-1;n=this.speechRules_[r];r--)n!==e&&e.dynamicCstr.equal(n.dynamicCstr)&&xo.comparePreconditions_(n,e)&&this.speechRules_.splice(r,1)}getSpeechRules(){return this.speechRules_}setSpeechRules(e){this.speechRules_=e}getPreconditions(){return this.preconditions}parseCstr(e){try{return this.parser.parse(this.preParseCstr(e))}catch(n){if(n.name==="RuleError")return console.error("Rule Error ",`Illegal Dynamic Constraint: ${e}.`,n.message),null;throw n}}parsePrecondition(e,n){try{const r=this.parsePrecondition_(e);e=r[0];let o=r.slice(1);for(const i of n)o=o.concat(this.parsePrecondition_(i));return new Kn(e,...o)}catch(r){if(r.name==="RuleError")return console.error("Rule Error ",`Illegal preconditions: ${e}, ${n}.`,r.message),null;throw r}}parseAction(e){try{return nr.fromString(e)}catch(n){if(n.name==="RuleError")return console.error("Rule Error ",`Illegal action: ${e}.`,n.message),null;throw n}}parse(e){this.modality=e.modality||this.modality,this.locale=e.locale||this.locale,this.domain=e.domain||this.domain,this.context.parse(e.functions||[]),e.kind!=="actions"&&(this.kind=e.kind||this.kind,this.inheritRules()),this.parseRules(e.rules||[])}parseRules(e){for(let n,r=0;n=e[r];r++){const o=n[0],i=this.parseMethods[o];o&&i&&i.apply(this,n.slice(1))}}generateRules(e){const n=this.context.customGenerators.lookup(e);n&&n(this)}defineAction(e,n){let r;try{r=nr.fromString(n)}catch(s){if(s.name==="RuleError")return void console.error("Action Error ",n,s.message);throw s}const o=this.getFullPreconditions(e);if(!o)return void console.error(`Action Error: No precondition for action ${e}`);this.ignoreRules(e);const i=new RegExp("^\\w+\\.\\w+\\.");o.conditions.forEach(([s,c])=>{const p=this.parseCstr(s.toString().replace(i,""));this.addRule(new io(e,p,c,r))})}getFullPreconditions(e){const n=this.preconditions.get(e);return n||!this.inherits?n:this.inherits.getFullPreconditions(e)}definePrecondition(e,n,r,...o){const i=this.parsePrecondition(r,o),s=this.parseCstr(n);i&&s?(i.rank=this.rank++,this.preconditions.set(e,new wh(s,i))):console.error(`Precondition Error: ${r}, (${n})`)}inheritRules(){if(!this.inherits||!this.inherits.getSpeechRules().length)return;const e=new RegExp("^\\w+\\.\\w+\\."+(this.domain?"\\w+\\.":""));this.inherits.getSpeechRules().forEach(n=>{const r=this.parseCstr(n.dynamicCstr.toString().replace(e,""));this.addRule(new io(n.name,r,n.precondition,n.action))})}ignoreRules(e,...n){let r=this.findAllRules(i=>i.name===e);if(!n.length)return void r.forEach(this.deleteRule.bind(this));let o=[];for(const i of n){const s=this.parseCstr(i);for(const c of r)s.equal(c.dynamicCstr)?this.deleteRule(c):o.push(c);r=o,o=[]}}parsePrecondition_(e){const n=this.context.customGenerators.lookup(e);return n?n():[e]}preParseCstr(e){const n=e.match("(.+)\\.(.+)");return this.locale+"."+this.modality+"."+(n?e:(this.domain?this.domain:"")+"."+e)}}class wh{constructor(e,n){this.base=e,this._conditions=[],this.constraints=[],this.allCstr={},this.constraints.push(e),this.addCondition(e,n)}get conditions(){return this._conditions}addConstraint(e){if(this.constraints.filter(r=>r.equal(e)).length)return;this.constraints.push(e);const n=[];for(const[r,o]of this.conditions)this.base.equal(r)&&n.push([e,o]);this._conditions=this._conditions.concat(n)}addBaseCondition(e){this.addCondition(this.base,e)}addFullCondition(e){this.constraints.forEach(n=>this.addCondition(n,e))}addCondition(e,n){const r=e.toString()+" "+n.toString();this.allCstr.condStr||(this.allCstr[r]=!0,this._conditions.push([e,n]))}}class or extends xo{constructor(){super(),this.annotators=[],this.parseMethods.Alias=this.defineAlias,this.parseMethods.AliasRule=this.defineRulesAlias,this.parseMethods.SpecializedRule=this.defineSpecializedRule,this.parseMethods.Specialized=this.defineSpecialized}initialize(){this.initialized||(this.annotations(),this.initialized=!0)}annotations(){for(let e,n=0;e=this.annotators[n];n++)Ar(this.domain,e)}defineAlias(e,n,...r){const o=this.parsePrecondition(n,r);if(!o)return void console.error(`Precondition Error: ${n} ${r}`);const i=this.preconditions.get(e)||this.getFullPreconditions(e);i?i.addFullCondition(o):console.error(`Alias Error: No precondition by the name of ${e}`)}defineRulesAlias(e,n,...r){const o=this.findAllRules(function(s){return s.name===e});if(o.length===0)throw new rr("Rule with name "+e+" does not exist.");const i=[];o.forEach(s=>{(c=>{const p=c.dynamicCstr.toString(),E=c.action.toString();for(let T,C=0;T=i[C];C++)if(T.action===E&&T.cstr===p)return!1;return i.push({cstr:p,action:E}),!0})(s)&&this.addAlias_(s,n,r)})}defineSpecializedRule(e,n,r,o){const i=this.parseCstr(n),s=this.findRule(T=>T.name===e&&i.equal(T.dynamicCstr)),c=this.parseCstr(r);if(!s&&o)throw new rr("Rule named "+e+" with style "+n+" does not exist.");const p=o?nr.fromString(o):s.action,E=new io(s.name,c,s.precondition,p);this.addRule(E)}defineSpecialized(e,n,r){const o=this.parseCstr(r);if(!o)return void console.error(`Dynamic Constraint Error: ${r}`);const i=this.preconditions.get(e);i?i.addConstraint(o):console.error(`Alias Error: No precondition by the name of ${e}`)}evaluateString(e){const n=[];if(e.match(/^\s+$/))return n;let r=this.matchNumber(e);if(r&&r.length===e.length)return n.push(this.evaluateCharacter(r.number)),n;const o=e.replace(/\s/g," ").split(" ").filter(i=>i);for(let i,s=0;i=o[s];s++)if(i.length===1)n.push(this.evaluateCharacter(i));else if(i.match(new RegExp("^["+I.MESSAGES.regexp.TEXT+"]+$")))n.push(this.evaluateCharacter(i));else{let c=i;for(;c;){r=this.matchNumber(c);const p=c.match(new RegExp("^["+I.MESSAGES.regexp.TEXT+"]+"));if(r)n.push(this.evaluateCharacter(r.number)),c=c.substring(r.length);else if(p)n.push(this.evaluateCharacter(p[0])),c=c.substring(p[0].length);else{const E=Array.from(c),T=E[0];n.push(this.evaluateCharacter(T)),c=E.slice(1).join("")}}}return n}parse(e){super.parse(e),this.annotators=e.annotators||[]}addAlias_(e,n,r){const o=this.parsePrecondition(n,r),i=new io(e.name,e.dynamicCstr,o,e.action);i.name=e.name,this.addRule(i)}matchNumber(e){const n=e.match(new RegExp("^"+I.MESSAGES.regexp.NUMBER)),r=e.match(new RegExp("^"+or.regexp.NUMBER));if(!n&&!r)return null;const o=r&&r[0]===e;return n&&n[0]===e||!o?n?{number:n[0],length:n[0].length}:null:{number:r[0].replace(new RegExp(or.regexp.DIGIT_GROUP,"g"),"X").replace(new RegExp(or.regexp.DECIMAL_MARK,"g"),I.MESSAGES.regexp.DECIMAL_MARK).replace(/X/g,I.MESSAGES.regexp.DIGIT_GROUP.replace(/\\/g,"")),length:r[0].length}}}or.regexp={NUMBER:"((\\d{1,3})(?=(,| ))((,| )\\d{3})*(\\.\\d+)?)|^\\d*\\.\\d+|^\\d+",DECIMAL_MARK:"\\.",DIGIT_GROUP:","};class Ca extends or{constructor(){super(...arguments),this.modality="braille",this.customTranscriptions={"⋊":"⠈⠡⠳"}}evaluateString(e){const n=[],r=Array.from(e);for(let o=0;o<r.length;o++)n.push(this.evaluateCharacter(r[o]));return n}annotations(){for(let e,n=0;e=this.annotators[n];n++)Ar(this.locale,e)}}class Ph extends Ca{constructor(){super(...arguments),this.locale="euro",this.customTranscriptions={},this.customCommands={"\\cdot":"*","\\lt":"<","\\gt":">"},this.lastSpecial=!1,this.specialChars=["^","_","{","}"]}evaluateString(e){const n=e.split(/(\\[a-z]+|\\{|\\}|\\\\)/i),r=this.cleanup(n);return super.evaluateString(r)}cleanup(e){const n=[];let r=!1,o=null;for(let i of e){if(i.match(/^\\/)){i==="\\text"&&(r=!0),this.addSpace(Fe.LatexCommands.get(i))&&n.push(" "),i=this.customCommands[i]||i;const c=i.match(/^\\/);c&&i.match(/^\\[a-zA-Z]+$/)&&o&&n.push(" "),o=c?i:null,n.push(i);continue}const s=i.split("");for(const c of s)r?(n.push(c),r=c!=="}",o=null):c.match(/[a-z]/i)&&o?(o=null,n.push(" "),n.push(c)):c.match(/\s/)||(this.addSpace(c)&&n.push(" "),n.push(c),o=null)}return n.join("")}addSpace(e){if(!e)return!1;if(this.specialChars.indexOf(e)!==-1)return this.lastSpecial=!0,!1;if(this.lastSpecial)return this.lastSpecial=!1,!1;const n=Fe.Meaning.get(e);return n.type===l.OPERATOR||n.type===l.RELATION||n.type===l.PUNCTUATION&&n.role===d.COLON}}(function(t){t.ROOT="root",t.DYNAMIC="dynamic",t.QUERY="query",t.BOOLEAN="boolean",t.STATIC="static"})(Dt||(Dt={}));class ji{constructor(e,n){this.constraint=e,this.test=n,this.children_={},this.kind=Dt.ROOT}getConstraint(){return this.constraint}getKind(){return this.kind}applyTest(e){return this.test(e)}addChild(e){const n=e.getConstraint(),r=this.children_[n];return this.children_[n]=e,r}getChild(e){return this.children_[e]}getChildren(){const e=[];for(const n of Object.values(this.children_))e.push(n);return e}findChildren(e){const n=[];for(const r of Object.values(this.children_))r.applyTest(e)&&n.push(r);return n}removeChild(e){delete this.children_[e]}toString(){return this.constraint}}class La extends ji{constructor(e,n){super(e,n),this.rule_=null,this.kind=Dt.STATIC}getRule(){return this.rule_}setRule(e){this.rule_&&_.getInstance().output("Replacing rule "+this.rule_+" with "+e),this.rule_=e}toString(){return this.getRule()?this.constraint+`
31
+ ==> `+this.getRule().action:this.constraint}}function Ma(t,e,n){switch(t){case Dt.ROOT:return new xh;case Dt.DYNAMIC:return new Fh(e);case Dt.QUERY:return new Uh(e,n);case Dt.BOOLEAN:return new _h(e,n);default:return null}}class xh extends ji{constructor(){super("",()=>!0),this.kind=Dt.ROOT}}class Fh extends ji{constructor(e){super(e,n=>n===e),this.kind=Dt.DYNAMIC}}const va={"=":(t,e)=>t===e,"!=":(t,e)=>t!==e,"<":(t,e)=>t<e,">":(t,e)=>t>e,"<=":(t,e)=>t<=e,">=":(t,e)=>t>=e};function Da(t){if(t.match(/^self::\*$/))return e=>!0;if(t.match(/^self::\w+$/)){const e=t.slice(6).toUpperCase();return n=>n.tagName&&Q(n)===e}if(t.match(/^self::\w+:\w+$/)){const e=t.split(":"),n=Ce(e[2]);if(!n)return null;const r=e[3].toUpperCase();return o=>o.localName&&o.localName.toUpperCase()===r&&o.namespaceURI===n}if(t.match(/^@\w+$/)){const e=t.slice(1);return n=>n.hasAttribute&&n.hasAttribute(e)}if(t.match(/^@\w+="[\w\d ]+"$/)){const e=t.split("="),n=e[0].slice(1),r=e[1].slice(1,-1);return o=>o.hasAttribute&&o.hasAttribute(n)&&o.getAttribute(n)===r}if(t.match(/^@\w+!="[\w\d ]+"$/)){const e=t.split("!="),n=e[0].slice(1),r=e[1].slice(1,-1);return o=>!o.hasAttribute||!o.hasAttribute(n)||o.getAttribute(n)!==r}if(t.match(/^contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)$/)){const e=t.split('"')[1];return n=>!!P.getInstance().getParameter(e)}if(t.match(/^not\(\s*contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)\s*\)$/)){const e=t.split('"')[1];return n=>!P.getInstance().getParameter(e)}if(t.match(/^name\(\.\.\/\.\.\)="\w+"$/)){const e=t.split('"')[1].toUpperCase();return n=>{var r,o;return((o=(r=n.parentNode)===null||r===void 0?void 0:r.parentNode)===null||o===void 0?void 0:o.tagName)&&Q(n.parentNode.parentNode)===e}}if(t.match(/^count\(preceding-sibling::\*\)=\d+$/)){const e=t.split("="),n=parseInt(e[1],10);return r=>{var o;return((o=r.parentNode)===null||o===void 0?void 0:o.childNodes[n])===r}}if(t.match(/^.+\[@category!?=".+"\]$/)){let[,e,n,r]=t.match(/^(.+)\[@category(!?=)"(.+)"\]$/);const o=r.match(/^unit:(.+)$/);let i="";return o&&(r=o[1],i=":unit"),s=>{const c=he(e,s)[0];if(c){const p=Kr(c.textContent+i);return n==="="?p===r:p!==r}return!1}}if(t.match(/^string-length\(.+\)\W+\d+/)){const[,e,n,r]=t.match(/^string-length\((.+)\)(\W+)(\d+)/),o=va[n]||va["="],i=parseInt(r,10);return s=>{const c=he(e,s)[0];return!!c&&o(Array.from(c.textContent).length,i)}}return null}class Uh extends La{constructor(e,n){super(e,Da(e)),this.context=n,this.kind=Dt.QUERY}applyTest(e){return this.test?this.test(e):this.context.applyQuery(e,this.constraint)===e}}class _h extends La{constructor(e,n){super(e,Da(e)),this.context=n,this.kind=Dt.BOOLEAN}applyTest(e){return this.test?this.test(e):this.context.applyConstraint(e,this.constraint)}}class ir{static collectRules_(e){const n=[];let r=[e];for(;r.length;){const o=r.shift();if(o.getKind()===Dt.QUERY||o.getKind()===Dt.BOOLEAN){const i=o.getRule();i&&n.unshift(i)}r=r.concat(o.getChildren())}return n}static printWithDepth_(e,n,r){r+=new Array(n+2).join(n.toString())+": "+e.toString()+`
32
+ `;const o=e.getChildren();for(let i,s=0;i=o[s];s++)r=ir.printWithDepth_(i,n+1,r);return r}static order_(e){const n=e.getChildren();if(!n.length)return 0;const r=Math.max.apply(null,n.map(ir.order_));return Math.max(n.length,r)}constructor(){this.root=Ma(Dt.ROOT,"",null)}addRule(e){let n=this.root;const r=e.context,o=e.dynamicCstr.getValues();for(let s=0,c=o.length;s<c;s++)n=this.addNode_(n,o[s],Dt.DYNAMIC,r);n=this.addNode_(n,e.precondition.query,Dt.QUERY,r);const i=e.precondition.constraints;for(let s=0,c=i.length;s<c;s++)n=this.addNode_(n,i[s],Dt.BOOLEAN,r);n.setRule(e)}lookupRules(e,n){let r=[this.root];const o=[];for(;n.length;){const i=n.shift(),s=[];for(;r.length;)r.shift().getChildren().forEach(c=>{c.getKind()===Dt.DYNAMIC&&i.indexOf(c.getConstraint())===-1||s.push(c)});r=s.slice()}for(;r.length;){const i=r.shift();if(i.getRule){const c=i.getRule();c&&o.push(c)}const s=i.findChildren(e);r=r.concat(s)}return o}hasSubtrie(e){let n=this.root;for(let r=0,o=e.length;r<o;r++){const i=e[r];if(n=n.getChild(i),!n)return!1}return!0}toString(){return ir.printWithDepth_(this.root,0,"")}collectRules(e=this.root){return ir.collectRules_(e)}order(){return ir.order_(this.root)}enumerate(e){return this.enumerate_(this.root,e)}byConstraint(e){let n=this.root;for(;e.length&&n;){const r=e.shift();n=n.getChild(r)}return n||null}enumerate_(e,n){n=n||{};const r=e.getChildren();for(let o,i=0;o=r[i];i++)o.kind===Dt.DYNAMIC&&(n[o.getConstraint()]=this.enumerate_(o,n[o.getConstraint()]));return n}addNode_(e,n,r,o){let i=e.getChild(n);return i||(i=Ma(r,n,o),e.addChild(i)),i}}var ze;(function(t){t[t.ENTER=13]="ENTER",t[t.ESC=27]="ESC",t[t.SPACE=32]="SPACE",t[t.PAGE_UP=33]="PAGE_UP",t[t.PAGE_DOWN=34]="PAGE_DOWN",t[t.END=35]="END",t[t.HOME=36]="HOME",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN",t[t.TAB=9]="TAB",t[t.LESS=188]="LESS",t[t.GREATER=190]="GREATER",t[t.DASH=189]="DASH",t[t.ZERO=48]="ZERO",t[t.ONE=49]="ONE",t[t.TWO=50]="TWO",t[t.THREE=51]="THREE",t[t.FOUR=52]="FOUR",t[t.FIVE=53]="FIVE",t[t.SIX=54]="SIX",t[t.SEVEN=55]="SEVEN",t[t.EIGHT=56]="EIGHT",t[t.NINE=57]="NINE",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z"})(ze||(ze={}));const kh=new Map([[13,"ENTER"],[27,"ESC"],[32,"SPACE"],[33,"PAGE_UP"],[34,"PAGE_DOWN"],[35,"END"],[36,"HOME"],[37,"LEFT"],[38,"UP"],[39,"RIGHT"],[40,"DOWN"],[9,"TAB"],[188,"LESS"],[190,"GREATER"],[189,"DASH"],[48,"ZERO"],[49,"ONE"],[50,"TWO"],[51,"THREE"],[52,"FOUR"],[53,"FIVE"],[54,"SIX"],[55,"SEVEN"],[56,"EIGHT"],[57,"NINE"],[65,"A"],[66,"B"],[67,"C"],[68,"D"],[69,"E"],[70,"F"],[71,"G"],[72,"H"],[73,"I"],[74,"J"],[75,"K"],[76,"L"],[77,"M"],[78,"N"],[79,"O"],[80,"P"],[81,"Q"],[82,"R"],[83,"S"],[84,"T"],[85,"U"],[86,"V"],[87,"W"],[88,"X"],[89,"Y"],[90,"Z"]]);var wa;(function(t){t.CLICK="click",t.DBLCLICK="dblclick",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSEMOVE="mousemove",t.SELECTSTART="selectstart",t.KEYPRESS="keypress",t.KEYDOWN="keydown",t.KEYUP="keyup",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.TOUCHCANCEL="touchcancel"})(wa||(wa={}));function Bh(t,e,n){return t?{pause:$i(t.pause,e.pause,n)}:e}function $i(t,e,n){return(n||function(r,o){return typeof r=="number"&&typeof o=="number"?r+o:typeof r=="number"?o:typeof o=="number"?r:[t,e].sort()[0]}).call(null,t,e)}function Gh(t,e){delete t.open,e.close.forEach(n=>delete t[n]),e.open.forEach(n=>t[n]=e[n]),t.open=Object.keys(t)}function Vh(t,e){if(t.length<=1)return t;const n=[];for(let r,o=0;r=e[o],t.length;o++)r.close&&r.close.length&&r.close.forEach(function(i){const s=t.indexOf(i);s!==-1&&(n.unshift(i),t.splice(s,1))});return n}let Fo={},br=[];function ao(t){t=t.map(r=>r.clone()),Fo={},br=[];let e=[];const n={};for(let r,o=0;r=t[o];o++){let i=null;const s=r.descriptionSpan(),c=r.personality,p=c[Se.JOIN];delete c[Se.JOIN],c[Se.PAUSE]!==void 0&&(i={[Se.PAUSE]:c[Se.PAUSE]},delete c[Se.PAUSE]),Hh(e,s,jh(c,n),p,i,!0)}return e=e.concat((function(){const r=[];for(let o=br.length-1;o>=0;o--){const i=br[o];if(i.length){const s={open:[],close:[]};for(let c=0;c<i.length;c++){const p=i[c];s.close.push(p),s[p]=0}r.push(s)}}return r})()),e=(function(r){const o={},i=[];for(let s,c=0;s=r[c];c++){if(!Or(s)){Pa(i,s);continue}if(!s.close||s.close.length!==1||s.open.length){Xi(s,o),i.push(s);continue}let p=r[c+1];if(!p||Uo(p)){Xi(s,o),i.push(s);continue}const E=Cn(p)?p:null;E&&(p=r[c+2]),p&&Or(p)&&p.open[0]===s.close[0]&&!p.close.length&&p[p.open[0]]===o[p.open[0]]?E?(Pa(i,E),c+=2):c+=1:(Xi(s,o),i.push(s))}return i})(e),e=L.getInstance().options.cleanpause?(function(r){for(;Cn(r[0]);)r.shift();for(;Cn(r[r.length-1]);)r.pop();return r})(e):e,e}function Pa(t,e){const n=t[t.length-1];if(n){if(Uo(e)&&Uo(n)){if(n.join===void 0)return void(n.span=n.span.concat(e.span));const r=n.span.pop(),o=e.span.shift();n.span.push(r+n.join+o),n.span=n.span.concat(e.span),n.join=e.join;return}Cn(e)&&Cn(n)?n.pause=$i(n.pause,e.pause):t.push(e)}else t.push(e)}function Xi(t,e){t.rate&&(e.rate=t.rate),t.pitch&&(e.pitch=t.pitch),t.volume&&(e.volume=t.volume)}function Or(t){return typeof t=="object"&&t.open}function Cn(t){return typeof t=="object"&&Object.keys(t).length===1&&Object.keys(t)[0]===Se.PAUSE}function Uo(t){const e=Object.keys(t);return typeof t=="object"&&(e.length===1&&e[0]==="span"||e.length===2&&(e[0]==="span"&&e[1]==="join"||e[1]==="span"&&e[0]==="join"))}function Hh(t,e,n,r,o,i=!1){if(i){const s=t[t.length-1];let c;if(s&&(c=s[Se.JOIN]),s&&!e.speech&&o&&Cn(s)){const p=Se.PAUSE;s[p]=$i(s[p],o[p]),o=null}if(s&&e.speech&&Object.keys(n).length===0&&Uo(s)){if(c!==void 0){const p=s.span.pop();e=W.stringAttr(p.speech+c+e.speech,p.attributes)}s.span.push(e),e=W.empty(),s[Se.JOIN]=r}}Object.keys(n).length!==0&&t.push(n),e.speech&&t.push({span:[e],join:r}),o&&t.push(o)}function jh(t,e){if(!e)return t;const n={};for(const r of St){const o=t[r],i=e[r];if(!o&&!i||o&&i&&o===i)continue;const s=o||0;Or(n)||(n.open=[],n.close=[]),o||n.close.push(r),i||n.open.push(r),i&&o&&(n.close.push(r),n.open.push(r)),e[r]=s,n[r]=s,Fo[r]?Fo[r].push(s):Fo[r]=[s]}if(Or(n)){let r=n.close.slice();for(;r.length>0;){let o=br.pop();const i=Oi(o,r);if(r=Oi(r,o),o=i,r.length!==0){if(o.length!==0){n.close=n.close.concat(o),n.open=n.open.concat(o);for(let s,c=0;s=o[c];c++)n[s]=e[s]}}else o.length!==0&&br.push(o)}br.push(n.open)}return n}class Yi{constructor(){this.separator_=" "}set separator(e){this.separator_=e}get separator(){return L.getInstance().options.modality==="braille"?"":this.separator_}error(e){return null}merge(e){let n="";const r=e.length-1;for(let o,i=0;o=e[i];i++)if(n+=o.speech,i<r){const s=o.attributes.separator;n+=s!==void 0?s:this.separator}return n}finalize(e){return e}pauseValue(e){let n;switch(e){case"long":n=750;break;case"medium":n=500;break;case"short":n=250;break;default:n=parseInt(e,10)}return Math.floor(n*L.getInstance().getRate()/100)}}class xa extends Yi{constructor(){super(...arguments),this.ignoreElements=[Se.LAYOUT],this.scaleFunction=null}setScaleFunction(e,n,r,o,i=0){this.scaleFunction=s=>{const c=(s-e)/(n-e),p=r*(1-c)+o*c;return+(Math.round(p+"e+"+i)+"e-"+i)}}applyScaleFunction(e){return this.scaleFunction?this.scaleFunction(e):e}ignoreElement(e){return this.ignoreElements.indexOf(e)!==-1}}class _o extends xa{markup(e){this.setScaleFunction(-2,2,-100,100,2);const n=ao(e),r=[],o=[];for(let i,s=0;i=n[s];s++)if(i.span)r.push(this.merge(i.span));else if(Cn(i))r.push(this.pause(i));else{if(i.close.length)for(let c=0;c<i.close.length;c++){const p=o.pop();if(i.close.indexOf(p)===-1)throw new ue("Unknown closing markup element: "+p);r.push(this.closeTag(p))}i.open.length&&Vh(i.open.slice(),n.slice(s+1)).forEach(c=>{r.push(this.prosodyElement(c,i[c])),o.push(c)})}return r.join(" ")}}class Fa extends _o{constructor(){super(...arguments),this.values=new Map}finalize(e){return(function(n){if(Ki.clear(),!n)return;const r=Object.keys(n).map(o=>parseInt(o)).sort();for(let o,i=0;o=r[i];i++)Ki.set(o,i+1)})(this.values.get("rel")),(function(n){Wi="";const r=Ge(`<all>${n}</all>`);return _.getInstance().generate(()=>[ye(r.toString())]),Wi=sr(r),Wi})(e)}pause(e){return""}prosodyElement(e,n){return e===Se.LAYOUT?`<${n}>`:""}closeTag(e){return`</${e}>`}markup(e){this.values.clear();const n=[];let r=[];for(const o of e){if(!o.layout){r.push(o);continue}n.push(this.processContent(r)),r=[];const[i,s,c]=this.layoutValue(o.layout);i!=="begin"?i!=="end"?console.warn("Something went wrong with layout markup: "+s):n.push("</"+s+">"):n.push("<"+s+(c?` value="${c}"`:"")+">")}return n.push(this.processContent(r)),n.join("")}processContent(e){const n=[],r=ao(e);for(let o,i=0;o=r[i];i++)o.span?n.push(this.merge(o.span)):Cn(o);return n.join("")}layoutValue(e){const n=e.match(/^(begin|end|)(.*\D)(\d*)$/),r=n[3];return r?(e=n[2],this.values.has(e)||this.values.set(e,{}),this.values.get(e)[r]=!0,[n[1],e,r]):[n[1],n[2],""]}}Fa.options={cayleyshort:L.getInstance().options.cayleyshort,linebreaks:L.getInstance().options.linebreaks};let Wi="";const $h={TABLE:function(t){let e=Bo(t);e.forEach(o=>{o.cells=o.cells.slice(1).slice(0,-1),o.width=o.width.slice(1).slice(0,-1)});const[n,r]=Go(e);return e=Vo(e,r),Ho(e,n)},CASES:function(t){let e=Bo(t);e.forEach(o=>{o.cells=o.cells.slice(0,-1),o.width=o.width.slice(0,-1)});const[n,r]=Go(e);return e=Vo(e,r),Ho(e,n)},CAYLEY:function(t){let e=Bo(t);e.forEach(i=>{i.cells=i.cells.slice(1).slice(0,-1),i.width=i.width.slice(1).slice(0,-1),i.sep=i.sep+i.sep});const[n,r]=Go(e),o={lfence:"",rfence:"",cells:r.map(i=>"⠐"+new Array(i).join("⠒")),width:r,height:1,sep:e[0].sep};return L.getInstance().options.cayleyshort&&e[0].cells[0]==="⠀"&&(o.cells[0]="⠀"),e.splice(1,0,o),e=Vo(e,r),Ho(e,n)},MATRIX:function(t){let e=Bo(t);const[n,r]=Go(e);return e=Vo(e,r),Ho(e,n)},CELL:sr,FENCE:sr,ROW:sr,FRACTION:function(t){const[e,n,,r,o]=Array.from(t.childNodes),i=co(n),s=co(r),c=ar(i),p=ar(s);let E=Math.max(c,p);const T=e+new Array(E+1).join("⠒")+o;return E=T.length,`${_a(i,E)}
33
+ ${T}
34
+ ${_a(s,E)}`},NUMERATOR:ka,DENOMINATOR:ka,REL:Ba,OP:Ba};function co(t){const e=Q(t),n=$h[e];return n?n(t):t.textContent}const Ki=new Map;function Rr(t,e){if(!t||!e)return t+e;const n=ko(t),r=ko(e),o=n-r;t=o<0?zi(t,r,ar(t)):t,e=o>0?zi(e,n,ar(e)):e;const i=t.split(/\r\n|\r|\n/),s=e.split(/\r\n|\r|\n/),c=[];for(let p=0;p<i.length;p++)c.push(i[p]+s[p]);return c.join(`
35
+ `)}function sr(t){let e="";for(const n of Array.from(t.childNodes))e=n.nodeType!==He.TEXT_NODE?Rr(e,co(n)):Rr(e,n.textContent);return e}function ko(t){return t.split(/\r\n|\r|\n/).length}function ar(t){return t.split(/\r\n|\r|\n/).reduce((e,n)=>Math.max(n.length,e),0)}function zi(t,e,n){return t=(function(r,o){const i=o-ko(r);return r+(i>0?new Array(i+1).join(`
36
+ `):"")})(t,e),(function(r,o){const i=r.split(/\r\n|\r|\n/),s=[];for(const c of i){const p=o-c.length;s.push(c+(p>0?new Array(p+1).join("⠀"):""))}return s.join(`
37
+ `)})(t,n)}function Bo(t){const e=Array.from(t.childNodes),n=[];for(const r of e)r.nodeType===He.ELEMENT_NODE&&n.push(Xh(r));return n}function Go(t){const e=t.reduce((r,o)=>Math.max(o.height,r),0),n=[];for(let r=0;r<t[0].width.length;r++)n.push(t.map(o=>o.width[r]).reduce((o,i)=>Math.max(o,i),0));return[e,n]}function Vo(t,e){const n=[];for(const r of t){if(r.height===0)continue;const o=[];for(let i=0;i<r.cells.length;i++)o.push(zi(r.cells[i],r.height,e[i]));r.cells=o,n.push(r)}return n}function Ho(t,e){if(e===1)return t.map(r=>r.lfence+r.cells.join(r.sep)+r.rfence).join(`
38
+ `);const n=[];for(const r of t){const o=Qi(r.sep,r.height);let i=r.cells.shift();for(;r.cells.length;)i=Rr(i,o),i=Rr(i,r.cells.shift());i=Rr(Qi(r.lfence,r.height),i),i=Rr(i,Qi(r.rfence,r.height)),n.push(i),n.push(r.lfence+new Array(ar(i)-3).join(r.sep)+r.rfence)}return n.slice(0,-1).join(`
39
+ `)}function Qi(t,e){let n="";for(;e;)n+=t+`
40
+ `,e--;return n.slice(0,-1)}function Ua(t){return t.nodeType===He.ELEMENT_NODE&&Q(t)==="FENCE"?co(t):""}function Xh(t){const e=Array.from(t.childNodes),n=Ua(e[0]),r=Ua(e[e.length-1]);n&&e.shift(),r&&e.pop();let o="";const i=[];for(const s of e){if(s.nodeType===He.TEXT_NODE){o=s.textContent;continue}const c=co(s);i.push(c)}return{lfence:n,rfence:r,sep:o,cells:i,height:i.reduce((s,c)=>Math.max(ko(c),s),0),width:i.map(ar)}}function _a(t,e){const n=(e-ar(t))/2,[r,o]=Math.floor(n)===n?[n,n]:[Math.floor(n),Math.ceil(n)],i=t.split(/\r\n|\r|\n/),s=[],[c,p]=[new Array(r+1).join("⠀"),new Array(o+1).join("⠀")];for(const E of i)s.push(c+E+p);return s.join(`
41
+ `)}function ka(t){const e=t.firstChild,n=sr(t);if(e&&e.nodeType===He.ELEMENT_NODE){if(Q(e)==="ENGLISH")return"⠰"+n;if(Q(e)==="NUMBER")return"⠼"+n}return n}function Ba(t){if(!L.getInstance().options.linebreaks)return sr(t);const e=Ki.get(parseInt(t.getAttribute("value")));return(e?`<br value="${e}"/>`:"")+sr(t)}class jo extends Yi{markup(e){const n=ao(e);let r="",o=null,i=!1;for(let s,c=0;s=n[c];c++)Or(s)||(Cn(s)?o=s:(o&&(r+=this.pause(o[Se.PAUSE]),o=null),r+=(i?this.separator:"")+this.merge(s.span),i=!0));return r}pause(e){let n;return n=typeof e=="number"?e<=250?"short":e<=500?"medium":"long":e,jo.PAUSE_PUNCTUATION.get(n)||""}}jo.PAUSE_PUNCTUATION=new Map([["short",","],["medium",";"],["long","."]]);class hn extends _o{finalize(e){return`<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="${L.getInstance().options.locale}"><prosody rate="`+L.getInstance().getRate()+'%">'+this.separator+e+this.separator+"</prosody></speak>"}pause(e){return'<break time="'+this.pauseValue(e[Se.PAUSE])+'ms"/>'}prosodyElement(e,n){const r=(n=Math.floor(this.applyScaleFunction(n)))<0?n.toString():"+"+n.toString();return"<prosody "+e.toLowerCase()+'="'+r+(e===Se.VOLUME?">":'%">')}closeTag(e){return"</prosody>"}markup(e){return hn.MARKS={},super.markup(e)}merge(e){const n=[];let r="";for(let o=0;o<e.length;o++){const i=e[o];if(this.isEmptySpan(i))continue;const s=hn.MARK_KIND?i.attributes.kind:"",c=L.getInstance().options.automark?i.attributes.id:L.getInstance().options.mark?i.attributes.extid:"";!c||c===r||hn.MARK_ONCE&&hn.MARKS[c]||(n.push(s?`<mark name="${c}" kind="${s}"/>`:`<mark name="${c}"/>`),r=c,hn.MARKS[c]=!0),L.getInstance().options.character&&i.speech.length===1&&i.speech.match(/[a-zA-Z]/)?n.push('<say-as interpret-as="'+hn.CHARACTER_ATTR+'">'+i.speech+"</say-as>"):n.push(i.speech)}return n.join(this.separator)}isEmptySpan(e){const n=e.attributes.separator;return e.speech.match(/^\s*$/)&&(!n||n.match(/^\s*$/))}}hn.MARK_ONCE=!1,hn.MARK_KIND=!0,hn.CHARACTER_ATTR="character",hn.MARKS={};class Ga extends Yi{markup(e){let n="";const r=ao(e).filter(i=>i.span);if(!r.length)return n;const o=r.length-1;for(let i,s=0;i=r[s];s++){if(i.span&&(n+=this.merge(i.span)),s>=o)continue;const c=i.join;n+=c===void 0?this.separator:c}return n}}const Va=new hn,lo=new Map([[z.NONE,new Ga],[z.COUNTING,new class extends Ga{finalize(t){const e=super.finalize(t),n=L.getInstance().options.modality==="braille"?"⣿⠀⣿⠀⣿⠀⣿⠀⣿⠀":"0123456789";let r=new Array(Math.trunc(e.length/10)+1).join(n);return r+=n.slice(0,e.length%10),e+`
42
+ `+r}}],[z.PUNCTUATION,new jo],[z.LAYOUT,new Fa],[z.ACSS,new class extends xa{markup(t){this.setScaleFunction(-2,2,0,10,0);const e=ao(t),n=[],r={open:[]};let o=null,i=!1;for(let s,c=0;s=e[c];c++){if(Or(s)){Gh(r,s);continue}if(Cn(s)){i&&(o=Bh(o,s,Math.max));continue}const p='"'+this.merge(s.span)+'"';i=!0,o&&(n.push(this.pause(o)),o=null);const E=this.prosody_(r);n.push(E?"(text ("+E+") "+p+")":p)}return"(exp "+n.join(" ")+")"}error(t){return'(error "'+kh.get(t)+'")'}prosodyElement(t,e){switch(e=this.applyScaleFunction(e),t){case Se.RATE:return"(richness . "+e+")";case Se.PITCH:return"(average-pitch . "+e+")";case Se.VOLUME:return"(stress . "+e+")"}return"(value . "+e+")"}pause(t){return"(pause . "+this.pauseValue(t[Se.PAUSE])+")"}prosody_(t){const e=t.open,n=[];for(let r,o=0;r=e[o];o++)n.push(this.prosodyElement(r,t[r]));return n.join(" ")}}],[z.SABLE,new class extends _o{finalize(t){return'<?xml version="1.0"?><!DOCTYPE SABLE PUBLIC "-//SABLE//DTD SABLE speech mark up//EN" "Sable.v0_2.dtd" []><SABLE>'+this.separator+t+this.separator+"</SABLE>"}pause(t){return'<BREAK MSEC="'+this.pauseValue(t[Se.PAUSE])+'"/>'}prosodyElement(t,e){switch(e=this.applyScaleFunction(e),t){case Se.PITCH:return'<PITCH RANGE="'+e+'%">';case Se.RATE:return'<RATE SPEED="'+e+'%">';case Se.VOLUME:return'<VOLUME LEVEL="'+e+'%">';default:return"<"+t.toUpperCase()+' VALUE="'+e+'">'}}closeTag(t){return"</"+t.toUpperCase()+">"}}],[z.VOICEXML,Va],[z.SSML,Va]]);function zn(t){const e=lo.get(L.getInstance().options.markup);return e?e.markup(t):""}function cr(t){const e=lo.get(L.getInstance().options.markup);return e?e.finalize(t):t}class Yh{getSpeechMap(e){let n=this.speechMaps.get(e);return n||(n=new Map,this.speechMaps.set(e,n)),n}setMap(e,n,r){this.getSpeechMap(n).set(e,r.map(o=>o.clone()))}constructor(e){this.node=e,this.speechMaps=new Map,this.nodeMap=null}addNode(e,n,r="speech"){e.nodeType===He.ELEMENT_NODE&&e.hasAttribute("id")&&this.setMap(r,e.getAttribute("id"),n)}get(e){return this.speechMaps.get(e)}getNodeMap(){if(this.nodeMap)return this.nodeMap;this.nodeMap=new Map;for(const e of ht(this.node,"id")){const n=e.getAttribute("id");if(!this.nodeMap.has(n)){this.nodeMap.set(e.getAttribute("id"),e);continue}const r=e.parentNode.tagName;r!=="children"&&r!=="stree"||this.nodeMap.set(n,e)}return this.nodeMap}completeModality(e,n){const r=L.getInstance().options.modality;L.getInstance().options.modality=e;for(const[o,i]of this.getNodeMap())this.getSpeechMap(o).has(e)||n(i);L.getInstance().options.modality=r}json(e=["none"]){const n={},r=L.getInstance().options.markup;for(const[o,i]of this.speechMaps){const s={};for(const c of e)L.getInstance().options.markup=c,i.forEach((p,E)=>s[`${E}-${c}`]=zn(p)),n[o]=s}return L.getInstance().options.markup=r,n}}class bt{static getInstance(){return bt.instance=bt.instance||new bt,bt.instance}static debugSpeechRule(e,n){const r=e.precondition,o=e.context.applyQuery(n,r.query);_.getInstance().output(r.query,o&&o.toString()),r.constraints.forEach(i=>_.getInstance().output(i,e.context.applyConstraint(n,i)))}static debugNamedSpeechRule(e,n){const r=bt.getInstance().trie.collectRules().filter(o=>o.name==e);for(let o,i=0;o=r[i];i++)_.getInstance().output("Rule",e,"DynamicCstr:",o.dynamicCstr.toString(),"number",i),bt.debugSpeechRule(o,n)}evaluateNode(e,n=!1){ot(e),this.speechStructure&&!n||(this.speechStructure=new Yh(e));const r=new Date().getTime();let o=[];try{o=this.evaluateNode_(e)}catch(s){console.error("Something went wrong computing speech."),_.getInstance().output(s)}const i=new Date().getTime();return _.getInstance().output("Time:",i-r),o}toString(){return this.trie.collectRules().map(e=>e.toString()).join(`
43
+ `)}runInSetting(e,n){var r,o;const i=L.getInstance(),s=i.options,c=new te;for(const E of te.BINARY_FEATURES)c[E]=(r=e[E])!==null&&r!==void 0?r:s[E];for(const E of te.STRING_FEATURES)c[E]=(o=e[E])!==null&&o!==void 0?o:s[E];i.options=c,i.setDynamicCstr();const p=n();return i.options=s,i.setDynamicCstr(),p}static addStore(e){const n=(function(r){const o=`${r.locale}.${r.modality}.${r.domain}`;if(r.kind==="actions"){const s=Ji.get(o);return s.parse(r),s}Rh(),r&&!r.functions&&(r.functions=(function(s,c,p){return zr.get([s,c,p].join("."))||zr.get([D.DEFAULT_VALUES[O.LOCALE],c,p].join("."))||zr.get([D.BASE_LOCALE,c,p].join("."))||{}})(r.locale,r.modality,r.domain));const i=(function(s,c){return c==="braille"&&s==="euro"?new Ph:c==="braille"?new Ca:new or})(r.locale,r.modality);return Ji.set(o,i),r.inherits&&(i.inherits=Ji.get(`${r.inherits}.${r.modality}.${r.domain}`)),i.parse(r),i.initialize(),i})(e);n.kind!=="abstract"&&n.getSpeechRules().forEach(r=>bt.getInstance().trie.addRule(r)),bt.getInstance().addEvaluator(n)}processGrammar(e,n,r){const o={};for(const[i,s]of Object.entries(r))o[i]=typeof s=="string"?e.constructString(n,s):s;P.getInstance().pushState(o)}addEvaluator(e){const n=e.evaluateDefault.bind(e),r=this.evaluators_[e.locale];if(r)return void(r[e.modality]=n);const o={};o[e.modality]=n,this.evaluators_[e.locale]=o}getEvaluator(e,n){const r=this.evaluators_[e]||this.evaluators_[D.DEFAULT_VALUES[O.LOCALE]];return r[n]||r[D.DEFAULT_VALUES[O.MODALITY]]}enumerate(e){return this.trie.enumerate(e)}constructor(){this.trie=null,this.evaluators_={},this.speechStructure=null,this.trie=new ir}evaluateNode_(e){if(!e)return[];this.updateConstraint_();let n=this.evaluateTree_(e);return n=(function(r){const o=new Dl(r);for(const i of o.annotations){const s=i.data;if(s.annotation==="punctuation"){const c=o.prevText(i);if(!c)continue;const p=c.data;p.annotation!=="punctuation"&&p.text!=="⠀"&&s.text.length===1&&Wh.indexOf(s.text)!==-1&&(s.text="⠸"+s.text)}}return o.toList()})(n),n}evaluateTree_(e){const n=this.evaluateTreeInternal_(e);return this.speechStructure.addNode(e,n,L.getInstance().options.modality),n}evaluateTreeInternal_(e){const n=L.getInstance();let r;_.getInstance().generate(()=>[e.toString()]),P.getInstance().setAttribute(e);const o=this.lookupRule(e,n.dynamicCstr);if(!o)return n.options.strict?[]:(r=this.getEvaluator(n.options.locale,n.options.modality)(e),e.attributes&&this.addPersonality_(r,{},!1,e),r);_.getInstance().generate(()=>["Apply Rule:",o.name,o.dynamicCstr.toString(),n.mode===Pe.HTTP?de(e):e.toString()]),P.getInstance().processSingles();const i=o.context,s=o.action.components;r=[];for(let c,p=0;c=s[p];p++){let E=[];const T=c.content||"",C=c.attributes||{};let pe=!1;c.grammar&&this.processGrammar(i,e,c.grammar);let Ne=null;if(C.engine){Ne=L.getInstance().dynamicCstr.getComponents();const ae=Object.assign({},Ne,P.parseInput(C.engine));L.getInstance().setDynamicCstr(ae),this.updateConstraint_()}switch(c.type){case vt.NODE:{const ae=i.applyQuery(e,T);ae&&(E=this.evaluateTree_(ae))}break;case vt.MULTI:{pe=!0;const ae=i.applySelector(e,T);ae.length>0&&(E=this.evaluateNodeList_(i,ae,C.sepFunc,i.constructString(e,C.separator),C.ctxtFunc,i.constructString(e,C.context)))}break;case vt.TEXT:{const ae=C.span;let rt={};if(ae){const Nt=he(ae,e);rt=Nt.length?W.getAttributes(Nt[0]):{kind:ae}}E=i.constructSpan(e,T,rt).map(function(Nt){return Ke.create({text:Nt.speech,attributes:Nt.attributes},{adjust:!0})})}break;case vt.PERSONALITY:default:E=[Ke.create({text:T})]}E[0]&&!pe&&(C.context&&(E[0].context=i.constructString(e,C.context)+(E[0].context||"")),C.annotation&&(E[0].annotation=C.annotation)),this.addLayout(E,C,pe),c.grammar&&P.getInstance().popState(),r=r.concat(this.addPersonality_(E,C,pe,e)),Ne&&(L.getInstance().setDynamicCstr(Ne),this.updateConstraint_())}return P.getInstance().popState(),r}evaluateNodeList_(e,n,r,o,i,s){if(!n.length)return[];const c=o||"",p=s||"",E=e.contextFunctions.lookup(i),T=E?E(n,p):function(){return p},C=e.contextFunctions.lookup(r),pe=C?C(n,c):function(){return[Ke.create({text:c},{translate:!0})]};let Ne=[];for(let ae,rt=0;ae=n[rt];rt++){const Nt=this.evaluateTree_(ae);if(Nt.length>0&&(Nt[0].context=T()+(Nt[0].context||""),Ne=Ne.concat(Nt)),rt<n.length-1){const li=pe();Ne=Ne.concat(li)}}return Ne}addLayout(e,n,r){const o=n.layout;o&&(o.match(/^begin/)?e.unshift(new Ke({text:"",layout:o})):o.match(/^end/)?e.push(new Ke({text:"",layout:o})):(e.unshift(new Ke({text:"",layout:`begin${o}`})),e.push(new Ke({text:"",layout:`end${o}`}))))}addPersonality_(e,n,r,o){const i={};let s=null;for(const c of St){const p=n[c];if(p===void 0)continue;const E=parseFloat(p),T=isNaN(E)?p.charAt(0)==='"'?p.slice(1,-1):p:E;c===Se.PAUSE?s=T:i[c]=T}for(let c,p=0;c=e[p];p++)this.addRelativePersonality_(c,i),this.addExternalAttributes_(c,o);if(r&&e.length&&delete e[e.length-1].personality[Se.JOIN],s&&e.length){const c=e[e.length-1];c.text||Object.keys(c.personality).length?e.push(Ke.create({text:"",personality:{pause:s}})):c.personality[Se.PAUSE]=s}return e}addExternalAttributes_(e,n){var r;if(e.attributes.id===void 0&&(e.attributes.id=n.getAttribute("id")),(r=n.attributes)===null||r===void 0?void 0:r.length){const o=n.attributes;for(let i=o.length-1;i>=0;i--){const s=o[i].name;!e.attributes[s]&&s.match(/^ext/)&&(e.attributes[s]=o[i].value)}}}addRelativePersonality_(e,n){if(!e.personality)return e.personality=n,e;const r=e.personality;for(const[o,i]of Object.entries(n))r[o]&&typeof r[o]=="number"&&typeof i=="number"?r[o]=(r[o]+i).toString():r[o]||(r[o]=i);return e}updateConstraint_(){const e=L.getInstance().dynamicCstr,n=this.trie,r={};let o=e.getValue(O.LOCALE),i=e.getValue(O.MODALITY),s=e.getValue(O.DOMAIN);n.hasSubtrie([o,i,s])||(s=D.DEFAULT_VALUES[O.DOMAIN],n.hasSubtrie([o,i,s])||(i=D.DEFAULT_VALUES[O.MODALITY],n.hasSubtrie([o,i,s])||(o=D.DEFAULT_VALUES[O.LOCALE]))),r[O.LOCALE]=[o],r[O.MODALITY]=[i!=="summary"?i:D.DEFAULT_VALUES[O.MODALITY]],r[O.DOMAIN]=[i!=="speech"?D.DEFAULT_VALUES[O.DOMAIN]:s];const c=e.getOrder();for(let p,E=0;p=c[E];E++)if(!r[p]){const T=e.getValue(p),C=this.makeSet_(T,e.preference),pe=D.DEFAULT_VALUES[p];T!==pe&&C.push(pe),r[p]=C}e.updateProperties(r)}makeSet_(e,n){return n&&Object.keys(n).length?e.split(":"):[e]}lookupRule(e,n){if(!e||e.nodeType!==He.ELEMENT_NODE&&e.nodeType!==He.TEXT_NODE)return null;const r=this.lookupRules(e,n);return r.length>0?this.pickMostConstraint_(n,r):null}lookupRules(e,n){return this.trie.lookupRules(e,n.allProperties())}pickMostConstraint_(e,n){const r=L.getInstance().comparator;return n.sort(function(o,i){return r.compare(o.dynamicCstr,i.dynamicCstr)||i.precondition.priority-o.precondition.priority||i.precondition.constraints.length-o.precondition.constraints.length||i.precondition.rank-o.precondition.rank}),_.getInstance().generate((()=>["Applicable Rules:",...n.map(o=>o.name+"("+o.dynamicCstr.toString()+")")]).bind(this)),n[0]}}const Ji=new Map;L.nodeEvaluator=bt.getInstance().evaluateNode.bind(bt.getInstance());const Wh=["⠆","⠒","⠲","⠦","⠴","⠄"],yr={small:["default"],capital:["default"],digit:["default"]};function Kh(t){const e=L.getInstance().options.locale;L.getInstance().options.locale=t,Ti(),Yr({locale:t}),(function(){const n=I.ALPHABETS,r=(o,i)=>{const s={};return Object.keys(o).forEach(c=>s[c]=!0),Object.keys(i).forEach(c=>s[c]=!0),Object.keys(s)};yr.small=r(n.smallPrefix,n.letterTrans),yr.capital=r(n.capPrefix,n.letterTrans),yr.digit=r(n.digitPrefix,n.digitTrans)})();for(const n of wt.values()){const r=n.unicode;"offset"in n?Qh(r,n.font,n.offset||0):zh(r,I.ALPHABETS[n.base],n.font,!!n.capital)}L.getInstance().options.locale=e,Ti()}function Ha(t){return(function(e){return typeof e=="string"?{font:e,combiner:I.ALPHABETS.combiner}:{font:e[0],combiner:I.COMBINERS[e[1]]||_e[e[1]]||I.ALPHABETS.combiner}})(t==="normal"||t==="fullwidth"?"":I.MESSAGES.font[t]||I.MESSAGES.embellish[t]||"")}function zh(t,e,n,r){const o=Ha(n);for(let i,s,c=0;i=t[c],s=e[c];c++){const p=r?I.ALPHABETS.capPrefix:I.ALPHABETS.smallPrefix,E=r?yr.capital:yr.small;ja(o.combiner,i,s,o.font,p,I.ALPHABETS.letterTrans,E)}}function Qh(t,e,n){const r=Ha(e);for(let o,i=0;o=t[i];i++){const s=I.ALPHABETS.digitPrefix,c=i+n;ja(r.combiner,o,c,r.font,s,I.ALPHABETS.digitTrans,yr.digit)}}function ja(t,e,n,r,o,i,s){for(let c,p=0;c=s[p];p++){const E=c in i?i[c]:i.default,T=c in o?o[c]:o.default;_s(c,"default",e,t(E(n),r,T))}}var qi=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(E){try{p(r.next(E))}catch(T){i(T)}}function c(E){try{p(r.throw(E))}catch(T){i(T)}}function p(E){var T;E.done?o(E.value):(T=E.value,T instanceof n?T:new n(function(C){C(T)})).then(s,c)}p((r=r.apply(t,e||[])).next())})};const Jh={functions:function(t){for(const e of t)Yr(e)||(Cl(e.key,e.names||[]),_n!=="base"?(Fs(e),Ai(e)):Er.set(e.key,e))},symbols:function(t){for(const e of t){if(Yr(e))continue;const n=Ao.parseUnicode(e.key);_n!=="base"?Us(n,n,e.mappings):Er.set(n,e)}},units:function(t){for(const e of t)Yr(e)||(e.key+=":unit",_n!=="base"?(Fs(e),e.names&&(e.names=e.names.map(function(n){return n+":unit"})),e.si&&vl(e),Ai(e)):Er.set(e.key,e))},si:t=>t.forEach(Ll),messages:function(t){const e=Si[t.locale];if(!e)return void console.error("Locale "+t.locale+" does not exist!");const n=t.kind.toUpperCase(),r=t.messages;if(!r)return;const o=e();for(const[i,s]of Object.entries(r))o[n][i]=s},rules:bt.addStore,characters:t=>t.forEach(Ml)};let $a=!1;function qh(){return qi(this,arguments,void 0,function*(t=L.getInstance().options.locale){return $a||((function(){for(const e of wt.values()){const n=e.unicode;for(const r of n)Er.set(r,{key:r,category:e.category})}})(),$o(D.BASE_LOCALE),$a=!0),ce.promises[D.BASE_LOCALE].then(()=>qi(this,void 0,void 0,function*(){const e=L.getInstance().defaultLocale;return e?($o(e),ce.promises[e].then(()=>qi(this,void 0,void 0,function*(){return $o(t),ce.promises[t]}))):($o(t),ce.promises[t])}))})}function $o(t=L.getInstance().options.locale){ce.loaded[t]||(ce.loaded[t]=[!1,!1],_n=D.DEFAULT_VALUES[O.LOCALE],Xr=D.DEFAULT_VALUES[O.MODALITY],(function(e){const n=(function(){return L.getInstance().customLoader?L.getInstance().customLoader:Xa()})(),r=new Promise(o=>{n(e).then(i=>{var s;(function(c,p){let E=!0;for(let T,C=0;T=Object.keys(c)[C];C++){const pe=T.split("/");p&&p!==pe[0]||(E&&pe[1]==="symbols"&&pe[0]!=="base"&&(Kh(pe[0]),E=!1),Jh[pe[1]](c[T]))}})(typeof(s=i)=="string"?JSON.parse(s):s),ce.loaded[e]=[!0,!0],o(e)},i=>{ce.loaded[e]=[!0,!1],console.error(`Unable to load locale: ${e}`),L.getInstance().options.locale=L.getInstance().defaultLocale,o(e)})});ce.promises[e]=r})(t))}function Xa(){switch(L.getInstance().mode){case Pe.ASYNC:return Zh;case Pe.HTTP:return td;case Pe.SYNC:default:return ed}}function Zh(t){const e=re(t);return new Promise((n,r)=>{Re.fs.readFile(e,"utf8",(o,i)=>{if(o)return r(o);n(i)})})}function ed(t){const e=re(t);return new Promise((n,r)=>{let o="{}";try{o=Re.fs.readFileSync(e,"utf8")}catch(i){return r(i)}n(o)})}function td(t){const e=re(t),n=new XMLHttpRequest;return new Promise((r,o)=>{n.onreadystatechange=function(){if(n.readyState===4){const i=n.status;i===0||i>=200&&i<400?r(n.responseText):o(i)}},n.open("GET",e,!0),n.send()})}var nd=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(E){try{p(r.next(E))}catch(T){i(T)}}function c(E){try{p(r.throw(E))}catch(T){i(T)}}function p(E){var T;E.done?o(E.value):(T=E.value,T instanceof n?T:new n(function(C){C(T)})).then(s,c)}p((r=r.apply(t,e||[])).next())})};function Cr(t){return nd(this,void 0,void 0,function*(){t.debug&&_.getInstance().init();const e=L.getInstance();return e.setup(t),Ti(),e.setDynamicCstr(),e.init?(ce.promises.init=new Promise((n,r)=>{setTimeout(()=>{n("init")},10)}),e.init=!1,ce.get()):e.options.delay?(e.options.delay=!1,ce.get()):qh()})}var Ya=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(E){try{p(r.next(E))}catch(T){i(T)}}function c(E){try{p(r.throw(E))}catch(T){i(T)}}function p(E){var T;E.done?o(E.value):(T=E.value,T instanceof n?T:new n(function(C){C(T)})).then(s,c)}p((r=r.apply(t,e||[])).next())})};function Ln(t){return Ya(this,void 0,void 0,function*(){return Cr(t)})}function Wa(){return(function(){const t=L.getInstance().json();return t.json=Re.jsonPath,t})()}function Ka(){L.getInstance().reset()}function uo(){return Ya(this,void 0,void 0,function*(){return Ln({}).then(()=>ce.getall())})}const za=Xa;function Lr(t){const e=t||0;ce.getall().then(()=>process.exit(e))}class rd{constructor(e){this.type=e,this.factory_=new Ci}getFactory(){return this.factory_}setFactory(e){this.factory_=e}getType(){return this.type}parseList(e){const n=[];for(let r,o=0;r=e[o];o++)n.push(this.parse(r));return n}}class Mr extends rd{static getAttribute_(e,n,r){if(!e.hasAttribute(n))return r;const o=e.getAttribute(n);return o.match(/^\s*$/)?null:o}constructor(e){super("MathML"),this.options=e,fe.options=e,this.parseMap_=new Map([[v.SEMANTICS,this.semantics_.bind(this)],[v.MATH,this.rows_.bind(this)],[v.MROW,this.rows_.bind(this)],[v.MPADDED,this.rows_.bind(this)],[v.MSTYLE,this.rows_.bind(this)],[v.MFRAC,this.fraction_.bind(this)],[v.MSUB,this.limits_.bind(this)],[v.MSUP,this.limits_.bind(this)],[v.MSUBSUP,this.limits_.bind(this)],[v.MOVER,this.limits_.bind(this)],[v.MUNDER,this.limits_.bind(this)],[v.MUNDEROVER,this.limits_.bind(this)],[v.MROOT,this.root_.bind(this)],[v.MSQRT,this.sqrt_.bind(this)],[v.MTABLE,this.table_.bind(this)],[v.MLABELEDTR,this.tableLabeledRow_.bind(this)],[v.MTR,this.tableRow_.bind(this)],[v.MTD,this.tableCell_.bind(this)],[v.MS,this.text_.bind(this)],[v.MTEXT,this.text_.bind(this)],[v.MSPACE,this.space_.bind(this)],[v.ANNOTATIONXML,this.text_.bind(this)],[v.MI,this.identifier_.bind(this)],[v.MN,this.number_.bind(this)],[v.MO,this.operator_.bind(this)],[v.MFENCED,this.fenced_.bind(this)],[v.MENCLOSE,this.enclosed_.bind(this)],[v.MMULTISCRIPTS,this.multiscripts_.bind(this)],[v.ANNOTATION,this.empty_.bind(this)],[v.NONE,this.empty_.bind(this)],[v.MACTION,this.action_.bind(this)],[v.MPHANTOM,this.phantom_.bind(this)]]);const n={type:l.IDENTIFIER,role:d.NUMBERSET,font:be.DOUBLESTRUCK};["C","H","N","P","Q","R","Z","ℂ","ℍ","ℕ","ℙ","ℚ","ℝ","ℤ"].forEach((r=>this.getFactory().defaultMap.set(r,n)).bind(this))}parse(e){g.getInstance().setNodeFactory(this.getFactory());const n=Ae(e.childNodes),r=Q(e),o=(this.parseMap_.get(r)||this.dummy_.bind(this))(e,n);return o.noupdate||(yi(o,e),[v.MATH,v.MROW,v.MPADDED,v.MSTYLE,v.SEMANTICS,v.MACTION].indexOf(r)!==-1||(o.mathml.unshift(e),o.mathmlTree=e)),o}semantics_(e,n){return n.length?this.parse(n[0]):this.getFactory().makeEmptyNode()}rows_(e,n){const r=e.getAttribute("semantics");if(r&&r.match("bspr_"))return g.proof(e,r,this.parseList.bind(this));let o;if((n=Sr(n)).length===1)o=this.parse(n[0]),o.type!==l.EMPTY||o.mathmlTree||(o.mathmlTree=e);else{const i=fe.run("function_from_identifiers",e),s=this.parseList(n),c=Q(e)===v.MSTYLE;o=i&&i!==e?i:g.getInstance().row(s,c)}return o.mathml.unshift(e),o}fraction_(e,n){if(!n.length)return this.getFactory().makeEmptyNode();const r=this.parse(n[0]),o=n[1]?this.parse(n[1]):this.getFactory().makeEmptyNode();return g.getInstance().fractionLikeNode(r,o,e.getAttribute("linethickness"),e.getAttribute("bevelled")==="true")}limits_(e,n){return g.getInstance().limitNode(Q(e),this.parseList(n))}root_(e,n){return n[1]?this.getFactory().makeBranchNode(l.ROOT,[this.parse(n[1]),this.parse(n[0])],[]):this.sqrt_(e,n)}sqrt_(e,n){const r=this.parseList(Sr(n));return this.getFactory().makeBranchNode(l.SQRT,[g.getInstance().row(r)],[])}table_(e,n){const r=e.getAttribute("semantics");if(r&&r.match("bspr_"))return g.proof(e,r,this.parseList.bind(this));const o=this.getFactory().makeBranchNode(l.TABLE,this.parseList(n),[]);return o.mathmlTree=e,g.tableToMultiline(o)}tableRow_(e,n){const r=this.getFactory().makeBranchNode(l.ROW,this.parseList(n),[]);return r.role=d.TABLE,r}tableLabeledRow_(e,n){var r;if(!n.length)return this.tableRow_(e,n);const o=this.parse(n[0]);o.role=d.LABEL,((r=o.childNodes[0])===null||r===void 0?void 0:r.type)===l.TEXT&&(o.childNodes[0].role=d.LABEL);const i=this.getFactory().makeBranchNode(l.ROW,this.parseList(n.slice(1)),[o]);return i.role=d.TABLE,i}tableCell_(e,n){const r=this.parseList(Sr(n));let o;o=r.length?r.length===1&&J(r[0],l.EMPTY)?r:[g.getInstance().row(r)]:[];const i=this.getFactory().makeBranchNode(l.CELL,o,[]);return i.role=d.TABLE,i}phantom_(e,n){let r;return n.length?(r=this.getFactory().makeUnprocessed(e),r.type=l.TEXT,r.role=d.SPACE):r=this.empty_(e,n),r}space_(e,n){if(!qs(e))return this.empty_(e,n);const r=this.getFactory().makeUnprocessed(e);return g.getInstance().text(r,Q(e))}text_(e,n){const r=this.leaf_(e,n);return e.textContent?(r.updateContent(e.textContent,!0),g.getInstance().text(r,Q(e))):r}identifier_(e,n){const r=this.leaf_(e,n);return g.getInstance().identifierNode(r,g.getInstance().font(e.getAttribute("mathvariant")),e.getAttribute("class"))}number_(e,n){const r=this.leaf_(e,n);return g.number(r),r}operator_(e,n){const r=this.leaf_(e,n);return g.getInstance().operatorNode(r),r}fenced_(e,n){const r=this.parseList(n);r.forEach(p=>{J(p,l.EMPTY)&&p.addAnnotation("empty","MFENCED")});const o=Mr.getAttribute_(e,"separators",","),i=Mr.getAttribute_(e,"open","("),s=Mr.getAttribute_(e,"close",")"),c=g.getInstance().mfenced(i,s,o,r);return c.mathmlTree=e,c.addMathmlNodes([e]),g.getInstance().tablesInRow([c])[0]}enclosed_(e,n){const r=this.parseList(Sr(n)),o=this.getFactory().makeBranchNode(l.ENCLOSE,[g.getInstance().row(r)],[]);return o.role=e.getAttribute("notation")||d.UNKNOWN,o}multiscripts_(e,n){if(!n.length)return this.getFactory().makeEmptyNode();const r=this.parse(n.shift());if(!n.length)return r;const o=[],i=[],s=[],c=[];let p=!1,E=0;for(let T,C=0;T=n[C];C++)Q(T)!==v.MPRESCRIPTS?(p?1&E?o.push(T):i.push(T):1&E?s.push(T):c.push(T),E++):(p=!0,E=0);return Sr(o).length||Sr(i).length?g.getInstance().tensor(r,this.parseList(i),this.parseList(o),this.parseList(c),this.parseList(s)):g.getInstance().pseudoTensor(r,this.parseList(c),this.parseList(s))}empty_(e,n){const r=this.getFactory().makeEmptyNode();return r.addMathmlNodes([e]),r.mathmlTree=e,r}action_(e,n){const r=n[e.hasAttribute("selection")?parseInt(e.getAttribute("selection"),10)-1:0],o=this.parse(r);return o.mathmlTree=r,o}dummy_(e,n){const r=this.getFactory().makeUnprocessed(e);return r.role=e.tagName,r.textContent=e.textContent,r}leaf_(e,n){if(n.length===1&&n[0].nodeType!==He.TEXT_NODE){const o=this.getFactory().makeUnprocessed(e);return o.role=n[0].tagName,yi(o,n[0]),o}const r=this.getFactory().makeLeafNode(e.textContent,g.getInstance().font(e.getAttribute("mathvariant")));return e.hasAttribute("data-latex")&&Fe.LatexCommands.set(e.getAttribute("data-latex"),e.textContent),r}}class Zi{constructor(e,n,r=o=>!1){this.name=e,this.apply=n,this.applicable=r}}class mn extends Zi{}class ho extends Zi{}const es="data-semantic-";var U;(function(t){t.ADDED="data-semantic-added",t.ALTERNATIVE="data-semantic-alternative",t.CHILDREN="data-semantic-children",t.COLLAPSED="data-semantic-collapsed",t.CONTENT="data-semantic-content",t.EMBELLISHED="data-semantic-embellished",t.FENCEPOINTER="data-semantic-fencepointer",t.FONT="data-semantic-font",t.ID="data-semantic-id",t.ANNOTATION="data-semantic-annotation",t.ATTRIBUTES="data-semantic-attributes",t.OPERATOR="data-semantic-operator",t.OWNS="data-semantic-owns",t.PARENT="data-semantic-parent",t.POSTFIX="data-semantic-postfix",t.PREFIX="data-semantic-prefix",t.ROLE="data-semantic-role",t.SPEECH="data-semantic-speech",t.STRUCTURE="data-semantic-structure",t.SUMMARY="data-semantic-summary",t.TYPE="data-semantic-type"})(U||(U={}));const od=[U.ADDED,U.ALTERNATIVE,U.CHILDREN,U.COLLAPSED,U.CONTENT,U.EMBELLISHED,U.FENCEPOINTER,U.FONT,U.ID,U.ANNOTATION,U.ATTRIBUTES,U.OPERATOR,U.OWNS,U.PARENT,U.POSTFIX,U.PREFIX,U.ROLE,U.SPEECH,U.STRUCTURE,U.SUMMARY,U.TYPE];function ts(t){return t.map(function(e){return e.id}).join(",")}function Ot(t,e){t.setAttribute(U.TYPE,e.type);const n=e.allAttributes();for(let o,i=0;o=n[i];i++)t.setAttribute(es+o[0].toLowerCase(),o[1]);e.childNodes.length&&t.setAttribute(U.CHILDREN,ts(e.childNodes)),e.contentNodes.length&&t.setAttribute(U.CONTENT,ts(e.contentNodes)),e.parent&&t.setAttribute(U.PARENT,e.parent.id.toString());const r=e.attributesXml();r&&t.setAttribute(U.ATTRIBUTES,r),(function(o,i){const s=[];i.role===d.MGLYPH&&s.push("image"),i.attributes.href&&s.push("link"),s.length&&o.setAttribute(U.POSTFIX,s.join(" "))})(t,e)}function fo(t){return es+t}function Qn(){const t=ut("mrow");return t.setAttribute(U.ADDED,"true"),t}class Ee{static fromTree(e){return Ee.fromNode(e.root)}static fromNode(e){return new Ee(Ee.fromNode_(e))}static fromString(e){return new Ee(Ee.fromString_(e))}static simpleCollapseStructure(e){return typeof e=="number"}static contentCollapseStructure(e){return!!e&&!Ee.simpleCollapseStructure(e)&&e[0]==="c"}static interleaveIds(e,n){return Oo(Ee.collapsedLeafs(e),Ee.collapsedLeafs(n))}static collapsedLeafs(...e){return e.reduce((n,r)=>{return n.concat((o=r,Ee.simpleCollapseStructure(o)?[o]:Ee.contentCollapseStructure(o[1])?o.slice(2):o.slice(1)));var o},[])}static fromStructure(e,n,r){const o=new Map;e.hasAttribute(U.ID)&&o.set(e.getAttribute(U.ID),e);for(const i of ht(e,U.ID))o.set(i.getAttribute(U.ID),i);return new Ee(Ee.tree_(o,n.root,r))}static combineContentChildren(e,n,r,o){switch(e){case l.RELSEQ:case l.INFIXOP:case l.MULTIREL:return Oo(o,r);case l.PREFIXOP:return r.concat(o);case l.POSTFIXOP:return o.concat(r);case l.MATRIX:case l.VECTOR:case l.FENCED:return o.unshift(r[0]),o.push(r[1]),o;case l.CASES:return o.unshift(r[0]),o;case l.APPL:return[o[0],r[0],o[1]];case l.ROOT:return[o[0],o[1]];case l.ROW:case l.LINE:return r.length&&o.push(r[0]),o;default:return o}}static makeSexp_(e){return Ee.simpleCollapseStructure(e)?e.toString():Ee.contentCollapseStructure(e)?"(c "+e.slice(1).map(Ee.makeSexp_).join(" ")+")":"("+e.map(Ee.makeSexp_).join(" ")+")"}static fromString_(e){let n=e.replace(/\(/g,"[");return n=n.replace(/\)/g,"]"),n=n.replace(/ /g,","),n=n.replace(/c/g,'"c"'),JSON.parse(n)}static fromNode_(e){if(!e)return[];const n=e.contentNodes;let r;n.length&&(r=n.map(Ee.fromNode_),r.unshift("c"));const o=e.childNodes;if(!o.length)return n.length?[e.id,r]:e.id;const i=o.map(Ee.fromNode_);return n.length&&i.unshift(r),i.unshift(e.id),i}static tree_(e,n,r,o=0,i=1,s=1){if(!n)return[];const c=n.id,p=[c],E=e.get(c.toString());if(!n.childNodes.length)return Ee.addAria(E,o,i,s,r),n.id;const T=Ee.combineContentChildren(n.type,n.role,n.contentNodes,n.childNodes);E&&Ee.addOwns_(E,T);for(let C,pe=0,Ne=T.length;C=T[pe];pe++)p.push(Ee.tree_(e,C,r,o+1,pe+1,Ne));return Ee.addAria(E,o,i,s,r),p}static addAria(e,n,r,o,i){const s=i.tree?n?"treeitem":"tree":"treeitem";i.aria&&e&&(e.setAttribute("aria-level",n.toString()),e.setAttribute("aria-posinset",r.toString()),e.setAttribute("aria-setsize",o.toString()),e.setAttribute("role",s),e.hasAttribute(U.OWNS)&&e.setAttribute("aria-owns",e.getAttribute(U.OWNS)))}static addOwns_(e,n){const r=e.getAttribute(U.COLLAPSED),o=r?Ee.realLeafs_(Ee.fromString(r).array):n.map(i=>i.id);e.setAttribute(U.OWNS,o.join(" "))}static realLeafs_(e){if(Ee.simpleCollapseStructure(e))return[e];if(Ee.contentCollapseStructure(e))return[];let n=[];for(let r=1;r<e.length;r++)n=n.concat(Ee.realLeafs_(e[r]));return n}constructor(e){this.parents=null,this.levelsMap=null,e=e===0?e:e||[],this.array=e}populate(){this.parents&&this.levelsMap||(this.parents={},this.levelsMap={},this.populate_(this.array,this.array,[]))}toString(){return Ee.makeSexp_(this.array)}populate_(e,n,r){if(Ee.simpleCollapseStructure(e))return this.levelsMap[e]=n,void(this.parents[e]=e===r[0]?r.slice(1):r);const o=Ee.contentCollapseStructure(e)?e.slice(1):e,i=[o[0]].concat(r);for(let s=0,c=o.length;s<c;s++){const p=o[s];this.populate_(p,e,i)}}isRoot(e){return e===this.levelsMap[e][0]}directChildren(e){return this.isRoot(e)?this.levelsMap[e].slice(1).map(n=>Ee.simpleCollapseStructure(n)?n:Ee.contentCollapseStructure(n)?n[1]:n[0]):[]}subtreeNodes(e){if(!this.isRoot(e))return[];const n=(i,s)=>{Ee.simpleCollapseStructure(i)?s.push(i):(Ee.contentCollapseStructure(i)&&(i=i.slice(1)),i.forEach(c=>n(c,s)))},r=this.levelsMap[e],o=[];return n(r.slice(1),o),o}}function Qa(t,e,n){let r=null;if(!t.length)return r;const o=n[n.length-1],i=o&&o.length,s=e&&e.length,c=g.getInstance();if(i&&s){if(e[0].type===l.INFIXOP&&e[0].role===d.IMPLICIT)return r=t.pop(),o.push(c.postfixNode_(o.pop(),t)),r;r=t.shift();const p=c.prefixNode_(e.shift(),t);return e.unshift(p),r}return i?(o.push(c.postfixNode_(o.pop(),t)),r):(s&&e.unshift(c.prefixNode_(e.shift(),t)),r)}function vr(t,e,n){if(!e.length)return t;const r=t.pop(),o=e.shift(),i=n.shift();if(o.type===l.INFIXOP&&(o.role===d.IMPLICIT||o.role===d.UNIT)){_.getInstance().output("Juxta Heuristic Case 2");const p=(r?[r,o]:[o]).concat(i);return vr(t.concat(p),e,n)}if(!r)return _.getInstance().output("Juxta Heuristic Case 3"),vr([o].concat(i),e,n);const s=i.shift();if(!s){_.getInstance().output("Juxta Heuristic Case 9");const p=fe.factory.makeBranchNode(l.INFIXOP,[r,e.shift()],[o],o.textContent);return p.role=d.IMPLICIT,fe.run("combine_juxtaposition",p),e.unshift(p),vr(t,e,n)}if(Zn(r)||Zn(s))return _.getInstance().output("Juxta Heuristic Case 4"),vr(t.concat([r,o,s]).concat(i),e,n);let c=null;return Zr(r)&&Zr(s)?(_.getInstance().output("Juxta Heuristic Case 5"),r.contentNodes.push(o),r.contentNodes=r.contentNodes.concat(s.contentNodes),r.childNodes.push(s),r.childNodes=r.childNodes.concat(s.childNodes),s.childNodes.forEach(p=>p.parent=r),o.parent=r,r.addMathmlNodes(o.mathml),r.addMathmlNodes(s.mathml),c=r):Zr(r)?(_.getInstance().output("Juxta Heuristic Case 6"),r.contentNodes.push(o),r.childNodes.push(s),s.parent=r,o.parent=r,r.addMathmlNodes(o.mathml),r.addMathmlNodes(s.mathml),c=r):Zr(s)?(_.getInstance().output("Juxta Heuristic Case 7"),s.contentNodes.unshift(o),s.childNodes.unshift(r),r.parent=s,o.parent=s,s.addMathmlNodes(o.mathml),s.addMathmlNodes(r.mathml),c=s):(_.getInstance().output("Juxta Heuristic Case 8"),c=fe.factory.makeBranchNode(l.INFIXOP,[r,s],[o],o.textContent),c.role=d.IMPLICIT),t.push(c),vr(t.concat(i),e,n)}function Ja(t){return t.childNodes[0]&&t.childNodes[0].childNodes[0]&&Q(t.childNodes[0])===v.MPADDED&&Q(t.childNodes[0].childNodes[0])===v.MPADDED&&Q(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1])===v.MPHANTOM}fe.add(new mn("combine_juxtaposition",function(t){for(let e,n=t.childNodes.length-1;e=t.childNodes[n];n--)Zr(e)&&!e.nobreaking&&(t.childNodes.splice(n,1,...e.childNodes),t.contentNodes.splice(n,0,...e.contentNodes),e.childNodes.concat(e.contentNodes).forEach(function(r){r.parent=t}),t.addMathmlNodes(e.mathml));return t})),fe.add(new mn("propagateSimpleFunction",t=>(t.type!==l.INFIXOP&&t.type!==l.FRACTION||!t.childNodes.every(ou)||(t.role=d.COMPFUNC),t),t=>fe.options.domain==="clearspeak")),fe.add(new mn("simpleNamedFunction",t=>(t.role!==d.UNIT&&["f","g","h","F","G","H"].indexOf(t.textContent)!==-1&&(t.role=d.SIMPLEFUNC),t),t=>fe.options.domain==="clearspeak")),fe.add(new mn("propagateComposedFunction",t=>(t.type===l.FENCED&&t.childNodes[0].role===d.COMPFUNC&&(t.role=d.COMPFUNC),t),t=>fe.options.domain==="clearspeak")),fe.add(new mn("multioperator",t=>{t.role!==d.UNKNOWN||t.textContent.length<=1||(g.compSemantics(t,"role",d),g.compSemantics(t,"type",l))})),fe.add(new ho("convert_juxtaposition",t=>{let e=nn(t,function(n){return n.textContent===Rn.invisibleTimes&&n.type===l.OPERATOR});e=e.rel.length?(function(n){const r=[],o=[];let i=n.comp.shift(),s=null,c=[];for(;n.comp.length;)if(c=[],i.length)s&&r.push(s),o.push(i),s=n.rel.shift(),i=n.comp.shift();else{for(s&&c.push(s);!i.length&&n.comp.length;)i=n.comp.shift(),c.push(n.rel.shift());s=Qa(c,i,o)}return c.length||i.length?(r.push(s),o.push(i)):(c.push(s),Qa(c,i,o)),{rel:r,comp:o}})(e):e,t=e.comp[0];for(let n,r,o=1;n=e.comp[o],r=e.rel[o-1];o++)t.push(r),t=t.concat(n);return e=nn(t,function(n){return n.textContent===Rn.invisibleTimes&&(n.type===l.OPERATOR||n.type===l.INFIXOP)}),e.rel.length?vr(e.comp.shift(),e.rel,e.comp):t})),fe.add(new mn("simple2prefix",t=>(t.textContent.length>1&&!t.textContent[0].match(/[A-Z]/)&&(t.role=d.PREFIXFUNC),t),t=>fe.options.modality==="braille"&&t.type===l.IDENTIFIER)),fe.add(new mn("detect_cycle",t=>{t.type=l.MATRIX,t.role=d.CYCLE;const e=t.childNodes[0];return e.type=l.ROW,e.role=d.CYCLE,e.textContent="",e.contentNodes=[],t},t=>t.type===l.FENCED&&t.childNodes[0].type===l.INFIXOP&&t.childNodes[0].role===d.IMPLICIT&&t.childNodes[0].childNodes.every(function(e){return e.type===l.NUMBER})&&t.childNodes[0].contentNodes.every(function(e){return e.role===d.SPACE}))),fe.add(new ho("intvar_from_implicit",function(t){const e=t[0].childNodes;t.splice(0,1,...e),t.forEach(n=>n.parent=null)},t=>t[0]&&er(t[0]))),fe.add(new mn("intvar_from_fraction",function(t){const e=t.childNodes[1],n=e.childNodes[0];if(Li(n))return void(n.role=d.INTEGRAL);if(!er(n))return;const r=n.childNodes.length,o=n.childNodes[r-2],i=n.childNodes[r-1];if(Li(i))return void(i.role=d.INTEGRAL);if(ea(o,i)){const s=g.getInstance().prefixNode_(i,[o]);s.role=d.INTEGRAL,r===2?e.childNodes[0]=s:(n.childNodes.pop(),n.contentNodes.pop(),n.childNodes[r-2]=s,s.parent=n)}},t=>{if(t.type!==l.INTEGRAL)return!1;const[,e,n]=t.childNodes;return n.type===l.EMPTY&&e.type===l.FRACTION})),fe.add(new mn("rewrite_subcases",function(t){t.addAnnotation("Emph","top");let e=[];if(t.hasAnnotation("Emph","left")){const o=qa(t.childNodes[0].childNodes[0].childNodes[0],!0);o.forEach(i=>i.addAnnotation("Emph","left")),e=e.concat(o);for(let i,s=0;i=t.childNodes[s];s++)i.childNodes.shift()}if(e.push(t),t.hasAnnotation("Emph","right")){const o=qa(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].childNodes[0]);o.forEach(i=>i.addAnnotation("Emph","left")),e=e.concat(o),t.childNodes[0].childNodes.pop()}g.tableToMultiline(t);const n=g.getInstance().row(e),r=t.annotation.Emph;return t.annotation.Emph=["table"],r.forEach(o=>n.addAnnotation("Emph",o)),n},t=>{let e=!0,n=!0;const r=t.childNodes[0].childNodes[0];if(!r)return!1;if(Ja(r.mathmlTree)){for(let o,i=1;o=t.childNodes[i];i++)if(o.childNodes[0].childNodes.length){e=!1;break}}else e=!1;if(e&&t.addAnnotation("Emph","left"),Ja(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].mathmlTree)){const o=t.childNodes[0].childNodes.length;for(let i,s=1;i=t.childNodes[s];s++)if(i.childNodes.length>=o){n=!1;break}}else n=!1;return n&&t.addAnnotation("Emph","right"),e||n}));const id=[l.PUNCTUATED,l.RELSEQ,l.MULTIREL,l.INFIXOP,l.PREFIXOP,l.POSTFIXOP];function qa(t,e){if(!t.childNodes.length)return ns(t),[t];let n=null;if(t.type===l.PUNCTUATED&&(e?t.role===d.ENDPUNCT:t.role===d.STARTPUNCT)){const r=t.childNodes;ns(r[e?r.length-1:0])&&(t=r[e?0:r.length-1],n=r[e?r.length-1:0])}if(id.indexOf(t.type)!==-1){const r=t.childNodes;ns(r[e?r.length-1:0]);const o=Ee.combineContentChildren(t.type,t.role,t.contentNodes,t.childNodes);return n&&(e?o.push(n):o.unshift(n)),o}return n?e?[t,n]:[n,t]:[t]}const sd={[d.METRIC]:d.METRIC,[d.VBAR]:d.NEUTRAL,[d.OPENFENCE]:d.OPEN,[d.CLOSEFENCE]:d.CLOSE};function ns(t){if(t.type!==l.PUNCTUATION)return!1;const e=sd[t.role];return!!e&&(t.role=e,t.type=l.FENCE,t.addAnnotation("Emph","fence"),!0)}function Za(t,e,n,r=n){const o=[];for(;t&&t.role===n;)o.push(t),t=e.shift();return o.length?(t&&e.unshift(t),[o.length===1?o[0]:ad(o,r),e]):[t,e]}function ad(t,e){const n=fe.factory.makeBranchNode(l.PUNCTUATION,t,[]);return n.role=e,n}function Xo(t){return["[","["].includes(t)}function Yo(t){return["]","]"].includes(t)}function ec(t){return["(","⁽","₍"].includes(t)}function tc(t){return[")","⁾","₎"].includes(t)}function nc(t){return t.role===d.INFTY||t.type===l.PREFIXOP&&t.childNodes[0].role===d.INFTY}function rc(t){const e=t.childNodes[0];if(t.type!==l.FENCED||e?.type!==l.PUNCTUATED||e?.childNodes.length!==3||e?.contentNodes.length!==1||e?.childNodes[1].role!==d.COMMA)return!1;const n=t.childNodes[0].childNodes[0],r=t.childNodes[0].childNodes[2],o=t.contentNodes[0].textContent,i=t.contentNodes[1].textContent;return!!(Xo(o)&&tc(i)||ec(o)&&Yo(i))||!(!ec(o)||!tc(i)||!nc(n)&&!nc(r))}function cd(t){return os(t)||(function(e){return lr(e)||e.type===l.INFIXOP&&e.role===d.IMPLICIT&&(e.childNodes.length===2&&(lr(e.childNodes[0])||os(e.childNodes[0]))&&lr(e.childNodes[1])||e.childNodes.length===3&&os(e.childNodes[0])&&lr(e.childNodes[1])&&lr(e.childNodes[2]))})(t)||(function(e){return e.type===l.PUNCTUATED&&e.role===d.ENDPUNCT&&e.childNodes.length===2&&e.childNodes[1].role===d.DEGREE&&(lr(e.childNodes[0])||Wo(e.childNodes[0])||e.childNodes[0].type===l.PREFIXOP&&e.childNodes[0].role===d.NEGATIVE&&(lr(e.childNodes[0].childNodes[0])||Wo(e.childNodes[0].childNodes[0])))})(t)||(function(e){return e.type===l.PREFIXOP&&e.role===d.NEGATIVE&&rs(e.childNodes[0])&&e.childNodes[0].type!==l.PREFIXOP&&e.childNodes[0].type!==l.APPL&&e.childNodes[0].type!==l.PUNCTUATED})(t)||(function(e){return e.type===l.APPL&&(e.childNodes[0].role===d.PREFIXFUNC||e.childNodes[0].role===d.SIMPLEFUNC)&&(rs(e.childNodes[1])||e.childNodes[1].type===l.FENCED&&rs(e.childNodes[1].childNodes[0]))})(t)}function rs(t){return t.hasAnnotation("clearspeak","simple")}function lr(t){return t.type===l.IDENTIFIER&&(t.role===d.LATINLETTER||t.role===d.GREEKLETTER||t.role===d.OTHERLETTER||t.role===d.SIMPLEFUNC)}function Wo(t){return t.type===l.NUMBER&&(t.role===d.INTEGER||t.role===d.FLOAT)}function os(t){return Wo(t)||(function(e){if(is("Fraction_Over")||is("Fraction_FracOver")||e.type!==l.FRACTION||e.role!==d.VULGAR)return!1;if(is("Fraction_Ordinal"))return!0;const n=parseInt(e.childNodes[0].textContent,10),r=parseInt(e.childNodes[1].textContent,10);return n>0&&n<20&&r>0&&r<11})(t)}function is(t){return L.getInstance().options.style===t}function ld(t){return t.type===l.TEXT&&t.role!==d.LABEL||t.type===l.PUNCTUATED&&t.role===d.TEXT&&Wo(t.childNodes[0])&&(function(e){for(let n=0;n<e.length-1;n++)if(e[n].type!==l.TEXT||e[n].textContent!=="")return!1;return e[e.length-1].type===l.TEXT})(t.childNodes.slice(1))||t.type===l.IDENTIFIER&&t.role===d.UNIT||t.type===l.INFIXOP&&(t.role===d.IMPLICIT||t.role===d.UNIT)}fe.add(new ho("ellipses",t=>{const e=[];let n=t.shift();for(;n;)[n,t]=Za(n,t,d.FULLSTOP,d.ELLIPSIS),[n,t]=Za(n,t,d.DASH),e.push(n),n=t.shift();return e},t=>t.length>1)),fe.add(new ho("op_with_limits",t=>{const e=t[0];return e.type=l.LARGEOP,e.role=d.SUM,t},t=>(t[0].type===l.OPERATOR||t[0].type===l.IDENTIFIER&&t[0].attributes.texclass==="OP")&&t.slice(1).some(e=>e.type===l.RELSEQ||e.type===l.MULTIREL||e.type===l.INFIXOP&&e.role===d.ELEMENT||e.type===l.PUNCTUATED&&e.role===d.SEQUENCE))),fe.add(new class extends Zi{}("function_from_identifiers",t=>{const e=Ae(t.childNodes).map(r=>r.textContent.trim()).join("");if(Fe.Meaning.get(e).type===l.UNKNOWN)return t;const n=fe.factory.makeLeafNode(e,g.getInstance().font(t.getAttribute("mathvariant")));return n.mathmlTree=t,n},t=>{const e=Ae(t.childNodes);return!(e.length<2)&&e.every(n=>Q(n)===v.MI&&Fe.Meaning.get(n.textContent.trim()).role===d.LATINLETTER)})),fe.add(new ho("bracketed_interval",t=>{const e=t[0],n=t[1],r=t.slice(2),o=g.getInstance().row(r),i=fe.factory.makeBranchNode(l.FENCED,[o],[e,n]);return i.role=d.INTERVAL,i},t=>{const e=t[0],n=t[1],r=t.slice(2);if(!(e&&n&&(Yo(e.textContent)&&(Xo(n.textContent)||Yo(n.textContent))||Xo(n.textContent)&&(Xo(e.textContent)||Yo(e.textContent)))))return!1;if(r.length===1&&r[0].type===l.PUNCTUATED&&r[0].contentNodes.length===1)return!0;const o=nn(r,Co);return!(o.rel.length!==1||!o.comp[0].length||!o.comp[1].length)})),fe.add(new mn("interval_heuristic",t=>(t.role=d.INTERVAL,t),t=>rc(t))),fe.add(new mn("propagateInterval",t=>(t.childNodes.forEach(e=>{rc(e)&&(e.role=d.INTERVAL)}),t),t=>ma(t))),wo(new ki("clearspeak","simple",function(t){return cd(t)?"simple":""})),Ar("clearspeak","simple"),wo(new ki("clearspeak","unit",function(t){return ld(t)?"unit":""})),Ar("clearspeak","unit");const ud=[l.MULTIREL,l.RELSEQ,l.APPL,l.ROW,l.LINE],hd=[l.SUBSCRIPT,l.SUPERSCRIPT,l.OVERSCORE,l.UNDERSCORE];function oc(t,e){const n=t.parent;if(!n)return!1;const r=n.type;return ud.indexOf(r)!==-1||r===l.PREFIXOP&&n.role===d.NEGATIVE&&!e.script&&!e.enclosed||r===l.PREFIXOP&&n.role===d.GEOMETRY||!(r!==l.PUNCTUATED||e.enclosed&&n.role!==d.TEXT)}wo(new Bi("nemeth","number",function(t,e){return t.childNodes.length?(hd.indexOf(t.type)!==-1&&(e.script=!0),t.type===l.FENCED?(e.number=!1,e.enclosed=!0,["",e]):t.type===l.PREFIXOP&&t.role!==d.GEOMETRY&&t.role!==d.NEGATIVE?(e.number=!1,["",e]):(oc(t,e)&&(e.number=!0,e.enclosed=!1),["",e])):(oc(t,e)&&(e.number=!0,e.script=!1,e.enclosed=!1),[e.number?"number":"",{number:!1,enclosed:e.enclosed,script:e.script}])},{number:!0})),Ar("nemeth","number"),wo(new Bi("depth","depth",function(t){return t.parent?[parseInt(t.parent.annotation.depth[0])+1]:[1]})),Ar("depth","depth");class Bn{static empty(){const e=Ge("<math/>"),n=new Bn(e,new te);return n.mathml=e,n}static fromNode(e,n){const r=Bn.empty();return r.root=e,n&&(r.mathml=n),r}static fromRoot(e,n){let r=e;for(;r.parent;)r=r.parent;const o=Bn.fromNode(r);return n&&(o.mathml=n),o}static fromXml(e){const n=Bn.empty();return e.childNodes[0]&&(n.root=un.fromXml(e.childNodes[0])),n}constructor(e,n){this.mathml=e,this.options=n,this.parser=new Mr(n),this.root=this.parser.parse(e),this.root=g.rewriteTrivialTable(this.root),this.collator=this.parser.getFactory().leafMap.collateMeaning();const r=this.collator.newDefault();r&&(this.parser=new Mr(n),this.parser.getFactory().defaultMap=r,this.root=this.parser.parse(e)),dd.visit(this.root,{}),(function(o){for(const i of Gi.values())i.active&&i.annotate(o);for(const i of Vi.values())i.active&&i.visit(o,Object.assign({},i.def))})(this.root),_.getInstance().generate(()=>(function(o){const i=new Map,s=p=>{if(p.mathmlTree){const E=i.get(p.mathmlTree)||new Set;E.add(p),i.set(p.mathmlTree,E)}p.childNodes.forEach(s),p.contentNodes.forEach(s)};s(o);const c=[];for(const[p,E]of i)E.size>1&&c.push(`DUPLICATE mathmlTree: ${Q(p)} shared by `+Array.from(E).map(T=>`${T.id}:${T.type}:${T.role}`).join(", "));return c})(this.root))}xml(e){const n=Ge("<stree></stree>"),r=this.root.xml(n.ownerDocument,e);return n.appendChild(r),n}toString(e){return de(this.xml(e))}formatXml(e){return ye(this.toString(e))}displayTree(){this.root.displayTree()}replaceNode(e,n){const r=e.parent;r?r.replaceChild(e,n):this.root=n}toJson(){const e={};return e.stree=this.root.toJson(),e}}const dd=new Bi("general","unit",(t,e)=>(da(t)&&(t.role=d.UNIT),!1));function Dr(t,e){return Ko(t,e).xml()}function Ko(t,e){return new Bn(t,e)}const ic=[],po=new Map;function it(t){_.getInstance().generate(()=>["WALKING START: ",t.toString()]);const e=(function(s){for(let c,p=0;c=ic[p];p++)if(c.test(s))return c.constr(s);return null})(t);let n;if(e)return n=e.getMathml(),_.getInstance().generate(()=>["WALKING END (1): ",t.toString()]),Gn(n,t);if(t.mathml.length===1){if(_.getInstance().output("Walktree Case 0"),!t.childNodes.length)return _.getInstance().output("Walktree Case 0.1"),n=t.mathml[0],Ot(n,t),_.getInstance().generate(()=>["WALKING END (2): ",t.toString()]),Gn(n,t.getAnnotation("empty").length&&!t.hasAnnotation("empty","MFENCED")?t:void 0);const s=t.childNodes[0];if(t.childNodes.length===1&&s.type===l.EMPTY)return _.getInstance().output("Walktree Case 0.2"),n=t.mathml[0],Ot(n,t),n.appendChild(it(s)),_.getInstance().generate(()=>["WALKING END (3): ",t.toString()]),Gn(n);t.childNodes.forEach(c=>{c.mathml.length||c.addMathmlNodes([fc(c)])})}const r=t.contentNodes.map(Zo);pc(t,r);const o=t.childNodes.map(it),i=Ee.combineContentChildren(t.type,t.role,r,o);if(n=t.mathmlTree,n===null)_.getInstance().output("Walktree Case 1"),n=wr(i,t);else{n=dc(n);const s=Jo(i);if(_.getInstance().output("Walktree Case 2"),s){_.getInstance().output("Walktree Case 2.1");const c=Xt(s);if(c&&t.parent&&s!==n&&Nr(n,c)){_.getInstance().output("Walktree Case 2.1.fallback");const p=Vn(n);if(p!==n&&p.hasAttribute(U.ID))return ac(Xt(n)||n,i,t),po.has(t.id)||(po.set(t.id,!0),Ot(n,t)),_.getInstance().generate(()=>["WALKING END (4): ",t.toString()]),Gn(n,t);n=p}else n=c}else _.getInstance().output("Walktree Case 2.2"),n=Vn(n)}return ac(n,i,t),po.has(t.id)||(po.set(t.id,!0),Ot(n,t)),_.getInstance().generate(()=>["WALKING END (5): ",t.toString()]),Gn(n,t)}function wr(t,e){const n=(function(i){const s=Jo(i);if(!s)return{type:Mn.INVALID,node:null};const c=Jo(i.slice().reverse());if(s===c)return{type:Mn.VALID,node:s};const p=cc(s),E=(function(Ne,ae){let rt=0;for(;Ne[rt]&&ae.indexOf(Ne[rt])===-1;)rt++;return Ne.slice(0,rt+1)})(p,i),T=cc(c,function(Ne){return E.indexOf(Ne)!==-1}),C=T[0],pe=E.indexOf(C);return pe===-1?{type:Mn.INVALID,node:null}:{type:E.length!==p.length?Mn.PRUNED:Ed(E[pe+1],T[1])?Mn.VALID:Mn.INVALID,node:C}})(t);let r=n.node;const o=n.type;if(o!==Mn.VALID||!Xn(r)||!r.parentNode&&e.parent){if(_.getInstance().output("Walktree Case 1.1"),r=Qn(),o===Mn.PRUNED)_.getInstance().output("Walktree Case 1.1.0"),r=(function(i,s,c){let p=uc(s);if(Ro(p)){_.getInstance().output("Walktree Case 1.1.0.0"),sc(p,i),Ae(p.childNodes).forEach(function(C){i.appendChild(C)});const T=i;i=p,p=T}const E=c.indexOf(s);return c[E]=p,q(p,i),i.appendChild(p),c.forEach(function(T){i.appendChild(T)}),i})(r,n.node,t);else if(t[0]){_.getInstance().output("Walktree Case 1.1.1");const i=Jo(t);if(i){_.getInstance().output("Walktree Case 1.1.1.0");const s=(function(c,p){const E=Ae(c.childNodes);let T=1/0,C=-1/0;return p.forEach(function(pe){const Ne=E.indexOf(pe);Ne!==-1&&(T=Math.min(T,Ne),C=Math.max(C,Ne))}),E.slice(T,C+1)})(Xt(i),t);(function(c,p){if(c.type!=="postfixop")return;const E=p[p.length-1].nextSibling;E&&(function(T){return Q(T)===v.MROW&&T.getAttribute("data-mjx-texclass")==="ORD"&&T.childNodes.length===0})(E)&&p.push(E)})(e,s),q(i,r),s.forEach(function(c){r.appendChild(c)})}else _.getInstance().output("Walktree Case 1.1.1.1"),sc(r,t[0]),r=t[0]}}return e.mathmlTree||(e.mathmlTree=r),r}function sc(t,e){for(const n of od)t.hasAttribute(n)&&(e.setAttribute(n,t.getAttribute(n)),t.removeAttribute(n))}function fd(t,e){const n=[];let r=Ae(t.childNodes);for(;r.length;){const o=r.shift();o.nodeType===He.ELEMENT_NODE&&(o.hasAttribute(U.TYPE)||e.indexOf(o)!==-1?n.push(o):r=Ae(o.childNodes).concat(r))}return n}function ac(t,e,n){if(!e.length||e.length===1&&t===e[0])return;const r=n.role===d.IMPLICIT&&fe.flags.combine_juxtaposition?(function(s,c,p){const E=[];let T=Ae(s.childNodes),C=!1;for(;T.length;){const ae=T.shift();if(ae.hasAttribute(U.TYPE)){E.push(ae);continue}const rt=fd(ae,c);rt.length!==0&&(rt.length!==1?(C?ae.setAttribute("AuxiliaryImplicit",!0):C=!0,T=rt.concat(T)):E.push(ae))}const pe=[],Ne=p.childNodes.map(function(ae){return ae.mathmlTree});for(;Ne.length;){const ae=Ne.pop();if(ae){if(E.indexOf(ae)!==-1)break;c.indexOf(ae)!==-1&&pe.unshift(ae)}}return E.concat(pe)})(t,e,n):Ae(t.childNodes);if(!r.length)return void e.forEach(function(s){Qo(t,s)||t.appendChild(s)});let o=0;const i=qr(Jr,"mergeChildren infinite loop");for(;e.length;){i();const s=e[0];if(r[o]===s||gd(r[o],s)){e.shift(),o++;continue}if(r[o]&&e.indexOf(r[o])===-1){o++;continue}if(Nr(s,t)){e.shift();continue}const c=r[o];if(!c){if(s.parentNode){t=Xt(s),e.shift();continue}const p=e[1];if(p&&p.parentNode){let E=Xt(p),T=p;for(;E&&E!==t&&Zl(E);)T=E,E=Xt(E);zo(t=E,s,T),e.shift(),e.shift();continue}zo(t,s,null),e.shift();continue}pd(t,c,s),e.shift()}}function pd(t,e,n){let r=e,o=Xt(r);const i=qr(Jr,()=>`insertNewChild loop: next=${o?.tagName} parent=${r?.tagName}`);for(;o&&md(o,r)&&!r.hasAttribute("AuxiliaryImplicit")&&o!==t;)i(),r=o,o=Xt(r);o&&(zo(o,n,r),r.removeAttribute("AuxiliaryImplicit"))}function zo(t,e,n){Qo(t,e)||(Q(t)===v.MACTION?zo(Xt(t),e,t):t.insertBefore(e,n))}function Qo(t,e){return t===e||Nr(t,e)}function md(t,e){if(Q(t)!==v.MACTION)return t.firstChild===e;const n=parseInt(t.getAttribute("selection"))||1;return t.childNodes[n-1]===e}function gd(t,e){const n=Rn.functionApplication;if(t&&e&&t.textContent&&e.textContent&&t.textContent===n&&e.textContent===n&&e.getAttribute(U.ADDED)==="true"){for(let r,o=0;r=t.attributes[o];o++)e.hasAttribute(r.nodeName)||e.setAttribute(r.nodeName,r.nodeValue);return q(t,e),!0}return!1}var Mn;function Jo(t){let e=0,n=null;for(;!n&&e<t.length;)t[e].parentNode&&(n=t[e]),e++;return n}function cc(t,e){const n=e||(i=>!1),r=[t],o=qr(Jr,()=>{var i;return`pathToRoot infinite loop at ${t.tagName} parent=${(i=t.parentNode)===null||i===void 0?void 0:i.tagName}`});for(;!n(t)&&!Ro(t)&&t.parentNode;)o(),t=Xt(t),r.unshift(t);return r}function Ed(t,e){return!(!t||!e||lc(t,"previousSibling")||lc(e,"nextSibling"))}function lc(t,e){let n=t[e];for(;n;){if(!qo(n))return!0;n=n[e]}return!1}function Gn(t,e){var n,r;const o=e&&!e.hasAnnotation("empty","MFENCED")&&e.getAnnotation("empty"),i=(n=e?.parent)===null||n===void 0?void 0:n.mathmlTree,s=qr(Jr,()=>{var p;return`ascendNewNode infinite loop at ${t.tagName} parent=${(p=t.parentNode)===null||p===void 0?void 0:p.tagName}`}),c=!(!e||!e.parent);for(;t!==i&&!Ro(t)&&(!c||!Ro(Xt(t)))&&(Nd(t)||o&&t.parentNode&&(!i||Nr(t,i))&&o.includes((r=Xt(t).tagName)===null||r===void 0?void 0:r.toUpperCase())&&hc(t));)s(),t=Xt(t);return t}function uc(t){const e=Ae(t.childNodes);if(!e)return t;const n=e.filter(function(r){return r.nodeType===He.ELEMENT_NODE&&!Ri(r)});return n.length===1&&Xn(n[0])&&!n[0].hasAttribute(U.TYPE)?uc(n[0]):t}function Nd(t){const e=Xt(t);return!(!e||!Xn(e))&&hc(t)}function hc(t){const e=Xt(t);return!!e&&Ae(e.childNodes).every(function(n){return n===t||qo(n)})}function qo(t){if(t.nodeType!==He.ELEMENT_NODE||!t||Ri(t))return!0;const e=Ae(t.childNodes);return!(!Xn(t)&&e.length||(function(n){return!!n&&Ql.includes(Q(n))})(t)||qs(t)||t.hasAttribute(U.TYPE)||ql(t))&&Ae(t.childNodes).every(qo)}function Xt(t){return t.parentNode}function mo(t,e){const n=new Ee(e);t.setAttribute(U.COLLAPSED,n.toString())}function Zo(t){if(t.mathml.length)return Gn(it(t),t);const e=fc(t);return t.addMathmlNodes([e]),e}function dc(t){if(Q(t)!==v.MFENCED)return t;const e=Qn();for(let n,r=0;n=t.attributes[r];r++)["open","close","separators"].indexOf(n.name)===-1&&e.setAttribute(n.name,n.value);return Ae(t.childNodes).forEach(function(n){e.appendChild(n)}),q(t,e),e}function fc(t){const e=ut("mo"),n=et(t.textContent);return e.appendChild(n),Ot(e,t),e.setAttribute(U.ADDED,"true"),e}function pc(t,e){const n=t.type+(t.textContent?","+t.textContent:"");e.forEach(function(r){Vn(r).setAttribute(U.OPERATOR,n)})}function Vn(t){if(Ri(t))return t;const e=Ae(t.childNodes);if(!e)return t;const n=e.filter(function(o){return!qo(o)}),r=[];for(let o,i=0;o=n[i];i++)if(Xn(o)&&o.getAttribute(U.TYPE)!==l.PUNCTUATION){const s=Vn(o);s&&s!==o&&r.push(s)}else r.push(o);return r.length===1?r[0]:t}function ss(t){return ye(t.toString()).toString().replace(new RegExp(es,"g"),"")}function mc(t,e){const n=!!e,r=e||[],o=t.parent,i=t.contentNodes.map(function(c){return c.id});i.unshift("c");const s=[t.id,i];for(let c,p=0;c=t.childNodes[p];p++){const E=it(c);r.push(E);const T=Vn(E);o&&!n&&T.setAttribute(U.PARENT,o.id.toString()),s.push(c.id)}return s}(function(t){t.VALID="valid",t.INVALID="invalid",t.PRUNED="pruned"})(Mn||(Mn={}));class gn{constructor(e){this.semantic=e}}class gc extends gn{static test(e){return!e.mathmlTree&&e.type===l.LINE&&e.role===d.BINOMIAL}constructor(e){super(e),this.mml=e.mathmlTree}getMathml(){if(!this.semantic.childNodes.length)return this.mml;const e=this.semantic.childNodes[0];if(this.mml=it(e),this.mml.hasAttribute(U.TYPE)){const n=Qn();q(this.mml,n),n.appendChild(this.mml),this.mml=n}return Ot(this.mml,this.semantic),this.mml}}class Ec extends gn{static test(e){var n,r;return!!e.getAnnotation("collapsed").length&&((r=(n=e.mathmlTree)===null||n===void 0?void 0:n.parentNode)===null||r===void 0?void 0:r.childNodes.length)>2}getMathml(){it(this.semantic.childNodes[0]),it(this.semantic.childNodes[1]);const e=this.semantic.mathmlTree,n=wr([this.semantic.childNodes[0].mathmlTree,e],this.semantic);return Ot(n,this.semantic),n}}class as extends gn{static test(e){if(!e.mathmlTree||!e.childNodes.length)return!1;const n=Q(e.mathmlTree),r=e.childNodes[0].role;return n===v.MSUBSUP&&r===d.SUBSUP||n===v.MUNDEROVER&&r===d.UNDEROVER}constructor(e){super(e),this.mml=e.mathmlTree}getMathml(){const e=this.semantic.childNodes[0],n=e.childNodes[0],r=this.semantic.childNodes[1],o=e.childNodes[1],i=it(r),s=it(n),c=it(o);return Ot(this.mml,this.semantic),this.mml.setAttribute(U.CHILDREN,ts([n,o,r])),[s,c,i].forEach(p=>Vn(p).setAttribute(U.PARENT,this.mml.getAttribute(U.ID))),this.mml.setAttribute(U.TYPE,e.role),mo(this.mml,[this.semantic.id,[e.id,n.id,o.id],r.id]),this.mml}}class En extends gn{static multiscriptIndex(e){return e.type===l.PUNCTUATED&&e.contentNodes[0].role===d.DUMMY&&e.hasAnnotation("general","script")?mc(e):(it(e),e.id)}static createNone_(e){const n=ut("none");return e&&Ot(n,e),n.setAttribute(U.ADDED,"true"),n}constructor(e){super(e),this.mml=e.mathmlTree}completeMultiscript(e,n){const r=Ae(this.mml.childNodes).slice(1);let o=0;const i=s=>{for(const c of s){const p=r[o];if(p&&c===parseInt(p.getAttribute(U.ID)))p.setAttribute(U.PARENT,this.semantic.id.toString()),o++;else if(p&&c===parseInt(Vn(p).getAttribute(U.ID)))Vn(p).setAttribute(U.PARENT,this.semantic.id.toString()),o++;else{const E=this.semantic.querySelectorAll(T=>T.id===c);this.mml.insertBefore(En.createNone_(E[0]),p||null)}}};i(e),r[o]&&Q(r[o])!==v.MPRESCRIPTS?this.mml.insertBefore(r[o],ut("mprescripts")):o++,i(n)}}class cs extends En{static test(e){return e.mathmlTree?Q(e.mathmlTree)===v.MMULTISCRIPTS&&(e.type===l.SUPERSCRIPT||e.type===l.SUBSCRIPT):!1}constructor(e){super(e)}getMathml(){let e,n,r;if(Ot(this.mml,this.semantic),this.semantic.childNodes[0]&&this.semantic.childNodes[0].role===d.SUBSUP){const i=this.semantic.childNodes[0];e=i.childNodes[0],n=En.multiscriptIndex(this.semantic.childNodes[1]),r=En.multiscriptIndex(i.childNodes[1]);const s=[this.semantic.id,[i.id,e.id,r],n];mo(this.mml,s),this.mml.setAttribute(U.TYPE,i.role),this.completeMultiscript(Ee.interleaveIds(r,n),[])}else{e=this.semantic.childNodes[0],n=En.multiscriptIndex(this.semantic.childNodes[1]);const i=[this.semantic.id,e.id,n];mo(this.mml,i)}const o=Ee.collapsedLeafs(r||[],n);return Vn(it(e)).setAttribute(U.PARENT,this.semantic.id.toString()),o.unshift(e.id),this.mml.setAttribute(U.CHILDREN,o.join(",")),this.mml}}class ls extends En{static test(e){return!!e.mathmlTree&&e.type===l.TENSOR}constructor(e){super(e)}getMathml(){it(this.semantic.childNodes[0]);const e=En.multiscriptIndex(this.semantic.childNodes[1]),n=En.multiscriptIndex(this.semantic.childNodes[2]),r=En.multiscriptIndex(this.semantic.childNodes[3]),o=En.multiscriptIndex(this.semantic.childNodes[4]);Ot(this.mml,this.semantic);const i=[this.semantic.id,this.semantic.childNodes[0].id,e,n,r,o];mo(this.mml,i);const s=Ee.collapsedLeafs(e,n,r,o);return s.unshift(this.semantic.childNodes[0].id),this.mml.setAttribute(U.CHILDREN,s.join(",")),this.completeMultiscript(Ee.interleaveIds(r,o),Ee.interleaveIds(e,n)),this.mml}}class ur extends gn{static test(e){return!(!e.mathmlTree||!e.fencePointer||e.mathmlTree.getAttribute("data-semantic-type"))}static makeEmptyNode_(e){const n=Qn(),r=new un(e);return r.type=l.EMPTY,r.mathmlTree=n,r}static fencedMap_(e,n){n[e.id]=e.mathmlTree,e.embellished&&ur.fencedMap_(e.childNodes[0],n)}constructor(e){super(e),this.fenced=null,this.fencedMml=null,this.fencedMmlNodes=[],this.ofence=null,this.ofenceMml=null,this.ofenceMap={},this.cfence=null,this.cfenceMml=null,this.cfenceMap={},this.parentCleanup=[]}getMathml(){return this.getFenced_(),this.fencedMml=Gn(it(this.fenced),this.fenced),this.getFencesMml_(),this.fenced.type!==l.EMPTY||this.fencedMml.parentNode||(this.fencedMml.setAttribute(U.ADDED,"true"),this.cfenceMml.parentNode.insertBefore(this.fencedMml,this.cfenceMml)),this.getFencedMml_(),this.rewrite_()}fencedElement(e){return e.type===l.FENCED||e.type===l.MATRIX||e.type===l.VECTOR}getFenced_(){let e=this.semantic;for(;!this.fencedElement(e);)e=e.childNodes[0];this.fenced=e.childNodes[0],this.ofence=e.contentNodes[0],this.cfence=e.contentNodes[1],ur.fencedMap_(this.ofence,this.ofenceMap),ur.fencedMap_(this.cfence,this.cfenceMap)}getFencedMml_(){let e=this.ofenceMml.nextSibling;for(e=e===this.fencedMml?e:this.fencedMml;e&&e!==this.cfenceMml&&(this.fencedMmlNodes.push(e),!Nr(this.cfenceMml,e));)e=e.nextSibling}getFencesMml_(){let e=this.semantic;const n=Object.keys(this.ofenceMap),r=Object.keys(this.cfenceMap);for(;!(this.ofenceMml&&this.cfenceMml||e===this.fenced);)n.indexOf(e.fencePointer)===-1||this.ofenceMml||(this.ofenceMml=e.mathmlTree),r.indexOf(e.fencePointer)===-1||this.cfenceMml||(this.cfenceMml=e.mathmlTree),e=e.childNodes[0];this.ofenceMml||(this.ofenceMml=this.ofence.mathmlTree),this.cfenceMml||(this.cfenceMml=this.cfence.mathmlTree),this.ofenceMml&&(this.ofenceMml=Gn(this.ofenceMml)),this.cfenceMml&&(this.cfenceMml=Gn(this.cfenceMml))}rewrite_(){let e=this.semantic,n=null;const r=this.introduceNewLayer_();for(Ot(r,this.fenced.parent);!this.fencedElement(e);){const o=e.mathmlTree,i=this.specialCase_(e,o);if(i)e=i;else{Ot(o,e);const p=[];for(let E,T=1;E=e.childNodes[T];T++)p.push(it(E));e=e.childNodes[0]}const s=ut("dummy"),c=o.childNodes[0];q(o,s),q(r,o),q(o.childNodes[0],r),q(s,c),n||(n=o)}return it(this.ofence),it(this.cfence),this.cleanupParents_(),n||r}specialCase_(e,n){var r;const o=Q(n);let i,s=null;if(o===v.MSUBSUP?((r=e.childNodes[0])===null||r===void 0?void 0:r.role)===d.SUBSUP&&(s=e.childNodes[0],i=as):o===v.MMULTISCRIPTS&&(e.type===l.SUPERSCRIPT||e.type===l.SUBSCRIPT?i=cs:e.type===l.TENSOR&&(i=ls),s=i&&e.childNodes[0]&&e.childNodes[0].role===d.SUBSUP?e.childNodes[0]:e),!s)return null;const c=s.childNodes[0],p=ur.makeEmptyNode_(c.id);return s.childNodes[0]=p,n=new i(e).getMathml(),s.childNodes[0]=c,this.parentCleanup.push(n),s.childNodes[0]}introduceNewLayer_(){const e=this.fullFence(this.ofenceMml),n=this.fullFence(this.cfenceMml);let r=Qn();if(q(this.fencedMml,r),this.fencedMmlNodes.forEach(o=>r.appendChild(o)),Qo(r,e)||r.insertBefore(e,this.fencedMml),Qo(r,n)||r.appendChild(n),!r.parentNode){const o=Qn();for(;r.childNodes.length>0;)o.appendChild(r.childNodes[0]);r.appendChild(o),r=o}return r}fullFence(e){const n=this.fencedMml.parentNode;let r=e;for(;r.parentNode&&r.parentNode!==n;)r=r.parentNode;return r}cleanupParents_(){this.parentCleanup.forEach(function(e){const n=e.childNodes[1].getAttribute(U.PARENT);e.childNodes[0].setAttribute(U.PARENT,n)})}}class Nc extends gn{static test(e){return!!e.mathmlTree&&e.hasAnnotation("Emph","top")}constructor(e){super(e),this.mrows=[],this.mml=e.mathmlTree}getMathml(){if(this.recurseToTable(this.semantic),this.mrows.length){const e=Qn();this.mml.parentNode.insertBefore(e,this.mml);for(const n of this.mrows)e.appendChild(n);e.appendChild(this.mml)}return this.mml}recurseToTable(e){var n,r;if(e.hasAnnotation("Emph","top")||e.hasAnnotation("Emph","fence")||!e.hasAnnotation("Emph","left")&&!e.hasAnnotation("Emph","right")){if(!e.mathmlTree||Q(e.mathmlTree)===v.MTABLE&&(!((n=e.annotation.Emph)===null||n===void 0)&&n.length)&&e.annotation.Emph[0]!=="table"){const o=Qn();Ot(o,e),this.mrows.unshift(o)}else{if(Q(e.mathmlTree)===v.MTABLE&&(!((r=e.annotation.Emph)===null||r===void 0)&&r.length)&&e.annotation.Emph[0]==="table")return void this.finalizeTable(e);Ot(e.mathmlTree,e)}if(e.childNodes.forEach(this.recurseToTable.bind(this)),e.textContent||e.type==="punctuated"){pc(e,e.contentNodes.map(o=>{const i=Zo(o);return i.hasAttribute("data-semantic-added")?this.mrows.unshift(i):this.recurseToTable(o),i}));return}e.contentNodes.forEach(this.recurseToTable.bind(this))}else it(e)}finalizeTable(e){Ot(e.mathmlTree,e),e.contentNodes.forEach(n=>{it(n)}),e.childNodes.forEach(n=>{it(n)})}}class ei extends gn{static test(e){if(!e.mathmlTree||!e.childNodes.length)return!1;const n=Q(e.mathmlTree),r=e.type;return(r===l.LIMUPPER||r===l.LIMLOWER)&&(n===v.MSUBSUP||n===v.MUNDEROVER)||r===l.LIMBOTH&&(n===v.MSUB||n===v.MUNDER||n===v.MSUP||n===v.MOVER)}static walkTree_(e){e&&it(e)}constructor(e){super(e),this.mml=e.mathmlTree}getMathml(){const e=this.semantic.childNodes;return this.semantic.type!==l.LIMBOTH&&this.mml.childNodes.length>=3&&(this.mml=wr([this.mml],this.semantic)),Ot(this.mml,this.semantic),e[0].mathmlTree||(e[0].mathmlTree=this.semantic.mathmlTree),e.forEach(ei.walkTree_),this.mml}}class Sc extends gn{static test(e){return!!e.mathmlTree&&e.type===l.LINE}constructor(e){super(e),this.mml=e.mathmlTree}getMathml(){return this.semantic.contentNodes.length&&it(this.semantic.contentNodes[0]),this.semantic.childNodes.length&&it(this.semantic.childNodes[0]),Ot(this.mml,this.semantic),this.mml}}class Tc extends gn{static test(e){return!!e.mathmlTree&&(e.type===l.INFERENCE||e.type===l.PREMISES)}constructor(e){super(e),this.mml=e.mathmlTree}getMathml(){return this.semantic.childNodes.length?(this.semantic.contentNodes.forEach(function(e){it(e),Ot(e.mathmlTree,e)}),this.semantic.childNodes.forEach(function(e){it(e)}),Ot(this.mml,this.semantic),this.mml.getAttribute("data-semantic-id")===this.mml.getAttribute("data-semantic-parent")&&this.mml.removeAttribute("data-semantic-parent"),this.mml):this.mml}}class Ic extends gn{static test(e){return e.type===l.MATRIX||e.type===l.VECTOR||e.type===l.CASES}constructor(e){super(e),this.inner=[],this.mml=e.mathmlTree}getMathml(){const e=Zo(this.semantic.contentNodes[0]),n=this.semantic.contentNodes[1]?Zo(this.semantic.contentNodes[1]):null;if(this.inner=this.semantic.childNodes.map(it),this.mml)if(Q(this.mml)===v.MFENCED){const r=this.mml.childNodes;this.mml.insertBefore(e,r[0]||null),n&&this.mml.appendChild(n),this.mml=dc(this.mml)}else{const r=[e,this.mml];n&&r.push(n),this.mml=wr(r,this.semantic)}else this.mml=wr([e].concat(this.inner,[n]),this.semantic);return Ot(this.mml,this.semantic),this.mml}}class Ac extends gn{static test(e){return e.type===l.PUNCTUATED&&(e.role===d.TEXT||e.contentNodes.every(n=>n.role===d.DUMMY))}constructor(e){super(e),this.mml=e.mathmlTree}getMathml(){const e=[],n=mc(this.semantic,e);return this.mml=wr(e,this.semantic),Ot(this.mml,this.semantic),this.mml.removeAttribute(U.CONTENT),mo(this.mml,n),this.mml}}function Sd(t,e){const n=Rt(t);return(function(r,o,i){return _.getInstance().generate(()=>["Original MathML",ss(r)]),po.clear(),it(o.root),i.structure&&r.setAttribute(U.STRUCTURE,Ee.fromStructure(r,o,i).toString()),_.getInstance().generate(()=>[`Semantic Tree
44
+ `,ss(o),`Semantically enriched MathML
45
+ `,ss(r)]),r})(n,Ko(n,e),e)}ic.push({test:ei.test,constr:t=>new ei(t)},{test:ur.test,constr:t=>new ur(t)},{test:Ec.test,constr:t=>new Ec(t)},{test:as.test,constr:t=>new as(t)},{test:ls.test,constr:t=>new ls(t)},{test:cs.test,constr:t=>new cs(t)},{test:Sc.test,constr:t=>new Sc(t)},{test:gc.test,constr:t=>new gc(t)},{test:Tc.test,constr:t=>new Tc(t)},{test:Nc.test,constr:t=>new Nc(t)},{test:Ic.test,constr:t=>new Ic(t)},{test:Ac.test,constr:t=>new Ac(t)});let Td=0;class ti{constructor(){this.counter=Td++,this.ATTR="sre-highlight-"+this.counter.toString(),this.color=null,this.mactionName="",this.currentHighlights=[]}highlight(e){this.currentHighlights.push(e.map(n=>{const r=this.highlightNode(n);return this.setHighlighted(n),r}))}highlightAll(e){const n=this.getMactionNodes(e);for(let r,o=0;r=n[o];o++)this.highlight([r])}unhighlight(){const e=this.currentHighlights.pop();e&&e.forEach(n=>{this.isHighlighted(n.node)&&(this.unhighlightNode(n),this.unsetHighlighted(n.node))})}unhighlightAll(){for(;this.currentHighlights.length>0;)this.unhighlight()}setColor(e){this.color=e}colorString(){return this.color.rgba()}addEvents(e,n){const r=this.getMactionNodes(e);for(let o,i=0;o=r[i];i++)for(const[s,c]of Object.entries(n))o.addEventListener(s,c)}getMactionNodes(e){return Array.from(e.getElementsByClassName(this.mactionName))}isMactionNode(e){const n=e.className||e.getAttribute("class");return!!n&&!!n.match(new RegExp(this.mactionName))}isHighlighted(e){return e.hasAttribute(this.ATTR)}setHighlighted(e){e.setAttribute(this.ATTR,"true")}unsetHighlighted(e){e.removeAttribute(this.ATTR)}colorizeAll(e){ot(e),he(`.//*[@${U.ID}]`,e).forEach(n=>this.colorize(n))}uncolorizeAll(e){he(`.//*[@${U.ID}]`,e).forEach(n=>this.uncolorize(n))}colorize(e){const n=fo("foreground");e.hasAttribute(n)&&(e.setAttribute(n+"-old",e.style.color),e.style.color=e.getAttribute(n))}uncolorize(e){const n=fo("foreground")+"-old";e.hasAttribute(n)&&(e.style.color=e.getAttribute(n))}}class us extends ti{constructor(){super(),this.mactionName="mjx-maction"}highlightNode(e){const n={node:e,background:e.style.backgroundColor,foreground:e.style.color};if(!this.isHighlighted(e)){const r=this.colorString();e.style.backgroundColor=r.background,e.style.color=r.foreground}return n}unhighlightNode(e){e.node.style.backgroundColor=e.background,e.node.style.color=e.foreground}}const bc={red:{red:255,green:0,blue:0},green:{red:0,green:255,blue:0},blue:{red:0,green:0,blue:255},yellow:{red:255,green:255,blue:0},cyan:{red:0,green:255,blue:255},magenta:{red:255,green:0,blue:255},white:{red:255,green:255,blue:255},black:{red:0,green:0,blue:0}};function Oc(t,e){const n=t||{color:e};let r=Object.prototype.hasOwnProperty.call(n,"color")?bc[n.color]:n;return r||(r=bc[e]),r.alpha=Object.prototype.hasOwnProperty.call(n,"alpha")?n.alpha:1,(function(o){const i=s=>(s=Math.max(s,0),s=Math.min(255,s),Math.round(s));return o.red=i(o.red),o.green=i(o.green),o.blue=i(o.blue),o.alpha=Math.max(o.alpha,0),o.alpha=Math.min(1,o.alpha),o})(r)}class vn{static toHex(e){const n=e.toString(16);return n.length===1?"0"+n:n}constructor(e,n){this.foreground=Oc(n,vn.DEFAULT_FOREGROUND_),this.background=Oc(e,vn.DEFAULT_BACKGROUND_)}rgba(){const e=function(n){return"rgba("+n.red+","+n.green+","+n.blue+","+n.alpha+")"};return{background:e(this.background),foreground:e(this.foreground)}}rgb(){const e=function(n){return"rgb("+n.red+","+n.green+","+n.blue+")"};return{background:e(this.background),alphaback:this.background.alpha.toString(),foreground:e(this.foreground),alphafore:this.foreground.alpha.toString()}}hex(){const e=function(n){return"#"+vn.toHex(n.red)+vn.toHex(n.green)+vn.toHex(n.blue)};return{background:e(this.background),alphaback:this.background.alpha.toString(),foreground:e(this.foreground),alphafore:this.foreground.alpha.toString()}}}vn.DEFAULT_BACKGROUND_="blue",vn.DEFAULT_FOREGROUND_="black";class Id{constructor(){this.hue=10,this.sat=100,this.light=50,this.incr=50}generate(){return n=(function(r,o,i){o=o>1?o/100:o,i=i>1?i/100:i;const s=(1-Math.abs(2*i-1))*o,c=s*(1-Math.abs(r/60%2-1)),p=i-s/2;let E=0,T=0,C=0;return 0<=r&&r<60?[E,T,C]=[s,c,0]:60<=r&&r<120?[E,T,C]=[c,s,0]:120<=r&&r<180?[E,T,C]=[0,s,c]:180<=r&&r<240?[E,T,C]=[0,c,s]:240<=r&&r<300?[E,T,C]=[c,0,s]:300<=r&&r<360&&([E,T,C]=[s,0,c]),{red:E+p,green:T+p,blue:C+p}})(this.hue,this.sat,this.light),"rgb("+(e={red:Math.round(255*n.red),green:Math.round(255*n.green),blue:Math.round(255*n.blue)}).red+","+e.green+","+e.blue+")";var e,n}increment(){this.hue=(this.hue+this.incr)%360}}class Rc extends ti{constructor(){super(),this.mactionName="mjx-svg-maction"}highlightNode(e){let n;if(this.isHighlighted(e))return n={node:e.previousSibling||e,background:e.style.backgroundColor,foreground:e.style.color},n;if(e.tagName==="svg"){const s={node:e,background:e.style.backgroundColor,foreground:e.style.color};return e.style.backgroundColor=this.colorString().background,e.style.color=this.colorString().foreground,s}const r=Ve("http://www.w3.org/2000/svg","rect");let o;if(e.nodeName==="use"){const s=Ve("http://www.w3.org/2000/svg","g");e.parentNode.insertBefore(s,e),s.appendChild(e),o=s.getBBox(),s.parentNode.replaceChild(e,s)}else o=e.getBBox();r.setAttribute("x",(o.x-40).toString()),r.setAttribute("y",(o.y-40).toString()),r.setAttribute("width",(o.width+80).toString()),r.setAttribute("height",(o.height+80).toString());const i=e.getAttribute("transform");return i&&r.setAttribute("transform",i),r.setAttribute("fill",this.colorString().background),r.setAttribute(this.ATTR,"true"),e.parentNode.insertBefore(r,e),n={node:r,foreground:e.getAttribute("fill")},e.setAttribute("fill",this.colorString().foreground),n}setHighlighted(e){e.tagName==="svg"&&super.setHighlighted(e)}unhighlightNode(e){if("background"in e)return e.node.style.backgroundColor=e.background,void(e.node.style.color=e.foreground);e.foreground?e.node.nextSibling.setAttribute("fill",e.foreground):e.node.nextSibling.removeAttribute("fill"),e.node.parentNode.removeChild(e.node)}isMactionNode(e){let n=e.className||e.getAttribute("class");return!!n&&(n=n.baseVal!==void 0?n.baseVal:n,!!n&&!!n.match(new RegExp(this.mactionName)))}}const yc={SVG:Rc,"SVG-V3":class extends Rc{constructor(){super(),this.mactionName="maction"}highlightNode(t){let e;if(this.isHighlighted(t))return e={node:t,background:this.colorString().background,foreground:this.colorString().foreground},e;if(t.tagName==="svg"||t.tagName==="MJX-CONTAINER")return e={node:t,background:t.style.backgroundColor,foreground:t.style.color},t.style.backgroundColor=this.colorString().background,t.style.color=this.colorString().foreground,e;const n=(document??Oe).createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("sre-highlighter-added","true");const r=t.getBBox();n.setAttribute("x",(r.x-40).toString()),n.setAttribute("y",(r.y-40).toString()),n.setAttribute("width",(r.width+80).toString()),n.setAttribute("height",(r.height+80).toString());const o=t.getAttribute("transform");if(o&&n.setAttribute("transform",o),n.setAttribute("fill",this.colorString().background),t.setAttribute(this.ATTR,"true"),t.parentNode.insertBefore(n,t),e={node:t,foreground:t.getAttribute("fill")},t.nodeName==="rect"){const i=new vn({alpha:0,color:"white"});t.setAttribute("fill",i.rgba().background)}else t.setAttribute("fill",this.colorString().foreground);return e}unhighlightNode(t){const e=t.node.previousSibling;if(e&&e.hasAttribute("sre-highlighter-added"))return t.foreground?t.node.setAttribute("fill",t.foreground):t.node.removeAttribute("fill"),void t.node.parentNode.removeChild(e);t.node.style.backgroundColor=t.background,t.node.style.color=t.foreground}isMactionNode(t){return t.getAttribute("data-mml-node")===this.mactionName}getMactionNodes(t){return Array.from(he(`.//*[@data-mml-node="${this.mactionName}"]`,t))}},NativeMML:class extends ti{constructor(){super(),this.mactionName="maction"}highlightNode(t){let e=t.getAttribute("style");return e+=";background-color: "+this.colorString().background,e+=";color: "+this.colorString().foreground,t.setAttribute("style",e),{node:t}}unhighlightNode(t){let e=t.node.getAttribute("style");e=e.replace(";background-color: "+this.colorString().background,""),e=e.replace(";color: "+this.colorString().foreground,""),t.node.setAttribute("style",e)}colorString(){return this.color.rgba()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}isMactionNode(t){return t.tagName===this.mactionName}},"HTML-CSS":class extends ti{constructor(){super(),this.mactionName="maction"}highlightNode(t){const e={node:t,foreground:t.style.color,position:t.style.position},n=this.color.rgb();t.style.color=n.foreground,t.style.position="relative";const r=t.bbox;if(r&&r.w){const s=ut("span"),c=parseFloat(t.style.paddingLeft||"0");s.style.backgroundColor=n.background,s.style.opacity=n.alphaback.toString(),s.style.display="inline-block",s.style.height=r.h+r.d+2*.05+"em",s.style.verticalAlign=-r.d+"em",s.style.marginTop=s.style.marginBottom="-0.05em",s.style.width=r.w+0+"em",s.style.marginLeft=c-0+"em",s.style.marginRight=-r.w-0-c+"em",t.parentNode.insertBefore(s,t),e.box=s}return e}unhighlightNode(t){const e=t.node;e.style.color=t.foreground,e.style.position=t.position,t.box&&t.box.parentNode.removeChild(t.box)}},"MML-CSS":class extends us{constructor(){super(),this.mactionName="maction"}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}isMactionNode(t){return t.tagName===this.mactionName}},CommonHTML:us,CHTML:class extends us{constructor(){super()}isMactionNode(t){var e;return((e=t.tagName)===null||e===void 0?void 0:e.toUpperCase())===this.mactionName.toUpperCase()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}}};function go(t){return t?t.split(/,/):[]}function Et(t,e){return t.getAttribute(e)}function hs(t){if(t.hasAttribute(U.TYPE)&&!t.hasAttribute(U.PARENT))return t;const e=ht(t,U.TYPE);for(let n,r=0;n=e[r];r++)if(!n.hasAttribute(U.PARENT))return n;return t}function Hn(t,e){return t.getAttribute(U.ID)===e?t:at(t,U.ID,e)[0]}function Ad(t,e){return t.getAttribute(U.ID)===e?[t]:at(t,U.ID,e)}class Ft{static textContent(e,n,r){if(!r&&n.textContent)return void(e.textContent=n.textContent);const o=go(Et(n,U.OPERATOR));o.length>1&&(e.textContent=o[1])}static isPunctuated(e){return!Ee.simpleCollapseStructure(e)&&e[1]&&Ee.contentCollapseStructure(e[1])}constructor(e){if(this.mathml=e,this.factory=new Ci,this.nodeDict={},this.mmlRoot=hs(e),this.streeRoot=this.assembleTree(this.mmlRoot),isNaN(this.streeRoot.id))throw new ue(`Failed to rebuild semantic tree for
46
+ ${e}`);this.stree=Bn.fromNode(this.streeRoot,this.mathml),this.xml=this.stree.xml()}getTree(){return this.stree}assembleTree(e){const n=this.makeNode(e),r=go(Et(e,U.CHILDREN)),o=go(Et(e,U.CONTENT));if(o.length===0&&r.length===0)return Ft.textContent(n,e,this.isEmpty(n,e)),n;if(o.length>0){const s=Hn(this.mathml,o[0]);s&&Ft.textContent(n,s,!0)}n.contentNodes=o.map(s=>this.setParent(s,n)),n.childNodes=r.map(s=>this.setParent(s,n));const i=Et(e,U.COLLAPSED);return i?this.postProcess(n,i):n}makeNode(e){const n=Et(e,U.TYPE),r=Et(e,U.ROLE),o=Et(e,U.FONT),i=Et(e,U.ANNOTATION)||"",s=Et(e,U.ATTRIBUTES)||"",c=Et(e,U.ID),p=Et(e,U.EMBELLISHED),E=Et(e,U.FENCEPOINTER),T=this.createNode(parseInt(c,10));return T.type=n,T.role=r,T.font=o||be.UNKNOWN,T.parseAnnotation(i),T.parseAttributes(s),E&&(T.fencePointer=E),p&&(T.embellished=p),T}makePunctuation(e){const n=this.createNode(e);return n.updateContent(Rn.invisibleComma),n.role=d.DUMMY,n}makePunctuated(e,n,r){const o=this.createNode(n[0]);o.type=l.PUNCTUATED,o.embellished=e.embellished,o.fencePointer=e.fencePointer,o.role=r,o.addAnnotation("general","script"),o.contentNodes=n.splice(1,1)[0].slice(1).map(this.makePunctuation.bind(this)),this.collapsedChildren_(n)}makeEmpty(e,n,r){const o=this.createNode(n);o.type=l.EMPTY,o.embellished=e.embellished,o.fencePointer=e.fencePointer,o.role=r}makeIndex(e,n,r){if(Ft.isPunctuated(n))return this.makePunctuated(e,n,r),void(n=n[0]);Ee.simpleCollapseStructure(n)&&!this.nodeDict[n.toString()]&&this.makeEmpty(e,n,r)}postProcess(e,n){const r=Ee.fromString(n).array;if(e.type===d.SUBSUP){const o=this.createNode(r[1][0]);return o.type=l.SUBSCRIPT,o.role=d.SUBSUP,e.type=l.SUPERSCRIPT,o.embellished=e.embellished,o.fencePointer=e.fencePointer,this.makeIndex(e,r[1][2],d.RIGHTSUB),this.makeIndex(e,r[2],d.RIGHTSUPER),this.collapsedChildren_(r),e}if(e.type===l.SUBSCRIPT)return this.makeIndex(e,r[2],d.RIGHTSUB),this.collapsedChildren_(r),e;if(e.type===l.SUPERSCRIPT)return this.makeIndex(e,r[2],d.RIGHTSUPER),this.collapsedChildren_(r),e;if(e.type===l.TENSOR)return this.makeIndex(e,r[2],d.LEFTSUB),this.makeIndex(e,r[3],d.LEFTSUPER),this.makeIndex(e,r[4],d.RIGHTSUB),this.makeIndex(e,r[5],d.RIGHTSUPER),this.collapsedChildren_(r),e;if(e.type===l.PUNCTUATED)return Ft.isPunctuated(r)&&(e.contentNodes=r.splice(1,1)[0].slice(1).map(this.makePunctuation.bind(this))),e;if(e.type===d.UNDEROVER){const o=this.createNode(r[1][0]);return e.childNodes[1].role===d.OVERACCENT?(o.type=l.OVERSCORE,e.type=l.UNDERSCORE):(o.type=l.UNDERSCORE,e.type=l.OVERSCORE),o.role=d.UNDEROVER,o.embellished=e.embellished,o.fencePointer=e.fencePointer,this.collapsedChildren_(r),e}return e}createNode(e){const n=this.factory.makeNode(e);return this.nodeDict[e.toString()]=n,n}collapsedChildren_(e){const n=r=>{const o=this.nodeDict[r[0]];o.childNodes=[];for(let i=1,s=r.length;i<s;i++){const c=r[i];o.childNodes.push(Ee.simpleCollapseStructure(c)?this.nodeDict[c]:n(c))}return o};n(e)}setParent(e,n){const r=Hn(this.mathml,e);if(!r){const i=this.createNode(parseInt(e,10));return i.parent=n,i}const o=this.assembleTree(r);return o.parent=n,o}isEmpty(e,n){return e.type===l.EMPTY||(e.type===l.TEXT||e.role===d.SPACE)&&n.tagName.toUpperCase()==="MPHANTOM"}}const ds=new V({AbsoluteValue:["Auto","AbsEnd","Cardinality","Determinant"],Bar:["Auto","Conjugate"],Caps:["Auto","SayCaps"],CombinationPermutation:["Auto","ChoosePermute"],Currency:["Auto","Position","Prefix"],Ellipses:["Auto","AndSoOn"],Enclosed:["Auto","EndEnclose"],Exponent:["Auto","AfterPower","Ordinal","OrdinalPower","Exponent"],Fraction:["Auto","EndFrac","FracOver","General","GeneralEndFrac","Ordinal","Over","OverEndFrac","Per"],Functions:["Auto","None","Reciprocal"],Inference:["Auto","Long"],ImpliedTimes:["Auto","MoreImpliedTimes","None"],Log:["Auto","LnAsNaturalLog"],Matrix:["Auto","Combinatoric","EndMatrix","EndVector","SilentColNum","SpeakColNum","Vector"],MultiLineLabel:["Auto","Case","Constraint","Equation","Line","None","Row","Step"],MultiLineOverview:["Auto","None"],MultiLinePausesBetweenColumns:["Auto","Long","Short"],MultsymbolDot:["Auto","Dot"],MultsymbolX:["Auto","By","Cross"],Paren:["Auto","CoordPoint","Interval","Silent","Speak","SpeakNestingLevel"],Prime:["Auto","Angle","Length"],Roots:["Auto","PosNegSqRoot","PosNegSqRootEnd","RootEnd"],SetMemberSymbol:["Auto","Belongs","Element","Member","In"],Sets:["Auto","SilentBracket","woAll"],TriangleSymbol:["Auto","Delta"],Trig:["Auto","ArcTrig","TrigInverse","Reciprocal"],VerticalLine:["Auto","Divides","Given","SuchThat"]}),fs="Auto";function ps(t){const e=t.split(":"),n={},r=ds.getProperties(),o=Object.keys(r);for(let i,s=0;i=e[s];s++){const c=i.split("_");if(o.indexOf(c[0])===-1)continue;const p=c[1];p&&p!==fs&&r[c[0]].indexOf(p)!==-1&&(n[c[0]]=c[1])}return n}function Cc(t){const e=Object.keys(t),n=[];for(let r=0;r<e.length;r++)n.push(e[r]+"_"+t[e[r]]);return n.length?n.join(":"):D.DEFAULT_VALUE}class qt extends D{static comparator(){return new bd(L.getInstance().dynamicCstr,V.createProp([D.DEFAULT_VALUES[O.LOCALE]],[D.DEFAULT_VALUES[O.MODALITY]],[D.DEFAULT_VALUES[O.DOMAIN]],[D.DEFAULT_VALUES[O.STYLE]]))}static getLocalePreferences(e){const n=e||ks(bt.getInstance().enumerate());return qt.getLocalePreferences_(n)}static relevantPreferences(e){const n=Rd[e.type];if(!n)return"ImpliedTimes";const r=n[e.role]||n[""];return r?typeof r=="string"?r:(function(o,i){for(const[s,c]of Object.entries(o))if(yd(s,i))return c;return""})(r,e)||"ImpliedTimes":"ImpliedTimes"}static getLocalePreferences_(e){const n={};for(const r of Object.keys(e)){if(!e[r].speech||!e[r].speech.clearspeak)continue;const o=Object.keys(e[r].speech.clearspeak);if(o.length<3)continue;const i=n[r]={};for(const s in ds.getProperties()){const c=ds.getProperties()[s],p=[s+"_Auto"];if(c)for(const E of c)o.indexOf(s+"_"+E)!==-1&&p.push(s+"_"+E);i[s]=p}}return n}constructor(e,n){super(e),this.preference=n}equal(e){if(!super.equal(e))return!1;const n=Object.keys(this.preference),r=e.preference;if(n.length!==Object.keys(r).length)return!1;for(let o,i=0;o=n[i];i++)if(this.preference[o]!==r[o])return!1;return!0}}class bd extends H{constructor(e,n){super(e,n),this.preference=e instanceof qt?e.preference:{}}match(e){if(!(e instanceof qt))return super.match(e);if(e.getComponents()[O.STYLE]==="default")return!0;const n=Object.keys(e.preference);for(let r,o=0;r=n[o];o++)if(this.preference[r]!==e.preference[r])return!1;return!0}compare(e,n){const r=super.compare(e,n);if(r!==0)return r;const o=e instanceof qt,i=n instanceof qt;if(!o&&i)return 1;if(o&&!i)return-1;if(!o&&!i)return 0;const s=Object.keys(e.preference).length,c=Object.keys(n.preference).length;return s>c?-1:s<c?1:0}}const Od=[["AbsoluteValue",l.FENCED,d.NEUTRAL],["AbsoluteValue",l.FENCED,d.METRIC],["Bar",l.OVERSCORE,""],["Caps",l.IDENTIFIER,d.LATINLETTER,"category:Lu"],["CombinationPermutation",l.APPL,d.UNKNOWN],["Currency",l.IDENTIFIER,d.UNIT,"unit:currency"],["Currency",l.INFIXOP,d.UNIT,"unit:currency"],["Enclosed",l.ENCLOSE,""],["Ellipses",l.PUNCTUATION,d.ELLIPSIS],["Exponent",l.SUPERSCRIPT,""],["Fraction",l.FRACTION,""],["Functions",l.APPL,d.SIMPLEFUNC],["ImpliedTimes",l.OPERATOR,d.IMPLICIT],["Log",l.APPL,d.PREFIXFUNC,"appl:Logarithm"],["Log",l.FUNCTION,d.PREFIXFUNC,"category:Logarithm"],["Matrix",l.MATRIX,""],["Matrix",l.VECTOR,""],["MultiLineLabel",l.ROW,""],["MultiLineLabel",l.MULTILINE,d.LABEL],["MultiLinePausesBetweenColumns",l.MULTILINE,d.TABLE],["MultiLineOverview",l.MULTILINE,""],["MultiLineLabel",l.TABLE,d.LABEL],["MultiLinePausesBetweenColumns",l.TABLE,""],["MultiLineOverview",l.TABLE,""],["MultiLineLabel",l.CASES,d.LABEL],["MultiLinePausesBetweenColumns",l.CASES,""],["MultiLineOverview",l.CASES,""],["MultsymbolDot",l.OPERATOR,d.MULTIPLICATION,"content:22C5"],["MultsymbolX",l.OPERATOR,d.MULTIPLICATION,"content:00D7"],["Paren",l.FENCED,d.LEFTRIGHT],["Prime",l.PUNCTUATION,d.PRIME],["Roots",l.ROOT,""],["Roots",l.SQRT,""],["SetMemberSymbol",l.OPERATOR,d.ELEMENT],["Sets",l.FENCED,d.SETEXT],["TriangleSymbol",l.IDENTIFIER,d.GREEKLETTER,"content:0394"],["Trig",l.APPL,d.PREFIXFUNC,"appl:Trigonometric"],["Trig",l.FUNCTION,d.PREFIXFUNC,"category:Trigonometric"],["VerticalLine",l.PUNCTUATED,d.VBAR],["VerticalLine",l.PUNCTUATION,d.VBAR],["Inference",l.INFERENCE,""],["Inference",l.PREMISES,""],["Inference",l.RULELABEL,""],["Inference",l.CONCLUSION,""]],Rd=(function(){const t={};for(let e,n=0;e=Od[n];n++){const r=e[0],o=e[3];let i=t[e[1]];if(i||(i={},t[e[1]]=i),!o){i[e[2]]=r;continue}let s=i[e[2]];s||(s={},i[e[2]]=s),s[o]=r}return t})();function yd(t,e){const[n,r]=t.split(":");if(!n)return!1;const o=Cd[n];return!!o&&o(e,r)}const Cd={category:(t,e)=>Kr(t.textContent)===e,content:(t,e)=>t.textContent===String.fromCodePoint(parseInt(e,16)),appl:(t,e)=>{const n=t.childNodes[0];return!!n&&Kr(n.textContent)===e},unit:(t,e)=>Kr(t.textContent+":unit")===e};function jn(t,e=!1){return bt.getInstance().evaluateNode(t,e)}function Pr(t,e=!1){return zn(jn(t,e))}function ms(t){return zn((function(e){return jn(Bn.fromNode(e).xml())})(t))}function Ld(t,e,n){const r=at(n,"id",e.id.toString())[0],o=r?zn(jn(r)):ms(e);t.setAttribute(U.SPEECH,o)}function Lc(t,e,n){const r=ms(e);t.setAttribute(n,r)}function Md(t,e){const n=gs(e);n&&t.setAttribute(U.PREFIX,n)}function gs(t){return zn(Mc((function(e){const n=Bn.fromRoot(e),r=he('.//*[@id="'+e.id+'"]',n.xml());let o=r[0];return r.length>1&&(o=(function(i,s){const c=s[0];if(!i.parent)return c;const p=[];for(;i;)p.push(i.id),i=i.parent;const E=function(T,C){for(;C.length&&C.shift().toString()===T.getAttribute("id")&&T.parentNode&&T.parentNode.parentNode;)T=T.parentNode.parentNode;return!C.length};for(let T,C=0;T=s[C];C++)if(E(T,p.slice()))return T;return c})(e,r)||o),o})(t)))}function Mc(t){return t?bt.getInstance().runInSetting({modality:"prefix",strict:!0,speech:!0},function(){return bt.getInstance().evaluateNode(t)}):[]}function vc(t,e,n){const r=Tn(e,"maction");for(let o,i=0;o=r[i];i++){const s=at(t,"id",o.getAttribute("id"))[0];if(!s)continue;const c=o.childNodes[1],p=c.getAttribute(U.ID);let E=Hn(t,p);if(E&&E.getAttribute(U.TYPE)!=="dummy"||(E=s.childNodes[0],E.getAttribute("sre-highlighter-added")))continue;const T=c.getAttribute(U.PARENT);T&&E.setAttribute(U.PARENT,T),E.setAttribute(U.TYPE,"dummy"),E.setAttribute(U.ID,p),E.setAttribute("role","treeitem"),E.setAttribute("aria-level",c.getAttribute("aria-level")),at(n,"id",p)[0].setAttribute("alternative",p)}}var ni;function vd(t){const e={};for(const[,n]of Object.entries(ni))e[n]=t.getAttribute(n);return e}function Dc(t,e){const n=Tn(t,"maction"),r={};for(let o,i=0;o=n[i];i++){const s=parseInt(o.getAttribute("selection")),c=Array.from(o.childNodes),p=c.filter(C=>C.hasAttribute(ni.ID))[0],E=c[s-1];if(!p||p===E)continue;const T=p.getAttribute(U.ID);at(e,"id",T)[0].setAttribute("alternative",T),r[o.getAttribute("id")]=vd(p)}return r}function wc(t,e={}){const n=e.locale?{locale:e.locale}:{};return t?bt.getInstance().runInSetting(Object.assign(n,{modality:"summary",strict:!1,speech:!0}),function(){return bt.getInstance().evaluateNode(t)}):[]}function Dd(t){const e=[];return t.getAttribute("role")===d.MGLYPH&&e.push(new Ke({text:"image",personality:{}})),t.hasAttribute("href")&&e.push(new Ke({text:"link",personality:{}})),bt.getInstance().speechStructure.addNode(t,e,"postfix"),e}function Pc(t){jn(t,!0);const e=bt.getInstance().speechStructure;return(function(n){n.completeModality("speech",jn),n.completeModality("prefix",Mc),n.completeModality("postfix",Dd),n.completeModality("summary",wc)})(e),e.json(["none","ssml"])}function xc(t,e=w){var n;return t.modality!=="speech"||qt.getLocalePreferences()[t.locale]&&(t.domain=t.domain==="mathspeak"?"clearspeak":"mathspeak",t.style=(n=e[t.domain])!==null&&n!==void 0?n:t.style),t}function Fc(t,e){const{modality:n,domain:r,style:o,locale:i}=e;if(n!=="speech")return o;if(r==="mathspeak"){const s=["default","brief","sbrief"],c=s.indexOf(o);return c===-1?o:c>=s.length-1?s[0]:s[c+1]}if(r==="clearspeak"){const s=qt.getLocalePreferences()[i];if(!s)return"default";const c=qt.relevantPreferences(t),p=(function(C,pe){return C==="default"?fs:ps(C)[pe]||fs})(o,c),E=s[c].map(function(C){return C.split("_")[1]}),T=E.indexOf(p);return T===-1?o:(function(C,pe,Ne){if(C==="default")return pe+"_"+Ne;const ae=ps(C);return ae[pe]=Ne,Cc(ae)})(o,c,T>=E.length-1?E[0]:E[T+1])}return o}function Es(t){var e;const{domain:n,style:r,domain2style:o}=t,i={};if(!o)return Object.assign(i,w),i[n]=r,i;const s=o.split(",");for(const c of s){const[p,E]=c.split(/:(.*)/);i[p]=E||((e=w[p])!==null&&e!==void 0?e:"default")}return i}function Ns(t){const e=[];for(const[n,r]of Object.entries(t))e.push(`${n}:${r}`);return e.join(",")}L.getInstance().comparators.clearspeak=qt.comparator,L.getInstance().parsers.clearspeak=new class extends oe{constructor(){super([O.LOCALE,O.MODALITY,O.DOMAIN,O.STYLE])}parse(t){const e=super.parse(t);let n=e.getValue(O.STYLE);const r=e.getValue(O.LOCALE),o=e.getValue(O.MODALITY);let i={};return n!==D.DEFAULT_VALUE&&(i=this.fromPreference(n),n=this.toPreference(i)),new qt({locale:r,modality:o,domain:"clearspeak",style:n},i)}fromPreference(t){return ps(t)}toPreference(t){return Cc(t)}},(function(t){t.ID="data-semantic-id",t.PARENT="data-semantic-parent",t.LEVEL="aria-level",t.POS="aria-posinset",t.ROLE="role"})(ni||(ni={}));class xr{constructor(){this.modality=fo("speech"),this.rebuilt_=null,this.options_={}}getRebuilt(){return this.rebuilt_}setRebuilt(e){this.rebuilt_=e}computeRebuilt(e,n=!1){return this.rebuilt_&&!n||(this.rebuilt_=new Ft(e)),this.rebuilt_}setOptions(e){this.options_=e||{},this.modality=fo(this.options_.modality||"speech")}setOption(e,n){const r=this.getOptions();r[e]=n,this.setOptions(r)}getOptions(){return this.options_}generateSpeech(e,n){return this.rebuilt_||(this.rebuilt_=new Ft(n)),Cr(this.options_),Pr(this.getRebuilt().xml)}nextRules(){this.setOptions(xc(this.getOptions()))}nextStyle(e){this.setOption("style",Fc(this.getRebuilt().nodeDict[e],this.getOptions()))}getLevel(e){return I.MESSAGES.navigate.LEVEL+" "+e}getActionable(e){return e?e<0?I.MESSAGES.navigate.EXPANDABLE:I.MESSAGES.navigate.COLLAPSIBLE:""}}class wd extends xr{getSpeech(e,n){const r=this.generateSpeech(e,n);return e.setAttribute(this.modality,r),r}}class Eo extends xr{constructor(){super(...arguments),this.modality=fo("foreground"),this.contrast=new Id}static visitStree_(e,n,r){if(e.childNodes.length){if(e.contentNodes.length&&(e.type==="punctuated"&&e.contentNodes.forEach(o=>r[o.id]=!0),e.role!=="implicit"&&n.push(e.contentNodes.map(o=>o.id))),e.childNodes.length){if(e.role==="implicit"){const o=[];let i=[];for(const s of e.childNodes){const c=[];Eo.visitStree_(s,c,r),c.length<=2&&o.push(c.shift()),i=i.concat(c)}n.push(o),i.forEach(s=>n.push(s));return}e.childNodes.forEach(o=>Eo.visitStree_(o,n,r))}}else r[e.id]||n.push(e.id)}getSpeech(e,n){return Et(e,this.modality)}generateSpeech(e,n){return this.getRebuilt()||this.setRebuilt(new Ft(Ge(n))),this.colorLeaves_(e),Et(e,this.modality)}colorLeaves_(e){const n=[];Eo.visitStree_(this.getRebuilt().streeRoot,n,{});for(const r of n){const o=this.contrast.generate();let i=!1;i=Array.isArray(r)?r.map(s=>this.colorLeave_(e,s,o)).reduce((s,c)=>s||c,!1):this.colorLeave_(e,r.toString(),o),i&&this.contrast.increment()}}colorLeave_(e,n,r){const o=Hn(e,n);return!!o&&(o.setAttribute(this.modality,r),!0)}}class Pd extends xr{getSpeech(e,n){return Et(e,this.modality)}}class xd extends xr{getSpeech(e,n){return""}}class Uc extends xr{getSpeech(e,n,r=null){this.getRebuilt()&&vc(e,n,this.getRebuilt().xml);const o=this.generateSpeech(e,n),i=this.getRebuilt().nodeDict;for(const[s,c]of Object.entries(i)){const p=Hn(n,s),E=Hn(e,s)||r&&Hn(r,s);p&&E&&(this.modality&&this.modality!==U.SPEECH?Lc(E,c,this.modality):Ld(E,c,this.getRebuilt().xml),this.modality===U.SPEECH&&Md(E,c))}return o}}class Fd extends Uc{getSpeech(e,n){return super.getSpeech(e,n),Et(e,this.modality)}}class Ud extends xr{getSpeech(e,n){Cr(this.getOptions());const r=e.getAttribute(U.ID);return Lc(e,this.getRebuilt().streeRoot.querySelectorAll(o=>o.id.toString()===r)[0],this.modality),e.getAttribute(U.SUMMARY)}}function ri(t){return(_c[t]||_c.Direct)()}const _c={Adhoc:()=>new wd,Color:()=>new Eo,Direct:()=>new Pd,Dummy:()=>new xd,Node:()=>new Fd,Summary:()=>new Ud,Tree:()=>new Uc};class $n{static factory(e,n,r,o){const i=C=>Hn(o,C),s=r.nodeDict,c=i(e),p=n.map(i),E=n.map(function(C){return s[C]}),T=new $n(E,s[e]);return T.domNodes=p,T.domPrimary_=c,T.allNodes=$n.generateAllVisibleNodes_(n,p,s,o),T}static generateAllVisibleNodes_(e,n,r,o){let i=[];for(let s=0,c=e.length;s<c;s++){if(n[s]){const C=$n.getAllVisibleNodes([e[s]],o);C.length?i=i.concat(C):i.push(n[s]);continue}const p=r[e[s]];if(!p)continue;const E=p.childNodes.map(C=>C.id.toString()),T=$n.getAllVisibleNodes(E,o);i=i.concat($n.generateAllVisibleNodes_(E,T,r,o))}return i}static getAllVisibleNodes(e,n){let r=[];for(const o of e)r=r.concat(Ad(n,o));return r}constructor(e,n){this.nodes=e,this.primary=n,this.domNodes=[],this.domPrimary_=null,this.allNodes=[]}getSemanticPrimary(){return this.primary}getSemanticNodes(){return this.nodes}getNodes(){return this.allNodes}getDomNodes(){return this.domNodes}getDomPrimary(){return this.domPrimary_}toString(){return"Primary:"+this.domPrimary_+" Nodes:"+this.domNodes}clone(){const e=new $n(this.nodes,this.primary);return e.domNodes=this.domNodes,e.domPrimary_=this.domPrimary_,e.allNodes=this.allNodes,e}}var nt;(function(t){t.UP="up",t.DOWN="down",t.LEFT="left",t.RIGHT="right",t.REPEAT="repeat",t.DEPTH="depth",t.ENTER="enter",t.EXPAND="expand",t.HOME="home",t.SUMMARY="summary",t.DETAIL="detail",t.ROW="row",t.CELL="cell"})(nt||(nt={}));class hr{static resetState(e){delete hr.STATE[e]}static setState(e,n){hr.STATE[e]=n}static getState(e){return hr.STATE[e]}}hr.STATE={};class Nn{constructor(e,n,r,o){this.node=e,this.generator=n,this.highlighter=r,this.modifier=!1,this.keyMapping=new Map([[ze.UP,this.up.bind(this)],[ze.DOWN,this.down.bind(this)],[ze.RIGHT,this.right.bind(this)],[ze.LEFT,this.left.bind(this)],[ze.TAB,this.repeat.bind(this)],[ze.DASH,this.expand.bind(this)],[ze.SPACE,this.depth.bind(this)],[ze.HOME,this.home.bind(this)],[ze.X,this.summary.bind(this)],[ze.Z,this.detail.bind(this)],[ze.V,this.virtualize.bind(this)],[ze.P,this.previous.bind(this)],[ze.U,this.undo.bind(this)],[ze.LESS,this.previousRules.bind(this)],[ze.GREATER,this.nextRules.bind(this)]]),this.cursors=[],this.xml_=null,this.rebuilt_=null,this.focus_=null,this.active_=!1,this.node.id?this.id=this.node.id:this.node.hasAttribute(Nn.SRE_ID_ATTR)?this.id=this.node.getAttribute(Nn.SRE_ID_ATTR):(this.node.setAttribute(Nn.SRE_ID_ATTR,Nn.ID_COUNTER.toString()),this.id=Nn.ID_COUNTER++),this.rootNode=hs(e),this.rootId=this.rootNode.getAttribute(U.ID),this.xmlString_=o,this.moved=nt.ENTER}getXml(){return this.xml_||(this.xml_=Ge(this.xmlString_)),this.xml_}getRebuilt(){return this.rebuilt_||this.rebuildStree(),this.rebuilt_}isActive(){return this.active_}activate(){this.isActive()||this.toggleActive_()}deactivate(){this.isActive()&&(hr.setState(this.id,this.primaryId()),this.toggleActive_())}getFocus(e=!1){return this.rootId===null&&this.getRebuilt(),this.focus_||(this.focus_=this.singletonFocus(this.rootId)),e&&this.updateFocus(),this.focus_}setFocus(e){this.focus_=e}getDepth(){return this.levels.depth()-1}isSpeech(){return this.generator.modality===U.SPEECH}focusDomNodes(){return this.getFocus().getDomNodes()}focusSemanticNodes(){return this.getFocus().getSemanticNodes()}speech(){const e=this.focusDomNodes();if(!e.length)return"";const n=this.specialMove();if(n!==null)return n;switch(this.moved){case nt.DEPTH:return this.depth_();case nt.SUMMARY:return this.summary_();case nt.DETAIL:return this.detail_();default:{const r=[],o=this.focusSemanticNodes();for(let i=0,s=e.length;i<s;i++){const c=e[i],p=o[i];r.push(c?this.generator.getSpeech(c,this.getXml(),this.node):ms(p))}return this.mergePrefix_(r)}}}move(e){const n=this.keyMapping.get(e);if(!n)return null;const r=n();return!(!r||r===this.getFocus())&&(this.setFocus(r),this.moved===nt.HOME&&(this.levels=this.initLevels()),!0)}up(){return this.moved=nt.UP,this.getFocus()}down(){return this.moved=nt.DOWN,this.getFocus()}left(){return this.moved=nt.LEFT,this.getFocus()}right(){return this.moved=nt.RIGHT,this.getFocus()}repeat(){return this.moved=nt.REPEAT,this.getFocus().clone()}depth(){return this.moved=this.isSpeech()?nt.DEPTH:nt.REPEAT,this.getFocus().clone()}home(){return this.moved=nt.HOME,this.singletonFocus(this.rootId)}getBySemanticId(e){return Hn(this.node,e)}primaryId(){return this.getFocus().getSemanticPrimary().id.toString()}expand(){const e=this.getFocus().getDomPrimary(),n=this.actionable_(e);return n?(this.moved=nt.EXPAND,n.dispatchEvent(new Event("click")),this.getFocus().clone()):this.getFocus()}expandable(e){return!!this.actionable_(e)&&e.childNodes.length===0}collapsible(e){return!!this.actionable_(e)&&e.childNodes.length>0}restoreState(){if(!this.highlighter)return;const e=hr.getState(this.id);if(!e)return;let n=this.getRebuilt().nodeDict[e];const r=[];for(;n;)r.push(n.id),n=n.parent;for(r.pop();r.length>0;){this.down();const o=r.pop(),i=this.findFocusOnLevel(o);if(!i)break;this.setFocus(i)}this.moved=nt.ENTER}updateFocus(){this.setFocus($n.factory(this.getFocus().getSemanticPrimary().id.toString(),this.getFocus().getSemanticNodes().map(e=>e.id.toString()),this.getRebuilt(),this.node))}rebuildStree(){this.rebuilt_=new Ft(this.getXml()),this.rootId=this.rebuilt_.stree.root.id.toString(),this.generator.setRebuilt(this.rebuilt_),this.skeleton=Ee.fromTree(this.rebuilt_.stree),this.skeleton.populate(),this.focus_=this.singletonFocus(this.rootId),this.levels=this.initLevels(),vc(this.node,this.getXml(),this.rebuilt_.xml)}previousLevel(){const e=this.getFocus().getDomPrimary();return e?Et(e,U.PARENT):this.getFocus().getSemanticPrimary().parent.id.toString()}nextLevel(){const e=this.getFocus().getDomPrimary();let n,r;if(e){n=go(Et(e,U.CHILDREN)),r=go(Et(e,U.CONTENT));const s=Et(e,U.TYPE),c=Et(e,U.ROLE);return this.combineContentChildren(s,c,r,n)}const o=s=>s.id.toString(),i=this.getRebuilt().nodeDict[this.primaryId()];return n=i.childNodes.map(o),r=i.contentNodes.map(o),n.length===0?[]:this.combineContentChildren(i.type,i.role,r,n)}singletonFocus(e){this.getRebuilt();const n=this.retrieveVisuals(e);return this.focusFromId(e,n)}retrieveVisuals(e){if(!this.skeleton)return[e];const n=parseInt(e,10),r=this.skeleton.subtreeNodes(n);if(!r.length)return[e];r.unshift(n);const o={},i=[];ot(this.getXml());for(const s of r)o[s]||(i.push(s.toString()),o[s]=!0,this.subtreeIds(s,o));return i}subtreeIds(e,n){he("*//@data-semantic-id",he(`//*[@data-semantic-id="${e}"]`,this.getXml())[0]).forEach(r=>n[parseInt(r.textContent,10)]=!0)}focusFromId(e,n){return $n.factory(e,n,this.getRebuilt(),this.node)}summary(){return this.moved=this.isSpeech()?nt.SUMMARY:nt.REPEAT,this.getFocus().clone()}detail(){return this.moved=this.isSpeech()?nt.DETAIL:nt.REPEAT,this.getFocus().clone()}specialMove(){return null}virtualize(e){return this.cursors.push({focus:this.getFocus(),levels:this.levels,undo:e||!this.cursors.length}),this.levels=this.levels.clone(),this.getFocus().clone()}previous(){const e=this.cursors.pop();return e?(this.levels=e.levels,e.focus):this.getFocus()}undo(){let e;do e=this.cursors.pop();while(e&&!e.undo);return e?(this.levels=e.levels,e.focus):this.getFocus()}update(e){Cr(e).then(()=>ri("Tree").getSpeech(this.node,this.getXml()))}nextRules(){this.generator.nextRules();const e=this.generator.getOptions();return e.modality!=="speech"?this.getFocus():(this.update(e),this.moved=nt.REPEAT,this.getFocus().clone())}previousRules(){var e;this.generator.nextStyle((e=this.getFocus().getSemanticPrimary())===null||e===void 0?void 0:e.id.toString());const n=this.generator.getOptions();return n.modality!=="speech"?this.getFocus():(this.update(n),this.moved=nt.REPEAT,this.getFocus().clone())}refocus(){let e,n=this.getFocus();for(;!n.getNodes().length;){e=this.levels.peek();const r=this.up();if(!r)break;this.setFocus(r),n=this.getFocus(!0)}this.levels.push(e),this.setFocus(n)}toggleActive_(){this.active_=!this.active_}mergePrefix_(e,n=[]){const r=this.isSpeech()?this.prefix_():"";r&&e.unshift(r);const o=this.isSpeech()?this.postfix_():"";return o&&e.push(o),cr((function(i){const s=i.map(p=>typeof p=="string"?W.stringEmpty(p):p),c=lo.get(L.getInstance().options.markup);return c?c.merge(s):i.join()})(n.concat(e)))}prefix_(){const e=this.getFocus().getDomNodes(),n=this.getFocus().getSemanticNodes();return e[0]?Et(e[0],U.PREFIX):gs(n[0])}postfix_(){const e=this.getFocus().getDomNodes();return e[0]?Et(e[0],U.POSTFIX):""}depth_(){const e=P.getInstance().getParameter("depth");P.getInstance().setParameter("depth",!0);const n=this.getFocus().getDomPrimary(),r=this.expandable(n)?I.MESSAGES.navigate.EXPANDABLE:this.collapsible(n)?I.MESSAGES.navigate.COLLAPSIBLE:"",o=I.MESSAGES.navigate.LEVEL+" "+this.getDepth(),i=gs(this.getFocus().getSemanticNodes()[0]),s=[new Ke({text:o,personality:{}}),new Ke({text:i,personality:{}}),new Ke({text:r,personality:{}})];return P.getInstance().setParameter("depth",e),cr(zn(s))}actionable_(e){const n=e?.parentNode;return n&&this.highlighter.isMactionNode(n)?n:null}summary_(){const e=this.getFocus().getSemanticPrimary().id.toString(),n=(function(r,o={}){return zn(wc(r,o))})(this.getRebuilt().xml.getAttribute("id")===e?this.getRebuilt().xml:at(this.getRebuilt().xml,"id",e)[0]);return this.mergePrefix_([n])}detail_(){const e=this.getFocus().getSemanticPrimary().id.toString(),n=this.getRebuilt().xml.getAttribute("id")===e?this.getRebuilt().xml:at(this.getRebuilt().xml,"id",e)[0],r=n.getAttribute("alternative");n.removeAttribute("alternative");const o=Pr(n),i=this.mergePrefix_([o]);return n.setAttribute("alternative",r),i}}Nn.ID_COUNTER=0,Nn.SRE_ID_ATTR="sre-explorer-id";class _d extends Nn{up(){return null}down(){return null}left(){return null}right(){return null}repeat(){return null}depth(){return null}home(){return null}getDepth(){return 0}initLevels(){return null}combineContentChildren(e,n,r,o){return[]}findFocusOnLevel(e){return null}}class oi{constructor(){this.level_=[]}push(e){this.level_.push(e)}pop(){return this.level_.pop()}peek(){return this.level_[this.level_.length-1]||null}indexOf(e){const n=this.peek();return n?n.indexOf(e):null}find(e){const n=this.peek();if(!n)return null;for(let r=0,o=n.length;r<o;r++)if(e(n[r]))return n[r];return null}get(e){const n=this.peek();return!n||e<0||e>=n.length?null:n[e]}depth(){return this.level_.length}clone(){const e=new oi;return e.level_=this.level_.slice(0),e}toString(){let e="";for(let n,r=0;n=this.level_[r];r++)e+=`
47
+ `+n.map(function(o){return o.toString()});return e}}class kd extends Nn{constructor(e,n,r,o){super(e,n,r,o),this.node=e,this.generator=n,this.highlighter=r,this.levels=null,this.restoreState()}initLevels(){const e=new oi;return e.push([this.getFocus()]),e}up(){super.up();const e=this.previousLevel();return e?(this.levels.pop(),this.levels.find(function(n){return n.getSemanticNodes().some(function(r){return r.id.toString()===e})})):null}down(){super.down();const e=this.nextLevel();return e.length===0?null:(this.levels.push(e),e[0])}combineContentChildren(e,n,r,o){switch(e){case l.RELSEQ:case l.INFIXOP:case l.MULTIREL:return this.makePairList(o,r);case l.PREFIXOP:return[this.focusFromId(o[0],r.concat(o))];case l.POSTFIXOP:return[this.focusFromId(o[0],o.concat(r))];case l.MATRIX:case l.VECTOR:case l.FENCED:return[this.focusFromId(o[0],[r[0],o[0],r[1]])];case l.CASES:return[this.focusFromId(o[0],[r[0],o[0]])];case l.PUNCTUATED:return n===d.TEXT?o.map(this.singletonFocus.bind(this)):o.length===r.length?r.map(this.singletonFocus.bind(this)):this.combinePunctuations(o,r,[],[]);case l.APPL:return[this.focusFromId(o[0],[o[0],r[0]]),this.singletonFocus(o[1])];case l.ROOT:return[this.singletonFocus(o[0]),this.singletonFocus(o[1])];default:return o.map(this.singletonFocus.bind(this))}}combinePunctuations(e,n,r,o){if(e.length===0)return o;const i=e.shift(),s=n.shift();return i===s?(r.push(s),this.combinePunctuations(e,n,r,o)):(n.unshift(s),r.push(i),e.length===n.length?(o.push(this.focusFromId(i,r.concat(n))),o):(o.push(this.focusFromId(i,r)),this.combinePunctuations(e,n,[],o)))}makePairList(e,n){if(e.length===0)return[];if(e.length===1)return[this.singletonFocus(e[0])];const r=[this.singletonFocus(e.shift())];for(let o=0,i=e.length;o<i;o++)r.push(this.focusFromId(e[o],[n[o],e[o]]));return r}left(){super.left();const e=this.levels.indexOf(this.getFocus());return e===null?null:this.levels.get(e-1)||null}right(){super.right();const e=this.levels.indexOf(this.getFocus());return e===null?null:this.levels.get(e+1)||null}findFocusOnLevel(e){return this.levels.find(n=>n.getSemanticPrimary().id===e)}}class kc extends Nn{constructor(e,n,r,o){super(e,n,r,o),this.node=e,this.generator=n,this.highlighter=r,this.levels=null,this.restoreState()}initLevels(){const e=new oi;return e.push([this.primaryId()]),e}up(){super.up();const e=this.previousLevel();return e?(this.levels.pop(),this.singletonFocus(e)):null}down(){super.down();const e=this.nextLevel();if(e.length===0)return null;const n=this.singletonFocus(e[0]);return n&&this.levels.push(e),n}combineContentChildren(e,n,r,o){switch(e){case l.RELSEQ:case l.INFIXOP:case l.MULTIREL:return Oo(o,r);case l.PREFIXOP:return r.concat(o);case l.POSTFIXOP:return o.concat(r);case l.MATRIX:case l.VECTOR:case l.FENCED:return o.unshift(r[0]),o.push(r[1]),o;case l.CASES:return o.unshift(r[0]),o;case l.PUNCTUATED:return n===d.TEXT?Oo(o,r):o;case l.APPL:return[o[0],r[0],o[1]];case l.ROOT:return[o[0],o[1]];default:return o}}left(){super.left();const e=this.levels.indexOf(this.primaryId());if(e===null)return null;const n=this.levels.get(e-1);return n?this.singletonFocus(n):null}right(){super.right();const e=this.levels.indexOf(this.primaryId());if(e===null)return null;const n=this.levels.get(e+1);return n?this.singletonFocus(n):null}findFocusOnLevel(e){return this.singletonFocus(e.toString())}focusDomNodes(){return[this.getFocus().getDomPrimary()]}focusSemanticNodes(){return[this.getFocus().getSemanticPrimary()]}}class Fr extends kc{constructor(e,n,r,o){super(e,n,r,o),this.node=e,this.generator=n,this.highlighter=r,this.firstJump=null,this.key_=null,this.row_=0,this.currentTable_=null,this.keyMapping.set(ze.ZERO,this.jumpCell.bind(this)),this.keyMapping.set(ze.ONE,this.jumpCell.bind(this)),this.keyMapping.set(ze.TWO,this.jumpCell.bind(this)),this.keyMapping.set(ze.THREE,this.jumpCell.bind(this)),this.keyMapping.set(ze.FOUR,this.jumpCell.bind(this)),this.keyMapping.set(ze.FIVE,this.jumpCell.bind(this)),this.keyMapping.set(ze.SIX,this.jumpCell.bind(this)),this.keyMapping.set(ze.SEVEN,this.jumpCell.bind(this)),this.keyMapping.set(ze.EIGHT,this.jumpCell.bind(this)),this.keyMapping.set(ze.NINE,this.jumpCell.bind(this))}move(e){this.key_=e;const n=super.move(e);return this.modifier=!1,n}up(){return this.moved=nt.UP,this.eligibleCell_()?this.verticalMove_(!1):super.up()}down(){return this.moved=nt.DOWN,this.eligibleCell_()?this.verticalMove_(!0):super.down()}jumpCell(){if(!this.isInTable_()||this.key_===null)return this.getFocus();if(this.moved===nt.ROW){this.moved=nt.CELL;const n=this.key_-ze.ZERO;return this.isLegalJump_(this.row_,n)?this.jumpCell_(this.row_,n):this.getFocus()}const e=this.key_-ze.ZERO;return e>this.currentTable_.childNodes.length?this.getFocus():(this.row_=e,this.moved=nt.ROW,this.getFocus().clone())}undo(){const e=super.undo();return e===this.firstJump&&(this.firstJump=null),e}eligibleCell_(){const e=this.getFocus().getSemanticPrimary();return this.modifier&&e.type===l.CELL&&Fr.ELIGIBLE_CELL_ROLES.indexOf(e.role)!==-1}verticalMove_(e){const n=this.previousLevel();if(!n)return null;const r=this.getFocus(),o=this.levels.indexOf(this.primaryId()),i=this.levels.pop(),s=this.levels.indexOf(n),c=this.levels.get(e?s+1:s-1);if(!c)return this.levels.push(i),null;this.setFocus(this.singletonFocus(c));const p=this.nextLevel();return p[o]?(this.levels.push(p),this.singletonFocus(p[o])):(this.setFocus(r),this.levels.push(i),null)}jumpCell_(e,n){this.firstJump?this.virtualize(!1):(this.firstJump=this.getFocus(),this.virtualize(!0));const r=this.currentTable_.id.toString();let o;do o=this.levels.pop();while(o.indexOf(r)===-1);this.levels.push(o),this.setFocus(this.singletonFocus(r)),this.levels.push(this.nextLevel());const i=this.currentTable_.childNodes[e-1];return this.setFocus(this.singletonFocus(i.id.toString())),this.levels.push(this.nextLevel()),this.singletonFocus(i.childNodes[n-1].id.toString())}isLegalJump_(e,n){const r=at(this.getRebuilt().xml,"id",this.currentTable_.id.toString())[0];if(!r||r.hasAttribute("alternative"))return!1;const o=this.currentTable_.childNodes[e-1];if(!o)return!1;const i=at(r,"id",o.id.toString())[0];return!(!i||i.hasAttribute("alternative"))&&!(!o||!o.childNodes[n-1])}isInTable_(){let e=this.getFocus().getSemanticPrimary();for(;e;){if(Fr.ELIGIBLE_TABLE_TYPES.indexOf(e.type)!==-1)return this.currentTable_=e,!0;e=e.parent}return!1}}Fr.ELIGIBLE_CELL_ROLES=[d.DETERMINANT,d.ROWVECTOR,d.BINOMIAL,d.SQUAREMATRIX,d.MULTILINE,d.MATRIX,d.VECTOR,d.CASES,d.TABLE],Fr.ELIGIBLE_TABLE_TYPES=[l.MULTILINE,l.MATRIX,l.VECTOR,l.CASES,l.TABLE];const Bc={dummy:(t,e,n,r)=>new _d(t,e,n,r),semantic:(t,e,n,r)=>new kd(t,e,n,r),syntax:(t,e,n,r)=>new kc(t,e,n,r),table:(t,e,n,r)=>new Fr(t,e,n,r)};class Ze{static stringify_(e){return e&&e.toString()}constructor(e,n){this.name=e,this.process=n.processor,this.postprocess=n.postprocessor||((r,o)=>r),this.processor=this.postprocess?function(r){return this.postprocess(this.process(r),r)}:this.process,this.print=n.print||Ze.stringify_,this.pprint=n.pprint||this.print}}Ze.LocalState={walker:null,speechGenerator:null,highlighter:null};class ii extends Ze{static getKey_(e){return typeof e=="string"?ze[e.toUpperCase()]:e}constructor(e,n){super(e,n),this.key=n.key||ii.getKey_}}const Gc=new Map;function Ut(t){Gc.set(t.name,t)}function si(t){const e=Gc.get(t);if(!e)throw new ue("Unknown processor "+t);return e}function ai(t,e){const n=si(t);try{return n.processor(e)}catch(r){throw r instanceof ue?r:new ue(`Processing error for expression
48
+ ${e}`)}}function ci(t,e){const n=si(t);try{const r=n.processor(e);return L.getInstance().options.pprint?n.pprint(r):n.print(r)}catch(r){throw r instanceof ue?r:new ue(`Processing error for expression
49
+ ${e}`)}}function Sn(t,e){return ai(t,e)}function Vc(t){return t.children&&(t.children&&t.children.forEach(e=>e.child=!0),t.content&&t.content.forEach(e=>e.cont=!0),t.children=Ee.combineContentChildren(t.type,t.role,t.content||[],t.children||[]),t.children.forEach(e=>Vc(e))),t}function Hc(t,e,n,r={}){var o;if(t.options=r,t.mactions=Dc(e,n),r.enableSpeech===!1)return;t.speech=Pc(n);const i=(o=n.childNodes[0])===null||o===void 0?void 0:o.getAttribute("id"),s=ht(n,"href").length;if(s){const c=`${s} ${s===1?"link":"links"}`;t.speech[i]["postfix-none"]=t.speech[i]["postfix-none"]?t.speech[i]["postfix-none"]+`, ${c}`:c,t.speech[i]["postfix-ssml"]=t.speech[i]["postfix-ssml"]?t.speech[i]["postfix-ssml"]+` <break time="250ms"/> ${c}`:c}t.label=t.speech[i]["speech-none"]+(t.speech[i]["postfix-none"]?`, ${t.speech[i]["postfix-none"]}`:""),t.ssml=t.speech[i]["speech-ssml"]+(t.speech[i]["postfix-ssml"]?` <prosody pitch="+30%" rate="+20%"> ${t.speech[i]["postfix-ssml"]} </prosody>`:""),t.translations=Object.assign({},I.MESSAGES.navigate)}function jc(t){return Sn("speech",t)}function $c(t){return Sn("semantic",t)}function Xc(t){return Sn("json",t)}function Yc(t){return Sn("vis",t)}function Wc(t){return Sn("description",t)}function Kc(t){return Sn("enriched",t)}function zc(t){return Sn("speechStructure",t)}function Qc(t){return Sn("number",t)}function Jc(t){return Sn("ordinal",t)}function qc(t){return Sn("numericOrdinal",t)}function Zc(t){return Sn("vulgar",t)}function el(t){return ci("walker",t)}function tl(t){return(function(e,n){const r=si(e),o=r instanceof ii?r.key(n):n,i=r.processor(o);return L.getInstance().options.pprint?r.pprint(i):r.print(i)})("move",t)}Ut(new Ze("semantic",{processor:function(t){return Dr(Ge(t),L.getInstance().options)},postprocessor:function(t,e){const n=L.getInstance().options.speech;if(n===G.NONE)return t;const r=Rt(t);let o=Pr(r,!0);if(n===G.SHALLOW)return t.setAttribute("speech",cr(o)),t;const i=he(".//*[@id]",t),s=he(".//*[@id]",r);for(let c,p,E=0;c=i[E],p=s[E];E++)o=Pr(p),c.setAttribute("speech",cr(o));return t},pprint:function(t){return ye(t.toString())}})),Ut(new Ze("speech",{processor:function(t){return cr(zn(jn(Dr(Ge(t),L.getInstance().options),!0)))},pprint:function(t){const e=t.toString();return lo.get(L.getInstance().options.markup)instanceof _o?ye(e):e}})),Ut(new Ze("json",{processor:function(t){return Ko(Ge(t),L.getInstance().options).toJson()},postprocessor:function(t,e){const n=L.getInstance().options.speech;if(n===G.NONE)return t;const r=Dr(Ge(e),L.getInstance().options),o=Pr(r);if(n===G.SHALLOW)return t.stree.speech=cr(o),t;const i=s=>{s.speech=cr(Pr(he(`.//*[@id=${s.id}]`,r)[0])),s.children&&s.children.forEach(i)};return i(t.stree),t},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),Ut(new Ze("vis",{processor:function(t){const e=Ko(Ge(t),L.getInstance().options).toJson();return e.stree=Vc(e.stree),e},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),Ut(new Ze("description",{processor:function(t){return jn(Dr(Ge(t),L.getInstance().options),!0)},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),Ut(new Ze("enriched",{processor:function(t){return(function(e,n){const r=Ge(e);try{return Sd(r,n)}catch(o){return console.error(o),r}})(t,L.getInstance().options)},postprocessor:function(t,e){const n=hs(t);let r;switch(L.getInstance().options.speech){case G.NONE:break;case G.SHALLOW:r=ri("Adhoc"),r.getSpeech(n,t);break;case G.DEEP:r=ri("Tree"),r.getSpeech(t,t)}return t},pprint:function(t){return ye(t.toString())}})),Ut(new Ze("rebuild",{processor:function(t){return new Ft(Ge(t)).stree.xml()},pprint:function(t){return ye(t.toString())}})),Ut(new Ze("walker",{processor:function(t){const e=ri("Node");Ze.LocalState.speechGenerator=e,e.setOptions({modality:L.getInstance().options.modality,locale:L.getInstance().options.locale,domain:L.getInstance().options.domain,style:L.getInstance().options.style}),Ze.LocalState.highlighter=(function(o,i,s){const c=new vn(o,i),p=s.renderer==="NativeMML"&&s.browser==="Safari"?"MML-CSS":s.renderer==="SVG"&&s.browser==="v3"?"SVG-V3":s.renderer,E=new(yc[p]||yc.NativeMML);return E.setColor(c),E})({color:"black"},{color:"white"},{renderer:"NativeMML"});const n=ai("enriched",t),r=(function(o,i){const s=si(o);return L.getInstance().options.pprint?s.pprint(i):s.print(i)})("enriched",n);return Ze.LocalState.walker=(function(o,i,s,c,p){return(Bc[o.toLowerCase()]||Bc.dummy)(i,s,c,p)})(L.getInstance().options.walker,n,e,Ze.LocalState.highlighter,r),Ze.LocalState.walker},print:function(t){return Ze.LocalState.walker.speech()}})),Ut(new ii("move",{processor:function(t){return Ze.LocalState.walker?Ze.LocalState.walker.move(t)===!1?(function(e){const n=lo.get(L.getInstance().options.markup);return n?n.error(e):""})(t):Ze.LocalState.walker.speech():null}})),Ut(new Ze("number",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":I.NUMBERS.numberToWords(e)}})),Ut(new Ze("ordinal",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":I.NUMBERS.wordOrdinal(e)}})),Ut(new Ze("numericOrdinal",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":I.NUMBERS.numericOrdinal(e)}})),Ut(new Ze("vulgar",{processor:function(t){const[e,n]=t.split("/").map(r=>parseInt(r,10));return isNaN(e)||isNaN(n)?"":ai("speech",`<mfrac><mn>${e}</mn><mn>${n}</mn></mfrac>`)}})),Ut(new Ze("latex",{processor:function(t){return L.getInstance().options.modality==="braille"&&L.getInstance().options.locale==="euro"||console.info("LaTeX input currently only works for Euro Braille output. Please use the latex-to-speech package from npm for general LaTeX input to SRE."),ai("speech",`<math data-latex="${t}"></math>`)}})),Ut(new Ze("rebuildStree",{processor:function(t){return new Ft(Ge(t))}})),Ut(new Ze("speechStructure",{processor:function(t){const e=Ge(t);let n;try{n=new Ft(e).stree.xml()}catch{n=Dr(e,L.getInstance().options)}return Dc(e,n),Pc(n)},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),Ut(new Ze("workerSpeechStructure",{processor:function(t){const e=Ge(t);let n;try{n=new Ft(e).stree.xml()}catch{n=Dr(e,L.getInstance().options)}L.getInstance().options.automark=!0;const r={};return Hc(r,e,n),r},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}}));var Ur=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(E){try{p(r.next(E))}catch(T){i(T)}}function c(E){try{p(r.throw(E))}catch(T){i(T)}}function p(E){var T;E.done?o(E.value):(T=E.value,T instanceof n?T:new n(function(C){C(T)})).then(s,c)}p((r=r.apply(t,e||[])).next())})};function Bd(t,e){return Ur(this,void 0,void 0,function*(){const n=Ge(t),r=new Ft(n);return e.domain2style=Ns(Es(e)),Ss(n,r.stree.xml(),e)})}function Gd(t,e){return Ur(this,void 0,void 0,function*(){const n=Ge(t),r=new Ft(n),o=Es(e);return(e=xc(e,o)).domain2style=Ns(o),Ss(n,r.stree.xml(),e)})}function Vd(t,e,n){return Ur(this,void 0,void 0,function*(){const r=Ge(t),o=new Ft(r),i=Es(e);return e.style=Fc(o.nodeDict[n],e),i[e.domain]=e.style,e.domain2style=Ns(i),Ss(r,o.stree.xml(),e)})}function Hd(t){return Ur(this,void 0,void 0,function*(){return qt.getLocalePreferences()[t.locale]})}function jd(t,e){return Ur(this,void 0,void 0,function*(){var n;const r=Ge(t),o=new Ft(r),i=(n=o.stree.root.querySelectorAll(s=>s.id.toString()===e)[0])!==null&&n!==void 0?n:o.stree.root;return qt.relevantPreferences(i)})}function Ss(t,e,n){return Ur(this,void 0,void 0,function*(){var r;yield Cr(n),L.getInstance().options.automark=!0;const o={};if(Hc(o,t,e,n),n.enableBraille===!1)return o;yield Cr({modality:"braille",locale:n.braille,domain:"default",style:"default"});const i=(r=e.childNodes[0])===null||r===void 0?void 0:r.getAttribute("id");return o.braille=(function(s){jn(s,!0);const c=bt.getInstance().speechStructure;return c.completeModality("braille",jn),c.json(["none"])})(e),o.braillelabel=o.braille[i]["braille-none"],o})}var $d=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(E){try{p(r.next(E))}catch(T){i(T)}}function c(E){try{p(r.throw(E))}catch(T){i(T)}}function p(E){var T;E.done?o(E.value):(T=E.value,T instanceof n?T:new n(function(C){C(T)})).then(s,c)}p((r=r.apply(t,e||[])).next())})};function Xd(t,e){return dr("speech",t,e)}function Yd(t,e){return dr("semantic",t,e)}function Wd(t,e){return dr("json",t,e)}function Kd(t,e){return dr("description",t,e)}function zd(t,e){return dr("enriched",t,e)}function dr(t,e,n){switch(L.getInstance().mode){case Pe.ASYNC:return(function(r,o,i){return $d(this,void 0,void 0,function*(){const s=ci(r,yield Re.fs.promises.readFile(o,{encoding:"utf8"}));if(i)try{Re.fs.promises.writeFile(i,s)}catch{throw new ue("Can not write to file: "+i)}return s})})(t,e,n);case Pe.SYNC:return(function(r,o,i){const s=ci(r,(function(c){let p;try{p=Re.fs.readFileSync(c,{encoding:"utf8"})}catch{throw new ue("Can not open file: "+c)}return p})(o));if(i)try{Re.fs.writeFileSync(i,s)}catch{throw new ue("Can not write to file: "+i)}return s})(t,e,n);default:throw new ue(`Cannot process files in ${L.getInstance().mode} mode`)}}const Qd=re,Ts=x.VERSION;Re.documentSupported||Re.webworker?Ln({mode:Pe.HTTP}).then(()=>Ln({})):Ln({mode:Pe.SYNC}).then(()=>Ln({mode:Pe.ASYNC}));var Is=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(E){try{p(r.next(E))}catch(T){i(T)}}function c(E){try{p(r.throw(E))}catch(T){i(T)}}function p(E){var T;E.done?o(E.value):(T=E.value,T instanceof n?T:new n(function(C){C(T)})).then(s,c)}p((r=r.apply(t,e||[])).next())})};class Zt{constructor(){this.setup={mode:Pe.SYNC},this.processors=[],this.output=Zt.process.stdout,this.dp=new Re.xmldom.DOMParser({onError:(e,n)=>{throw new ue("XML DOM error!")}})}set(e,n,r){this.setup[e]=n===void 0||n}processor(e){this.processors.push(e)}loadLocales(){return Is(this,void 0,void 0,function*(){for(const e of x.LOCALES.keys())yield Ln({locale:e})})}enumerate(){return Is(this,arguments,void 0,function*(e=!1){const n=Ln(this.setup),r=D.DEFAULT_ORDER.slice(0,-1);return(e?this.loadLocales():n).then(()=>ce.getall().then(()=>{const o=r.map(ae=>ae.length),i=(ae,rt)=>{o[rt]=Math.max.apply(null,Object.keys(ae).map(Nt=>Nt.length).concat(o[rt]))},s=(ae,rt)=>ae+new Array(rt-ae.length+1).join(" ");let c=bt.getInstance().enumerate();c=ks(c);const p=[];i(c,0);for(const[ae,rt]of Object.entries(c)){let Nt=!0;i(rt,1);for(const[li,nl]of Object.entries(rt)){let ui=!0;i(nl,2);for(const[As,Zd]of Object.entries(nl)){const ef=Object.keys(Zd).sort();if(As==="clearspeak"){let rl=!0;const ol=qt.getLocalePreferences(c)[ae];if(!ol)continue;for(const tf of Object.values(ol))p.push([s(Nt?ae:"",o[0]),s(ui?li:"",o[1]),s(rl?As:"",o[2]),tf.join(", ")]),Nt=!1,ui=!1,rl=!1}else p.push([s(Nt?ae:"",o[0]),s(ui?li:"",o[1]),s(As,o[2]),ef.join(", ")]);Nt=!1,ui=!1}}}let E=0;const T=r.map(ae=>s(ae,o[E++])),C=Zt.commander.opts().pprint,pe=o.map(ae=>new Array(ae+1).join(C?"-":"="));C||(pe[E-1]=pe[E-1]+"========================"),p.unshift(pe),p.unshift(T);let Ne=p.map(ae=>ae.join(" | "));C&&(Ne=Ne.map(ae=>`| ${ae} |`),Ne.unshift(`# Options SRE v${Ts}
50
+ `)),console.info(Ne.join(`
51
+ `))}))})}execute(e){ce.getall().then(()=>{this.runProcessors_((n,r)=>this.output.write(dr(n,r)+`
52
+ `),e)})}readline(){Zt.process.stdin.setEncoding("utf8");const e=Re.extRequire("readline").createInterface({input:Zt.process.stdin,output:this.output});let n="";e.on("line",(r=>{n+=r,this.readExpression_(n)&&e.close()}).bind(this)),e.on("close",(()=>{this.runProcessors_((r,o)=>{e.output.write(ci(r,o)+`
53
+ `)},n),uo().then(()=>_.getInstance().exit(()=>Lr(0)))}).bind(this))}commandLine(){return Is(this,void 0,void 0,function*(){const e=Zt.commander,n=Z,r=(s=>(c,p)=>this.set(s,c,p)).bind(this),o=this.processor.bind(this);e.version(n.version).usage("[options] <file ...>").option("-i, --input [name]","Input file [name]. (Deprecated)").option("-o, --output [name]","Output file [name]. Defaults to stdout.").option("-d, --domain [name]","Speech rule set [name]. See --options for details.",r(O.DOMAIN),D.DEFAULT_VALUES[O.DOMAIN]).option("-s, --style [name]","Speech style [name]. See --options for details.",r(O.STYLE),D.DEFAULT_VALUES[O.STYLE]).option("-c, --locale [code]","Locale [code].",r(O.LOCALE),D.DEFAULT_VALUES[O.LOCALE]).option("-b, --modality [name]","Modality [name].",r(O.MODALITY),D.DEFAULT_VALUES[O.MODALITY]).option("-k, --markup [name]","Generate speech output with markup tags.",r("markup"),"none").option("-e, --automark","Automatically set marks for external reference.",r("automark")).option("-L, --linebreaks","Linebreak marking in 2D output.",r("linebreaks")).option("-r, --rate [value]","Base rate [value] for tagged speech output.",r("rate"),"100").option("-p, --speech","Generate speech output (default).",()=>o("speech")).option("-a, --audit","Generate auditory descriptions (JSON format).",()=>o("description")).option("-j, --json","Generate JSON of semantic tree.",()=>o("json")).option("-J, --vis","Generate JSON for semantic visualization.",()=>o("vis")).option("-x, --xml","Generate XML of semantic tree.",()=>o("semantic")).option("-m, --mathml","Generate enriched MathML.",()=>o("enriched")).option("-u, --rebuild","Rebuild semantic tree from enriched MathML.",()=>o("rebuild")).option("-T, --speechStructure","Return speech structure only.",()=>o("speechStructure")).option("-W, --workerStructure","Return worker speech structure only.",()=>o("workerSpeechStructure")).option("-t, --latex","Accepts LaTeX input for certain locale/modality combinations.",()=>o("latex")).option("-g, --generate <depth>","Include generated speech in enriched MathML (with -m option only).",r("speech"),"none").option("-w, --structure","Include structure attribute in enriched MathML (with -m option only).",r("structure")).option("-A, --aria","Include aria tree annotations MathML (with -m and -w option only).",r("aria")).option("-P, --pprint","Pretty print output whenever possible.",r("pprint")).option("-f, --rules [name]","Loads a local rule file [name].",r("rules")).option("-C, --subiso [name]","Supplementary country code (or similar) for the given locale.",r("subiso")).option("-N, --number","Translate number to word.",()=>o("number")).option("-O, --ordinal","Translate number to ordinal.",()=>o("ordinal"),"ordinal").option("-S, --numeric","Translate number to numeric ordinal.",()=>o("numericOrdinal")).option("-F, --vulgar","Translate vulgar fraction to word. Provide vulgar fraction as slash seperated numbers.",()=>o("vulgar")).option("-v, --verbose","Verbose mode.").option("-l, --log [name]","Log file [name].").option("--opt","List engine setup options. Output as markdown with -P option.").option("--opt-all","List engine setup options for all available locales. Output as markdown with -P option.").on("option:opt",()=>{this.enumerate().then(()=>Lr(0))}).on("option:opt-all",()=>{this.enumerate(!0).then(()=>Lr(0))}).parse(Zt.process.argv),yield uo().then(()=>Ln(this.setup));const i=Zt.commander.opts();i.output&&(this.output=Re.fs.createWriteStream(i.output)),i.verbose&&(yield _.getInstance().init(i.log)),i.input&&this.execute(i.input),Zt.commander.args.length?(Zt.commander.args.forEach(this.execute.bind(this)),uo().then(()=>_.getInstance().exit(()=>Lr(0)))):this.readline()})}runProcessors_(e,n){try{this.processors.length||this.processors.push("speech"),n&&this.processors.forEach(r=>e(r,n))}catch(r){console.error(r.name+": "+r.message),_.getInstance().exit(()=>Zt.process.exit(1))}}readExpression_(e){try{const n=e.replace(/(&|#|;)/g,"");this.dp.parseFromString(n,"text/xml")}catch{return!1}return!0}}Zt.process=Re.extRequire("process"),Zt.commander=Re.documentSupported||Re.webworker?null:Re.extRequire("commander").program;const Jd=Zt,qd=x})(),di})())})),il=nf(sf(),1),sl=il.default??il;sl.setupEngine(of());var lf=sl;export{lf as default};